re.order

0.0.1 • Public • Published

re.order

An extremely fast pathfinder tool/algorithm to determine optimal order execution sequence.

It considers:

  • Vehicle disposition start and end time (time window).
  • Vehicle load capacity.
  • Vehicle start position.
  • Order load capacity changes.
  • Order dependencies (to other orders): sequencing.
  • Order commute time to destination.
  • Order job duration.
  • Order latest start/end time.

Two different modes are available:

  • All or nothing: If there is no solution to complete all of the given orders, with the given conditions, nothing will be returned.
  • As many as possible: complete as many orders as possible.

If multiple solutions exist, the fastest one is returned.

Since this library is extremely fast (it is only bound by the speed of your routing calculation service/script), it is possible to calculate optimal order execution "on the fly". That means, if a vehicle on its way to an order encounters a traffic jam, it might be faster to complete another order in that time. A "live" order re-calculation would save time and money.

Getting Started

This is a node.js ibrary. Hence, it can be used in any JS project. It does not have any dependencies.

Installing

npm install re.order

Or with yarn

npm add re.order

Or check out the project and build locally

Running the tests

yarn run test

Usage

You create a runner and pass your orders, the returned result contains an array of orders with the end time all the orders will be completed by:

const { createReOrder } = require('re.order')
const run = createReOrder(options)
const result = run(orders)

// => { endTime: 2017-07-05T07:15:00.000Z, orders: [...] }

Following options are possible (asterisk = required):

  • *getDuration(start, destination, startTime): given a start and destination positions and a starting date time, your function shoul return a duration in seconds, how long it would take to go from start to the destination. It is up to you to provide this functionality, by hooking to your routing API or any other means.
  • mode: 'asmany' (default) or 'allornothing'
  • startPosition: of the vehicle
  • startTime and endTime: timeframe for the orders to be executed. This could be an availability window of the vehicle. You can provide one, both or neither.
  • loadCapacity: maximal capacity of the vehicle. 0 = unlimited or not considered.

The orders you pass to re.order should have the following properties (asterisk = required):

  • *id: unique id of the order
  • *destination: position where the order should be executed
  • dependencies: array of order ids that should be executed before this order
  • startLatest: Datetime, before which this order should be started.
  • finishLatest: Datetime, before which this order should be finished.
  • load: positive or negative load value. Example: pickup order = +X, delivery order = -Y.
  • jobDuration: in seconds, how long it takes to complete the given job at the destination.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Package Sidebar

Install

npm i re.order

Homepage

semkodev.com

Weekly Downloads

2

Version

0.0.1

License

MIT

Unpacked Size

20.8 kB

Total Files

6

Last publish

Collaborators

  • vsemko
  • romansemko