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

#include <linear_model.h>

Public Member Functions

 LinearModel (const CpModelProto &model_proto)
 
const CpModelProto & model_proto () const
 
const std::vector< bool > & ignored_constraints () const
 Mask on the constraints of the model passed to the ctor.
 
const std::vector< ConstraintProto > & additional_constraints () const
 Additional constraints created during the initialization.
 
int num_ignored_constraints () const
 
int num_exactly_ones () const
 
int num_full_encodings () const
 
int num_element_encodings () const
 

Detailed Description

This class is meant to be a view on the full CpModelProto, with hidden and additional constraints. Currently, this class is meant to be used by the feasibility jump subsolver. It could also contains the linear relaxation at level 1 or 2 of the model and could be computed once for all workers of a given linearization level.

Definition at line 29 of file linear_model.h.

Constructor & Destructor Documentation

◆ LinearModel()

operations_research::sat::LinearModel::LinearModel ( const CpModelProto & model_proto)
explicit
Todo
(user): Do we use the loader code to detect full encodings and element encodings.

Loop over all constraints and fill var_to_equalities.

Sort literals to get a canonical constraint.

ct is a linear constraint with one term and one enforcement literal.

Detect enforcement_literal => (var == value or var != value).

Note
for domain with 2 values like [0, 1], we will detect both == 0 and != 1. Similarly, for a domain in [min, max], we should both detect (== min) and (<= min), and both detect (== max) and (>= max).

Detect Literal <=> X == value and rebuild full encodings.

Todo
(user): Deal with/Check double insertion.

We sort to have a canonical representation with increasing values and sorted literals.

Fill exactly one.

Fill linear encoding.

We shift the var = sum(lit * value) by the min value.

Add exactly_one constraint if new.

Definition at line 82 of file linear_model.cc.

Member Function Documentation

◆ additional_constraints()

const std::vector< ConstraintProto > & operations_research::sat::LinearModel::additional_constraints ( ) const
inline

Additional constraints created during the initialization.

Definition at line 41 of file linear_model.h.

◆ ignored_constraints()

const std::vector< bool > & operations_research::sat::LinearModel::ignored_constraints ( ) const
inline

Mask on the constraints of the model passed to the ctor.

Definition at line 36 of file linear_model.h.

◆ model_proto()

const CpModelProto & operations_research::sat::LinearModel::model_proto ( ) const
inline

Definition at line 33 of file linear_model.h.

◆ num_element_encodings()

int operations_research::sat::LinearModel::num_element_encodings ( ) const
inline

Definition at line 48 of file linear_model.h.

◆ num_exactly_ones()

int operations_research::sat::LinearModel::num_exactly_ones ( ) const
inline

Definition at line 46 of file linear_model.h.

◆ num_full_encodings()

int operations_research::sat::LinearModel::num_full_encodings ( ) const
inline

Definition at line 47 of file linear_model.h.

◆ num_ignored_constraints()

int operations_research::sat::LinearModel::num_ignored_constraints ( ) const
inline

Definition at line 45 of file linear_model.h.


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