[i

mg][/img]

I am trying to code this in gams, but I could not correct all the errors if anyone can help me, please.

A model you should be able to do after reading a GAMS Tutorial (e.g. https://www.gams.com/latest/docs/UG_Tutorial.html). Why don’t you share your model and then we can give you specific help.

-Michael

MILP.gms (3.56 KB)

This is how far I could code the model.

I think the problem is in the limited Sum and ln sample.

i and j in the math go from 1 to n. You have j /1*7/ and i /1*40/. What is n? -Michael

I think I have to set it according to my case study, which is N= 10, K =15

How can I form it, and where?

also, i should be assigned to J as j contains several i . and K is where i is located

also, i should be assigned to J as j contains several i . and K is where i is located

I don’t know what this means. Also your code has data for n=6 and K=5. Not sure where you get N=10 and K=15. Perhaps you have other data. The math is super straight forward. You made many mistakes. What is xl in you code? The math clear says x(i,j) <= x(j,j) why do x(i,j) <= xl(j,j)??? Why make h and u semiCont variables? In the math they are just positive variables. The math does not say what m_i is. Do you know? If this is a linear model, then this needs to be data, what data??? Constraint 8 and 10 do not hold for k=1, you did not take care of this at all. Why did you name all the GAMS constraints different from the math? Math constraint 8 is co_6 in GAMS. Make it extra hard to match the algebra? Don’t put extra parenthesis where they are not needed, GAMS and math have the same operator bindings. GAMS needs explicit operators so Ln(1-c_j) in math is L*n*(1-c(j)) in GAMS. GAMS does not do ranged constraints. So you need to split (11) in eq11a and eq11b.

-Michael