/* 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. */
-#include "surf/maxmin.hpp"
+#include "src/kernel/lmm/maxmin.hpp"
#include "xbt/log.h"
#include "xbt/sysdep.h"
#include <algorithm>
#define SHOW_EXPR_D(expr) XBT_DEBUG(#expr " = %d", expr);
#define SHOW_EXPR_P(expr) XBT_DEBUG(#expr " = %p", expr);
-void simgrid::surf::bottleneck_solve(lmm_system_t sys)
+void simgrid::kernel::lmm::bottleneck_solve(lmm_system_t sys)
{
void* _var;
void* _var_next;
void* _elem;
lmm_variable_t var = nullptr;
lmm_constraint_t cnst = nullptr;
- s_lmm_constraint_t s_cnst;
lmm_element_t elem = nullptr;
xbt_swag_t cnst_list = nullptr;
xbt_swag_t var_list = nullptr;
xbt_swag_t elem_list = nullptr;
- static s_xbt_swag_t cnst_to_update;
-
if (not sys->modified)
return;
- /* Init */
- xbt_swag_init(&(cnst_to_update), xbt_swag_offset(s_cnst, saturated_constraint_set_hookup));
-
var_list = &(sys->variable_set);
XBT_DEBUG("Variable set : %d", xbt_swag_size(var_list));
xbt_swag_foreach(_var, var_list)
var = static_cast<lmm_variable_t>(_var);
var->value = 0.0;
XBT_DEBUG("Handling variable %p", var);
- xbt_swag_insert(var, &(sys->saturated_variable_set));
- auto weighted = std::find_if(begin(var->cnsts), end(var->cnsts),
- [](s_lmm_element_t const& x) { return x.consumption_weight != 0.0; });
- if (weighted == end(var->cnsts) && var->sharing_weight > 0.0) {
- XBT_DEBUG("Err, finally, there is no need to take care of variable %p", var);
- xbt_swag_remove(var, &(sys->saturated_variable_set));
- var->value = 1.0;
- }
- if (var->sharing_weight <= 0.0) {
+ if (var->sharing_weight > 0.0 && std::find_if(begin(var->cnsts), end(var->cnsts), [](s_lmm_element_t const& x) {
+ return x.consumption_weight != 0.0;
+ }) != end(var->cnsts)) {
+ xbt_swag_insert(var, &(sys->saturated_variable_set));
+ } else {
XBT_DEBUG("Err, finally, there is no need to take care of variable %p", var);
- xbt_swag_remove(var, &(sys->saturated_variable_set));
+ if (var->sharing_weight > 0.0)
+ var->value = 1.0;
}
}
var_list = &(sys->saturated_variable_set);