![]() |
Google OR-Tools v9.12
a fast and portable software suite for combinatorial optimization
|
#include <cp_model_copy.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 (absl::Span< const 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 37 of file cp_model_copy.h.
|
explicit |
Definition at line 43 of file cp_model_copy.cc.
void operations_research::sat::ModelCopy::CreateVariablesFromDomains | ( | absl::Span< const Domain > | domains | ) |
Setup new variables from a vector of domains. Inactive variables will be fixed to their lower bound.
Definition at line 60 of file cp_model_copy.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 71 of file cp_model_copy.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 45 of file cp_model_copy.cc.