Skip to content

Commit

Permalink
Merge pull request #164 from nextmv-io/develop
Browse files Browse the repository at this point in the history
Release v0.20.11
  • Loading branch information
merschformann authored Jan 18, 2023
2 parents 39b781c + bba6cd4 commit bf63490
Show file tree
Hide file tree
Showing 15 changed files with 34 additions and 20 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.20.10
v0.20.11
2 changes: 1 addition & 1 deletion route/google/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.19
replace github.com/nextmv-io/sdk => ../../.

require (
github.com/nextmv-io/sdk v0.20.10
github.com/nextmv-io/sdk v0.20.11
googlemaps.github.io/maps v1.3.2
)

Expand Down
2 changes: 1 addition & 1 deletion route/here/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ replace github.com/nextmv-io/sdk => ../../.

require (
github.com/google/go-cmp v0.5.6
github.com/nextmv-io/sdk v0.20.10
github.com/nextmv-io/sdk v0.20.11
)

require golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
2 changes: 1 addition & 1 deletion route/osrm/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ replace github.com/nextmv-io/sdk => ../../.
require (
github.com/golang/mock v1.6.0
github.com/hashicorp/golang-lru v0.5.4
github.com/nextmv-io/sdk v0.20.10
github.com/nextmv-io/sdk v0.20.11
)

require github.com/twpayne/go-polyline v1.1.1
2 changes: 1 addition & 1 deletion route/routingkit/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ replace github.com/nextmv-io/sdk => ../../.
require (
github.com/dgraph-io/ristretto v0.1.0
github.com/nextmv-io/go-routingkit v0.1.10
github.com/nextmv-io/sdk v0.20.10
github.com/nextmv-io/sdk v0.20.11
)

require (
Expand Down
2 changes: 1 addition & 1 deletion templates/cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ as expected:

```bash
nextmv run local . -- -runner.input.path input.json \
-runner.output.path output.json -duration 10s
-runner.output.path output.json -limits.duration 10s
```

A file `output.json` should have been created with a clustering solution
Expand Down
6 changes: 4 additions & 2 deletions templates/cluster/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ type Output struct {

// ClusterOptions holds the options for the solver.
type ClusterOptions struct {
Duration time.Duration `json:"duration" default:"10s"`
Limits struct {
Duration time.Duration `json:"duration" default:"10s"`
} `json:"limits"`
}

func main() {
Expand Down Expand Up @@ -81,7 +83,7 @@ func solver(input input, opts ClusterOptions) ([]Output, error) {
// and the measure to use.
solveOptions := kmeans.NewSolveOptions().
SetMeasure(measure.EuclideanByPoint()).
SetMaximumDuration(opts.Duration)
SetMaximumDuration(opts.Limits.Duration)

solution, err := solver.Solve(solveOptions)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion templates/cluster/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func TestTemplate(t *testing.T) {

// Declare the options.
opt := ClusterOptions{}
opt.Duration = 5 * time.Second
opt.Limits.Duration = 5 * time.Second

// Declare the solver.
output, err := solver(input, opt)
Expand Down
6 changes: 4 additions & 2 deletions templates/mip-incentive-allocation/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ type Option struct {
// here in case no duration limit is set. For local runs there is no time
// limitation. If you want to make cloud runs for longer than 5 minutes,
// please contact: [email protected]
Duration time.Duration `json:"duration" default:"10s"`
Limits struct {
Duration time.Duration `json:"duration" default:"10s"`
} `json:"limits"`
}

// Output is the output of the solver.
Expand Down Expand Up @@ -111,7 +113,7 @@ func solver(
solveOptions := mip.NewSolveOptions()

// Limit the solve to a maximum duration.
err = solveOptions.SetMaximumDuration(opts.Duration)
err = solveOptions.SetMaximumDuration(opts.Limits.Duration)
if err != nil {
return nil, err
}
Expand Down
4 changes: 3 additions & 1 deletion templates/mip-incentive-allocation/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ func TestTemplate(t *testing.T) {
}

// Declare the output.
output, err := solver(input, Option{Duration: 5 * time.Second})
options := Option{}
options.Limits.Duration = 5 * time.Second
output, err := solver(input, options)
if err != nil {
t.Fatal(err)
}
Expand Down
6 changes: 4 additions & 2 deletions templates/mip-knapsack/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ type Option struct {
// here in case no duration limit is set. For local runs there is no time
// limitation. If you want to make cloud runs for longer than 5 minutes,
// please contact: [email protected]
Duration time.Duration `json:"duration" default:"10s"`
Limits struct {
Duration time.Duration `json:"duration" default:"10s"`
} `json:"limits"`
}

// Output is the output of the solver.
Expand Down Expand Up @@ -100,7 +102,7 @@ func solver(input input, opts Option) ([]Output, error) {
solveOptions := mip.NewSolveOptions()

// Limit the solve to a maximum duration
if err = solveOptions.SetMaximumDuration(opts.Duration); err != nil {
if err = solveOptions.SetMaximumDuration(opts.Limits.Duration); err != nil {
return nil, err
}

Expand Down
4 changes: 3 additions & 1 deletion templates/mip-knapsack/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ func TestTemplate(t *testing.T) {
}

// Declare the output.
output, err := solver(input, Option{Duration: 5 * time.Second})
options := Option{}
options.Limits.Duration = 5 * time.Second
output, err := solver(input, options)
if err != nil {
t.Fatal(err)
}
Expand Down
6 changes: 4 additions & 2 deletions templates/mip-meal-allocation/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ type Option struct {
// here in case no duration limit is set. For local runs there is no time
// limitation. If you want to make cloud runs for longer than 5 minutes,
// please contact: [email protected]
Duration time.Duration `json:"duration" default:"10s"`
Limits struct {
Duration time.Duration `json:"duration" default:"10s"`
} `json:"limits"`
}

// Output is the output of the solver.
Expand Down Expand Up @@ -146,7 +148,7 @@ func solver(input input, opts Option) ([]Output, error) {
solveOptions := mip.NewSolveOptions()

// Limit the solve to a maximum duration
if err = solveOptions.SetMaximumDuration(opts.Duration); err != nil {
if err = solveOptions.SetMaximumDuration(opts.Limits.Duration); err != nil {
return nil, err
}

Expand Down
4 changes: 3 additions & 1 deletion templates/mip-meal-allocation/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ func TestTemplate(t *testing.T) {
}

// Declare the output.
output, err := solver(input, Option{Duration: 5 * time.Second})
options := Option{}
options.Limits.Duration = 5 * time.Second
output, err := solver(input, options)
if err != nil {
t.Fatal(err)
}
Expand Down
4 changes: 2 additions & 2 deletions templates/routing-matrix-input/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ Before you start customizing run the command below to see if everything works as
expected:

```bash
nextmv run local . -- -hop.runner.input.path input.json\
-hop.runner.output.path output.json -hop.solver.limits.duration 10s
nextmv run local . -- -runner.input.path input.json\
-runner.output.path output.json -limits.duration 10s
```

A file `output.json` should have been created with a VRP solution.
Expand Down

0 comments on commit bf63490

Please sign in to comment.