scenred.gms 1.6 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
* 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;
15
$ifthene %debug%>1
16
17
18
19
ScenRedParms('visual_init') = 1;
ScenRedParms('visual_red') = 1;
$endif

Erkka Rinne's avatar
Erkka Rinne committed
20
* Export data
21
execute_unload 'srin.gdx', ScenRedParms,
22
                                  s, ss, p_sProbability,
23
                                  ts_influx_, ts_cf_;
Erkka Rinne's avatar
Erkka Rinne committed
24
25
26
27
28
29
30
* Choose right null device
$ifthen %system.filesys% == 'MSNT' $set nuldev NUL
$else $set nuldev /dev/null
$endif
* Execute SCENRED2 and load data
$log Executing SCENRED2
execute 'scenred2 inc/scenred.cmd > %nuldev%';
Erkka Rinne's avatar
Erkka Rinne committed
31
if(errorLevel, abort "Scenario reduction (SCENRED2) failed");
32
execute_load 'srout.gdx', ScenRedReport,
Erkka Rinne's avatar
Erkka Rinne committed
33
                          p_sProbability=red_prob;
34
35
36
37
38

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

* Update sets
39
40
41
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);
42

Erkka Rinne's avatar
Erkka Rinne committed
43
44
45
46
47
* Clear data from removed samples
ts_influx_(gn, ft, s)$(not s_active(s)) = 0;
ts_cf_(flowNode, ft, s)$(not s_active(s)) = 0;


48
49
50
51
else
    put log "!!! No scenario reduction setting given, skipping scenario reduction!"/;
);