16.01.2015 Views

GAMS — The Solver Manuals - Available Software

GAMS — The Solver Manuals - Available Software

GAMS — The Solver Manuals - Available Software

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

DECIS 215<br />

First define the <strong>GAMS</strong> stochastic file “MODEL.STG” (only the exact name in uppercase letters is supported)<br />

and set up <strong>GAMS</strong> to write to it. This is done by the first two statements. You may want to consult the <strong>GAMS</strong><br />

manual for how to use put for writing files. <strong>The</strong> next statement “INDEP DISCRETE” indicates that a section of<br />

independent stochastic parameters follows. <strong>The</strong>n we write all possible outcomes and corresponding probabilities<br />

for each stochastic parameter best by using a loop statement. Of course one could also write each line separately,<br />

but this would not look nicely. Writing a “*” between the definitions of the independent stochastic parameters is<br />

merely for optical reasons and can be omitted.<br />

* defining distributions (writing file MODEL.STG)<br />

file stg /MODEL.STG/;<br />

put stg;<br />

put "INDEP DISCRETE" /;<br />

loop(omega1,<br />

put "x g1 omax g1 ", v1("out", omega1), " period2 ", v1("pro", omega1) /;<br />

);<br />

put "*" /;<br />

loop(omega2,<br />

put "x g2 omax g2 ", v2("out", omega2), " period2 ", v2("pro", omega2) /;<br />

);<br />

put "*" /;<br />

loop(omega3,<br />

put "RHS demand h ", v3("out", omega3), " period2 ", v3("pro", omega3) /;<br />

);<br />

put "*" /;<br />

loop(omega4,<br />

put "RHS demand m ", v4("out", omega4), " period2 ", v4("pro", omega4) /;<br />

)<br />

put "*" /;<br />

loop(omega5,<br />

put "RHS demand l ", v5("out", omega5), " period2 ", v5("pro", omega5) /;<br />

);<br />

putclose stg;<br />

In the example APL1P the first stochastic parameter is the availability of generator g1. In the model the<br />

parameter appears as the coefficient of variable x(g1) in equation omax(g1). <strong>The</strong> definition using the put statement<br />

first gives the stochastic parameter as the intersection of variable x(g1) with equation omax(g1), but without<br />

having to type the braces, thus x g1 omax g1, then the outcome v1(”out”, omega1) and the probability v1(”pro”,<br />

omega1) separated by “period2”. <strong>The</strong> different elements of the statement must be separated by blanks. Since<br />

the outcomes and probabilities of the first stochastic parameters are driven by the set omega1 we loop over<br />

all elements of the set omega1. We continue and define all possible outcomes for each of the five independent<br />

stochastic parameters.<br />

In the example of independent stochastic parameters, the specification of the distribution of the stochasic parameters<br />

using the put facility creates the following file “MODEL.STG”, which then is processed by the <strong>GAMS</strong>/DECIS<br />

interface:<br />

INDEP DISCRETE<br />

x g1 omax g1 -1.00 period2 0.20<br />

x g1 omax g1 -0.90 period2 0.30<br />

x g1 omax g1 -0.50 period2 0.40<br />

x g1 omax g1 -0.10 period2 0.10<br />

*<br />

x g2 omax g2 -1.00 period2 0.10<br />

x g2 omax g2 -0.90 period2 0.20<br />

x g2 omax g2 -0.70 period2 0.50<br />

x g2 omax g2 -0.10 period2 0.10<br />

x g2 omax g2 0.00 period2 0.10<br />

*<br />

RHS demand h 900.00 period2 0.15<br />

RHS demand h 1000.00 period2 0.45<br />

RHS demand h 1100.00 period2 0.25<br />

RHS demand h 1200.00 period2 0.15<br />

*<br />

RHS demand m 900.00 period2 0.15

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!