Search code examples
matlabgurobiampl

How can we see the MIP log when calling AMPL from Matlab and using Gurobi as solver?


Does anyone know how can I print the MIP logging on Matlab when calling AMPL from it? I'm using Gurobi as solver.

My Matlab code do:

system(['ampl.exe ' modelName.run]);

The modelName.run file has the AMPL code and calls Gurobi:

model model.md;
data input.dat;
option solver gurobi;
problem oampl: fo, constraints;
solve oampl;

The model.md has the objective function (fo) and the constraints.

I would like to see the log progress (initial solution, nodes, iterations, bounds etc.) of the MILP resolution process on Matlab. Should I do some parameter setting on Matlab or on AMPL? Or it can't be done?


Solution

  • When using Gurobi via AMPL the logging is turned off by default, you can turn it on with the following option:

    option gurobi_options 'outlev 1' ;
    

    More Details about the AMPL-Gurobi options can be found here: http://www.gurobi.com/documentation/7.0/ampl-gurobi/parameters.html