int Variable::next_rank_ = 1;
int Constraint::next_rank_ = 1;
+Element::Element(Constraint* constraint, Variable* variable, double cweight)
+ : constraint(constraint), variable(variable), consumption_weight(cweight), max_consumption_weight(cweight)
+{
+}
+
int Element::get_concurrency() const
{
// Ignore element with weight less than one (e.g. cross-traffic)
xbt_assert(var->cnsts_.size() < var->cnsts_.capacity(), "Too much constraints");
- var->cnsts_.emplace_back();
+ var->cnsts_.emplace_back(cnst, var, consumption_weight);
Element& elem = var->cnsts_.back();
- elem.consumption_weight = consumption_weight;
- elem.max_consumption_weight = consumption_weight;
- elem.constraint = cnst;
- elem.variable = var;
-
if (var->sharing_penalty_ != 0.0) {
elem.constraint->enabled_element_set_.push_front(elem);
elem.increase_concurrency();
public:
// Use rule-of-three, and implicitely disable the move constructor which should be 'noexcept' according to C++ Core
// Guidelines.
- Element() = default;
+ Element(Constraint* constraint, Variable* variable, double cweight);
Element(const Element&) = default;
~Element() = default;
// - If network, then 1 in forward direction and 0.05 backward for the ACKs
double consumption_weight;
// maximum consumption weight (can be different from consumption_weight with subflows/ptasks)
- double max_consumption_weight = 0;
+ double max_consumption_weight;
};
class ConstraintLight {
public:
enum class SharingPolicy { NONLINEAR = 2, SHARED = 1, FATPIPE = 0 };
- Constraint() = delete;
Constraint(resource::Resource* id_value, double bound_value);
/** @brief Unshare a constraint. */