![]() |
OR-Tools
8.2
|
Definition at line 68 of file presolve_context.h.
Public Member Functions | |
PresolveContext (bool log_info, Model *model, CpModelProto *cp_model, CpModelProto *mapping) | |
int | NewIntVar (const Domain &domain) |
int | NewBoolVar () |
int | GetOrCreateConstantVar (int64 cst) |
void | AddImplication (int a, int b) |
void | AddImplyInDomain (int b, int x, const Domain &domain) |
bool | DomainIsEmpty (int ref) const |
bool | IsFixed (int ref) const |
bool | CanBeUsedAsLiteral (int ref) const |
bool | LiteralIsTrue (int lit) const |
bool | LiteralIsFalse (int lit) const |
int64 | MinOf (int ref) const |
int64 | MaxOf (int ref) const |
bool | DomainContains (int ref, int64 value) const |
Domain | DomainOf (int ref) const |
int64 | MinOf (const LinearExpressionProto &expr) const |
int64 | MaxOf (const LinearExpressionProto &expr) const |
bool | DomainOfVarIsIncludedIn (int var, const Domain &domain) |
bool | VariableIsUniqueAndRemovable (int ref) const |
bool | VariableIsNotUsedAnymore (int ref) const |
void | MarkVariableAsRemoved (int ref) |
bool | VariableWasRemoved (int ref) const |
bool | VariableWithCostIsUniqueAndRemovable (int ref) const |
bool | VariableIsOnlyUsedInEncoding (int ref) const |
ABSL_MUST_USE_RESULT bool | IntersectDomainWith (int ref, const Domain &domain, bool *domain_modified=nullptr) |
ABSL_MUST_USE_RESULT bool | SetLiteralToFalse (int lit) |
ABSL_MUST_USE_RESULT bool | SetLiteralToTrue (int lit) |
ABSL_MUST_USE_RESULT bool | NotifyThatModelIsUnsat (const std::string &message="") |
bool | ModelIsUnsat () const |
void | UpdateRuleStats (const std::string &name, int num_times=1) |
void | UpdateConstraintVariableUsage (int c) |
bool | ConstraintVariableGraphIsUpToDate () const |
void | UpdateNewConstraintsVariableUsage () |
bool | ConstraintVariableUsageIsConsistent () |
void | ExploitFixedDomain (int var) |
bool | StoreAffineRelation (int ref_x, int ref_y, int64 coeff, int64 offset) |
void | StoreBooleanEqualityRelation (int ref_a, int ref_b) |
bool | StoreAbsRelation (int target_ref, int ref) |
bool | GetAbsRelation (int target_ref, int *ref) |
int | GetLiteralRepresentative (int ref) const |
int | GetVariableRepresentative (int ref) const |
int | NumAffineRelations () const |
int | NumEquivRelations () const |
AffineRelation::Relation | GetAffineRelation (int ref) const |
std::string | RefDebugString (int ref) const |
std::string | AffineRelationDebugString (int ref) const |
bool | PropagateAffineRelation (int ref) |
void | InitializeNewDomains () |
void | ClearStats () |
void | InsertVarValueEncoding (int literal, int ref, int64 value) |
int | GetOrCreateVarValueEncoding (int ref, int64 value) |
void | CanonicalizeDomainOfSizeTwo (int var) |
bool | HasVarValueEncoding (int ref, int64 value, int *literal=nullptr) |
bool | StoreLiteralImpliesVarEqValue (int literal, int var, int64 value) |
bool | StoreLiteralImpliesVarNEqValue (int literal, int var, int64 value) |
void | ReadObjectiveFromProto () |
ABSL_MUST_USE_RESULT bool | CanonicalizeObjective () |
void | WriteObjectiveToProto () const |
bool | SubstituteVariableInObjective (int var_in_equality, int64 coeff_in_equality, const ConstraintProto &equality, std::vector< int > *new_vars_in_objective=nullptr) |
const Domain & | ObjectiveDomain () const |
const absl::flat_hash_map< int, int64 > & | ObjectiveMap () const |
bool | ObjectiveDomainIsConstraining () const |
void | RemoveVariableFromAffineRelation (int var) |
void | RemoveAllVariablesFromAffineRelationConstraint () |
const std::vector< int > & | ConstraintToVars (int c) const |
const absl::flat_hash_set< int > & | VarToConstraints (int var) const |
int | IntervalUsage (int c) const |
void | RegisterVariablesUsedInAssumptions () |
int | GetOrCreateReifiedPrecedenceLiteral (int time_i, int time_j, int active_i, int active_j) |
void | ClearPrecedenceCache () |
bool | log_info () const |
const SatParameters & | params () const |
TimeLimit * | time_limit () |
ModelRandomGenerator * | random () |
Public Attributes | |
std::vector< absl::flat_hash_set< int > > | var_to_ub_only_constraints |
std::vector< absl::flat_hash_set< int > > | var_to_lb_only_constraints |
CpModelProto * | working_model = nullptr |
CpModelProto * | mapping_model = nullptr |
bool | keep_all_feasible_solutions = false |
bool | enable_stats = true |
absl::flat_hash_map< std::string, int > | stats_by_rule_name |
int64 | num_presolve_operations = 0 |
std::vector< int > | tmp_literals |
std::vector< Domain > | tmp_term_domains |
std::vector< Domain > | tmp_left_domains |
absl::flat_hash_set< int > | tmp_literal_set |
SparseBitset< int64 > | modified_domains |
DomainDeductions | deductions |
|
inlineexplicit |
Definition at line 70 of file presolve_context.h.
void AddImplication | ( | int | a, |
int | b | ||
) |
Definition at line 55 of file presolve_context.cc.
void AddImplyInDomain | ( | int | b, |
int | x, | ||
const Domain & | domain | ||
) |
Definition at line 62 of file presolve_context.cc.
std::string AffineRelationDebugString | ( | int | ref | ) | const |
Definition at line 760 of file presolve_context.cc.
bool CanBeUsedAsLiteral | ( | int | ref | ) | const |
Definition at line 84 of file presolve_context.cc.
void CanonicalizeDomainOfSizeTwo | ( | int | var | ) |
Definition at line 865 of file presolve_context.cc.
bool CanonicalizeObjective | ( | ) |
Definition at line 1180 of file presolve_context.cc.
void ClearPrecedenceCache | ( | ) |
Definition at line 1466 of file presolve_context.cc.
void ClearStats | ( | ) |
Definition at line 32 of file presolve_context.cc.
|
inline |
Definition at line 324 of file presolve_context.h.
bool ConstraintVariableGraphIsUpToDate | ( | ) | const |
Definition at line 352 of file presolve_context.cc.
bool ConstraintVariableUsageIsConsistent | ( | ) |
Definition at line 371 of file presolve_context.cc.
bool DomainContains | ( | int | ref, |
int64 | value | ||
) | const |
Definition at line 231 of file presolve_context.cc.
bool DomainIsEmpty | ( | int | ref | ) | const |
Definition at line 74 of file presolve_context.cc.
Domain DomainOf | ( | int | ref | ) | const |
Definition at line 221 of file presolve_context.cc.
|
inline |
Definition at line 108 of file presolve_context.h.
void ExploitFixedDomain | ( | int | var | ) |
Definition at line 447 of file presolve_context.cc.
bool GetAbsRelation | ( | int | target_ref, |
int * | ref | ||
) |
Definition at line 686 of file presolve_context.cc.
AffineRelation::Relation GetAffineRelation | ( | int | ref | ) | const |
Definition at line 743 of file presolve_context.cc.
int GetLiteralRepresentative | ( | int | ref | ) | const |
Definition at line 704 of file presolve_context.cc.
int GetOrCreateConstantVar | ( | int64 | cst | ) |
Definition at line 43 of file presolve_context.cc.
int GetOrCreateReifiedPrecedenceLiteral | ( | int | time_i, |
int | time_j, | ||
int | active_i, | ||
int | active_j | ||
) |
Definition at line 1404 of file presolve_context.cc.
int GetOrCreateVarValueEncoding | ( | int | ref, |
int64 | value | ||
) |
Definition at line 1078 of file presolve_context.cc.
int GetVariableRepresentative | ( | int | ref | ) | const |
Definition at line 733 of file presolve_context.cc.
bool HasVarValueEncoding | ( | int | ref, |
int64 | value, | ||
int * | literal = nullptr |
||
) |
Definition at line 1064 of file presolve_context.cc.
void InitializeNewDomains | ( | ) |
Definition at line 767 of file presolve_context.cc.
void InsertVarValueEncoding | ( | int | literal, |
int | ref, | ||
int64 | value | ||
) |
Definition at line 1040 of file presolve_context.cc.
ABSL_MUST_USE_RESULT bool IntersectDomainWith | ( | int | ref, |
const Domain & | domain, | ||
bool * | domain_modified = nullptr |
||
) |
Definition at line 238 of file presolve_context.cc.
|
inline |
Definition at line 332 of file presolve_context.h.
bool IsFixed | ( | int | ref | ) | const |
Definition at line 78 of file presolve_context.cc.
bool LiteralIsFalse | ( | int | lit | ) | const |
Definition at line 98 of file presolve_context.cc.
bool LiteralIsTrue | ( | int | lit | ) | const |
Definition at line 89 of file presolve_context.cc.
|
inline |
Definition at line 358 of file presolve_context.h.
void MarkVariableAsRemoved | ( | int | ref | ) |
Definition at line 190 of file presolve_context.cc.
int64 MaxOf | ( | const LinearExpressionProto & | expr | ) | const |
Definition at line 132 of file presolve_context.cc.
int64 MaxOf | ( | int | ref | ) | const |
Definition at line 113 of file presolve_context.cc.
int64 MinOf | ( | const LinearExpressionProto & | expr | ) | const |
Definition at line 119 of file presolve_context.cc.
int64 MinOf | ( | int | ref | ) | const |
Definition at line 107 of file presolve_context.cc.
|
inline |
Definition at line 152 of file presolve_context.h.
int NewBoolVar | ( | ) |
Definition at line 41 of file presolve_context.cc.
int NewIntVar | ( | const Domain & | domain | ) |
Definition at line 34 of file presolve_context.cc.
|
inline |
Definition at line 144 of file presolve_context.h.
|
inline |
Definition at line 212 of file presolve_context.h.
|
inline |
Definition at line 213 of file presolve_context.h.
|
inline |
Definition at line 305 of file presolve_context.h.
|
inline |
Definition at line 309 of file presolve_context.h.
|
inline |
Definition at line 306 of file presolve_context.h.
|
inline |
Definition at line 359 of file presolve_context.h.
bool PropagateAffineRelation | ( | int | ref | ) |
Definition at line 471 of file presolve_context.cc.
|
inline |
Definition at line 361 of file presolve_context.h.
void ReadObjectiveFromProto | ( | ) |
Definition at line 1137 of file presolve_context.cc.
std::string RefDebugString | ( | int | ref | ) | const |
Definition at line 755 of file presolve_context.cc.
|
inline |
Definition at line 339 of file presolve_context.h.
void RemoveAllVariablesFromAffineRelationConstraint | ( | ) |
Definition at line 493 of file presolve_context.cc.
void RemoveVariableFromAffineRelation | ( | int | var | ) |
Definition at line 502 of file presolve_context.cc.
ABSL_MUST_USE_RESULT bool SetLiteralToFalse | ( | int | lit | ) |
Definition at line 275 of file presolve_context.cc.
ABSL_MUST_USE_RESULT bool SetLiteralToTrue | ( | int | lit | ) |
Definition at line 281 of file presolve_context.cc.
bool StoreAbsRelation | ( | int | target_ref, |
int | ref | ||
) |
Definition at line 671 of file presolve_context.cc.
Definition at line 530 of file presolve_context.cc.
void StoreBooleanEqualityRelation | ( | int | ref_a, |
int | ref_b | ||
) |
Definition at line 645 of file presolve_context.cc.
bool StoreLiteralImpliesVarEqValue | ( | int | literal, |
int | var, | ||
int64 | value | ||
) |
Definition at line 1048 of file presolve_context.cc.
bool StoreLiteralImpliesVarNEqValue | ( | int | literal, |
int | var, | ||
int64 | value | ||
) |
Definition at line 1056 of file presolve_context.cc.
bool SubstituteVariableInObjective | ( | int | var_in_equality, |
int64 | coeff_in_equality, | ||
const ConstraintProto & | equality, | ||
std::vector< int > * | new_vars_in_objective = nullptr |
||
) |
Definition at line 1301 of file presolve_context.cc.
|
inline |
Definition at line 360 of file presolve_context.h.
void UpdateConstraintVariableUsage | ( | int | c | ) |
Definition at line 318 of file presolve_context.cc.
void UpdateNewConstraintsVariableUsage | ( | ) |
Definition at line 356 of file presolve_context.cc.
void UpdateRuleStats | ( | const std::string & | name, |
int | num_times = 1 |
||
) |
Definition at line 285 of file presolve_context.cc.
bool VariableIsNotUsedAnymore | ( | int | ref | ) | const |
Definition at line 185 of file presolve_context.cc.
bool VariableIsOnlyUsedInEncoding | ( | int | ref | ) | const |
Definition at line 215 of file presolve_context.cc.
bool VariableIsUniqueAndRemovable | ( | int | ref | ) | const |
Definition at line 165 of file presolve_context.cc.
bool VariableWasRemoved | ( | int | ref | ) | const |
Definition at line 197 of file presolve_context.cc.
bool VariableWithCostIsUniqueAndRemovable | ( | int | ref | ) | const |
Definition at line 174 of file presolve_context.cc.
|
inline |
Definition at line 328 of file presolve_context.h.
void WriteObjectiveToProto | ( | ) | const |
Definition at line 1384 of file presolve_context.cc.
DomainDeductions deductions |
Definition at line 408 of file presolve_context.h.
bool enable_stats = true |
Definition at line 386 of file presolve_context.h.
bool keep_all_feasible_solutions = false |
Definition at line 382 of file presolve_context.h.
CpModelProto* mapping_model = nullptr |
Definition at line 375 of file presolve_context.h.
SparseBitset<int64> modified_domains |
Definition at line 405 of file presolve_context.h.
int64 num_presolve_operations = 0 |
Definition at line 396 of file presolve_context.h.
absl::flat_hash_map<std::string, int> stats_by_rule_name |
Definition at line 389 of file presolve_context.h.
std::vector<Domain> tmp_left_domains |
Definition at line 401 of file presolve_context.h.
absl::flat_hash_set<int> tmp_literal_set |
Definition at line 402 of file presolve_context.h.
std::vector<int> tmp_literals |
Definition at line 399 of file presolve_context.h.
std::vector<Domain> tmp_term_domains |
Definition at line 400 of file presolve_context.h.
std::vector<absl::flat_hash_set<int> > var_to_lb_only_constraints |
Definition at line 372 of file presolve_context.h.
std::vector<absl::flat_hash_set<int> > var_to_ub_only_constraints |
Definition at line 371 of file presolve_context.h.
CpModelProto* working_model = nullptr |
Definition at line 374 of file presolve_context.h.