ojalgo-user Mailing List for oj! Algorithms (Page 12)
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: Jeff S. <jef...@gm...> - 2013-04-11 13:47:25
|
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 > > ojA...@li... > > 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 > > 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 09:57:31
|
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 > ojA...@li... > 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 > ojA...@li... > https://lists.sourceforge.net/lists/listinfo/ojalgo-user |
From: Anders P. <an...@op...> - 2013-04-09 08:55:56
|
One or two months ago there was another problem report regarding the IntegerSolver returning non-integer solutions. That took me a long time to find/fix. The main problem was actually with the LinearSolver, and I believe it's the same here. I'm a little short on time these days. This wont be a quick fix. If you want to try to debug the problem here's a few pointers: 1) To log debug info call tmpModel.options.debug(LinearSolver.class); specifying which solver class/implementation you want to debug. 2) Experiment with different values on the various options in tmpModel.options and tmpModel.options.problem in particular. 3) The method SimplexTableauSolver#findNextPivotRow() is a very likely culprit. 4) The IntegerSolver is multithreaded. To get log statement from one subproblem at the time set a breakpoint at the very beginning of the IntegerSolver.BranchAndBoundNodeTask#compute() method. /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 > ojA...@li... > 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 > ojA...@li... > https://lists.sourceforge.net/lists/listinfo/ojalgo-user |
From: Anders P. <an...@op...> - 2013-04-08 09:23:02
|
...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 > > |
From: Anders P. <an...@op...> - 2013-04-08 06:58:55
|
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 |
From: Jeff S. <jef...@gm...> - 2013-04-07 23:25:51
|
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 |
From: Anders P. <an...@op...> - 2013-04-04 20:30:08
|
The covariance matrix is not symmetric positive semidefinite. Eigenvalues: [(0.4906530283552536 + 0.0i), (0.015721604173945955 + 0.0i), (0.010461976347998022 + 0.0i), (0.00722515181081578 + 0.0i), (0.0052806179437730125 + 0.0i), (0.004434033531049306 + 0.0i), (0.06071148162510361 + 0.0i), (0.05520353517789536 + 0.0i), (0.03098136247025044 + 0.0i), (0.024699548816013137 + 0.0i), (-0.007604829902151985 + 0.0i), (0.0010364796500534224 + 0.0i), (0.0 + 0.0i)] If you want you can try calling: marketEquilibrium.clean(); /Anders On 4 apr 2013, at 16:15, Matteo Baccan <mat...@gm...> wrote: > Hi > > we have a second problem with MarkowitzModel. > I have produced a little source that explain the problem. > > The problem is similar with the previous: 3 different TargetReturn 2 ok and 1 ko- > > This is the source that reproduce the problem > > ---------8<--------------8<--------------8<--------------8<--------------8<----- > //package org.ojalgo.finance.portfolio; > > import java.math.BigDecimal; > import java.util.List; > > import org.ojalgo.matrix.BasicMatrix; > import org.ojalgo.matrix.BigMatrix; > import org.ojalgo.matrix.store.BigDenseStore; > import org.ojalgo.matrix.store.MatrixStore; > import org.ojalgo.optimisation.Optimisation.State; > > import org.ojalgo.finance.portfolio.MarketEquilibrium; > import org.ojalgo.finance.portfolio.MarkowitzModel; > > public class MarkowitzProblems2 { > > public static void main(final String[] args) { > > //BigDecimal nTarget = new BigDecimal("0.07"); // OK > //0.0401 > //0.0 > //0.0 > //0.0 > //0.0239 > //0.0 > //0.0051 > //0.0 > //0.5305 > //0.1669 > //0.0 > //0.0335 > //0.2 > > BigDecimal nTarget = new BigDecimal("0.08"); // ERROR > // 0.0828 > // 0.0164 > // 0.0 > // 0.0 > // 0.0501 > // 0.0 > // -0.0396 -> Out of Weight Range > // 0.0 > // 0.5876 > // 0.1908 > // -0.0049 -> Out of Weight Range > // 0.0 > // 0.1169 > > //BigDecimal nTarget = new BigDecimal("0.09"); // OK > //0.0788 > //0.0045 > //0.0 > //0.0 > //0.0 > //0.0 > //0.0711 > //0.0 > //0.6272 > //0.1628 > //0.0057 > //0.0 > //0.05 > > final double[][] cm= > {{0.04206601, 0.044550845724, 0.048217369200, 0.054350966740, 0.022460320512, 0.055208551370, 0.034165558000, 0.029414658518, -0.000907567500, -0.003266560017, 0.011408652633, 0.007174996892, 0}, > {0.044550845724, 0.06796449, 0.063983606214, 0.072022499274, 0.032393205504, 0.085397746665, 0.046597518000, 0.040498055664, -0.001203130500, -0.003712871151, 0.016252486404, 0..008933472075, 0}, > {0.048217369200, 0.063983606214, 0.09084196, 0.096768635348, 0.043186328064, 0.083969449256, 0.054541344000, 0.049330020454, -0.001261359000, -0.004770776208, 0.023684614800, 0.016492134802, 0}, > {0.054350966740, 0.072022499274, 0.096768635348, 0.11874916, 0.039110390784, 0.091360338216, 0.058037532000, 0.051565647644, -0.001011401000, -0.004914519792, 0.024900113692, 0..014709412962, 0}, > {0.022460320512, 0.032393205504, 0.043186328064, 0.039110390784, 0.05308416, 0.064832995584, 0.040674816000, 0.041904582912, -0.001357056000, -0.003786856704, 0.018876923136, 0.017478379008, 0}, > {0.055208551370, 0.085397746665, 0.083969449256, 0.091360338216, 0.064832995584, 0.14661241, 0.060023404000, 0.054428675966, -0.000761971000, -0.004890659172, 0.020088021436, 0..009159105844, 0}, > {0.034165558000, 0.046597518000, 0.054541344000, 0.058037532000, 0.040674816000, 0.060023404000, 0.04000000, 0.030711460000, -0.001110000000, -0.003517058000, 0.013415070000, 0.007178534000, 0}, > {0.029414658518, 0.040498055664, 0.049330020454, 0.051565647644, 0.041904582912, 0.054428675966, 0.030711460000, 0.08300161, 0.000404780500, -0.001591573878, 0.020639653979, 0.010983694379, 0}, > {-0.000907567500, -0.001203130500, -0.001261359000, -0.001011401000, -0.001357056000, -0.000761971000, -0.001110000000, 0.000404780500, 0.00250000, 0.002084702500, 0.000854111500, 0.000385734000, 0}, > {-0.003266560017, -0.003712871151, -0.004770776208, -0.004914519792, -0.003786856704, -0.004890659172, -0.003517058000, -0.001591573878, 0.002084702500, 0.00426409, 0.000608437974, 0.001034468234, 0}, > {0.011408652633, 0.016252486404, 0.023684614800, 0.024900113692, 0.018876923136, 0.020088021436, 0.013415070000, 0.020639653979, 0.000854111500, 0.000608437974, 0.03500641, 0.003756060565, 0}, > {0.007174996892, 0.008933472075, 0.016492134802, 0.014709412962, 0.017478379008, 0.009159105844, 0.007178534000, 0.010983694379, 0.000385734000, 0.001034468234, 0.003756060565, 0.01471369, 0}, > {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}} > ; > > final int assetNum = cm.length; > > final int row = cm.length; > if (row > 0) { > final int col = cm[0].length; > final MatrixStore<BigDecimal> a = BigDenseStore.FACTORY.makeZero(row, col); > BasicMatrix covariances = BigMatrix.FACTORY.copy(a); > > for (int i = 0; i < row; i++) { > for (int j = 0; j < col; j++) { > covariances = covariances.replace(i, j, cm[i][j]); > } > } > > final double nRisk = 1000.0; > final BigDecimal riskAversion = new BigDecimal(nRisk); > final MarketEquilibrium marketEquilibrium = new MarketEquilibrium(covariances, riskAversion); > > final MatrixStore<BigDecimal> ret_matrix = BigDenseStore.FACTORY.makeZero(assetNum, 1); > BasicMatrix expectedExcessReturns1 = BigMatrix.FACTORY.copy(ret_matrix); > > expectedExcessReturns1 = expectedExcessReturns1.replace(0, 0, 0.1389); > expectedExcessReturns1 = expectedExcessReturns1.replace(1, 0, 0.1545); > expectedExcessReturns1 = expectedExcessReturns1.replace(2, 0, 0.0736); > expectedExcessReturns1 = expectedExcessReturns1.replace(3, 0, 0.0648); > expectedExcessReturns1 = expectedExcessReturns1.replace(4, 0, 0.0915); > expectedExcessReturns1 = expectedExcessReturns1.replace(5, 0, 0.1802); > expectedExcessReturns1 = expectedExcessReturns1.replace(6, 0, 0.1331); > expectedExcessReturns1 = expectedExcessReturns1.replace(7, 0, 0.0816); > expectedExcessReturns1 = expectedExcessReturns1.replace(8, 0, 0.0874); > expectedExcessReturns1 = expectedExcessReturns1.replace(9, 0, 0.0829); > expectedExcessReturns1 = expectedExcessReturns1.replace(10, 0, 0.1038); > expectedExcessReturns1 = expectedExcessReturns1.replace(11, 0, 0.0759); > expectedExcessReturns1 = expectedExcessReturns1.replace(12, 0, 0.0000); > > final MarkowitzModel markowitzModel = new MarkowitzModel(marketEquilibrium, expectedExcessReturns1); > > markowitzModel.setLowerLimit(0, new BigDecimal(0.0000)); > markowitzModel.setUpperLimit(0, new BigDecimal(1.0000)); > markowitzModel.setLowerLimit(1, new BigDecimal(0.0000)); > markowitzModel.setUpperLimit(1, new BigDecimal(1.0000)); > markowitzModel.setLowerLimit(2, new BigDecimal(0.0000)); > markowitzModel.setUpperLimit(2, new BigDecimal(1.0000)); > markowitzModel.setLowerLimit(3, new BigDecimal(0.0000)); > markowitzModel.setUpperLimit(3, new BigDecimal(1.0000)); > markowitzModel.setLowerLimit(4, new BigDecimal(0.0000)); > markowitzModel.setUpperLimit(4, new BigDecimal(1.0000)); > markowitzModel.setLowerLimit(5, new BigDecimal(0.0000)); > markowitzModel.setUpperLimit(5, new BigDecimal(1.0000)); > markowitzModel.setLowerLimit(6, new BigDecimal(0.0000)); > markowitzModel.setUpperLimit(6, new BigDecimal(1.0000)); > markowitzModel.setLowerLimit(7, new BigDecimal(0.0000)); > markowitzModel.setUpperLimit(7, new BigDecimal(1.0000)); > markowitzModel.setLowerLimit(8, new BigDecimal(0.0000)); > markowitzModel.setUpperLimit(8, new BigDecimal(1.0000)); > markowitzModel.setLowerLimit(9, new BigDecimal(0.0000)); > markowitzModel.setUpperLimit(9, new BigDecimal(1.0000)); > markowitzModel.setLowerLimit(10, new BigDecimal(0.0000)); > markowitzModel.setUpperLimit(10, new BigDecimal(1.0000)); > markowitzModel.setLowerLimit(11, new BigDecimal(0.0000)); > markowitzModel.setUpperLimit(11, new BigDecimal(1.0000)); > markowitzModel.setLowerLimit(12, new BigDecimal(0.0500)); > markowitzModel.setUpperLimit(12, new BigDecimal(0.2000)); > > final boolean bShort = false; > markowitzModel.setShortingAllowed(bShort); > markowitzModel.setTargetReturn(nTarget); > > final List<BigDecimal> re = markowitzModel.getWeights(); > > final State tmpOptState = markowitzModel.getOptimisationState(); > > for (int nn = 0; nn < re.size(); nn++) { > System.out.println(re.get(nn)); > } > } > } > > } > ---------8<--------------8<--------------8<--------------8<--------------8<----- > > > > All the best > Matteo Baccan > > > > -- > Matteo Baccan > http://www.baccan.it > http://www.moonlab.it > http://www.jobcrawler.it > http://www.paginelibere.it > http://www.cvcrawler.it > http://www.newscrawler.it > http://casa.newscrawler.it > http://www.autocrawler.it > http://www.annunciveloci.it > ------------------------------------------------------------------------------ > 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 |
From: Matteo B. <mat...@gm...> - 2013-04-04 14:16:30
|
Hi we have a second problem with MarkowitzModel. I have produced a little source that explain the problem. The problem is similar with the previous: 3 different TargetReturn 2 ok and 1 ko- This is the source that reproduce the problem ---------8<--------------8<--------------8<--------------8<--------------8<----- //package org.ojalgo.finance.portfolio; import java.math.BigDecimal; import java.util.List; import org.ojalgo.matrix.BasicMatrix; import org.ojalgo.matrix.BigMatrix; import org.ojalgo.matrix.store.BigDenseStore; import org.ojalgo.matrix.store.MatrixStore; import org.ojalgo.optimisation.Optimisation.State; import org.ojalgo.finance.portfolio.MarketEquilibrium; import org.ojalgo.finance.portfolio.MarkowitzModel; public class MarkowitzProblems2 { public static void main(final String[] args) { //BigDecimal nTarget = new BigDecimal("0.07"); // OK //0.0401 //0.0 //0.0 //0.0 //0.0239 //0.0 //0.0051 //0.0 //0.5305 //0.1669 //0.0 //0.0335 //0.2 BigDecimal nTarget = new BigDecimal("0.08"); // ERROR // 0.0828 // 0.0164 // 0.0 // 0.0 // 0.0501 // 0.0 // -0.0396 -> Out of Weight Range // 0.0 // 0.5876 // 0.1908 // -0.0049 -> Out of Weight Range // 0.0 // 0.1169 //BigDecimal nTarget = new BigDecimal("0.09"); // OK //0.0788 //0.0045 //0.0 //0.0 //0.0 //0.0 //0.0711 //0.0 //0.6272 //0.1628 //0.0057 //0.0 //0.05 final double[][] cm= {{0.04206601, 0.044550845724, 0.048217369200, 0.054350966740, 0.022460320512, 0.055208551370, 0.034165558000, 0.029414658518, -0.000907567500, -0.003266560017, 0.011408652633, 0.007174996892, 0}, {0.044550845724, 0.06796449, 0.063983606214, 0.072022499274, 0.032393205504, 0.085397746665, 0.046597518000, 0.040498055664, -0.001203130500, -0.003712871151, 0.016252486404, 0.008933472075, 0}, {0.048217369200, 0.063983606214, 0.09084196, 0.096768635348, 0.043186328064, 0.083969449256, 0.054541344000, 0.049330020454, -0.001261359000, -0.004770776208, 0.023684614800, 0.016492134802, 0}, {0.054350966740, 0.072022499274, 0.096768635348, 0.11874916, 0.039110390784, 0.091360338216, 0.058037532000, 0.051565647644, -0.001011401000, -0.004914519792, 0.024900113692, 0.014709412962, 0}, {0.022460320512, 0.032393205504, 0.043186328064, 0.039110390784, 0.05308416, 0.064832995584, 0.040674816000, 0.041904582912, -0.001357056000, -0.003786856704, 0.018876923136, 0.017478379008, 0}, {0.055208551370, 0.085397746665, 0.083969449256, 0.091360338216, 0.064832995584, 0.14661241, 0.060023404000, 0.054428675966, -0.000761971000, -0.004890659172, 0.020088021436, 0.009159105844, 0}, {0.034165558000, 0.046597518000, 0.054541344000, 0.058037532000, 0.040674816000, 0.060023404000, 0.04000000, 0.030711460000, -0.001110000000, -0.003517058000, 0.013415070000, 0.007178534000, 0}, {0.029414658518, 0.040498055664, 0.049330020454, 0.051565647644, 0.041904582912, 0.054428675966, 0.030711460000, 0.08300161, 0.000404780500, -0.001591573878, 0.020639653979, 0.010983694379, 0}, {-0.000907567500, -0.001203130500, -0.001261359000, -0.001011401000, -0.001357056000, -0.000761971000, -0.001110000000, 0.000404780500, 0.00250000, 0.002084702500, 0.000854111500, 0.000385734000, 0}, {-0.003266560017, -0.003712871151, -0.004770776208, -0.004914519792, -0.003786856704, -0.004890659172, -0.003517058000, -0.001591573878, 0.002084702500, 0.00426409, 0.000608437974, 0.001034468234, 0}, {0.011408652633, 0.016252486404, 0.023684614800, 0.024900113692, 0.018876923136, 0.020088021436, 0.013415070000, 0.020639653979, 0.000854111500, 0.000608437974, 0.03500641, 0.003756060565, 0}, {0.007174996892, 0.008933472075, 0.016492134802, 0.014709412962, 0.017478379008, 0.009159105844, 0.007178534000, 0.010983694379, 0.000385734000, 0.001034468234, 0.003756060565, 0.01471369, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}} ; final int assetNum = cm.length; final int row = cm.length; if (row > 0) { final int col = cm[0].length; final MatrixStore<BigDecimal> a = BigDenseStore.FACTORY.makeZero(row, col); BasicMatrix covariances = BigMatrix.FACTORY.copy(a); for (int i = 0; i < row; i++) { for (int j = 0; j < col; j++) { covariances = covariances.replace(i, j, cm[i][j]); } } final double nRisk = 1000.0; final BigDecimal riskAversion = new BigDecimal(nRisk); final MarketEquilibrium marketEquilibrium = new MarketEquilibrium(covariances, riskAversion); final MatrixStore<BigDecimal> ret_matrix = BigDenseStore.FACTORY.makeZero(assetNum, 1); BasicMatrix expectedExcessReturns1 = BigMatrix.FACTORY.copy(ret_matrix); expectedExcessReturns1 = expectedExcessReturns1.replace(0, 0, 0.1389); expectedExcessReturns1 = expectedExcessReturns1.replace(1, 0, 0.1545); expectedExcessReturns1 = expectedExcessReturns1.replace(2, 0, 0.0736); expectedExcessReturns1 = expectedExcessReturns1.replace(3, 0, 0.0648); expectedExcessReturns1 = expectedExcessReturns1.replace(4, 0, 0.0915); expectedExcessReturns1 = expectedExcessReturns1.replace(5, 0, 0.1802); expectedExcessReturns1 = expectedExcessReturns1.replace(6, 0, 0.1331); expectedExcessReturns1 = expectedExcessReturns1.replace(7, 0, 0.0816); expectedExcessReturns1 = expectedExcessReturns1.replace(8, 0, 0.0874); expectedExcessReturns1 = expectedExcessReturns1.replace(9, 0, 0.0829); expectedExcessReturns1 = expectedExcessReturns1.replace(10, 0, 0.1038); expectedExcessReturns1 = expectedExcessReturns1.replace(11, 0, 0.0759); expectedExcessReturns1 = expectedExcessReturns1.replace(12, 0, 0.0000); final MarkowitzModel markowitzModel = new MarkowitzModel(marketEquilibrium, expectedExcessReturns1); markowitzModel.setLowerLimit(0, new BigDecimal(0.0000)); markowitzModel.setUpperLimit(0, new BigDecimal(1.0000)); markowitzModel.setLowerLimit(1, new BigDecimal(0.0000)); markowitzModel.setUpperLimit(1, new BigDecimal(1.0000)); markowitzModel.setLowerLimit(2, new BigDecimal(0.0000)); markowitzModel.setUpperLimit(2, new BigDecimal(1.0000)); markowitzModel.setLowerLimit(3, new BigDecimal(0.0000)); markowitzModel.setUpperLimit(3, new BigDecimal(1.0000)); markowitzModel.setLowerLimit(4, new BigDecimal(0.0000)); markowitzModel.setUpperLimit(4, new BigDecimal(1.0000)); markowitzModel.setLowerLimit(5, new BigDecimal(0.0000)); markowitzModel.setUpperLimit(5, new BigDecimal(1.0000)); markowitzModel.setLowerLimit(6, new BigDecimal(0.0000)); markowitzModel.setUpperLimit(6, new BigDecimal(1.0000)); markowitzModel.setLowerLimit(7, new BigDecimal(0.0000)); markowitzModel.setUpperLimit(7, new BigDecimal(1.0000)); markowitzModel.setLowerLimit(8, new BigDecimal(0.0000)); markowitzModel.setUpperLimit(8, new BigDecimal(1.0000)); markowitzModel.setLowerLimit(9, new BigDecimal(0.0000)); markowitzModel.setUpperLimit(9, new BigDecimal(1.0000)); markowitzModel.setLowerLimit(10, new BigDecimal(0.0000)); markowitzModel.setUpperLimit(10, new BigDecimal(1.0000)); markowitzModel.setLowerLimit(11, new BigDecimal(0.0000)); markowitzModel.setUpperLimit(11, new BigDecimal(1.0000)); markowitzModel.setLowerLimit(12, new BigDecimal(0.0500)); markowitzModel.setUpperLimit(12, new BigDecimal(0.2000)); final boolean bShort = false; markowitzModel.setShortingAllowed(bShort); markowitzModel.setTargetReturn(nTarget); final List<BigDecimal> re = markowitzModel.getWeights(); final State tmpOptState = markowitzModel.getOptimisationState(); for (int nn = 0; nn < re.size(); nn++) { System.out.println(re.get(nn)); } } } } ---------8<--------------8<--------------8<--------------8<--------------8<----- All the best Matteo Baccan -- Matteo Baccan http://www.baccan.it http://www.moonlab.it http://www.jobcrawler.it http://www.paginelibere.it http://www.cvcrawler.it http://www.newscrawler.it http://casa.newscrawler.it http://www.autocrawler.it http://www.annunciveloci.it |
From: Anders P. <an...@op...> - 2013-04-03 11:05:08
|
ojAlgo is now on Google+ https://plus.google.com/b/117018788961284360300/117018788961284360300/posts /Anders |
From: Matteo B. <mat...@gm...> - 2013-04-02 15:09:28
|
Hi Anders now the results seem to be perfect. Very good job! I'll check some similar situation in next days and keep you informed if I'll find other problems. Thank you matteo On Tue, Apr 2, 2013 at 3:35 PM, Anders Peterson <an...@op...>wrote: > I've tweaked the underlying optimization algorithm so that it now produces > {0.5, 0.5} as the optimal solution for the case with target return 0.11. > > Your covariance matrix looks like this: > > 0.0036 0.0018 > 0.0018 0.0009 > > and thus the correlations matrix is: > > 1 1 > 1 1 > > Is this intended/expected? > > > /Anders > > > On 31 mar 2013, at 11:38, Anders Peterson <an...@op...> wrote: > > > Yes, ojAlgo seems to have a problem solving that. I'll have to look into > exactly what goes on. > > > > The covariance matrix is positive semidefinite, right? That should be > enough, but positive definite would be better. > > > > You should always check the optimisation state. In this case it is > APPROXIMATE. Suppose it should be FAILED or something, but anything less > that OPTIMAL would indicate a problem with the underlying optimisation > algorithm. > > > > Regarding how to create matrices; I think you should read this: > > http://code.google.com/p/ojalgo/wiki/GettingStartedLinearAlgebra > > > > /Anders > > > > > > On 29 mar 2013, at 13:19, Matteo Baccan <mat...@gm...> wrote: > > > >> Hi > >> > >> we have a problem with MarkowitzModel. > >> I have produced a little source that explain the problem. > >> > >> We have set 3 different TargetReturn on the same data.. > >> > >> With targets near to the best end worst target return, the > MarkowitzModel works fine. > >> With targets within the interval of best and worst return, seem that > the MarkowitzModel > >> is not able to find a correct list of weights. > >> > >> If you try this program and use target of 0.08 or 0.13 or 0.12 you can > see a correct solution. > >> With a target of 0.10 MarkowitzModel is not able to find a valid > solution. > >> > >> It's a OJAlgo bug or is a problem in my implementation? > >> > >> All the best > >> Matteo Baccan > >> > >> > >> > >> import java.math.BigDecimal; > >> import java.util.List; > >> > >> import org.ojalgo.access.AccessUtils; > >> import org.ojalgo.constant.BigMath; > >> import org.ojalgo.finance.portfolio.MarketEquilibrium; > >> import org.ojalgo.finance.portfolio.MarkowitzModel; > >> import org.ojalgo.matrix.BasicMatrix; > >> import org.ojalgo.matrix.BigMatrix; > >> import org.ojalgo.matrix.PrimitiveMatrix; > >> import org.ojalgo.matrix.store.BigDenseStore; > >> import org.ojalgo.matrix.store.MatrixStore; > >> import org.ojalgo.matrix.store.PrimitiveDenseStore; > >> import org.ojalgo.optimisation.Optimisation; > >> import org.ojalgo.optimisation.quadratic.QuadraticSolver; > >> > >> public class MarkowitzProblems > >> { > >> > >> public static void main(String[] args) > >> { > >> > >> //BigDecimal nTarget = new BigDecimal("0.08"); // OK > >> // 0.0 > >> // 1.0 > >> > >> BigDecimal nTarget = new BigDecimal("0.10"); // ERROR > >> // -0.9999 > >> // 1.9999 > >> > >> //BigDecimal nTarget = new BigDecimal("0.13"); // OK > >> // 0.8333 > >> // 0.1667 > >> > >> double[][] cm= > >> {{0.00360000, 0.001800000000}, > >> {0.001800000000, 0.00090000}} > >> ; > >> > >> int assetNum = cm.length; > >> > >> final int row = cm.length; > >> if (row > 0) { > >> final int col = cm[0].length; > >> final MatrixStore<BigDecimal> a = > BigDenseStore.FACTORY.makeZero(row, col); > >> BasicMatrix covariances = BigMatrix.FACTORY.copy(a); > >> > >> for (int i = 0; i < row; i++) { > >> for (int j = 0; j < col; j++) { > >> covariances = covariances.replace(i, j, cm[i][j]); > >> } > >> } > >> > >> double nRisk = 1000.0; > >> final BigDecimal riskAversion = new BigDecimal(nRisk); > >> final MarketEquilibrium marketEquilibrium = new > MarketEquilibrium(covariances, riskAversion); > >> > >> final MatrixStore<BigDecimal> ret_matrix = > BigDenseStore.FACTORY.makeZero(assetNum, 1); > >> BasicMatrix expectedExcessReturns1 = > BigMatrix.FACTORY.copy(ret_matrix); > >> > >> expectedExcessReturns1 = expectedExcessReturns1.replace(0, 0, 0.1400); > >> expectedExcessReturns1 = expectedExcessReturns1.replace(1, 0, 0.0800); > >> > >> final MarkowitzModel markowitzModel = new > MarkowitzModel(marketEquilibrium, expectedExcessReturns1); > >> > >> markowitzModel.setLowerLimit(0, new BigDecimal(0.0000)); > >> markowitzModel.setUpperLimit(0, new BigDecimal(1.0000)); > >> markowitzModel.setLowerLimit(1, new BigDecimal(0.0000)); > >> markowitzModel.setUpperLimit(1, new BigDecimal(1.0000)); > >> > >> boolean bShort = false; > >> markowitzModel.setShortingAllowed(bShort); > >> markowitzModel.setTargetReturn(nTarget); > >> > >> final List<BigDecimal> re = markowitzModel.getWeights(); > >> for (int nn = 0; nn < re.size(); nn++) { > >> System.out.println( re.get(nn) ); > >> } > >> } > >> } > >> > >> } > >> > >> > ------------------------------------------------------------------------------ > >> Own the Future-Intel(R) Level Up Game Demo Contest 2013 > >> Rise to greatness in Intel's independent game demo contest. Compete > >> for recognition, cash, and the chance to get your game on Steam. > >> $5K grand prize plus 10 genre and skill prizes. Submit your demo > >> by 6/6/13. > http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2_______________________________________________ > >> ojAlgo-user mailing list > >> ojA...@li... > >> https://lists.sourceforge.net/lists/listinfo/ojalgo-user > > > > > > > ------------------------------------------------------------------------------ > > Own the Future-Intel(R) Level Up Game Demo Contest 2013 > > Rise to greatness in Intel's independent game demo contest. Compete > > for recognition, cash, and the chance to get your game on Steam. > > $5K grand prize plus 10 genre and skill prizes. Submit your demo > > by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2 > > _______________________________________________ > > ojAlgo-user mailing list > > ojA...@li... > > https://lists.sourceforge.net/lists/listinfo/ojalgo-user > > > > > > > > ------------------------------------------------------------------------------ > Own the Future-Intel(R) Level Up Game Demo Contest 2013 > Rise to greatness in Intel's independent game demo contest. Compete > for recognition, cash, and the chance to get your game on Steam. > $5K grand prize plus 10 genre and skill prizes. Submit your demo > by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2 > _______________________________________________ > ojAlgo-user mailing list > ojA...@li... > https://lists.sourceforge.net/lists/listinfo/ojalgo-user > -- Matteo Baccan http://www.baccan.it http://www.moonlab.it http://www.jobcrawler.it http://www.paginelibere.it http://www.cvcrawler.it http://www.newscrawler.it http://casa.newscrawler.it http://www.autocrawler.it http://www.annunciveloci.it |
From: Anders P. <an...@op...> - 2013-04-02 13:35:23
|
I've tweaked the underlying optimization algorithm so that it now produces {0.5, 0.5} as the optimal solution for the case with target return 0.11. Your covariance matrix looks like this: 0.0036 0.0018 0.0018 0.0009 and thus the correlations matrix is: 1 1 1 1 Is this intended/expected? /Anders On 31 mar 2013, at 11:38, Anders Peterson <an...@op...> wrote: > Yes, ojAlgo seems to have a problem solving that. I'll have to look into exactly what goes on. > > The covariance matrix is positive semidefinite, right? That should be enough, but positive definite would be better. > > You should always check the optimisation state. In this case it is APPROXIMATE. Suppose it should be FAILED or something, but anything less that OPTIMAL would indicate a problem with the underlying optimisation algorithm. > > Regarding how to create matrices; I think you should read this: > http://code.google.com/p/ojalgo/wiki/GettingStartedLinearAlgebra > > /Anders > > > On 29 mar 2013, at 13:19, Matteo Baccan <mat...@gm...> wrote: > >> Hi >> >> we have a problem with MarkowitzModel. >> I have produced a little source that explain the problem. >> >> We have set 3 different TargetReturn on the same data.. >> >> With targets near to the best end worst target return, the MarkowitzModel works fine. >> With targets within the interval of best and worst return, seem that the MarkowitzModel >> is not able to find a correct list of weights. >> >> If you try this program and use target of 0.08 or 0.13 or 0.12 you can see a correct solution. >> With a target of 0.10 MarkowitzModel is not able to find a valid solution. >> >> It's a OJAlgo bug or is a problem in my implementation? >> >> All the best >> Matteo Baccan >> >> >> >> import java.math.BigDecimal; >> import java.util.List; >> >> import org.ojalgo.access.AccessUtils; >> import org.ojalgo.constant.BigMath; >> import org.ojalgo.finance.portfolio.MarketEquilibrium; >> import org.ojalgo.finance.portfolio.MarkowitzModel; >> import org.ojalgo.matrix.BasicMatrix; >> import org.ojalgo.matrix.BigMatrix; >> import org.ojalgo.matrix.PrimitiveMatrix; >> import org.ojalgo.matrix.store.BigDenseStore; >> import org.ojalgo.matrix.store.MatrixStore; >> import org.ojalgo.matrix.store.PrimitiveDenseStore; >> import org.ojalgo.optimisation.Optimisation; >> import org.ojalgo.optimisation.quadratic.QuadraticSolver; >> >> public class MarkowitzProblems >> { >> >> public static void main(String[] args) >> { >> >> //BigDecimal nTarget = new BigDecimal("0.08"); // OK >> // 0.0 >> // 1.0 >> >> BigDecimal nTarget = new BigDecimal("0.10"); // ERROR >> // -0.9999 >> // 1.9999 >> >> //BigDecimal nTarget = new BigDecimal("0.13"); // OK >> // 0.8333 >> // 0.1667 >> >> double[][] cm= >> {{0.00360000, 0.001800000000}, >> {0.001800000000, 0.00090000}} >> ; >> >> int assetNum = cm.length; >> >> final int row = cm.length; >> if (row > 0) { >> final int col = cm[0].length; >> final MatrixStore<BigDecimal> a = BigDenseStore.FACTORY.makeZero(row, col); >> BasicMatrix covariances = BigMatrix.FACTORY.copy(a); >> >> for (int i = 0; i < row; i++) { >> for (int j = 0; j < col; j++) { >> covariances = covariances.replace(i, j, cm[i][j]); >> } >> } >> >> double nRisk = 1000.0; >> final BigDecimal riskAversion = new BigDecimal(nRisk); >> final MarketEquilibrium marketEquilibrium = new MarketEquilibrium(covariances, riskAversion); >> >> final MatrixStore<BigDecimal> ret_matrix = BigDenseStore.FACTORY.makeZero(assetNum, 1); >> BasicMatrix expectedExcessReturns1 = BigMatrix.FACTORY.copy(ret_matrix); >> >> expectedExcessReturns1 = expectedExcessReturns1.replace(0, 0, 0.1400); >> expectedExcessReturns1 = expectedExcessReturns1.replace(1, 0, 0.0800); >> >> final MarkowitzModel markowitzModel = new MarkowitzModel(marketEquilibrium, expectedExcessReturns1); >> >> markowitzModel.setLowerLimit(0, new BigDecimal(0.0000)); >> markowitzModel.setUpperLimit(0, new BigDecimal(1.0000)); >> markowitzModel.setLowerLimit(1, new BigDecimal(0.0000)); >> markowitzModel.setUpperLimit(1, new BigDecimal(1.0000)); >> >> boolean bShort = false; >> markowitzModel.setShortingAllowed(bShort); >> markowitzModel.setTargetReturn(nTarget); >> >> final List<BigDecimal> re = markowitzModel.getWeights(); >> for (int nn = 0; nn < re.size(); nn++) { >> System.out.println( re.get(nn) ); >> } >> } >> } >> >> } >> >> ------------------------------------------------------------------------------ >> Own the Future-Intel(R) Level Up Game Demo Contest 2013 >> Rise to greatness in Intel's independent game demo contest. Compete >> for recognition, cash, and the chance to get your game on Steam. >> $5K grand prize plus 10 genre and skill prizes. Submit your demo >> by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2_______________________________________________ >> ojAlgo-user mailing list >> ojA...@li... >> https://lists.sourceforge.net/lists/listinfo/ojalgo-user > > > ------------------------------------------------------------------------------ > Own the Future-Intel(R) Level Up Game Demo Contest 2013 > Rise to greatness in Intel's independent game demo contest. Compete > for recognition, cash, and the chance to get your game on Steam. > $5K grand prize plus 10 genre and skill prizes. Submit your demo > by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2 > _______________________________________________ > ojAlgo-user mailing list > ojA...@li... > https://lists.sourceforge.net/lists/listinfo/ojalgo-user > > |
From: Anders P. <an...@op...> - 2013-03-31 09:38:57
|
Yes, ojAlgo seems to have a problem solving that. I'll have to look into exactly what goes on. The covariance matrix is positive semidefinite, right? That should be enough, but positive definite would be better. You should always check the optimisation state. In this case it is APPROXIMATE. Suppose it should be FAILED or something, but anything less that OPTIMAL would indicate a problem with the underlying optimisation algorithm. Regarding how to create matrices; I think you should read this: http://code.google.com/p/ojalgo/wiki/GettingStartedLinearAlgebra /Anders On 29 mar 2013, at 13:19, Matteo Baccan <mat...@gm...> wrote: > Hi > > we have a problem with MarkowitzModel. > I have produced a little source that explain the problem. > > We have set 3 different TargetReturn on the same data.. > > With targets near to the best end worst target return, the MarkowitzModel works fine. > With targets within the interval of best and worst return, seem that the MarkowitzModel > is not able to find a correct list of weights. > > If you try this program and use target of 0.08 or 0.13 or 0.12 you can see a correct solution. > With a target of 0.10 MarkowitzModel is not able to find a valid solution. > > It's a OJAlgo bug or is a problem in my implementation? > > All the best > Matteo Baccan > > > > import java.math.BigDecimal; > import java.util.List; > > import org.ojalgo.access.AccessUtils; > import org.ojalgo.constant.BigMath; > import org.ojalgo.finance.portfolio.MarketEquilibrium; > import org.ojalgo.finance.portfolio.MarkowitzModel; > import org.ojalgo.matrix.BasicMatrix; > import org.ojalgo.matrix.BigMatrix; > import org.ojalgo.matrix.PrimitiveMatrix; > import org.ojalgo.matrix.store.BigDenseStore; > import org.ojalgo.matrix.store.MatrixStore; > import org.ojalgo.matrix.store.PrimitiveDenseStore; > import org.ojalgo.optimisation.Optimisation; > import org.ojalgo.optimisation.quadratic.QuadraticSolver; > > public class MarkowitzProblems > { > > public static void main(String[] args) > { > > //BigDecimal nTarget = new BigDecimal("0.08"); // OK > // 0.0 > // 1.0 > > BigDecimal nTarget = new BigDecimal("0.10"); // ERROR > // -0.9999 > // 1.9999 > > //BigDecimal nTarget = new BigDecimal("0.13"); // OK > // 0.8333 > // 0.1667 > > double[][] cm= > {{0.00360000, 0.001800000000}, > {0.001800000000, 0.00090000}} > ; > > int assetNum = cm.length; > > final int row = cm.length; > if (row > 0) { > final int col = cm[0].length; > final MatrixStore<BigDecimal> a = BigDenseStore.FACTORY.makeZero(row, col); > BasicMatrix covariances = BigMatrix.FACTORY.copy(a); > > for (int i = 0; i < row; i++) { > for (int j = 0; j < col; j++) { > covariances = covariances.replace(i, j, cm[i][j]); > } > } > > double nRisk = 1000.0; > final BigDecimal riskAversion = new BigDecimal(nRisk); > final MarketEquilibrium marketEquilibrium = new MarketEquilibrium(covariances, riskAversion); > > final MatrixStore<BigDecimal> ret_matrix = BigDenseStore.FACTORY.makeZero(assetNum, 1); > BasicMatrix expectedExcessReturns1 = BigMatrix.FACTORY.copy(ret_matrix); > > expectedExcessReturns1 = expectedExcessReturns1.replace(0, 0, 0.1400); > expectedExcessReturns1 = expectedExcessReturns1.replace(1, 0, 0.0800); > > final MarkowitzModel markowitzModel = new MarkowitzModel(marketEquilibrium, expectedExcessReturns1); > > markowitzModel.setLowerLimit(0, new BigDecimal(0.0000)); > markowitzModel.setUpperLimit(0, new BigDecimal(1.0000)); > markowitzModel.setLowerLimit(1, new BigDecimal(0.0000)); > markowitzModel.setUpperLimit(1, new BigDecimal(1.0000)); > > boolean bShort = false; > markowitzModel.setShortingAllowed(bShort); > markowitzModel.setTargetReturn(nTarget); > > final List<BigDecimal> re = markowitzModel.getWeights(); > for (int nn = 0; nn < re.size(); nn++) { > System.out.println( re.get(nn) ); > } > } > } > > } > > ------------------------------------------------------------------------------ > Own the Future-Intel(R) Level Up Game Demo Contest 2013 > Rise to greatness in Intel's independent game demo contest. Compete > for recognition, cash, and the chance to get your game on Steam. > $5K grand prize plus 10 genre and skill prizes. Submit your demo > by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2_______________________________________________ > ojAlgo-user mailing list > ojA...@li... > https://lists.sourceforge.net/lists/listinfo/ojalgo-user |
From: Matteo B. <mat...@gm...> - 2013-03-29 12:19:49
|
Hi we have a problem with MarkowitzModel. I have produced a little source that explain the problem. We have set 3 different TargetReturn on the same data.. With targets near to the best end worst target return, the MarkowitzModel works fine. With targets within the interval of best and worst return, seem that the MarkowitzModel is not able to find a correct list of weights. If you try this program and use target of 0.08 or 0.13 or 0.12 you can see a correct solution. With a target of 0.10 MarkowitzModel is not able to find a valid solution. It's a OJAlgo bug or is a problem in my implementation? All the best Matteo Baccan import java.math.BigDecimal; import java.util.List; import org.ojalgo.access.AccessUtils; import org.ojalgo.constant.BigMath; import org.ojalgo.finance.portfolio.MarketEquilibrium; import org.ojalgo.finance.portfolio.MarkowitzModel; import org.ojalgo.matrix.BasicMatrix; import org.ojalgo.matrix.BigMatrix; import org.ojalgo.matrix.PrimitiveMatrix; import org.ojalgo.matrix.store.BigDenseStore; import org.ojalgo.matrix.store.MatrixStore; import org.ojalgo.matrix.store.PrimitiveDenseStore; import org.ojalgo.optimisation.Optimisation; import org.ojalgo.optimisation.quadratic.QuadraticSolver; public class MarkowitzProblems { public static void main(String[] args) { //BigDecimal nTarget = new BigDecimal("0.08"); // OK // 0.0 // 1.0 BigDecimal nTarget = new BigDecimal("0.10"); // ERROR // -0.9999 // 1.9999 //BigDecimal nTarget = new BigDecimal("0.13"); // OK // 0.8333 // 0.1667 double[][] cm= {{0.00360000, 0.001800000000}, {0.001800000000, 0.00090000}} ; int assetNum = cm.length; final int row = cm.length; if (row > 0) { final int col = cm[0].length; final MatrixStore<BigDecimal> a = BigDenseStore.FACTORY.makeZero(row, col); BasicMatrix covariances = BigMatrix.FACTORY.copy(a); for (int i = 0; i < row; i++) { for (int j = 0; j < col; j++) { covariances = covariances.replace(i, j, cm[i][j]); } } double nRisk = 1000.0; final BigDecimal riskAversion = new BigDecimal(nRisk); final MarketEquilibrium marketEquilibrium = new MarketEquilibrium(covariances, riskAversion); final MatrixStore<BigDecimal> ret_matrix = BigDenseStore.FACTORY.makeZero(assetNum, 1); BasicMatrix expectedExcessReturns1 = BigMatrix.FACTORY.copy(ret_matrix); expectedExcessReturns1 = expectedExcessReturns1.replace(0, 0, 0.1400); expectedExcessReturns1 = expectedExcessReturns1.replace(1, 0, 0.0800); final MarkowitzModel markowitzModel = new MarkowitzModel(marketEquilibrium, expectedExcessReturns1); markowitzModel.setLowerLimit(0, new BigDecimal(0.0000)); markowitzModel.setUpperLimit(0, new BigDecimal(1.0000)); markowitzModel.setLowerLimit(1, new BigDecimal(0.0000)); markowitzModel.setUpperLimit(1, new BigDecimal(1.0000)); boolean bShort = false; markowitzModel.setShortingAllowed(bShort); markowitzModel.setTargetReturn(nTarget); final List<BigDecimal> re = markowitzModel.getWeights(); for (int nn = 0; nn < re.size(); nn++) { System.out.println( re.get(nn) ); } } } } |
From: Francisco V. <fra...@gm...> - 2013-03-28 08:15:25
|
Thanks Anders, sorry, but I have a lot of work. I thought about this in summer work. Cheers. El miércoles, 27 de marzo de 2013, Anders Peterson escribió: > Ok. Everything works now except semi-continuous variables in mps-files and > some harder mip models (mps-files) that I downloaded from MIPLIB. > > MIPLIP classifies problem instances as "easy" if they can be solved within > one hour using a commercial MIP solver, and also lists problems that are > not yet solved by any solver. ojAlgo has, previously, solved at least one > of these, but I do not know what the current state is. > > @ Francisco Verdejo : ojAlgo can now handle the model you sent me. The > returned state is OPTIMAL, the solution satisfies all constraints and > integer variables are at integer values. > > /Anders > > > On 18 mar 2013, at 10:42, Anders Peterson <an...@op...> wrote: > > > I have worked some on solving this problem - here's un update on the > general state of the optimization functionality in ojAlgo: > > > > junit tests for package... > > > > org.ojalgo.optimisation.quadratic: All tests pass > > > > org.ojalgo.optimisation.linear: All tests pass > > > > org.ojalgo.optimisation.integer: All tests pass, but the test > corresponding to the problem reported in this thread is not proper. > Validation and debug output indicates there is still some problem. > > > > org.ojalgo.optimisation.linear.mps: Tests related to semi continuous > variables, and 2 other cases downloaded from netlib fail. Other tests are > ok. > > > > org.ojalgo.optimisation.integer.mps: Several problems here! In many > cases ojAlgo even has problems solving the relaxed LP problems. > > > > > > To summarize: > > 1) Semi continuos variables in mps files doesn't work > > 2) The chain mps-file - IntegerSolver - LinearSolver seems to be > problematic. Most likely there's more than one bug/problem. This > chain/combination is just a good way to replicate the symptoms. > > > > > > Please help buy supplying small manageable test cases that indicate > various problems! > > > > > > /Anders > > > > > > On 26 feb 2013, at 14:30, Anders Peterson <an...@op...> wrote: > > > >> I suspect it's not trivial to grasp the inner workings of > ExpressionsBasedModel, IntegerSolver and LinearSolver... > >> > >> Finding a smaller model that demonstrates the bug would be very helpful. > >> > >> If you do try to debug the code, please get the latest source directly > from cvs. > >> > >> http://sourceforge.net/p/ojalgo/code/ > >> > >> /Anders > >> > >> > >> On 26 feb 2013, at 11:33, Francisco Verdejo <fra...@gm...> > wrote: > >> > >>> Hi Anders, > >>> I go to try to debug the problem and simplify the model but I need > time. > >>> > >>> Thanks for your interest. > >>> Fran. > >>> > >>> > >>> 2013/2/26 Anders Peterson <an...@op...> > >>> Can't see (yet) exactly what the problem is, but it seems to be > related to extracting and copying solutions back and forth between the > model and solver. The MIP solver is multithreaded, and that adds to the > problem... > >>> > >>> Any one else have problems with the MIP solver? It is very likely the > problem was introduced during December/January when I did a lot of work on > to the MIP solver. > >>> > >>> I'm a little short on time at the moment. You have the source code. > Please participate in debugging this. > >>> > >>> One thing that would help a lot is if this behavior can be reproduced > in a smaller (as small as possible) model. Would be great if it was > possible to simply print the entire simplex tableau and/or all related > matrices... > >>> > >>> /Anders > >>> > >>> > >>> On 25 feb 2013, at 11:55, Francisco Verdejo <fra...@gm...> > wrote: > >>> > >>>> Hi, > >>>> Sorry for waiting, I have prepared an example which I send. > >>>> Seems that it skips the restrictions of variables for satisfy the > restrictions of expression. > >>>> I hope it helps you to solve the problem. > >>>> Thanks. > >>>> Fran. > >>>> > >>>> > >>>> 2013/2/22 Anders Peterson <an...@op...> > >>>> Send me a, self-contained and directly-runnable, test case. If you > can reproduce the problem with a small(er) model then please do that. > /Anders > >>>> > >>>> On 22 feb 2013, at 12:48, Francisco Verdejo <fra...@gm...> > wrote: > >>>> > >>>>> The variables are binay and the X_111_19=-16 > >>>>> Also exits the folowing resOwn the Future-Intel® Level Up Game > Demo Contest 2013 > Rise to greatness in Intel's independent game demo contest. > Compete for recognition, cash, and the chance to get your game > on Steam. $5K grand prize plus 10 genre and skill prizes. > Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d > _______________________________________________ > ojAlgo-user mailing list > ojA...@li... <javascript:;> > https://lists.sourceforge.net/lists/listinfo/ojalgo-user > |
From: Anders P. <an...@op...> - 2013-03-27 19:22:38
|
Ok. Everything works now except semi-continuous variables in mps-files and some harder mip models (mps-files) that I downloaded from MIPLIB. MIPLIP classifies problem instances as "easy" if they can be solved within one hour using a commercial MIP solver, and also lists problems that are not yet solved by any solver. ojAlgo has, previously, solved at least one of these, but I do not know what the current state is. @ Francisco Verdejo : ojAlgo can now handle the model you sent me. The returned state is OPTIMAL, the solution satisfies all constraints and integer variables are at integer values. /Anders On 18 mar 2013, at 10:42, Anders Peterson <an...@op...> wrote: > I have worked some on solving this problem - here's un update on the general state of the optimization functionality in ojAlgo: > > junit tests for package... > > org.ojalgo.optimisation.quadratic: All tests pass > > org.ojalgo.optimisation.linear: All tests pass > > org.ojalgo.optimisation.integer: All tests pass, but the test corresponding to the problem reported in this thread is not proper. Validation and debug output indicates there is still some problem. > > org.ojalgo.optimisation.linear.mps: Tests related to semi continuous variables, and 2 other cases downloaded from netlib fail. Other tests are ok. > > org.ojalgo.optimisation.integer.mps: Several problems here! In many cases ojAlgo even has problems solving the relaxed LP problems. > > > To summarize: > 1) Semi continuos variables in mps files doesn't work > 2) The chain mps-file - IntegerSolver - LinearSolver seems to be problematic. Most likely there's more than one bug/problem. This chain/combination is just a good way to replicate the symptoms. > > > Please help buy supplying small manageable test cases that indicate various problems! > > > /Anders > > > On 26 feb 2013, at 14:30, Anders Peterson <an...@op...> wrote: > >> I suspect it's not trivial to grasp the inner workings of ExpressionsBasedModel, IntegerSolver and LinearSolver... >> >> Finding a smaller model that demonstrates the bug would be very helpful. >> >> If you do try to debug the code, please get the latest source directly from cvs. >> >> http://sourceforge.net/p/ojalgo/code/ >> >> /Anders >> >> >> On 26 feb 2013, at 11:33, Francisco Verdejo <fra...@gm...> wrote: >> >>> Hi Anders, >>> I go to try to debug the problem and simplify the model but I need time. >>> >>> Thanks for your interest. >>> Fran. >>> >>> >>> 2013/2/26 Anders Peterson <an...@op...> >>> Can't see (yet) exactly what the problem is, but it seems to be related to extracting and copying solutions back and forth between the model and solver. The MIP solver is multithreaded, and that adds to the problem... >>> >>> Any one else have problems with the MIP solver? It is very likely the problem was introduced during December/January when I did a lot of work on to the MIP solver. >>> >>> I'm a little short on time at the moment. You have the source code. Please participate in debugging this. >>> >>> One thing that would help a lot is if this behavior can be reproduced in a smaller (as small as possible) model. Would be great if it was possible to simply print the entire simplex tableau and/or all related matrices... >>> >>> /Anders >>> >>> >>> On 25 feb 2013, at 11:55, Francisco Verdejo <fra...@gm...> wrote: >>> >>>> Hi, >>>> Sorry for waiting, I have prepared an example which I send. >>>> Seems that it skips the restrictions of variables for satisfy the restrictions of expression. >>>> I hope it helps you to solve the problem. >>>> Thanks. >>>> Fran. >>>> >>>> >>>> 2013/2/22 Anders Peterson <an...@op...> >>>> Send me a, self-contained and directly-runnable, test case. If you can reproduce the problem with a small(er) model then please do that. /Anders >>>> >>>> On 22 feb 2013, at 12:48, Francisco Verdejo <fra...@gm...> wrote: >>>> >>>>> The variables are binay and the X_111_19=-16 >>>>> Also exits the folowing restriction: sum(X_i_j) = 1 >>>>> The variables with problem are X_111_j, the variable X_112_j are ok. >>>>> The result state are: OPTIMAL 295.5 >>>>> >>>>> This is a print of variables after solve >>>>> >>>>> 0 <= X_111_0: 0 (6.6) <= 1 >>>>> 0 <= X_111_1: 1 (5.8) <= 1 >>>>> 0 <= X_111_2: 1 (5) <= 1 >>>>> 0 <= X_111_3: 0 (4.2) <= 1 >>>>> 0 <= X_111_4: 1 (3.5) <= 1 >>>>> 0 <= X_111_5: 1 (2.9) <= 1 >>>>> 0 <= X_111_6: 1 (2.3) <= 1 >>>>> 0 <= X_111_7: 1 (1.9) <= 1 >>>>> 0 <= X_111_8: 1 (1.5) <= 1 >>>>> 0 <= X_111_9: 1 (1.2) <= 1 >>>>> 0 <= X_111_10: 1 (0.9) <= 1 >>>>> 0 <= X_111_11: 1 (0.7) <= 1 >>>>> 0 <= X_111_12: 1 (0.6) <= 1 >>>>> 0 <= X_111_13: 1 (0.6) <= 1 >>>>> 0 <= X_111_14: 1 (0.8) <= 1 >>>>> 0 <= X_111_15: 1 (1) <= 1 >>>>> 0 <= X_111_16: 1 (1.4) <= 1 >>>>> 0 <= X_111_17: 1 (2) <= 1 >>>>> 0 <= X_111_18: 1 (2.8) <= 1 >>>>> 0 <= X_111_19: -16 (3.6) <= 1 >>>>> >>>>> 0 <= X_112_0: 0 (7.1) <= 1 >>>>> 0 <= X_112_1: 0 (6.1) <= 1 >>>>> 0 <= X_112_2: 0 (5.3) <= 1 >>>>> 0 <= X_112_3: 0 (4.5) <= 1 >>>>> 0 <= X_112_4: 0 (3.8) <= 1 >>>>> 0 <= X_112_5: 1 (3.1) <= 1 >>>>> 0 <= X_112_6: 0 (2..6) <= 1 >>>>> 0 <= X_112_7: 0 (2.1) <= 1 >>>>> 0 <= X_112_8: 0 (1.6) <= 1 >>>>> 0 <= X_112_9: 0 (1.3) <= 1 >>>>> 0 <= X_112_10: 0 (1) <= 1 >>>>> 0 <= X_112_11: 0 (0.8) <= 1 >>>>> 0 <= X_112_12: 0 (0.6) <= 1 >>>>> 0 <= X_112_13: 0 (0.5) <= 1 >>>>> 0 <= X_112_14: 0 (0.5) <= 1 >>>>> 0 <= X_112_15: 0 (0.6) <= 1 >>>>> 0 <= X_112_16: 0 (0.8) <= 1 >>>>> 0 <= X_112_17: 0 (1.2) <= 1 >>>>> 0 <= X_112_18: 0 (1.7) <= 1 >>>>> 0 <= X_112_19: 0 (2.4) <= 1 >>>>> >>>>> If you want I tell you more details of our model. >>>>> Thanks. >>>>> >>>>> >>>>> 2013/2/22 Anders Peterson <an...@op...> >>>>> I have no idea... >>>>> >>>>> Are you saying that you define a (mixed) integer linear program, and you get solutions where some integer variables are not at integer values? >>>>> >>>>> Did you check the Optimisation.State? Does it indicate that the problem is solved correctly? >>>>> >>>>> Can you supply me with a self-contained directly-runnable test case that clearly demonstrates how you do things, what you expect to happen and what actually happens. >>>>> >>>>> /Anders >>>>> >>>>> >>>>> On 22 feb 2013, at 12:14, Francisco Verdejo <fra...@gm...> wrote: >>>>> >>>>>> Hi friends, >>>>>> We are using an integer linear programming. All the variables are binary. The problem is that the result of some variables are distinct than 0 and 1. >>>>>> Why is it? >>>>>> >>>>>> Thanks. >>>>>> ------------------------------------------------------------------------------ >>>>>> Everyone hates slow websites. So do we. >>>>>> Make your web apps faster with AppDynamics >>>>>> Download AppDynamics Lite for free today: >>>>>> http://p.sf.net/sfu/appdyn_d2d_feb_______________________________________________ >>>>>> ojAlgo-user mailing list >>>>>> ojAlgo-user@lists..sourceforge.net >>>>>> https://lists..sourceforge.net/lists/listinfo/ojalgo-user >>>>> >>>>> >>>>> ------------------------------------------------------------------------------ >>>>> Everyone hates slow websites. So do we. >>>>> Make your web apps faster with AppDynamics >>>>> Download AppDynamics Lite for free today: >>>>> http://p.sf.net/sfu/appdyn_d2d_feb >>>>> _______________________________________________ >>>>> ojAlgo-user mailing list >>>>> ojAlgo-user@lists..sourceforge.net >>>>> https://lists.sourceforge.net/lists/listinfo/ojalgo-user >>>>> >>>>> ------------------------------------------------------------------------------ >>>>> Everyone hates slow websites. So do we. >>>>> Make your web apps faster with AppDynamics >>>>> Download AppDynamics Lite for free today: >>>>> http://p.sf.net/sfu/appdyn_d2d_feb_______________________________________________ >>>>> ojAlgo-user mailing list >>>>> ojAlgo-user@lists..sourceforge.net >>>>> https://lists.sourceforge.net/lists/listinfo/ojalgo-user >>>> >>>> >>>> ------------------------------------------------------------------------------ >>>> Everyone hates slow websites. So do we. >>>> Make your web apps faster with AppDynamics >>>> Download AppDynamics Lite for free today: >>>> http://p.sf.net/sfu/appdyn_d2d_feb >>>> _______________________________________________ >>>> ojAlgo-user mailing list >>>> ojAlgo-user@lists..sourceforge.net >>>> https://lists.sourceforge.net/lists/listinfo/ojalgo-user >>>> >>>> <Example.java>------------------------------------------------------------------------------ >>>> Everyone hates slow websites. So do we. >>>> Make your web apps faster with AppDynamics >>>> Download AppDynamics Lite for free today: >>>> http://p.sf.net/sfu/appdyn_d2d_feb_______________________________________________ >>>> ojAlgo-user mailing list >>>> ojAlgo-user@lists..sourceforge.net >>>> https://lists.sourceforge.net/lists/listinfo/ojalgo-user >>> >>> >>> ------------------------------------------------------------------------------ >>> Everyone hates slow websites. So do we. >>> Make your web apps faster with AppDynamics >>> Download AppDynamics Lite for free today: >>> http://p.sf.net/sfu/appdyn_d2d_feb >>> _______________________________________________ >>> ojAlgo-user mailing list >>> ojA...@li... >>> https://lists.sourceforge.net/lists/listinfo/ojalgo-user >>> >>> ------------------------------------------------------------------------------ >>> Everyone hates slow websites. So do we. >>> Make your web apps faster with AppDynamics >>> Download AppDynamics Lite for free today: >>> http://p.sf.net/sfu/appdyn_d2d_feb_______________________________________________ >>> ojAlgo-user mailing list >>> ojA...@li... >>> https://lists.sourceforge.net/lists/listinfo/ojalgo-user >> >> >> ------------------------------------------------------------------------------ >> Everyone hates slow websites. So do we. >> Make your web apps faster with AppDynamics >> Download AppDynamics Lite for free today: >> http://p.sf.net/sfu/appdyn_d2d_feb >> _______________________________________________ >> ojAlgo-user mailing list >> ojA...@li... >> https://lists.sourceforge.net/lists/listinfo/ojalgo-user >> >> > |
From: Anders P. <an...@op...> - 2013-03-18 09:42:30
|
I have worked some on solving this problem - here's un update on the general state of the optimization functionality in ojAlgo: junit tests for package... org.ojalgo.optimisation.quadratic: All tests pass org.ojalgo.optimisation.linear: All tests pass org.ojalgo.optimisation.integer: All tests pass, but the test corresponding to the problem reported in this thread is not proper. Validation and debug output indicates there is still some problem. org.ojalgo.optimisation.linear.mps: Tests related to semi continuous variables, and 2 other cases downloaded from netlib fail. Other tests are ok. org.ojalgo.optimisation.integer.mps: Several problems here! In many cases ojAlgo even has problems solving the relaxed LP problems. To summarize: 1) Semi continuos variables in mps files doesn't work 2) The chain mps-file - IntegerSolver - LinearSolver seems to be problematic. Most likely there's more than one bug/problem. This chain/combination is just a good way to replicate the symptoms. Please help buy supplying small manageable test cases that indicate various problems! /Anders On 26 feb 2013, at 14:30, Anders Peterson <an...@op...> wrote: > I suspect it's not trivial to grasp the inner workings of ExpressionsBasedModel, IntegerSolver and LinearSolver... > > Finding a smaller model that demonstrates the bug would be very helpful. > > If you do try to debug the code, please get the latest source directly from cvs. > > http://sourceforge.net/p/ojalgo/code/ > > /Anders > > > On 26 feb 2013, at 11:33, Francisco Verdejo <fra...@gm...> wrote: > >> Hi Anders, >> I go to try to debug the problem and simplify the model but I need time. >> >> Thanks for your interest. >> Fran. >> >> >> 2013/2/26 Anders Peterson <an...@op...> >> Can't see (yet) exactly what the problem is, but it seems to be related to extracting and copying solutions back and forth between the model and solver. The MIP solver is multithreaded, and that adds to the problem... >> >> Any one else have problems with the MIP solver? It is very likely the problem was introduced during December/January when I did a lot of work on to the MIP solver. >> >> I'm a little short on time at the moment. You have the source code. Please participate in debugging this. >> >> One thing that would help a lot is if this behavior can be reproduced in a smaller (as small as possible) model. Would be great if it was possible to simply print the entire simplex tableau and/or all related matrices... >> >> /Anders >> >> >> On 25 feb 2013, at 11:55, Francisco Verdejo <fra...@gm...> wrote: >> >>> Hi, >>> Sorry for waiting, I have prepared an example which I send. >>> Seems that it skips the restrictions of variables for satisfy the restrictions of expression. >>> I hope it helps you to solve the problem. >>> Thanks. >>> Fran. >>> >>> >>> 2013/2/22 Anders Peterson <an...@op...> >>> Send me a, self-contained and directly-runnable, test case. If you can reproduce the problem with a small(er) model then please do that. /Anders >>> >>> On 22 feb 2013, at 12:48, Francisco Verdejo <fra...@gm...> wrote: >>> >>>> The variables are binay and the X_111_19=-16 >>>> Also exits the folowing restriction: sum(X_i_j) = 1 >>>> The variables with problem are X_111_j, the variable X_112_j are ok. >>>> The result state are: OPTIMAL 295.5 >>>> >>>> This is a print of variables after solve >>>> >>>> 0 <= X_111_0: 0 (6.6) <= 1 >>>> 0 <= X_111_1: 1 (5.8) <= 1 >>>> 0 <= X_111_2: 1 (5) <= 1 >>>> 0 <= X_111_3: 0 (4.2) <= 1 >>>> 0 <= X_111_4: 1 (3.5) <= 1 >>>> 0 <= X_111_5: 1 (2.9) <= 1 >>>> 0 <= X_111_6: 1 (2.3) <= 1 >>>> 0 <= X_111_7: 1 (1.9) <= 1 >>>> 0 <= X_111_8: 1 (1.5) <= 1 >>>> 0 <= X_111_9: 1 (1.2) <= 1 >>>> 0 <= X_111_10: 1 (0.9) <= 1 >>>> 0 <= X_111_11: 1 (0.7) <= 1 >>>> 0 <= X_111_12: 1 (0.6) <= 1 >>>> 0 <= X_111_13: 1 (0.6) <= 1 >>>> 0 <= X_111_14: 1 (0.8) <= 1 >>>> 0 <= X_111_15: 1 (1) <= 1 >>>> 0 <= X_111_16: 1 (1.4) <= 1 >>>> 0 <= X_111_17: 1 (2) <= 1 >>>> 0 <= X_111_18: 1 (2.8) <= 1 >>>> 0 <= X_111_19: -16 (3.6) <= 1 >>>> >>>> 0 <= X_112_0: 0 (7.1) <= 1 >>>> 0 <= X_112_1: 0 (6.1) <= 1 >>>> 0 <= X_112_2: 0 (5.3) <= 1 >>>> 0 <= X_112_3: 0 (4.5) <= 1 >>>> 0 <= X_112_4: 0 (3.8) <= 1 >>>> 0 <= X_112_5: 1 (3.1) <= 1 >>>> 0 <= X_112_6: 0 (2..6) <= 1 >>>> 0 <= X_112_7: 0 (2.1) <= 1 >>>> 0 <= X_112_8: 0 (1.6) <= 1 >>>> 0 <= X_112_9: 0 (1.3) <= 1 >>>> 0 <= X_112_10: 0 (1) <= 1 >>>> 0 <= X_112_11: 0 (0.8) <= 1 >>>> 0 <= X_112_12: 0 (0.6) <= 1 >>>> 0 <= X_112_13: 0 (0.5) <= 1 >>>> 0 <= X_112_14: 0 (0.5) <= 1 >>>> 0 <= X_112_15: 0 (0.6) <= 1 >>>> 0 <= X_112_16: 0 (0.8) <= 1 >>>> 0 <= X_112_17: 0 (1.2) <= 1 >>>> 0 <= X_112_18: 0 (1.7) <= 1 >>>> 0 <= X_112_19: 0 (2.4) <= 1 >>>> >>>> If you want I tell you more details of our model. >>>> Thanks. >>>> >>>> >>>> 2013/2/22 Anders Peterson <an...@op...> >>>> I have no idea... >>>> >>>> Are you saying that you define a (mixed) integer linear program, and you get solutions where some integer variables are not at integer values? >>>> >>>> Did you check the Optimisation.State? Does it indicate that the problem is solved correctly? >>>> >>>> Can you supply me with a self-contained directly-runnable test case that clearly demonstrates how you do things, what you expect to happen and what actually happens. >>>> >>>> /Anders >>>> >>>> >>>> On 22 feb 2013, at 12:14, Francisco Verdejo <fra...@gm...> wrote: >>>> >>>>> Hi friends, >>>>> We are using an integer linear programming. All the variables are binary. The problem is that the result of some variables are distinct than 0 and 1. >>>>> Why is it? >>>>> >>>>> Thanks. >>>>> ------------------------------------------------------------------------------ >>>>> Everyone hates slow websites. So do we. >>>>> Make your web apps faster with AppDynamics >>>>> Download AppDynamics Lite for free today: >>>>> http://p.sf.net/sfu/appdyn_d2d_feb_______________________________________________ >>>>> ojAlgo-user mailing list >>>>> ojAlgo-user@lists..sourceforge.net >>>>> https://lists..sourceforge.net/lists/listinfo/ojalgo-user >>>> >>>> >>>> ------------------------------------------------------------------------------ >>>> Everyone hates slow websites. So do we. >>>> Make your web apps faster with AppDynamics >>>> Download AppDynamics Lite for free today: >>>> http://p.sf.net/sfu/appdyn_d2d_feb >>>> _______________________________________________ >>>> ojAlgo-user mailing list >>>> ojAlgo-user@lists..sourceforge.net >>>> https://lists.sourceforge.net/lists/listinfo/ojalgo-user >>>> >>>> ------------------------------------------------------------------------------ >>>> Everyone hates slow websites. So do we. >>>> Make your web apps faster with AppDynamics >>>> Download AppDynamics Lite for free today: >>>> http://p.sf.net/sfu/appdyn_d2d_feb_______________________________________________ >>>> ojAlgo-user mailing list >>>> ojAlgo-user@lists..sourceforge.net >>>> https://lists.sourceforge.net/lists/listinfo/ojalgo-user >>> >>> >>> ------------------------------------------------------------------------------ >>> Everyone hates slow websites. So do we. >>> Make your web apps faster with AppDynamics >>> Download AppDynamics Lite for free today: >>> http://p.sf.net/sfu/appdyn_d2d_feb >>> _______________________________________________ >>> ojAlgo-user mailing list >>> ojAlgo-user@lists..sourceforge.net >>> https://lists.sourceforge.net/lists/listinfo/ojalgo-user >>> >>> <Example.java>------------------------------------------------------------------------------ >>> Everyone hates slow websites. So do we. >>> Make your web apps faster with AppDynamics >>> Download AppDynamics Lite for free today: >>> http://p.sf.net/sfu/appdyn_d2d_feb_______________________________________________ >>> ojAlgo-user mailing list >>> ojAlgo-user@lists..sourceforge.net >>> https://lists.sourceforge.net/lists/listinfo/ojalgo-user >> >> >> ------------------------------------------------------------------------------ >> Everyone hates slow websites. So do we. >> Make your web apps faster with AppDynamics >> Download AppDynamics Lite for free today: >> http://p.sf.net/sfu/appdyn_d2d_feb >> _______________________________________________ >> ojAlgo-user mailing list >> ojA...@li... >> https://lists.sourceforge.net/lists/listinfo/ojalgo-user >> >> ------------------------------------------------------------------------------ >> Everyone hates slow websites. So do we. >> Make your web apps faster with AppDynamics >> Download AppDynamics Lite for free today: >> http://p.sf.net/sfu/appdyn_d2d_feb_______________________________________________ >> ojAlgo-user mailing list >> ojA...@li... >> https://lists.sourceforge.net/lists/listinfo/ojalgo-user > > > ------------------------------------------------------------------------------ > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_d2d_feb > _______________________________________________ > ojAlgo-user mailing list > ojA...@li... > https://lists.sourceforge.net/lists/listinfo/ojalgo-user > > |
From: Anders P. <an...@op...> - 2013-03-04 07:39:01
|
As far as I can see that means you have quadratic constraints, and ojAlgo can't handle that. You'l have to reformulate the problem or write a cover algorithm that does what you want. If that's not possible then you'll have find another library that can handle quadratic constraints. /Anders On 3 mar 2013, at 23:40, Matteo Baccan <mat...@gm...> wrote: > Hi > > I am performing some test on your ojalgo.finance.portfolio library based on Markowitz model, but I have a problem that I am not able to solve. > > > Assuming a case of a two-asset portfolio. The input values for Markowitz model are: expected return, expected volatility and covariance matrix. > > > Assets > > Expected Return > > Expected Volatility > > Asset 1 > > μ1 > > σ1 > > Asset 2 > > μ2 σ2 > > > > Covariance Matrix > > Asset 1 > > Asset 2 > > Asset 1 > > > σ1^2 > > σ2,1=σ1,2 > > Asset 2 > > σ1,2 > > σ2^2 > > > > The portfolio variance can be seen as the sum of the risk contribution of each asset class as following: > > > Assets > > Weights > > Risk Contribution > > Asset 1 > > X1 > > VP1=X1^2∙σ1^2+X1∙X2∙σ1,2 > > Asset 2 > > X2 > > > VP2=X2^2∙σ2^2+X1∙X2∙σ1,2 > > > Portfolio Variance = VP1+VP2 > > > > My goal is to calculate the asset allocation (sum weights =1) maximizing portfolio expected return and adding the following constraint: VP1=VP2 (risk parity approach). > > > > Considering n Assets, the logic is the same: maximizing portfolio return but adding the following constraint: > > VP1=VP2=⋯ =VPn > > > > Could you give me some suggestion in order to solve this problem using your library? > > > Best Regards, > > > > -- > Matteo Baccan > http://www.baccan.it > > ------------------------------------------------------------------------------ > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_d2d_feb_______________________________________________ > ojAlgo-user mailing list > ojA...@li... > https://lists.sourceforge.net/lists/listinfo/ojalgo-user |
From: Matteo B. <mat...@gm...> - 2013-03-03 22:41:10
|
Hi I am performing some test on your ojalgo.finance.portfolio library based on Markowitz model, but I have a problem that I am not able to solve. Assuming a case of a two-asset portfolio. The input values for Markowitz model are: expected return, expected volatility and covariance matrix. Assets Expected Return Expected Volatility Asset 1 μ1 σ1 Asset 2 μ2 σ2 Covariance Matrix Asset 1 Asset 2 Asset 1 σ1^2 σ2,1=σ1,2 Asset 2 σ1,2 σ2^2 The portfolio variance can be seen as the sum of the risk contribution of each asset class as following: Assets Weights Risk Contribution Asset 1 X1 VP1=X1^2∙σ1^2+X1∙X2∙σ1,2 Asset 2 X2 VP2=X2^2∙σ2^2+X1∙X2∙σ1,2 Portfolio Variance = VP1+VP2 *My goal is to calculate the asset allocation (sum weights =1) maximizing portfolio expected return and adding the following constraint: **VP1=VP2 (risk parity approach).* Considering n Assets, the logic is the same: maximizing portfolio return but adding the following constraint: VP1=VP2=⋯ =VPn Could you give me some suggestion in order to solve this problem using your library? Best Regards, -- Matteo Baccan http://www.baccan.it |
From: Anders P. <an...@op...> - 2013-02-27 20:54:20
|
I asume you call maximise() or minimise() directly on the MathProgSysModel... and, yes that wont work well. The solution is not written back to the columns. MathProgSysModel tmpMPSM = MathProgSysModel.makeFromFile(...); ExpressionsBasedModel tmpEBM = ExpressionsBasedModel.make(tmpMPSM); State tmpState = tmpEBM.minimise().getState(); List<Variable> tmpVariables = tmpEBM.getVariables(); The variables have names and the solution values are written back to them. Suppose there should be code that writes those solution values to the columns of the MathProgSysModel. Until someone writes that code you have to do as described above. /Anders On 27 feb 2013, at 19:00, "Steffen Borgwardt" <bor...@ma...> wrote: > Hello! > > I'm solving a linear program using ojalgo. To do so, i write an MPS file > and call 'MathProgSysModel.makeFromFile'. The solving process works just > fine, but in the 'Optimisation.Result' i cannot tell which value is > associated to which variable. Their order is not preserved, so i cannot > simply iterate over the 'or.doubleValues'. > > How do i connect variable names with the solution? > > Thanks for a reply! > > Best > Steffen > > > ------------------------------------------------------------------------------ > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_d2d_feb > _______________________________________________ > ojAlgo-user mailing list > ojA...@li... > https://lists.sourceforge.net/lists/listinfo/ojalgo-user > > |
From: Steffen B. <bor...@ma...> - 2013-02-27 18:19:42
|
Hello! I'm solving a linear program using ojalgo. To do so, i write an MPS file and call 'MathProgSysModel.makeFromFile'. The solving process works just fine, but in the 'Optimisation.Result' i cannot tell which value is associated to which variable. Their order is not preserved, so i cannot simply iterate over the 'or.doubleValues'. How do i connect variable names with the solution? Thanks for a reply! Best Steffen |
From: Anders P. <an...@op...> - 2013-02-26 13:31:34
|
I suspect it's not trivial to grasp the inner workings of ExpressionsBasedModel, IntegerSolver and LinearSolver... Finding a smaller model that demonstrates the bug would be very helpful. If you do try to debug the code, please get the latest source directly from cvs. http://sourceforge.net/p/ojalgo/code/ /Anders On 26 feb 2013, at 11:33, Francisco Verdejo <fra...@gm...> wrote: > Hi Anders, > I go to try to debug the problem and simplify the model but I need time. > > Thanks for your interest. > Fran. > > > 2013/2/26 Anders Peterson <an...@op...> > Can't see (yet) exactly what the problem is, but it seems to be related to extracting and copying solutions back and forth between the model and solver. The MIP solver is multithreaded, and that adds to the problem... > > Any one else have problems with the MIP solver? It is very likely the problem was introduced during December/January when I did a lot of work on to the MIP solver. > > I'm a little short on time at the moment. You have the source code. Please participate in debugging this. > > One thing that would help a lot is if this behavior can be reproduced in a smaller (as small as possible) model. Would be great if it was possible to simply print the entire simplex tableau and/or all related matrices... > > /Anders > > > On 25 feb 2013, at 11:55, Francisco Verdejo <fra...@gm...> wrote: > > > Hi, > > Sorry for waiting, I have prepared an example which I send. > > Seems that it skips the restrictions of variables for satisfy the restrictions of expression. > > I hope it helps you to solve the problem. > > Thanks. > > Fran. > > > > > > 2013/2/22 Anders Peterson <an...@op...> > > Send me a, self-contained and directly-runnable, test case. If you can reproduce the problem with a small(er) model then please do that. /Anders > > > > On 22 feb 2013, at 12:48, Francisco Verdejo <fra...@gm...> wrote: > > > > > The variables are binay and the X_111_19=-16 > > > Also exits the folowing restriction: sum(X_i_j) = 1 > > > The variables with problem are X_111_j, the variable X_112_j are ok. > > > The result state are: OPTIMAL 295.5 > > > > > > This is a print of variables after solve > > > > > > 0 <= X_111_0: 0 (6.6) <= 1 > > > 0 <= X_111_1: 1 (5.8) <= 1 > > > 0 <= X_111_2: 1 (5) <= 1 > > > 0 <= X_111_3: 0 (4.2) <= 1 > > > 0 <= X_111_4: 1 (3.5) <= 1 > > > 0 <= X_111_5: 1 (2.9) <= 1 > > > 0 <= X_111_6: 1 (2.3) <= 1 > > > 0 <= X_111_7: 1 (1.9) <= 1 > > > 0 <= X_111_8: 1 (1.5) <= 1 > > > 0 <= X_111_9: 1 (1.2) <= 1 > > > 0 <= X_111_10: 1 (0.9) <= 1 > > > 0 <= X_111_11: 1 (0.7) <= 1 > > > 0 <= X_111_12: 1 (0.6) <= 1 > > > 0 <= X_111_13: 1 (0.6) <= 1 > > > 0 <= X_111_14: 1 (0.8) <= 1 > > > 0 <= X_111_15: 1 (1) <= 1 > > > 0 <= X_111_16: 1 (1.4) <= 1 > > > 0 <= X_111_17: 1 (2) <= 1 > > > 0 <= X_111_18: 1 (2.8) <= 1 > > > 0 <= X_111_19: -16 (3.6) <= 1 > > > > > > 0 <= X_112_0: 0 (7.1) <= 1 > > > 0 <= X_112_1: 0 (6.1) <= 1 > > > 0 <= X_112_2: 0 (5.3) <= 1 > > > 0 <= X_112_3: 0 (4.5) <= 1 > > > 0 <= X_112_4: 0 (3.8) <= 1 > > > 0 <= X_112_5: 1 (3.1) <= 1 > > > 0 <= X_112_6: 0 (2..6) <= 1 > > > 0 <= X_112_7: 0 (2.1) <= 1 > > > 0 <= X_112_8: 0 (1.6) <= 1 > > > 0 <= X_112_9: 0 (1.3) <= 1 > > > 0 <= X_112_10: 0 (1) <= 1 > > > 0 <= X_112_11: 0 (0.8) <= 1 > > > 0 <= X_112_12: 0 (0.6) <= 1 > > > 0 <= X_112_13: 0 (0.5) <= 1 > > > 0 <= X_112_14: 0 (0.5) <= 1 > > > 0 <= X_112_15: 0 (0.6) <= 1 > > > 0 <= X_112_16: 0 (0.8) <= 1 > > > 0 <= X_112_17: 0 (1.2) <= 1 > > > 0 <= X_112_18: 0 (1.7) <= 1 > > > 0 <= X_112_19: 0 (2.4) <= 1 > > > > > > If you want I tell you more details of our model. > > > Thanks. > > > > > > > > > 2013/2/22 Anders Peterson <an...@op...> > > > I have no idea... > > > > > > Are you saying that you define a (mixed) integer linear program, and you get solutions where some integer variables are not at integer values? > > > > > > Did you check the Optimisation.State? Does it indicate that the problem is solved correctly? > > > > > > Can you supply me with a self-contained directly-runnable test case that clearly demonstrates how you do things, what you expect to happen and what actually happens. > > > > > > /Anders > > > > > > > > > On 22 feb 2013, at 12:14, Francisco Verdejo <fra...@gm...> wrote: > > > > > > > Hi friends, > > > > We are using an integer linear programming. All the variables are binary. The problem is that the result of some variables are distinct than 0 and 1. > > > > Why is it? > > > > > > > > Thanks. > > > > ------------------------------------------------------------------------------ > > > > Everyone hates slow websites. So do we. > > > > Make your web apps faster with AppDynamics > > > > Download AppDynamics Lite for free today: > > > > http://p.sf.net/sfu/appdyn_d2d_feb_______________________________________________ > > > > ojAlgo-user mailing list > > > > ojAlgo-user@lists..sourceforge.net > > > > https://lists..sourceforge.net/lists/listinfo/ojalgo-user > > > > > > > > > ------------------------------------------------------------------------------ > > > Everyone hates slow websites. So do we. > > > Make your web apps faster with AppDynamics > > > Download AppDynamics Lite for free today: > > > http://p.sf.net/sfu/appdyn_d2d_feb > > > _______________________________________________ > > > ojAlgo-user mailing list > > > ojAlgo-user@lists..sourceforge.net > > > https://lists.sourceforge.net/lists/listinfo/ojalgo-user > > > > > > ------------------------------------------------------------------------------ > > > Everyone hates slow websites. So do we. > > > Make your web apps faster with AppDynamics > > > Download AppDynamics Lite for free today: > > > http://p.sf.net/sfu/appdyn_d2d_feb_______________________________________________ > > > ojAlgo-user mailing list > > > ojAlgo-user@lists..sourceforge.net > > > https://lists.sourceforge.net/lists/listinfo/ojalgo-user > > > > > > ------------------------------------------------------------------------------ > > Everyone hates slow websites. So do we. > > Make your web apps faster with AppDynamics > > Download AppDynamics Lite for free today: > > http://p.sf.net/sfu/appdyn_d2d_feb > > _______________________________________________ > > ojAlgo-user mailing list > > ojAlgo-user@lists..sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/ojalgo-user > > > > <Example.java>------------------------------------------------------------------------------ > > Everyone hates slow websites. So do we. > > Make your web apps faster with AppDynamics > > Download AppDynamics Lite for free today: > > http://p.sf.net/sfu/appdyn_d2d_feb_______________________________________________ > > ojAlgo-user mailing list > > ojAlgo-user@lists..sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/ojalgo-user > > > ------------------------------------------------------------------------------ > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_d2d_feb > _______________________________________________ > ojAlgo-user mailing list > ojA...@li... > https://lists.sourceforge.net/lists/listinfo/ojalgo-user > > ------------------------------------------------------------------------------ > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_d2d_feb_______________________________________________ > ojAlgo-user mailing list > ojA...@li... > https://lists.sourceforge.net/lists/listinfo/ojalgo-user |
From: Francisco V. <fra...@gm...> - 2013-02-26 10:34:03
|
Hi Anders, I go to try to debug the problem and simplify the model but I need time. Thanks for your interest. Fran. 2013/2/26 Anders Peterson <an...@op...> > Can't see (yet) exactly what the problem is, but it seems to be related to > extracting and copying solutions back and forth between the model and > solver. The MIP solver is multithreaded, and that adds to the problem... > > Any one else have problems with the MIP solver? It is very likely the > problem was introduced during December/January when I did a lot of work on > to the MIP solver. > > I'm a little short on time at the moment. You have the source code. Please > participate in debugging this. > > One thing that would help a lot is if this behavior can be reproduced in a > smaller (as small as possible) model. Would be great if it was possible to > simply print the entire simplex tableau and/or all related matrices... > > /Anders > > > On 25 feb 2013, at 11:55, Francisco Verdejo <fra...@gm...> > wrote: > > > Hi, > > Sorry for waiting, I have prepared an example which I send. > > Seems that it skips the restrictions of variables for satisfy the > restrictions of expression. > > I hope it helps you to solve the problem. > > Thanks. > > Fran. > > > > > > 2013/2/22 Anders Peterson <an...@op...> > > Send me a, self-contained and directly-runnable, test case. If you can > reproduce the problem with a small(er) model then please do that. /Anders > > > > On 22 feb 2013, at 12:48, Francisco Verdejo <fra...@gm...> > wrote: > > > > > The variables are binay and the X_111_19=-16 > > > Also exits the folowing restriction: sum(X_i_j) = 1 > > > The variables with problem are X_111_j, the variable X_112_j are ok. > > > The result state are: OPTIMAL 295.5 > > > > > > This is a print of variables after solve > > > > > > 0 <= X_111_0: 0 (6.6) <= 1 > > > 0 <= X_111_1: 1 (5.8) <= 1 > > > 0 <= X_111_2: 1 (5) <= 1 > > > 0 <= X_111_3: 0 (4.2) <= 1 > > > 0 <= X_111_4: 1 (3.5) <= 1 > > > 0 <= X_111_5: 1 (2.9) <= 1 > > > 0 <= X_111_6: 1 (2.3) <= 1 > > > 0 <= X_111_7: 1 (1.9) <= 1 > > > 0 <= X_111_8: 1 (1.5) <= 1 > > > 0 <= X_111_9: 1 (1.2) <= 1 > > > 0 <= X_111_10: 1 (0.9) <= 1 > > > 0 <= X_111_11: 1 (0.7) <= 1 > > > 0 <= X_111_12: 1 (0.6) <= 1 > > > 0 <= X_111_13: 1 (0.6) <= 1 > > > 0 <= X_111_14: 1 (0.8) <= 1 > > > 0 <= X_111_15: 1 (1) <= 1 > > > 0 <= X_111_16: 1 (1.4) <= 1 > > > 0 <= X_111_17: 1 (2) <= 1 > > > 0 <= X_111_18: 1 (2.8) <= 1 > > > 0 <= X_111_19: -16 (3.6) <= 1 > > > > > > 0 <= X_112_0: 0 (7.1) <= 1 > > > 0 <= X_112_1: 0 (6.1) <= 1 > > > 0 <= X_112_2: 0 (5.3) <= 1 > > > 0 <= X_112_3: 0 (4.5) <= 1 > > > 0 <= X_112_4: 0 (3.8) <= 1 > > > 0 <= X_112_5: 1 (3.1) <= 1 > > > 0 <= X_112_6: 0 (2..6) <= 1 > > > 0 <= X_112_7: 0 (2.1) <= 1 > > > 0 <= X_112_8: 0 (1.6) <= 1 > > > 0 <= X_112_9: 0 (1.3) <= 1 > > > 0 <= X_112_10: 0 (1) <= 1 > > > 0 <= X_112_11: 0 (0.8) <= 1 > > > 0 <= X_112_12: 0 (0.6) <= 1 > > > 0 <= X_112_13: 0 (0.5) <= 1 > > > 0 <= X_112_14: 0 (0.5) <= 1 > > > 0 <= X_112_15: 0 (0.6) <= 1 > > > 0 <= X_112_16: 0 (0.8) <= 1 > > > 0 <= X_112_17: 0 (1.2) <= 1 > > > 0 <= X_112_18: 0 (1.7) <= 1 > > > 0 <= X_112_19: 0 (2.4) <= 1 > > > > > > If you want I tell you more details of our model. > > > Thanks. > > > > > > > > > 2013/2/22 Anders Peterson <an...@op...> > > > I have no idea... > > > > > > Are you saying that you define a (mixed) integer linear program, and > you get solutions where some integer variables are not at integer values? > > > > > > Did you check the Optimisation.State? Does it indicate that the > problem is solved correctly? > > > > > > Can you supply me with a self-contained directly-runnable test case > that clearly demonstrates how you do things, what you expect to happen and > what actually happens. > > > > > > /Anders > > > > > > > > > On 22 feb 2013, at 12:14, Francisco Verdejo <fra...@gm...> > wrote: > > > > > > > Hi friends, > > > > We are using an integer linear programming. All the variables are > binary. The problem is that the result of some variables are distinct than > 0 and 1. > > > > Why is it? > > > > > > > > Thanks. > > > > > ------------------------------------------------------------------------------ > > > > Everyone hates slow websites. So do we. > > > > Make your web apps faster with AppDynamics > > > > Download AppDynamics Lite for free today: > > > > > http://p.sf.net/sfu/appdyn_d2d_feb_______________________________________________ > > > > ojAlgo-user mailing list > > > > ojAlgo-user@lists..sourceforge.net > > > > https://lists..sourceforge.net/lists/listinfo/ojalgo-user > > > > > > > > > > ------------------------------------------------------------------------------ > > > Everyone hates slow websites. So do we. > > > Make your web apps faster with AppDynamics > > > Download AppDynamics Lite for free today: > > > http://p.sf.net/sfu/appdyn_d2d_feb > > > _______________________________________________ > > > ojAlgo-user mailing list > > > ojAlgo-user@lists..sourceforge.net > > > https://lists.sourceforge.net/lists/listinfo/ojalgo-user > > > > > > > ------------------------------------------------------------------------------ > > > Everyone hates slow websites. So do we. > > > Make your web apps faster with AppDynamics > > > Download AppDynamics Lite for free today: > > > > http://p.sf.net/sfu/appdyn_d2d_feb_______________________________________________ > > > ojAlgo-user mailing list > > > ojAlgo-user@lists..sourceforge.net > > > https://lists.sourceforge.net/lists/listinfo/ojalgo-user > > > > > > > ------------------------------------------------------------------------------ > > Everyone hates slow websites. So do we. > > Make your web apps faster with AppDynamics > > Download AppDynamics Lite for free today: > > http://p.sf.net/sfu/appdyn_d2d_feb > > _______________________________________________ > > ojAlgo-user mailing list > > ojA...@li... > > https://lists.sourceforge.net/lists/listinfo/ojalgo-user > > > > > <Example.java>------------------------------------------------------------------------------ > > Everyone hates slow websites. So do we. > > Make your web apps faster with AppDynamics > > Download AppDynamics Lite for free today: > > > http://p.sf.net/sfu/appdyn_d2d_feb_______________________________________________ > > ojAlgo-user mailing list > > ojA...@li... > > https://lists.sourceforge.net/lists/listinfo/ojalgo-user > > > > ------------------------------------------------------------------------------ > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_d2d_feb > _______________________________________________ > ojAlgo-user mailing list > ojA...@li... > https://lists.sourceforge.net/lists/listinfo/ojalgo-user > |
From: Anders P. <an...@op...> - 2013-02-26 09:58:57
|
Can't see (yet) exactly what the problem is, but it seems to be related to extracting and copying solutions back and forth between the model and solver. The MIP solver is multithreaded, and that adds to the problem... Any one else have problems with the MIP solver? It is very likely the problem was introduced during December/January when I did a lot of work on to the MIP solver. I'm a little short on time at the moment. You have the source code. Please participate in debugging this. One thing that would help a lot is if this behavior can be reproduced in a smaller (as small as possible) model. Would be great if it was possible to simply print the entire simplex tableau and/or all related matrices... /Anders On 25 feb 2013, at 11:55, Francisco Verdejo <fra...@gm...> wrote: > Hi, > Sorry for waiting, I have prepared an example which I send. > Seems that it skips the restrictions of variables for satisfy the restrictions of expression. > I hope it helps you to solve the problem. > Thanks. > Fran. > > > 2013/2/22 Anders Peterson <an...@op...> > Send me a, self-contained and directly-runnable, test case. If you can reproduce the problem with a small(er) model then please do that. /Anders > > On 22 feb 2013, at 12:48, Francisco Verdejo <fra...@gm...> wrote: > > > The variables are binay and the X_111_19=-16 > > Also exits the folowing restriction: sum(X_i_j) = 1 > > The variables with problem are X_111_j, the variable X_112_j are ok. > > The result state are: OPTIMAL 295.5 > > > > This is a print of variables after solve > > > > 0 <= X_111_0: 0 (6.6) <= 1 > > 0 <= X_111_1: 1 (5.8) <= 1 > > 0 <= X_111_2: 1 (5) <= 1 > > 0 <= X_111_3: 0 (4.2) <= 1 > > 0 <= X_111_4: 1 (3.5) <= 1 > > 0 <= X_111_5: 1 (2.9) <= 1 > > 0 <= X_111_6: 1 (2.3) <= 1 > > 0 <= X_111_7: 1 (1.9) <= 1 > > 0 <= X_111_8: 1 (1.5) <= 1 > > 0 <= X_111_9: 1 (1.2) <= 1 > > 0 <= X_111_10: 1 (0.9) <= 1 > > 0 <= X_111_11: 1 (0.7) <= 1 > > 0 <= X_111_12: 1 (0.6) <= 1 > > 0 <= X_111_13: 1 (0.6) <= 1 > > 0 <= X_111_14: 1 (0.8) <= 1 > > 0 <= X_111_15: 1 (1) <= 1 > > 0 <= X_111_16: 1 (1.4) <= 1 > > 0 <= X_111_17: 1 (2) <= 1 > > 0 <= X_111_18: 1 (2.8) <= 1 > > 0 <= X_111_19: -16 (3.6) <= 1 > > > > 0 <= X_112_0: 0 (7.1) <= 1 > > 0 <= X_112_1: 0 (6.1) <= 1 > > 0 <= X_112_2: 0 (5.3) <= 1 > > 0 <= X_112_3: 0 (4.5) <= 1 > > 0 <= X_112_4: 0 (3.8) <= 1 > > 0 <= X_112_5: 1 (3.1) <= 1 > > 0 <= X_112_6: 0 (2..6) <= 1 > > 0 <= X_112_7: 0 (2.1) <= 1 > > 0 <= X_112_8: 0 (1.6) <= 1 > > 0 <= X_112_9: 0 (1.3) <= 1 > > 0 <= X_112_10: 0 (1) <= 1 > > 0 <= X_112_11: 0 (0.8) <= 1 > > 0 <= X_112_12: 0 (0.6) <= 1 > > 0 <= X_112_13: 0 (0.5) <= 1 > > 0 <= X_112_14: 0 (0.5) <= 1 > > 0 <= X_112_15: 0 (0.6) <= 1 > > 0 <= X_112_16: 0 (0.8) <= 1 > > 0 <= X_112_17: 0 (1.2) <= 1 > > 0 <= X_112_18: 0 (1.7) <= 1 > > 0 <= X_112_19: 0 (2.4) <= 1 > > > > If you want I tell you more details of our model. > > Thanks. > > > > > > 2013/2/22 Anders Peterson <an...@op...> > > I have no idea... > > > > Are you saying that you define a (mixed) integer linear program, and you get solutions where some integer variables are not at integer values? > > > > Did you check the Optimisation.State? Does it indicate that the problem is solved correctly? > > > > Can you supply me with a self-contained directly-runnable test case that clearly demonstrates how you do things, what you expect to happen and what actually happens. > > > > /Anders > > > > > > On 22 feb 2013, at 12:14, Francisco Verdejo <fra...@gm...> wrote: > > > > > Hi friends, > > > We are using an integer linear programming. All the variables are binary. The problem is that the result of some variables are distinct than 0 and 1. > > > Why is it? > > > > > > Thanks. > > > ------------------------------------------------------------------------------ > > > Everyone hates slow websites. So do we. > > > Make your web apps faster with AppDynamics > > > Download AppDynamics Lite for free today: > > > http://p.sf.net/sfu/appdyn_d2d_feb_______________________________________________ > > > ojAlgo-user mailing list > > > ojAlgo-user@lists..sourceforge.net > > > https://lists..sourceforge.net/lists/listinfo/ojalgo-user > > > > > > ------------------------------------------------------------------------------ > > Everyone hates slow websites. So do we. > > Make your web apps faster with AppDynamics > > Download AppDynamics Lite for free today: > > http://p.sf.net/sfu/appdyn_d2d_feb > > _______________________________________________ > > ojAlgo-user mailing list > > ojAlgo-user@lists..sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/ojalgo-user > > > > ------------------------------------------------------------------------------ > > Everyone hates slow websites. So do we. > > Make your web apps faster with AppDynamics > > Download AppDynamics Lite for free today: > > http://p.sf.net/sfu/appdyn_d2d_feb_______________________________________________ > > ojAlgo-user mailing list > > ojAlgo-user@lists..sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/ojalgo-user > > > ------------------------------------------------------------------------------ > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_d2d_feb > _______________________________________________ > ojAlgo-user mailing list > ojA...@li... > https://lists.sourceforge.net/lists/listinfo/ojalgo-user > > <Example.java>------------------------------------------------------------------------------ > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_d2d_feb_______________________________________________ > ojAlgo-user mailing list > ojA...@li... > https://lists.sourceforge.net/lists/listinfo/ojalgo-user |
From: Anders P. <an...@op...> - 2013-02-22 13:01:44
|
Send me a, self-contained and directly-runnable, test case. If you can reproduce the problem with a small(er) model then please do that. /Anders On 22 feb 2013, at 12:48, Francisco Verdejo <fra...@gm...> wrote: > The variables are binay and the X_111_19=-16 > Also exits the folowing restriction: sum(X_i_j) = 1 > The variables with problem are X_111_j, the variable X_112_j are ok. > The result state are: OPTIMAL 295.5 > > This is a print of variables after solve > > 0 <= X_111_0: 0 (6.6) <= 1 > 0 <= X_111_1: 1 (5.8) <= 1 > 0 <= X_111_2: 1 (5) <= 1 > 0 <= X_111_3: 0 (4.2) <= 1 > 0 <= X_111_4: 1 (3.5) <= 1 > 0 <= X_111_5: 1 (2.9) <= 1 > 0 <= X_111_6: 1 (2.3) <= 1 > 0 <= X_111_7: 1 (1.9) <= 1 > 0 <= X_111_8: 1 (1.5) <= 1 > 0 <= X_111_9: 1 (1.2) <= 1 > 0 <= X_111_10: 1 (0.9) <= 1 > 0 <= X_111_11: 1 (0.7) <= 1 > 0 <= X_111_12: 1 (0.6) <= 1 > 0 <= X_111_13: 1 (0.6) <= 1 > 0 <= X_111_14: 1 (0.8) <= 1 > 0 <= X_111_15: 1 (1) <= 1 > 0 <= X_111_16: 1 (1.4) <= 1 > 0 <= X_111_17: 1 (2) <= 1 > 0 <= X_111_18: 1 (2.8) <= 1 > 0 <= X_111_19: -16 (3.6) <= 1 > > 0 <= X_112_0: 0 (7.1) <= 1 > 0 <= X_112_1: 0 (6.1) <= 1 > 0 <= X_112_2: 0 (5.3) <= 1 > 0 <= X_112_3: 0 (4.5) <= 1 > 0 <= X_112_4: 0 (3.8) <= 1 > 0 <= X_112_5: 1 (3.1) <= 1 > 0 <= X_112_6: 0 (2..6) <= 1 > 0 <= X_112_7: 0 (2.1) <= 1 > 0 <= X_112_8: 0 (1.6) <= 1 > 0 <= X_112_9: 0 (1.3) <= 1 > 0 <= X_112_10: 0 (1) <= 1 > 0 <= X_112_11: 0 (0.8) <= 1 > 0 <= X_112_12: 0 (0.6) <= 1 > 0 <= X_112_13: 0 (0.5) <= 1 > 0 <= X_112_14: 0 (0.5) <= 1 > 0 <= X_112_15: 0 (0.6) <= 1 > 0 <= X_112_16: 0 (0.8) <= 1 > 0 <= X_112_17: 0 (1.2) <= 1 > 0 <= X_112_18: 0 (1.7) <= 1 > 0 <= X_112_19: 0 (2.4) <= 1 > > If you want I tell you more details of our model. > Thanks. > > > 2013/2/22 Anders Peterson <an...@op...> > I have no idea... > > Are you saying that you define a (mixed) integer linear program, and you get solutions where some integer variables are not at integer values? > > Did you check the Optimisation.State? Does it indicate that the problem is solved correctly? > > Can you supply me with a self-contained directly-runnable test case that clearly demonstrates how you do things, what you expect to happen and what actually happens. > > /Anders > > > On 22 feb 2013, at 12:14, Francisco Verdejo <fra...@gm...> wrote: > > > Hi friends, > > We are using an integer linear programming. All the variables are binary. The problem is that the result of some variables are distinct than 0 and 1. > > Why is it? > > > > Thanks. > > ------------------------------------------------------------------------------ > > Everyone hates slow websites. So do we. > > Make your web apps faster with AppDynamics > > Download AppDynamics Lite for free today: > > http://p.sf.net/sfu/appdyn_d2d_feb_______________________________________________ > > ojAlgo-user mailing list > > ojAlgo-user@lists..sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/ojalgo-user > > > ------------------------------------------------------------------------------ > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_d2d_feb > _______________________________________________ > ojAlgo-user mailing list > ojA...@li... > https://lists.sourceforge.net/lists/listinfo/ojalgo-user > > ------------------------------------------------------------------------------ > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_d2d_feb_______________________________________________ > ojAlgo-user mailing list > ojA...@li... > https://lists.sourceforge.net/lists/listinfo/ojalgo-user |
From: Francisco V. <fra...@gm...> - 2013-02-22 11:48:17
|
The variables are binay and the X_111_19=-16 Also exits the folowing restriction: sum(X_i_j) = 1 The variables with problem are X_111_j, the variable X_112_j are ok. The result state are: OPTIMAL 295.5 This is a print of variables after solve 0 <= X_111_0: 0 (6.6) <= 1 0 <= X_111_1: 1 (5.8) <= 1 0 <= X_111_2: 1 (5) <= 1 0 <= X_111_3: 0 (4.2) <= 1 0 <= X_111_4: 1 (3.5) <= 1 0 <= X_111_5: 1 (2.9) <= 1 0 <= X_111_6: 1 (2.3) <= 1 0 <= X_111_7: 1 (1.9) <= 1 0 <= X_111_8: 1 (1.5) <= 1 0 <= X_111_9: 1 (1.2) <= 1 0 <= X_111_10: 1 (0.9) <= 1 0 <= X_111_11: 1 (0.7) <= 1 0 <= X_111_12: 1 (0.6) <= 1 0 <= X_111_13: 1 (0.6) <= 1 0 <= X_111_14: 1 (0.8) <= 1 0 <= X_111_15: 1 (1) <= 1 0 <= X_111_16: 1 (1.4) <= 1 0 <= X_111_17: 1 (2) <= 1 0 <= X_111_18: 1 (2.8) <= 1 0 <= X_111_19: -16 (3.6) <= 1 0 <= X_112_0: 0 (7.1) <= 1 0 <= X_112_1: 0 (6.1) <= 1 0 <= X_112_2: 0 (5.3) <= 1 0 <= X_112_3: 0 (4.5) <= 1 0 <= X_112_4: 0 (3.8) <= 1 0 <= X_112_5: 1 (3.1) <= 1 0 <= X_112_6: 0 (2.6) <= 1 0 <= X_112_7: 0 (2.1) <= 1 0 <= X_112_8: 0 (1.6) <= 1 0 <= X_112_9: 0 (1.3) <= 1 0 <= X_112_10: 0 (1) <= 1 0 <= X_112_11: 0 (0.8) <= 1 0 <= X_112_12: 0 (0.6) <= 1 0 <= X_112_13: 0 (0.5) <= 1 0 <= X_112_14: 0 (0.5) <= 1 0 <= X_112_15: 0 (0.6) <= 1 0 <= X_112_16: 0 (0.8) <= 1 0 <= X_112_17: 0 (1.2) <= 1 0 <= X_112_18: 0 (1.7) <= 1 0 <= X_112_19: 0 (2.4) <= 1 If you want I tell you more details of our model. Thanks. 2013/2/22 Anders Peterson <an...@op...> > I have no idea... > > Are you saying that you define a (mixed) integer linear program, and you > get solutions where some integer variables are not at integer values? > > Did you check the Optimisation.State? Does it indicate that the problem is > solved correctly? > > Can you supply me with a self-contained directly-runnable test case that > clearly demonstrates how you do things, what you expect to happen and what > actually happens. > > /Anders > > > On 22 feb 2013, at 12:14, Francisco Verdejo <fra...@gm...> > wrote: > > > Hi friends, > > We are using an integer linear programming. All the variables are > binary. The problem is that the result of some variables are distinct than > 0 and 1. > > Why is it? > > > > Thanks. > > > ------------------------------------------------------------------------------ > > Everyone hates slow websites. So do we. > > Make your web apps faster with AppDynamics > > Download AppDynamics Lite for free today: > > > http://p.sf.net/sfu/appdyn_d2d_feb_______________________________________________ > > ojAlgo-user mailing list > > ojA...@li... > > https://lists.sourceforge.net/lists/listinfo/ojalgo-user > > > > ------------------------------------------------------------------------------ > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_d2d_feb > _______________________________________________ > ojAlgo-user mailing list > ojA...@li... > https://lists.sourceforge.net/lists/listinfo/ojalgo-user > |