Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
|
#include <cp_model_presolve.h>
Public Member Functions | |
ModelCopy (PresolveContext *context) | |
bool | ImportAndSimplifyConstraints (const CpModelProto &in_model, bool first_copy=false, std::function< bool(int)> active_constraints=nullptr) |
void | ImportVariablesAndMaybeIgnoreNames (const CpModelProto &in_model) |
void | CreateVariablesFromDomains (const std::vector< Domain > &domains) |
This helper class perform copy with simplification from a model and a partial assignment to another model. The purpose is to minimize the size of the copied model, as well as to reduce the pressure on the memory sub-system.
It is currently used by the LNS part, but could be used with any other scheme that generates partial assignments.
Definition at line 379 of file cp_model_presolve.h.
|
explicit |
Definition at line 11778 of file cp_model_presolve.cc.
void operations_research::sat::ModelCopy::CreateVariablesFromDomains | ( | const std::vector< Domain > & | domains | ) |
Setup new variables from a vector of domains. Inactive variables will be fixed to their lower bound.
Definition at line 11795 of file cp_model_presolve.cc.
bool operations_research::sat::ModelCopy::ImportAndSimplifyConstraints | ( | const CpModelProto & | in_model, |
bool | first_copy = false, | ||
std::function< bool(int)> | active_constraints = nullptr ) |
Copies all constraints from in_model to working model of the context.
During the process, it will read variable domains from the context, and simplify constraints to minimize the size of the copied model. Thus it is important that the context->working_model already have the variables part copied.
It returns false iff the model is proven infeasible.
It does not clear the constraints part of the working model of the context.
Note(user): If first_copy is true, we will reorder the scheduling constraint so that they only use reference to previously defined intervals. This allow to be more efficient later in a few preprocessing steps.
If first_copy is true, we reorder the scheduling constraint to be sure they refer to interval before them.
This should be empty if first_copy is false.
Definition at line 11806 of file cp_model_presolve.cc.
void operations_research::sat::ModelCopy::ImportVariablesAndMaybeIgnoreNames | ( | const CpModelProto & | in_model | ) |
Copy variables from the in_model to the working model. It reads the 'ignore_names' parameters from the context, and keeps or deletes names accordingly.
Definition at line 11780 of file cp_model_presolve.cc.