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

#include <cp_model_search.h>

Public Member Functions

 CpModelView (Model *model)
 
int NumVariables () const
 The valid indices for the calls below are in [0, num_variables).
 
bool IsFixed (int var) const
 Getters about the current domain of the given variable.
 
int64_t Min (int var) const
 
int64_t Max (int var) const
 
BooleanOrIntegerLiteral GreaterOrEqual (int var, int64_t value) const
 Helpers to generate a decision.
 
BooleanOrIntegerLiteral LowerOrEqual (int var, int64_t value) const
 
BooleanOrIntegerLiteral MedianValue (int var) const
 

Detailed Description

This class allows to query information about the current bounds of the loaded cp_model.proto variables during the search. It is a "view" of the current solver state using the indices of the proto.

Todo
(user): For now it uses proto indices of the loaded model. We will need to add a mapping to use proto indices of the non-presolved model to allow for a client custom search with presolve. The main API shouldn't change though and the change will be transparent.

Definition at line 43 of file cp_model_search.h.

Constructor & Destructor Documentation

◆ CpModelView()

operations_research::sat::CpModelView::CpModelView ( Model * model)
explicit

Definition at line 49 of file cp_model_search.cc.

Member Function Documentation

◆ GreaterOrEqual()

BooleanOrIntegerLiteral operations_research::sat::CpModelView::GreaterOrEqual ( int var,
int64_t value ) const

Helpers to generate a decision.

Definition at line 87 of file cp_model_search.cc.

◆ IsFixed()

bool operations_research::sat::CpModelView::IsFixed ( int var) const

Getters about the current domain of the given variable.

Definition at line 57 of file cp_model_search.cc.

◆ LowerOrEqual()

BooleanOrIntegerLiteral operations_research::sat::CpModelView::LowerOrEqual ( int var,
int64_t value ) const

Definition at line 103 of file cp_model_search.cc.

◆ Max()

int64_t operations_research::sat::CpModelView::Max ( int var) const

Definition at line 77 of file cp_model_search.cc.

◆ MedianValue()

BooleanOrIntegerLiteral operations_research::sat::CpModelView::MedianValue ( int var) const

5 values -> returns the second. 4 values -> returns the second too. Array is 0 based.

Definition at line 119 of file cp_model_search.cc.

◆ Min()

int64_t operations_research::sat::CpModelView::Min ( int var) const

Definition at line 67 of file cp_model_search.cc.

◆ NumVariables()

int operations_research::sat::CpModelView::NumVariables ( ) const

The valid indices for the calls below are in [0, num_variables).

Definition at line 55 of file cp_model_search.cc.


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