As you may know, Gurobi is a powerful solver for MIP formulations. In this post, I will briefly explain how to start simplex algorithm by using an initial solution.

Gurobi can read and write files in “.mst” format for loading/saving solutions. Suppose, you have a formulation and know a good solution for starting. In order to load the solution, you need to write your own .mst file. MST format is easy to handle; click here for reference. You need to start with hash sign (#) and list variable names and their values by placing a space between. Then you can use the following code in interactive shell:

gurobi> m=read(“yourmodelname.lp”)

gurobi> m.read(“yourmstfile.mst”)

gurobi> m.optimize()

Simple, isn’t it? You will see that your solution will be loaded as initial solution.

Now, suppose you have two formulations where only objective functions are different. Then, you can record solution of the first one in mst format. Here:

gurobi> m=read(“yourfirstmodel.lp”)

gurobi> m.optimize()

… stuff stuff

gurobi> m.write(“mymstfile.mst”)

gurobi> n=read(“yoursecondmodel.lp”)

gurobi> n.read(“mymstfile.mst”)

gurobi> n.optimize()

Well you can interrupt first model at any time by pressing Ctrl+C and can apply the same procedure.

Hope it helps, you can ask your questions.

### Like this:

Like Loading...

Yasaman(20:44:08) :Hi, thanks a lot for your helpful instructions. I set the format for mst file such as follows,

# Solution for model (null)

# Objective value = 109.17780

x 0

y 0

z 5

But I get the following error,

“Unknown variable ‘x’ in MIP start – ignored”

Can you help me?

Thanks,

Yasaman

Sertalp Bilal Cay(15:21:28) :Hi Yasaman,

I don’t have a working Gurobi version at the moment, but I advise you to post your question to OR-Exchange.