Commit d1f6c5c0 authored by EYRAUD-DUBOIS Lionel's avatar EYRAUD-DUBOIS Lionel

AreaBound now exports its getRepartition() function

parent 0ab732b2
......@@ -84,16 +84,8 @@ double AreaBound::compute() {
void AreaBound::finalize() {
if (!share.empty()) {
IloArray<IloNumArray> values(env, nbTaskTypes);
vector<vector<double> > *shared = new vector<vector<double>>(nbTaskTypes, vector<double>(nbWorkerTypes, -1));
for (int i = 0; i < nbTaskTypes; i++) {
values[i] = IloNumArray(env);
indepCplex.getValues(values[i], wType[i]);
for (int j = 0; j < nbWorkerTypes; j++)
(*shared)[i][j] = values[i][j] / countTasks[i];
}
ins->extraData.insert(share + "[repart]", (void *) shared);
vector<vector<double>> repart = getRepartition();
ins->extraData.insert(share + "[repart]", (void *) new vector<vector<double>>(repart));
}
}
......@@ -108,3 +100,18 @@ void AreaBound::restoreTask(int taskID) {
string AreaBound::name() {
return "area";
}
std::vector<std::vector<double>> AreaBound::getRepartition() {
vector<vector<double>> result(nbTaskTypes, vector<double>(nbWorkerTypes, -1));
IloArray<IloNumArray> values(env, nbTaskTypes);
for (int i = 0; i < nbTaskTypes; i++) {
values[i] = IloNumArray(env);
indepCplex.getValues(values[i], wType[i]);
for (int j = 0; j < nbWorkerTypes; j++)
result[i][j] = values[i][j];
}
return result;
}
......@@ -34,7 +34,8 @@ class AreaBound : public ModifiableBound {
void init(Instance& ins);
double compute();
void finalize();
void finalize();
std::vector<std::vector<double>> getRepartition();
void removeTask(int taskID);
void restoreTask(int taskID);
std::string name();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment