class XBT_PUBLIC Constraint {
public:
Constraint() = delete;
- Constraint(void* id_value, double bound_value);
+ Constraint(resource::Resource* id_value, double bound_value);
/** @brief Unshare a constraint. */
void unshare() { sharing_policy_ = s4u::Link::SharingPolicy::FATPIPE; }
* @brief Get the data associated to a constraint
* @return The data associated to the constraint
*/
- void* get_id() const { return id_; }
+ resource::Resource* get_id() const { return id_; }
/* hookup to system */
boost::intrusive::list_member_hook<> constraint_set_hook_;
static int next_rank_; // To give a separate rank_ to each contraint
int concurrency_limit_; /* The maximum number of variables that may be enabled at any time (stage variables if
* necessary) */
- void* id_;
+ resource::Resource* id_;
};
/**
*/
class XBT_PUBLIC Variable {
public:
- void initialize(resource::Action* id_value, double sharing_weight_value, double bound_value,
- int number_of_constraints, unsigned visited_value);
+ void initialize(resource::Action* id_value, double sharing_penalty, double bound_value, int number_of_constraints,
+ unsigned visited_value);
/** @brief Get the value of the variable after the last lmm solve */
double get_value() const { return value_; }
/** @brief Get the data associated to a variable */
resource::Action* get_id() const { return id_; }
- /** @brief Get the weight of a variable */
- double get_weight() const { return sharing_weight_; }
+ /** @brief Get the penalty of a variable */
+ double get_penalty() const { return sharing_penalty_; }
/** @brief Measure the minimum concurrency slack across all constraints where the given var is involved */
int get_min_concurrency_slack() const;
/** @brief Check if a variable can be enabled
- * Make sure to set staged_weight before, if your intent is only to check concurrency
+ * Make sure to set staged_penalty before, if your intent is only to check concurrency
*/
- int can_enable() const { return staged_weight_ > 0 && get_min_concurrency_slack() >= concurrency_share_; }
+ int can_enable() const { return staged_penalty_ > 0 && get_min_concurrency_slack() >= concurrency_share_; }
/* hookup to system */
boost::intrusive::list_member_hook<> variable_set_hook_;
std::vector<Element> cnsts_;
- // sharing_weight: variable's impact on the resource during the sharing
+ // sharing_penalty: variable's impact on the resource during the sharing
// if == 0, the variable is not considered by LMM
// on CPU, actions with N threads have a sharing of N
- // on network, the actions with higher latency have a lesser sharing_weight
- double sharing_weight_;
+ // on network, the actions with higher latency have a lesser sharing_penalty
+ double sharing_penalty_;
- double staged_weight_; /* If non-zero, variable is staged for addition as soon as maxconcurrency constraints will be
+ double staged_penalty_; /* If non-zero, variable is staged for addition as soon as maxconcurrency constraints will be
met */
double bound_;
double value_;
* @param id Data associated to the constraint (e.g.: a network link)
* @param bound_value The bound value of the constraint
*/
- Constraint* constraint_new(void* id, double bound_value);
+ Constraint* constraint_new(resource::Resource* id, double bound_value);
/**
* @brief Create a new Linear MaxMin variable
*/
void variable_free(Variable * var);
+ /** @brief Free all variables */
+ void variable_free_all();
+
/**
* @brief Associate a variable to a constraint with a coefficient
* @param cnst A constraint
/** @brief Update the bound of a variable */
void update_variable_bound(Variable * var, double bound);
- /**
- * @brief Update the weight of a variable
- * @param var A variable
- * @param weight The new weight of the variable
- */
- void update_variable_weight(Variable * var, double weight);
+ /** @brief Update the sharing penalty of a variable */
+ void update_variable_penalty(Variable* var, double penalty);
/** @brief Update a constraint bound */
void update_constraint_bound(Constraint * cnst, double bound);