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

Sdk

v0.16.0 Upgrade Guide

Nextmv SDK

  • Set your go.mod requirements to match the new version.
require (
   github.com/nextmv-io/code/engines v0.16.0
   github.com/nextmv-io/code/hop v0.16.0
)
Copy

The Expander.Expand() method now returns an additional bool value which indicates whether the expander can be queried for additional states. As a result you have to add this bool to your implementations of the Expander interface, for example, when you are passing a function to expand.Lazy(). Before this change you would return nil as the sentinel value to inform hop to not expand a state any further. Now you can return false when you want to stop expansion.

return expand.Lazy(func() model.State {
    return myState{}
})
Copy

The signatures of Assigner.Assign and VehicleSorter received and additional rand.Rand parameter that can be used to add randomization to their respective implementations. Importantly this ensures deterministic behavior (as long as only one thread is used) when re-running the same input with randomization.

type Assigner interface {
    // Assign determines the next assignment based on the current state.
    Assign(State) Assignment
    ...
}

func DefaultVehicleSorter(s State, locations, vehicles model.IntDomain) []int {
}
Copy

Page last updated