Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
|
#include <bop_base.h>
Public Member Functions | |
ProblemState (const sat::LinearBooleanProblem &problem) | |
ProblemState (const ProblemState &)=delete | |
This type is neither copyable nor movable. | |
ProblemState & | operator= (const ProblemState &)=delete |
void | SetParameters (const BopParameters ¶meters) |
Sets parameters, used for instance to get the tolerance, the gap limit... | |
const BopParameters & | GetParameters () const |
void | set_assignment_preference (const std::vector< bool > &a) |
std::vector< bool > | assignment_preference () const |
bool | MergeLearnedInfo (const LearnedInfo &learned_info, BopOptimizerBase::Status optimization_status) |
LearnedInfo | GetLearnedInfo () const |
int64_t | update_stamp () const |
void | MarkAsOptimal () |
Marks the problem state as optimal. | |
void | MarkAsInfeasible () |
Marks the problem state as infeasible. | |
bool | IsOptimal () const |
bool | IsInfeasible () const |
Returns true when the problem is proved to be infeasible. | |
bool | IsVariableFixed (VariableIndex var) const |
const util_intops::StrongVector< VariableIndex, bool > & | is_fixed () const |
bool | GetVariableFixedValue (VariableIndex var) const |
const util_intops::StrongVector< VariableIndex, bool > & | fixed_values () const |
const glop::DenseRow & | lp_values () const |
const BopSolution & | solution () const |
const sat::LinearBooleanProblem & | original_problem () const |
int64_t | lower_bound () const |
int64_t | upper_bound () const |
double | GetScaledLowerBound () const |
Returns the scaled lower bound of the original problem. | |
const std::vector< sat::BinaryClause > & | NewlyAddedBinaryClauses () const |
Returns the newly added binary clause since the last SynchronizationDone(). | |
void | SynchronizationDone () |
Static Public Attributes | |
static const int64_t | kInitialStampValue |
This class represents the current state of the problem with all the information that the solver learned about it at a given time.
Definition at line 119 of file bop_base.h.
|
explicit |
|
delete |
This type is neither copyable nor movable.
|
inline |
Definition at line 139 of file bop_base.h.
|
inline |
Definition at line 194 of file bop_base.h.
LearnedInfo operations_research::bop::ProblemState::GetLearnedInfo | ( | ) | const |
Returns all the information learned so far.
Definition at line 231 of file bop_base.cc.
|
inline |
Definition at line 132 of file bop_base.h.
|
inline |
Returns the scaled lower bound of the original problem.
Definition at line 222 of file bop_base.h.
|
inline |
Returns the value of the fixed variable var. Should be only called on fixed variables (CHECKed).
Definition at line 191 of file bop_base.h.
|
inline |
Definition at line 185 of file bop_base.h.
|
inline |
Returns true when the problem is proved to be infeasible.
Definition at line 180 of file bop_base.h.
|
inline |
Returns true when the current state is proved to be optimal. In such a case solution() returns the optimal solution.
Definition at line 175 of file bop_base.h.
|
inline |
Returns true when the variable var is fixed in the current problem state. The value of the fixed variable is returned by GetVariableFixedValue(var).
Definition at line 184 of file bop_base.h.
|
inline |
Returns the current lower (resp. upper) bound of the objective cost. For internal use only: this is the unscaled version of the lower (resp. upper) bound, and so should be compared only to the unscaled cost given by solution.GetCost().
Definition at line 218 of file bop_base.h.
|
inline |
Returns the values of the LP relaxation of the problem. Returns an empty vector when the LP has not been populated.
Definition at line 200 of file bop_base.h.
void operations_research::bop::ProblemState::MarkAsInfeasible | ( | ) |
Marks the problem state as infeasible.
Mark as infeasible, i.e. set a lower_bound greater than the upper_bound.
Definition at line 253 of file bop_base.cc.
void operations_research::bop::ProblemState::MarkAsOptimal | ( | ) |
Marks the problem state as optimal.
Definition at line 247 of file bop_base.cc.
bool operations_research::bop::ProblemState::MergeLearnedInfo | ( | const LearnedInfo & | learned_info, |
BopOptimizerBase::Status | optimization_status ) |
Merges the learned information with the current problem state. For instance, if variables x, and y are fixed in the current state, and z is learned to be fixed, the result of the merge will be x, y, and z being fixed in the problem state.
The lower bound might be greater that the cost of a feasible solution due to rounding errors in the problem scaling and Glop. As a feasible solution was found, the solution is proved optimal.
Merge fixed variables. Note that variables added during search, i.e. not in the original problem, are ignored.
Set the solution to the fixed variables.
Definition at line 108 of file bop_base.cc.
const std::vector< sat::BinaryClause > & operations_research::bop::ProblemState::NewlyAddedBinaryClauses | ( | ) | const |
Returns the newly added binary clause since the last SynchronizationDone().
Definition at line 265 of file bop_base.cc.
|
delete |
|
inline |
Returns the original problem. Note that the current problem might be different, e.g. fixed variables, but equivalent, i.e. a solution to one should be a solution to the other too.
Definition at line 210 of file bop_base.h.
|
inline |
Sets an assignment preference for each variable. This is only used for warm start.
Definition at line 136 of file bop_base.h.
|
inline |
Sets parameters, used for instance to get the tolerance, the gap limit...
Definition at line 128 of file bop_base.h.
|
inline |
Returns the solution to the current state problem.
Definition at line 205 of file bop_base.h.
void operations_research::bop::ProblemState::SynchronizationDone | ( | ) |
Resets what is considered "new" information. This is meant to be called once all the optimize have been synchronized.
Definition at line 270 of file bop_base.cc.
|
inline |
Definition at line 165 of file bop_base.h.
|
inline |
Definition at line 219 of file bop_base.h.
|
static |
The stamp represents an upper bound on the number of times the problem state has been updated. If the stamp changed since last time one has checked the state, it's worth trying again as it might have changed (no guarantee).
Definition at line 164 of file bop_base.h.