vroom

package module
v0.0.0-...-2dcfb48 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 29, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

README

vroom

Simple library to generate json iv vroom format

Also includes service to use vroom binary via http

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrLocationNotDefined = errors.New("location is not defined")

Functions

This section is empty.

Types

type Client

type Client struct {
	Url string
}

func NewClient

func NewClient(url string) *Client

func (*Client) Solve

func (c *Client) Solve(p *Problem) (*Solution, error)

type Job

type Job struct {
	//Id            int       `json:"id"`
	//Description   string    `json:"description"`
	//Location      *Location `json:"location"`
	//LocationIndex *int      `json:"location_index"`
	//locationID    int
	//Setup         int     `json:"setup"`
	//Service       int     `json:"service"`
	ShipmentStep
	TimeWindows [][]int `json:"time_windows,omitempty"`
	Delivery    []int   `json:"delivery,omitempty"`
	Pickup      []int   `json:"pickup,omitempty"`
	Skills      []int   `json:"skills,omitempty"`
	Priority    int     `json:"priority"`
	// contains filtered or unexported fields
}

func (*Job) SetDelivery

func (j *Job) SetDelivery(d []int) *Job

func (*Job) SetLocationId

func (j *Job) SetLocationId(locationId int) *Job

func (*Job) SetMeasuredDelivery

func (j *Job) SetMeasuredDelivery(m Measurement, val int) *Job

func (*Job) SetMeasuredPickup

func (j *Job) SetMeasuredPickup(m Measurement, val int) *Job

func (*Job) SetPickup

func (j *Job) SetPickup(p []int) *Job

func (*Job) SetPriority

func (j *Job) SetPriority(p int) *Job

func (*Job) SetSkills

func (j *Job) SetSkills(s []int) *Job

func (*Job) SetTimeWindows

func (j *Job) SetTimeWindows(tw [][]int) *Job

type Location

type Location [2]float64

type Measurement

type Measurement int
const (
	MeasVolume Measurement = iota
	MeasWeight
	MeasAre
	MeasPLL
)

type Problem

type Problem struct {
	Vehicles  []*Vehicle  `json:"vehicles"`
	Jobs      []*Job      `json:"jobs,omitempty"`
	Shipments []*Shipment `json:"shipments,omitempty"`
	// contains filtered or unexported fields
}

func (*Problem) AddJob

func (p *Problem) AddJob(j *Job) *Problem

func (*Problem) AddShipment

func (p *Problem) AddShipment(s *Shipment) *Problem

func (*Problem) AddVehicle

func (p *Problem) AddVehicle(v *Vehicle) *Problem

func (*Problem) Err

func (p *Problem) Err() error

func (*Problem) FillLocations

func (p *Problem) FillLocations(locationResolver func(locationID int) Location) bool

func (*Problem) GetLocation

func (p *Problem) GetLocation(id int) (loc Location, err error)

func (*Problem) GetMeasurementIndex

func (p *Problem) GetMeasurementIndex(measurement Measurement) int

func (*Problem) NewJob

func (p *Problem) NewJob(id ...int) *Job

func (*Problem) NewShipment

func (p *Problem) NewShipment(id ...int) *Shipment

func (*Problem) NewVehicle

func (p *Problem) NewVehicle(id ...int) *Vehicle

func (*Problem) NextJobId

func (p *Problem) NextJobId() (id int)

func (*Problem) SetCapacity

func (p *Problem) SetCapacity(measurement Measurement, val int, capacities []int) []int

type Route

type Route struct {
	Vehicle     int           `json:"vehicle"`
	Cost        int           `json:"cost"`
	Delivery    []int         `json:"delivery"`
	Pickup      []int         `json:"pickup"`
	Setup       int           `json:"setup"`
	Service     int           `json:"service"`
	Duration    int           `json:"duration"`
	WaitingTime int           `json:"waiting_time"`
	Priority    int           `json:"priority"`
	Distance    int           `json:"distance"`
	Steps       []RouteStep   `json:"steps"`
	Violations  []interface{} `json:"violations"`
	Geometry    string        `json:"geometry"`
}

type RouteStep

type RouteStep struct {
	Type        string        `json:"type"`
	Location    []float64     `json:"location,omitempty"`
	Setup       int           `json:"setup"`
	Service     int           `json:"service"`
	WaitingTime int           `json:"waiting_time"`
	Load        []int         `json:"load"`
	Arrival     int           `json:"arrival"`
	Duration    int           `json:"duration"`
	Violations  []interface{} `json:"violations"`
	Distance    int           `json:"distance"`
	Id          int           `json:"id,omitempty"`
	Job         int           `json:"job,omitempty"`
}

type Shipment

type Shipment struct {
	Pickup   ShipmentStep `json:"pickup"`
	Delivery ShipmentStep `json:"delivery"`
	Amount   []int        `json:"amount,omitempty"`
	Skills   []int        `json:"skills,omitempty"`
	Priority int          `json:"priority"`
	// contains filtered or unexported fields
}

func (*Shipment) SetAmount

