Re: [ojAlgo-user] Negative weights in MarkowitzMarkowitz model when setShortingAllowed(false) and w
Mathematics, linear algebra and optimisation
Brought to you by:
apete
From: Anders P. <an...@op...> - 2013-10-21 20:24:33
|
Most likely there is no feasible solution. What does markowitzModel.getOptimisationState(); return? /Anders On 21 okt 2013, at 18:11, Anthony Edwards <ant...@al...> wrote: > Hi > > I was under the impression that if I create a MarkowitzModel, then set setShortingAllowed to false and setTargetReturn then the weights should always be positive or zero? > > MarkowitzModel markowitzModel = new MarkowitzModel(cvm, erm); > markowitzModel.setShortingAllowed(false); > markowitzModel.setTargetReturn(new BigDecimal(targetReturn)); > > > for (int i=0; i<er.length; i++) { > markowitzModel.setLowerLimit(i, new BigDecimal(minWgt[i])); > markowitzModel.setUpperLimit(i, new BigDecimal(maxWgt[i])); > > System.out.println("Limits["+i+"] --> "+minWgt[i]+" to "+maxWgt[i]); > } > > final List<BigDecimal> re = markowitzModel.getWeights(); > for (int nn = 0; nn < re.size(); nn++) { > //System.out.println( re.get(nn) ); > weights[nn] = re.get(nn).doubleValue(); > } > > This gives me some negative weights with my covariance (cvm) and expected returns (erm). > > Any idea what am I doing wrong? Ive tried all sorts of combinations but it doesnt seem to help. > > Interestingly, if I do setRiskAversion() instead of setTargetReturn() then the weight limits seem to be respected. > > Basically, I am trying to plot out the efficient frontier but calling the above for a rage of target returns ... > > Any help gratefully appraciated. > > Thanks > > Tony > ------------------------------------------------------------------------------ > October Webinars: Code for Performance > Free Intel webinars can help you accelerate application performance. > Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from > the latest Intel processors and coprocessors. See abstracts and register > > http://pubads.g.doubleclick.net/gampad/clk?id=60135031&iu=/4140/ostg.clktrk_______________________________________________ > ojAlgo-user mailing list > ojA...@li... > https://lists.sourceforge.net/lists/listinfo/ojalgo-user |