[ojAlgo-user] QuadraticSolver issue
Mathematics, linear algebra and optimisation
Brought to you by:
apete
From: Simon G. <si...@ya...> - 2011-06-10 18:29:25
|
Hello! I'm using the QuadraticSolver in ojAlgo. Solvingmin 1/2 [X]T[Q][X] - [C]T[X] when [AE][X] == [BE] and [AI][X] <= [BI] I'm having a problem. Can anyone help? In the equalities I state that the sum the variables must be = 1 (by making AE a row of 1's and BE=1). And in the inequalities I state that all variables must be between 0 and 1 (by making AI an Identity Matrix and AE a column vector of 1's, which along with the equalities restriction means none can go above 1 or below 0). Still, when I run solve(), the result follows that the sum of X is 1, however, sometimes there's negative Xi's... This is how I instance the solver: QuadraticExpressionsModel qem = new QuadraticExpressionsModel(VARIABLE); QuadraticSolver.Builder qdrtc_slvr_bldr = new QuadraticSolver.Builder(qem).objective(Q_ms, C_ms).equalities(AE_ms, BE_ms).inequalities(AI_ms, BI_ms); QuadraticSolver qdrtc_slvr = qdrtc_slvr_bldr.build(); when I call "qdrtc_slvr_bldr.getAI()" I get the matrix I inserted, so it seem like the object has all the matrices in place. Am I doing something wrong? Thanks in advance for any help! SG |