You are viewing Nextmv legacy docs. ⚡️ Go to latest docs ⚡️

Sdk

v0.8.0 Upgrade Guide

Nextmv SDK

To upgrade to this version a few steps are necessary. To make your upgrade as smooth as possible, we give a step by step introduction which covers the minimum steps required to upgrade from version 0.7.3 to 0.8.0. Please keep in mind that, depending on your own code customizations, additional steps might be necessary.

  • Set your go.mod requirements to match the new version.
require (
   github.com/nextmv-io/code/engines v0.8.0
   github.com/nextmv-io/code/hop v0.8.0
)
Copy
  • Search for hopm and replace all occurrences in the import statements for engines (i.e., github.com/nextmv-io/code/hopm is now github.com/nextmv-io/code/engines).
  • To configure a window constraint, you now have to pass five instead of three arguments. If you used a stop_duration or maxWait_time in your measure, remove it there and pass them to the window method. Note that the length of the slice must match the length of your window constraint's slice. If you do not use them, you can simply pass nil.
routeVehicle.Window(
   int(vehicle.ShiftStart.Unix()),
   windows,
   measurer,
   nil,
   nil,
)
Copy
  • Note that default UnassignedPenalties behavior has changed.

    • If no unassigned penalties are provided, assignment will be enforced (note, this could result in no feasible solutions being returned).
    • If unassigned penalties are provided, assignment will not be enforced. Unassignment will be discouraged (more or less, based on the penalty value).
    • If you are using a custom penalty in your value function to penalize unassigned locations, please remove it from there.

    If you solve a VRP, use UnassignedPenaltyfor all stops in your input.json and read it in your input.go.

    • Extend stop struct with new field UnassignedPenalty, read your json input.
    • Double check that your input data has values set for UnassignedPenalty. If you don't set this data, they will be set to zero and, thus, will not be assigned to your routes.
    • Make a slice of your UnassignedPenalty indexed by stop and pass it to your fleet schema.
return fleetSchema.Fleet{
   Locations:           locations,
   Vehicles:            vehicles,
   UnassignedPenalties: unassignedPenalties,
}
Copy
  • Change deprecated Haversine methods, if necessary. The following code snipped should help you when applying the new method.
measure.HaversineByIndex(point)
Copy
  • The Next() method now takes an argument and has changed to Next(ctx context.Context). If you are calling it, the argument to pass is context.Background().

Page last updated