scenred.gms 1.33 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
* Ensure scenario reduction setting are given
if(mSettings(mSolve, 'red_num_leaves')
   or mSettings(mSolve, 'red_percentage'),

* Get probabilitiesfor samples
p_sProbability(s)$ms(mSolve, s) = p_msProbability_orig(mSolve, s);

* SCENRED2 parameters
ScenRedParms('red_num_leaves') = mSettings(mSolve, 'red_num_leaves');
ScenRedParms('red_percentage') = mSettings(mSolve, 'red_percentage');
ScenRedParms('scen_red') = 1;  // Reduce scenarios
ScenRedParms('tree_con') = 0;  // No tree construction
*ScenRedParms('report_level') = 2;
ScenRedParms('run_time_limit') = 30;
$ifthen %debug% == 'yes'
ScenRedParms('visual_init') = 1;
ScenRedParms('visual_red') = 1;
$endif

* Data exchange and execute SCENRED2
21
execute_unload 'srin.gdx', ScenRedParms,
22
                                  s, ss, p_sProbability,
23
                                  ts_influx_, ts_cf_;
24
execute 'scenred2 inc/scenred.cmd';
Erkka Rinne's avatar
Erkka Rinne committed
25
if(errorLevel, abort "Scenario reduction (SCENRED2) failed");
26
execute_load 'srout.gdx', ScenRedReport,
Erkka Rinne's avatar
Erkka Rinne committed
27
                          p_sProbability=red_prob;
28
29
30
31
32

* Update probabilities
p_msProbability(mSolve, s) = p_sProbability(s);

* Update sets
33
34
35
s_active(s) = p_sProbability(s);
msft(mSolve, s, f, t)$msft(mSolve, s, f, t) = s_active(s);
sft(s, f, t)$sft(s, f, t) = s_active(s);
36
37
38
39
40

else
    put log "!!! No scenario reduction setting given, skipping scenario reduction!"/;
);