/** @brief Get the maxmin system of the current Model */
lmm::System* get_maxmin_system() const { return maxmin_system_; }
+ /** @brief Set the maxmin system of the current Model */
+ void set_maxmin_system(lmm::System* system) { maxmin_system_ = system; }
+
/**
* @brief Get the update mechanism of the current Model
* @see e_UM_t
*/
virtual bool nextOccuringEventIsIdempotent() { return true; }
-protected:
- lmm::System* maxmin_system_ = nullptr;
-
private:
+ lmm::System* maxmin_system_ = nullptr;
UpdateAlgo update_mechanism_ = UpdateAlgo::UM_UNDEFINED;
Action::StateSet* ready_action_set_ = new Action::StateSet(); /**< Actions in state SURF_ACTION_READY */
Action::StateSet* running_action_set_ = new Action::StateSet(); /**< Actions in state SURF_ACTION_RUNNING */
class Link;
class Mailbox;
using MailboxPtr = boost::intrusive_ptr<Mailbox>;
+XBT_PUBLIC void intrusive_ptr_release(Mailbox* m);
+XBT_PUBLIC void intrusive_ptr_add_ref(Mailbox* m);
class Mutex;
class NetZone;
class VirtualMachine;
#define SHOW_EXPR_D(expr) XBT_DEBUG(#expr " = %d", expr);
#define SHOW_EXPR_P(expr) XBT_DEBUG(#expr " = %p", expr);
-void simgrid::kernel::lmm::bottleneck_solve(lmm::System* sys)
+simgrid::kernel::lmm::System* simgrid::kernel::lmm::make_new_fair_bottleneck_system(bool selective_update)
{
- if (not sys->modified)
+ return new simgrid::kernel::lmm::FairBottleneck(selective_update);
+}
+
+void simgrid::kernel::lmm::FairBottleneck::bottleneck_solve()
+{
+ if (not modified)
return;
- XBT_DEBUG("Variable set : %zu", sys->variable_set.size());
- for (Variable& var : sys->variable_set) {
+ XBT_DEBUG("Variable set : %zu", variable_set.size());
+ for (Variable& var : variable_set) {
var.value = 0.0;
XBT_DEBUG("Handling variable %p", &var);
if (var.sharing_weight > 0.0 && std::find_if(begin(var.cnsts), end(var.cnsts), [](Element const& x) {
return x.consumption_weight != 0.0;
}) != end(var.cnsts)) {
- sys->saturated_variable_set.push_back(var);
+ saturated_variable_set.push_back(var);
} else {
XBT_DEBUG("Err, finally, there is no need to take care of variable %p", &var);
if (var.sharing_weight > 0.0)
}
}
- XBT_DEBUG("Active constraints : %zu", sys->active_constraint_set.size());
- for (Constraint& cnst : sys->active_constraint_set) {
- sys->saturated_constraint_set.push_back(cnst);
+ XBT_DEBUG("Active constraints : %zu", active_constraint_set.size());
+ for (Constraint& cnst : active_constraint_set) {
+ saturated_constraint_set.push_back(cnst);
}
- for (Constraint& cnst : sys->saturated_constraint_set) {
+ for (Constraint& cnst : saturated_constraint_set) {
cnst.remaining = cnst.bound;
cnst.usage = 0.0;
}
/*
* Compute Usage and store the variables that reach the maximum.
*/
- auto& var_list = sys->saturated_variable_set;
- auto& cnst_list = sys->saturated_constraint_set;
+ auto& var_list = saturated_variable_set;
+ auto& cnst_list = saturated_constraint_set;
do {
if (XBT_LOG_ISENABLED(surf_maxmin, xbt_log_priority_debug)) {
XBT_DEBUG("Fair bottleneck done");
- sys->print();
+ print();
}
XBT_DEBUG("******* Constraints to process: %zu *******", cnst_list.size());
for (auto iter = std::begin(cnst_list); iter != std::end(cnst_list);) {
} while (not var_list.empty());
cnst_list.clear();
- sys->modified = true;
+ modified = true;
if (XBT_LOG_ISENABLED(surf_maxmin, xbt_log_priority_debug)) {
XBT_DEBUG("Fair bottleneck done");
- sys->print();
+ print();
}
}
double (*func_fp_def)(const Variable&, double);
double (*func_fpi_def)(const Variable&, double);
+System* make_new_lagrange_system(bool selective_update)
+{
+ return new Lagrange(selective_update);
+}
+
/*
* Local prototypes to implement the Lagrangian optimization with optimal step, also called dichotomy.
*/
-// solves the proportional fairness using a Lagrangian optimization with dichotomy step
-void lagrange_solve(kernel::lmm::System* sys);
// computes the value of the dichotomy using a initial values, init, with a specific variable or constraint
static double dichotomy(double init, double diff(double, const Constraint&), const Constraint& cnst, double min_error);
// computes the value of the differential of constraint cnst applied to lambda
return obj;
}
-void lagrange_solve(kernel::lmm::System* sys)
+// solves the proportional fairness using a Lagrangian optimization with dichotomy step
+void Lagrange::lagrange_solve()
{
/* Lagrange Variables. */
int max_iterations = 100;
XBT_DEBUG("#### Minimum error tolerated (dichotomy) : %e", dichotomy_min_error);
if (XBT_LOG_ISENABLED(surf_lagrange, xbt_log_priority_debug)) {
- sys->print();
+ print();
}
- if (not sys->modified)
+ if (not modified)
return;
/* Initialize lambda. */
- auto& cnst_list = sys->active_constraint_set;
+ auto& cnst_list = active_constraint_set;
for (Constraint& cnst : cnst_list) {
cnst.lambda = 1.0;
cnst.new_lambda = 2.0;
/*
* Initialize the var_list variable with only the active variables. Initialize mu.
*/
- auto& var_list = sys->variable_set;
+ auto& var_list = variable_set;
for (Variable& var : var_list) {
if (not var.sharing_weight)
var.value = 0.0;
}
if (XBT_LOG_ISENABLED(surf_lagrange, xbt_log_priority_debug)) {
- sys->print();
+ print();
}
}
int Variable::Global_debug_id = 1;
int Constraint::Global_debug_id = 1;
+System* make_new_maxmin_system(bool selective_update)
+{
+ return new System(selective_update);
+}
+
int Element::get_concurrency() const
{
// Ignore element with weight less than one (e.g. cross-traffic)
variable_mallocator =
xbt_mallocator_new(65536, System::variable_mallocator_new_f, System::variable_mallocator_free_f, nullptr);
- solve_fun = &lmm_solve;
}
System::~System()
}
}
-void System::solve()
+void System::lmm_solve()
{
if (modified) {
XBT_IN("(sys=%p)", this);
* constraints that changed are considered. Otherwise all constraints with active actions are considered.
*/
if (selective_update_active)
- solve(modified_constraint_set);
+ lmm_solve(modified_constraint_set);
else
- solve(active_constraint_set);
+ lmm_solve(active_constraint_set);
XBT_OUT();
}
}
-template <class CnstList> void System::solve(CnstList& cnst_list)
+template <class CnstList> void System::lmm_solve(CnstList& cnst_list)
{
double min_usage = -1;
double min_bound = -1;
delete[] cnst_light_tab;
}
-void lmm_solve(System* sys)
-{
- sys->solve();
-}
-
/** \brief Attribute the value bound to var->bound.
*
* \param var the Variable*
/** @{ @ingroup SURF_lmm */
-/**
- * @brief Solve the lmm system
- * @param sys The lmm system to solve
- */
-XBT_PUBLIC void lmm_solve(lmm::System* sys);
-
-XBT_PUBLIC void lagrange_solve(lmm::System* sys);
-XBT_PUBLIC void bottleneck_solve(lmm::System* sys);
-
/** Default functions associated to the chosen protocol. When using the lagrangian approach. */
XBT_PUBLIC void set_default_protocol_function(double (*func_f)(const Variable& var, double x),
*/
explicit System(bool selective_update);
/** @brief Free an existing Linear MaxMin system */
- ~System();
+ virtual ~System();
/**
* @brief Create a new Linear MaxMin constraint
void print() const;
/** @brief Solve the lmm system */
- void solve();
+ void lmm_solve();
+
+ /** @brief Solve the lmm system. May be specialized in subclasses. */
+ virtual void solve() { lmm_solve(); }
private:
static void* variable_mallocator_new_f();
void remove_all_modified_set();
void check_concurrency() const;
- template <class CnstList> void solve(CnstList& cnst_list);
+ template <class CnstList> void lmm_solve(CnstList& cnst_list);
+
public:
bool modified;
boost::intrusive::list<Variable, boost::intrusive::member_hook<Variable, boost::intrusive::list_member_hook<>,
simgrid::kernel::resource::Action::ModifiedSet* modified_set_ = nullptr;
- void (*solve_fun)(lmm::System* self);
-
private:
bool selective_update_active; /* flag to update partially the system only selecting changed portions */
unsigned visited_counter; /* used by System::update_modified_set() and System::remove_all_modified_set() to
xbt_mallocator_t variable_mallocator;
};
+class XBT_PUBLIC FairBottleneck : public System {
+public:
+ explicit FairBottleneck(bool selective_update) : System(selective_update) {}
+ void solve() final { bottleneck_solve(); }
+
+private:
+ void bottleneck_solve();
+};
+
+class XBT_PUBLIC Lagrange : public System {
+public:
+ explicit Lagrange(bool selective_update) : System(selective_update) {}
+ void solve() final { lagrange_solve(); }
+
+private:
+ void lagrange_solve();
+};
+
+XBT_PUBLIC System* make_new_maxmin_system(bool selective_update);
+XBT_PUBLIC System* make_new_fair_bottleneck_system(bool selective_update);
+XBT_PUBLIC System* make_new_lagrange_system(bool selective_update);
+
extern XBT_PRIVATE double (*func_f_def)(const Variable&, double);
extern XBT_PRIVATE double (*func_fp_def)(const Variable&, double);
extern XBT_PRIVATE double (*func_fpi_def)(const Variable&, double);
double Model::next_occuring_event_lazy(double now)
{
XBT_DEBUG("Before share resources, the size of modified actions set is %zu", maxmin_system_->modified_set_->size());
- lmm_solve(maxmin_system_);
+ maxmin_system_->lmm_solve();
XBT_DEBUG("After share resources, The size of modified actions set is %zu", maxmin_system_->modified_set_->size());
while (not maxmin_system_->modified_set_->empty()) {
double Model::next_occuring_event_full(double /*now*/)
{
- maxmin_system_->solve_fun(maxmin_system_);
+ maxmin_system_->solve();
double min = -1;
xbt_cfg_register_boolean("cpu/maxmin-selective-update", "no", nullptr, "Update the constraint set propagating "
"recursively to others constraints (off by "
- "default when optim is set to lazy)");
+ "default unless optim is set to lazy)");
xbt_cfg_register_alias("cpu/maxmin-selective-update", "cpu/maxmin_selective_update");
xbt_cfg_register_boolean("network/maxmin-selective-update", "no", nullptr, "Update the constraint set propagating "
"recursively to others constraints (off "
- "by default when optim is set to lazy)");
+ "by default unless optim is set to lazy)");
xbt_cfg_register_alias("network/maxmin-selective-update", "network/maxmin_selective_update");
/* Replay (this part is enabled even if MC it disabled) */
xbt_cfg_register_string("model-check/replay", nullptr, _sg_cfg_cb_model_check_replay,
StorageModel::StorageModel() : Model()
{
- maxmin_system_ = new simgrid::kernel::lmm::System(true /* selective update */);
+ set_maxmin_system(new simgrid::kernel::lmm::System(true /* selective update */));
}
StorageModel::~StorageModel()
if (optim == "Full") {
setUpdateMechanism(Model::UpdateAlgo::Full);
} else if (optim == "Lazy") {
+ xbt_assert(select || xbt_cfg_is_default_value("cpu/maxmin-selective-update"),
+ "You cannot disable cpu selective update when using the lazy update mechanism");
setUpdateMechanism(Model::UpdateAlgo::Lazy);
select = true;
- xbt_assert(select || (xbt_cfg_is_default_value("cpu/maxmin-selective-update")),
- "Disabling selective update while using the lazy update mechanism is dumb!");
} else {
xbt_die("Unsupported optimization (%s) for this model", optim.c_str());
}
- maxmin_system_ = new simgrid::kernel::lmm::System(select);
+ set_maxmin_system(new simgrid::kernel::lmm::System(select));
if (getUpdateMechanism() == Model::UpdateAlgo::Lazy)
- maxmin_system_->modified_set_ = new kernel::resource::Action::ModifiedSet();
+ get_maxmin_system()->modified_set_ = new kernel::resource::Action::ModifiedSet();
}
CpuCas01Model::~CpuCas01Model()
xbt_cfg_setdefault_double("network/bandwidth-factor", 0.97);
xbt_cfg_setdefault_double("network/weight-S", 20537);
- surf_network_model = new simgrid::surf::NetworkCm02Model(&simgrid::kernel::lmm::lagrange_solve);
+ surf_network_model = new simgrid::surf::NetworkCm02Model(&simgrid::kernel::lmm::make_new_lagrange_system);
all_existing_models->push_back(surf_network_model);
}
xbt_cfg_setdefault_double("network/bandwidth-factor", 0.97);
xbt_cfg_setdefault_double("network/weight-S", 20537);
- surf_network_model = new simgrid::surf::NetworkCm02Model(&simgrid::kernel::lmm::lagrange_solve);
+ surf_network_model = new simgrid::surf::NetworkCm02Model(&simgrid::kernel::lmm::make_new_lagrange_system);
all_existing_models->push_back(surf_network_model);
}
xbt_cfg_setdefault_double("network/bandwidth-factor", 0.97);
xbt_cfg_setdefault_double("network/weight-S", 20537);
- surf_network_model = new simgrid::surf::NetworkCm02Model(&simgrid::kernel::lmm::lagrange_solve);
+ surf_network_model = new simgrid::surf::NetworkCm02Model(&simgrid::kernel::lmm::make_new_lagrange_system);
all_existing_models->push_back(surf_network_model);
}
namespace simgrid {
namespace surf {
-NetworkCm02Model::NetworkCm02Model()
- :NetworkModel()
+NetworkCm02Model::NetworkCm02Model(kernel::lmm::System* (*make_new_lmm_system)(bool)) : NetworkModel()
{
std::string optim = xbt_cfg_get_string("network/optim");
bool select = xbt_cfg_get_boolean("network/maxmin-selective-update");
if (optim == "Full") {
setUpdateMechanism(kernel::resource::Model::UpdateAlgo::Full);
} else if (optim == "Lazy") {
+ xbt_assert(select || xbt_cfg_is_default_value("network/maxmin-selective-update"),
+ "You cannot disable network selective update when using the lazy update mechanism");
select = true;
setUpdateMechanism(kernel::resource::Model::UpdateAlgo::Lazy);
- xbt_assert(select || (xbt_cfg_is_default_value("network/maxmin-selective-update")),
- "You cannot disable selective update when using the lazy update mechanism");
} else {
xbt_die("Unsupported optimization (%s) for this model. Accepted: Full, Lazy.", optim.c_str());
}
- maxmin_system_ = new simgrid::kernel::lmm::System(select);
+ set_maxmin_system(make_new_lmm_system(select));
loopback_ = NetworkCm02Model::createLink("__loopback__", 498000000, 0.000015, SURF_LINK_FATPIPE);
if (getUpdateMechanism() == kernel::resource::Model::UpdateAlgo::Lazy)
- maxmin_system_->modified_set_ = new kernel::resource::Action::ModifiedSet();
-}
-
-NetworkCm02Model::NetworkCm02Model(void (*specificSolveFun)(kernel::lmm::System* self)) : NetworkCm02Model()
-{
- maxmin_system_->solve_fun = specificSolveFun;
+ get_maxmin_system()->modified_set_ = new kernel::resource::Action::ModifiedSet();
}
LinkImpl* NetworkCm02Model::createLink(const std::string& name, double bandwidth, double latency,
e_surf_link_sharing_policy_t policy)
{
- return new NetworkCm02Link(this, name, bandwidth, latency, policy, maxmin_system_);
+ return new NetworkCm02Link(this, name, bandwidth, latency, policy, get_maxmin_system());
}
void NetworkCm02Model::update_actions_state_lazy(double now, double /*delta*/)
// if I am wearing a latency hat
if (action->get_type() == kernel::resource::Action::Type::LATENCY) {
XBT_DEBUG("Latency paid for action %p. Activating", action);
- maxmin_system_->update_variable_weight(action->get_variable(), action->weight_);
+ get_maxmin_system()->update_variable_weight(action->get_variable(), action->weight_);
action->heapRemove();
action->set_last_update();
action.latency_ = 0.0;
}
if (action.latency_ <= 0.0 && not action.is_suspended())
- maxmin_system_->update_variable_weight(action.get_variable(), action.weight_);
+ get_maxmin_system()->update_variable_weight(action.get_variable(), action.weight_);
}
if (TRACE_is_enabled()) {
int n = action.get_variable()->get_number_of_constraint();
constraints_per_variable += back_route.size();
if (action->latency_ > 0) {
- action->set_variable(maxmin_system_->variable_new(action, 0.0, -1.0, constraints_per_variable));
+ action->set_variable(get_maxmin_system()->variable_new(action, 0.0, -1.0, constraints_per_variable));
if (getUpdateMechanism() == kernel::resource::Model::UpdateAlgo::Lazy) {
// add to the heap the event when the latency is payed
XBT_DEBUG("Added action (%p) one latency event at date %f", action, action->latency_ + action->get_last_update());
: kernel::resource::Action::Type::LATENCY);
}
} else
- action->set_variable(maxmin_system_->variable_new(action, 1.0, -1.0, constraints_per_variable));
+ action->set_variable(get_maxmin_system()->variable_new(action, 1.0, -1.0, constraints_per_variable));
if (action->rate_ < 0) {
- maxmin_system_->update_variable_bound(
+ get_maxmin_system()->update_variable_bound(
action->get_variable(), (action->latCurrent_ > 0) ? sg_tcp_gamma / (2.0 * action->latCurrent_) : -1.0);
} else {
- maxmin_system_->update_variable_bound(action->get_variable(),
- (action->latCurrent_ > 0)
- ? std::min(action->rate_, sg_tcp_gamma / (2.0 * action->latCurrent_))
- : action->rate_);
+ get_maxmin_system()->update_variable_bound(action->get_variable(),
+ (action->latCurrent_ > 0)
+ ? std::min(action->rate_, sg_tcp_gamma / (2.0 * action->latCurrent_))
+ : action->rate_);
}
for (auto const& link : route)
- maxmin_system_->expand(link->constraint(), action->get_variable(), 1.0);
+ get_maxmin_system()->expand(link->constraint(), action->get_variable(), 1.0);
if (not back_route.empty()) { // sg_network_crosstraffic was activated
XBT_DEBUG("Crosstraffic active adding backward flow using 5%%");
for (auto const& link : back_route)
- maxmin_system_->expand(link->constraint(), action->get_variable(), .05);
+ get_maxmin_system()->expand(link->constraint(), action->get_variable(), .05);
// Change concurrency_share here, if you want that cross-traffic is included in the SURF concurrency
// (You would also have to change simgrid::kernel::lmm::Element::get_concurrency())
class NetworkCm02Model : public NetworkModel {
public:
- NetworkCm02Model();
- explicit NetworkCm02Model(void (*solve_fun)(kernel::lmm::System* self));
+ explicit NetworkCm02Model(kernel::lmm::System* (*make_new_sys)(bool) = &simgrid::kernel::lmm::make_new_maxmin_system);
virtual ~NetworkCm02Model() = default;
LinkImpl* createLink(const std::string& name, double bandwidth, double latency,
e_surf_link_sharing_policy_t policy) override;
-/* Copyright (c) 2014-2017. The SimGrid Team.
+/* Copyright (c) 2014-2018. The SimGrid Team.
*All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
if (not double_equals(penalized_bw, rate_before_update, sg_surf_precision)) {
XBT_DEBUG("%d->%d action %p penalty updated : bw now %f, before %f , initial rate %f", root->id,
(*it)->destination->id, (*it)->action, penalized_bw, (*it)->action->get_bound(), (*it)->init_rate);
- maxmin_system_->update_variable_bound((*it)->action->get_variable(), penalized_bw);
+ get_maxmin_system()->update_variable_bound((*it)->action->get_variable(), penalized_bw);
} else {
XBT_DEBUG("%d->%d action %p penalty not updated : bw %f, initial rate %f", root->id, (*it)->destination->id,
(*it)->action, penalized_bw, (*it)->init_rate);
*/
virtual kernel::resource::Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) = 0;
- /** @brief Function pointer to the function to use to solve the lmm_system_t
- *
- * @param system The lmm_system_t to solve
- */
- void (*f_networkSolve)(kernel::lmm::System*) = kernel::lmm::lmm_solve;
-
/**
* @brief Get the right multiplicative factor for the latency.
* @details Depending on the model, the effective latency when sending
namespace surf {
HostL07Model::HostL07Model() : HostModel() {
- maxmin_system_ = new simgrid::kernel::lmm::System(true /* selective update */);
- maxmin_system_->solve_fun = &simgrid::kernel::lmm::bottleneck_solve;
- surf_network_model = new NetworkL07Model(this, maxmin_system_);
- surf_cpu_model_pm = new CpuL07Model(this, maxmin_system_);
+ auto* maxmin_system = new simgrid::kernel::lmm::FairBottleneck(true /* selective update */);
+ set_maxmin_system(maxmin_system);
+ surf_network_model = new NetworkL07Model(this, maxmin_system);
+ surf_cpu_model_pm = new CpuL07Model(this, maxmin_system);
}
HostL07Model::~HostL07Model()
CpuL07Model::CpuL07Model(HostL07Model* hmodel, kernel::lmm::System* sys) : CpuModel(), hostModel_(hmodel)
{
- maxmin_system_ = sys;
+ set_maxmin_system(sys);
}
CpuL07Model::~CpuL07Model()
{
- maxmin_system_ = nullptr;
+ set_maxmin_system(nullptr);
}
NetworkL07Model::NetworkL07Model(HostL07Model* hmodel, kernel::lmm::System* sys) : NetworkModel(), hostModel_(hmodel)
{
- maxmin_system_ = sys;
+ set_maxmin_system(sys);
loopback_ = NetworkL07Model::createLink("__loopback__", 498000000, 0.000015, SURF_LINK_FATPIPE);
}
NetworkL07Model::~NetworkL07Model()
{
- maxmin_system_ = nullptr;
+ set_maxmin_system(nullptr);
}
double HostL07Model::next_occuring_event(double now)
}
if ((action.latency_ <= 0.0) && (action.is_suspended() == 0)) {
action.updateBound();
- maxmin_system_->update_variable_weight(action.get_variable(), 1.0);
+ get_maxmin_system()->update_variable_weight(action.get_variable(), 1.0);
}
}
XBT_DEBUG("Action (%p) : remains (%g) updated by %g.", &action, action.get_remains(),
"property Bwrite, storage", type_id.c_str());
StorageImpl* storage =
- new StorageN11(this, id, maxmin_system_, Bread, Bwrite, type_id, content_name, storage_type->size, attach);
+ new StorageN11(this, id, get_maxmin_system(), Bread, Bwrite, type_id, content_name, storage_type->size, attach);
storageCreatedCallbacks(storage);
XBT_DEBUG("SURF storage create resource\n\t\tid '%s'\n\t\ttype '%s'\n\t\tBread '%f'\n", id.c_str(), type_id.c_str(),
enum method_t { MAXMIN, LAGRANGE_RENO, LAGRANGE_VEGAS };
+static simgrid::kernel::lmm::System* new_system(method_t method, bool update)
+{
+ switch (method) {
+ case MAXMIN:
+ return simgrid::kernel::lmm::make_new_maxmin_system(update);
+ case LAGRANGE_VEGAS:
+ case LAGRANGE_RENO:
+ return simgrid::kernel::lmm::make_new_lagrange_system(update);
+ default:
+ xbt_die("Invalid method");
+ }
+}
+
static double dichotomy(double func(double), double min, double max, double min_error)
{
double overall_error = 2 * min_error;
set_default_protocol_function(simgrid::kernel::lmm::func_reno_f, simgrid::kernel::lmm::func_reno_fpi,
simgrid::kernel::lmm::func_reno_fpi);
- simgrid::kernel::lmm::System* Sys = new simgrid::kernel::lmm::System(true);
+ simgrid::kernel::lmm::System* Sys = new_system(method, true);
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);
Sys->expand(L3, R_3, 1.0);
if (method == MAXMIN) {
- lmm_solve(Sys);
+ Sys->solve();
} else {
double x;
if (method == LAGRANGE_VEGAS) {
xbt_die( "Invalid method");
}
- lagrange_solve(Sys);
+ Sys->solve();
double max_deviation = 0.0;
max_deviation = std::max(max_deviation, fabs(R_1->get_value() - x));
set_default_protocol_function(simgrid::kernel::lmm::func_reno_f, simgrid::kernel::lmm::func_reno_fp,
simgrid::kernel::lmm::func_reno_fpi);
- simgrid::kernel::lmm::System* Sys = new simgrid::kernel::lmm::System(true);
+ simgrid::kernel::lmm::System* Sys = new_system(method, true);
+
simgrid::kernel::lmm::Constraint* CPU1 = Sys->constraint_new(nullptr, 200.0);
simgrid::kernel::lmm::Constraint* CPU2 = Sys->constraint_new(nullptr, 100.0);
Sys->expand(CPU1, T1, 1.0);
Sys->expand(CPU2, T2, 1.0);
- if (method == MAXMIN) {
- lmm_solve(Sys);
- } else if (method == LAGRANGE_VEGAS || method == LAGRANGE_RENO) {
- lagrange_solve(Sys);
- } else {
- xbt_die("Invalid method");
- }
+ Sys->solve();
PRINT_VAR(T1);
PRINT_VAR(T2);
set_default_protocol_function(simgrid::kernel::lmm::func_reno_f, simgrid::kernel::lmm::func_reno_fp,
simgrid::kernel::lmm::func_reno_fpi);
- simgrid::kernel::lmm::System* Sys = new simgrid::kernel::lmm::System(true);
+ simgrid::kernel::lmm::System* Sys = new_system(method, true);
/* Creates the constraints */
simgrid::kernel::lmm::Constraint** tmp_cnst = new simgrid::kernel::lmm::Constraint*[15];
if (A[i][j])
Sys->expand(tmp_cnst[i], tmp_var[j], 1.0);
- if (method == MAXMIN) {
- lmm_solve(Sys);
- } else if (method == LAGRANGE_VEGAS) {
- lagrange_solve(Sys);
- } else if (method == LAGRANGE_RENO) {
- lagrange_solve(Sys);
- } else {
- xbt_die("Invalid method");
- }
+ Sys->solve();
for (int j = 0; j < 16; j++)
PRINT_VAR(tmp_var[j]);
fprintf(stderr,"Starting to solve(%i)\n",myrand()%1000);
date = xbt_os_time() * 1000000;
- lmm_solve(Sys);
+ Sys->solve();
date = xbt_os_time() * 1000000 - date;
if(mode==2){