npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

re.order

v0.0.1

Published

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

Downloads

10

Readme

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