## How to tune the parameter of CPLEX for solving large MIP problem

Problems with syntax of GAMS
sam_Hab
User
Posts: 10
Joined: 11 months ago

### How to tune the parameter of CPLEX for solving large MIP problem

Hello everyone,

I want to know how to use CPLEX automatic tuning tool, I found the parameters to use https://www.gams.com/latest/docs/S_CPLE ... ngSHORTDOC, but I am not sure how to use them.
I have tried the following code but I cannot find the output file for the parameters that CPLEX automatic tuning tool found

Code: Select all

`````` Sets i products / i0*i55 /
j suppliers / j0*j55  /
t time periods / t0*t55 /
sub_j(j)   dynamic subset for j
sub_t(t)   dynamic subset for t
sub_i(i)   dynamic subset for i ;

Alias ( k , t ) ;
Parameter D( i , t ) demand of product ;
Parameter C( i , j ) porduction capacity ;
Parameter P( i , j ) purchase price ( \$ per unit );
Parameter H( i ) product-dependent holding cost ( \$ per unit )  ;
Parameter O( j ) supplier-dependent ordering cost ( \$ per unit ) ;

Variables x ( i , j , t )
y ( j , t )
R( i , t )
cost ;
Positive Variables x ,R;
Binary Variable y ;
Equations obj objective function
con1 ( i , t )
con2 ( i , j , t ) feasibility constraint

obj ..
cost =E= sum ( ( sub_i(i) , sub_j(j) , sub_t(t) ) ,P( i , j )* x ( i , j , t ))+sum ( ( sub_j(j) , sub_t(t) ) ,O( j )* y ( j , t ) )
+ sum ( ( sub_i(i) , sub_t(t) ) ,H( i ) * ( sum ( k\$ ( ord ( t ) GE ord ( k ) ) , sum ( sub_j(j) , x ( i , j , k))-D( i , k ) ) ) ) ;

con1 ( sub_i(i) , sub_t(t) ) .. R( i , t ) =E= sum ( k\$ ( ord ( t ) GE ord ( k ) ) , sum ( sub_j(j) , x ( i , j , k))-D( i , k ) ) ;

con2 ( sub_i(i) , sub_j(j) , sub_t(t) ) .. C( i , j )* y ( j , t ) - x ( i , j , t ) =G= 0 ;

display "---------------------formulation ----------------------";
File fopt / cplex.opt /;

\$onEcho > cplex.op3
tuning 'cplex.op2'
tuningdettilim 1000000
\$offEcho

putClose fopt;
option optcr =0;
option limrow =0;
option limcol =0;
option reslim =1800;

Model mymodel /all/;

option savepoint = 6;
Scalar cpxOptFile;

put_utility 'gdxin' / 'path\data.gdx';
execute_load D, P, C, H, O, Pr, sub_i, sub_j,sub_t;
mymodel .optFile = 3;
Solve mymodel minimizing cost using mip ;

``````
Any help would be appreciated,
Thanks

bussieck
Moderator
Posts: 330
Joined: 2 years ago

### Re: How to tune the parameter of CPLEX for solving large MIP problem

The file GAMS/Cplex creates is called 'cplex.op2' including the ticks ('). Remove the ticks in the option to create the file normally, i.e. tuning cplex.op2. You will find the file in the project directory (IDE) or directory where the main GAMS file resides (Studio). There are cases where the default is the best and the tuned option file will be empty. In this case you find in the log:

Code: Select all

``````Default test: Deterministic time = 0.47 ticks
Best test: 'defaults'  Deterministic time = 0.47 ticks
``````
-Michael