* the corresponding action will enable it (at least this is the idea).
* \li Enabled elements which variable's weight is non-zero. They are utilized in some LMM functions.
* \li Active elements which variable's weight is non-zero (i.e. it is enabled) AND its element value is non-zero.
- * LMM_solve iterates over active elements during resolution, dynamically making them active or unactive.
+ * LMM_solve iterates over active elements during resolution, dynamically making them active or inactive.
*/
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_;
ConstraintLight* cnst_light_;
private:
- static int next_rank_; // To give a separate rank_ to each contraint
+ static int next_rank_; // To give a separate rank_ to each constraint
int concurrency_limit_; /* The maximum number of variables that may be enabled at any time (stage variables if
* necessary) */
- void* id_;
+ resource::Resource* id_;
};
/**
* @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
* @param id Data associated to the variable (e.g.: a network communication)
- * @param weight_value The weight of the variable (0.0 if not used)
+ * @param sharing_penalty The weight of the variable (0.0 if not used)
* @param bound The maximum value of the variable (-1.0 if no maximum value)
- * @param number_of_constraints The maximum number of constraint to associate to the variable
+ * @param number_of_constraints The maximum number of constraints to associate to the variable
*/
- Variable* variable_new(resource::Action* id, double weight_value, double bound, size_t number_of_constraints);
+ Variable* variable_new(resource::Action* id, double sharing_penalty, double bound = -1.0,
+ size_t number_of_constraints = 1);
/**
* @brief Free a 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
resource::Action::ModifiedSet* modified_set_ = nullptr;
private:
+
+ typedef std::vector<int> dyn_light_t;
+
+ //Data used in lmm::solve
+ std::vector<ConstraintLight> cnst_light_vec;
+ dyn_light_t saturated_constraints;
+
bool selective_update_active; /* flag to update partially the system only selecting changed portions */
unsigned visited_counter_ = 1; /* used by System::update_modified_set() and System::remove_all_modified_set() to
* cleverly (un-)flag the constraints (more details in these functions) */