Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
operations_research::sat::CompiledConstraint Class Referenceabstract

View of a generic (non linear) constraint for the LsEvaluator. More...

#include <constraint_violation.h>

Inheritance diagram for operations_research::sat::CompiledConstraint:
operations_research::sat::CompiledConstraintWithProto operations_research::sat::CompiledReservoirConstraint operations_research::sat::NoOverlapBetweenTwoIntervals 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

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_
 

Detailed Description

View of a generic (non linear) constraint for the LsEvaluator.

Definition at line 244 of file constraint_violation.h.

Constructor & Destructor Documentation

◆ CompiledConstraint()

operations_research::sat::CompiledConstraint::CompiledConstraint ( )
default

◆ ~CompiledConstraint()

virtual operations_research::sat::CompiledConstraint::~CompiledConstraint ( )
virtualdefault

Member Function Documentation

◆ ComputeViolation()

◆ InitializeViolation()

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.

◆ PerformMove()

void operations_research::sat::CompiledConstraint::PerformMove ( int var,
int64_t old_value,
absl::Span< const int64_t > solution_with_new_value )
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.

◆ UsedVariables()

virtual std::vector< int > operations_research::sat::CompiledConstraint::UsedVariables ( const CpModelProto & model_proto) const
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.

◆ violation()

int64_t operations_research::sat::CompiledConstraint::violation ( ) const
inline

The cached violation of this constraint.

Definition at line 270 of file constraint_violation.h.

◆ ViolationDelta()

int64_t operations_research::sat::CompiledConstraint::ViolationDelta ( int var,
int64_t old_value,
absl::Span< const int64_t > solution_with_new_value )
virtual

Member Data Documentation

◆ violation_

int64_t operations_research::sat::CompiledConstraint::violation_
protected

Definition at line 279 of file constraint_violation.h.


The documentation for this class was generated from the following files: