Search code examples
ampl

AMPL "Locking" a derived variable to a value


I want to investigate whether it is profitable to invest in an additional production facility, and hence I have to account for an capitilization in my objective function.

As such I am wondering if it is possible to, say, if y[t] = 1, then y[g] = 1 for g != t, g > t and where g,t is a subset of the time interval set T.

My first thought was to have:

subject to Constraint1:
    y[t] = y[t-1] for all t in T

But that must surely render the solution of y to become the start value in y[0] which is something I obviously do not want.

For clarification. Assume that y[t] is a binary variable whose value is 1 if the investment is undertaken in time t, otherwise 0.

Hope anyone can shed some light into this!

Regards


Solution

  • The constraint y[t] = 1, then y[g] = 1 for g != t, g > t can be represented in AMPL as something like:

    s.t. c{t in T: t != t0}: y[t + 1] >= y[t];
    

    where t0 is the first element of set T. Note the use of >= instead of =. If y[t] is 1 for some t, it will drive y for all subsequent values of t to 1.