func (s *Shipment) SetAmount(a []int) *Shipment

func (*Shipment) SetDeliveryLocationId

func (s *Shipment) SetDeliveryLocationId(locationId int) *Shipment

func (*Shipment) SetMeasuredAmount

func (s *Shipment) SetMeasuredAmount(m Measurement, val int) *Shipment

func (*Shipment) SetPickupLocationId

func (s *Shipment) SetPickupLocationId(locationId int) *Shipment

func (*Shipment) SetPriority

func (s *Shipment) SetPriority(p int) *Shipment

func (*Shipment) SetSkills

func (s *Shipment) SetSkills(skills []int) *Shipment

type ShipmentStep

type ShipmentStep struct {
	Id            int       `json:"id"`
	Description   string    `json:"description,omitempty"`
	Location      *Location `json:"location,omitempty"`
	LocationIndex *int      `json:"location_index,omitempty"`

	Setup       int     `json:"setup,omitempty"`
	Service     int     `json:"service,omitempty"`
	TimeWindows [][]int `json:"time_windows,omitempty"`
	// contains filtered or unexported fields
}

func (*ShipmentStep) SetDescription

func (ss *ShipmentStep) SetDescription(d string) *ShipmentStep

func (*ShipmentStep) SetLocation

func (ss *ShipmentStep) SetLocation(l *Location) *ShipmentStep

func (*ShipmentStep) SetLocationIndex

func (ss *ShipmentStep) SetLocationIndex(idx int) *ShipmentStep

func (*ShipmentStep) SetService

func (ss *ShipmentStep) SetService(s int) *ShipmentStep

func (*ShipmentStep) SetSetup

func (ss *ShipmentStep) SetSetup(s int) *ShipmentStep

func (*ShipmentStep) SetTimeWindows

func (ss *ShipmentStep) SetTimeWindows(tw [][]int) *ShipmentStep

type Solution

type Solution struct {
	Code       int `json:"code"`
	Summary    `json:"summary"`
	Unassigned []interface{} `json:"unassigned"`
	Routes     []Route       `json:"routes"`
}

type Summary

type Summary struct {
	Cost        int           `json:"cost"`
	Routes      int           `json:"routes"`
	Unassigned  int           `json:"unassigned"`
	Delivery    []int         `json:"delivery"`
	Pickup      []int         `json:"pickup"`
	Setup       int           `json:"setup"`
	Service     int           `json:"service"`
	Duration    int           `json:"duration"`
	WaitingTime int           `json:"waiting_time"`
	Priority    int           `json:"priority"`
	Distance    int           `json:"distance"`
	Violations  []interface{} `json:"violations"`
}

type Vehicle

type Vehicle struct {
	Id          int            `json:"id"`
	Profile     VehicleProfile `json:"profile,omitempty"`
	Description string         `json:"description,omitempty"`
	Start       *Location      `json:"start,omitempty"`
	StartIndex  *int           `json:"start_index,omitempty"`

	End      *Location `json:"end,omitempty"`
	EndIndex *int      `json:"end_index,omitempty"`

	Capacity   []int `json:"capacity,omitempty"`
	Costs      []int `json:"costs,omitempty"`
	Skills     []int `json:"skills,omitempty"`
	TimeWindow []int `json:"time_window,omitempty"`
	Breaks     []int `json:"breaks,omitempty"`
	// contains filtered or unexported fields
}

func (*Vehicle) SetBreaks

func (v *Vehicle) SetBreaks(b []int) *Vehicle

func (*Vehicle) SetCapacity

func (v *Vehicle) SetCapacity(c []int) *Vehicle

func (*Vehicle) SetCosts

func (v *Vehicle) SetCosts(c []int) *Vehicle

func (*Vehicle) SetDescription

func (v *Vehicle) SetDescription(d string) *Vehicle

func (*Vehicle) SetEnd

func (v *Vehicle) SetEnd(l *Location) *Vehicle

func (*Vehicle) SetEndId

func (v *Vehicle) SetEndId(locationId int) *Vehicle

func (*Vehicle) SetEndIndex

func (v *Vehicle) SetEndIndex(idx int) *Vehicle

func (*Vehicle) SetMeasuredCapacity

func (v *Vehicle) SetMeasuredCapacity(m Measurement, val int) *Vehicle

func (*Vehicle) SetProfile

func (v *Vehicle) SetProfile(p VehicleProfile) *Vehicle

func (*Vehicle) SetSkills

func (v *Vehicle) SetSkills(s []int) *Vehicle

func (*Vehicle) SetStart

func (v *Vehicle) SetStart(l *Location) *Vehicle

func (*Vehicle) SetStartId

func (v *Vehicle) SetStartId(locationId int) *Vehicle

func (*Vehicle) SetStartIndex

func (v *Vehicle) SetStartIndex(idx int) *Vehicle

func (*Vehicle) SetTimeWindow

func (v *Vehicle) SetTimeWindow(tw []int) *Vehicle

type VehicleProfile

type VehicleProfile string
const (
	VPCar VehicleProfile = "car"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL