Giter Site home page Giter Site logo

traveling-salesperson-qio-maps's Introduction

Traveling Salesperson QIO Demo

This repo contains everything you need to show how traveling salesperson problems can be solved with Azure Quantum QIO jobs via an integrated solution that also involves Azure Maps service. Jobs can be submitted by uploading JSON-files to blob storage.

Architecture

Getting Started

Create a fork of this repository

Click on the Fork button in the upper right corner of this page.

Fork Button

You'll get asked for an organization to fork this repo to. Select your organization.

Create Azure Credentials

Follow instructions on Deploy ARM templates by using GitHub Actions for creating deployment credentials for GitHub. This includes creating a service principal and assigning Contributor-role to the principal.

Configure Actions secrets

Configure two Actions secrets:

  • AZURE_CREDENTIALS with the output generated during the service principal creation.
  • AZURE_SUBSCRIPTION with the Azure subscription ID.

Change the workflows (if needed)

You might want to change following settings in the CD-Full-Deployment.yml-file:

  • AZURE_RESOURCE_GROUP_NAME - the resource group the deployment should be targeted to
  • AZURE_RESOURCE_GROUP_LOCATION - the region of all deployment artifacts (including the resource group)
  • AZURE_FUNCTIONAPP_NAME - name of the application (names of other resources will be derived from)

Commit your changes. This will trigger the GitHub action that creates a resource group and deploys the application. The whole process takes a few minutes (when triggered on an empty subscription).

Call the function

After the deployment is complete, you can call the Function via following URL:

https://<AZURE_FUNCTIONAPP_NAME>.azurewebsites.net/api/GetRoute

In the request body provide a JSON-file with addresses of the desired destinations similar to the following (containing the addresses of German Microsoft regional offices):

{
    "problem": {
        "type": "travelingsalesperson",
        "optimizeBy": "travelTimeInSeconds",
        "data": {
            "destinations": [
                "Walter-Gropius-Straße 5, 80807 München",
                "Meitnerstraße 9, 70563 Stuttgart",
                "Holzmarkt 2a, 50676 Köln",
                "Axel-Springer-Platz 3, 20355 Hamburg",
                "Friedrich-Ebert-Anlage 49, 60308 Frankfurt",
                "Unter den Linden 17, 10117 Berlin",
                "Altrottstraße 31, 69190 Walldorf"
            ]
        }
    } 
}

Note that you can specify via the optimizeBy-parameter, whether you want to optimize by travel time (value: travelTimeInSeconds) or travel distance (lengthInMeters).

As result you'll receive a JSON-response with an ordered list of travel points, similar to the following:

{
  "result": {
    "Route": {
      "0": "Walter-Gropius-Straße 5, 80807 München",
      "1": "Meitnerstraße 9, 70563 Stuttgart",
      "2": "Altrottstraße 31, 69190 Walldorf",
      "3": "Friedrich-Ebert-Anlage 49, 60308 Frankfurt",
      "4": "Holzmarkt 2a, 50676 Köln",
      "5": "Axel-Springer-Platz 3, 20355 Hamburg",
      "6": "Unter den Linden 17, 10117 Berlin",
      "7": "Walter-Gropius-Straße 5, 80807 München"
    },
    "RouteCost": {
      "Cost": 62563.0
    }
  }
}

Clean up resources

    az group delete --name myResourceGroup

traveling-salesperson-qio-maps's People

Contributors

ailobstercan avatar hsirtl avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.