Google OR-Tools v9.14
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
operations_research::sat::CompiledNoOverlap2dWithTwoBoxes< has_enforcement > Class Template Reference

#include <constraint_violation.h>

Inheritance diagram for operations_research::sat::CompiledNoOverlap2dWithTwoBoxes< has_enforcement >:
operations_research::sat::CompiledConstraint

Classes

struct  Box

Public Member Functions

 CompiledNoOverlap2dWithTwoBoxes (const ConstraintProto &x1, const ConstraintProto &y1, const ConstraintProto &x2, const ConstraintProto &y2)
 ~CompiledNoOverlap2dWithTwoBoxes () final=default
int64_t ComputeViolation (absl::Span< const int64_t > solution) final
int64_t ViolationDelta (int, int64_t, absl::Span< const int64_t > solution_with_new_value) final
std::vector< int > UsedVariables (const CpModelProto &model_proto) const final
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.
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.
int64_t violation () const
 The cached violation of this constraint.

Additional Inherited Members

Protected Attributes inherited from operations_research::sat::CompiledConstraint
int64_t violation_

Detailed Description

template<bool has_enforcement = true>
class operations_research::sat::CompiledNoOverlap2dWithTwoBoxes< has_enforcement >

Definition at line 630 of file constraint_violation.h.

Constructor & Destructor Documentation

◆ CompiledNoOverlap2dWithTwoBoxes()

template<bool has_enforcement = true>
operations_research::sat::CompiledNoOverlap2dWithTwoBoxes< has_enforcement >::CompiledNoOverlap2dWithTwoBoxes ( const ConstraintProto & x1,
const ConstraintProto & y1,
const ConstraintProto & x2,
const ConstraintProto & y2 )
inline

Definition at line 644 of file constraint_violation.h.

◆ ~CompiledNoOverlap2dWithTwoBoxes()

template<bool has_enforcement = true>
operations_research::sat::CompiledNoOverlap2dWithTwoBoxes< has_enforcement >::~CompiledNoOverlap2dWithTwoBoxes ( )
finaldefault

Member Function Documentation

◆ ComputeViolation()

template<bool has_enforcement = true>
int64_t operations_research::sat::CompiledNoOverlap2dWithTwoBoxes< has_enforcement >::ComputeViolation ( absl::Span< const int64_t > solution)
inlinefinalvirtual

Computes the violation of a constraint.

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

Optimization hack: If we create a ComputeViolationInternal() that we call from here and in ViolationDelta(), then the later is not inlined below in ViolationDelta() where it matter a lot for performance.

Implements operations_research::sat::CompiledConstraint.

Definition at line 667 of file constraint_violation.h.

◆ UsedVariables()

template<bool has_enforcement>
std::vector< int > operations_research::sat::CompiledNoOverlap2dWithTwoBoxes< has_enforcement >::UsedVariables ( const CpModelProto & model_proto) const
finalvirtual

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.

Implements operations_research::sat::CompiledConstraint.

Definition at line 1244 of file constraint_violation.cc.

◆ ViolationDelta()

template<bool has_enforcement>
int64_t operations_research::sat::CompiledNoOverlap2dWithTwoBoxes< has_enforcement >::ViolationDelta ( int ,
int64_t ,
absl::Span< const int64_t > solution_with_new_value )
finalvirtual

Note(user): this is the same implementation as the base one, but it avoid one virtual call !

Reimplemented from operations_research::sat::CompiledConstraint.

Definition at line 1213 of file constraint_violation.cc.


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