ojalgo-user Mailing List for oj! Algorithms (Page 11)
Mathematics, linear algebra and optimisation
Brought to you by:
apete
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
|
Feb
(1) |
Mar
|
Apr
(14) |
May
(1) |
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
(1) |
2005 |
Jan
(3) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
(1) |
Sep
(3) |
Oct
|
Nov
|
Dec
(1) |
2006 |
Jan
(1) |
Feb
(1) |
Mar
(1) |
Apr
|
May
(1) |
Jun
(2) |
Jul
|
Aug
(5) |
Sep
|
Oct
(3) |
Nov
(4) |
Dec
(2) |
2007 |
Jan
(8) |
Feb
(1) |
Mar
(2) |
Apr
(11) |
May
(6) |
Jun
|
Jul
(10) |
Aug
(2) |
Sep
|
Oct
(4) |
Nov
|
Dec
(11) |
2008 |
Jan
(22) |
Feb
(4) |
Mar
(2) |
Apr
(4) |
May
(2) |
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
(6) |
Nov
(17) |
Dec
(5) |
2009 |
Jan
(15) |
Feb
(2) |
Mar
(2) |
Apr
(3) |
May
(4) |
Jun
(5) |
Jul
(9) |
Aug
(2) |
Sep
|
Oct
(5) |
Nov
(14) |
Dec
|
2010 |
Jan
(3) |
Feb
(5) |
Mar
(2) |
Apr
(19) |
May
|
Jun
|
Jul
|
Aug
(2) |
Sep
|
Oct
(5) |
Nov
(3) |
Dec
|
2011 |
Jan
|
Feb
(1) |
Mar
(7) |
Apr
(10) |
May
(1) |
Jun
(15) |
Jul
(1) |
Aug
|
Sep
|
Oct
(13) |
Nov
(9) |
Dec
(11) |
2012 |
Jan
|
Feb
(1) |
Mar
(9) |
Apr
(23) |
May
(16) |
Jun
(9) |
Jul
(13) |
Aug
|
Sep
(4) |
Oct
(1) |
Nov
(1) |
Dec
|
2013 |
Jan
|
Feb
(12) |
Mar
(7) |
Apr
(24) |
May
|
Jun
(7) |
Jul
(4) |
Aug
|
Sep
(3) |
Oct
(16) |
Nov
(7) |
Dec
(3) |
2014 |
Jan
(22) |
Feb
(1) |
Mar
(1) |
Apr
|
May
(2) |
Jun
(3) |
Jul
(4) |
Aug
(4) |
Sep
(1) |
Oct
(2) |
Nov
(6) |
Dec
(2) |
2015 |
Jan
(11) |
Feb
(10) |
Mar
(1) |
Apr
(9) |
May
|
Jun
|
Jul
(1) |
Aug
(4) |
Sep
(6) |
Oct
(3) |
Nov
(15) |
Dec
(4) |
2016 |
Jan
(6) |
Feb
|
Mar
(18) |
Apr
(5) |
May
(9) |
Jun
(3) |
Jul
(5) |
Aug
(2) |
Sep
(5) |
Oct
(2) |
Nov
|
Dec
(5) |
2017 |
Jan
(4) |
Feb
(3) |
Mar
|
Apr
|
May
(12) |
Jun
(1) |
Jul
(4) |
Aug
|
Sep
(3) |
Oct
(1) |
Nov
|
Dec
(1) |
2018 |
Jan
(5) |
Feb
|
Mar
(1) |
Apr
(1) |
May
(1) |
Jun
|
Jul
(4) |
Aug
(1) |
Sep
(8) |
Oct
|
Nov
|
Dec
(1) |
2019 |
Jan
|
Feb
(2) |
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2022 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Anthony E. <ant...@al...> - 2013-10-08 16:08:29
|
Hi Ive spent all afternoon looking at this mailing list just to find a basic example of Markowitz optimisation so I can see how to do things properly (especially creating the covar matrics etc). Does anyone have a basic example to point me in the right direction please? A lot of the code fragments in the list seem to be from older versions and dont even compile now ... Any help would be really appreciated – I have seen the little documentation there is, but just want a simple example if possibe where i supply an expected returns and covar and get back the weights ... Thanks everyone Anthony |
From: Anders P. <an...@op...> - 2013-09-03 08:50:20
|
What's the problem? If you think you've found a bug; supply a test case (code) that demonstrates the problem. Please just send minimal, directly executable, code. Be sure to state what you expect to happen and what actually does happen. /Anders On 3 sep 2013, at 09:55, Cristian Bissattini <cri...@ho...> wrote: > Dear All, > > I found out a possible bug in Markowitz model with this asset allocation: > > Asset 1: Expected return 4.51%, SD 4.25% > Asset 2: Expected return 9.12%, SD 32.18% > Asset 3: Expected return 9.00%, SD 47.17% > Asset 4: Expected return 7.71%, SD 28.24% > Asset 5: Expected return 6.73%, SD 25.49% > Asset 6: Expected return 7.21%, SD 27.25% > Asset 7: Expected return 9.55%, SD 31.09% > > Correlation Matrix is positive defined: > > -0.3511 > -0.2413 0.8849 > -0.3264 0.8656 0.7288 > -0.3762 0.9433 0.8205 0.9320 > -0.3624 0.9460 0.8408 0.9183 0.9907 > -0.3576 0.9938 0.8556 0.8771 0.9486 0.9413 > > The problem is when the target return is 6.81% > > Could you give me your feedback? > > Regards, > Cristian > ------------------------------------------------------------------------------ > Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more! > Discover the easy way to master current and previous Microsoft technologies > and advance your career. Get an incredible 1,500+ hours of step-by-step > tutorial videos with LearnDevNow. Subscribe today and save! > http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk_______________________________________________ > ojAlgo-user mailing list > ojA...@li... > https://lists.sourceforge.net/lists/listinfo/ojalgo-user |
From: Cristian B. <cri...@ho...> - 2013-09-03 08:37:48
|
I have also lower limit (10%) and upper limit (40%) for each asse class. From: cri...@ho... To: oja...@li... Subject: Markowitz model Date: Tue, 3 Sep 2013 09:55:30 +0200 Dear All, I found out a possible bug in Markowitz model with this asset allocation: Asset 1: Expected return 4.51%, SD 4.25% Asset 2: Expected return 9.12%, SD 32.18% Asset 3: Expected return 9.00%, SD 47.17% Asset 4: Expected return 7.71%, SD 28.24% Asset 5: Expected return 6.73%, SD 25.49% Asset 6: Expected return 7.21%, SD 27.25% Asset 7: Expected return 9.55%, SD 31.09% Correlation Matrix is positive defined: -0.3511 -0.2413 0.8849 -0.3264 0.8656 0.7288 -0.3762 0.9433 0.8205 0.9320 -0.3624 0.9460 0.8408 0.9183 0.9907 -0.3576 0.9938 0.8556 0.8771 0.9486 0.9413 The problem is when the target return is 6.81% Could you give me your feedback? Regards, Cristian |
From: Cristian B. <cri...@ho...> - 2013-09-03 07:55:38
|
Dear All, I found out a possible bug in Markowitz model with this asset allocation: Asset 1: Expected return 4.51%, SD 4.25% Asset 2: Expected return 9.12%, SD 32.18% Asset 3: Expected return 9.00%, SD 47.17% Asset 4: Expected return 7.71%, SD 28.24% Asset 5: Expected return 6.73%, SD 25.49% Asset 6: Expected return 7.21%, SD 27.25% Asset 7: Expected return 9.55%, SD 31.09% Correlation Matrix is positive defined: -0.3511 -0.2413 0.8849 -0.3264 0.8656 0.7288 -0.3762 0.9433 0.8205 0.9320 -0.3624 0.9460 0.8408 0.9183 0.9907 -0.3576 0.9938 0.8556 0.8771 0.9486 0.9413 The problem is when the target return is 6.81% Could you give me your feedback? Regards, Cristian |
From: Anders P. <an...@op...> - 2013-07-05 11:10:34
|
Thanks, it's in. /Anders On 5 jul 2013, at 03:55, Craig Miller <cra...@ya...> wrote: > and the unit test update inserted at line 83-92 of Testhardware.java > > > public void testX86_64__12() { > > final Hardware tmpHardware = Hardware.X86_64__12; > > final int tmpThreads = 12; > final int tmpCores = 6; > final int tmpUnits = 1; > > this.doTest(tmpHardware, tmpThreads, tmpCores, tmpUnits); > } > > > From: Anders Peterson <an...@op...> > To: ojAlgo ojAlgo <oja...@li...> > Sent: Thursday, July 4, 2013 1:19 PM > Subject: Re: [ojAlgo-user] Hardware update: Intel Core i7-980 3.33GHz > > Thanks - it's committed. /Anders > > On 4 jul 2013, at 06:51, Craig Miller <cra...@ya...> wrote: > > > > > /** > > * <pre> "Gulftown" (32 nm) Model: SLBUZ (B1) > > * Intel Core i7-980 3.33GHz > > * 8/25/2010 > > * ref: http://ark.intel.com/products/47932 > > * https://en.wikipedia.org/wiki/List_of_Intel_Core_i7_microprocessors > > * Device Manager </pre> > > * > > * <ul> > > * <li> Intel Core i7-980 > > * <ul> > > * <li>1 processor</li> > > * <li>6 cores per processor</li> > > * <li>2 threads per core</li> > > * <li>==>> Total 12 threads</li> > > * <li></li> > > * <li>12GB system RAM</li> > > * <li>8MB L3 cache per processor</li> > > * <li>256kB L2 cache per core x6</li> > > * <li>32kB L1 cache per core</li> > > * </ul> > > * </li> > > * </ul> > > */ > > public final static Hardware X86_64__12 = new Hardware("x86_64", new BasicMachine[] { new BasicMachine(12L * K * K * K, 12), new BasicMachine(12L * K * K, 8), new BasicMachine(256L * K, 2), new BasicMachine(32L * K, 2) }); > > > > ------------------------------------------------------------------------------ > > This SF.net email is sponsored by Windows: > > > > Build for Windows Store. > > > > http://p.sf.net/sfu/windows-dev2dev_______________________________________________ > > ojAlgo-user mailing list > > ojA...@li... > > https://lists.sourceforge.net/lists/listinfo/ojalgo-user > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by Windows: > > Build for Windows Store. > > http://p.sf.net/sfu/windows-dev2dev > _______________________________________________ > ojAlgo-user mailing list > ojA...@li... > https://lists.sourceforge.net/lists/listinfo/ojalgo-user > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by Windows: > > Build for Windows Store. > > http://p.sf.net/sfu/windows-dev2dev_______________________________________________ > ojAlgo-user mailing list > ojA...@li... > https://lists.sourceforge.net/lists/listinfo/ojalgo-user |
From: Craig M. <cra...@ya...> - 2013-07-05 01:55:51
|
and the unit test update inserted at line 83-92 of Testhardware.java public void testX86_64__12() { final Hardware tmpHardware = Hardware.X86_64__12; final int tmpThreads = 12; final int tmpCores = 6; final int tmpUnits = 1; this.doTest(tmpHardware, tmpThreads, tmpCores, tmpUnits); } ________________________________ From: Anders Peterson <an...@op...> To: ojAlgo ojAlgo <oja...@li...> Sent: Thursday, July 4, 2013 1:19 PM Subject: Re: [ojAlgo-user] Hardware update: Intel Core i7-980 3.33GHz Thanks - it's committed. /Anders On 4 jul 2013, at 06:51, Craig Miller <cra...@ya...> wrote: > > /** > * <pre> "Gulftown" (32 nm) Model: SLBUZ (B1) > * Intel Core i7-980 3.33GHz > * 8/25/2010 > * ref: http://ark.intel.com/products/47932 > * https://en.wikipedia.org/wiki/List_of_Intel_Core_i7_microprocessors > * Device Manager </pre> > * > * <ul> > * <li> Intel Core i7-980 > * <ul> > * <li>1 processor</li> > * <li>6 cores per processor</li> > * <li>2 threads per core</li> > * <li>==>> Total 12 threads</li> > * <li></li> > * <li>12GB system RAM</li> > * <li>8MB L3 cache per processor</li> > * <li>256kB L2 cache per core x6</li> > * <li>32kB L1 cache per core</li> > * </ul> > * </li> > * </ul> > */ > public final static Hardware X86_64__12 = new Hardware("x86_64", new BasicMachine[] { new BasicMachine(12L * K * K * K, 12), new BasicMachine(12L * K * K, 8), new BasicMachine(256L * K, 2), new BasicMachine(32L * K, 2) }); > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by Windows: > > Build for Windows Store. > > http://p.sf.net/sfu/windows-dev2dev_______________________________________________ > ojAlgo-user mailing list > ojA...@li... > https://lists.sourceforge.net/lists/listinfo/ojalgo-user ------------------------------------------------------------------------------ This SF.net email is sponsored by Windows: Build for Windows Store. http://p.sf.net/sfu/windows-dev2dev _______________________________________________ ojAlgo-user mailing list ojA...@li... https://lists.sourceforge.net/lists/listinfo/ojalgo-user |
From: Anders P. <an...@op...> - 2013-07-04 18:19:53
|
Thanks - it's committed. /Anders On 4 jul 2013, at 06:51, Craig Miller <cra...@ya...> wrote: > > /** > * <pre> "Gulftown" (32 nm) Model: SLBUZ (B1) > * Intel Core i7-980 3.33GHz > * 8/25/2010 > * ref: http://ark.intel.com/products/47932 > * https://en.wikipedia.org/wiki/List_of_Intel_Core_i7_microprocessors > * Device Manager </pre> > * > * <ul> > * <li> Intel Core i7-980 > * <ul> > * <li>1 processor</li> > * <li>6 cores per processor</li> > * <li>2 threads per core</li> > * <li>==>> Total 12 threads</li> > * <li></li> > * <li>12GB system RAM</li> > * <li>8MB L3 cache per processor</li> > * <li>256kB L2 cache per core x6</li> > * <li>32kB L1 cache per core</li> > * </ul> > * </li> > * </ul> > */ > public final static Hardware X86_64__12 = new Hardware("x86_64", new BasicMachine[] { new BasicMachine(12L * K * K * K, 12), new BasicMachine(12L * K * K, 8), new BasicMachine(256L * K, 2), new BasicMachine(32L * K, 2) }); > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by Windows: > > Build for Windows Store. > > http://p.sf.net/sfu/windows-dev2dev_______________________________________________ > ojAlgo-user mailing list > ojA...@li... > https://lists.sourceforge.net/lists/listinfo/ojalgo-user |
From: Craig M. <cra...@ya...> - 2013-07-04 04:51:45
|
/** * <pre> "Gulftown" (32 nm) Model: SLBUZ (B1) * Intel Core i7-980 3.33GHz * 8/25/2010 * ref: http://ark.intel.com/products/47932 * https://en.wikipedia.org/wiki/List_of_Intel_Core_i7_microprocessors * Device Manager </pre> * * <ul> * <li> Intel Core i7-980 * <ul> * <li>1 processor</li> * <li>6 cores per processor</li> * <li>2 threads per core</li> * <li>==>> Total 12 threads</li> * <li></li> * <li>12GB system RAM</li> * <li>8MB L3 cache per processor</li> * <li>256kB L2 cache per core x6</li> * <li>32kB L1 cache per core</li> * </ul> * </li> * </ul> */ public final static Hardware X86_64__12 = new Hardware("x86_64", new BasicMachine[] { new BasicMachine(12L * K * K * K, 12), new BasicMachine(12L * K * K, 8), new BasicMachine(256L * K, 2), new BasicMachine(32L * K, 2) }); |
From: Anders P. <an...@op...> - 2013-06-28 07:08:48
|
Have a look at this application: http://t-cloud.blaadin.com/ (You need to log in using your e-mail address.) Under "Define Market" and "Setup Profiles" you'll see what the risk aversion is for the market portfolio and the various risk profiles. On the "Assign Confidence" page you'll se all efficient portfolio weights. I used a 0.1 to 100 range on the risk aversion to create that chart. /Anders On 27 jun 2013, at 23:51, Anders Peterson <an...@op...> wrote: > The risk aversion factor is up to you... ;-) > > 2 and 4 are reasonable values, but as the entire range it's a bit narrow. 1 to 10 will cover a bit more, and 0.1 to 100 will usually cover just about everything. Try different values and see what results you get. Also try the calibrate(...) methods of FixedReturnsPortfolio and FixedWeightsPortfolio. > > /Anders > > > On 27 jun 2013, at 19:09, Yang Huang <yan...@gm...> wrote: > >> Hi Anders, >> >> Thanks for the quick fix. It works fine now. However, I realized that I have another simple question regarding the Risk Aversion Factor of the several portfolio classes, e.g. MarkowitzModel and MarketEquilibrium. What is the range for this factor? In some cases, a practical range for the factor can be between 2 to 4. I couldn't find a clue how this factor can be defined. Could you please also advise that? Thanks. >> >> -- >> Yang >> ------------------------------------------------------------------------------ >> This SF.net email is sponsored by Windows: >> >> Build for Windows Store. >> >> http://p.sf.net/sfu/windows-dev2dev_______________________________________________ >> ojAlgo-user mailing list >> ojA...@li... >> https://lists.sourceforge.net/lists/listinfo/ojalgo-user > |
From: Anders P. <an...@op...> - 2013-06-27 21:51:40
|
The risk aversion factor is up to you... ;-) 2 and 4 are reasonable values, but as the entire range it's a bit narrow. 1 to 10 will cover a bit more, and 0.1 to 100 will usually cover just about everything. Try different values and see what results you get. Also try the calibrate(...) methods of FixedReturnsPortfolio and FixedWeightsPortfolio. /Anders On 27 jun 2013, at 19:09, Yang Huang <yan...@gm...> wrote: > Hi Anders, > > Thanks for the quick fix. It works fine now. However, I realized that I have another simple question regarding the Risk Aversion Factor of the several portfolio classes, e.g. MarkowitzModel and MarketEquilibrium. What is the range for this factor? In some cases, a practical range for the factor can be between 2 to 4. I couldn't find a clue how this factor can be defined. Could you please also advise that? Thanks. > > -- > Yang > ------------------------------------------------------------------------------ > This SF.net email is sponsored by Windows: > > Build for Windows Store. > > http://p.sf.net/sfu/windows-dev2dev_______________________________________________ > ojAlgo-user mailing list > ojA...@li... > https://lists.sourceforge.net/lists/listinfo/ojalgo-user |
From: Yang H. <yan...@gm...> - 2013-06-27 17:09:18
|
Hi Anders, Thanks for the quick fix. It works fine now. However, I realized that I have another simple question regarding the Risk Aversion Factor of the several portfolio classes, e.g. MarkowitzModel and MarketEquilibrium. What is the range for this factor? In some cases, a practical range for the factor can be between 2 to 4. I couldn't find a clue how this factor can be defined. Could you please also advise that? Thanks. -- Yang |
From: Anders P. <an...@op...> - 2013-06-27 14:49:35
|
Yes, that's a bug - thank you for reporting it. I've changed the code in the FinanceUtils method to use "tmpTimeSeries.getName()" rather than "tmpTimeSeries" AND i've modified CoordinationSet to handle the case when the get(Object) method is called using a CalendarDateSeries instance. (Haven't actually tested it, but that should fix the problem.) The changes are in CVS. I'm in the process of refactoring parts of ojAlgo (the org.ojalgo.access package). That may cause some trouble. Let me know if it's too much. Because of the refactoring I'd like to wait a little before making a snapshot release. You'll have to get the source code directly from CVS if you want this bug fix. (...and then you'll get the other changes as well). /Anders On 27 jun 2013, at 15:37, Yang Huang <yan...@gm...> wrote: > I think I found a bug in org.ojalgo.finance.FinanceUtils..makeCovarianceMatrix() method: > > public static <V extends Number> BasicMatrix makeCovarianceMatrix(final Collection<CalendarDateSeries<V>> aTimeSeriesCollection) { > > final CoordinationSet<V> tmpCoordinator = new CoordinationSet<V>(aTimeSeriesCollection).prune(); > > final ArrayList<SampleSet> tmpSampleSets = new ArrayList<SampleSet>(); > for (final CalendarDateSeries<V> tmpTimeSeries : aTimeSeriesCollection) { > final double[] someValues = tmpCoordinator.get(tmpTimeSeries).getPrimitiveValues(); > ... > > According to the API, CoordinationSet.get() should have a String as the input parameter, but it is passing a CalendarDateSeries in makeCovarianceMatrix() method. It actually causes NullPointerException. when the following line is called. > > final double[] someValues = tmpCoordinator.get(tmpTimeSeries).getPrimitiveValues(); > > > -- > Yang > ------------------------------------------------------------------------------ > This SF.net email is sponsored by Windows: > > Build for Windows Store. > > http://p.sf.net/sfu/windows-dev2dev_______________________________________________ > ojAlgo-user mailing list > ojA...@li... > https://lists.sourceforge.net/lists/listinfo/ojalgo-user |
From: Yang H. <yan...@gm...> - 2013-06-27 13:37:17
|
I think I found a bug in org.ojalgo.finance.FinanceUtils.makeCovarianceMatrix() method: public static <V extends Number> BasicMatrix makeCovarianceMatrix(final Collection<CalendarDateSeries<V>> aTimeSeriesCollection) { final CoordinationSet<V> tmpCoordinator = new CoordinationSet<V>(aTimeSeriesCollection).prune(); final ArrayList<SampleSet> tmpSampleSets = new ArrayList<SampleSet>(); for (final CalendarDateSeries<V> tmpTimeSeries : aTimeSeriesCollection) { final double[] someValues = tmpCoordinator.get(tmpTimeSeries).getPrimitiveValues(); ... According to the API, CoordinationSet.get() should have a String as the input parameter, but it is passing a CalendarDateSeries in makeCovarianceMatrix() method. It actually causes NullPointerException. when the following line is called. final double[] someValues = tmpCoordinator.get(tmpTimeSeries).getPrimitiveValues(); -- Yang |
From: Anders P. <an...@op...> - 2013-06-25 19:46:00
|
How was the result from getReturnVariance() different than what you expected? Did you expect the correlations matrix to be anything else other than the identity matrix? Where would those different numbers come from? /Anders On 25 jun 2013, at 14:41, Yang Huang <yan...@gm...> wrote: > Hi everyone, > > I am new to ojAlgo and I am trying to create a simple portfolio optimization analyzing tool using ojAlgo library in Java. > > First of all, I created a simple portfolio with 5 instruments with corresponding expected returns, volatilities, and weights. > > I have created individual instruments using SimpleAsset class: > SimpleAsset(Number aMeanReturn, Number aVolatility, Number aWeight) > > Then I have created an instance of SimplePortfolio class to contain all these instruments as a list: > SimplePortfolio(List<SimpleAsset> someAssets) > > It turns out that getMeanReturn() method of SimplePortfolio gives me an expected answer but getReturnVariance() method doesn't provides an expected result. When I check the correlation matrix from getCorrelations(), I got the following BasicMatrix instance: > class org.ojalgo.matrix.PrimitiveMatrix > {{1.0, 0.0, 0.0, 0.0, 0.0}, > {0.0, 1.0, 0.0, 0.0, 0.0}, > {0.0, 0.0, 1.0, 0.0, 0.0}, > {0.0, 0.0, 0.0, 1.0, 0.0}, > {0.0, 0.0, 0.0, 0.0, 1.0}} > > Could anyone please let me know how I should fix this? Thanks a lot! > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by Windows: > > Build for Windows Store. > > http://p.sf.net/sfu/windows-dev2dev_______________________________________________ > ojAlgo-user mailing list > ojA...@li... > https://lists.sourceforge.net/lists/listinfo/ojalgo-user |
From: Yang H. <yan...@gm...> - 2013-06-25 12:42:02
|
Hi everyone, I am new to ojAlgo and I am trying to create a simple portfolio optimization analyzing tool using ojAlgo library in Java. First of all, I created a simple portfolio with 5 instruments with corresponding expected returns, volatilities, and weights. I have created individual instruments using SimpleAsset class: *SimpleAsset<http://ojalgo.org/generated/org/ojalgo/finance/portfolio/SimpleAsset.html#SimpleAsset(java.lang.Number, java.lang.Number, java.lang.Number)>*(Number<http://download.oracle.com/javase/6/docs/api/java/lang/Number.html?is-external=true> aMeanReturn, Number<http://download.oracle.com/javase/6/docs/api/java/lang/Number.html?is-external=true> aVolatility, Number<http://download.oracle.com/javase/6/docs/api/java/lang/Number.html?is-external=true> aWeight) Then I have created an instance of SimplePortfolio class to contain all these instruments as a list: *SimplePortfolio<http://ojalgo.org/generated/org/ojalgo/finance/portfolio/SimplePortfolio.html#SimplePortfolio(java.util.List)> *(List<http://download.oracle.com/javase/6/docs/api/java/util/List.html?is-external=true> <SimpleAsset<http://ojalgo.org/generated/org/ojalgo/finance/portfolio/SimpleAsset.html> > someAssets) It turns out that *getMeanReturn<http://ojalgo.org/generated/org/ojalgo/finance/portfolio/SimplePortfolio.html#getMeanReturn()> *() method of SimplePortfolio gives me an expected answer but * getReturnVariance<http://ojalgo.org/generated/org/ojalgo/finance/portfolio/SimplePortfolio.html#getReturnVariance()> *() method doesn't provides an expected result. When I check the correlation matrix from *getCorrelations<http://ojalgo.org/generated/org/ojalgo/finance/portfolio/SimplePortfolio.html#getCorrelations()> *(), I got the following BasicMatrix instance: class org.ojalgo.matrix.PrimitiveMatrix {{1.0, 0.0, 0.0, 0.0, 0.0}, {0.0, 1.0, 0.0, 0.0, 0.0}, {0.0, 0.0, 1.0, 0.0, 0.0}, {0.0, 0.0, 0.0, 1.0, 0.0}, {0.0, 0.0, 0.0, 0.0, 1.0}} Could anyone please let me know how I should fix this? Thanks a lot! |
From: Anders P. <an...@op...> - 2013-04-30 09:42:49
|
I don't get any compilation errors. Suppose it's a matter of compiler settings. Try changing those, or change the code so that your compiler with its current settings accepts it. /Anders On 26 apr 2013, at 03:22, Bayard Fetler <bf...@gm...> wrote: > I set up Java_5_6 with NetBeans and CVS, but it doesn't compile with Java 6, with the following errors: > > ojalgo_5_6/DevProj/src/org/ojalgo/finance/FinanceUtils.java:112: incompatible types; inferred type argument(s) java.lang.Object do not conform to bounds of type variable(s) K > found : <K>void > required: void > > ojalgo_5_6/DevProj/src/org/ojalgo/random/process/GaussianField.java:95: incompatible types; inferred type argument(s) java.lang.Object do not conform to bounds of type variable(s) K > found : <K>org.ojalgo.random.process.GaussianField.Mean<K> > required: java.lang.Object > this((Mean<K>) GaussianField.mean(), covarFunc, new TreeSet<ComparableToDouble<K>>()); > > Bayard > > > On Thu, Apr 25, 2013 at 1:31 AM, Anders Peterson <an...@op...> wrote: > Sorry, I can't offer CVS support. I use the eclipse tools - it's very simple. /Anders > > <PastedGraphic-1.tiff> > > On 25 apr 2013, at 06:53, Bayard Fetler <bf...@gm...> wrote: > >> How do I access the Java_5_6 branch? If I try >> cvs -z3 -d:pserver:ano...@oj...:/cvsroot/ojalgo co -Pr Java_5_6 DevProj >> I get "no such tag Java_5_6". Apologies, I don't use CVS much. >> >> I got it to compile with Java 7 on Mac and it is much faster, only 6 to 20 times slower with ComplexNumber compared to Double. >> >> However I still need a Java 6 version on Mac due to lack of support from Oracle. >> >> Thanks, >> Bayard >> >> >> On Wed, Apr 24, 2013 at 6:40 AM, Anders Peterson <an...@op...> wrote: >> Please keep discussions like this on the mailing list. >> >> I created a Java_5_6 branch for you, and I supply the ComplexNumber class from the latest release here. The rest you'll have to do yourself. When you're done you may consider creating a patch file to update that branch. In that case please make sure all CVS modules (even the ones you don't use) compile. >> >> /Anders >> >> >> >> >> >> On 23 apr 2013, at 02:19, Bayard Fetler <bf...@gm...> wrote: >> >> > I was busy last week, now back looking at it again. Would you happen to have a Java 6 version in CVS? We are working on upgrading to Java 7, but not fully there yet, especially on Mac due to some incompatibilities. We would very much like to go with ojalgo, since it has continuing development and support. >> > >> > Best regards, >> > Bayard >> > >> > >> > On Fri, Apr 12, 2013 at 2:46 PM, Bayard Fetler <bf...@gm...> wrote: >> > Attached is my source code for the ojalgo SVD Complex and Double comparisons. Also attached is a screenshot from the Netbeans profiler, showing SVDnew32.toDiagonal(). Not shown are SingularValueDecomposition methods computeBidiagonal() and getBidiagonalQ1(), which also take time due to ComplexNumber.multiply(). >> > >> > Hope this helps. >> > >> > Best regards, >> > Bayard Fetler >> > >> >> >> ------------------------------------------------------------------------------ >> Try New Relic Now & We'll Send You this Cool Shirt >> New Relic is the only SaaS-based application performance monitoring service >> that delivers powerful full stack analytics. Optimize and monitor your >> browser, app, & servers with just a few lines of code. Try New Relic >> and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr >> _______________________________________________ >> ojAlgo-user mailing list >> ojA...@li... >> https://lists.sourceforge.net/lists/listinfo/ojalgo-user >> >> >> ------------------------------------------------------------------------------ >> Try New Relic Now & We'll Send You this Cool Shirt >> New Relic is the only SaaS-based application performance monitoring service >> that delivers powerful full stack analytics. Optimize and monitor your >> browser, app, & servers with just a few lines of code. Try New Relic >> and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr_______________________________________________ >> ojAlgo-user mailing list >> ojA...@li... >> https://lists.sourceforge.net/lists/listinfo/ojalgo-user > > > ------------------------------------------------------------------------------ > Try New Relic Now & We'll Send You this Cool Shirt > New Relic is the only SaaS-based application performance monitoring service > that delivers powerful full stack analytics. Optimize and monitor your > browser, app, & servers with just a few lines of code. Try New Relic > and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr > _______________________________________________ > ojAlgo-user mailing list > ojA...@li... > https://lists.sourceforge.net/lists/listinfo/ojalgo-user > > > ------------------------------------------------------------------------------ > Try New Relic Now & We'll Send You this Cool Shirt > New Relic is the only SaaS-based application performance monitoring service > that delivers powerful full stack analytics. Optimize and monitor your > browser, app, & servers with just a few lines of code. Try New Relic > and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr_______________________________________________ > ojAlgo-user mailing list > ojA...@li... > https://lists.sourceforge.net/lists/listinfo/ojalgo-user |
From: Anders P. <an...@op...> - 2013-04-25 08:32:02
|
Sorry, I can't offer CVS support. I use the eclipse tools - it's very simple. /Anders On 25 apr 2013, at 06:53, Bayard Fetler <bf...@gm...> wrote: > How do I access the Java_5_6 branch? If I try > cvs -z3 -d:pserver:ano...@oj...:/cvsroot/ojalgo co -Pr Java_5_6 DevProj > I get "no such tag Java_5_6". Apologies, I don't use CVS much. > > I got it to compile with Java 7 on Mac and it is much faster, only 6 to 20 times slower with ComplexNumber compared to Double. > > However I still need a Java 6 version on Mac due to lack of support from Oracle. > > Thanks, > Bayard > > > On Wed, Apr 24, 2013 at 6:40 AM, Anders Peterson <an...@op...> wrote: > Please keep discussions like this on the mailing list. > > I created a Java_5_6 branch for you, and I supply the ComplexNumber class from the latest release here. The rest you'll have to do yourself. When you're done you may consider creating a patch file to update that branch. In that case please make sure all CVS modules (even the ones you don't use) compile. > > /Anders > > > > > > On 23 apr 2013, at 02:19, Bayard Fetler <bf...@gm...> wrote: > > > I was busy last week, now back looking at it again. Would you happen to have a Java 6 version in CVS? We are working on upgrading to Java 7, but not fully there yet, especially on Mac due to some incompatibilities. We would very much like to go with ojalgo, since it has continuing development and support. > > > > Best regards, > > Bayard > > > > > > On Fri, Apr 12, 2013 at 2:46 PM, Bayard Fetler <bf...@gm...> wrote: > > Attached is my source code for the ojalgo SVD Complex and Double comparisons. Also attached is a screenshot from the Netbeans profiler, showing SVDnew32.toDiagonal(). Not shown are SingularValueDecomposition methods computeBidiagonal() and getBidiagonalQ1(), which also take time due to ComplexNumber.multiply(). > > > > Hope this helps. > > > > Best regards, > > Bayard Fetler > > > > > ------------------------------------------------------------------------------ > Try New Relic Now & We'll Send You this Cool Shirt > New Relic is the only SaaS-based application performance monitoring service > that delivers powerful full stack analytics. Optimize and monitor your > browser, app, & servers with just a few lines of code. Try New Relic > and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr > _______________________________________________ > ojAlgo-user mailing list > ojA...@li... > https://lists.sourceforge.net/lists/listinfo/ojalgo-user > > > ------------------------------------------------------------------------------ > Try New Relic Now & We'll Send You this Cool Shirt > New Relic is the only SaaS-based application performance monitoring service > that delivers powerful full stack analytics. Optimize and monitor your > browser, app, & servers with just a few lines of code. Try New Relic > and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr_______________________________________________ > ojAlgo-user mailing list > ojA...@li... > https://lists.sourceforge.net/lists/listinfo/ojalgo-user |
From: Bayard F. <bf...@gm...> - 2013-04-25 04:53:46
|
How do I access the Java_5_6 branch? If I try cvs -z3 -d:pserver:ano...@oj...:/cvsroot/ojalgo co -Pr Java_5_6 DevProj I get "no such tag Java_5_6". Apologies, I don't use CVS much. I got it to compile with Java 7 on Mac and it is much faster, only 6 to 20 times slower with ComplexNumber compared to Double. However I still need a Java 6 version on Mac due to lack of support from Oracle. Thanks, Bayard On Wed, Apr 24, 2013 at 6:40 AM, Anders Peterson <an...@op...>wrote: > Please keep discussions like this on the mailing list. > > I created a Java_5_6 branch for you, and I supply the ComplexNumber class > from the latest release here. The rest you'll have to do yourself. When > you're done you may consider creating a patch file to update that branch. > In that case please make sure all CVS modules (even the ones you don't use) > compile. > > /Anders > > > > > > On 23 apr 2013, at 02:19, Bayard Fetler <bf...@gm...> wrote: > > > I was busy last week, now back looking at it again. Would you happen to > have a Java 6 version in CVS? We are working on upgrading to Java 7, but > not fully there yet, especially on Mac due to some incompatibilities. We > would very much like to go with ojalgo, since it has continuing development > and support. > > > > Best regards, > > Bayard > > > > > > On Fri, Apr 12, 2013 at 2:46 PM, Bayard Fetler <bf...@gm...> > wrote: > > Attached is my source code for the ojalgo SVD Complex and Double > comparisons. Also attached is a screenshot from the Netbeans profiler, > showing SVDnew32.toDiagonal(). Not shown are SingularValueDecomposition > methods computeBidiagonal() and getBidiagonalQ1(), which also take time due > to ComplexNumber.multiply(). > > > > Hope this helps. > > > > Best regards, > > Bayard Fetler > > > > > > ------------------------------------------------------------------------------ > Try New Relic Now & We'll Send You this Cool Shirt > New Relic is the only SaaS-based application performance monitoring service > that delivers powerful full stack analytics. Optimize and monitor your > browser, app, & servers with just a few lines of code. Try New Relic > and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr > _______________________________________________ > ojAlgo-user mailing list > ojA...@li... > https://lists.sourceforge.net/lists/listinfo/ojalgo-user > > |
From: Anders P. <an...@op...> - 2013-04-24 13:40:50
|
Please keep discussions like this on the mailing list. I created a Java_5_6 branch for you, and I supply the ComplexNumber class from the latest release here. The rest you'll have to do yourself. When you're done you may consider creating a patch file to update that branch. In that case please make sure all CVS modules (even the ones you don't use) compile. /Anders |
From: Bayard F. <bf...@gm...> - 2013-04-15 05:54:15
|
I'll try it out, and downloaded the code from sourceforge. I assume I only need to compile the DevProj module? My project requires complex numbers, which I suppose are not often needed by most people. Bayard On Sat, Apr 13, 2013 at 4:56 AM, Anders Peterson <an...@op...>wrote: > I wouldn't expect SVD with ComplexNumber or BigDecimal to very fast. > > The ComplexNumber code did seem to be unnecessarily abstract so I made > some changes. See if it's faster now. You'll have to get the source from > CVS. > > ComplexNumber is now an abstract class. Whenever possible use the > makeReal() factory method rather than makeRectangular() or makePolar(); > > /Anders > > > On 12 apr 2013, at 23:34, Bayard Fetler <bf...@gm...> wrote: > > > I find that doing Singular Value Decomposition with ComplexNumber is > much slower than with Double. For 256 rows by 64 columns, Double takes 17 > ms while ComplexNumber takes 2.95 s, over a factor of 150.. At lower > dimensions it's only 10 to 20 times slower. The timing comparison is just > for the method SingularValue.compute(). > > > > I used NetBeans profiling and found that much of the time is spent in > ComplexNumber.multiply(). I can understand a factor of 4 to 6 from the > number of operations, but it also does a number of other checks such as > isReal() and isPolar(). The initial matrix is created with > makeRectangular(). > > > > I am using v33.0, and would be happy to share my source code.. > > > ------------------------------------------------------------------------------ > > Precog is a next-generation analytics platform capable of advanced > > analytics on semi-structured data. The platform includes APIs for > building > > apps and a phenomenal toolset for data science. Developers can use > > our toolset for easy data analysis & visualization. Get a free account! > > > http://www2.precog.com/precogplatform/slashdotnewsletter_______________________________________________ > > ojAlgo-user mailing list > > ojA...@li... > > https://lists.sourceforge.net/lists/listinfo/ojalgo-user > > > > ------------------------------------------------------------------------------ > Precog is a next-generation analytics platform capable of advanced > analytics on semi-structured data. The platform includes APIs for building > apps and a phenomenal toolset for data science. Developers can use > our toolset for easy data analysis & visualization. Get a free account! > http://www2.precog.com/precogplatform/slashdotnewsletter > _______________________________________________ > ojAlgo-user mailing list > ojA...@li... > https://lists.sourceforge.net/lists/listinfo/ojalgo-user > |
From: Anders P. <an...@op...> - 2013-04-13 11:56:48
|
I wouldn't expect SVD with ComplexNumber or BigDecimal to very fast. The ComplexNumber code did seem to be unnecessarily abstract so I made some changes. See if it's faster now. You'll have to get the source from CVS. ComplexNumber is now an abstract class. Whenever possible use the makeReal() factory method rather than makeRectangular() or makePolar(); /Anders On 12 apr 2013, at 23:34, Bayard Fetler <bf...@gm...> wrote: > I find that doing Singular Value Decomposition with ComplexNumber is much slower than with Double. For 256 rows by 64 columns, Double takes 17 ms while ComplexNumber takes 2.95 s, over a factor of 150.. At lower dimensions it's only 10 to 20 times slower. The timing comparison is just for the method SingularValue.compute(). > > I used NetBeans profiling and found that much of the time is spent in ComplexNumber.multiply(). I can understand a factor of 4 to 6 from the number of operations, but it also does a number of other checks such as isReal() and isPolar(). The initial matrix is created with makeRectangular(). > > I am using v33.0, and would be happy to share my source code.. > ------------------------------------------------------------------------------ > Precog is a next-generation analytics platform capable of advanced > analytics on semi-structured data. The platform includes APIs for building > apps and a phenomenal toolset for data science. Developers can use > our toolset for easy data analysis & visualization. Get a free account! > http://www2.precog.com/precogplatform/slashdotnewsletter_______________________________________________ > ojAlgo-user mailing list > ojA...@li... > https://lists.sourceforge.net/lists/listinfo/ojalgo-user |
From: Bayard F. <bf...@gm...> - 2013-04-12 21:34:25
|
I find that doing Singular Value Decomposition with ComplexNumber is much slower than with Double. For 256 rows by 64 columns, Double takes 17 ms while ComplexNumber takes 2.95 s, over a factor of 150. At lower dimensions it's only 10 to 20 times slower. The timing comparison is just for the method SingularValue.compute(). I used NetBeans profiling and found that much of the time is spent in ComplexNumber.multiply(). I can understand a factor of 4 to 6 from the number of operations, but it also does a number of other checks such as isReal() and isPolar(). The initial matrix is created with makeRectangular(). I am using v33.0, and would be happy to share my source code. |
From: Anders P. <an...@op...> - 2013-04-11 20:21:42
|
On 11 apr 2013, at 17:33, Jeff Sherman <jef...@gm...> wrote: > So is it the case that for some setting of > model.options.problem > you'd expect the solver to find an optimal solution if one exists? The default values should work for the majority of cases, but sometimes you have to tweak them. > You demonstrated that when this value is set to 8, the solver fails. Should the logic be "if fail then increase model.options.problem and run again". I guess I dont understand the relationship between model.options.problem and successfully solving the problem. There's no logic like that. At various points the algorithm needs to determine if a number is zero or not, positive or negative, equal to another number or not... Determining these things in a numerically stable manner is not always trivial. The various NumberContext:s among the options are used to control precision, scale, rounding, and error/margins. Look at the code if want see how they're used. Feel free to suggest better default values, or code changes regarding how the various tests are done. /Anders > On Thu, Apr 11, 2013 at 10:31 AM, Anders Peterson <an...@op...> wrote: > I just check the state the way you do... > > model.options.problem = NumberContext.getGeneral(8); > ==>> > FAILED Infinity @ { 0.0, 0.0, 0.0, 0.0 } > > model.options.problem = NumberContext.getGeneral(9); > ==>> > OPTIMAL 4849.999999999305 @ { 4849.999999999305, 1244.9999999999998, 1269.0000000000002, 1307.0 } > > model.options.problem = NumberContext.getGeneral(12); > ==>> > FEASIBLE 4849.999999999305 @ { 4849.999999999305, 1244.9999999999998, 1269.0000000000002, 1307.0 } > > > Changing from 9 to 12 causes some LP subproblem to fail. The MIP solver detects this, and therefore is not certain if the feasible solution it did find is optimal or not. Thus it marks it feasible rather than optimal. > > > I don't consider the fact that you have to adjust some options to get the solver to function properly in some cases a bug. The way the LP fails with the "12" - it actually returns an infeasible solution - is a bug. > > > /Anders > > > On 11 apr 2013, at 15:47, Jeff Sherman <jef...@gm...> wrote: > > > Thanks for looking into this. I dont require anywhere near 16 digit accuracy on x1. In fact, I'm really only interested in the values of the integral variables. On the test case i sent you, I added the following: > > > > model.options.problem = NumberContext.getGeneral(9); > > > > and I get this output which is "correct". > > > > Obj val: 4849.999999999305 > > Optimal: true > > All vars: > > x1 = 4.85E+3 > > x2013 = 1245 > > x2014 = 1269 > > x2015 = 1307 > > > > The "Optimal: true" output comes from: > > res.getState().isOptimal() > > > > which doesn't seem to coincide with your results...how are you determining that you get a FEASIBLE, rather than OPTIMAL result? > > > > > > > > On Thu, Apr 11, 2013 at 5:57 AM, Anders Peterson <an...@op...> wrote: > > I've run this test case, and I've created another using the model description from your first message. > > > > By setting > > > > tmpModel.options.problem = NumberContext.getGeneral(12); > > > > I can get correct (but maybe not accurate enough) solutions to both models: > > > > OPTIMAL 4199.999999999861 @ { 4199.999999999861, 1891.9999999999998, 1929.0 } > > FEASIBLE 4849.999999999305 @ { 4849.999999999305, 1244.9999999999998, 1269.0000000000002, 1307.0 } > > > > > > With the first model description you sent in you stated the correct solution to be: > > x1 = 4200.000000000075 > > x2013 = 1892 > > x2014 = 1929 > > > > Do you really require full 16 digit accuracy on x1? > > > > > > With the second model something does go wrong with the linear solver in one of the integer solver's nodes (subproblems). That's why the result has state FEASIBLE rather than OPTIMAL. The fact that the returned feasible solution actually happens to be the correct/optimal solution is a coincidence. That problem with the linear solver is a bug - it somehow returns an infeasible solution. I'll look in to this further. > > > > > > Using NumberContext.getGeneral(12); as the default value for tmpModel.options.problem breaks a number of other test cases... > > > > > > /Anders > > > > > > On 8 apr 2013, at 18:02, Jeff Sherman <jef...@gm...> wrote: > > > > > Anders, > > > Please disregard the previous attachment and run this one. Also, on one run i got these results: > > > Obj val: 5250.000000000088 > > > Optimal: true > > > All vars: > > > x1 = 5.25E+3 > > > x2013 = 1244 > > > x2014 = 1269 > > > x2015 = 1308 > > > > > > > > > On Mon, Apr 8, 2013 at 11:52 AM, Jeff Sherman <jef...@gm...> wrote: > > > Andres, > > > Thanks for your response. The attached code produces the following results: > > > x1 = 0 > > > x2013 = 1245 > > > x2014 = 1269.9 > > > x2015 = 1306.1 > > > > > > Note that x2014 and x2015 are set as integral variables. > > > > > > If in the calls to model.addExpression, i change the strings that are passed in, I can also obtain the following results: > > > x1 = 2890.64039409 > > > x2013 = 1244 > > > x2014 = 1269.45812808 > > > x2015 = 1307.54187192 > > > > > > I did some looking into the code and I noticed in the ExpressionsBasedModel class you have: > > > > > > private final HashMap<String, Expression> myExpressions = new HashMap<String, Expression>(); > > > > > > and at points, you get a collection of myExpression.values(), the order of which is not guaranteed. I'm not sure if you care about this ordering but i thought id point it out in case. > > > > > > The correct results for the problem are: > > > x1 = 4849.999999997941 > > > x2013 = 1245 > > > x2014 = 1269 > > > x2015 = 1307 > > > > > > Please let me know if I can provide any additional information or clarification. > > > > > > Best, > > > Jeff > > > > > > > > > > > > On Mon, Apr 8, 2013 at 5:22 AM, Anders Peterson <an...@op...> wrote: > > > ...and please experiment with different values on the various model/solver options - in particular tmpYourModel.options..problem > > > > > > /Anders > > > > > > > > > On 8 apr 2013, at 08:58, Anders Peterson <an...@op...> wrote: > > > > > > > It's better you send me source code that I can execute and use as a test case. /Anders > > > > > > > > On 8 apr 2013, at 01:25, Jeff Sherman <jef...@gm...> wrote: > > > > > > > >> When I execute the following program: > > > >> Minimize > > > >> 1*x1 > > > >> Subject To > > > >> 1*x2013 >= 0 > > > >> 1*x2014 >= 0 > > > >> 1*x1 >= 0 > > > >> -5000.0*x2014 + 5100.0*x2013 + -1.0*x1 <= 0 > > > >> -5000.0*x2014 + 5100.0*x2013 + 1.0*x1 >= 0 > > > >> 5000*x2013 + 5000*x2014 = 19105000 > > > >> Bounds > > > >> Variables > > > >> x2014 integer > > > >> x2013 integer > > > >> x1 continuous > > > >> > > > >> I get these results which are suboptimal: > > > >> x1 = 5899.999999996906 > > > >> x2013 = 1891 > > > >> x2014 = 1930 > > > >> > > > >> Or these results (which seem to occur at random): > > > >> x1 = Infinity > > > >> x2013 = 0 > > > >> x2014 = 0 > > > >> > > > >> Using another solver, I obtain: > > > >> x1 = 4200.000000000075 > > > >> x2013 = 1892 > > > >> x2014 = 1929 > > > >> ------------------------------------------------------------------------------ > > > >> Minimize network downtime and maximize team effectiveness. > > > >> Reduce network management and security costs.Learn how to hire > > > >> the most talented Cisco Certified professionals. Visit the > > > >> Employer Resources Portal > > > >> http://www.cisco.com/web/learning/employer_resources/index.html_______________________________________________ > > > >> ojAlgo-user mailing list > > > >> ojA...@li... > > > >> https://lists.sourceforge.net/lists/listinfo/ojalgo-user > > > > > > > > > > > > ------------------------------------------------------------------------------ > > > > Minimize network downtime and maximize team effectiveness. > > > > Reduce network management and security costs.Learn how to hire > > > > the most talented Cisco Certified professionals. Visit the > > > > Employer Resources Portal > > > > http://www.cisco.com/web/learning/employer_resources/index.html > > > > _______________________________________________ > > > > ojAlgo-user mailing list > > > > ojA...@li... > > > > https://lists.sourceforge.net/lists/listinfo/ojalgo-user > > > > > > > > > > > > > > > > > ------------------------------------------------------------------------------ > > > Minimize network downtime and maximize team effectiveness. > > > Reduce network management and security costs.Learn how to hire > > > the most talented Cisco Certified professionals. Visit the > > > Employer Resources Portal > > > http://www.cisco.com/web/learning/employer_resources/index.html > > > _______________________________________________ > > > ojAlgo-user mailing list > > > ojAlgo-user@lists..sourceforge.net > > > https://lists.sourceforge.net/lists/listinfo/ojalgo-user > > > > > > > > > <TestILP.java>------------------------------------------------------------------------------ > > > Minimize network downtime and maximize team effectiveness. > > > Reduce network management and security costs.Learn how to hire > > > the most talented Cisco Certified professionals. Visit the > > > Employer Resources Portal > > > http://www.cisco.com/web/learning/employer_resources/index.html_______________________________________________ > > > ojAlgo-user mailing list > > > ojAlgo-user@lists..sourceforge.net > > > https://lists..sourceforge.net/lists/listinfo/ojalgo-user > > > > > > ------------------------------------------------------------------------------ > > Precog is a next-generation analytics platform capable of advanced > > analytics on semi-structured data. The platform includes APIs for building > > apps and a phenomenal toolset for data science. Developers can use > > our toolset for easy data analysis & visualization. Get a free account! > > http://www2.precog.com/precogplatform/slashdotnewsletter > > _______________________________________________ > > ojAlgo-user mailing list > > ojAlgo-user@lists..sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/ojalgo-user > > > > ------------------------------------------------------------------------------ > > Precog is a next-generation analytics platform capable of advanced > > analytics on semi-structured data. The platform includes APIs for building > > apps and a phenomenal toolset for data science. Developers can use > > our toolset for easy data analysis & visualization. Get a free account! > > http://www2..precog.com/precogplatform/slashdotnewsletter_______________________________________________ > > ojAlgo-user mailing list > > ojAlgo-user@lists..sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/ojalgo-user > > > ------------------------------------------------------------------------------ > Precog is a next-generation analytics platform capable of advanced > analytics on semi-structured data. The platform includes APIs for building > apps and a phenomenal toolset for data science. Developers can use > our toolset for easy data analysis & visualization. Get a free account! > http://www2.precog.com/precogplatform/slashdotnewsletter > _______________________________________________ > ojAlgo-user mailing list > ojA...@li... > https://lists.sourceforge.net/lists/listinfo/ojalgo-user > > ------------------------------------------------------------------------------ > Precog is a next-generation analytics platform capable of advanced > analytics on semi-structured data. The platform includes APIs for building > apps and a phenomenal toolset for data science. Developers can use > our toolset for easy data analysis & visualization. Get a free account! > http://www2.precog.com/precogplatform/slashdotnewsletter_______________________________________________ > ojAlgo-user mailing list > ojA...@li... > https://lists.sourceforge.net/lists/listinfo/ojalgo-user |
From: Jeff S. <jef...@gm...> - 2013-04-11 15:33:26
|
So is it the case that for some setting of model.options.problem you'd expect the solver to find an optimal solution if one exists? You demonstrated that when this value is set to 8, the solver fails. Should the logic be "if fail then increase model.options.problem and run again". I guess I dont understand the relationship between model.options.problem and successfully solving the problem. On Thu, Apr 11, 2013 at 10:31 AM, Anders Peterson <an...@op...>wrote: > I just check the state the way you do... > > model.options.problem = NumberContext.getGeneral(8); > ==>> > FAILED Infinity @ { 0.0, 0.0, 0.0, 0.0 } > > model.options.problem = NumberContext.getGeneral(9); > ==>> > OPTIMAL 4849.999999999305 @ { 4849.999999999305, 1244.9999999999998, > 1269.0000000000002, 1307.0 } > > model.options.problem = NumberContext.getGeneral(12); > ==>> > FEASIBLE 4849.999999999305 @ { 4849.999999999305, 1244.9999999999998, > 1269.0000000000002, 1307.0 } > > > Changing from 9 to 12 causes some LP subproblem to fail. The MIP solver > detects this, and therefore is not certain if the feasible solution it did > find is optimal or not. Thus it marks it feasible rather than optimal. > > > I don't consider the fact that you have to adjust some options to get the > solver to function properly in some cases a bug. The way the LP fails with > the "12" - it actually returns an infeasible solution - is a bug. > > > /Anders > > > On 11 apr 2013, at 15:47, Jeff Sherman <jef...@gm...> wrote: > > > Thanks for looking into this. I dont require anywhere near 16 digit > accuracy on x1. In fact, I'm really only interested in the values of the > integral variables. On the test case i sent you, I added the following: > > > > model.options.problem = NumberContext.getGeneral(9); > > > > and I get this output which is "correct". > > > > Obj val: 4849.999999999305 > > Optimal: true > > All vars: > > x1 = 4.85E+3 > > x2013 = 1245 > > x2014 = 1269 > > x2015 = 1307 > > > > The "Optimal: true" output comes from: > > res.getState().isOptimal() > > > > which doesn't seem to coincide with your results...how are you > determining that you get a FEASIBLE, rather than OPTIMAL result? > > > > > > > > On Thu, Apr 11, 2013 at 5:57 AM, Anders Peterson <an...@op...> > wrote: > > I've run this test case, and I've created another using the model > description from your first message. > > > > By setting > > > > tmpModel.options.problem = NumberContext.getGeneral(12); > > > > I can get correct (but maybe not accurate enough) solutions to both > models: > > > > OPTIMAL 4199.999999999861 @ { 4199.999999999861, 1891.9999999999998, > 1929.0 } > > FEASIBLE 4849.999999999305 @ { 4849.999999999305, 1244.9999999999998, > 1269.0000000000002, 1307.0 } > > > > > > With the first model description you sent in you stated the correct > solution to be: > > x1 = 4200.000000000075 > > x2013 = 1892 > > x2014 = 1929 > > > > Do you really require full 16 digit accuracy on x1? > > > > > > With the second model something does go wrong with the linear solver in > one of the integer solver's nodes (subproblems). That's why the result has > state FEASIBLE rather than OPTIMAL. The fact that the returned feasible > solution actually happens to be the correct/optimal solution is a > coincidence. That problem with the linear solver is a bug - it somehow > returns an infeasible solution. I'll look in to this further. > > > > > > Using NumberContext.getGeneral(12); as the default value for > tmpModel.options.problem breaks a number of other test cases... > > > > > > /Anders > > > > > > On 8 apr 2013, at 18:02, Jeff Sherman <jef...@gm...> wrote: > > > > > Anders, > > > Please disregard the previous attachment and run this one. Also, on > one run i got these results: > > > Obj val: 5250.000000000088 > > > Optimal: true > > > All vars: > > > x1 = 5.25E+3 > > > x2013 = 1244 > > > x2014 = 1269 > > > x2015 = 1308 > > > > > > > > > On Mon, Apr 8, 2013 at 11:52 AM, Jeff Sherman <jef...@gm...> > wrote: > > > Andres, > > > Thanks for your response. The attached code produces the following > results: > > > x1 = 0 > > > x2013 = 1245 > > > x2014 = 1269.9 > > > x2015 = 1306.1 > > > > > > Note that x2014 and x2015 are set as integral variables. > > > > > > If in the calls to model.addExpression, i change the strings that are > passed in, I can also obtain the following results: > > > x1 = 2890.64039409 > > > x2013 = 1244 > > > x2014 = 1269.45812808 > > > x2015 = 1307.54187192 > > > > > > I did some looking into the code and I noticed in the > ExpressionsBasedModel class you have: > > > > > > private final HashMap<String, Expression> myExpressions = new > HashMap<String, Expression>(); > > > > > > and at points, you get a collection of myExpression.values(), the > order of which is not guaranteed. I'm not sure if you care about this > ordering but i thought id point it out in case. > > > > > > The correct results for the problem are: > > > x1 = 4849.999999997941 > > > x2013 = 1245 > > > x2014 = 1269 > > > x2015 = 1307 > > > > > > Please let me know if I can provide any additional information or > clarification. > > > > > > Best, > > > Jeff > > > > > > > > > > > > On Mon, Apr 8, 2013 at 5:22 AM, Anders Peterson <an...@op...> > wrote: > > > ...and please experiment with different values on the various > model/solver options - in particular tmpYourModel.options..problem > > > > > > /Anders > > > > > > > > > On 8 apr 2013, at 08:58, Anders Peterson <an...@op...> wrote: > > > > > > > It's better you send me source code that I can execute and use as a > test case. /Anders > > > > > > > > On 8 apr 2013, at 01:25, Jeff Sherman <jef...@gm...> > wrote: > > > > > > > >> When I execute the following program: > > > >> Minimize > > > >> 1*x1 > > > >> Subject To > > > >> 1*x2013 >= 0 > > > >> 1*x2014 >= 0 > > > >> 1*x1 >= 0 > > > >> -5000.0*x2014 + 5100.0*x2013 + -1.0*x1 <= 0 > > > >> -5000.0*x2014 + 5100.0*x2013 + 1.0*x1 >= 0 > > > >> 5000*x2013 + 5000*x2014 = 19105000 > > > >> Bounds > > > >> Variables > > > >> x2014 integer > > > >> x2013 integer > > > >> x1 continuous > > > >> > > > >> I get these results which are suboptimal: > > > >> x1 = 5899.999999996906 > > > >> x2013 = 1891 > > > >> x2014 = 1930 > > > >> > > > >> Or these results (which seem to occur at random): > > > >> x1 = Infinity > > > >> x2013 = 0 > > > >> x2014 = 0 > > > >> > > > >> Using another solver, I obtain: > > > >> x1 = 4200.000000000075 > > > >> x2013 = 1892 > > > >> x2014 = 1929 > > > >> > ------------------------------------------------------------------------------ > > > >> Minimize network downtime and maximize team effectiveness. > > > >> Reduce network management and security costs.Learn how to hire > > > >> the most talented Cisco Certified professionals. Visit the > > > >> Employer Resources Portal > > > >> > http://www.cisco.com/web/learning/employer_resources/index.html_______________________________________________ > > > >> ojAlgo-user mailing list > > > >> ojA...@li... > > > >> https://lists.sourceforge.net/lists/listinfo/ojalgo-user > > > > > > > > > > > > > ------------------------------------------------------------------------------ > > > > Minimize network downtime and maximize team effectiveness. > > > > Reduce network management and security costs.Learn how to hire > > > > the most talented Cisco Certified professionals. Visit the > > > > Employer Resources Portal > > > > http://www.cisco.com/web/learning/employer_resources/index.html > > > > _______________________________________________ > > > > ojAlgo-user mailing list > > > > ojA...@li... > > > > https://lists.sourceforge.net/lists/listinfo/ojalgo-user > > > > > > > > > > > > > > > > > > ------------------------------------------------------------------------------ > > > Minimize network downtime and maximize team effectiveness. > > > Reduce network management and security costs.Learn how to hire > > > the most talented Cisco Certified professionals. Visit the > > > Employer Resources Portal > > > http://www.cisco.com/web/learning/employer_resources/index.html > > > _______________________________________________ > > > ojAlgo-user mailing list > > > ojAlgo-user@lists..sourceforge.net > > > https://lists.sourceforge.net/lists/listinfo/ojalgo-user > > > > > > > > > > <TestILP.java>------------------------------------------------------------------------------ > > > Minimize network downtime and maximize team effectiveness. > > > Reduce network management and security costs.Learn how to hire > > > the most talented Cisco Certified professionals. Visit the > > > Employer Resources Portal > > > > http://www.cisco.com/web/learning/employer_resources/index.html_______________________________________________ > > > ojAlgo-user mailing list > > > ojAlgo-user@lists..sourceforge.net > > > https://lists.sourceforge.net/lists/listinfo/ojalgo-user > > > > > > > ------------------------------------------------------------------------------ > > Precog is a next-generation analytics platform capable of advanced > > analytics on semi-structured data. The platform includes APIs for > building > > apps and a phenomenal toolset for data science. Developers can use > > our toolset for easy data analysis & visualization. Get a free account! > > http://www2.precog.com/precogplatform/slashdotnewsletter > > _______________________________________________ > > ojAlgo-user mailing list > > ojA...@li... > > https://lists.sourceforge.net/lists/listinfo/ojalgo-user > > > > > ------------------------------------------------------------------------------ > > Precog is a next-generation analytics platform capable of advanced > > analytics on semi-structured data. The platform includes APIs for > building > > apps and a phenomenal toolset for data science. Developers can use > > our toolset for easy data analysis & visualization. Get a free account! > > > http://www2.precog.com/precogplatform/slashdotnewsletter_______________________________________________ > > ojAlgo-user mailing list > > ojA...@li... > > https://lists.sourceforge.net/lists/listinfo/ojalgo-user > > > > ------------------------------------------------------------------------------ > Precog is a next-generation analytics platform capable of advanced > analytics on semi-structured data. The platform includes APIs for building > apps and a phenomenal toolset for data science. Developers can use > our toolset for easy data analysis & visualization. Get a free account! > http://www2.precog.com/precogplatform/slashdotnewsletter > _______________________________________________ > ojAlgo-user mailing list > ojA...@li... > https://lists.sourceforge.net/lists/listinfo/ojalgo-user > |
From: Anders P. <an...@op...> - 2013-04-11 14:31:41
|
I just check the state the way you do... model.options.problem = NumberContext.getGeneral(8); ==>> FAILED Infinity @ { 0.0, 0.0, 0.0, 0.0 } model.options.problem = NumberContext.getGeneral(9); ==>> OPTIMAL 4849.999999999305 @ { 4849.999999999305, 1244.9999999999998, 1269.0000000000002, 1307.0 } model.options.problem = NumberContext.getGeneral(12); ==>> FEASIBLE 4849.999999999305 @ { 4849.999999999305, 1244.9999999999998, 1269.0000000000002, 1307.0 } Changing from 9 to 12 causes some LP subproblem to fail. The MIP solver detects this, and therefore is not certain if the feasible solution it did find is optimal or not. Thus it marks it feasible rather than optimal. I don't consider the fact that you have to adjust some options to get the solver to function properly in some cases a bug. The way the LP fails with the "12" - it actually returns an infeasible solution - is a bug. /Anders On 11 apr 2013, at 15:47, Jeff Sherman <jef...@gm...> wrote: > Thanks for looking into this. I dont require anywhere near 16 digit accuracy on x1. In fact, I'm really only interested in the values of the integral variables. On the test case i sent you, I added the following: > > model.options.problem = NumberContext.getGeneral(9); > > and I get this output which is "correct". > > Obj val: 4849.999999999305 > Optimal: true > All vars: > x1 = 4.85E+3 > x2013 = 1245 > x2014 = 1269 > x2015 = 1307 > > The "Optimal: true" output comes from: > res.getState().isOptimal() > > which doesn't seem to coincide with your results...how are you determining that you get a FEASIBLE, rather than OPTIMAL result? > > > > On Thu, Apr 11, 2013 at 5:57 AM, Anders Peterson <an...@op...> wrote: > I've run this test case, and I've created another using the model description from your first message. > > By setting > > tmpModel.options.problem = NumberContext.getGeneral(12); > > I can get correct (but maybe not accurate enough) solutions to both models: > > OPTIMAL 4199.999999999861 @ { 4199.999999999861, 1891.9999999999998, 1929.0 } > FEASIBLE 4849.999999999305 @ { 4849.999999999305, 1244.9999999999998, 1269.0000000000002, 1307.0 } > > > With the first model description you sent in you stated the correct solution to be: > x1 = 4200.000000000075 > x2013 = 1892 > x2014 = 1929 > > Do you really require full 16 digit accuracy on x1? > > > With the second model something does go wrong with the linear solver in one of the integer solver's nodes (subproblems). That's why the result has state FEASIBLE rather than OPTIMAL. The fact that the returned feasible solution actually happens to be the correct/optimal solution is a coincidence. That problem with the linear solver is a bug - it somehow returns an infeasible solution. I'll look in to this further. > > > Using NumberContext.getGeneral(12); as the default value for tmpModel.options.problem breaks a number of other test cases... > > > /Anders > > > On 8 apr 2013, at 18:02, Jeff Sherman <jef...@gm...> wrote: > > > Anders, > > Please disregard the previous attachment and run this one. Also, on one run i got these results: > > Obj val: 5250.000000000088 > > Optimal: true > > All vars: > > x1 = 5.25E+3 > > x2013 = 1244 > > x2014 = 1269 > > x2015 = 1308 > > > > > > On Mon, Apr 8, 2013 at 11:52 AM, Jeff Sherman <jef...@gm...> wrote: > > Andres, > > Thanks for your response. The attached code produces the following results: > > x1 = 0 > > x2013 = 1245 > > x2014 = 1269.9 > > x2015 = 1306.1 > > > > Note that x2014 and x2015 are set as integral variables. > > > > If in the calls to model.addExpression, i change the strings that are passed in, I can also obtain the following results: > > x1 = 2890.64039409 > > x2013 = 1244 > > x2014 = 1269.45812808 > > x2015 = 1307.54187192 > > > > I did some looking into the code and I noticed in the ExpressionsBasedModel class you have: > > > > private final HashMap<String, Expression> myExpressions = new HashMap<String, Expression>(); > > > > and at points, you get a collection of myExpression.values(), the order of which is not guaranteed. I'm not sure if you care about this ordering but i thought id point it out in case. > > > > The correct results for the problem are: > > x1 = 4849.999999997941 > > x2013 = 1245 > > x2014 = 1269 > > x2015 = 1307 > > > > Please let me know if I can provide any additional information or clarification. > > > > Best, > > Jeff > > > > > > > > On Mon, Apr 8, 2013 at 5:22 AM, Anders Peterson <an...@op...> wrote: > > ...and please experiment with different values on the various model/solver options - in particular tmpYourModel.options..problem > > > > /Anders > > > > > > On 8 apr 2013, at 08:58, Anders Peterson <an...@op...> wrote: > > > > > It's better you send me source code that I can execute and use as a test case. /Anders > > > > > > On 8 apr 2013, at 01:25, Jeff Sherman <jef...@gm...> wrote: > > > > > >> When I execute the following program: > > >> Minimize > > >> 1*x1 > > >> Subject To > > >> 1*x2013 >= 0 > > >> 1*x2014 >= 0 > > >> 1*x1 >= 0 > > >> -5000.0*x2014 + 5100.0*x2013 + -1.0*x1 <= 0 > > >> -5000.0*x2014 + 5100.0*x2013 + 1.0*x1 >= 0 > > >> 5000*x2013 + 5000*x2014 = 19105000 > > >> Bounds > > >> Variables > > >> x2014 integer > > >> x2013 integer > > >> x1 continuous > > >> > > >> I get these results which are suboptimal: > > >> x1 = 5899.999999996906 > > >> x2013 = 1891 > > >> x2014 = 1930 > > >> > > >> Or these results (which seem to occur at random): > > >> x1 = Infinity > > >> x2013 = 0 > > >> x2014 = 0 > > >> > > >> Using another solver, I obtain: > > >> x1 = 4200.000000000075 > > >> x2013 = 1892 > > >> x2014 = 1929 > > >> ------------------------------------------------------------------------------ > > >> Minimize network downtime and maximize team effectiveness. > > >> Reduce network management and security costs.Learn how to hire > > >> the most talented Cisco Certified professionals. Visit the > > >> Employer Resources Portal > > >> http://www.cisco.com/web/learning/employer_resources/index.html_______________________________________________ > > >> ojAlgo-user mailing list > > >> ojA...@li... > > >> https://lists.sourceforge.net/lists/listinfo/ojalgo-user > > > > > > > > > ------------------------------------------------------------------------------ > > > Minimize network downtime and maximize team effectiveness. > > > Reduce network management and security costs.Learn how to hire > > > the most talented Cisco Certified professionals. Visit the > > > Employer Resources Portal > > > http://www.cisco.com/web/learning/employer_resources/index.html > > > _______________________________________________ > > > ojAlgo-user mailing list > > > ojA...@li... > > > https://lists.sourceforge.net/lists/listinfo/ojalgo-user > > > > > > > > > > > > ------------------------------------------------------------------------------ > > Minimize network downtime and maximize team effectiveness. > > Reduce network management and security costs.Learn how to hire > > the most talented Cisco Certified professionals. Visit the > > Employer Resources Portal > > http://www.cisco.com/web/learning/employer_resources/index.html > > _______________________________________________ > > ojAlgo-user mailing list > > ojAlgo-user@lists..sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/ojalgo-user > > > > > > <TestILP.java>------------------------------------------------------------------------------ > > Minimize network downtime and maximize team effectiveness. > > Reduce network management and security costs.Learn how to hire > > the most talented Cisco Certified professionals. Visit the > > Employer Resources Portal > > http://www.cisco.com/web/learning/employer_resources/index.html_______________________________________________ > > ojAlgo-user mailing list > > ojAlgo-user@lists..sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/ojalgo-user > > > ------------------------------------------------------------------------------ > Precog is a next-generation analytics platform capable of advanced > analytics on semi-structured data. The platform includes APIs for building > apps and a phenomenal toolset for data science. Developers can use > our toolset for easy data analysis & visualization. Get a free account! > http://www2.precog.com/precogplatform/slashdotnewsletter > _______________________________________________ > ojAlgo-user mailing list > ojA...@li... > https://lists.sourceforge.net/lists/listinfo/ojalgo-user > > ------------------------------------------------------------------------------ > Precog is a next-generation analytics platform capable of advanced > analytics on semi-structured data. The platform includes APIs for building > apps and a phenomenal toolset for data science. Developers can use > our toolset for easy data analysis & visualization. Get a free account! > http://www2.precog.com/precogplatform/slashdotnewsletter_______________________________________________ > ojAlgo-user mailing list > ojA...@li... > https://lists.sourceforge.net/lists/listinfo/ojalgo-user |