# \[AMPL 25071\] Variable declared as Integer/ Results is fractional

**URL:** <https://discuss.ampl.com/t/ampl-25071-variable-declared-as-integer-results-is-fractional/2003>\
**Category:** Google Group Mirror\
**Created:** [December 9, 2024, 3:17pm UTC](https://discuss.ampl.com/t/ampl-25071-variable-declared-as-integer-results-is-fractional/2003 "2024-12-09T15:17:38Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:** [December 11, 2024, 2:47pm UTC](https://discuss.ampl.com/t/ampl-25071-variable-declared-as-integer-results-is-fractional/2003/2 "2024-12-11T14:47:39Z")

</div>

I see just one integer variable in your model:

```auto
var CVE integer >= 0;

```

But when I solve your problem using `include Computercafee_2024_12_09.run;` the value of CVE in the results is integer:

```auto
ampl: include Computercafee_2024_12_09.run;
........
Gurobi 12.0.0: optimal solution; objective 51263455.89
3121 simplex iterations
3 branching nodes
.......
ampl: option display_precision 0;
ampl: display CVE;
CVE = 4

```

(By setting `option display_precision 0;` I am asking `display` to use the maximum precision possible, to be sure the result value is exactly 4.)

I also get this result with Gurobi version 11, though it uses a different algorithm.

The integer variable can be relaxed by use of the `.relax` suffix, like this:

```auto
let CVE.relax := 1;
solve;

```

Then `CVE` has a fractional result value, and the maximal objective value is higher:

```auto
Gurobi 12.0.0: optimal solution; objective 51440779.46
5172 simplex iterations
3 branching nodes
.......
ampl: option display_precision 0;
ampl: display CVE;
CVE = 4.339090190246878

```

Can you post an example (including the files) where `CVE` is supposed to be integer, but it is fractional in the result?

---

_[View the full topic](https://discuss.ampl.com/t/ampl-25071-variable-declared-as-integer-results-is-fractional/2003)._
