solve(m)
print(m.colVal)

That gives me this, which I believe is the right answer. Note that you 
included a space between `solve` and `(m)`, which is not recommended.

2-element Array{Float64,1}:
 0.0
 0.0


On Friday, April 1, 2016 at 4:03:30 AM UTC-7, tann...@gmail.com wrote:
>
> Hello to every one,
>
> Any one can tell me the code given below is not giving the optimal 
> solution .it gives the just range of x1 and x2. I want to calculate optimal 
> value of the function. Thank you for your time.
>
> Best Regards,
> Tanveer Iqbal
>
> using JuMP
> using Ipopt
> m = Model(solver = IpoptSolver())
>
> @defVar(m, 0 <= x1 <=3)
> @defVar(m, 0 <= x2 <=7)
>
> @addNLConstraint(m, x1+2x2 <=8)
> @addNLConstraint(m, 2x1 + x2 <= 10)
> @addNLConstraint(m,  x2 <= 3)
>
> @setNLObjective(m, Min, (x1)^2 +2(x2)^2 + 2(x1)+ 3(x2))
>
> solve (m)
>
> print(m)
>

Reply via email to