Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

For Nash: after infeasibilities continue in debug mode before aborting #1636

Merged
merged 9 commits into from
Mar 28, 2024

Conversation

dklein-pik
Copy link
Contributor

@dklein-pik dklein-pik commented Mar 26, 2024

Purpose of this PR

For Nash only:

So far, REMIND aborted after the maximum number of consecutive infeasibilities/failures (cm_abortOnConsecFail) was reached in at least one region. Now, it switches from parallel to serial (debug) mode after the maximum number was reached and tries to solve (only the infeasible regions, see #1522). If all regions become magically feasible in the debug mode, it continues in parallel mode. If not, it finally aborts. All this is done within GAMS, not in R, to keep the full information from the previous nash and solver iteration. However, this also means that for the duration of the debug mode, which only runs on one core, the other cores are idle.

Type of change

  • New feature

Checklist:

  • My code follows the coding etiquette
  • I performed a self-review of my own code
  • I explained my changes within the PR, particularly in hard-to-understand areas
  • I checked that the in-code documentation is up-to-date
  • I adjusted the reporting in remind2 where it was needed
  • I adjusted forbiddenColumnNames in readCheckScenarioConfig.R in case the PR leads to deprecated switches
  • All automated model tests pass (FAIL 0 in the output of make test)
  • The changelog CHANGELOG.md has been updated correctly

Further information (optional):

  • Test runs are here: /p/tmp/dklein/remind-dklein/output/SSP1-PkBudg650_2024-03-27_12.24.58/

@dklein-pik dklein-pik marked this pull request as ready for review March 26, 2024 13:04
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice.

modules/80_optimization/nash/solve.gms Outdated Show resolved Hide resolved
modules/80_optimization/nash/solve.gms Outdated Show resolved Hide resolved
modules/80_optimization/nash/solve.gms Outdated Show resolved Hide resolved
config/default.cfg Show resolved Hide resolved
modules/80_optimization/nash/postsolve.gms Outdated Show resolved Hide resolved
Copy link
Contributor

@orichters orichters left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One comment, see below.

main.gms, start.R and start_bundle_coupled.R look good.

By the way: Wasn't there the idea to move the switch definitions to a different file anyway at some point to avoid all this redundant work in the standalone templates that are unusable anyway?

core/loop.gms Outdated
***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 ;
*** This disables solprint in cm_nash_mode=1 (debug) case by default. It is switched on in case of infes in nash/solve.gms
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually don't get the comment. Setting solprint to on disables it by default?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lazy commenting.

diff --git a/core/loop.gms b/core/loop.gms
index a7758ac..d57b3f7 100644
--- a/core/loop.gms
+++ b/core/loop.gms
@@ -63,7 +63,8 @@ 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
-$IF %cm_nash_mode% == "debug" option solprint = off ;
+*RP* for faster debugging, turn solprint immediately on
+$IF %cm_nash_mode% == "debug" option solprint = on ;
 
 o_modelstat = 100;
 loop(sol_itr$(sol_itr.val <= c_solver_try_max),

(You will have to look on the Gitlab repo.)

Add two conditions for auto-debug mode. Only start auto-debug mode if
  1) not all regions are infeasible
  2) if not already in manual debug mode
Activate equation and column listing in debug mode
Remove solprint statement in solve.gms that was always overwritten in loop.gms
@dklein-pik dklein-pik merged commit c33e9fe into remindmodel:develop Mar 28, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants