polish CP-SAT cut management code
This commit is contained in:
@@ -149,7 +149,6 @@ LinearConstraintManager::ConstraintIndex LinearConstraintManager::Add(
|
||||
ct_info.objective_parallelism_computed = false;
|
||||
ct_info.objective_parallelism = 0.0;
|
||||
ct_info.inactive_count = 0;
|
||||
ct_info.permanently_removed = false;
|
||||
ct_info.hash = key;
|
||||
equiv_constraints_[key] = ct_index;
|
||||
|
||||
@@ -383,8 +382,6 @@ bool LinearConstraintManager::ChangeLp(
|
||||
// ones that are currently not satisfied by at least "tolerance".
|
||||
const double tolerance = 1e-6;
|
||||
for (ConstraintIndex i(0); i < constraint_infos_.size(); ++i) {
|
||||
if (constraint_infos_[i].permanently_removed) continue;
|
||||
|
||||
// Inprocessing of the constraint.
|
||||
if (simplify_constraints &&
|
||||
SimplifyConstraint(&constraint_infos_[i].constraint)) {
|
||||
@@ -491,7 +488,6 @@ bool LinearConstraintManager::ChangeLp(
|
||||
}
|
||||
|
||||
const ConstraintIndex new_constraint = new_constraints[j];
|
||||
if (constraint_infos_[new_constraint].permanently_removed) continue;
|
||||
if (constraint_infos_[new_constraint].is_in_lp) continue;
|
||||
|
||||
if (last_added_candidate != kInvalidConstraintIndex) {
|
||||
@@ -505,15 +501,13 @@ bool LinearConstraintManager::ChangeLp(
|
||||
std::min(new_constraints_orthogonalities[j], current_orthogonality);
|
||||
}
|
||||
|
||||
// NOTE(user): It is safe to permanently remove this constraint as the
|
||||
// constraint that is almost parallel to this constraint is present in the
|
||||
// LP or is inactive for a long time and is removed from the LP. In either
|
||||
// case, this constraint is not adding significant value and is only
|
||||
// making the LP larger.
|
||||
// NOTE(user): It is safe to not add this constraint as the constraint
|
||||
// that is almost parallel to this constraint is present in the LP or is
|
||||
// inactive for a long time and is removed from the LP. In either case,
|
||||
// this constraint is not adding significant value and is only making the
|
||||
// LP larger.
|
||||
if (new_constraints_orthogonalities[j] <
|
||||
sat_parameters_.min_orthogonality_for_lp_constraints()) {
|
||||
constraint_infos_[new_constraint].permanently_removed = true;
|
||||
VLOG(2) << "Constraint permanently removed: " << new_constraint;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -49,9 +49,6 @@ class LinearConstraintManager {
|
||||
double objective_parallelism;
|
||||
bool objective_parallelism_computed;
|
||||
bool is_in_lp;
|
||||
// A constraint might be marked for permanent removal if it is almost
|
||||
// parallel to one of the existing constraints in the LP.
|
||||
bool permanently_removed;
|
||||
size_t hash;
|
||||
double current_score;
|
||||
};
|
||||
|
||||
@@ -595,7 +595,7 @@ message SatParameters {
|
||||
// constraints during current call. Orthogonality is defined as 1 -
|
||||
// cosine(vector angle between constraints). A value of zero disable this
|
||||
// feature.
|
||||
optional double min_orthogonality_for_lp_constraints = 115 [default = 0.0];
|
||||
optional double min_orthogonality_for_lp_constraints = 115 [default = 0.05];
|
||||
|
||||
// Max number of time we perform cut generation and resolve the LP at level 0.
|
||||
optional int32 max_cut_rounds_at_level_zero = 154 [default = 1];
|
||||
|
||||
Reference in New Issue
Block a user