How to model dividing parameter by variable? Topic is solved

Problems with modeling
Post Reply
dunyayigezerken
User
User
Posts: 29
Joined: 5 years ago

How to model dividing parameter by variable?

Post by dunyayigezerken »

Code: Select all

a(i) =e= b(i) + (parameter1 / parameter2 * var1)
I tried to define this with a parameter that represent an interval what I need for example

Code: Select all

parameter interval(ch)/
1...0.8
2...0.82
3...0.84
........
20...1
Then;

I define a binary variable c(i,ch) which assigns each i to a ch in the interval parameter. after that I changed the equality constraint to include c(i,ch) into the constraint to use "ch".
I transformed and defined it like that

Code: Select all

c1(i,ch)..
a(i,ch) =g= b(i) + (parameter1 / parameter2 * interval(ch)) - (1-spd(i,ch))*m;

c2(i,ch)..
a(i,ch) =l= b(i) + (parameter1 / parameter2 * interval(ch)) + (1-spd(i,ch))*m;

c3(i)..
sum(ch, spd(i,ch))=e=1;


So, I will be controlling effect of parameter2 with choosable interval parameter by respecting to constraint 3.

But, when it is working gap score shows always 100% but best integer is decreasing.

I could not find what I missed, but to sum up, I want to control the effect of parameter2 by multplying it with a variable that constrained as greater than 0.8. But, when I do it, it errors as dividing by a variable.

Thanks for any advise,
abhosekar
Moderator
Moderator
Posts: 295
Joined: 3 years ago

Re: How to model dividing parameter by variable?

Post by abhosekar »

The code that you showed does not 'divide' parameter by a variable. In the term "parameter1/parameter2 *var1", var1 is not in the denominator. You should change it to something like following:

Code: Select all

a(i) =e= b(i) + (parameter1 / (parameter2 * var1))
Hope this helps.

- Atharv
Post Reply