Skip to content

Commit

Permalink
sat: update go/cpmodel
Browse files Browse the repository at this point in the history
  • Loading branch information
Mizux committed Sep 27, 2024
1 parent 858d4a7 commit 100b6bc
Show file tree
Hide file tree
Showing 33 changed files with 464 additions and 561 deletions.
1 change: 1 addition & 0 deletions ortools/sat/cp_model.proto
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ syntax = "proto3";
package operations_research.sat;

option csharp_namespace = "Google.OrTools.Sat";
option go_package = "github.com/google/or-tools/ortools/sat/proto/cpmodel";
option java_package = "com.google.ortools.sat";
option java_multiple_files = true;
option java_outer_classname = "CpModelProtobuf";
Expand Down
6 changes: 3 additions & 3 deletions ortools/sat/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,8 @@ package main
import (
"fmt"

"github.com/golang/glog"
cmpb "ortools/sat/cp_model_go_proto"
log "github.com/golang/glog"
cmpb "github.com/google/or-tools/ortools/sat/proto/cpmodel"
"ortools/sat/go/cpmodel"
)

Expand Down Expand Up @@ -264,7 +264,7 @@ func simpleSatProgram() error {

func main() {
if err := simpleSatProgram(); err != nil {
glog.Exitf("simpleSatProgram returned with error: %v", err)
log.Exitf("simpleSatProgram returned with error: %v", err)
}
}
```
12 changes: 6 additions & 6 deletions ortools/sat/docs/boolean_logic.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public class LiteralSampleSat
package main

import (
"github.com/golang/glog"
log "github.com/golang/glog"
"ortools/sat/go/cpmodel"
)

Expand All @@ -123,7 +123,7 @@ func literalSampleSat() {
x := model.NewBoolVar().WithName("x")
notX := x.Not()

glog.Infof("x = %d, x.Not() = %d", x.Index(), notX.Index())
log.Infof("x = %d, x.Not() = %d", x.Index(), notX.Index())
}

func main() {
Expand Down Expand Up @@ -525,10 +525,10 @@ package main
import (
"fmt"

"github.com/golang/glog"
"golang/protobuf/v2/proto/proto"
log "github.com/golang/glog"
sppb "github.com/google/or-tools/ortools/sat/proto/satparameters"
"google.golang.org/protobuf/proto"
"ortools/sat/go/cpmodel"
sppb "ortools/sat/sat_parameters_go_proto"
)

func booleanProductSample() error {
Expand Down Expand Up @@ -576,7 +576,7 @@ func booleanProductSample() error {
func main() {
err := booleanProductSample()
if err != nil {
glog.Exitf("booleanProductSample returned with error: %v", err)
log.Exitf("booleanProductSample returned with error: %v", err)
}
}
```
16 changes: 8 additions & 8 deletions ortools/sat/docs/channeling.md
Original file line number Diff line number Diff line change
Expand Up @@ -308,11 +308,11 @@ package main
import (
"fmt"

"github.com/golang/glog"
"golang/protobuf/v2/proto/proto"
cmpb "ortools/sat/cp_model_go_proto"
log "github.com/golang/glog"
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"
sppb "ortools/sat/sat_parameters_go_proto"
)

func channelingSampleSat() error {
Expand Down Expand Up @@ -367,7 +367,7 @@ func channelingSampleSat() error {

func main() {
if err := channelingSampleSat(); err != nil {
glog.Exitf("channelingSampleSat returned with error: %v", err)
log.Exitf("channelingSampleSat returned with error: %v", err)
}
}
```
Expand Down Expand Up @@ -895,7 +895,7 @@ package main
import (
"fmt"

"github.com/golang/glog"
log "github.com/golang/glog"
"ortools/sat/go/cpmodel"
)

Expand All @@ -907,7 +907,7 @@ const (
)

type item struct {
Cost, Copies int64_t
Cost, Copies int64
}

func binpackingProblemSat() error {
Expand Down Expand Up @@ -993,7 +993,7 @@ func binpackingProblemSat() error {

func main() {
if err := binpackingProblemSat(); err != nil {
glog.Exitf("binpackingProblemSat returned with error: %v", err)
log.Exitf("binpackingProblemSat returned with error: %v", err)
}
}
```
26 changes: 13 additions & 13 deletions ortools/sat/docs/integer_arithmetic.md
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,8 @@ package main
import (
"fmt"

"github.com/golang/glog"
cmpb "ortools/sat/cp_model_go_proto"
log "github.com/golang/glog"
cmpb "github.com/google/or-tools/ortools/sat/proto/cpmodel"
"ortools/sat/go/cpmodel"
)

Expand Down Expand Up @@ -315,7 +315,7 @@ func rabbitsAndPheasants() error {

func main() {
if err := rabbitsAndPheasants(); err != nil {
glog.Exitf("rabbitsAndPheasants returned with error: %v", err)
log.Exitf("rabbitsAndPheasants returned with error: %v", err)
}
}
```
Expand Down Expand Up @@ -675,11 +675,11 @@ package main
import (
"fmt"

"github.com/golang/glog"
"golang/protobuf/v2/proto/proto"
cmpb "ortools/sat/cp_model_go_proto"
log "github.com/golang/glog"
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"
sppb "ortools/sat/sat_parameters_go_proto"
)

const (
Expand Down Expand Up @@ -742,7 +742,7 @@ func earlinessTardinessCostSampleSat() error {

func main() {
if err := earlinessTardinessCostSampleSat(); err != nil {
glog.Exitf("earlinessTardinessCostSampleSat returned with error: %v", err)
log.Exitf("earlinessTardinessCostSampleSat returned with error: %v", err)
}
}
```
Expand Down Expand Up @@ -1131,11 +1131,11 @@ package main
import (
"fmt"

"github.com/golang/glog"
"golang/protobuf/v2/proto/proto"
cmpb "ortools/sat/cp_model_go_proto"
log "github.com/golang/glog"
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"
sppb "ortools/sat/sat_parameters_go_proto"
)

func stepFunctionSampleSat() error {
Expand Down Expand Up @@ -1208,7 +1208,7 @@ func stepFunctionSampleSat() error {

func main() {
if err := stepFunctionSampleSat(); err != nil {
glog.Exitf("stepFunctionSampleSat returned with error: %v", err)
log.Exitf("stepFunctionSampleSat returned with error: %v", err)
}
}
```
Expand Down
6 changes: 3 additions & 3 deletions ortools/sat/docs/model.md
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,8 @@ package main
import (
"fmt"

"github.com/golang/glog"
cmpb "ortools/sat/cp_model_go_proto"
log "github.com/golang/glog"
cmpb "github.com/google/or-tools/ortools/sat/proto/cpmodel"
"ortools/sat/go/cpmodel"
)

Expand Down Expand Up @@ -353,7 +353,7 @@ func solutionHintingSampleSat() error {

func main() {
if err := solutionHintingSampleSat(); err != nil {
glog.Exitf("solutionHintingSampleSat returned with error: %v", err)
log.Exitf("solutionHintingSampleSat returned with error: %v", err)
}
}
```
Expand Down
22 changes: 11 additions & 11 deletions ortools/sat/docs/scheduling.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ package main
import (
"fmt"

"github.com/golang/glog"
log "github.com/golang/glog"
"ortools/sat/go/cpmodel"
)

Expand Down Expand Up @@ -231,7 +231,7 @@ func intervalSampleSat() error {

func main() {
if err := intervalSampleSat(); err != nil {
glog.Exitf("intervalSampleSat returned with error: %v", err)
log.Exitf("intervalSampleSat returned with error: %v", err)
}
}
```
Expand Down Expand Up @@ -421,7 +421,7 @@ package main
import (
"fmt"

"github.com/golang/glog"
log "github.com/golang/glog"
"ortools/sat/go/cpmodel"
)

Expand Down Expand Up @@ -454,7 +454,7 @@ func optionalIntervalSampleSat() error {

func main() {
if err := optionalIntervalSampleSat(); err != nil {
glog.Exitf("optionalIntervalSampleSat returned with error: %v", err)
log.Exitf("optionalIntervalSampleSat returned with error: %v", err)
}
}
```
Expand Down Expand Up @@ -841,8 +841,8 @@ package main
import (
"fmt"

"github.com/golang/glog"
cmpb "ortools/sat/cp_model_go_proto"
log "github.com/golang/glog"
cmpb "github.com/google/or-tools/ortools/sat/proto/cpmodel"
"ortools/sat/go/cpmodel"
)

Expand Down Expand Up @@ -909,7 +909,7 @@ func noOverlapSampleSat() error {

func main() {
if err := noOverlapSampleSat(); err != nil {
glog.Exitf("noOverlapSampleSat returned with error: %v", err)
log.Exitf("noOverlapSampleSat returned with error: %v", err)
}
}
```
Expand Down Expand Up @@ -1865,8 +1865,8 @@ package main
import (
"fmt"

"github.com/golang/glog"
cmpb "ortools/sat/cp_model_go_proto"
log "github.com/golang/glog"
cmpb "github.com/google/or-tools/ortools/sat/proto/cpmodel"
"ortools/sat/go/cpmodel"
)

Expand Down Expand Up @@ -1937,7 +1937,7 @@ func rankingSampleSat() error {

for t := 0; t < numTasks; t++ {
start := model.NewIntVarFromDomain(horizon)
duration := cpmodel.NewConstant(int64_t(t + 1))
duration := cpmodel.NewConstant(int64(t + 1))
end := model.NewIntVarFromDomain(horizon)
var presence cpmodel.BoolVar
if t < numTasks/2 {
Expand Down Expand Up @@ -2008,7 +2008,7 @@ func rankingSampleSat() error {

func main() {
if err := rankingSampleSat(); err != nil {
glog.Exitf("rankingSampleSat returned with error: %v", err)
log.Exitf("rankingSampleSat returned with error: %v", err)
}
}
```
Expand Down
26 changes: 13 additions & 13 deletions ortools/sat/docs/solver.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,11 @@ package main
import (
"fmt"

"github.com/golang/glog"
"golang/protobuf/v2/proto/proto"
cmpb "ortools/sat/cp_model_go_proto"
log "github.com/golang/glog"
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"
sppb "ortools/sat/sat_parameters_go_proto"
)

func solveWithTimeLimitSampleSat() error {
Expand Down Expand Up @@ -240,7 +240,7 @@ func solveWithTimeLimitSampleSat() error {

func main() {
if err := solveWithTimeLimitSampleSat(); err != nil {
glog.Exitf("solveWithTimeLimitSampleSat returned with error: %v", err)
log.Exitf("solveWithTimeLimitSampleSat returned with error: %v", err)
}
}
```
Expand Down Expand Up @@ -535,10 +535,10 @@ package main
import (
"fmt"

"github.com/golang/glog"
"golang/protobuf/v2/proto/proto"
log "github.com/golang/glog"
sppb "github.com/google/or-tools/ortools/sat/proto/satparameters"
"google.golang.org/protobuf/proto"
"ortools/sat/go/cpmodel"
sppb "ortools/sat/sat_parameters_go_proto"
)

func solveAndPrintIntermediateSolutionsSampleSat() error {
Expand Down Expand Up @@ -583,7 +583,7 @@ func solveAndPrintIntermediateSolutionsSampleSat() error {

func main() {
if err := solveAndPrintIntermediateSolutionsSampleSat(); err != nil {
glog.Exitf("solveAndPrintIntermediateSolutionsSampleSat returned with error: %v", err)
log.Exitf("solveAndPrintIntermediateSolutionsSampleSat returned with error: %v", err)
}
}
```
Expand Down Expand Up @@ -872,10 +872,10 @@ package main
import (
"fmt"

"github.com/golang/glog"
"golang/protobuf/v2/proto/proto"
log "github.com/golang/glog"
sppb "github.com/google/or-tools/ortools/sat/proto/satparameters"
"google.golang.org/protobuf/proto"
"ortools/sat/go/cpmodel"
sppb "ortools/sat/sat_parameters_go_proto"
)

func searchForAllSolutionsSampleSat() error {
Expand Down Expand Up @@ -917,7 +917,7 @@ func searchForAllSolutionsSampleSat() error {

func main() {
if err := searchForAllSolutionsSampleSat(); err != nil {
glog.Exitf("searchForAllSolutionsSampleSat returned with error: %v", err)
log.Exitf("searchForAllSolutionsSampleSat returned with error: %v", err)
}
}
```
Expand Down
10 changes: 5 additions & 5 deletions ortools/sat/go/cpmodel/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ go_library(
srcs = [
"cp_model.go",
"cp_solver.go",
"cp_solver_c.cc",
"cp_solver_c.h",
#"cp_solver_c.cc",
#"cp_solver_c.h",
"domain.go",
],
cdeps = [":cp_solver_c"],
Expand Down Expand Up @@ -57,12 +57,12 @@ cc_library(
srcs = ["cp_solver_c.cc"],
hdrs = ["cp_solver_c.h"],
deps = [
"//ortools/base:memutil",
"//ortools/sat:cp_model_cc_proto",
"//ortools/sat:cp_model_solver",
"//ortools/sat:model",
"//ortools/sat:sat_parameters_cc_proto",
"//ortools/util:time_limit",
"@com_google_absl//absl/log",
"@com_google_absl//absl/status",
"@com_google_absl//absl/strings",
"@com_google_absl//absl/log:check",
],
)
Loading

0 comments on commit 100b6bc

Please sign in to comment.