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

--— CompiledCircuitConstraint --— More...

Inheritance diagram for operations_research::sat::CompiledCircuitConstraint:
operations_research::sat::CompiledConstraintWithProto operations_research::sat::CompiledConstraint

Public Member Functions

 CompiledCircuitConstraint (const ConstraintProto &ct_proto)
 
 ~CompiledCircuitConstraint () override=default
 
int64_t ComputeViolation (absl::Span< const int64_t > solution) override
 
void PerformMove (int var, int64_t old_value, absl::Span< const int64_t > new_solution) override
 Updates the violation with the new value.
 
int64_t ViolationDelta (int var, int64_t old_value, absl::Span< const int64_t > solution_with_new_value) override
 Returns the delta if var changes from old_value to solution[var].
 
- Public Member Functions inherited from operations_research::sat::CompiledConstraintWithProto
 CompiledConstraintWithProto (const ConstraintProto &ct_proto)
 --— CompiledConstraintWithProto --—
 
 ~CompiledConstraintWithProto () override=default
 
const ConstraintProto & ct_proto () const
 
std::vector< int > UsedVariables (const CpModelProto &model_proto) const final
 This just returns the variables used by the stored ct_proto_.
 
- Public Member Functions inherited from operations_research::sat::CompiledConstraint
 CompiledConstraint ()=default
 
virtual ~CompiledConstraint ()=default
 
void InitializeViolation (absl::Span< const int64_t > solution)
 Recomputes the violation of the constraint from scratch.
 
int64_t violation () const
 The cached violation of this constraint.
 

Additional Inherited Members

- Protected Member Functions inherited from operations_research::sat::CompiledConstraint
- Protected Attributes inherited from operations_research::sat::CompiledConstraint
int64_t violation_
 

Detailed Description

--— CompiledCircuitConstraint --—

The violation of a circuit has three parts:

  1. Flow imbalance, maintained by the linear part.
  2. The number of non-skipped SCCs in the graph minus 1.
  3. The number of non-skipped SCCs that cannot be reached from any other component minus 1.

#3 is not necessary for correctness, but makes the function much smoother.

The only difference between single and multi circuit is flow balance at the depot, so we use the same compiled constraint for both.

Definition at line 1281 of file constraint_violation.cc.

Constructor & Destructor Documentation

◆ CompiledCircuitConstraint()

operations_research::sat::CompiledCircuitConstraint::CompiledCircuitConstraint ( const ConstraintProto & ct_proto)
explicit

Definition at line 1339 of file constraint_violation.cc.

◆ ~CompiledCircuitConstraint()

operations_research::sat::CompiledCircuitConstraint::~CompiledCircuitConstraint ( )
overridedefault

Member Function Documentation

◆ ComputeViolation()

int64_t operations_research::sat::CompiledCircuitConstraint::ComputeViolation ( absl::Span< const int64_t > solution)
overridevirtual

Computes the violation of a constraint.

This is called by InitializeViolation() and also the default implementation of ViolationDelta().

Implements operations_research::sat::CompiledConstraint.

Definition at line 1394 of file constraint_violation.cc.

◆ PerformMove()

void operations_research::sat::CompiledCircuitConstraint::PerformMove ( int var,
int64_t old_value,
absl::Span< const int64_t > solution_with_new_value )
overridevirtual

Updates the violation with the new value.

Reimplemented from operations_research::sat::CompiledConstraint.

Definition at line 1387 of file constraint_violation.cc.

◆ ViolationDelta()

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

Returns the delta if var changes from old_value to solution[var].

Reimplemented from operations_research::sat::CompiledConstraint.

Definition at line 1402 of file constraint_violation.cc.


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