I have coded a facility layout problem as a MINLP model. Then, I used Baron as the default solver. In this model, constraint 19b determines the maximum distance between whole departments (DmaxF, a positive variable). Then, this variable is used on the right-hand sides of constraints 22a and 22b. When I run the model, I face an error called division by zero, which is related to constraints 22a and 22b.
But when I replace DmaxF with a constant, e.g., 40, in constraints 22a and 22b, the model solves the problem with no error. Surprisingly, the results show that DmaxF gets positive values (DmaxF <> 0).
Could you please help out? Note that I have attached a .gms file containing all information required for guidance!
Hi Amir
In equation 18b, you use the sqrt function and as Gams initializes variables to 0, you get an error.
If I initialize these variables with a random number, the model starts solving using BONMIN (I don’t have a license for DICOPT).
Hi Renger,
First of all, I have to appreciate your attention. As per as your valuable comment, I have added the following lines to the code (next to the place I had defined variables), but it does not work even now!
Hi
Here it is exactly the same problem: you did not initialize DmaxF, so add DmaxF.l(t) = 1; and it works.
You don’t need a loop for assigning values to x and y. As long as the index of the variables on the LHS is equal to the RHS in the assignment, without a loop the assignment works well.
Cheers
Renger
I also found another solution to this problem, specifically for the Baron solver. If you add the following code, the Baron could ignore the error and try to find a feasible solution. I think there should be similar options for other solvers as well. But what you mentioned, is a solution for all solvers! Thank you very much. My code works right now.