Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tspwc

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tspwc

TSP-WC Algorithm - Solving the traveling salesman problem with conditions

  • 1.0.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
decreased by-77.78%
Maintainers
1
Weekly downloads
 
Created
Source

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.

Keywords

FAQs

Package last updated on 07 Feb 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc