sat: Fix golang doc

This commit is contained in:
Corentin Le Molgat
2024-09-30 11:17:31 +02:00
parent 129038009b
commit df4b32b4a4
7 changed files with 32 additions and 32 deletions

View File

@@ -227,8 +227,8 @@ import (
"fmt"
log "github.com/golang/glog"
"github.com/google/or-tools/ortools/sat/go/cpmodel"
cmpb "github.com/google/or-tools/ortools/sat/proto/cpmodel"
"ortools/sat/go/cpmodel"
)
func simpleSatProgram() error {

View File

@@ -114,7 +114,7 @@ package main
import (
log "github.com/golang/glog"
"ortools/sat/go/cpmodel"
"github.com/google/or-tools/ortools/sat/go/cpmodel"
)
func literalSampleSat() {
@@ -248,7 +248,7 @@ public class BoolOrSampleSat
package main
import (
"ortools/sat/go/cpmodel"
"github.com/google/or-tools/ortools/sat/go/cpmodel"
)
func boolOrSampleSat() {
@@ -434,7 +434,7 @@ public class ReifiedSampleSat
package main
import (
"ortools/sat/go/cpmodel"
"github.com/google/or-tools/ortools/sat/go/cpmodel"
)
func reifiedSampleSat() {
@@ -526,9 +526,9 @@ import (
"fmt"
log "github.com/golang/glog"
"github.com/google/or-tools/ortools/sat/go/cpmodel"
sppb "github.com/google/or-tools/ortools/sat/proto/satparameters"
"google.golang.org/protobuf/proto"
"ortools/sat/go/cpmodel"
)
func booleanProductSample() error {
@@ -552,11 +552,11 @@ func booleanProductSample() error {
}
// Set `fill_additional_solutions_in_response` and `enumerate_all_solutions` to true so
// the solver returns all solutions found.
params := sppb.SatParameters_builder{
params := &sppb.SatParameters{
FillAdditionalSolutionsInResponse: proto.Bool(true),
EnumerateAllSolutions: proto.Bool(true),
SolutionPoolSize: proto.Int32(4),
}.Build()
}
response, err := cpmodel.SolveCpModelWithParameters(m, params)
if err != nil {
return fmt.Errorf("failed to solve the model: %w", err)

View File

@@ -309,10 +309,10 @@ import (
"fmt"
log "github.com/golang/glog"
"github.com/google/or-tools/ortools/sat/go/cpmodel"
cmpb "github.com/google/or-tools/ortools/sat/proto/cpmodel"
sppb "github.com/google/or-tools/ortools/sat/proto/satparameters"
"google.golang.org/protobuf/proto"
"ortools/sat/go/cpmodel"
)
func channelingSampleSat() error {
@@ -344,12 +344,12 @@ func channelingSampleSat() error {
if err != nil {
return fmt.Errorf("failed to instantiate the CP model: %w", err)
}
params := sppb.SatParameters_builder{
params := &sppb.SatParameters{
FillAdditionalSolutionsInResponse: proto.Bool(true),
EnumerateAllSolutions: proto.Bool(true),
SolutionPoolSize: proto.Int32(11),
SearchBranching: sppb.SatParameters_FIXED_SEARCH.Enum(),
}.Build()
}
response, err := cpmodel.SolveCpModelWithParameters(m, params)
if err != nil {
return fmt.Errorf("failed to solve the model: %w", err)
@@ -896,7 +896,7 @@ import (
"fmt"
log "github.com/golang/glog"
"ortools/sat/go/cpmodel"
"github.com/google/or-tools/ortools/sat/go/cpmodel"
)
const (

View File

@@ -276,8 +276,8 @@ import (
"fmt"
log "github.com/golang/glog"
"github.com/google/or-tools/ortools/sat/go/cpmodel"
cmpb "github.com/google/or-tools/ortools/sat/proto/cpmodel"
"ortools/sat/go/cpmodel"
)
const numAnimals = 20
@@ -676,10 +676,10 @@ import (
"fmt"
log "github.com/golang/glog"
"github.com/google/or-tools/ortools/sat/go/cpmodel"
cmpb "github.com/google/or-tools/ortools/sat/proto/cpmodel"
sppb "github.com/google/or-tools/ortools/sat/proto/satparameters"
"google.golang.org/protobuf/proto"
"ortools/sat/go/cpmodel"
)
const (
@@ -719,12 +719,12 @@ func earlinessTardinessCostSampleSat() error {
if err != nil {
return fmt.Errorf("failed to instantiate the CP model: %w", err)
}
params := sppb.SatParameters_builder{
params := &sppb.SatParameters{
FillAdditionalSolutionsInResponse: proto.Bool(true),
EnumerateAllSolutions: proto.Bool(true),
SolutionPoolSize: proto.Int32(21),
SearchBranching: sppb.SatParameters_FIXED_SEARCH.Enum(),
}.Build()
}
response, err := cpmodel.SolveCpModelWithParameters(m, params)
if err != nil {
return fmt.Errorf("failed to solve the model: %w", err)
@@ -1132,10 +1132,10 @@ import (
"fmt"
log "github.com/golang/glog"
"github.com/google/or-tools/ortools/sat/go/cpmodel"
cmpb "github.com/google/or-tools/ortools/sat/proto/cpmodel"
sppb "github.com/google/or-tools/ortools/sat/proto/satparameters"
"google.golang.org/protobuf/proto"
"ortools/sat/go/cpmodel"
)
func stepFunctionSampleSat() error {
@@ -1185,12 +1185,12 @@ func stepFunctionSampleSat() error {
if err != nil {
return fmt.Errorf("failed to instantiate the CP model: %w", err)
}
params := sppb.SatParameters_builder{
params := &sppb.SatParameters{
FillAdditionalSolutionsInResponse: proto.Bool(true),
EnumerateAllSolutions: proto.Bool(true),
SolutionPoolSize: proto.Int32(21),
SearchBranching: sppb.SatParameters_FIXED_SEARCH.Enum(),
}.Build()
}
response, err := cpmodel.SolveCpModelWithParameters(m, params)
if err != nil {
return fmt.Errorf("failed to solve the model: %w", err)

View File

@@ -311,8 +311,8 @@ import (
"fmt"
log "github.com/golang/glog"
"github.com/google/or-tools/ortools/sat/go/cpmodel"
cmpb "github.com/google/or-tools/ortools/sat/proto/cpmodel"
"ortools/sat/go/cpmodel"
)
func solutionHintingSampleSat() error {

View File

@@ -196,7 +196,7 @@ import (
"fmt"
log "github.com/golang/glog"
"ortools/sat/go/cpmodel"
"github.com/google/or-tools/ortools/sat/go/cpmodel"
)
const horizon = 100
@@ -422,7 +422,7 @@ import (
"fmt"
log "github.com/golang/glog"
"ortools/sat/go/cpmodel"
"github.com/google/or-tools/ortools/sat/go/cpmodel"
)
const horizon = 100
@@ -842,8 +842,8 @@ import (
"fmt"
log "github.com/golang/glog"
"github.com/google/or-tools/ortools/sat/go/cpmodel"
cmpb "github.com/google/or-tools/ortools/sat/proto/cpmodel"
"ortools/sat/go/cpmodel"
)
const horizon = 21 // 3 weeks
@@ -1866,8 +1866,8 @@ import (
"fmt"
log "github.com/golang/glog"
"github.com/google/or-tools/ortools/sat/go/cpmodel"
cmpb "github.com/google/or-tools/ortools/sat/proto/cpmodel"
"ortools/sat/go/cpmodel"
)
const (

View File

@@ -195,10 +195,10 @@ import (
"fmt"
log "github.com/golang/glog"
"github.com/google/or-tools/ortools/sat/go/cpmodel"
cmpb "github.com/google/or-tools/ortools/sat/proto/cpmodel"
sppb "github.com/google/or-tools/ortools/sat/proto/satparameters"
"google.golang.org/protobuf/proto"
"ortools/sat/go/cpmodel"
)
func solveWithTimeLimitSampleSat() error {
@@ -217,9 +217,9 @@ func solveWithTimeLimitSampleSat() error {
}
// Sets a time limit of 10 seconds.
params := sppb.SatParameters_builder{
params := &sppb.SatParameters{
MaxTimeInSeconds: proto.Float64(10.0),
}.Build()
}
// Solve.
response, err := cpmodel.SolveCpModelWithParameters(m, params)
@@ -536,9 +536,9 @@ import (
"fmt"
log "github.com/golang/glog"
"github.com/google/or-tools/ortools/sat/go/cpmodel"
sppb "github.com/google/or-tools/ortools/sat/proto/satparameters"
"google.golang.org/protobuf/proto"
"ortools/sat/go/cpmodel"
)
func solveAndPrintIntermediateSolutionsSampleSat() error {
@@ -562,10 +562,10 @@ func solveAndPrintIntermediateSolutionsSampleSat() error {
// Currently, the CpModelBuilder does not allow for callbacks, so intermediate solutions
// cannot be printed while solving. However, the CP-SAT solver does allow for returning
// the intermediate solutions found while solving in the response.
params := sppb.SatParameters_builder{
params := &sppb.SatParameters{
FillAdditionalSolutionsInResponse: proto.Bool(true),
SolutionPoolSize: proto.Int32(10),
}.Build()
}
response, err := cpmodel.SolveCpModelWithParameters(m, params)
if err != nil {
return fmt.Errorf("failed to solve the model: %w", err)
@@ -873,9 +873,9 @@ import (
"fmt"
log "github.com/golang/glog"
"github.com/google/or-tools/ortools/sat/go/cpmodel"
sppb "github.com/google/or-tools/ortools/sat/proto/satparameters"
"google.golang.org/protobuf/proto"
"ortools/sat/go/cpmodel"
)
func searchForAllSolutionsSampleSat() error {
@@ -895,11 +895,11 @@ func searchForAllSolutionsSampleSat() error {
// Currently, the CpModelBuilder does not allow for callbacks, so each feasible solution cannot
// be printed while solving. However, the CP Solver can return all of the enumerated solutions
// in the response by setting the following parameters.
params := sppb.SatParameters_builder{
params := &sppb.SatParameters{
EnumerateAllSolutions: proto.Bool(true),
FillAdditionalSolutionsInResponse: proto.Bool(true),
SolutionPoolSize: proto.Int32(27),
}.Build()
}
response, err := cpmodel.SolveCpModelWithParameters(m, params)
if err != nil {
return fmt.Errorf("failed to solve the model: %w", err)