polish cumulative presolve in CP-SAT
This commit is contained in:
@@ -2245,17 +2245,18 @@ bool PresolveCumulative(ConstraintProto* ct, PresolveContext* context) {
|
||||
// Filter absent intervals.
|
||||
int new_size = 0;
|
||||
bool changed = false;
|
||||
int removed_zero_demands = 0;
|
||||
int num_zero_demand_removed = 0;
|
||||
for (int i = 0; i < proto.intervals_size(); ++i) {
|
||||
if (context->working_model->constraints(proto.intervals(i))
|
||||
.constraint_case() ==
|
||||
ConstraintProto::ConstraintCase::CONSTRAINT_NOT_SET) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const int demand_ref = proto.demands(i);
|
||||
const int64 demand_max = context->MaxOf(demand_ref);
|
||||
if (demand_max == 0) {
|
||||
removed_zero_demands++;
|
||||
num_zero_demand_removed++;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -2269,8 +2270,8 @@ bool PresolveCumulative(ConstraintProto* ct, PresolveContext* context) {
|
||||
ct->mutable_cumulative()->mutable_demands()->Truncate(new_size);
|
||||
}
|
||||
|
||||
if (removed_zero_demands > 0) {
|
||||
context->UpdateRuleStats("cumulative: removed null demands");
|
||||
if (num_zero_demand_removed > 0) {
|
||||
context->UpdateRuleStats("cumulative: removed intervals with no demands");
|
||||
}
|
||||
|
||||
if (HasEnforcementLiteral(*ct)) return changed;
|
||||
|
||||
@@ -2100,12 +2100,12 @@ CpSolverResponse SolveCpModelWithLNS(
|
||||
total_num_calls++;
|
||||
generators[selected_generator]->AddSolveData(
|
||||
objective_diff, local_response.deterministic_time());
|
||||
// TODO(user): Print the status in a better format.
|
||||
VLOG(2)
|
||||
<< generators[selected_generator]->name()
|
||||
<< ": [difficulty: " << difficulty.value()
|
||||
<< ", deterministic time: " << local_response.deterministic_time()
|
||||
<< ", status: " << local_response.status()
|
||||
<< ", status: "
|
||||
<< ProtoEnumToString<CpSolverStatus>(local_response.status())
|
||||
<< ", num calls: " << generators[selected_generator]->num_calls()
|
||||
<< ", UCB1 Score: "
|
||||
<< generators[selected_generator]->GetUCBScore(total_num_calls)
|
||||
|
||||
Reference in New Issue
Block a user