Minimum of Unrelated Parameters

Hi everyone,

I am in need of a way to express the minimum of two parameters in a model constraint. The two parameters are not of the same set.

For example:

“equation(i, j)… t(i, j) =l= smin[x(i) * U(i), y(j) * U(j)] * z(i, j);”

where t and z are variables and x, y and U are parameters.

How can I achieve this without defining a new joint parameter, as I feel this will get very messy?

Thanks!

You don’t need an smin, a min is okay and since i and j are controlled by the equation this should work:

equation(i, j).. t(i, j) =l= min[x(i) * U(i), y(j) * U(j)] * z(i, j);

-Michael

Thank you for the reply Michael.

For some reason, when I use the min function, I get errors asking for a set at the start of the bracket: min[,… even though i and j are controlled. I’m not sure exactly what it wants.

Joel

Not clear what happens, you probably should upload your entire model to allow us to see what’s going on. The following (non-sense) model compile just fine:

set i /1/; alias (i,j)
parameter x(i) /1 1/, U(i) /1 1/, y(i) /1 1/, t(i,j) /1.1 1/;
variable z(i,j),obj;

equation defobj, e(i, j);

e(i, j).. t(i, j) =l= min[x(i) * U(i), y(j) * U(j)] * z(i, j);
defobj.. obj =e= 0;

model m /all/;
solve m min obj us lp;

-Michael

Hi Michael,

After playing around with the sample you posted I figured out the issue I was having: I had declared an identifier called “min” as a variable elsewhere in the model. I changed this identifier’s name and the min function is working properly again.

Thanks for the help!
Joel