Skip to content

Commit

Permalink
fixup 2
Browse files Browse the repository at this point in the history
  • Loading branch information
Mizux committed Sep 26, 2024
1 parent 7f77ff4 commit ad3c36a
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions ortools/sat/go/cpmodel/cp_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -897,24 +897,21 @@ func (cp *Builder) AddNoOverlap(vars ...IntervalVar) Constraint {
// AddNoOverlap2D adds a no_overlap2D constraint that prevents a set of boxes from overlapping.
func (cp *Builder) AddNoOverlap2D() NoOverlap2DConstraint {
return NoOverlap2DConstraint{cp.appendConstraint(&cmpb.ConstraintProto{
Constraint: &cmpb.ConstraintProto_NoOverlap_2D{&cmpb.NoOverlap2DConstraintProto{},
}})}
Constraint: &cmpb.ConstraintProto_NoOverlap_2D{&cmpb.NoOverlap2DConstraintProto{}}})}
}

// AddCircuitConstraint adds a circuit constraint to the model. The circuit constraint is
// defined on a graph where the arcs are present if the corresponding literals are set to true.
func (cp *Builder) AddCircuitConstraint() CircuitConstraint {
return CircuitConstraint{cp.appendConstraint(&cmpb.ConstraintProto{
Constraint: &cmpb.ConstraintProto_Circuit{&cmpb.CircuitConstraintProto{},
}})}
Constraint: &cmpb.ConstraintProto_Circuit{&cmpb.CircuitConstraintProto{}}})}
}

// AddMultipleCircuitConstraint adds a multiple circuit constraint to the model, aka the "VRP"
// (Vehicle Routing Problem) constraint.
func (cp *Builder) AddMultipleCircuitConstraint() MultipleCircuitConstraint {
return MultipleCircuitConstraint{cp.appendConstraint(&cmpb.ConstraintProto{
Constraint: &cmpb.ConstraintProto_Routes{&cmpb.RoutesConstraintProto{},
}})}
Constraint: &cmpb.ConstraintProto_Routes{&cmpb.RoutesConstraintProto{}}})}
}

// AddAllowedAssignments adds an allowed assignments constraint to the model. When all variables
Expand All @@ -927,8 +924,7 @@ func (cp *Builder) AddAllowedAssignments(vars ...IntVar) TableConstraint {
}

return TableConstraint{cp.appendConstraint(&cmpb.ConstraintProto{
Constraint: &cmpb.ConstraintProto_Table{&cmpb.TableConstraintProto{Vars: varsInd},
}})}
Constraint: &cmpb.ConstraintProto_Table{&cmpb.TableConstraintProto{Vars: varsInd}}})}
}

// AddReservoirConstraint adds a reservoir constraint with optional refill/emptying events.
Expand Down Expand Up @@ -1126,7 +1122,7 @@ func (cp *Builder) AddDecisionStrategy(vars []IntVar, vs cmpb.DecisionStrategyPr
Variables: indices,
VariableSelectionStrategy: vs,
DomainReductionStrategy: ds,
})
})
}

// Model returns the built CP model proto. The proto returned is a pointer to the proto in Builder,
Expand Down

0 comments on commit ad3c36a

Please sign in to comment.