Skip to content

Commit 5215e10

Browse files
committed
routing: Fix indent in routing_filters
1 parent 0eb35f3 commit 5215e10

File tree

2 files changed

+19
-21
lines changed

2 files changed

+19
-21
lines changed

ortools/constraint_solver/routing.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1831,11 +1831,9 @@ IntVar* RoutingModel::CreateDisjunction(DisjunctionIndex disjunction) {
18311831
}
18321832
const int64_t max_cardinality =
18331833
disjunctions_[disjunction].value.max_cardinality;
1834-
18351834
IntVar* number_active_vars = solver_->MakeIntVar(0, max_cardinality);
18361835
solver_->AddConstraint(
18371836
solver_->MakeSumEquality(disjunction_vars, number_active_vars));
1838-
18391837
const int64_t penalty = disjunctions_[disjunction].value.penalty;
18401838
// If penalty is negative, then disjunction is mandatory
18411839
// i.e. number of active vars must be equal to max cardinality.

ortools/constraint_solver/routing_filters.cc

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -283,26 +283,26 @@ class NodeDisjunctionFilter : public IntVarLocalSearchFilter {
283283
(current_inactive_nodes + inactive_nodes_delta) -
284284
max_inactive_cardinality;
285285
if (inactive_nodes_above_limit > 0 && penalty < 0) {
286-
// Nodes are mandatory, i.e. exactly max_cardinality nodes must be
287-
// performed, so the move is not acceptable.
288-
return false;
289-
}
286+
// Nodes are mandatory, i.e. exactly max_cardinality nodes must be
287+
// performed, so the move is not acceptable.
288+
return false;
289+
}
290290
const RoutingModel::PenaltyCostBehavior penalty_cost_behavior =
291291
routing_model_.GetDisjunctionPenaltyCostBehavior(disjunction_index);
292292
switch (penalty_cost_behavior) {
293293
case RoutingModel::PenaltyCostBehavior::PENALIZE_ONCE:
294294
if (inactive_nodes_above_limit > 0) { // penalty cost to update
295-
if (current_inactive_nodes <= max_inactive_cardinality) {
295+
if (current_inactive_nodes <= max_inactive_cardinality) {
296296
// Add penalty if there were not too many inactive nodes before
297297
// the move.
298-
CapAddTo(penalty, &accepted_objective_value_);
299-
}
298+
CapAddTo(penalty, &accepted_objective_value_);
299+
}
300300
} else { // no more penalty cost
301301
if (current_inactive_nodes > max_inactive_cardinality) {
302-
// Remove penalty if there were too many inactive nodes before the
302+
// Remove penalty if there were too many inactive nodes before the
303303
// move.
304-
accepted_objective_value_ =
305-
CapSub(accepted_objective_value_, penalty);
304+
accepted_objective_value_ =
305+
CapSub(accepted_objective_value_, penalty);
306306
}
307307
}
308308
break;
@@ -322,12 +322,12 @@ class NodeDisjunctionFilter : public IntVarLocalSearchFilter {
322322
if (current_inactive_nodes > max_inactive_cardinality) {
323323
// Remove penalty if there were too many inactive nodes before the
324324
// move.
325-
const int current_inactive_nodes_above_limit =
326-
current_inactive_nodes - max_inactive_cardinality;
327-
accepted_objective_value_ =
328-
CapSub(accepted_objective_value_,
329-
penalty * current_inactive_nodes_above_limit);
330-
}
325+
const int current_inactive_nodes_above_limit =
326+
current_inactive_nodes - max_inactive_cardinality;
327+
accepted_objective_value_ =
328+
CapSub(accepted_objective_value_,
329+
penalty * current_inactive_nodes_above_limit);
330+
}
331331
}
332332
break;
333333
}
@@ -374,11 +374,11 @@ class NodeDisjunctionFilter : public IntVarLocalSearchFilter {
374374
if (inactive_nodes_above_limit > 0 && penalty > 0) {
375375
switch (penalty_cost_behavior) {
376376
case RoutingModel::PenaltyCostBehavior::PENALIZE_ONCE:
377-
CapAddTo(penalty, &synchronized_objective_value_);
377+
CapAddTo(penalty, &synchronized_objective_value_);
378378
break;
379379
case RoutingModel::PenaltyCostBehavior::PENALIZE_PER_INACTIVE:
380-
CapAddTo(penalty * inactive_nodes_above_limit,
381-
&synchronized_objective_value_);
380+
CapAddTo(penalty * inactive_nodes_above_limit,
381+
&synchronized_objective_value_);
382382
break;
383383
}
384384
}

0 commit comments

Comments
 (0)