Is it possible to use a decision variable as an outer loop (combination)

Problems with modeling
Post Reply
abb.omidi
User
User
Posts: 39
Joined: 6 years ago

Is it possible to use a decision variable as an outer loop (combination)

Post by abb.omidi »

Hi,

There are some situations in which one needs to use a decision variable as an index in a specific constraint. Applying such a case, somewhat, is straightforward by introducing the auxiliary binary variables and adding appropriate constraints. Now, someone needs to use a decision variable as an index in the outer loop (for-each combination). E.g. in the following constraints:

Code: Select all

eq14(np(i) , nc(j) , t)$(ord(t)<=card(t)-cp) .. z2(i,j,t) =e= z2(i,j,t+cp)
"CP" would be a decision variable.

I was wondering if, is there any way to use a decision variable in the outer loop?

Regards
Abbas
User avatar
bussieck
Moderator
Moderator
Posts: 1042
Joined: 7 years ago

Re: Is it possible to use a decision variable as an outer loop (combination)

Post by bussieck »

Not sure what you mean by "use in outer loop". In the code you showed, CP can't be a variable. The compiler will complain. The issue is that this is not a mathematical program that a solver understand. What you can do (in case CP is the only variable) make CP an exogenous scalar and run for each CP values the optimization with a fixed CP. Since CP needs to be integer and is related to the set t you probably need card(t) optimization runs with fixed CP to find the optimal CP.

-Michael
abb.omidi
User
User
Posts: 39
Joined: 6 years ago

Re: Is it possible to use a decision variable as an outer loop (combination)

Post by abb.omidi »

Dear Dr. Bussieck,

Many thanks for your answer. The second paragraph you mentioned is exactly what we were looking for. Now, it is clear to us.

Best regards
Abbas
Post Reply