-/* Copyright (c) 2004-2017. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2004-2018. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
*
* max( var1.weight * var1.value * elem5.value , var3.weight * var3.value * elem6.value ) <= cons3.bound
*
- * This is usefull for the sharing of resources for various models.
+ * This is useful for the sharing of resources for various models.
* For instance, for the network model, each link is associated to a constraint and each communication to a variable.
*
* Implementation details
/** Default functions associated to the chosen protocol. When using the lagrangian approach. */
XBT_PUBLIC(void)
-lmm_set_default_protocol_function(double (*func_f)(const Variable& var, double x),
- double (*func_fp)(const Variable& var, double x),
- double (*func_fpi)(const Variable& var, double x));
+set_default_protocol_function(double (*func_f)(const Variable& var, double x),
+ double (*func_fp)(const Variable& var, double x),
+ double (*func_fpi)(const Variable& var, double x));
XBT_PUBLIC(double) func_reno_f(const Variable& var, double x);
XBT_PUBLIC(double) func_reno_fp(const Variable& var, double x);
* Then, it is used to list all variables involved in constraint through constraint's xxx_element_set lists, or
* vice-versa list all constraints for a given variable.
*/
-XBT_PUBLIC_CLASS s_lmm_element_t
+XBT_PUBLIC_CLASS Element
{
public:
int get_concurrency() const;
XBT_PUBLIC_CLASS Constraint
{
public:
- Constraint() = default;
+ Constraint() = delete;
Constraint(void* id_value, double bound_value);
/** @brief Unshare a constraint. */
/**
* @brief Sets the concurrency limit for this constraint
- * @param concurrency_limit The concurrency limit to use for this constraint
+ * @param limit The concurrency limit to use for this constraint
*/
void set_concurrency_limit(int limit)
{
boost::intrusive::list_member_hook<> active_constraint_set_hook;
boost::intrusive::list_member_hook<> modified_constraint_set_hook;
boost::intrusive::list_member_hook<> saturated_constraint_set_hook;
- boost::intrusive::list<s_lmm_element_t,
- boost::intrusive::member_hook<s_lmm_element_t, boost::intrusive::list_member_hook<>,
- &s_lmm_element_t::enabled_element_set_hook>>
+ boost::intrusive::list<Element, boost::intrusive::member_hook<Element, boost::intrusive::list_member_hook<>,
+ &Element::enabled_element_set_hook>>
enabled_element_set;
- boost::intrusive::list<s_lmm_element_t,
- boost::intrusive::member_hook<s_lmm_element_t, boost::intrusive::list_member_hook<>,
- &s_lmm_element_t::disabled_element_set_hook>>
+ boost::intrusive::list<Element, boost::intrusive::member_hook<Element, boost::intrusive::list_member_hook<>,
+ &Element::disabled_element_set_hook>>
disabled_element_set;
- boost::intrusive::list<s_lmm_element_t,
- boost::intrusive::member_hook<s_lmm_element_t, boost::intrusive::list_member_hook<>,
- &s_lmm_element_t::active_element_set_hook>>
+ boost::intrusive::list<Element, boost::intrusive::member_hook<Element, boost::intrusive::list_member_hook<>,
+ &Element::active_element_set_hook>>
active_element_set;
double remaining;
double usage;
int concurrency_maximum; /* The maximum number of (enabled and disabled) variables associated to the constraint at any
* given time (essentially for tracing)*/
- int sharing_policy; /* see @e_surf_link_sharing_policy_t (0: FATPIPE, 1: SHARED, 2: FULLDUPLEX) */
+ int sharing_policy; /* see @e_surf_link_sharing_policy_t (0: FATPIPE, 1: SHARED, 2: SPLITDUPLEX) */
int id_int;
double lambda;
double new_lambda;
/**
* @brief Set the concurrent share of the variable
- * @param concurrency_share The new concurrency share
+ * @param value The new concurrency share
*/
void set_concurrency_share(short int value) { concurrency_share = value; }
boost::intrusive::list_member_hook<> variable_set_hook;
boost::intrusive::list_member_hook<> saturated_variable_set_hook;
- std::vector<s_lmm_element_t> cnsts;
+ std::vector<Element> cnsts;
// sharing_weight: variable's impact on the resource during the sharing
// if == 0, the variable is not considered by LMM
short int concurrency_share; /* The maximum number of elements that variable will add to a constraint */
simgrid::surf::Action* id;
int id_int;
- unsigned visited; /* used by lmm_update_modified_set */
+ unsigned visited; /* used by System::update_modified_set() */
/* \begin{For Lagrange only} */
double mu;
double new_mu;
static int Global_debug_id;
};
-inline void s_lmm_element_t::make_active()
+inline void Element::make_active()
{
constraint->active_element_set.push_front(*this);
}
-inline void s_lmm_element_t::make_inactive()
+inline void Element::make_inactive()
{
if (active_element_set_hook.is_linked())
simgrid::xbt::intrusive_erase(constraint->active_element_set, *this);
/**
* @brief LMM system
*/
-XBT_PUBLIC_CLASS s_lmm_system_t
+XBT_PUBLIC_CLASS System
{
public:
/**
* @brief Create a new Linear MaxMim system
* @param selective_update whether we should do lazy updates
*/
- explicit s_lmm_system_t(bool selective_update);
+ explicit System(bool selective_update);
/** @brief Free an existing Linear MaxMin system */
- ~s_lmm_system_t();
+ ~System();
/**
* @brief Create a new Linear MaxMin constraint
private:
bool selective_update_active; /* flag to update partially the system only selecting changed portions */
- unsigned visited_counter; /* used by lmm_update_modified_set and lmm_remove_modified_set to cleverly (un-)flag the
- * constraints (more details in these functions) */
+ unsigned visited_counter; /* used by System::update_modified_set() and System::remove_all_modified_set() to
+ * cleverly (un-)flag the constraints (more details in these functions) */
boost::intrusive::list<Constraint, boost::intrusive::member_hook<Constraint, boost::intrusive::list_member_hook<>,
&Constraint::constraint_set_hook>>
constraint_set;