Re: [ojAlgo-user] QuadraticSolver issue
Mathematics, linear algebra and optimisation
Brought to you by:
apete
From: Simon G. <si...@ya...> - 2011-06-14 21:33:20
|
Yes, I have to finish the lower bounds, that part I'm not worried about. But I don't understand, I must be doing something different from how you did it, because I get: X class org.ojalgo.matrix.PrimitiveMatrix {{1.000000000000013}, {3.2333333333333143}, {-3.233333333333325}} This is how I get X: Result rslt = qdrtc_slvr.solve(); BasicMatrix rslt_mtrx = rslt.getSolution(); PhysicalStore<Double> result = rslt_mtrx.toPrimitiveStore(); System.out.println("\nX " + rslt_mtrx.toString()); I this correct? Thanks again for all your help by the way! SG ________________________________ From: Anders Peterson <an...@op...> To: oja...@li... Sent: Tue, June 14, 2011 4:34:59 PM Subject: Re: [ojAlgo-user] QuadraticSolver issue Here's what I get: [AE] = class org.ojalgo.matrix.PrimitiveMatrix {{1.0, 1.0, 1.0}} [BE] = class org.ojalgo.matrix.PrimitiveMatrix {{1.0}} [Q] = class org.ojalgo.matrix.PrimitiveMatrix {{4.0, 1.0, 2.0}, {1.0, 9.0, 1.0}, {2.0, 1.0, 16.0}} [C] = class org.ojalgo.matrix.PrimitiveMatrix {{10.0}, {15.0}, {18.0}} [AI] = class org.ojalgo.matrix.PrimitiveMatrix {{1.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, {0.0, 0.0, 1.0}} [BI] = class org.ojalgo.matrix.PrimitiveMatrix {{1.0}, {1.0}, {1.0}} [X] = class org.ojalgo.matrix.PrimitiveMatrix {{-0.17441860465116266}, {0.6279069767441859}, {0.5465116279069767}} [LE] = class org.ojalgo.matrix.PrimitiveMatrix {{8.976744186046512}} [LI] = class org.ojalgo.matrix.PrimitiveMatrix {{0.0}, {0.0}, {0.0}} [SE] = class org.ojalgo.matrix.PrimitiveMatrix {{0.0}} [SI] = class org.ojalgo.matrix.PrimitiveMatrix {{1.1744186046511627}, {0.37209302325581406}, {0.4534883720930233}} I do not get any weights larger than 1.0, but I do get one weight smaller than 0.0. There's no constraint to restrict that! Add constraints for that and you should get the solutions you expect. Here's how I would find the efficient frontier: final BasicMatrix tmpCovars = ...; final BasicMatrix tmpReturs = ...; final MarketEquilibrium tmpME = new MarketEquilibrium(tmpCovars); final MarkowitzModel tmpMarkowitz = new MarkowitzModel(tmpME, tmpReturs); for (int i = 1; i < 10; i++) { // Some different risk aversion factors tmpMarkowitz.setRiskAversion(new BigDecimal(i)); final List<BigDecimal> tmpWeights = tmpMarkowitz.getWeights(); } |