## Minimum of Unrelated Parameters Topic is solved

Problems with syntax of GAMS
NiobiumFire2
User
Posts: 5
Joined: 11 months ago

### 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!

bussieck
Moderator
Posts: 286
Joined: 2 years ago

### Re: Minimum of Unrelated Parameters

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

Code: Select all

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

NiobiumFire2
User
Posts: 5
Joined: 11 months ago

### Re: Minimum of Unrelated Parameters

bussieck wrote:
7 months ago
You don't need an smin, a min is okay and since i and j are controlled by the equation this should work:

Code: Select all

``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[<set required>,... even though i and j are controlled. I'm not sure exactly what it wants.

Joel

bussieck
Moderator
Posts: 286
Joined: 2 years ago

### Re: Minimum of Unrelated Parameters

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:

Code: Select all

``````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

NiobiumFire2
User
Posts: 5
Joined: 11 months ago

### Re: Minimum of Unrelated Parameters

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