######################################################################## # # MIDACO solves Multi-Objective Mixed-Integer Non-Linear Problems: # # # Minimize F_1(X),... F_O(X) where X(1,...N-NI) is CONTINUOUS # and X(N-NI+1,...N) is DISCRETE # # subject to G_j(X) = 0 (j=1,...ME) equality constraints # G_j(X) >= 0 (j=ME+1,...M) inequality constraints # # and bounds XL <= X <= XU # # # The problem statement of this example is given below. You can use # this example as template to run your own problem. To do so: Replace # the objective functions 'F' (and in case the constraints 'G') given # here with your own problem and follow the below instruction steps. # ######################################################################## import math import midaco def model_functions(x): f = [0.0]*1 g = [0.0]*92 f[0] = (-(-(0.4*((-1.15398 + 0.003375*x[28])*x[0] + (-0.30630793 + 0.000893*x[29])*x[1] + (-1.57608132 + 0.004458*x[30])*x[2] + (-1.08593792 + 0.003176*x[31])*x[3] + 31.8928571428571*x[12]/(1 + x[28] - x[34] - x[80]) + 31.8928571428571*x[13]/(1 + x[29] - x[35] - x[81]) + 31.8928571428571*x[14]/(1 + x[30] - x[32] - x[82]) + 31.8928571428571*x[15]/(1 + x[31] - x[33] - x[83]) + 151.125*x[80] + 180.003*x[81] + 4.2286*x[82] + 213.42*x[83] + 31.8928571428571*x[24]/(1 + x[36] - x[80]) + 31.8928571428571*x[25]/(1 + x[37] - x[81]) + 31.8928571428571*x[26]/(1 + x[38] - x[82]) + 31.8928571428571*x[27]/(1 + x[39] - x[83]) + 31.8928571428571*x[16]/(421 - x[32]) + 31.8928571428571*x[17]/(421 - x[33]) + 31.8928571428571*x[18]/(421 - x[34]) + 31.8928571428571*x[19]/(421 - x[35]) + 31.8928571428571*x[20]/(373 - x[32]) + 31.8928571428571*x[21]/(373 - x[33]) + 31.8928571428571*x[22]/(373 - x[34]) + 31.8928571428571*x[23]/(373 - x[35])) + 12.95216*x[16] + 12.95216*x[17] + 12.95216 *x[18] + 12.95216*x[19] + 4.75228*x[20] + 4.75228*x[21] + 4.75228*x[22] + 4.75228* x[23] + 2.418*x[24] + 2.418*x[25] + 2.418*x[26] + 2.418*x[27]) - 1.3568*x[64] - 1.3568*x[65] - 1.3568*x[66] - 1.3568*x[67] - 1.3568*x[68] - 1.3568*x[69] - 1.3568*x[70] - 1.3568*x[71] - 1.3568*x[72] - 1.3568*x[73] - 1.3568*x[74] - 1.3568*x[75] - 1.3568*x[76] - 1.3568*x[77] - 1.3568*x[78] - 1.3568*x[79])) g[0] = (-(0.666666666666667*math.sqrt((-305 + x[28])*(-325 + x[28])) + 0.333333333333333* x[28]) + x[36] - x[40] + x[44] - (-105)) g[1] = (-(0.666666666666667*math.sqrt((-305 + x[29])*(-325 + x[29])) + 0.333333333333333* x[29]) + x[37] - x[41] + x[45] - (-105)) g[2] = (-(0.666666666666667*math.sqrt((-305 + x[30])*(-325 + x[30])) + 0.333333333333333* x[30]) + x[38] - x[42] + x[46] - (-105)) g[3] = (-(0.666666666666667*math.sqrt((-305 + x[31])*(-325 + x[31])) + 0.333333333333333* x[31]) + x[39] - x[43] + x[47] - (-105)) g[4] = 0.9*x[1] - x[3] g[5] = 0.2*x[0] - x[2] g[6] = x[0] + x[1] - 396 g[7] = x[8] - 0.0225*x[28] - x[56] + x[60] - 24.7068 g[8] = x[9] - 0.013*x[29] - x[57] + x[61] - 20.54087 g[9] = x[10] - 0.0043*x[30] - x[58] + x[62] - 2.239778 g[10] = x[11] - 0.0156*x[31] - x[59] + x[63] - 29.766048 g[11] = x[4] - x[8] g[12] = x[5] - x[9] g[13] = x[6] - x[10] g[14] = x[7] - x[11] g[15] = x[8] - x[12] - x[24] g[16] = x[9] - x[13] - x[25] g[17] = x[10] - x[14] - x[26] g[18] = x[11] - x[15] - x[27] g[19] = x[4] - x[14] - x[16] - x[20] g[20] = x[5] - x[15] - x[17] - x[21] g[21] = x[6] - x[12] - x[18] - x[22] g[22] = x[7] - x[13] - x[19] - x[23] g[23] = -1.028*x[28] + x[32] - x[48] + x[52] - (-341.95276) g[24] = -1.05*x[29] + x[33] - x[49] + x[53] - (-347.9205) g[25] = -1.029*x[30] + x[34] - x[50] + x[54] - (-355.03666) g[26] = -1.005*x[31] + x[35] - x[51] + x[55] - (-334.4486) g[27] = x[81] - x[83] g[28] = x[80] - x[82] g[29] = x[80] + x[81] - 1 g[30] = -(x[28] + x[32] + x[36] - 1500*x[80]) g[31] = -(x[29] + x[33] + x[37] - 1500*x[81]) g[32] = -(x[30] + x[34] + x[38] - 1500*x[82]) g[33] = -(x[31] + x[35] + x[39] - 1500*x[83]) g[34] = -(x[40] + x[48] + x[52] + 1500*x[80]) + 1500 g[35] = -(x[41] + x[49] + x[53] + 1500*x[81]) + 1500 g[36] = -(x[42] + x[50] + x[54] + 1500*x[82]) + 1500 g[37] = -(x[43] + x[51] + x[55] + 1500*x[83]) + 1500 g[38] = -(x[44] + x[56] + x[60] + 1500*x[80]) + 1500 g[39] = -(x[45] + x[57] + x[61] + 1500*x[81]) + 1500 g[40] = -(x[46] + x[58] + x[62] + 1500*x[82]) + 1500 g[41] = -(x[47] + x[59] + x[63] + 1500*x[83]) + 1500 g[42] = -(x[0] - 1500*x[80]) g[43] = -(x[1] - 1500*x[81]) g[44] = -(x[2] - 1500*x[82]) g[45] = -(x[3] - 1500*x[83]) g[46] = -(x[32]) + 411 g[47] = -(x[33]) + 411 g[48] = -(x[34]) + 411 g[49] = -(x[35]) + 411 g[50] = -(-x[28] + 1500*x[80]) + 1158.08 g[51] = -(-x[29] + 1500*x[81]) + 1156.99 g[52] = -(-x[30] + 1500*x[82]) + 1146.46 g[53] = -(-x[31] + 1500*x[83]) + 1158.08 g[54] = -(-x[28] + x[34] + 1500*x[64]) + 1490 g[55] = -(-x[29] + x[35] + 1500*x[65]) + 1490 g[56] = -(-x[30] + x[32] + 1500*x[66]) + 1490 g[57] = -(-x[31] + x[33] + 1500*x[67]) + 1490 g[58] = -(x[32] + 1500*x[72]) + 1863 g[59] = -(x[33] + 1500*x[73]) + 1863 g[60] = -(x[34] + 1500*x[74]) + 1863 g[61] = -(x[35] + 1500*x[75]) + 1863 g[62] = -(x[12] - 1500*x[64]) g[63] = -(x[13] - 1500*x[65]) g[64] = -(x[14] - 1500*x[66]) g[65] = -(x[15] - 1500*x[67]) g[66] = -(x[16] - 1500*x[68]) g[67] = -(x[17] - 1500*x[69]) g[68] = -(x[18] - 1500*x[70]) g[69] = -(x[19] - 1500*x[71]) g[70] = -(x[20] - 1500*x[72]) g[71] = -(x[21] - 1500*x[73]) g[72] = -(x[22] - 1500*x[74]) g[73] = -(x[23] - 1500*x[75]) g[74] = -(x[24] - 1500*x[76]) g[75] = -(x[25] - 1500*x[77]) g[76] = -(x[26] - 1500*x[78]) g[77] = -(x[27] - 1500*x[79]) g[78] = -(x[4] + x[8] - 1500*x[80]) g[79] = -(x[5] + x[9] - 1500*x[81]) g[80] = -(x[6] + x[10] - 1500*x[82]) g[81] = -(x[7] + x[11] - 1500*x[83]) g[82] = -(x[68] + x[72]) + 1 g[83] = -(x[69] + x[73]) + 1 g[84] = -(x[70] + x[74]) + 1 g[85] = -(x[71] + x[75]) + 1 g[86] = -(x[64] + x[66]) + 1 g[87] = -(x[65] + x[67]) + 1 g[88] = -(x[64] + x[66] + x[68] + x[72] + x[76] - 20*x[80]) g[89] = -(x[65] + x[67] + x[69] + x[73] + x[77] - 20*x[81]) g[90] = -(x[64] + x[66] + x[70] + x[74] + x[78] - 20*x[82]) g[91] = -(x[65] + x[67] + x[71] + x[75] + x[79] - 20*x[83]) return f, g def problem_function(x): try: f, g = model_functions(x) except (ValueError, ZeroDivisionError, OverflowError): # X is outside the domain of the model functions (sqrt, division) f, g = [1e30], [-1e30]*92 return f, g ######################################################################## key = b'************************************************************' problem = {} option = {} problem['@'] = problem_function problem['o'] = 1 # Number of objectives problem['n'] = 84 # Number of variables (in total) problem['ni'] = 20 # Number of integer variables (0 <= ni <= n) problem['m'] = 92 # Number of constraints (in total) problem['me'] = 30 # Number of equality constraints (0 <= me <= m) problem['xl'] = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 326.0, 0.0, 326.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] problem['xu'] = [5000.0, 10.0, 1000.0, 10.0, 500.0, 10.0, 50.0, 10.0, 500.0, 10.0, 50.0, 10.0, 50.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 500.0, 10.0, 10.0, 10.0, 500.0, 10.0, 50.0, 10.0, 5326.0, 304.0, 5326.0, 304.0, 1000.0, 1000.0, 1000.0, 1000.0, 500.0, 10.0, 500.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 5000.0, 10.0, 5000.0, 10.0, 5000.0, 10.0, 5000.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 500.0, 10.0, 500.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] problem['x'] = list(problem['xl']) # Starting point: lower bounds option['maxeval'] = 1000000 option['maxtime'] = 60*60*24 option['printeval'] = 1000 option['save2file'] = 1 option['resumable'] = 0 option['param1'] = 1e-08 # ACCURACY option['param2'] = 0.0 # SEED option['param3'] = 316.6926954 + 316.6926954*1e-4 # 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'] = 0.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 = multiprocessing, 1 = mpi4py, 2 = vectorized ######################################################################## if __name__ == '__main__': solution = midaco.run(problem, option, key)