Page 1 of 1

MCP in a loop results in infeasible solutions

Posted: Tue Aug 22, 2023 7:30 pm
by ryanpent
Hello,
I am trying to solve multiple iterations of an MCP model where I adjust a single parameter in the model. To do so, I wrote a loop statement that goes through a set of scenarios "i", changes the particular parameter, solves the model, and then stores values as reference parameters(using a similar method in therisk.gms loop from the McCarl gams [url]guidehttps://www.gams.com/mccarlGuide/programs_with_ ... ements.htm[/url]). My problem is that many of the parameter scenarios result in locally infeasible solutions, but are feasible when solved with the same parameters outside of the loop. Does this occur because of the PATH solver working from previous solutions when there is multiple solves in the same loop? Is there a way that I can "reset" the model so that it can start without the previous solution and give results similar to when I manually input the parameters outside of the loop? I tried using option solveopt = replace and clear within the loop, but it had no effect. Any help on this issue would be greatly appreciated.

Best,
Ryan

Re: MCP in a loop results in infeasible solutions

Posted: Sun Aug 27, 2023 8:18 pm
by bussieck
Usually, solvers react to bRatio (see https://www.gams.com/latest/docs/UG_Gam ... MSAObratio) but this does not help here. I unloaded an initial solution via "execute_unload 'startpoint';" just before the loop and inside the loop I did a "execute_loadpoint 'startpoint';" to have all solves starting from the same starting point. With this little trick I could convince PATH to solve all 10 model instances.

Code: Select all

execute_unload 'startpoint';

loop(i,
    Risk_Aversion(sResources) = Risk_Loop(i);
*    Risk_Aversion(sResources) = 1.1 - ord(i)*0.1;
*   Risk_Aversion(sResources) = .1;

    execute_loadpoint 'startpoint';
*    EIR_Market_RTLMP_Great_Than_K.bratio = 0;
    solve EIR_Market_RTLMP_Great_Than_K using mcp;
-Michael

Re: MCP in a loop results in infeasible solutions

Posted: Tue Aug 29, 2023 8:45 pm
by ryanpent
Michael,
Thank you very much! My workaround was to manually clear all the variable solutions using option clear VarName after the solves in the loop, but this is a much quicker method.
Best,
Ryan