Skip to content

Implementation of VROOM (Vehicle Routing Open-Source Optimization Machine) HTTP client.

License

Notifications You must be signed in to change notification settings

wesleimp/vroom-elixir

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vroom-elixir

Implementation of VROOM (Vehicle Routing Open-Source Optimization Machine) HTTP client for Elixir.

Usage

Install

defp deps() do
  [
    {:vroom, "~> 0.1.0"}
  ]
end

Configuration

# config/config.exs

config :vroom,
    url: "VROOM URL",
    timeout: 15000

# config/prod.exs

config :vroom,
    url: "VROOM URL PROD"

Example

defmodule Router do
  def solve_route do
    shipment = %VROOM.Shipment{
      amount: [1],
      pickup: %VROOM.Shipment.Step{
        id: 1,
        description: "Pickup #1",
        location: [
          -49.273080825805664,
          -25.437422762495064
        ]
      },
      delivery: %VROOM.Shipment.Step{
        id: 2,
        description: "Delivery #1",
        location: [
          -49.264068603515625,
          -25.436686416884992
        ]
      }
    }

    vehicle = %VROOM.Vehicle{
      capacity: [3],
      description: "John Doe",
      id: 1,
      profile: "car",
      start: [
        -49.273080825805664,
        -25.437422762495064
      ]
    }

    %{"code" => 0, "routes" => routes} = VROOM.solve([vehicle], [shipment], [], %{g: true})

    routes
  end
end

For more info, check out the docs

About

Implementation of VROOM (Vehicle Routing Open-Source Optimization Machine) HTTP client.

Topics

Resources

License

Stars

Watchers

Forks

Languages