You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to solve a MIQCP with Bonmin. The problem has several quadratic constraints, but JuMP tells me that I can not use @constraint because
ERROR: LoadError: Solver does not support quadratic constraints
If I enter the quadratic expression "by hand", I can get it to work. Like so:
using JuMP, AmplNLWriter
m =Model(solver=AmplNLSolver("bonmin"))
@variable(m, a, Int)
@variable(m, b, Int)
@variable(m, s >=0 )
@variable(m, t >=0 )
@NLconstraint(m, 2*x+(a+b)*y >=0)
But I actually I have an array of linear forms in a and b, and I'd like to create many constraints from them.
My first try
M = [2 a-b; a+b 3]
v = [s t]
for j =1:2@NLconstraint(m, sum(M[i,j]*v[i] for i=1:2) ==0)
end
fails at the @NLconstraint: Unexpected object 2 in nonlinear expression. Ok, so I use the @NLexpression macro. This fails on the first line (same error).
M =@NLexpression(m, [i=1:2,j=1:2], [2 a-b; a+b 3][i,j])
v =@NLexpression(m, [i=1:2], [s t][i])
for j =1:2@NLconstraint(m, sum(M[i,j]*v[i] for i=1:2) ==0)
end
What am I doing wrong?
The text was updated successfully, but these errors were encountered:
(JuMP v18.5)
I am trying to solve a MIQCP with Bonmin. The problem has several quadratic constraints, but JuMP tells me that I can not use
@constraint
becauseIf I enter the quadratic expression "by hand", I can get it to work. Like so:
But I actually I have an array of linear forms in a and b, and I'd like to create many constraints from them.
My first try
fails at the @NLconstraint: Unexpected object 2 in nonlinear expression. Ok, so I use the @NLexpression macro. This fails on the first line (same error).
What am I doing wrong?
The text was updated successfully, but these errors were encountered: