X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/76d4849864c227687e17bdd93c5b1338e9b4cb50..3dd753cd9e46d794e00629d03183250aec4a17e4:/src/surf/network_cm02.cpp diff --git a/src/surf/network_cm02.cpp b/src/surf/network_cm02.cpp index 5037e6aad1..29604a599f 100644 --- a/src/surf/network_cm02.cpp +++ b/src/surf/network_cm02.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2013-2021. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2013-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. */ @@ -221,12 +221,22 @@ void NetworkCm02Model::comm_action_expand_constraints(const s4u::Host* src, cons } /* WI-FI links needs special treatment, do it here */ - if (src_wifi_link != nullptr) - get_maxmin_system()->expand(src_wifi_link->get_constraint(), action->get_variable(), - 1.0 / src_wifi_link->get_host_rate(src)); - if (dst_wifi_link != nullptr) - get_maxmin_system()->expand(dst_wifi_link->get_constraint(), action->get_variable(), - 1.0 / dst_wifi_link->get_host_rate(dst)); + if (src_wifi_link != nullptr) { + /* In case of 0Mbps data rate, don't consider it in the LMM */ + if (src_wifi_link->get_host_rate(src) != 0) + get_maxmin_system()->expand(src_wifi_link->get_constraint(), action->get_variable(), + 1.0 / src_wifi_link->get_host_rate(src)); + else + get_maxmin_system()->update_variable_penalty(action->get_variable(), 0); + } + if (dst_wifi_link != nullptr) { + if (dst_wifi_link->get_host_rate(dst) != 0) + get_maxmin_system()->expand(dst_wifi_link->get_constraint(), action->get_variable(), + 1.0 / dst_wifi_link->get_host_rate(dst)); + else { + get_maxmin_system()->update_variable_penalty(action->get_variable(), 0); + } + } for (auto const* link : route) { if (link->get_sharing_policy() != s4u::Link::SharingPolicy::WIFI) @@ -316,11 +326,10 @@ bool NetworkCm02Model::comm_get_route_info(const s4u::Host* src, const s4u::Host bool failed = std::any_of(route.begin(), route.end(), [](const StandardLinkImpl* link) { return not link->is_on(); }); - if (cfg_crosstraffic) { + if (not failed && cfg_crosstraffic) { dst->route_to(src, back_route, nullptr); - if (not failed) - failed = std::any_of(back_route.begin(), back_route.end(), - [](const StandardLinkImpl* link) { return not link->is_on(); }); + failed = std::any_of(back_route.begin(), back_route.end(), + [](const StandardLinkImpl* link) { return not link->is_on(); }); } return failed; }