-/* Copyright (c) 2004-2021. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2004-2022. 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. */
#include <boost/core/demangle.hpp>
#include <typeinfo>
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_maxmin, surf, "Logging specific to SURF (maxmin)");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(ker_lmm, kernel, "Kernel Linear Max-Min solver");
double sg_maxmin_precision = 1E-5; /* Change this with --cfg=maxmin/precision:VALUE */
double sg_surf_precision = 1E-9; /* Change this with --cfg=surf/precision:VALUE */
int Variable::next_rank_ = 1;
int Constraint::next_rank_ = 1;
+Element::Element(Constraint* constraint, Variable* variable, double cweight)
+ : constraint(constraint), variable(variable), consumption_weight(cweight), max_consumption_weight(cweight)
+{
+}
+
int Element::get_concurrency() const
{
// Ignore element with weight less than one (e.g. cross-traffic)
void System::check_concurrency() const
{
// These checks are very expensive, so do them only if we want to debug SURF LMM
- if (not XBT_LOG_ISENABLED(surf_maxmin, xbt_log_priority_debug))
+ if (not XBT_LOG_ISENABLED(ker_lmm, xbt_log_priority_debug))
return;
for (Constraint const& cnst : constraint_set) {
xbt_assert(var->cnsts_.size() < var->cnsts_.capacity(), "Too much constraints");
- var->cnsts_.emplace_back();
+ var->cnsts_.emplace_back(cnst, var, consumption_weight);
Element& elem = var->cnsts_.back();
- elem.consumption_weight = consumption_weight;
- elem.constraint = cnst;
- elem.variable = var;
-
if (var->sharing_penalty_ != 0.0) {
elem.constraint->enabled_element_set_.push_front(elem);
elem.increase_concurrency();
if (var->sharing_penalty_ != 0.0)
elem.decrease_concurrency();
+ elem.max_consumption_weight = std::max(elem.max_consumption_weight, value);
if (cnst->sharing_policy_ != Constraint::SharingPolicy::FATPIPE)
elem.consumption_weight += value;
else
if (selective_update_active)
remove_all_modified_set();
- if (XBT_LOG_ISENABLED(surf_maxmin, xbt_log_priority_debug)) {
+ if (XBT_LOG_ISENABLED(ker_lmm, xbt_log_priority_debug)) {
print();
}
// loops (after doing the first for enabling==1, and before doing the last for disabling==1)
void System::enable_var(Variable* var)
{
- xbt_assert(not XBT_LOG_ISENABLED(surf_maxmin, xbt_log_priority_debug) || var->can_enable());
+ xbt_assert(not XBT_LOG_ISENABLED(ker_lmm, xbt_log_priority_debug) || var->can_enable());
var->sharing_penalty_ = var->staged_penalty_;
var->staged_penalty_ = 0;