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-09 20:35:08
|
UNEXPLORED would mean the optimisation has not been executed (since you last modified the model). How did you get that?
/Anders
> On 9 May 2017, at 17:15, yifa wang <fag...@ho...> wrote:
>
> hi,
>
> I try to use ojalgo to do a portfolio optimization. The target is find an efficient frontier for 15 securities or more. I generate random returns for simulation. However, when I run the program, I get the state as "UNEXPLORED". Usually, we get OPTIMAL. What does this mean? Is it possible to get the optimal weight for more than 50 securities?
>
> Thanks.
> Jerry
>
>
>
>
> 发件人: lvz...@gt... <lvz...@gt...>
> 发送时间: 2017年5月8日 下午 8:20:21
> 收件人: oja...@li...
> 主题: [ojAlgo-user] Report A Bug Of ojalgo finace library
>
>
> 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)
>
>
>
> 吕子锋
>
> ------------------------------------------------------------------------------
> 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
|