typedef simgrid::kernel::lmm::Element* lmm_element_t;
typedef const simgrid::kernel::lmm::Element* const_lmm_element_t;
-typedef simgrid::kernel::lmm::Variable* lmm_variable_t;
-typedef simgrid::kernel::lmm::Constraint* lmm_constraint_t;
typedef simgrid::kernel::lmm::ConstraintLight* lmm_constraint_light_t;
typedef simgrid::kernel::lmm::System* lmm_system_t;
for (Constraint const& cnst : cnst_list) {
double tmp = 0;
for (Element const& elem : cnst.enabled_element_set) {
- lmm_variable_t var = elem.variable;
+ Variable* var = elem.variable;
xbt_assert(var->sharing_weight > 0);
tmp += var->value;
}
}
}
-void System::var_free(lmm_variable_t var)
+void System::var_free(Variable* var)
{
XBT_IN("(sys=%p, var=%p)", this, var);
modified = true;
System::~System()
{
- lmm_variable_t var;
- lmm_constraint_t cnst;
+ Variable* var;
+ Constraint* cnst;
while ((var = extract_variable())) {
auto demangled = simgrid::xbt::demangle(typeid(*var->id).name());
xbt_mallocator_free(variable_mallocator);
}
-void System::cnst_free(lmm_constraint_t cnst)
+void System::cnst_free(Constraint* cnst)
{
make_constraint_inactive(cnst);
delete cnst;
cnst_light = nullptr;
}
-lmm_constraint_t System::constraint_new(void* id, double bound_value)
+Constraint* System::constraint_new(void* id, double bound_value)
{
- lmm_constraint_t cnst = new Constraint(id, bound_value);
+ Constraint* cnst = new Constraint(id, bound_value);
insert_constraint(cnst);
return cnst;
}
void System::variable_mallocator_free_f(void* var)
{
- delete static_cast<lmm_variable_t>(var);
+ delete static_cast<Variable*>(var);
}
-lmm_variable_t System::variable_new(simgrid::surf::Action* id, double sharing_weight, double bound,
- int number_of_constraints)
+Variable* System::variable_new(simgrid::surf::Action* id, double sharing_weight, double bound,
+ int number_of_constraints)
{
XBT_IN("(sys=%p, id=%p, weight=%f, bound=%f, num_cons =%d)", this, id, sharing_weight, bound, number_of_constraints);
- lmm_variable_t var = static_cast<lmm_variable_t>(xbt_mallocator_get(variable_mallocator));
+ Variable* var = static_cast<Variable*>(xbt_mallocator_get(variable_mallocator));
var->initialize(id, sharing_weight, bound, number_of_constraints, visited_counter - 1);
if (sharing_weight)
variable_set.push_front(*var);
return var;
}
-void System::variable_free(lmm_variable_t var)
+void System::variable_free(Variable* var)
{
remove_variable(var);
var_free(var);
}
-void System::expand(lmm_constraint_t cnst, lmm_variable_t var, double consumption_weight)
+void System::expand(Constraint* cnst, Variable* var, double consumption_weight)
{
modified = true;
check_concurrency();
}
-void System::expand_add(lmm_constraint_t cnst, lmm_variable_t var, double value)
+void System::expand_add(Constraint* cnst, Variable* var, double value)
{
modified = true;
check_concurrency();
}
-lmm_variable_t Constraint::get_variable(const_lmm_element_t* elem) const
+Variable* Constraint::get_variable(const_lmm_element_t* elem) const
{
if (*elem == nullptr) {
// That is the first call, pick the first element among enabled_element_set (or disabled_element_set if
// if we modify the list between calls, normal version may loop forever
// this safe version ensures that we browse the list elements only once
-lmm_variable_t Constraint::get_variable_safe(const_lmm_element_t* elem, const_lmm_element_t* nextelem,
- int* numelem) const
+Variable* Constraint::get_variable_safe(const_lmm_element_t* elem, const_lmm_element_t* nextelem, int* numelem) const
{
if (*elem == nullptr) {
*numelem = enabled_element_set.size() + disabled_element_set.size() - 1;
/* Update the usage of contraints where this variable is involved */
for (Element& elem : var.cnsts) {
- lmm_constraint_t cnst = elem.constraint;
+ Constraint* cnst = elem.constraint;
if (cnst->sharing_policy) {
// Remember: shared constraints require that sum(elem.value * var.value) < cnst->bound
double_update(&(cnst->remaining), elem.consumption_weight * var.value, cnst->bound * sg_maxmin_precision);
/** \brief Attribute the value bound to var->bound.
*
- * \param var the lmm_variable_t
+ * \param var the Variable*
* \param bound the new bound to associate with var
*
* Makes var->bound equal to bound. Whenever this function is called a change is signed in the system. To
* avoid false system changing detection it is a good idea to test (bound != 0) before calling it.
*/
-void System::update_variable_bound(lmm_variable_t var, double bound)
+void System::update_variable_bound(Variable* var, double bound)
{
modified = true;
var->bound = bound;
// with var when running System::update_modified_set().
// A priori not a big performance issue, but we might do better by calling System::update_modified_set() within the for
// loops (after doing the first for enabling==1, and before doing the last for disabling==1)
-void System::enable_var(lmm_variable_t var)
+void System::enable_var(Variable* var)
{
xbt_assert(not XBT_LOG_ISENABLED(surf_maxmin, xbt_log_priority_debug) || var->can_enable());
// Anyway, caller functions all call check_concurrency() in the end.
}
-void System::disable_var(lmm_variable_t var)
+void System::disable_var(Variable* var)
{
xbt_assert(not var->staged_weight, "Staged weight should have been cleared");
// Disabling the variable, move to var to list tail. Subtlety is: here, we need to call update_modified_set
* If yes, check that none of the constraints that this variable is involved in is at the limit of its concurrency
* And then add it to enabled variables
*/
-void System::on_disabled_var(lmm_constraint_t cnstr)
+void System::on_disabled_var(Constraint* cnstr)
{
if (cnstr->get_concurrency_limit() < 0)
return;
/* \brief update the weight of a variable, and enable/disable it.
* @return Returns whether a change was made
*/
-void System::update_variable_weight(lmm_variable_t var, double weight)
+void System::update_variable_weight(Variable* var, double weight)
{
xbt_assert(weight >= 0, "Variable weight should not be negative!");
XBT_OUT();
}
-void System::update_constraint_bound(lmm_constraint_t cnst, double bound)
+void System::update_constraint_bound(Constraint* cnst, double bound)
{
modified = true;
update_modified_set(cnst);
/** \brief Update the constraint set propagating recursively to other constraints so the system should not be entirely
* computed.
*
- * \param cnst the lmm_constraint_t affected by the change
+ * \param cnst the Constraint* affected by the change
*
* A recursive algorithm to optimize the system recalculation selecting only constraints that have changed. Each
* constraint change is propagated to the list of constraints for each variable.
*/
-void System::update_modified_set_rec(lmm_constraint_t cnst)
+void System::update_modified_set_rec(Constraint* cnst)
{
for (Element const& elem : cnst->enabled_element_set) {
- lmm_variable_t var = elem.variable;
+ Variable* var = elem.variable;
for (Element const& elem2 : var->cnsts) {
if (var->visited == visited_counter)
break;
}
}
-void System::update_modified_set(lmm_constraint_t cnst)
+void System::update_modified_set(Constraint* cnst)
{
/* nothing to do if selective update isn't active */
if (selective_update_active && not cnst->modified_constraint_set_hook.is_linked()) {
boost::intrusive::list_member_hook<> disabled_element_set_hook;
boost::intrusive::list_member_hook<> active_element_set_hook;
- lmm_constraint_t constraint;
- lmm_variable_t variable;
+ Constraint* constraint;
+ Variable* variable;
// consumption_weight: impact of 1 byte or flop of your application onto the resource (in byte or flop)
// - if CPU, then probably 1.
struct ConstraintLight {
double remaining_over_usage;
- lmm_constraint_t cnst;
+ Constraint* cnst;
};
/**
* @param elem A element of constraint of the constraint or NULL
* @return A variable associated to a constraint
*/
- lmm_variable_t get_variable(const_lmm_element_t* elem) const;
+ Variable* get_variable(const_lmm_element_t * elem) const;
/**
* @brief Get a var associated to a constraint
* @param numelem parameter representing the number of elements to go
* @return A variable associated to a constraint
*/
- lmm_variable_t get_variable_safe(const_lmm_element_t* elem, const_lmm_element_t* nextelem, int* numelem) const;
+ Variable* get_variable_safe(const_lmm_element_t * elem, const_lmm_element_t * nextelem, int* numelem) const;
/**
* @brief Get the data associated to a constraint
* @param num The rank of constraint we want to get
* @return The numth constraint
*/
- lmm_constraint_t get_constraint(unsigned num) const { return num < cnsts.size() ? cnsts[num].constraint : nullptr; }
+ Constraint* get_constraint(unsigned num) const { return num < cnsts.size() ? cnsts[num].constraint : nullptr; }
/**
* @brief Get the weigth of the numth constraint associated to the variable
* @param id Data associated to the constraint (e.g.: a network link)
* @param bound_value The bound value of the constraint
*/
- lmm_constraint_t constraint_new(void* id, double bound_value);
+ Constraint* constraint_new(void* id, double bound_value);
/**
* @brief Create a new Linear MaxMin variable
* @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
*/
- lmm_variable_t variable_new(simgrid::surf::Action* id, double weight_value, double bound, int number_of_constraints);
+ Variable* variable_new(simgrid::surf::Action * id, double weight_value, double bound, int number_of_constraints);
/**
* @brief Free a variable
* @param var The variable to free
*/
- void variable_free(lmm_variable_t var);
+ void variable_free(Variable * var);
/**
* @brief Associate a variable to a constraint with a coefficient
* @param var A variable
* @param value The coefficient associated to the variable in the constraint
*/
- void expand(lmm_constraint_t cnst, lmm_variable_t var, double value);
+ void expand(Constraint * cnst, Variable * var, double value);
/**
* @brief Add value to the coefficient between a constraint and a variable or create one
* @param var A variable
* @param value The value to add to the coefficient associated to the variable in the constraint
*/
- void expand_add(lmm_constraint_t cnst, lmm_variable_t var, double value);
+ void expand_add(Constraint * cnst, Variable * var, double value);
/**
* @brief Update the bound of a variable
* @param var A constraint
* @param bound The new bound
*/
- void update_variable_bound(lmm_variable_t var, double bound);
+ 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(lmm_variable_t var, double weight);
+ void update_variable_weight(Variable * var, double weight);
/**
* @brief Update a constraint bound
* @param cnst A constraint
* @param bound The new bound of the consrtaint
*/
- void update_constraint_bound(lmm_constraint_t cnst, double bound);
+ void update_constraint_bound(Constraint * cnst, double bound);
/**
* @brief [brief description]
* @param cnst A constraint
* @return [description]
*/
- int constraint_used(lmm_constraint_t cnst) { return cnst->active_constraint_set_hook.is_linked(); }
+ int constraint_used(Constraint * cnst) { return cnst->active_constraint_set_hook.is_linked(); }
/** @brief Print the lmm system */
void print() const;
static void* variable_mallocator_new_f();
static void variable_mallocator_free_f(void* var);
- void var_free(lmm_variable_t var);
- void cnst_free(lmm_constraint_t cnst);
- lmm_variable_t extract_variable()
+ void var_free(Variable * var);
+ void cnst_free(Constraint * cnst);
+ Variable* extract_variable()
{
if (variable_set.empty())
return nullptr;
- lmm_variable_t res = &variable_set.front();
+ Variable* res = &variable_set.front();
variable_set.pop_front();
return res;
}
- lmm_constraint_t extract_constraint()
+ Constraint* extract_constraint()
{
if (constraint_set.empty())
return nullptr;
- lmm_constraint_t res = &constraint_set.front();
+ Constraint* res = &constraint_set.front();
constraint_set.pop_front();
return res;
}
- void insert_constraint(lmm_constraint_t cnst) { constraint_set.push_back(*cnst); }
- void remove_variable(lmm_variable_t var)
+ void insert_constraint(Constraint * cnst) { constraint_set.push_back(*cnst); }
+ void remove_variable(Variable * var)
{
if (var->variable_set_hook.is_linked())
simgrid::xbt::intrusive_erase(variable_set, *var);
if (var->saturated_variable_set_hook.is_linked())
simgrid::xbt::intrusive_erase(saturated_variable_set, *var);
}
- void make_constraint_active(lmm_constraint_t cnst)
+ void make_constraint_active(Constraint * cnst)
{
if (not cnst->active_constraint_set_hook.is_linked())
active_constraint_set.push_back(*cnst);
}
- void make_constraint_inactive(lmm_constraint_t cnst)
+ void make_constraint_inactive(Constraint * cnst)
{
if (cnst->active_constraint_set_hook.is_linked())
simgrid::xbt::intrusive_erase(active_constraint_set, *cnst);
simgrid::xbt::intrusive_erase(modified_constraint_set, *cnst);
}
- void enable_var(lmm_variable_t var);
- void disable_var(lmm_variable_t var);
- void on_disabled_var(lmm_constraint_t cnstr);
+ void enable_var(Variable * var);
+ void disable_var(Variable * var);
+ void on_disabled_var(Constraint * cnstr);
/**
* @brief Update the value of element linking the constraint and the variable
* @param var A variable
* @param value The new value
*/
- void update(lmm_constraint_t cnst, lmm_variable_t var, double value);
+ void update(Constraint * cnst, Variable * var, double value);
- void update_modified_set(lmm_constraint_t cnst);
- void update_modified_set_rec(lmm_constraint_t cnst);
+ void update_modified_set(Constraint * cnst);
+ void update_modified_set_rec(Constraint * cnst);
/** @brief Remove all constraints of the modified_constraint_set. */
void remove_all_modified_set();
static std::unordered_map<std::string, StorageImpl*>* storagesMap() { return StorageImpl::storages; }
- lmm_constraint_t constraintWrite_; /* Constraint for maximum write bandwidth*/
- lmm_constraint_t constraintRead_; /* Constraint for maximum write bandwidth*/
+ kernel::lmm::Constraint* constraintWrite_; /* Constraint for maximum write bandwidth*/
+ kernel::lmm::Constraint* constraintRead_; /* Constraint for maximum write bandwidth*/
std::string typeId_;
std::string content_name; // Only used at parsing time then goes to the FileSystemExtension
* @param storage The Storage associated to this StorageAction
* @param type [description]
*/
- StorageAction(Model* model, double cost, bool failed, lmm_variable_t var, StorageImpl* storage,
+ StorageAction(Model* model, double cost, bool failed, kernel::lmm::Variable* var, StorageImpl* storage,
e_surf_action_storage_type_t type)
: Action(model, cost, failed, var), type_(type), storage_(storage){};
/** @brief take into account changes of speed (either load or max) */
void CpuCas01::onSpeedChange() {
- lmm_variable_t var = nullptr;
+ kernel::lmm::Variable* var = nullptr;
const_lmm_element_t elem = nullptr;
model()->getMaxminSystem()->update_constraint_bound(constraint(), coresAmount_ * speed_.scale * speed_.peak);
host_that_restart.push_back(getHost());
turnOn();
} else {
- lmm_constraint_t cnst = constraint();
- lmm_variable_t var = nullptr;
+ kernel::lmm::Constraint* cnst = constraint();
+ kernel::lmm::Variable* var = nullptr;
const_lmm_element_t elem = nullptr;
double date = surf_get_clock();
/**********
* Action *
**********/
-CpuCas01Action::CpuCas01Action(Model* model, double cost, bool failed, double speed, lmm_constraint_t constraint,
- int requestedCore)
+CpuCas01Action::CpuCas01Action(Model* model, double cost, bool failed, double speed,
+ kernel::lmm::Constraint* constraint, int requestedCore)
: CpuAction(model, cost, failed,
model->getMaxminSystem()->variable_new(this, 1.0 / requestedCore, requestedCore * speed, 1))
, requestedCore_(requestedCore)
model->getMaxminSystem()->expand(constraint, getVariable(), 1.0);
}
-CpuCas01Action::CpuCas01Action(Model* model, double cost, bool failed, double speed, lmm_constraint_t constraint)
+CpuCas01Action::CpuCas01Action(Model* model, double cost, bool failed, double speed,
+ kernel::lmm::Constraint* constraint)
: CpuCas01Action(model, cost, failed, speed, constraint, 1)
{
}
friend CpuAction *CpuCas01::execution_start(double size);
friend CpuAction *CpuCas01::sleep(double duration);
public:
- CpuCas01Action(Model* model, double cost, bool failed, double speed, lmm_constraint_t constraint, int coreAmount);
- CpuCas01Action(Model* model, double cost, bool failed, double speed, lmm_constraint_t constraint);
+ CpuCas01Action(Model* model, double cost, bool failed, double speed, kernel::lmm::Constraint* constraint,
+ int coreAmount);
+ CpuCas01Action(Model* model, double cost, bool failed, double speed, kernel::lmm::Constraint* constraint);
~CpuCas01Action() override;
int requestedCore();
{
}
-Cpu::Cpu(Model* model, simgrid::s4u::Host* host, lmm_constraint_t constraint, std::vector<double>* speedPerPstate,
- int core)
+Cpu::Cpu(Model* model, simgrid::s4u::Host* host, kernel::lmm::Constraint* constraint,
+ std::vector<double>* speedPerPstate, int core)
: Resource(model, host->getCname(), constraint), coresAmount_(core), host_(host)
{
xbt_assert(core > 0, "Host %s must have at least one core, not 0.", host->getCname());
* @param speedPerPstate Processor speed (in flop per second) for each pstate
* @param core The number of core of this Cpu
*/
- Cpu(simgrid::surf::Model* model, simgrid::s4u::Host* host, lmm_constraint_t constraint,
- std::vector<double>* speedPerPstate, int core);
+ Cpu(simgrid::surf::Model * model, simgrid::s4u::Host * host, kernel::lmm::Constraint * constraint,
+ std::vector<double> * speedPerPstate, int core);
/**
* @brief Cpu constructor
static simgrid::xbt::signal<void(simgrid::surf::CpuAction*)> onShareChange;
CpuAction(simgrid::surf::Model* model, double cost, bool failed) : Action(model, cost, failed) {}
- CpuAction(simgrid::surf::Model* model, double cost, bool failed, lmm_variable_t var)
+ CpuAction(simgrid::surf::Model * model, double cost, bool failed, kernel::lmm::Variable* var)
: Action(model, cost, failed, var)
{
}
int n = action->getVariable()->get_number_of_constraint();
for (int i = 0; i < n; i++){
- lmm_constraint_t constraint = action->getVariable()->get_constraint(i);
+ kernel::lmm::Constraint* constraint = action->getVariable()->get_constraint(i);
NetworkCm02Link* link = static_cast<NetworkCm02Link*>(constraint->get_id());
double value = action->getVariable()->get_value() * action->getVariable()->get_constraint_weight(i);
TRACE_surf_link_set_utilization(link->getCname(), action->getCategory(), value, action->getLastUpdate(),
if (TRACE_is_enabled()) {
int n = action.getVariable()->get_number_of_constraint();
for (int i = 0; i < n; i++) {
- lmm_constraint_t constraint = action.getVariable()->get_constraint(i);
+ kernel::lmm::Constraint* constraint = action.getVariable()->get_constraint(i);
NetworkCm02Link* link = static_cast<NetworkCm02Link*>(constraint->get_id());
TRACE_surf_link_set_utilization(
link->getCname(), action.getCategory(),
if (value > 0)
turnOn();
else {
- lmm_variable_t var = nullptr;
+ kernel::lmm::Variable* var = nullptr;
const_lmm_element_t elem = nullptr;
double now = surf_get_clock();
if (sg_weight_S_parameter > 0) {
double delta = sg_weight_S_parameter / value - sg_weight_S_parameter / (bandwidth_.peak * bandwidth_.scale);
- lmm_variable_t var;
+ kernel::lmm::Variable* var;
const_lmm_element_t elem = nullptr;
const_lmm_element_t nextelem = nullptr;
int numelem = 0;
void NetworkCm02Link::setLatency(double value)
{
double delta = value - latency_.peak;
- lmm_variable_t var = nullptr;
+ kernel::lmm::Variable* var = nullptr;
const_lmm_element_t elem = nullptr;
const_lmm_element_t nextelem = nullptr;
int numelem = 0;
* Resource *
************/
- LinkImpl::LinkImpl(simgrid::surf::NetworkModel* model, const std::string& name, lmm_constraint_t constraint)
+ LinkImpl::LinkImpl(simgrid::surf::NetworkModel* model, const std::string& name, kernel::lmm::Constraint* constraint)
: Resource(model, name, constraint), piface_(this)
{
*/
class LinkImpl : public simgrid::surf::Resource, public simgrid::surf::PropertyHolder {
protected:
- LinkImpl(simgrid::surf::NetworkModel* model, const std::string& name, lmm_constraint_t constraint);
+ LinkImpl(simgrid::surf::NetworkModel* model, const std::string& name, kernel::lmm::Constraint* constraint);
~LinkImpl() override;
public:
* @param failed [description]
* @param var The lmm variable associated to this Action if it is part of a LMM component
*/
- NetworkAction(simgrid::surf::Model* model, double cost, bool failed, lmm_variable_t var)
+ NetworkAction(simgrid::surf::Model* model, double cost, bool failed, kernel::lmm::Variable* var)
: simgrid::surf::Action(model, cost, failed, var){};
void setState(simgrid::surf::Action::State state) override;
} else {
/* Need to check that none of the model has failed */
int i = 0;
- lmm_constraint_t cnst = action.getVariable()->get_constraint(i);
+ kernel::lmm::Constraint* cnst = action.getVariable()->get_constraint(i);
while (cnst != nullptr) {
i++;
void* constraint_id = cnst->get_id();
/** @brief take into account changes of speed (either load or max) */
void CpuL07::onSpeedChange() {
- lmm_variable_t var = nullptr;
+ kernel::lmm::Variable* var = nullptr;
const_lmm_element_t elem = nullptr;
model()->getMaxminSystem()->update_constraint_bound(constraint(), speed_.peak * speed_.scale);
void LinkL07::setLatency(double value)
{
- lmm_variable_t var = nullptr;
+ kernel::lmm::Variable* var = nullptr;
L07Action *action;
const_lmm_element_t elem = nullptr;
namespace simgrid {
namespace surf {
-Resource::Resource(Model* model, const std::string& name, lmm_constraint_t constraint)
+Resource::Resource(Model* model, const std::string& name, kernel::lmm::Constraint* constraint)
: name_(name), model_(model), constraint_(constraint)
{}
return name_ == other.name_;
}
-lmm_constraint_t Resource::constraint() const
+kernel::lmm::Constraint* Resource::constraint() const
{
- return constraint_;
+ return const_cast<kernel::lmm::Constraint*>(constraint_);
}
}
{
}
-Action::Action(simgrid::surf::Model* model, double cost, bool failed, lmm_variable_t var)
+Action::Action(simgrid::surf::Model* model, double cost, bool failed, kernel::lmm::Variable* var)
: remains_(cost), start_(surf_get_clock()), cost_(cost), model_(model), variable_(var)
{
if (failed)
* @param failed If the action is impossible (e.g.: execute something on a switched off host)
* @param var The lmm variable associated to this Action if it is part of a LMM component
*/
- Action(simgrid::surf::Model* model, double cost, bool failed, lmm_variable_t var);
+ Action(simgrid::surf::Model * model, double cost, bool failed, kernel::lmm::Variable* var);
/** @brief Destructor */
virtual ~Action();
/* LMM */
double lastUpdate_ = 0;
double lastValue_ = 0;
- lmm_variable_t variable_ = nullptr;
+ kernel::lmm::Variable* variable_ = nullptr;
Action::Type hat_ = Action::Type::NOTSET;
boost::optional<heap_type::handle_type> heapHandle_ = boost::none;
void heapRemove(heap_type& heap);
void heapUpdate(heap_type & heap, double key, Action::Type hat);
void clearHeapHandle() { heapHandle_ = boost::none; }
- lmm_variable_t getVariable() const { return variable_; }
- void setVariable(lmm_variable_t var) { variable_ = var; }
+ kernel::lmm::Variable* getVariable() const { return variable_; }
+ void setVariable(kernel::lmm::Variable * var) { variable_ = var; }
double getLastUpdate() const { return lastUpdate_; }
void refreshLastUpdate() {lastUpdate_ = surf_get_clock();}
double getLastValue() const { return lastValue_; }
* @param name The name of the Resource
* @param constraint The lmm constraint associated to this Resource if it is part of a LMM component
*/
- Resource(Model * model, const std::string& name, lmm_constraint_t constraint);
+ Resource(Model * model, const std::string& name, kernel::lmm::Constraint* constraint);
virtual ~Resource();
public: /* LMM */
/** @brief Get the lmm constraint associated to this Resource if it is part of a LMM component (or null if none) */
- lmm_constraint_t constraint() const;
+ kernel::lmm::Constraint* constraint() const;
protected:
- const lmm_constraint_t constraint_ = nullptr;
+ const kernel::lmm::Constraint* constraint_ = nullptr;
};
}
/* A few tests for the maxmin library */
-/* Copyright (c) 2007-2017. The SimGrid Team.
+/* Copyright (c) 2007-2018s. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
simgrid::kernel::lmm::func_reno_fpi);
lmm_system_t Sys = new simgrid::kernel::lmm::System(true);
- lmm_constraint_t L1 = Sys->constraint_new(nullptr, a);
- lmm_constraint_t L2 = Sys->constraint_new(nullptr, b);
- lmm_constraint_t L3 = Sys->constraint_new(nullptr, a);
+ simgrid::kernel::lmm::Constraint* L1 = Sys->constraint_new(nullptr, a);
+ simgrid::kernel::lmm::Constraint* L2 = Sys->constraint_new(nullptr, b);
+ simgrid::kernel::lmm::Constraint* L3 = Sys->constraint_new(nullptr, a);
- lmm_variable_t R_1_2_3 = Sys->variable_new(nullptr, 1.0, -1.0, 3);
- lmm_variable_t R_1 = Sys->variable_new(nullptr, 1.0, -1.0, 1);
- lmm_variable_t R_2 = Sys->variable_new(nullptr, 1.0, -1.0, 1);
- lmm_variable_t R_3 = Sys->variable_new(nullptr, 1.0, -1.0, 1);
+ simgrid::kernel::lmm::Variable* R_1_2_3 = Sys->variable_new(nullptr, 1.0, -1.0, 3);
+ simgrid::kernel::lmm::Variable* R_1 = Sys->variable_new(nullptr, 1.0, -1.0, 1);
+ simgrid::kernel::lmm::Variable* R_2 = Sys->variable_new(nullptr, 1.0, -1.0, 1);
+ simgrid::kernel::lmm::Variable* R_3 = Sys->variable_new(nullptr, 1.0, -1.0, 1);
Sys->update_variable_weight(R_1_2_3, 1.0);
Sys->update_variable_weight(R_1, 1.0);
simgrid::kernel::lmm::func_reno_fpi);
lmm_system_t Sys = new simgrid::kernel::lmm::System(true);
- lmm_constraint_t CPU1 = Sys->constraint_new(nullptr, 200.0);
- lmm_constraint_t CPU2 = Sys->constraint_new(nullptr, 100.0);
+ simgrid::kernel::lmm::Constraint* CPU1 = Sys->constraint_new(nullptr, 200.0);
+ simgrid::kernel::lmm::Constraint* CPU2 = Sys->constraint_new(nullptr, 100.0);
- lmm_variable_t T1 = Sys->variable_new(nullptr, 1.0, -1.0, 1);
- lmm_variable_t T2 = Sys->variable_new(nullptr, 1.0, -1.0, 1);
+ simgrid::kernel::lmm::Variable* T1 = Sys->variable_new(nullptr, 1.0, -1.0, 1);
+ simgrid::kernel::lmm::Variable* T2 = Sys->variable_new(nullptr, 1.0, -1.0, 1);
Sys->update_variable_weight(T1, 1.0);
Sys->update_variable_weight(T2, 1.0);
lmm_system_t Sys = new simgrid::kernel::lmm::System(true);
/* Creates the constraints */
- lmm_constraint_t* tmp_cnst = new lmm_constraint_t[15];
+ simgrid::kernel::lmm::Constraint** tmp_cnst = new simgrid::kernel::lmm::Constraint*[15];
for (int i = 0; i < 15; i++)
tmp_cnst[i] = Sys->constraint_new(nullptr, B[i]);
/* Creates the variables */
- lmm_variable_t* tmp_var = new lmm_variable_t[16];
+ simgrid::kernel::lmm::Variable** tmp_var = new simgrid::kernel::lmm::Variable*[16];
for (int j = 0; j < 16; j++) {
tmp_var[j] = Sys->variable_new(nullptr, 1.0, -1.0, 15);
Sys->update_variable_weight(tmp_var[j], 1.0);
static void test(int nb_cnst, int nb_var, int nb_elem, unsigned int pw_base_limit, unsigned int pw_max_limit,
float rate_no_limit, int max_share, int mode)
{
- lmm_constraint_t cnst[nb_cnst];
- lmm_variable_t var[nb_var];
+ simgrid::kernel::lmm::Constraint* cnst[nb_cnst];
+ simgrid::kernel::lmm::Variable* var[nb_var];
int used[nb_cnst];
lmm_system_t Sys = new simgrid::kernel::lmm::System(true);