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

#include <precedences.h>

Public Member Functions

int size () const
 
const Relationrelation (int index) const
 
absl::Span< const int > relation_indices (LiteralIndex lit) const
 
void Add (Literal lit, LinearTerm a, LinearTerm b, IntegerValue lhs, IntegerValue rhs)
 Adds a relation lit => a + b \in [lhs, rhs].
 
void Build ()
 
bool PropagateLocalBounds (const IntegerTrail &integer_trail, Literal lit, const absl::flat_hash_map< IntegerVariable, IntegerValue > &input, absl::flat_hash_map< IntegerVariable, IntegerValue > *output) const
 

Detailed Description

A repository of all the enforced linear constraints of size 1 or 2.

Todo
(user): This is not always needed, find a way to clean this once we don't need it.

Definition at line 494 of file precedences.h.

Member Function Documentation

◆ Add()

void operations_research::sat::BinaryRelationRepository::Add ( Literal lit,
LinearTerm a,
LinearTerm b,
IntegerValue lhs,
IntegerValue rhs )

Adds a relation lit => a + b \in [lhs, rhs].

We shall only consider positive variable here.

Definition at line 1108 of file precedences.cc.

◆ Build()

void operations_research::sat::BinaryRelationRepository::Build ( )

Builds the literal to relations mapping. This should be called once all the relations have been added.

Definition at line 1130 of file precedences.cc.

◆ PropagateLocalBounds()

bool operations_research::sat::BinaryRelationRepository::PropagateLocalBounds ( const IntegerTrail & integer_trail,
Literal lit,
const absl::flat_hash_map< IntegerVariable, IntegerValue > & input,
absl::flat_hash_map< IntegerVariable, IntegerValue > * output ) const

Assuming level-zero bounds + any (var >= value) in the input map, fills "output" with a "propagated" set of bounds assuming lit is true (by using the relations enforced by lit). Note that we will only fill bounds > level-zero ones in output.

Returns false if the new bounds are infeasible at level zero.

lb(b.y) <= b.y <= ub(b.y) and lhs <= a.x + b.y <= rhs imply ceil((lhs - ub(b.y)) / a) <= x <= floor((rhs - lb(b.y)) / a)

Check feasibility.

Todo
(user): we might do that earlier?

Definition at line 1391 of file precedences.cc.

◆ relation()

const Relation & operations_research::sat::BinaryRelationRepository::relation ( int index) const
inline

Definition at line 497 of file precedences.h.

◆ relation_indices()

absl::Span< const int > operations_research::sat::BinaryRelationRepository::relation_indices ( LiteralIndex lit) const
inline

Definition at line 499 of file precedences.h.

◆ size()

int operations_research::sat::BinaryRelationRepository::size ( ) const
inline

Definition at line 496 of file precedences.h.


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