1) I want AMPL to choose a number out of a predefined set. For example I
want AMPL to choose randomly between numbers 5, 9, 19. This should be quite
simple but what I found in A-3 didn't help me.
2) I want to create a random sequence for a production model. This means I
want AMPL to choose parameters (products) and give them a random number in
the production sequence. Additionally this should be controlled by
probabilities:
For example AMPL should randomly choose to pick product 2 for position 5 in
the sequence with a probability of 13%, product 3 for position 5 with a
probability of 21 % and so on...
Phil Kleffner
--
View this message in context: http://www.nabble.com/Random-numbers-tf3610091.html#a10088112
Sent from the AMPL mailing list archive at Nabble.com.
let source:= {5, 9, 19};
for {1..10} display member(floor(1+(Uniform(0,1)*3)),source);
--
Steven Harrod
Lexington, KY
859 225 1572
--
View this message in context: http://www.nabble.com/Random-numbers-tf3610091.html#a10094075
--
View this message in context: http://www.nabble.com/Random-numbers-tf3610091.html#a10094075
set source ordered;
for { 1..10 } {
let source := { 5, 9, 19 };
display member(floor(1+(Uniform(0,1)*3)),source);
reset data;
}
member(floor(1 + Uniform(0, 1)*3), source) = 9
member(floor(1 + Uniform(0, 1)*3), source) = 5
member(floor(1 + Uniform(0, 1)*3), source) = 19
member(floor(1 + Uniform(0, 1)*3), source) = 19
member(floor(1 + Uniform(0, 1)*3), source) = 5
member(floor(1 + Uniform(0, 1)*3), source) = 19
member(floor(1 + Uniform(0, 1)*3), source) = 9
member(floor(1 + Uniform(0, 1)*3), source) = 5
member(floor(1 + Uniform(0, 1)*3), source) = 9
member(floor(1 + Uniform(0, 1)*3), source) = 9
Bob Fourer
4...@ampl.com
> -----Original Message-----
> From: am...@googlegroups.com [mailto:am...@googlegroups.com] On Behalf Of
> Phil.Kleff
> Sent: Friday, April 20, 2007 5:04 AM
> To: am...@googlegroups.com
> Subject: [AMPL 1025] Re: Random numbers
>
>
>