- model->get_maxmin_system()->update_variable_weight(get_variable(), 0.0);
-
- for (int i = 0; i < host_nb; i++)
- model->get_maxmin_system()->expand(host_list[i]->pimpl_cpu->get_constraint(), get_variable(), flops_amount[i]);
-
- if(bytes_amount != nullptr) {
- for (int i = 0; i < host_nb; i++) {
- for (int j = 0; j < host_nb; j++) {
- if (bytes_amount[i * host_nb + j] > 0.0) {
- std::vector<kernel::resource::LinkImpl*> route;
- hostList_->at(i)->route_to(hostList_->at(j), route, nullptr);
-
- for (auto const& link : route)
- model->get_maxmin_system()->expand_add(link->get_constraint(), this->get_variable(),
- bytes_amount[i * host_nb + j]);
- }
- }
+ model->get_maxmin_system()->update_variable_penalty(get_variable(), 0.0);
+
+ /* Expand it for the CPUs even if there is nothing to compute, to make sure that it gets expended even if there is no
+ * communication either */
+ for (size_t i = 0; i < host_list.size(); i++)
+ model->get_maxmin_system()->expand(host_list[i]->pimpl_cpu->get_constraint(), get_variable(),
+ (flops_amount == nullptr ? 0.0 : flops_amount[i]));
+
+ if (bytes_amount != nullptr) {
+ for (size_t k = 0; k < host_list.size() * host_list.size(); k++) {
+ if (bytes_amount[k] <= 0.0)
+ continue;
+ std::vector<kernel::resource::LinkImpl*> route;
+ hostList_[k / host_list.size()]->route_to(hostList_[k % host_list.size()], route, nullptr);
+
+ for (auto const& link : route)
+ model->get_maxmin_system()->expand_add(link->get_constraint(), this->get_variable(), bytes_amount[k]);