Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
|
View of a generic (non linear) constraint for the LsEvaluator. More...
#include <constraint_violation.h>
Public Member Functions | |
CompiledConstraint ()=default | |
virtual | ~CompiledConstraint ()=default |
void | InitializeViolation (absl::Span< const int64_t > solution) |
Recomputes the violation of the constraint from scratch. | |
virtual void | PerformMove (int var, int64_t old_value, absl::Span< const int64_t > solution_with_new_value) |
Updates the violation with the new value. | |
virtual int64_t | ViolationDelta (int var, int64_t old_value, absl::Span< const int64_t > solution_with_new_value) |
Returns the delta if var changes from old_value to solution[var]. | |
virtual std::vector< int > | UsedVariables (const CpModelProto &model_proto) const =0 |
int64_t | violation () const |
The cached violation of this constraint. | |
Protected Member Functions | |
virtual int64_t | ComputeViolation (absl::Span< const int64_t > solution)=0 |
Protected Attributes | |
int64_t | violation_ |
View of a generic (non linear) constraint for the LsEvaluator.
Definition at line 244 of file constraint_violation.h.
|
default |
|
virtualdefault |
|
protectedpure virtual |
Computes the violation of a constraint.
This is called by InitializeViolation() and also the default implementation of ViolationDelta().
Implemented in operations_research::sat::CompiledAllDiffConstraint, operations_research::sat::CompiledBoolXorConstraint, operations_research::sat::CompiledCircuitConstraint, operations_research::sat::CompiledIntDivConstraint, operations_research::sat::CompiledIntModConstraint, operations_research::sat::CompiledIntProdConstraint, operations_research::sat::CompiledLinMaxConstraint, operations_research::sat::CompiledNoOverlap2dConstraint, operations_research::sat::CompiledReservoirConstraint, and operations_research::sat::NoOverlapBetweenTwoIntervals.
void operations_research::sat::CompiledConstraint::InitializeViolation | ( | absl::Span< const int64_t > | solution | ) |
Recomputes the violation of the constraint from scratch.
--— CompiledConstraint --—
Definition at line 962 of file constraint_violation.cc.
|
virtual |
Updates the violation with the new value.
Reimplemented in operations_research::sat::CompiledCircuitConstraint, and operations_research::sat::CompiledReservoirConstraint.
Definition at line 967 of file constraint_violation.cc.
|
pure virtual |
Returns the sorted vector of variables used by this constraint. This is used to known when a violation might change, and is only called once during initialization, so speed is not to much of a concern here.
The global proto is needed to resolve interval variables reference.
Implemented in operations_research::sat::CompiledConstraintWithProto, operations_research::sat::CompiledReservoirConstraint, and operations_research::sat::NoOverlapBetweenTwoIntervals.
|
inline |
The cached violation of this constraint.
Definition at line 270 of file constraint_violation.h.
|
virtual |
Returns the delta if var changes from old_value to solution[var].
Reimplemented in operations_research::sat::CompiledBoolXorConstraint, operations_research::sat::CompiledCircuitConstraint, operations_research::sat::CompiledReservoirConstraint, and operations_research::sat::NoOverlapBetweenTwoIntervals.
Definition at line 973 of file constraint_violation.cc.
|
protected |
Definition at line 279 of file constraint_violation.h.