@types/salesman.js
TypeScript icon, indicating that this package has built-in type declarations

2.0.2 • Public • Published

Installation

npm install --save @types/salesman.js

Summary

This package contains type definitions for salesman.js (https://github.com/lovasoa/salesman.js).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/salesman.js.

index.d.ts

/**
 * Solves the following problem:
 *  Given a list of points and the distances between each pair of points,
 *  what is the shortest possible route that visits each point exactly
 *  once and returns to the origin point?
 *
 * @param points The points that the path will have to visit.
 * @param [temp_coeff=0.999] changes the convergence speed of the algorithm: the closer to 1, the slower the algorithm and the better the solutions.
 * @param [callback=] An optional callback to be called after each iteration.
 *
 * @returns An array of indexes in the original array. Indicates in which order the different points are visited.
 *
 * @example
 * var points = [
 *       new salesman.Point(2,3)
 *       //other points
 *     ];
 * var solution = salesman.solve(points);
 * var ordered_points = solution.map(i => points[i]);
 * // ordered_points now contains the points, in the order they ought to be visited.
 */
export function solve(points: Point[], temp_coeff?: number, callback?: (order: number[]) => void): number[];

export class Point {
    /**
     * Represents a point in two dimensions.
     * @param x abscissa
     * @param y ordinate
     */
    constructor(x: number, y: number);
    x: number;
    y: number;
}

Additional Details

  • Last updated: Tue, 07 Nov 2023 15:11:36 GMT
  • Dependencies: none

Credits

These definitions were written by Josh Peaker.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/salesman.js

Weekly Downloads

15

Version

2.0.2

License

MIT

Unpacked Size

5.01 kB

Total Files

5

Last publish

Collaborators

  • types