Re: [ojAlgo-user] Report A Bug Of ojalgo finace library
Mathematics, linear algebra and optimisation
Brought to you by:
apete
From: Anders P. <an...@op...> - 2017-05-14 09:51:22
|
I identified the problem and have a fix. Will check in the code changes in a day or two, and most likely upload a new release within a couple of weeks. /Anders > On 8 May 2017, at 14:20, lvz...@gt... wrote: > > > Hi, > I have a problem when calculate best invest group by using markowitzModel in ojalgo with code below(for test); > > > > > for(int j = 0; j < 100; j ++) > { Builder<PrimitiveMatrix> tmpBuilder = PrimitiveMatrix.FACTORY.getBuilder(2, 2); > tmpBuilder.add(0, 0, 0.040000); > tmpBuilder.add(0, 1, 0.1000); > tmpBuilder.add(1, 0, 0.1000); > tmpBuilder.add(1, 1, 0.250000); > BasicMatrix covariances = tmpBuilder.build(); > tmpBuilder = PrimitiveMatrix.FACTORY.getBuilder(2); > tmpBuilder.add(0, 0.20000); > tmpBuilder.add(1, 0.40000); > BasicMatrix expectedExcessReturns = tmpBuilder.build(); > > MarketEquilibrium equilibrium = new MarketEquilibrium(covariances); > MarkowitzModel markowitzModel = new MarkowitzModel(equilibrium, expectedExcessReturns); > markowitzModel.setShortingAllowed(false); > // markowitzModel.optimiser().validate(true); > markowitzModel.setTargetReturn(new BigDecimal(0.2 + (0.002 * j))); > for (int i = 0; i < 2; i++) { > markowitzModel.setLowerLimit(i, new BigDecimal(0.00000)); > markowitzModel.setUpperLimit(i, new BigDecimal(1.00000)); > } > System.out.println(0.2 + (0.002 * j) + "," + markowitzModel.getReturnVariance() + " , " + markowitzModel.getMeanReturn() + "," + markowitzModel.getWeights()); > > > } > > > when TargetReturn equal to 0.206,Variance equal to 0.04 , weights equal to [1.0, 0.0] > when TargetReturn equal to 0.208, Variance equal to 0.25,weights equal to [0.0, 1.0] > Below Relationship of TargetReturn And Target Variance(Y-Axis TargetReturn,X-AXis standard deviation) > > > > 吕子锋 > > <1.jpg>------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot_______________________________________________ > ojAlgo-user mailing list > ojA...@li... > https://lists.sourceforge.net/lists/listinfo/ojalgo-user |