# Tuning parameters

I need to solve a hard MIP model using Gurobi. There is a tool to set the best parameters combination to solve this problem called “Parameter Tunning”. How can I find parameter tuning using Julia?

Here, I present a simple example:

``````Random.seed!(2022)
T=10
alpha=rand(1:10,T)
beta=rand(1:10,T)
d=rand(50:100,T)
M=sum(d)
w=0.9999
modelo = Model(Gurobi.Optimizer)
set_optimizer_attribute(modelo, "seconds", 60.0)
#
@variable(modelo, x[i in 1:T] >=0)
@variable(modelo, y[i in 1:T], Bin)
@variable(modelo, e[i in 1:T] >=0)
#
@objective(modelo, Min, w*sum(alpha[j]*e[j] for j in 1:T) + (1-w)*sum(beta[j]*y[j] for j in 1:T))
#
@constraint(modelo,x[1] - e[1] == d[1])
@constraint(modelo,[j in 2:T],x[j] - e[j] + e[j-1] == d[j])
@constraint(modelo,[j in 1:T],x[j] <= M*y[j])
#
optimize!(modelo)
#
z1 = sum(alpha[j]*value(e[j]) for j in 1:T)
z2 = sum(beta[j]*value(y[j]) for j in 1:T)
Z = [z1;z2]
``````

The easiest way is probably to write the model to file with

``````write_to_file(modelo, "benchmark.mps")
``````

and then use:

2 Likes