Nextand other methods in the [example app][dispatch-app]. Since
Pathis exported, Hop will automatically serialize it as the model output. All we must do is hook up the input type to a runner, construct a state, and return a solver operating on that state.
go buildour model into a binary, it will read
inputstructures from standard input and write
statestructures to standard output. An alternative to using standard input and output is to use the
input.jsonlocated in the
Numberserves as a unique identifier in the simulation,
Arrivalis the number of minutes since the beginning of the simulation that the customer enters the queue and
Serviceis the number of minutes required to service that customer.
customerstruct as an actor in our simulation, it must have a
Runmethod which takes a
time.Timevalue as an argument and returns a new
time.Timevalue and a boolean:
Runwas successful, and
falseif it was not. The specifics for what happens in the
Runmethod are up to you. Refer to the Single-Server Queue example for inspiration.
jsonannotations on our structs.
MarshalJSONmethods for the types as shown in the Go docs.
statetype is written when solutions are found. Say we implement a
statethat estimates the time to complete a path and returns a
time.Duration. We add that to our model output with a
MarshalJSONmethod. We also add the request list from the input.