Upgrade guide

Nextmv v0.9.0

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.8.0 or 0.8.1 to 0.9.0.

  1. Set your go.mod requirements to match the new version.

    require (
    github.com/nextmv-io/code/engines v0.9.0
    github.com/nextmv-io/code/hop v0.9.0
    )
  2. The model.Domains function was renamed to model.Repeat to better reflect the purpose of this function. All you need to do is rename the function in case you used it. The signature did not change.

  3. The signature of the alns.Destroyer and alns.Repairer interfaces changed. If you have implemented your own Destroyers or Repairers, you will have to add a parameter of type *rand.Rand as outlined below to still implement the respective interface.

    Before:

    type Destroyer interface {
    Destroy(ctx context.Context, m model.Valuer) model.Valuer
    }
    type Repairer interface {
    Repair(ctx context.Context, m model.Valuer) model.Valuer
    }

    After:

    type Destroyer interface {
    Destroy(ctx context.Context, random *rand.Rand, m model.Valuer) model.Valuer
    }
    type Repairer interface {
    Repair(ctx context.Context, random *rand.Rand, m model.Valuer) model.Valuer
    }
  4. The signature of the MaxRouteLengthFilter changed as outlined below. Note that the first parameter changed from a single measure.ByIndex to []measure.ByIndex. For each vehicle you need to pass in one measure.ByIndex. In the simplest case, you can create a []measure.ByIndex with the length of the number of vehicles and set the same measure.ByIndex for all of the vehicles.

    Before:

    func MaxRouteLengthFilter(m measure.ByIndex, routeLengths []float64, ignoreTriangular bool) (VehicleFilter, error)

    After:

    func MaxRouteLengthFilter(m []measure.ByIndex, routeLengths []float64, ignoreTriangular bool) (VehicleFilter, error)

Nextmv v0.8.1

Set your go.mod requirements to match the new version. No additional steps are needed to upgrade to v0.8.1.

require (
github.com/nextmv-io/code/engines v0.8.1
github.com/nextmv-io/code/hop v0.8.1
)

See the release notes or go package docs for more information on what's included in v0.8.1.

Nextmv v0.8.0

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.

  1. 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
    )
  2. 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).

  3. 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
    )
  4. 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 solve a VRP, use UnassignedPenaltyfor all stops in your input.json and read it in your input.go.

    1. Extend stop struct with new field UnassignedPenalty, read your json

      input.

    2. 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.

    3. 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,
      }
    4. If you are using a custom penalty in your value function to penalize unassigned locations, please remove it from there.

  5. Change deprecated Haversine methods, if necessary. The following code snipped should help you when applying the new method.

    Before:

    measure.HaversineByIndex(point)

    After:

    measure.Indexed(measure.HaversineByPoint(), point)
  6. 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().

Nextmv v0.7.1

See the release notes for details on upgrading to Nextmv v0.7.1.

Nextmv v0.7.0

See the release notes for details on upgrading to Nextmv v0.7.0.