Skip to content

Commit

Permalink
Merge pull request #1636 from dklein-pik/develop
Browse files Browse the repository at this point in the history
For Nash: after infeasibilities continue in debug mode before aborting
  • Loading branch information
dklein-pik authored Mar 28, 2024
2 parents 38cf08e + 461cf74 commit c33e9fe
Show file tree
Hide file tree
Showing 20 changed files with 119 additions and 106 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- **scripts** add MAGICCv7.5.3 with AR6 settings as output script, add compareScenarios2 option
[[#1475](https://github.com/remindmodel/remind/pull/1475), [[#1615](https://github.com/remindmodel/remind/pull/1615)]
- **scripts** add 'make test-fix' which runs codeCheck in interactive mode, adjusting not_used.txt files
[[#1625](https://github.com/remindmodel/remind/pull/1625)
[[#1625](https://github.com/remindmodel/remind/pull/1625)]
- **testthat** test and compile all config files [[#1356](https://github.com/remindmodel/remind/pull/1356)]
- **testthat** test existence of all required input data [[#1577](https://github.com/remindmodel/remind/pull/1577)]
- **80_optimization** For Nash mode: after infeasibilities continue in debug mode before aborting
[[#1636](https://github.com/remindmodel/remind/pull/1636)]

### fixed
- **26_agCosts** **30_biomass** fully fix landuse and MAGICC6 variables in delayed transition runs to reference run
Expand Down
3 changes: 0 additions & 3 deletions config/default.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,6 @@ cfg$gamsv <- "gams" # def = gams
# Action that should be performed ("ce": compile and run, "c": compile)
cfg$action <- "ce" #def <- ce

# Tar-ball all the put files to save space?
cfg$tarball_puts <- "on" # def <- on

# Provide additional SLURM parameters (e.g. "--time=03:30:00") not included in
# the list of following parameters that are set automatically in start.R:
# --qos, --nodes, --tasks-per-node, -job-name, --output, --mail-type, --comment.
Expand Down
2 changes: 1 addition & 1 deletion config/scenario_config_21_EU11_ECEMF.csv
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ xx_WP5_RAP-REG-LimCCS;0,WP5p3;;;;./config/regionmapping_21_EU11.csv;./config/ext
xx_WP5_RAP-REG-LimNuclear;0,WP5p3;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp20;9;globallyOptimal;650;diffCurvPhaseIn2Lin;100;2080;;9;;;;;;;;;;;;2050.GLO 0.9;NDC;regiCarbonPrice;2030.EU27_regi.tax.t.FE_wo_n_e.all 1.1235, (2035,2040,2045,2050).EU27_regi.tax.t.PE.biomass 0.237825;2020.2030.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 2.122, 2035.2040.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 0.321, 2045.2050.EU27_regi.all.year.netGHG_LULUCFGrassi 0.01;on;on;EUR_regi, NEU_regi;;;;;;;;5;;;;;;;;heat;Mix4;2025;xx_WP5_RAP-REG;xx_DIAG-NPI;xx_DIAG-NPI;;;on;;;;ENC,EWN,ECS,ESC,ECE,FRA,DEU,UKI,ESW;;;;;;;;
# xx_WP5_RAP-REG-LimRES;0;;;;;;;;;;;;;;;;;;;;;;;;;;2050.GLO 0.9;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
# _____tests_____;0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;35.43046358;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
test_WP1_Nzero_DEU;0,WP1;;testOneRegi;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp20;9;globallyOptimal;650;diffCurvPhaseIn2Lin;100;2080;;9;;;;;;;;;;;;2050.GLO 0.9;NDC;regiCarbonPrice;(2035,2040,2045,2050).EU27_regi.tax.t.PE.biomass 0.237825;2020.2030.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 2.122, 2035.2050.EU27_regi.all.year.netGHG_LULUCFGrassi 0.01;on;on;EUR_regi, NEU_regi;;;;;;;;;;;;;;;;heat;Mix4;2025;xx_DIAG-NPI;xx_DIAG-NPI;xx_DIAG-NPI;;same as xx_DIAG-Nzero;;;;;;;;;DEU;debug;1;1;
test_WP1_Nzero_DEU;0,WP1;;testOneRegi;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp20;9;globallyOptimal;650;diffCurvPhaseIn2Lin;100;2080;;9;;;;;;;;;;;;2050.GLO 0.9;NDC;regiCarbonPrice;(2035,2040,2045,2050).EU27_regi.tax.t.PE.biomass 0.237825;2020.2030.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 2.122, 2035.2050.EU27_regi.all.year.netGHG_LULUCFGrassi 0.01;on;on;EUR_regi, NEU_regi;;;;;;;;;;;;;;;;heat;Mix4;2025;xx_DIAG-NPI;xx_DIAG-NPI;xx_DIAG-NPI;;same as xx_DIAG-Nzero;;;;;;;;;DEU;1;1;1;
xx_WP1_Nzero_highPrecision_10tCO2eq;0,test;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp20;9;globallyOptimal;650;diffCurvPhaseIn2Lin;100;2080;;9;;;;;;;;;;;;2050.GLO 0.9;NDC;regiCarbonPrice;(2035,2040,2045,2050).EU27_regi.tax.t.PE.biomass 0.237825;2020.2030.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 2.122, 2035.2050.EU27_regi.all.year.netGHG_LULUCFGrassi 0.01;on;on;EUR_regi, NEU_regi;;;;;;;;;;;;;;;;heat;Mix4;2025;xx_WP1_Nzero;xx_DIAG-NPI;xx_DIAG-NPI;;same as xx_DIAG-Nzero;;;;;;;;;;;;;0.002
xx_WP1_Nzero_highPrecision_5tCO2eq;0,test;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp20;9;globallyOptimal;650;diffCurvPhaseIn2Lin;100;2080;;9;;;;;;;;;;;;2050.GLO 0.9;NDC;regiCarbonPrice;(2035,2040,2045,2050).EU27_regi.tax.t.PE.biomass 0.237825;2020.2030.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 2.122, 2035.2050.EU27_regi.all.year.netGHG_LULUCFGrassi 0.01;on;on;EUR_regi, NEU_regi;;;;;;;;;;;;;;;;heat;Mix4;2025;xx_WP1_Nzero;xx_DIAG-NPI;xx_DIAG-NPI;;same as xx_DIAG-Nzero;;;;;;;;;;;;;0.001
xx_WP1_Nzero_highPrecision_1tCO2eq;0,test;;;;./config/regionmapping_21_EU11.csv;./config/extramapping_EU27.csv;rcp20;9;globallyOptimal;650;diffCurvPhaseIn2Lin;100;2080;;9;;;;;;;;;;;;2050.GLO 0.9;NDC;regiCarbonPrice;(2035,2040,2045,2050).EU27_regi.tax.t.PE.biomass 0.237825;2020.2030.EU27_regi.all.year.netGHG_LULUCFGrassi_intraRegBunker 2.122, 2035.2050.EU27_regi.all.year.netGHG_LULUCFGrassi 0.01;on;on;EUR_regi, NEU_regi;;;;;;;;;;;;;;;;heat;Mix4;2025;xx_WP1_Nzero;xx_DIAG-NPI;xx_DIAG-NPI;;same as xx_DIAG-Nzero;;;;;;;;;;;;;0.0002
Expand Down
2 changes: 1 addition & 1 deletion config/tests/scenario_config_quick.csv
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
title;start;cm_nash_mode;cm_iteration_max;optimization;results_folder;output;cm_quick_mode;force_replace;slurmConfig
testOneRegi;1;debug;1;testOneRegi;output/testOneRegi;NA;on;TRUE;--qos=priority --nodes=1 --tasks-per-node=1 --mem=8000 --time=60 --wait
testOneRegi;1;1;1;testOneRegi;output/testOneRegi;NA;on;TRUE;--qos=priority --nodes=1 --tasks-per-node=1 --mem=8000 --time=60 --wait
18 changes: 12 additions & 6 deletions core/loop.gms
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ $batinclude "./modules/include.gms" presolve
*cb 20140305 submit.R looks for the unique string in the following line and replaces it with the offlisting include into the full.gms at this position
***cb20140305readinpositionforfinxingfiles

*AJS* In case of fixing, fix to prices from input_ref.gdx (t < cm_startyear).
*** In case of fixing, fix to prices from input_ref.gdx (t < cm_startyear).
*** Parameters are not automatically treated by the fixing mechanism above.
if( (cm_startyear gt 2005),
Execute_Loadpoint "input_ref" p_pvpRef = pm_pvp;
Expand All @@ -71,9 +71,15 @@ if( (cm_startyear gt 2005),
***--------------------------------------------------------------------------
*** SOLVE
***--------------------------------------------------------------------------
***this disables solprint in cm_nash_mode=debug case by default. It is switched on in case of infes in nash/solve.gms
*RP* for faster debugging, turn solprint immediately on
$IF %cm_nash_mode% == "debug" option solprint = on ;
*** Set options for debugging
if (cm_nash_mode eq 1,
option
solprint = on
limcol = 2147483647
limrow = 2147483647
;
);


o_modelstat = 100;
loop(sol_itr$(sol_itr.val <= cm_solver_try_max),
Expand Down Expand Up @@ -153,8 +159,8 @@ $batinclude "./modules/include.gms" postsolve
*** save gdx
*--------------------------------------------------------------------------
*** write the fulldata.gdx file after each optimal iteration
*AJS* in Nash status 7 is considered optimal in that respect (see definition of
*** o_modelstat in solve.gms)
*** In Nash status 7 is considered optimal in that respect (see definition of
*** o_modelstat in solve.gms)
logfile.nr = 1;
if (o_modelstat le 2,
execute_unload "fulldata";
Expand Down
16 changes: 9 additions & 7 deletions main.gms
Original file line number Diff line number Diff line change
Expand Up @@ -443,12 +443,19 @@ $setGlobal codePerformance off !! def = off
*' #### SWITCHES
***-----------------------------------------------------------------------------
parameter
cm_iteration_max "number of iterations, if optimization is set to negishi or testOneRegi; used in nash mode only with cm_nash_autoconverge = 0"
cm_nash_mode "mode for solving nash problem"
;
cm_nash_mode = 2; !! def = 2 !! regexp = 1|2
*' * (1): debug - all regions are run in a sequence and the lst-file will contain information on infeasiblities
*' * (2): parallel - all regions are run in parallel
*'
parameter
cm_iteration_max "number of iterations, if optimization is set to negishi or testOneRegi; is overwritten in Nash mode, except for cm_nash_autoconverge = 0"
;
cm_iteration_max = 1; !! def = 1
*'
parameter
cm_abortOnConsecFail "number of iterations of consecutive infeasibilities/failures to solve for one region, after which the run is automatically aborted"
cm_abortOnConsecFail "number of iterations of consecutive infeasibilities/failures to solve for one region, after which the run automatically switches to serial debug mode"
;
cm_abortOnConsecFail = 5; !! def = 5
*'
Expand Down Expand Up @@ -1641,11 +1648,6 @@ $setGlobal cm_conoptv conopt3 !! def = conopt3
*' (off): normal model operation, default
*' (on): no model operation, instead input.gdx is copied to fulldata.gdx
$setGlobal c_empty_model off !! def = off !! regexp = off|on
*' mode for solving nash problem
*'
*' * parallel - all regions are run an parallel
*' * debug - all regions are run in a sequence and the lst-file will contain information on infeasiblities
$setGlobal cm_nash_mode parallel !! def = parallel !! regexp = debug|parallel|serial
$setglobal cm_secondary_steel_bound scenario !! def = scenario
$setglobal c_GDPpcScen SSP2EU !! def = gdp_SSP2 (automatically adjusted by start_run() based on GDPscen)
$setglobal cm_demScen gdp_SSP2EU !! def = gdp_SSP2EU
Expand Down
2 changes: 1 addition & 1 deletion modules/80_optimization/nash/declarations.gms
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ s80_numberIterations "display helper"
s80_bool "helper"
s80_converged "if nash converged, this is 1"
s80_cnptfile "parameter that indicates which optimality tolerance will be used" /1/

s80_runInDebug "Is 1 if regions stayed infeasible in nash and start in debug mode automatically following the parallel mode" /0/
;

*' defining specific output formats:
Expand Down
2 changes: 1 addition & 1 deletion modules/80_optimization/nash/not_used.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# | AGPL-3.0, you are granted additional permissions described in the
# | REMIND License Exception, version 1.0 (see LICENSE file).
# | Contact: [email protected]
name, type, reason
name,type,reason
cm_solver_try_max, switch, not needed
pm_prtp, parameter, ???
pm_taxCO2eq, parameter, ???
Expand Down
53 changes: 33 additions & 20 deletions modules/80_optimization/nash/postsolve.gms
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ loop(ttot$(ttot.val ge 2005),
( sm_fadeoutPriceAnticip*p80_etaXp(trade)
* ( (pm_Xport0(ttot,regi,trade) - p80_Mport0(ttot,regi,trade)) - (vm_Xport.l(ttot,regi,trade) - vm_Mport.l(ttot,regi,trade))
- p80_taxrev0(ttot,regi)$(ttot.val gt 2005)$(sameas(trade,"good")) + vm_taxrev.l(ttot,regi)$(ttot.val gt 2005)$(sameas(trade,"good"))
)
)
/ (p80_normalize0(ttot,regi,trade) + sm_eps)
)
;
Expand Down Expand Up @@ -126,9 +126,9 @@ if(iteration.val > 2,
if(iteration.val > 2,
loop(ttot$(ttot.val ge 2005),
loop(trade$(tradePe(trade) OR sameas(trade,"good") ),
if( ( Sign(p80_surplus(ttot,trade,iteration) ) eq Sign(p80_surplus(ttot,trade,iteration-1) ) ) AND
( abs(p80_surplus(ttot,trade,iteration)) gt p80_surplusMaxTolerance(trade) ) ,
o80_trackSurplusSign(ttot,trade,iteration) = o80_trackSurplusSign(ttot,trade,iteration-1) +1;
if( ( Sign(p80_surplus(ttot,trade,iteration) ) eq Sign(p80_surplus(ttot,trade,iteration-1) ) )
AND ( abs(p80_surplus(ttot,trade,iteration)) gt p80_surplusMaxTolerance(trade) ) ,
o80_trackSurplusSign(ttot,trade,iteration) = o80_trackSurplusSign(ttot,trade,iteration-1) +1;
else
o80_trackSurplusSign(ttot,trade,iteration) = 0;
);
Expand Down Expand Up @@ -191,7 +191,7 @@ loop(trade$(NOT tradeSe(trade)),
pm_pvp(ttot,trade) = p80_pvp_itr(ttot,trade,iteration+1);
pm_Xport0(ttot,regi,trade)$(pm_SolNonInfes(regi) eq 1) = vm_Xport.l(ttot,regi,trade);
p80_Mport0(ttot,regi,trade)$(pm_SolNonInfes(regi) eq 1) = vm_Mport.l(ttot,regi,trade);
p80_Mport0(ttot,regi,trade)$(pm_SolNonInfes(regi) eq 0) = 1.2 * vm_Mport.l(ttot,regi,trade);
p80_Mport0(ttot,regi,trade)$(pm_SolNonInfes(regi) eq 0) = 1.2 * vm_Mport.l(ttot,regi,trade);
);
);
);
Expand Down Expand Up @@ -268,7 +268,7 @@ loop(trade$(NOT tradeSe(trade)),
p80_messageShow("surplus") = YES;
loop(ttot$((ttot.val ge cm_startyear) and (ttot.val gt 2100)),
if( (abs(p80_surplus(ttot,trade,iteration)) gt p80_surplusMaxTolerance(trade) ),
p80_messageFailedMarket(ttot,trade) = YES;
p80_messageFailedMarket(ttot,trade) = YES;
);
);
);
Expand Down Expand Up @@ -648,8 +648,8 @@ if (cm_abortOnConsecFail gt 0,
loop (regi,
if ( ( p80_repy_iteration(regi,"solvestat",iteration) eq 1
AND p80_repy_iteration(regi,"modelstat",iteration) eq 2)
OR ( p80_repy_iteration(regi,"solvestat",iteration) eq 4
AND p80_repy_iteration(regi,"modelstat",iteration) eq 7),
OR ( p80_repy_iteration(regi,"solvestat",iteration) eq 4
AND p80_repy_iteration(regi,"modelstat",iteration) eq 7),
!! region was solved successfully
p80_trackConsecFail(regi) = 0;
else
Expand All @@ -659,28 +659,41 @@ if (cm_abortOnConsecFail gt 0,
);

if (smax(regi, p80_trackConsecFail(regi)) >= cm_abortOnConsecFail,
execute_unload "abort.gdx";
display p80_trackConsecFail;
abort "Run was aborted because the maximum number of consecutive failures was reached in at least one region!";
if ((s80_runInDebug eq 0) AND (cm_nash_mode ne 1), !! auto-start debug only if not already in debug mode
if (sum(regi, pm_SolNonInfes(regi) ne 0) eq 0, !! if all regions are infeasible debug makes no sense
execute_unload "abort.gdx";
abort "Run was aborted because the maximum number of consecutive failures was reached in at least one region! No debug started since all regions are infeasible.";
else !! start debug mode only if at leat one region was feasible
s80_runInDebug = 1;
cm_nash_mode = 1;
display "Starting nash in debug mode after maximum number of consecutive failures was reached in at least one region.";
);
else !! s80_runInDebug eq 1 AND/OR cm_nash_mode eq 1
execute_unload "abort.gdx";
abort "After debug mode run was aborted because the maximum number of consecutive failures was still reached in at least one region!";
);
else
!! Set nash mode back to parallel because all regions got feasible after they have been automatically restarted as debug
if (s80_runInDebug eq 1,
s80_runInDebug = 0;
cm_nash_mode = 2;
display "Set nash mode back to parallel after regions got feasible in auto-debug mode.";
);
);
);

***Fade out LT correction terms, they should only be important in the first iterations and might interfere with ST corrections.
***p80_etaLT(trade) = p80_etaLT(trade)*0.5;



***--------------------------
*** EMIOPT implementation
***--------------------------
$ifthen.emiopt %emicapregi% == 'none'
if(cm_emiscen eq 6,

*mlb 20150609* nash emiopt algorithm
***we iteratively reach the point where these two marginals are equal for each region by adjusting regional permit budgets:
***marginal of cumulative emissions:
*** nash emiopt algorithm
*** we iteratively reach the point where these two marginals are equal for each region by adjusting regional permit budgets:
*** marginal of cumulative emissions:
p80_eoMargEmiCum(regi) = 5*(abs(qm_co2eqCum.m(regi)))$(pm_SolNonInfes(regi) eq 1);
***marginal of permit budget :
*** marginal of permit budget :
p80_eoMargPermBudg(regi) = 5*(abs(q80_budgetPermRestr.m(regi)))$(pm_SolNonInfes(regi) eq 1);

display pm_budgetCO2eq;
Expand All @@ -689,7 +702,7 @@ display pm_budgetCO2eq;
loop(regi,
p80_eoWeights(regi) = 1/max(abs(qm_budget.m("2050",regi)),1E-9);
);
***normalize sum to unity
***normalize sum to unity
p80_eoWeights(regi) = p80_eoWeights(regi) / sum(regi2, p80_eoWeights(regi2) );


Expand Down
4 changes: 0 additions & 4 deletions modules/80_optimization/nash/sets.gms
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ convMessage80 "contains all convergence criteria"
/
infes,surplus,nonopt,taxconv,anticip,target,regiTarget,implicitEnergyTarget,cm_implicitPriceTarget,cm_implicitPePriceTarget,damage,DevPriceAnticip
/
nash_sol_itr80 "nash iterations"
/
1*10
/
;

teLearn(learnte_dyn80) = YES;
Expand Down
55 changes: 24 additions & 31 deletions modules/80_optimization/nash/solve.gms
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,30 @@
*** | Contact: [email protected]
*** SOF ./modules/80_optimization/nash/solve.gms

regi(all_regi) = no;
hybrid.solvelink = 3;
regi(all_regi) = NO;
hybrid.solvelink = 3; !! activate multiple-CPU mode for GAMS
hybrid.optfile = 9;

$ifthene.debug (sameas("%cm_nash_mode%","serial"))OR(sameas("%cm_nash_mode%","debug"))
hybrid.solvelink = 0;
$endif.debug
if(cm_nash_mode eq 1,
hybrid.solvelink = 0; !! activate single-CPU mode for GAMS
);

loop (all_regi,
!! only solve for regions that do not have a valid solution for this nash iteration
if ( sol_itr.val gt 1
AND ( p80_repy(all_regi,"modelstat") eq 2
!! only solve for regions that do not have a valid solution from the
!! last solver iteration
if ( ( sol_itr.val gt 1
OR s80_runInDebug eq 1)
AND ( p80_repy(all_regi,"modelstat") eq 2
$ifthen.repeatNonOpt "%cm_repeatNonOpt%" == "off"
OR p80_repy(all_regi,"modelstat") eq 7
OR p80_repy(all_regi,"modelstat") eq 7
$endif.repeatNonOpt
),

p80_repy_thisSolitr(all_regi,solveinfo80) = 0;
continue;
);

regi(all_regi) = yes;
regi(all_regi) = YES;

if (execError > 0,
execute_unload "abort.gdx";
Expand All @@ -50,30 +52,28 @@ $endif.repeatNonOpt

solve hybrid using nlp maximizing vm_welfareGlob;

$ifthene.debug (sameas("%cm_nash_mode%","serial"))OR(sameas("%cm_nash_mode%","debug"))
p80_repy_thisSolitr(all_regi,"solvestat") = hybrid.solvestat;
p80_repy_thisSolitr(all_regi,"modelstat") = hybrid.modelstat;
p80_repy_thisSolitr(all_regi,"resusd") = hybrid.resusd;
p80_repy_thisSolitr(all_regi,"objval") = hybrid.objval;
if (p80_repy_thisSolitr(all_regi,"modelstat") eq 2,
p80_repyLastOptim(all_regi,"objval") = p80_repy(all_regi,"objval");
if(cm_nash_mode eq 1,
p80_repy_thisSolitr(all_regi,"solvestat") = hybrid.solvestat;
p80_repy_thisSolitr(all_regi,"modelstat") = hybrid.modelstat;
p80_repy_thisSolitr(all_regi,"resusd") = hybrid.resusd;
p80_repy_thisSolitr(all_regi,"objval") = hybrid.objval;
if (p80_repy_thisSolitr(all_regi,"modelstat") eq 2,
p80_repyLastOptim(all_regi,"objval") = p80_repy(all_regi,"objval");
);
);
$endif.debug

regi(all_regi) = NO;
p80_handle(all_regi) = hybrid.handle;
); !! close regi loop

$ifthen.parallel %cm_nash_mode% == "parallel"
if(cm_nash_mode eq 2,
repeat
loop (all_regi$handlecollect(p80_handle(all_regi)),
p80_repy_thisSolitr(all_regi,"solvestat") = hybrid.solvestat;
p80_repy_thisSolitr(all_regi,"modelstat") = hybrid.modelstat;
p80_repy_thisSolitr(all_regi,"resusd") = hybrid.resusd;
p80_repy_thisSolitr(all_regi,"objval") = hybrid.objval;

* p80_repyLatestSolve(all_regi,solveinfo80) = p80_repy(all_regi,solveinfo80);

if (p80_repy_thisSolitr(all_regi,"modelstat") eq 2,
p80_repyLastOptim(all_regi,"objval") = p80_repy_thisSolitr(all_regi,"objval");
);
Expand All @@ -83,7 +83,7 @@ repeat
);
display$sleep(5) "sleep some time";
until card(p80_handle) = 0;
$endif.parallel
);

regi(all_regi) = YES;

Expand All @@ -110,7 +110,8 @@ loop (regi,
if (p80_repy(regi,"modelstat") eq 2 OR p80_repy(regi,"modelstat") eq 7,
pm_SolNonInfes(regi) = 1;
);
if (p80_repy(regi,"modelstat") eq 7, p80_SolNonOpt(regi) = 1);
if (p80_repy(regi,"modelstat") eq 7,
p80_SolNonOpt(regi) = 1);
);

*** set o_modelstat to the highest value across all regions
Expand All @@ -121,14 +122,6 @@ $else.repeatNonOpt
= smax(regi, p80_repy(regi,"modelstat")); !! also taking into account status 7
$endif.repeatNonOpt

*** in cm_nash_mode=debug mode, enable solprint for next sol_itr when last
*** iteration was non-optimal:
$ifthen.solprint %cm_nash_mode% == "debug"
if (o_modelstat ne 2,
option solprint = on;
);
$endif.solprint

!! add information if this region was solved in this iteration
p80_repy_iteration(regi,solveinfo80,iteration)$(
p80_repy_thisSolitr(regi,solveinfo80) )
Expand Down
Loading

0 comments on commit c33e9fe

Please sign in to comment.