# Simple "coin" example will not work with JuMP + Gurobi

**URL:** <https://discourse.julialang.org/t/simple-coin-example-will-not-work-with-jump-gurobi/4629>\
**Category:** Optimization (Mathematical)\
**Tags:** question, jump\
**Created:** [July 3, 2017, 8:26pm UTC](https://discourse.julialang.org/t/simple-coin-example-will-not-work-with-jump-gurobi/4629 "2017-07-03T20:26:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mbeltagy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbeltagy/32/130_2.png) [@mbeltagy](https://discourse.julialang.org/u/mbeltagy)\
**Post date:** [July 3, 2017, 8:26pm UTC](https://discourse.julialang.org/t/simple-coin-example-will-not-work-with-jump-gurobi/4629/1 "2017-07-03T20:26:34Z")

</div>

This model is a simple introductory example in Gurobi, that seems unsolvable with JuMP + Gurobi

The model itself is typical found in a Gurobi installation at ` /opt/gurobi702/linux64/examples/data/coins.lp`. Running `gurobi_cl` on this file yields a feasible solution. Yet when called from `JuMP`, it returns `:InfeasibleOrUnbounded`.

```julia
using JuMP, Gurobi

m=Model(solver=GurobiSolver())

@variables m begin
    Pennies, Int
    Nickels, Int
    Dimes, Int 
    Quarters, Int
    Dollars, Int
    Cu <= 1000
    Ni <= 50
    Zi <= 50
    Mn <= 50
end

@constraints m begin
    Copper, .06Pennies + 3.8Nickels + 2.1Dimes + 5.2Quarters +7.2Dollars - Cu == 0
    Nickel, 1.2Nickels + .2Dimes + .5Quarters + .2Dollars - Ni == 0
    Zinc, 2.4Pennies +.5Dollars - Zi == 0
    Manganese, .3Dollars - Mn == 0
end

@objective(m, Max, .01Pennies + .05Nickels + .1Dimes + .25Quarters + 1Dollars )

status=solve(m)

```

I would have expected this simple model to work. Not sure where I might have gone wrong here.

When I print the model it appears pretty sound and should be solvable

```julia
julia> print(m)
Max 0.01 Pennies + 0.05 Nickels + 0.1 Dimes + 0.25 Quarters + Dollars
Subject to
 0.06 Pennies + 3.8 Nickels + 2.1 Dimes + 5.2 Quarters + 7.2 Dollars - Cu = 0
 1.2 Nickels + 0.2 Dimes + 0.5 Quarters + 0.2 Dollars - Ni = 0
 2.4 Pennies + 0.5 Dollars - Zi = 0
 0.3 Dollars - Mn = 0
 Pennies, integer
 Nickels, integer
 Dimes, integer
 Quarters, integer
 Dollars, integer
 Cu ≤ 1000
 Ni ≤ 50
 Zi ≤ 50
 Mn ≤ 50

```

The optimal solution from `gurobi_cl` is

```julia
# Objective value = 113.45
Pennies 0
Nickels 0
Dimes 2
Quarters 53
Dollars 100
Cu 999.8
Ni 46.9
Zi 50
Mn 30

```

---

<div class="post-metadata">

**Author:** ![joehuchette](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joehuchette/32/32_2.png) [@joehuchette](https://discourse.julialang.org/u/joehuchette)\
**Post date:** [July 3, 2017, 9:03pm UTC](https://discourse.julialang.org/t/simple-coin-example-will-not-work-with-jump-gurobi/4629/2 "2017-07-03T21:03:38Z")

</div>

The .lp file format takes “integer” variables to mean [non-negative integers](http://lpsolve.sourceforge.net/5.5/integer.htm), while in JuMP “integer” means any integer. If you add lower bounds of zero on your coin type variables, your model will work as you expect.
