mercredi 28 août 2019

How to generate random parameters in AMPL

how can I generate random parameters on AMPL. Here is my code:

set P;set R;param T>0 integer;
param k {p in P} > 0;param z {r in R} > 0;param c1 >= 0;param c2 >= 0;param c3 >= 0;param h >= 0;param f >= 0;param v >= 0;param D {t in 1..T, p in P} >= 0; param Dr{t in 1..T, r in R} >= 0;param M {t in 1..T, p in P} > 0;param O {t in 1..T, p in P} > 0;

var m {t in 1..T, p in P} >= 0;var n {t in 1..T, r in P} >= 0;var o {t in 1..T, p in P} >= 0;var a {t in 1..T, p in P} >= 0;var d {t in 1..T, p in P} >= 0;var s {t in 1..T, p in P} >= 0;

maximize profit: sum {t in 1..T} sum {p in P} k[p]* m[t,p] + sum{t in 1..T} sum {r in R}z[r]*n[t,r] - (c1*sum {t in 1..T} sum {p in P} m[t,p] + c2 *sum {t in 1..T} sum {r in R} n[t,r] + c3 * sum {t in 1..T} sum {p in P} o[t,p] + h * sum {t in 1..T} sum {p in P} a[t,p] + f * sum {t in 1..T} sum {p in P} d[t,p] + v * sum {t in 1..T} sum {p in P} s[t,p]);

subject to regular capacity {p in P, t in 1..T}: m[t,p] <= M[t,p];
subject to  overrate capacity {t in 1..T, p in P}: o[t,p] <= O[t,p];
subject to  inventory balance {t in 1..T, p in P}: s[t,p] = s[t-1,p] + m[t,p] + o[t,p] - D[t,p];
subject to  increasing limit {t in 1..T, p in P}: a[t,p] >= m[t,p] - m[t-1,p];

subject to decreasing limit {t in 1..T, p in P}: d[t,p] >= m[t-1,p] - m[t,p]; subject to refurbishing limit {t in 1..T, r in R, p in P}: n[t,r] <= 0.2 * m[t,p]; subject to demand balance {t in 1..T, p in P}: m[t,p] = D[t,p]; subject to demand balance {t in 1..T, r in R}: n[t,r] <= Dr[t,r];

here are the given sets : set P and R from 1 to 5 and T from 1 to 12 How can i randomly generate parameters other parameters based on these informations Thanks




Aucun commentaire:

Enregistrer un commentaire