var_free(var);
}
+void System::variable_free_all()
+{
+ Variable* var;
+ while ((var = extract_variable()))
+ variable_free(var);
+}
+
void System::expand(Constraint* cnst, Variable* var, double consumption_weight)
{
modified_ = true;
cnst->cnst_light_ = nullptr;
}
} else {
- cnst->cnst_light_->remaining_over_usage = cnst->remaining_ / cnst->usage_;
+ if (cnst->cnst_light_) {
+ cnst->cnst_light_->remaining_over_usage = cnst->remaining_ / cnst->usage_;
+ }
}
elem.make_inactive();
} else {
cnst->cnst_light_ = nullptr;
}
} else {
- cnst->cnst_light_->remaining_over_usage = cnst->remaining_ / cnst->usage_;
- xbt_assert(not cnst->active_element_set_.empty(),
- "Should not keep a maximum constraint that has no active"
- " element! You want to check the maxmin precision and possible rounding effects.");
+ if (cnst->cnst_light_) {
+ cnst->cnst_light_->remaining_over_usage = cnst->remaining_ / cnst->usage_;
+ xbt_assert(not cnst->active_element_set_.empty(),
+ "Should not keep a maximum constraint that has no active"
+ " element! You want to check the maxmin precision and possible rounding effects.");
+ }
}
}
}