Hi,
I want to solve several GMPs at the same time. I adopted AsynchronousExecute AIMMS example to my code. From the progress window I can see that all GMPs get to an optimal solution. However, I can only retrieve the solution of the last GMP. Here is my code:
I generate 3 GMPs, resolve them, and create one solversession for each of the GMPs:
periods := 3;
for (i in periods) do
myGMP(i) := GMP::Instance::Generate(myMathProgram, "myGMP_" + i);
ProgressWindow := GMP::Instance::CreateProgressCategory(myGMP(i));
presolved_myGMP(i) := GMP::Instance::CreatePresolved(myGMP(ip),"presolved_myGMP_" + ipss);
SolverSession(i) := GMP::Instance::CreateSolverSession(presolved_myGMP(i),"SS_" + i);
GMP::Solution::RetrieveFromModel(presolved_myGMP(i),1);
GMP::Solution::SendToSolverSession(SolverSession(i),1);
GMP::SolverSession::AsynchronousExecute(SolverSession(i));
endfor;
Here I wait until all asynchronous solversessions are solved.
GMP::SolverSession::WaitForCompletion(AllSolverSessions);
Here I want to retrieve the solution (variables, etc.) from solversessions into AIMMS so I can see them and save them.
for (i in periods) do
GMP::Solution::RetrieveFromSolverSession(SolverSession(i), 1);
GMP::Solution::SendToModel(presolved_myGMP(i), 1);
!Write the outcomes of each period solution
Period_tech_use(t,i):=tech_use(t,i);
hourly_prices(h,i):=balance_activitiesHourly(h,i).ShadowPrice;
endfor;
unfortunately, I only get the results from the last solved GMP. Do you know how can I retrieve the solution of all solversessions?