让参数根据变量更改其值

时间:2021-03-30 09:46:54

标签: optimization ampl

我正在尝试模拟维护将如何影响资产的健康指数并最大限度地降低其成本。从最简单的例子开始,这是我所拥有的:

var chi {0..1, 1..100} binary; # maintenance or no maintenance at instant t

#param HI {1..100};
var HI {1..100};

#let HI[1] := 100;
#let {t in 1..99} HI[t+1] := 0.9*HI[t];
#let {t in 1..99} HI[t+1] := if chi[1,t] = 0 then 0.9*HI[t] else 100;


minimize cost: sum {t in 1..100}(chi[0,t]*0 + chi[1,t]*5);


subject to
health {t in 1..100}: HI[t] >= 30; # If HI were to get below 30, maintenance has to be made

one_decision: product {t in 1..100} sum {i in 0..1} chi[i,t] == 1; # Ensuring one decision at every point in time

#initial_health: HI[1] = 100;


#small_improv {t in 1..100}:   chi[1,t] = 1 ==> HI[t] := 100;

condition {t in 1..100}: HI[t+1] := if chi[1,t] = 0 then 0.9*HI[t] else 100;

评论的是我尝试过的其他事情。 HI 应该是一个参数吗?这可能是最有意义的,但我不知道如何在运行时更改其值...

此外,健康约束可能应该是这样的:

health {t in 1..100}: HI[t] < 30 ==> chi[1,t] = 1;

但我还是不确定。

0 个答案:

没有答案