Reputation: 25
I have got such an optimization problem:
min a * x1^2 + b * x2^2 + c*x3^2 + d * x1*x2 + e * x1*x3 + f * x2*x3
s.t.
x1 + x2 + x3 + x4 = 1
x1, x2, x3, x4 >= 0
where a,b,c,d,e,f are given double type numbers
Could you help me to solve it using a Java library (for example JOptimizer)? I have been trying to find something proper recently, but I didn't manage..
Upvotes: 2
Views: 1168
Reputation: 26
Take a look at the first example shown at http://www.joptimizer.com/quadraticProgramming.html.
Your P matrix is:
P={{a, d/2, e/2, 0},{d/2, b, f/2, 0},{e/2, f/2, c, 0},{0, 0, 0, 1}}
And the following is almost the same as in the example. PS: in order to have a convex problem the P matrix must be positive, that is:
(c d^2)/4 - (b e^2)/4 + (d e f)/4 - (a f^2)/4 > 0
Upvotes: 1