Dear all,

I am trying to use bratio in my model to pass the basis as a starting point of another model.

In this GAMS mode (https://drive.google.com/file/d/1wad9qO ... sp=sharing), I am trying to solve the first part of the model comprising of the obj fn, c1, c2 and c3 constraints. In the second part, I am trying to use the basis obtained from the first part to solve the problem with little or no computational effort. The second part of the model comprises of the objective function and constraints c4, c5 and c6 (These constraints are similar to c1, c2 and c3 but with a slightly changed RHS).

But, I see that both the parts of the problem take 3 iterations to solve which shouldn't be happening as per my assumption.

Am I understanding something wrong here?

## Usage of bratio in GAMS/CPLEX to pass the optimal basis of one model to the other

### Re: Usage of bratio in GAMS/CPLEX to pass the optimal basis of one model to the other

Hi

How do you know that it should solve in three iterations? Everything looks fine.

Cheers

Renger

How do you know that it should solve in three iterations? Everything looks fine.

Cheers

Renger

____________________________________

Enjoy modeling even more: Read my blog on modeling at The lazy economist

Enjoy modeling even more: Read my blog on modeling at The lazy economist

### Re: Usage of bratio in GAMS/CPLEX to pass the optimal basis of one model to the other

Hello Renger,

I checked the ITERATION COUNT in the lst file. It was 3 for both parts. Am I understanding this correctly?

Kindly let me know.

Thank you.

I checked the ITERATION COUNT in the lst file. It was 3 for both parts. Am I understanding this correctly?

Kindly let me know.

Thank you.

### Re: Usage of bratio in GAMS/CPLEX to pass the optimal basis of one model to the other

yes, that is correct, but might be this coincidence that they both solve in 3 iterations.

R

R

____________________________________

Enjoy modeling even more: Read my blog on modeling at The lazy economist

Enjoy modeling even more: Read my blog on modeling at The lazy economist

### Re: Usage of bratio in GAMS/CPLEX to pass the optimal basis of one model to the other

Hello Renger,

Thank you so much for your reply.

I want to mention here that constraints 1, 2 and 3 were the original model and I did the sensitivity analysis on this model to find the ranges within which if I change the RHS of the constraints, the model will have the same basis. I applied the 100% rule and changed the RHS of the three constraints to ensure that the model remained in the same basis.

That's the reason when I passed the basis using 'bratio' from the first part of the model to the other, I expected the second part to solve in one iteration only. This is also the reason I thought that I hadn't used 'bratio' correctly.

Does this sound logical to you?

Thank you!

Thank you so much for your reply.

I want to mention here that constraints 1, 2 and 3 were the original model and I did the sensitivity analysis on this model to find the ranges within which if I change the RHS of the constraints, the model will have the same basis. I applied the 100% rule and changed the RHS of the three constraints to ensure that the model remained in the same basis.

That's the reason when I passed the basis using 'bratio' from the first part of the model to the other, I expected the second part to solve in one iteration only. This is also the reason I thought that I hadn't used 'bratio' correctly.

Does this sound logical to you?

Thank you!

### Re: Usage of bratio in GAMS/CPLEX to pass the optimal basis of one model to the other

Nia,

Basis information is stored not only in GAMS variables but also in GAMS equations. For example, if you resolve the same model, it uses 0 iterations. Here's some code to do that:

Instead of creating new equations, try adjusting the equations you have to use scalars, e.g.

and then change the rhs values between the solve statements.

Alternatively, you could assign the .m values for the constraints from the old model to the new one but that is not really the GAMS way in this case.

All of this would be easier if you indexed things by a row set i and a column set j.

-Steve

Basis information is stored not only in GAMS variables but also in GAMS equations. For example, if you resolve the same model, it uses 0 iterations. Here's some code to do that:

Code: Select all

```
Solve ex1 using LP maximizing z;
file log /''/; put log;
putclose ' ' / 'Iterations: ', ex1.iterusd / ' ' /;
Solve ex1 using LP maximizing z;
putclose ' ' / 'Iterations: ', ex1.iterusd / ' ' /;
```

Code: Select all

```
c1.. 0.8*x1 + 0.44*x2 =l= rhs1;
```

Alternatively, you could assign the .m values for the constraints from the old model to the new one but that is not really the GAMS way in this case.

All of this would be easier if you indexed things by a row set i and a column set j.

-Steve