Current Value of Random Parameter

51 views
Skip to first unread message

Alan Delgado de Oliveira

unread,
May 7, 2014, 10:30:48 AM5/7/14
to amp...@googlegroups.com
Hi,

i'm working with scenarios. In each scenario, i have a random parameter (Price). I can get the realized prices, but i would like to get the its expected values, the values that problem catch at first decision. Someone knows how could i do that?

Any Help will be appreciated,
tks.

AMPLDev Team

unread,
May 7, 2014, 10:43:12 AM5/7/14
to amp...@googlegroups.com

Hi Alan,

It looks as in your model you have something like:

set ASSETS;

set SCENARIOS;

param probability{SCENARIOS};

param price{ASSETS, SCENARIOS};

you can get the expected price as a derived parameter like:

param eprice{a in ASSETS} := sum{s in SCENARIOS} probability[s] * price[a,s];

Alan Delgado de Oliveira

unread,
May 8, 2014, 8:12:50 AM5/8/14
to amp...@googlegroups.com
Thank you very much for answer. I will try that. I would like to ask more one something. It's about the random parameter price of my problem. The only way to define this parameter that i know is:

#parameters for set ranges
param NT:=2; param NS:=2; param NA:=2;

#Sets
set ASSETS := 1..NA; set TIME := 1..NT;

#Parameters
param price{TIME, ASSETS, SCENARIO}:= Normal(35.0, 0.5);

In this way, i have to define a mean and std dev. There is another way to define a random parameter (whitout this values)?

tks!
Message has been deleted

AMPLDev Team

unread,
May 9, 2014, 4:52:37 AM5/9/14
to amp...@googlegroups.com
Hi Alan,

1) Instead of calculating the values for the parameter in AMPL, you can generate the pertaining data with any program (e.g. Excel, MATLAB, R…)
2) Export it as a table or a data file and use that data for the parameter.

This is useful because of more advanced data manipulation facilities available in such environments.
 
Hope this helps,

AMPLDev Team

Alan Delgado de Oliveira

unread,
May 9, 2014, 3:24:57 PM5/9/14
to amp...@googlegroups.com
Ok, but could i do that "on the fly"? the model get the values at first stage (expected value), to take decision. Could Matlab  give this values at time to decide?

AMPLDev Team

unread,
May 12, 2014, 5:25:17 AM5/12/14
to amp...@googlegroups.com
Hi Alan,

1) If you can implement the procedure in AMPL, then you can write your script that calculates the values at runtime.
Otherwise
2) You can write your own user defined function in C/C++ and import it into AMPL, as illustrated here.

Finally, an AMPL API is about to be released, which will enable to interact with Java and MATLAB in the first version. 
Further information will be available at www.ampl.com.

Regards,

AMPLDev Team

Alan Delgado de Oliveira

unread,
May 12, 2014, 3:44:36 PM5/12/14
to amp...@googlegroups.com
Thank you very much!! I will try do that :)
Reply all
Reply to author
Forward
0 new messages