Hide navigation sidebar
Hide table of contents sidebar
Back to top
Toggle table of contents sidebar

# Change parameters

Examples

batchmode, callback, fixanddive, gc_pwl_func, lp, lpmethod, mip2, multiscenario, params, sensitivity, workforce_batchmode

This section illustrates the use of Gurobi parameters. Example params reads a MIP model from a file, then solves the model using four different values of the MIPFocus parameter, running for five seconds per value (MIPFocus chooses the high-level strategy that the MIP solver uses to solve the problem). It then chooses the parameter value that produced the smallest MIP gap, and continues solving the model until it achieves optimality.

The mechanics of setting a parameter are quite simple. To set the MIPFocus parameter in different APIs, do the following:

    error = GRBsetintparam(modelenv, "MIPFocus", i);
    if (error) goto QUIT;

    m->set(GRB_IntParam_MIPFocus, i);

    m.Parameters.MIPFocus = i;

    m.set(GRB.IntParam.MIPFocus, i);

    m.Params.MIPFocus = i

    m.Parameters.MIPFocus = i

Note

We should add one quick comment about how parameter settings propagate between different models. When we set the TimeLimit parameter on a model, then make a copy of that model, the parameter setting is carried over to the copy. When we set the MIPFocus parameter on the copy, that parameter change has no effect on the other copies, nor on the original model.

Help and Feedback

Press `/` or click to search this documentation | Gurobi website | Gurobi community forum
Go to other Gurobi documentation | Gurobi download | Contact support