# How to set "variable hints" for Gurobi

**URL:** <https://discuss.ampl.com/t/how-to-set-variable-hints-for-gurobi/2045>\
**Category:** Support\
**Tags:** solvers, modeling\
**Created:** [January 30, 2025, 5:37pm UTC](https://discuss.ampl.com/t/how-to-set-variable-hints-for-gurobi/2045 "2025-01-30T17:37:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jkisse](https://avatars.discourse-cdn.com/v4/letter/j/53a042/32.png) [@jkisse](https://discuss.ampl.com/u/jkisse)\
**Post date:** [January 30, 2025, 5:37pm UTC](https://discuss.ampl.com/t/how-to-set-variable-hints-for-gurobi/2045/1 "2025-01-30T17:37:05Z")

</div>

Hi,  
I have a MIQCP-Problem that I want to solve with Gurobi 12. It is a pipeflow problem with a binary variable indicating the flow direction.  
I already know the likely direction of the flow, therefore I’d like to provide these values to Gurobi as [variable hints](https://docs.gurobi.com/projects/optimizer/en/current/reference/attributes/variable.html#varhintval). The variable hint values are read as parameters from an excel file.

Is it possible to set the variable hints in AMPL directly? I am using .run files, no API.

The advice from “Gurobot” ChatGPT was to use

```auto
# Assign hints to variables
let {i in I} x[i].hint := hint_value[i];

```

but it doesn’t work.

An alternative (also not working) suggestion was

```auto
for {i in I} {hint x[i] hint_value[i]};

```

Any hints would be much appreciated.

---

<div class="post-metadata">

**Author:** ![4er](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/4er/32/530_2.png) [@4er](https://discuss.ampl.com/u/4er)\
**Post date:** [January 30, 2025, 5:48pm UTC](https://discuss.ampl.com/t/how-to-set-variable-hints-for-gurobi/2045/2 "2025-01-30T17:48:07Z")

</div>

To specify hints, you can use the `mip:start` option described in our [Gurobi Options](https://dev.ampl.com/solvers/gurobi/options.html) listing.
