GithubHelp home page GithubHelp logo

aeolun / tspwc Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dcmox/tspwc

0.0 1.0 0.0 50 KB

Traveling Salesman Problem - With Conditions

License: GNU General Public License v3.0

JavaScript 63.89% TypeScript 34.10% HTML 2.01%

tspwc's Introduction

Traveling Salesman Problem - With Conditions

Whether you need to find the optimal route regardless of conditions or you have conditions based on time windows and load capacity, tsp-wc will help you find the shortest route.

Demo app to find optimal route

Sample Usage

See the sample file in TypeScript to see how it can be used in your Node.js projects. The core function (solve) is in tspwc.ts and takes the following parameters:

stops: ITspStop (required)
initialTime: Date (optional)
initialLoad: number (optional) - initial load capacity, generally set to 100
ignoreConditions: boolean (optional) - this will ignore conditions passed into stops
initialPath: [0] (optional, not recommended to change)

ITspStop is defined as follows:

export interface ITspStop {
    id: string,
    arriveBetween?: Date[],
    arriveAfter?: Date,
    arriveBy?: Date,
    load?: number,
    times: number[],
    startTime?: Date
}

HTML

See tests/demo.html to learn more about how to incorporate this into your project via HTML and JS or tests/usage.ts for an example on how to tspwc with NodeJS and TypeScript. We have included a browser-friendly version of tspwc that you can find here. Please note that you will need your own Google API key to test this with both Maps and Directions API enabled on your Google Account.

Available Scripts

In the project directory, you can run:

npm run build

Builds [tspwc.ts] and tests/usage.ts into JS files for usage. usage.ts is a demo of the script being used in Typescript while tests/demo.html provides a demonstration of usage within the browser.

npm run test-usage

Runs the sample usage.js file which should output a log in your console.

Learn More

You can learn more about the developer here.

tspwc's People

Watchers

 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.