Re: [ojAlgo-user] "Approximate" optimization results that don't satisfy constraints
Mathematics, linear algebra and optimisation
Brought to you by:
apete
From: Anders P. <an...@op...> - 2014-07-30 07:26:45
|
I believe this message I sent to the list the other is the "answer" to your question: Begin forwarded message: > From: Anders Peterson > Subject: Re: [ojAlgo-user] QuadraticSolver returns different results for the exact same problem > Date: 28 juli 2014 11:41:07 CEST > To: ojAlgo ojAlgo <oja...@li...> > > There is now a new solver org.ojalgo.optimisation.convex.ConvexSolver intended to replace and extend the functionality of org.ojalgo.optimisation.quadratic.QuadraticSolver. The new solver currently/still has exactly the same api as the old one - it's easy to switch between them. > > If you're using ExpressionsBasedModel (or MarkowitzModel in the org.ojalgo.finance.portfolio package) you should make sure that the method getDefaultSolver() contains this: > > //return QuadraticSolver.make(this); > return ConvexSolver.make(this); > > > The intention is that the new solver should handle more problems/cases, get rid of some odd behavior and scale better. > > If you're currently using ojAlgo to solve quadratic optimisation problems please try this new solver and report problems to this mailing list. > > Get the latest source code either from > > http://sourceforge.net/p/ojalgo/code/ > > or > > https://github.com/optimatika/ojAlgo I'm still working on getting rid of the last failing test cases. Very interested in getting feedback on what happens with larger models and models with integer constraints. 1) Get the latest source code 2) Make sure ExpressionsBasedModel uses the new ConvexSolver 3) Continue testing as before /Anders On 29 jul 2014, at 21:33, Edward Tolson <et...@gm...> wrote: > Hello, > > I am investigating ojalgo in the context of portfolio/investment optimization. Unlike the typical Markowitz case, our use case contains real-world complications including shorting assets, transaction costs, and limiting gross and net exposure. The problem can still be modeled as a quadratic optimization, but the number of variables increases quite a bit. I was gradually increasing the number of variables into ojalgo and got stopped pretty quickly. At around 200 variables I receive results that are "Approximate" and in fact the result provided did not match the simple constraints of the problem. I found this quite strange as finding a solution matching the constraints is very simple (and such a starting point was provided to the optimizer). Why would the optimizer return me an "Approximate" solution that doesn't match the constraints at all rather than returning me the best solution meeting the constraints that it could find (including the one I provided as the starting point)? > > The problem as I'm currently setting it up is relatively straightforward other than the large-ish number of variables. Each variable has a min and max constraint, which are the only constraints I'm providing so far. The objective is then a standard quadratic objective to be minimized. > > I'm setting up the problem by constructing an ExpressionsBasedModel, providing it the variables (each with a lower, upper, and starting value), and then providing the model the quadratic and linear expressions to be minimized. > > Any feedback or assistance would be appreciated. > > Here is a toString of the model after being minimized in case it helps. You can see that most of the variables are wildly outside of their bounds. > > ############################################ > 0.000047 <= v0: 0.000047 <= 0.002593 > 0 <= v1: 12.399095 <= 0.002180 > -0.002822 <= v2: -1.639345 <= 0 > -0.002617 <= v3: 9.242242 <= 0 > -0.002228 <= v4: -6.685084 <= 0 > -0.002006 <= v5: 7.002208 <= 0 > 0.000099 <= v6: 0.001492 <= 0.001492 > 0 <= v7: -15.831819 <= 0.001120 > 0.000154 <= v8: -0.654343 <= 0.004867 > 0 <= v9: -0.654343 <= 0.003971 > 0.000004 <= v10: 0.004626 <= 0.004626 > 0 <= v11: -3.352390 <= 0.004041 > 0 <= v12: 10.393662 <= 0.003149 > 0 <= v13: 10.393662 <= 0.002781 > -0.002782 <= v14: -0.002782 <= -0.000033 > -0.002372 <= v15: 14.427516 <= 0 > -0.013213 <= v16: -0.013213 <= -0.000521 > -0.010585 <= v17: -19.335598 <= 0 > -0.002088 <= v18: -9.886252 <= 0 > -0.001852 <= v19: 7.130217 <= 0 > 0.000840 <= v20: 0.000840 <= 0..009390 > 0 <= v21: 24.037796 <= 0.006642 > 0.000016 <= v22: -3.275853 <= 0.002073 > 0 <= v23: -3.275853 <= 0.001784 > 0 <= v24: -0.926375 <= 0.002628 > 0 <= v25: -0.926375 <= 0.002318 > 0.000014 <= v26: 4.944956 <= 0.002697 > 0 <= v27: 4.944956 <= 0.002334 > 0.000727 <= v28: -0.801618 <= 0.007707 > 0 <= v29: -0.801618 <= 0.005381 > 0.000168 <= v30: 0.000168 <= 0.006497 > 0 <= v31: 0 <= 0.005370 > -0.003646 <= v32: -0.000007 <= -0.000007 > -0.003178 <= v33: -9.548069 <= 0 > -0.006960 <= v34: -30.222010 <= 0 > -0.006120 <= v35: 9.120492 <= 0 > -0.002726 <= v36: -0.002726 <= -0.000039 > -0.002313 <= v37: 10.738876 <= 0 > 0 <= v38: 15.791419 <= 0.006325 > 0 <= v39: 15.791419 <= 0.005569 > -0.003546 <= v40: -0.000007 <= -0.000007 > -0.003090 <= v41: 10.877754 <= 0 > 0.000017 <= v42: 0.001999 <= 0.001999 > 0 <= v43: -12.511306 <= 0.001718 > 0.000172 <= v44: 0.000172 <= 0.010036 > 0 <= v45: 11.863053 <= 0..008460 > 0.000116 <= v46: -0.196284 <= 0.005268 > 0 <= v47: -0.196284 <= 0.004392 > 0.000310 <= v48: 1.026073 <= 0.004785 > 0 <= v49: 1.026073 <= 0.003606 > 0.000027 <= v50: 0.003538 <= 0.003538 > 0 <= v51: -13.694850 <= 0.003045 > 0.000314 <= v52: -2.658083 <= 0.012414 > 0 <= v53: -2.658083 <= 0.010274 > 0.000031 <= v54: 0.007608 <= 0.007608 > 0 <= v55: 3.578124 <= 0.006599 > 0 <= v56: 5.966903 <= 0.004941 > 0 <= v57: 5.966903 <= 0.004518 > 0 <= v58: -10.980529 <= 0.019227 > -0.019227 <= v59: 8.256236 <= 0 > -0.008174 <= v60: -22.822929 <= 0 > -0.007344 <= v61: 8.710203 <= 0 > 0 <= v62: 5.836502 <= 0.001974 > 0 <= v63: 5.836502 <= 0.001759 > 0 <= v64: -31.361763 <= 0.001513 > -0.001513 <= v65: 38.911668 <= 0 > -0.005145 <= v66: -13.969862 <= 0 > -0.004651 <= v67: 8.621640 <= 0 > 0.000003 <= v68: 0.007058 <= 0.007058 > 0 <= v69: -23.345131 <= 0.006170 > -0.009407 <= v70: -9.911777 <= 0 > -0.008307 <= v71: -2.999295 <= 0 > 0 <= v72: -6.330518 <= 0.006093 > 0 <= v73: -6.330518 <= 0.005362 > 0.000024 <= v74: 0.001785 <= 0.001785 > 0 <= v75: -24.557506 <= 0..001516 > -0.002806 <= v76: -0.002806 <= -0.000017 > -0.002424 <= v77: 25.120967 <= 0 > -0.004065 <= v78: -12.482007 <= 0 > -0.003562 <= v79: 18.072430 <= 0 > 0.000014 <= v80: 7.902697 <= 0.001913 > 0 <= v81: 7.902697 <= 0.001647 > -0.004862 <= v82: -23.278184 <= 0 > -0.004341 <= v83: 15.855152 <= 0 > -0.003301 <= v84: -7.672005 <= -0.000074 > -0.002750 <= v85: 4.081453 <= 0 > -0.011429 <= v86: -9.231121 <= 0 > -0.010169 <= v87: 20.433090 <= 0 > 0.000044 <= v88: 0.003628 <= 0.003628 > 0 <= v89: -20.725597 <= 0.003091 > -0.003857 <= v90: -8.605115 <= 0 > -0.003523 <= v91: 4.038718 <= 0 > 0 <= v92: -3.002273 <= 0.006223 > -0.006223 <= v93: 40.654612 <= 0 > -0.004187 <= v94: -0.004187 <= -0.000001 > -0.003662 <= v95: 2.308138 <= 0 > -0.005387 <= v96: -50.121281 <= 0 > -0.005080 <= v97: 6.731258 <= 0 > -0.005095 <= v98: -8.260419 <= -0.000143 > -0.004190 <= v99: 2.691277 <= 0 > -0.004629 <= v100: -20.052445 <= 0 > -0.004078 <= v101: 6.520501 <= 0 > -0.002092 <= v102: -6.164178 <= 0 > -0.001843 <= v103: 36.442212 <= 0 > -0.001778 <= v104: -0.001778 <= -0.000071 > -0.001423 <= v105: 9.796041 <= 0 > -0.008854 <= v106: 4.812977 <= 0 > 0 <= v107: 4.812977 <= 0.002873 > -0.011727 <= v108: 12.051375 <= 0 > -0.002280 <= v109: -0.002280 <= -0.000027 > -0.001945 <= v110: 11.204495 <= 0 > 0 <= v111: -9.731284 <= 0.010427 > 0 <= v112: -9.731284 <= 0.009155 > -0.004582 <= v113: -0.004582 <= -0.000051 > -0.003913 <= v114: 17.815327 <= 0 > 0 <= v115: -0.268223 <= 0.001641 > 0 <= v116: -0.268223 <= 0.001472 > 0.000177 <= v117: -2.271096 <= 0.002321 > 0 <= v118: -2.271096 <= 0.001699 > -0.003382 <= v119: -0.000008 <= -0.000008 > -0.002945 <= v120: -11.239441 <= 0 > -0.001377 <= v121: -11.528363 <= 0 > -0.001250 <= v122: -3.873247 <= 0 > 0.000077 <= v123: 2.934028 <= 0.003083 > 0 <= v124: 2.934028 <= 0.002552 > 0 <= v125: 14.661636 <= 0.003678 > 0 <= v126: 14.661636 <= 0.003312 > 0.000042 <= v127: -1.802925 <= 0.006800 > 0 <= v128: -1.802925 <= 0.005871 > 0 <= v129: 11.250457 <= 0.002385 > 0 <= v130: 11.250457 <= 0.002122 > 0.000008 <= v131: 0.002320 <= 0.002320 > 0 <= v132: -10.798308 <= 0.002015 > -0.002007 <= v133: -15.310603 <= -0.000087 > -0.001592 <= v134: 3.336150 <= 0 > 0 <= v135: -13.208688 <= 0.004539 > 0 <= v136: -13.208688 <= 0.004055 > 0.000004 <= v137: 0.000004 <= 0.002534 > 0 <= v138: 14.884312 <= 0.002211 > -0.003423 <= v139: -4.819391 <= 0 > -0.003064 <= v140: 7.298642 <= 0 > -0.011636 <= v141: -24.667288 <= 0 > 0 <= v142: 0 <= 0.000553 > -0.011218 <= v143: 9.120121 <= 0 > 0.000007 <= v144: 0.000007 <= 0.006453 > 0 <= v145: 8.706559 <= 0.005633 > 0.000011 <= v146: 0.000011 <= 0.002405 > 0 <= v147: 5.452150 <= 0.002083 > -0.007417 <= v148: -0.000105 <= -0.000105 > -0.006293 <= v149: -4.366268 <= 0 > 0.000015 <= v150: 0.002860 <= 0.002860 > 0 <= v151: -8.083382 <= 0.002475 > -0.004296 <= v152: -12.277851 <= 0 > -0.003764 <= v153: 8.536914 <= 0 > 0 <= v154: -1.525872 <= 0.000283 > 0 <= v155: -1.525872 <= 0.009001 > -0.008718 <= v156: 3.101125 <= 0 > 0.000272 <= v157: 3.384421 <= 0.007179 > 0 <= v158: 3.384421 <= 0.005772 > -0.011396 <= v159: -5.275025 <= -0.000223 > -0.009553 <= v160: 5.121074 <= 0 > -0.005891 <= v161: -5.439854 <= -0.000071 > -0.005021 <= v162: 3.615476 <= 0 > 0 <= v163: -3.953251 <= 0.003710 > 0 <= v164: -3.953251 <= 0.003428 > -0.002616 <= v165: -30.472951 <= 0 > -0.002310 <= v166: -12.734294 <= 0 > -0.003079 <= v167: -0.003079 <= -0.000012 > -0.002671 <= v168: 36.036856 <= 0 > -0.002525 <= v169: 4.658318 <= 0 > -0.002276 <= v170: 23.741247 <= 0 > -0.004125 <= v171: -0.004125 <= -0.000030 > -0.003554 <= v172: -4.883884 <= 0 > -0.004381 <= v173: -27.223216 <= 0 > -0.003908 <= v174: 0.373790 <= 0 > -0.002665 <= v175: -10.326246 <= 0 > -0.002350 <= v176: 20.589187 <= 0 > 0.000129 <= v177: 3.901199 <= 0.002780 > 0 <= v178: 3.901199 <= 0.002191 > 0 <= v179: 4.868897 <= 0.001489 > 0 <= v180: 4.868897 <= 0.001310 > 0 <= v181: -2.307442 <= 0.003723 > 0 <= v182: -2.307442 <= 0.003519 > secondOrderMinimization: 0.766253 (1.000000) > linearMinimization: -1.532517 (1.000000) > ############################################ > > ------------------------------------------------------------------------------ > Infragistics Professional > Build stunning WinForms apps today! > Reboot your WinForms applications with our WinForms controls. > Build a bridge from your legacy apps to the future. > http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk_______________________________________________ > ojAlgo-user mailing list > ojA...@li... > https://lists.sourceforge.net/lists/listinfo/ojalgo-user |