### Migrating from XPRESS™ includes:

- Building the model
- Setting Solver Parameters
- Computing and Extracting the Solution

In addition, you can also see a list of code examples, across a range of programming languages, on our code examples page.

Language | Command |
---|---|

C | int ind[ ] = {1, 3, 4}; double val[ ] = {1.0, 2.0, 1.0}; error = GRBaddconstr(model, 3, ind, val, GRB_EQUAL, 1.0, "New"); |

C++ | model.addConstr(x + y + 2*z <= 2); |

C# | model.AddConstr(x + y + 2*z <= 2); |

Python | model.addConstr(x + y + 2*z <= 2) |

You can also build linear expression (GRBExpr) objects, add linear terms to these expressions (expr.addTerm()), and then add constraints using these expressions. In Java:

**GRBLinExpr expr = new GRBLinExpr(); **

**expr.addTerm(1.0, x); expr.addTerm(1.0, y); expr.addTerm(2.0, z); **

**model.addConstr(expr, GRB.LESS_EQUAL, 2.0);**

Your model might contain other constraint types, including Special Ordered Set (SOS) constraints or quadratic constraints. The Gurobi interface contains routines that are quite similar to those in the Xpress interface for each of these. We encourage you to browse our examples for details.

### Setting solver parameters

When migrating an optimization model from XPRESS to Gurobi, you may need to set certain Gurobi parameters to match the parameters you have modified in XPRESS. One important point we’d like to make is that you shouldn’t assume that you’ll need to find a matching Gurobi parameter for every XPRESS parameter you’ve changed. Gurobi and XPRESS use different strategies and algorithms. Gurobi strategy tuning may differ from the XPRESS tuning you’ve done, and often it may not be necessary at all. We recommend that you start with default settings, and only change parameters when you observe specific behavior that you’d like to modify. The following table gives a high-level mapping for the most commonly used XPRESS parameters:

XPRESS parameter (C API) | Gurobi Parameter |
---|---|

BARCRASH | Crossover |

BARGAPSTOP | BarConvTol |

COVERCUTS | CoverCuts |

CROSSOVER | Crossover |

CUTSTRATEGY | Cuts |

DEFAULTALG | Method |

DUALIZE | PreDual |

HEURSEARCHEFFORT | Heuristics |

MAXTIME | TimeLimit |

MIPABSSTOP | MIPGapAbs |

MIPRELSTOP | MIPGap |

MIPTOL | IntFeasTol |

OPTIMALITYTOL | OptimalityTol |

PRESOLVE | Presolve |

THREADS | Threads |

### Contact Us

We’re happy to assist you. Please contact us using this form, and a Gurobi representative will get back to you shortly.

- Free Consultations
- General Inquiries
- Gurobi Optimizer Questions

Can’t view the form? Please email us at sales@gurobi.com.