如何在 AMPL 中生成随机参数



如何在AMPL中生成随机参数?这是我的代码:

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];

以下是给定的集合:

将 P 和 R 设置为 1 到 5,将 T 设置为 1 到 12

如何根据此信息随机生成其他参数?

https://ampl.com/faqs/how-do-i-solve-a-series-of-different-random-problems-with-data-drawn-from-the-same-distribution/给出了以下代码示例:

param avail_mean {STAGE} >= 0;
param avail_variance {STAGE} >= 0;
param avail {s in STAGE} :=
Normal (avail_mean[s], avail_variance[s]);

有关可用的不同随机函数的文档,请参阅AMPL手册和表A3的第7.6节和表A3。

相关内容

  • 没有找到相关文章

最新更新