######################################################################## # # MIDACO 7 benchmark - MINLPLib smallinvDAXr4b010-011: Surrogate mode # ------------------------------------------------------------------ # # Portfolio of a small investor in the 30 stocks of the DAX index: the # variables are the integer numbers of shares to buy (0 to 100 each). # Minimize the risk (variance, a convex quadratic function) subject to # a minimum expected return and a budget between 1000 and 1100. Shown # here as an EXPENSIVE problem: with the SURROGATE mode MIDACO reaches # the optimum in about two hundred evaluations, where the default # search needs several hundred thousand. # # MINLPLib instance smallinvDAXr4b010-011: # https://www.minlplib.org/smallinvDAXr4b010-011.html # # Variables: 30 integer variables # Constraints: 3 inequality constraints # Optimum: F(X) = 0.398797498 (proven optimal) # # The objective variable of the MINLPLib model is eliminated, so the # model here has one variable and one constraint less than listed # there. # # MIDACO setting: PARAM(14) = 2 (SURROGATE, Kriging model), budget # of 10000 evaluations, start at the lower bounds, the run stops # when F(X) reaches the optimum (FSTOP). With the default PARAM(14) # = 0 MIDACO needs between 300,000 and 730,000 evaluations (seeds 0 # to 3). # # Run it with: julia smallinvDAXr4b010_011_surrogate.jl # # This benchmark needs a full MIDACO license: the limited version # solves problems with up to 8 variables and the default parameters. # ######################################################################## using Distributed # for @everywhere (option["paradigm"] = 1) only ######################################################################## @everywhere function problem_function(x) # MINLPLib model smallinvDAXr4b010-011 in scalar form: objective f, constraints g # g[1:3] are inequality constraints (>= 0) f=Array{Float64,1}(undef, 1) # Objective F(X) g=Array{Float64,1}(undef, 3) # Constraints G(X) f[1] = -(-0.00558391*x[1]^2-0.0103737*x[2]^2-0.0221075*x[3]^2- 0.00399551*x[4]^2-0.00267064*x[5]^2-0.00516451*x[6]^2- 0.00421051*x[7]^2-0.00368008*x[8]^2-0.00372788*x[9]^2- 0.00668969*x[10]^2-0.00613034*x[11]^2-0.0129271*x[12]^2- 0.00697595*x[13]^2-0.0104282*x[14]^2-0.00899168*x[15]^2- 0.0206685*x[16]^2-0.0488863*x[17]^2-0.00894867*x[18]^2- 0.0124118*x[19]^2-0.0122291*x[20]^2-0.0128973*x[21]^2- 0.00668043*x[22]^2-0.0153425*x[23]^2-0.0128605*x[24]^2- 0.00718697*x[25]^2-0.0102616*x[26]^2-0.0123235*x[27]^2- 0.00569465*x[28]^2-0.00818114*x[29]^2-0.00469456*x[30]^2- 0.00901964*x[1]*x[2]-0.00860972*x[1]*x[3]-0.00248004*x[1]*x[4]- 0.001821292*x[1]*x[5]-0.00561078*x[1]*x[6]-0.0051287*x[1]*x[7]- 0.000691196*x[1]*x[8]-0.000805982*x[1]*x[9]- 0.00531452*x[1]*x[10]-0.00556768*x[1]*x[11]- 0.00745224*x[1]*x[12]-0.00478224*x[1]*x[13]- 0.00610824*x[1]*x[14]-0.00577634*x[1]*x[15]- 0.00613326*x[1]*x[16]-0.01432596*x[1]*x[17]-0.007501*x[1]*x[18]- 0.00716212*x[1]*x[19]-0.00512922*x[1]*x[20]- 0.0087283*x[1]*x[21]-0.00245846*x[1]*x[22]-0.0071572*x[1]*x[23]- 0.00543966*x[1]*x[24]-0.00708258*x[1]*x[25]- 0.00243422*x[1]*x[26]-0.00729094*x[1]*x[27]- 0.00386642*x[1]*x[28]-0.0061908*x[1]*x[29]- 0.00366754*x[1]*x[30]-0.01583972*x[2]*x[3]-0.00394608*x[2]*x[4]- 0.001773554*x[2]*x[5]-0.00861376*x[2]*x[6]-0.00604454*x[2]*x[7]- 0.00312866*x[2]*x[8]-0.00184686*x[2]*x[9]-0.00924638*x[2]*x[10]- 0.01131902*x[2]*x[11]-0.01253232*x[2]*x[12]- 0.00675858*x[2]*x[13]-0.00804604*x[2]*x[14]- 0.00869872*x[2]*x[15]-0.0094047*x[2]*x[16]-0.0251538*x[2]*x[17]- 0.01321532*x[2]*x[18]-0.01127964*x[2]*x[19]- 0.0096635*x[2]*x[20]-0.0160783*x[2]*x[21]-0.00271*x[2]*x[22]- 0.01486022*x[2]*x[23]-0.01091018*x[2]*x[24]- 0.01009426*x[2]*x[25]-0.00754144*x[2]*x[26]- 0.01408844*x[2]*x[27]-0.00544162*x[2]*x[28]- 0.01096178*x[2]*x[29]-0.00574964*x[2]*x[30]- 0.00299428*x[3]*x[4]-0.001239314*x[3]*x[5]-0.01256412*x[3]*x[6]- 0.00899714*x[3]*x[7]-0.00444448*x[3]*x[8]-0.00616612*x[3]*x[9]- 0.0146019*x[3]*x[10]-0.01249836*x[3]*x[11]-0.0264968*x[3]*x[12]- 0.01266506*x[3]*x[13]-0.01358566*x[3]*x[14]- 0.01419766*x[3]*x[15]-0.01033796*x[3]*x[16]-0.040104*x[3]*x[17]- 0.01504214*x[3]*x[18]-0.0210518*x[3]*x[19]-0.0169342*x[3]*x[20]- 0.020394*x[3]*x[21]-0.006361*x[3]*x[22]-0.0173249*x[3]*x[23]- 0.01157254*x[3]*x[24]-0.01601196*x[3]*x[25]- 0.01305808*x[3]*x[26]-0.018918*x[3]*x[27]-0.0100768*x[3]*x[28]- 0.01415258*x[3]*x[29]-0.00890208*x[3]*x[30]- 0.00365082*x[4]*x[5]-0.0031533*x[4]*x[6]-0.001664882*x[4]*x[7]- 0.000487746*x[4]*x[8]-0.00074873*x[4]*x[9]- 0.00279536*x[4]*x[10]-0.000948078*x[4]*x[11]- 0.00218644*x[4]*x[12]-0.001471884*x[4]*x[13]- 0.001764448*x[4]*x[14]-0.001707856*x[4]*x[15]- 0.00415534*x[4]*x[16]-0.00552118*x[4]*x[17]- 0.00298928*x[4]*x[18]-0.000446818*x[4]*x[19]- 0.0042709*x[4]*x[20]-0.00437068*x[4]*x[21]- 0.001584414*x[4]*x[22]-0.0028495*x[4]*x[23]- 0.00550266*x[4]*x[24]-0.0019381*x[4]*x[25]+ 0.000779792*x[4]*x[26]-0.00383714*x[4]*x[27]- 0.00170793*x[4]*x[28]-0.00220852*x[4]*x[29]- 0.001897386*x[4]*x[30]-0.00226608*x[5]*x[6]- 0.001391572*x[5]*x[7]-0.001434726*x[5]*x[8]- 0.000718962*x[5]*x[9]-0.00117417*x[5]*x[10]- 0.001240914*x[5]*x[11]-0.000587866*x[5]*x[12]- 0.0020154*x[5]*x[13]-0.00126883*x[5]*x[14]- 0.000645164*x[5]*x[15]-0.0001425196*x[5]*x[16]- 0.001199014*x[5]*x[17]-0.001896292*x[5]*x[18]+ 0.000289412*x[5]*x[19]-0.001457998*x[5]*x[20]- 0.00199702*x[5]*x[21]-0.001266598*x[5]*x[22]- 0.000764624*x[5]*x[23]-0.001961312*x[5]*x[24]- 0.001748826*x[5]*x[25]+0.00122625*x[5]*x[26]- 0.000753266*x[5]*x[27]-0.00063941*x[5]*x[28]- 0.001644068*x[5]*x[29]-0.001587886*x[5]*x[30]- 0.00454154*x[6]*x[7]-0.001157686*x[6]*x[8]-0.0032018*x[6]*x[9]- 0.00727798*x[6]*x[10]-0.0064553*x[6]*x[11]- 0.00791618*x[6]*x[12]-0.00687526*x[6]*x[13]- 0.00638032*x[6]*x[14]-0.00425538*x[6]*x[15]- 0.00583332*x[6]*x[16]-0.01491304*x[6]*x[17]- 0.00876772*x[6]*x[18]-0.00814434*x[6]*x[19]- 0.00549208*x[6]*x[20]-0.0103848*x[6]*x[21]- 0.001352278*x[6]*x[22]-0.0063097*x[6]*x[23]- 0.0052012*x[6]*x[24]-0.00808494*x[6]*x[25]- 0.00595234*x[6]*x[26]-0.00960786*x[6]*x[27]- 0.0035648*x[6]*x[28]-0.00730486*x[6]*x[29]-0.0036145*x[6]*x[30]- 0.0027426*x[7]*x[8]-0.00224138*x[7]*x[9]-0.00558948*x[7]*x[10]- 0.00489378*x[7]*x[11]-0.0073565*x[7]*x[12]-0.0050794*x[7]*x[13]- 0.00363244*x[7]*x[14]-0.00634576*x[7]*x[15]- 0.001588982*x[7]*x[16]-0.00877926*x[7]*x[17]- 0.00710862*x[7]*x[18]-0.00675396*x[7]*x[19]- 0.00621206*x[7]*x[20]-0.00746652*x[7]*x[21]- 0.001927036*x[7]*x[22]-0.00410122*x[7]*x[23]- 0.00344774*x[7]*x[24]-0.00594546*x[7]*x[25]- 0.00461784*x[7]*x[26]-0.00530234*x[7]*x[27]- 0.00320122*x[7]*x[28]-0.00474356*x[7]*x[29]- 0.00341222*x[7]*x[30]-0.00105347*x[8]*x[9]- 0.001879822*x[8]*x[10]-0.00290244*x[8]*x[11]- 0.00353818*x[8]*x[12]-0.0035513*x[8]*x[13]- 0.00294406*x[8]*x[14]-0.00389942*x[8]*x[15]- 0.00286866*x[8]*x[16]-0.000920126*x[8]*x[17]- 0.00274282*x[8]*x[18]-0.0027675*x[8]*x[19]- 0.00464592*x[8]*x[20]-0.001093444*x[8]*x[21]- 0.000948594*x[8]*x[22]-0.00275316*x[8]*x[23]- 0.001626794*x[8]*x[24]-0.00209498*x[8]*x[25]- 0.0031962*x[8]*x[26]-0.001767658*x[8]*x[27]- 0.00109948*x[8]*x[28]-0.00292004*x[8]*x[29]- 0.00215496*x[8]*x[30]-0.00329222*x[9]*x[10]- 0.00239978*x[9]*x[11]-0.00365066*x[9]*x[12]- 0.00463422*x[9]*x[13]-0.00260888*x[9]*x[14]- 0.00330432*x[9]*x[15]-0.000950274*x[9]*x[16]- 0.00309664*x[9]*x[17]-0.00325462*x[9]*x[18]- 0.00494078*x[9]*x[19]-0.00339202*x[9]*x[20]- 0.00283784*x[9]*x[21]-0.001862472*x[9]*x[22]- 0.001457294*x[9]*x[23]-0.000292408*x[9]*x[24]- 0.00434258*x[9]*x[25]-0.0051917*x[9]*x[26]- 0.00442724*x[9]*x[27]-0.00235362*x[9]*x[28]- 0.0023207*x[9]*x[29]-0.00232972*x[9]*x[30]- 0.00661128*x[10]*x[11]-0.0099349*x[10]*x[12]- 0.00670728*x[10]*x[13]-0.00688756*x[10]*x[14]- 0.00814804*x[10]*x[15]-0.00387536*x[10]*x[16]- 0.01709622*x[10]*x[17]-0.00921546*x[10]*x[18]- 0.01138012*x[10]*x[19]-0.0073598*x[10]*x[20]- 0.012047*x[10]*x[21]-0.001953884*x[10]*x[22]- 0.01110682*x[10]*x[23]-0.00744232*x[10]*x[24]- 0.00846572*x[10]*x[25]-0.00811902*x[10]*x[26]- 0.01093528*x[10]*x[27]-0.00642736*x[10]*x[28]- 0.00817838*x[10]*x[29]-0.00467066*x[10]*x[30]- 0.01089978*x[11]*x[12]-0.00580646*x[11]*x[13]- 0.00479126*x[11]*x[14]-0.00655088*x[11]*x[15]- 0.00784072*x[11]*x[16]-0.0171429*x[11]*x[17]- 0.0099023*x[11]*x[18]-0.00881158*x[11]*x[19]- 0.0065332*x[11]*x[20]-0.01111462*x[11]*x[21]- 0.00238226*x[11]*x[22]-0.00942038*x[11]*x[23]- 0.00509366*x[11]*x[24]-0.0079177*x[11]*x[25]- 0.00653764*x[11]*x[26]-0.00963386*x[11]*x[27]- 0.00518254*x[11]*x[28]-0.00839924*x[11]*x[29]- 0.00396162*x[11]*x[30]-0.00812884*x[12]*x[13]- 0.00932748*x[12]*x[14]-0.01172114*x[12]*x[15]- 0.00937084*x[12]*x[16]-0.033621*x[12]*x[17]- 0.0125625*x[12]*x[18]-0.01635358*x[12]*x[19]- 0.01460644*x[12]*x[20]-0.01374474*x[12]*x[21]- 0.00526496*x[12]*x[22]-0.01402198*x[12]*x[23]- 0.00931776*x[12]*x[24]-0.01195866*x[12]*x[25]- 0.00822682*x[12]*x[26]-0.01241788*x[12]*x[27]- 0.00706034*x[12]*x[28]-0.01219462*x[12]*x[29]- 0.00598988*x[12]*x[30]-0.0068538*x[13]*x[14]- 0.00620178*x[13]*x[15]-0.00379406*x[13]*x[16]- 0.00889862*x[13]*x[17]-0.00816594*x[13]*x[18]- 0.01033824*x[13]*x[19]-0.00577162*x[13]*x[20]- 0.00736548*x[13]*x[21]-0.00410776*x[13]*x[22]- 0.00580558*x[13]*x[23]-0.00459074*x[13]*x[24]- 0.0072167*x[13]*x[25]-0.00956086*x[13]*x[26]- 0.00943468*x[13]*x[27]-0.00587164*x[13]*x[28]- 0.00902842*x[13]*x[29]-0.00550608*x[13]*x[30]- 0.00635356*x[14]*x[15]-0.00709628*x[14]*x[16]- 0.01555038*x[14]*x[17]-0.00826722*x[14]*x[18]- 0.00751614*x[14]*x[19]-0.00814342*x[14]*x[20]- 0.00995652*x[14]*x[21]-0.00477798*x[14]*x[22]- 0.0076843*x[14]*x[23]-0.00817698*x[14]*x[24]- 0.00886056*x[14]*x[25]-0.00579636*x[14]*x[26]- 0.01128084*x[14]*x[27]-0.00483444*x[14]*x[28]- 0.0068342*x[14]*x[29]-0.0077372*x[14]*x[30]- 0.00973548*x[15]*x[16]-0.01556958*x[15]*x[17]- 0.00926266*x[15]*x[18]-0.01281188*x[15]*x[19]- 0.00669072*x[15]*x[20]-0.00937684*x[15]*x[21]- 0.00639856*x[15]*x[22]-0.00611934*x[15]*x[23]- 0.00853942*x[15]*x[24]-0.00964296*x[15]*x[25]- 0.00704584*x[15]*x[26]-0.0119279*x[15]*x[27]- 0.00648174*x[15]*x[28]-0.01050128*x[15]*x[29]- 0.00502696*x[15]*x[30]-0.01809222*x[16]*x[17]- 0.00823288*x[16]*x[18]-0.01161214*x[16]*x[19]- 0.00533676*x[16]*x[20]-0.01233794*x[16]*x[21]- 0.00512778*x[16]*x[22]-0.00722276*x[16]*x[23]- 0.01715638*x[16]*x[24]-0.00677738*x[16]*x[25]- 0.0069565*x[16]*x[26]-0.01691522*x[16]*x[27]- 0.00246824*x[16]*x[28]-0.00934088*x[16]*x[29]- 0.00393866*x[16]*x[30]-0.01858542*x[17]*x[18]- 0.0224912*x[17]*x[19]-0.01793624*x[17]*x[20]- 0.0270204*x[17]*x[21]-0.01083832*x[17]*x[22]- 0.0216678*x[17]*x[23]-0.0183347*x[17]*x[24]-0.01893*x[17]*x[25]- 0.01089098*x[17]*x[26]-0.0209142*x[17]*x[27]- 0.01273162*x[17]*x[28]-0.0200902*x[17]*x[29]- 0.00774366*x[17]*x[30]-0.01171594*x[18]*x[19]- 0.00861454*x[18]*x[20]-0.01414322*x[18]*x[21]- 0.001961404*x[18]*x[22]-0.00910214*x[18]*x[23]- 0.01003468*x[18]*x[24]-0.0094743*x[18]*x[25]- 0.00825794*x[18]*x[26]-0.01336058*x[18]*x[27]- 0.00607998*x[18]*x[28]-0.01070732*x[18]*x[29]- 0.00492858*x[18]*x[30]-0.0082848*x[19]*x[20]- 0.0126004*x[19]*x[21]-0.00407366*x[19]*x[22]- 0.01381284*x[19]*x[23]-0.00838908*x[19]*x[24]- 0.01198264*x[19]*x[25]-0.01583126*x[19]*x[26]- 0.01664044*x[19]*x[27]-0.00924324*x[19]*x[28]- 0.01214842*x[19]*x[29]-0.00592778*x[19]*x[30]- 0.01071434*x[20]*x[21]-0.00296964*x[20]*x[22]- 0.00736528*x[20]*x[23]-0.00606396*x[20]*x[24]- 0.00628822*x[20]*x[25]-0.00817696*x[20]*x[26]- 0.00776894*x[20]*x[27]-0.0026202*x[20]*x[28]- 0.00717342*x[20]*x[29]-0.00579184*x[20]*x[30]- 0.00469936*x[21]*x[22]-0.0138599*x[21]*x[23]- 0.0125037*x[21]*x[24]-0.01211002*x[21]*x[25]- 0.00836436*x[21]*x[26]-0.016494*x[21]*x[27]- 0.00602872*x[21]*x[28]-0.01180462*x[21]*x[29]- 0.00570478*x[21]*x[30]-0.0032176*x[22]*x[23]- 0.00379112*x[22]*x[24]-0.00301976*x[22]*x[25]- 0.00308424*x[22]*x[26]-0.00369962*x[22]*x[27]- 0.00278784*x[22]*x[28]-0.00465846*x[22]*x[29]- 0.00297212*x[22]*x[30]-0.01019176*x[23]*x[24]- 0.00779098*x[23]*x[25]-0.00577776*x[23]*x[26]- 0.01267514*x[23]*x[27]-0.00735432*x[23]*x[28]- 0.00786386*x[23]*x[29]-0.00559972*x[23]*x[30]- 0.00725022*x[24]*x[25]-0.00455648*x[24]*x[26]- 0.0157223*x[24]*x[27]-0.00579512*x[24]*x[28]- 0.00792398*x[24]*x[29]-0.0045755*x[24]*x[30]- 0.00723442*x[25]*x[26]-0.01196012*x[25]*x[27]- 0.0063273*x[25]*x[28]-0.0099815*x[25]*x[29]- 0.0041794*x[25]*x[30]-0.01139894*x[26]*x[27]- 0.0080092*x[26]*x[28]-0.0080044*x[26]*x[29]- 0.00493602*x[26]*x[30]-0.00826208*x[27]*x[28]- 0.01246152*x[27]*x[29]-0.0067556*x[27]*x[30]- 0.00575648*x[28]*x[29]-0.0044929*x[28]*x[30]- 0.00469952*x[29]*x[30])/1.0 t = 0.00318236*x[1]-0.00015175*x[2]-0.00695114*x[3]+0.012626*x[4]+ 0.0094202*x[5]+0.00596825*x[6]+0.00354677*x[7]-0.00134318*x[8]- 0.00670481*x[9]-0.00123195*x[10] t = t-0.00051299*x[11]-0.00348068*x[12]+0.00486372*x[13]- 0.0102346*x[14]-0.00211219*x[15]+0.00457072*x[16]- 0.00828342*x[17]-0.00168175*x[18]-0.00531856*x[19]- 0.00111388*x[20] t = t+0.0142599*x[21]+0.00545572*x[22]+0.0077442*x[23]+ 0.0195808*x[24]+0.00260132*x[25]-0.00524596*x[26]+0.00306*x[27]+ 0.00329918*x[28]+0.00265023*x[29]+0.0045383*x[30] g[1] = t t = 39.19*x[1]+41.47*x[2]+5.71*x[3]+53.59*x[4]+43.65*x[5]+ 85.46*x[6]+39.7*x[7]+44.91*x[8]+9.6*x[9]+11.26*x[10] t = t+39.56*x[11]+46.0*x[12]+45.25*x[13]+21.9*x[14]+11.85*x[15]+ 37.4*x[16]+4.75*x[17]+44.44*x[18]+80.5*x[19]+49.46*x[20] t = t+67.02*x[21]+59.25*x[22]+71.5*x[23]+48.8*x[24]+73.22*x[25]+ 101.9*x[26]+20.06*x[27]+36.33*x[28]+41.31*x[29]+53.09*x[30] t = t-1000.0 g[2] = t t = 1100.0-39.19*x[1]-41.47*x[2]-5.71*x[3]-53.59*x[4]-43.65*x[5]- 85.46*x[6]-39.7*x[7]-44.91*x[8]-9.6*x[9] t = t-11.26*x[10]-39.56*x[11]-46.0*x[12]-45.25*x[13]-21.9*x[14]- 11.85*x[15]-37.4*x[16]-4.75*x[17]-44.44*x[18]-80.5*x[19] t = t-49.46*x[20]-67.02*x[21]-59.25*x[22]-71.5*x[23]-48.8*x[24]- 73.22*x[25]-101.9*x[26]-20.06*x[27]-36.33*x[28]-41.31*x[29] t = t-53.09*x[30] g[3] = t return f,g end ######################################################################## key="************************************************************" problem = Dict() option = Dict() problem["o"] = 1 # Number of objectives problem["n"] = 30 # Number of variables (in total) problem["ni"] = 30 # Number of integer variables (0 <= ni <= n) problem["m"] = 3 # Number of constraints (in total) problem["me"] = 0 # Number of equality constraints (0 <= me <= m) problem["xl"] = fill(0.0, 30) problem["xu"] = fill(100.0, 30) problem["x"] = copy(problem["xl"]) # Starting point: lower bounds option["maxeval"] = 10000 option["maxtime"] = 60*60*24 option["printeval"] = 1 option["save2file"] = 1 option["resumable"] = 0 option["param1"] = 0.0 # ACCURACY option["param2"] = 0.0 # SEED option["param3"] = 0.398797498 + 1e-6 # FSTOP option["param4"] = 0.0 # ALGOSTOP option["param5"] = 0.0 # EVALSTOP option["param6"] = 0.0 # FOCUS option["param7"] = 0.0 # ANTS option["param8"] = 0.0 # KERNEL option["param9"] = 0.0 # ORACLE option["param10"]= 0.0 # PARETOMAX option["param11"]= 0.0 # EPSILON option["param12"]= 0.0 # BALANCE option["param13"]= 0.0 # CHARACTER option["param14"]= 2.0 # SURROGATE option["param15"]= 0.0 # PMISQP option["parallel"] = 0 # Serial: 0 or 1, Parallel: 2,3,4,5,6,7,8... option["paradigm"] = 0 # Parallel mode: 0 = multithreading, 1 = multiprocessing, 2 = MPI include("midaco.jl") solution = midaco(problem,option,key)