I'm somewhat new to GAMS, and totally new to this forum,

I was hoping that someone could help me to understand why my model "All13" gives a solution that differs from my model "max7" (attached). I hoped that the model All13 (obj= 26,608,552) would give the minimum cost over all combinations. However, when running some scenarios, I observed that does not happen. As exemplified in by model max7 (obj= 25,415,487), where I find a lower cost than in All13.

The model aims to minimize total cost considering transportation cost and capital investment. It decides the supply configuration, plant locations and the capacity of each plant. Could someone please help me to improve "all13"? or help me to understand why it does not minimize the total cost?

Thank you so much,

Luana

## MIP - CPLEX solver does not give optimal solution in a facility location problem

### Re: MIP - CPLEX solver does not give optimal solution in a facility location problem

Before digging deeper, have you set optCR to 0 as described here https://www.gams.com/latest/docs/UG_Lan ... ntProblems?

-Michael

-Michael

### Re: MIP - CPLEX solver does not give optimal solution in a facility location problem

Hi Michael,

Thank you for your suggestion. Yes, I have tried it before, and the result is the same as without "scaleopt = 0".

It seems that my model is first minimizing the transportation cost, and when that is set, it calculates the capital investment. Which is not what it should do, and I can't figure out why it is not minimizing both.

Thank you again, and if you have more suggestions please share. Highly appreciated.

Luana

Thank you for your suggestion. Yes, I have tried it before, and the result is the same as without "scaleopt = 0".

It seems that my model is first minimizing the transportation cost, and when that is set, it calculates the capital investment. Which is not what it should do, and I can't figure out why it is not minimizing both.

Thank you again, and if you have more suggestions please share. Highly appreciated.

Luana

### Re: MIP - CPLEX solver does not give optimal solution in a facility location problem

I said optCR (not scaleOpt)! If I set optCR to 0 both models return the same objective:

max7:
all13:
Just add "option optcr=0;" in front of the solve statement!

-Michael

max7:

Code: Select all

```
Proven optimal solution.
MIP Solution: 25415486.875000 (55 iterations, 0 nodes)
Final Solve: 25415486.875000 (20 iterations)
Best possible: 25415486.875000
Absolute gap: 0.000000
Relative gap: 0.000000
```

Code: Select all

```
Proven optimal solution.
MIP Solution: 25415486.875000 (55 iterations, 0 nodes)
Final Solve: 25415486.875000 (20 iterations)
Best possible: 25415486.875000
Absolute gap: 0.000000
Relative gap: 0.000000
```

-Michael

### Re: MIP - CPLEX solver does not give optimal solution in a facility location problem

Michael,

First, I'm sorry for not reading your message with the proper attention; second, thank you for being so nice and patient,

It was the default tolerance that was returning a suboptimal value.

Thank you so much, you saved my day!

First, I'm sorry for not reading your message with the proper attention; second, thank you for being so nice and patient,

It was the default tolerance that was returning a suboptimal value.

Thank you so much, you saved my day!