I tried solving this problem enter image description here

Here is my cplex code

enter image description here

I have mentioned stored[month] as float+ but in the final result I get negative values. What is wrong with my model? enter image description here

  • 1
    $\begingroup$ Why in objective function you have $\rm demand \times 0.3$? Shouldn't be $\rm stored \times 0.3$? $\endgroup$
    – Mostafa
    Apr 15, 2020 at 11:37
  • 2
    $\begingroup$ In the future, please use code blocks rather than screenshots. It makes it much easier for us to read, and also for us to copy and paste into our own systems to test and debug your code. $\endgroup$ Apr 15, 2020 at 15:22

1 Answer 1


you get negative values because your model is relaxed by cplex since it is not feasible. You should debug it. Your

if (i==i)

looks very strange, I would change one i into 1

Plus to get help try to copy / paste code instead of screenshots

  • $\begingroup$ It was a mistake I changed it to if (i==1) , it worked , thanks $\endgroup$
    – 21vs
    Apr 15, 2020 at 11:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.