add missing swig rule; remove redundant constraint in sat table implementation
This commit is contained in:
@@ -55,6 +55,7 @@ PROTO2_RETURN(operations_research::sat::CpSolverResponse,
|
||||
%feature("director") operations_research::sat::SolutionCallback;
|
||||
|
||||
%unignore operations_research::sat::SolutionCallback;
|
||||
%unignore operations_research::sat::SolutionCallback::~SolutionCallback;
|
||||
%rename (bestObjectiveBound) operations_research::sat::SolutionCallback::BestObjectiveBound;
|
||||
%rename (numBinaryPropagations) operations_research::sat::SolutionCallback::NumBinaryPropagations;
|
||||
%rename (numBooleans) operations_research::sat::SolutionCallback::NumBooleans;
|
||||
|
||||
@@ -394,9 +394,6 @@ std::function<void(Model*)> TransitionConstraint(
|
||||
: IntegerValue(transition[2]));
|
||||
}
|
||||
|
||||
// Exactly one tuple literal is true.
|
||||
model->Add(ExactlyOneConstraint(tuple_literals));
|
||||
|
||||
// Fully instantiate vars[time].
|
||||
// Tricky: because we started adding constraints that can propagate, the
|
||||
// possible values returned by encoding might not contains all the value
|
||||
@@ -434,18 +431,18 @@ std::function<void(Model*)> TransitionConstraint(
|
||||
out_encoding[s.front()] = Literal(var, true);
|
||||
out_encoding[s.back()] = Literal(var, false);
|
||||
} else if (s.size() > 1) {
|
||||
std::vector<Literal> state_literals;
|
||||
for (const IntegerValue state : s) {
|
||||
const Literal l = Literal(model->Add(NewBooleanVariable()), true);
|
||||
out_encoding[state] = l;
|
||||
state_literals.push_back(l);
|
||||
}
|
||||
// Exactly one state literal is true.
|
||||
model->Add(ExactlyOneConstraint(state_literals));
|
||||
}
|
||||
}
|
||||
|
||||
// Now we link everything together.
|
||||
//
|
||||
// Note that we do not need the ExactlyOneConstraint(tuple_literals)
|
||||
// because it is already implicitely encoded since we have exactly one
|
||||
// transition value.
|
||||
if (!in_encoding.empty()) {
|
||||
ProcessOneColumn(tuple_literals, in_states, in_encoding, model);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user