Re: [ojAlgo-user] QuadraticSolver issue
Mathematics, linear algebra and optimisation
Brought to you by:
apete
From: Anders P. <an...@op...> - 2011-06-10 20:45:15
|
Which constraint is violated with negative Xi's? BTW When/if you create the various matrices manually, the way you do, there is no need to (also) use QuadraticExpressionsModel. Alternative 1: QuadraticExpressionsModel qem = new QuadraticExpressionsModel(VARIABLE); qem.add...; qem.add...; OptimisationSolver qdrtc_slvr = qem.getDefaultSolver(); Alternative 2: QuadraticSolver.Builder qdrtc_slvr_bldr = new QuadraticSolver.Builder(Q_ms, C_ms).equalities(AE_ms, BE_ms).inequalities(AI_ms, BI_ms); QuadraticSolver qdrtc_slvr = qdrtc_slvr_bldr.build(); /Anders On 10 jun 2011, at 20.29, Simon Greaves wrote: > Hello! I'm using the QuadraticSolver in ojAlgo. Solving > min 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 > > ------------------------------------------------------------------------------ > EditLive Enterprise is the world's most technically advanced content > authoring tool. Experience the power of Track Changes, Inline Image > Editing and ensure content is compliant with Accessibility Checking. > http://p.sf.net/sfu/ephox-dev2dev_______________________________________________ > ojAlgo-user mailing list > ojA...@li... > https://lists.sourceforge.net/lists/listinfo/ojalgo-user |