######################################################################## # # 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]*73 f[0] = (x[33] + (x[34] + x[35])/x[36])/24.8739726027397 g[0] = (x[0] + x[1] + x[2] - x[36] + 0.4*x[37] + 0.4*x[38] + 0.4*x[39] + 0.2*x[40] + 0.2*x[41] + 0.2*x[42] + 0.1*x[43] + 0.1*x[44] + 0.1*x[45]) g[1] = (11.4794520547945*x[0] - x[3] - x[12] + x[13] + 4.59178082191781*x[37] + 2.2958904109589*x[40] + 1.14794520547945*x[43]) g[2] = (11.4794520547945*x[1] - x[4] - x[13] + x[14] + 4.59178082191781*x[38] + 2.2958904109589*x[41] + 1.14794520547945*x[44]) g[3] = (11.4794520547945*x[2] - x[5] + x[12] - x[14] + 4.59178082191781*x[39] + 2.2958904109589*x[42] + 1.14794520547945*x[45]) g[4] = (9.56712328767123*x[0] - x[6] - x[15] + x[16] + 3.82684931506849*x[37] + 1.91342465753425*x[40] + 0.956712328767123*x[43]) g[5] = (9.56712328767123*x[1] - x[7] - x[16] + x[17] + 3.82684931506849*x[38] + 1.91342465753425*x[41] + 0.956712328767123*x[44]) g[6] = (9.56712328767123*x[2] - x[8] + x[15] - x[17] + 3.82684931506849*x[39] + 1.91342465753425*x[42] + 0.956712328767123*x[45]) g[7] = (3.82739726027397*x[0] - x[9] - x[18] + x[19] + 1.53095890410959*x[37] + 0.765479452054795*x[40] + 0.382739726027397*x[43]) g[8] = (3.82739726027397*x[1] - x[10] - x[19] + x[20] + 1.53095890410959*x[38] + 0.765479452054795*x[41] + 0.382739726027397*x[44]) g[9] = (3.82739726027397*x[2] - x[11] + x[18] - x[20] + 1.53095890410959*x[39] + 0.765479452054795*x[42] + 0.382739726027397*x[45]) g[10] = (x[34] - 10*x[37] - 10*x[38] - 10*x[39] - 20*x[40] - 20*x[41] - 20*x[42] - 30*x[43] - 30*x[44] - 30*x[45]) g[11] = (-0.3271*(math.sqrt(x[21]) + math.sqrt(x[22]) + math.sqrt(x[23])) + x[33]) g[12] = (-(0.0515901369863014*x[24]*(x[0] + 0.4*x[37] + 0.2*x[40] + 0.1*x[43]) + 0.0515901369863014*x[25]*(x[1] + 0.4*x[38] + 0.2*x[41] + 0.1*x[44]) + 0.0515901369863014*x[26]*(x[2] + 0.4*x[39] + 0.2*x[42] + 0.1*x[45]) + 0.0528586301369863*x[27]*(x[0] + 0.4*x[37] + 0.2*x[40] + 0.1*x[43]) + 0.0528586301369863*x[28]*(x[1] + 0.4*x[38] + 0.2*x[41] + 0.1*x[44]) + 0.0528586301369863*x[29]*(x[2] + 0.4*x[39] + 0.2*x[42] + 0.1*x[45]) + 0.0541268493150685*x[30]*(x[0] + 0.4*x[37] + 0.2*x[40] + 0.1*x[43]) + 0.0541268493150685*x[31]*(x[1] + 0.4*x[38] + 0.2*x[41] + 0.1*x[44]) + 0.0541268493150685*x[32]*(x[2] + 0.4*x[39] + 0.2*x[42] + 0.1*x[45])) + x[35]) g[13] = -0.5*x[12] - 0.5*x[13] + x[24] - (-643) g[14] = -0.5*x[13] - 0.5*x[14] + x[25] - (-643) g[15] = -0.5*x[12] - 0.5*x[14] + x[26] - (-643) g[16] = -0.5*x[15] - 0.5*x[16] + x[27] - (-536) g[17] = -0.5*x[16] - 0.5*x[17] + x[28] - (-536) g[18] = -0.5*x[15] - 0.5*x[17] + x[29] - (-536) g[19] = -0.5*x[18] - 0.5*x[19] + x[30] - (-214) g[20] = -0.5*x[19] - 0.5*x[20] + x[31] - (-214) g[21] = -0.5*x[18] - 0.5*x[20] + x[32] - (-214) g[22] = -(x[37] + x[40] + x[43]) + 1 g[23] = -(x[38] + x[41] + x[44]) + 1 g[24] = -(x[39] + x[42] + x[45]) + 1 g[25] = -(x[12] - x[21]) g[26] = -(x[13] - x[21]) g[27] = -(x[14] - x[21]) g[28] = -(x[15] - x[22]) g[29] = -(x[16] - x[22]) g[30] = -(x[17] - x[22]) g[31] = -(x[18] - x[23]) g[32] = -(x[19] - x[23]) g[33] = -(x[20] - x[23]) g[34] = -(-50*x[0]*x[37] + x[3]) g[35] = -(-50*x[1]*x[38] + x[4]) g[36] = -(-50*x[2]*x[39] + x[5]) g[37] = -(-50*x[0]*x[40] + x[6]) g[38] = -(-50*x[1]*x[41] + x[7]) g[39] = -(-50*x[2]*x[42] + x[8]) g[40] = -(-50*x[0]*x[43] + x[9]) g[41] = -(-50*x[1]*x[44] + x[10]) g[42] = -(-50*x[2]*x[45] + x[11]) g[43] = -15*x[0]*x[37] + x[3] g[44] = -15*x[1]*x[38] + x[4] g[45] = -15*x[2]*x[39] + x[5] g[46] = -15*x[0]*x[40] + x[6] g[47] = -15*x[1]*x[41] + x[7] g[48] = -15*x[2]*x[42] + x[8] g[49] = -7*x[0]*x[43] + x[9] g[50] = -7*x[1]*x[44] + x[10] g[51] = -7*x[2]*x[45] + x[11] g[52] = -(x[0] - 40*x[37] - 40*x[40] - 40*x[43]) g[53] = -(x[1] - 40*x[38] - 40*x[41] - 40*x[44]) g[54] = -(x[2] - 40*x[39] - 40*x[42] - 40*x[45]) g[55] = x[0] - x[37] - x[40] - x[43] g[56] = x[1] - x[38] - x[41] - x[44] g[57] = x[2] - x[39] - x[42] - x[45] g[58] = -x[0] + 40*x[37] + 40*x[40] + 40*x[43] g[59] = -x[1] + 40*x[38] + 40*x[41] + 40*x[44] g[60] = -x[2] + 40*x[39] + 40*x[42] + 40*x[45] g[61] = -x[37] - x[38] - (-1) g[62] = -x[38] - x[39] - (-1) g[63] = -x[39] - (-1) g[64] = -x[40] - x[41] - (-1) g[65] = -x[41] - x[42] - (-1) g[66] = -x[42] - (-1) g[67] = -x[43] - x[44] - (-1) g[68] = -x[44] - x[45] - (-1) g[69] = -x[45] - (-1) g[70] = x[37] - x[38] + x[40] - x[41] + x[43] - x[44] g[71] = x[38] - x[39] + x[41] - x[42] + x[44] - x[45] g[72] = x[39] + x[42] + x[45] 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]*73 return f, g ######################################################################## key = b'************************************************************' problem = {} option = {} problem['@'] = problem_function problem['o'] = 1 # Number of objectives problem['n'] = 46 # Number of variables (in total) problem['ni'] = 9 # Number of integer variables (0 <= ni <= n) problem['m'] = 73 # Number of constraints (in total) problem['me'] = 22 # 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, 643.0, 643.0, 643.0, 536.0, 536.0, 536.0, 214.0, 214.0, 214.0, 643.0, 536.0, 214.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, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] problem['xu'] = [100.0, 50.0, 10.0, 5000.0, 10.0, 10.0, 10.0, 5000.0, 10.0, 10.0, 10.0, 500.0, 643.0, 4018.36, 4018.36, 3348.63, 3348.63, 3348.63, 1339.45, 1339.45, 1339.45, 4018.36, 3348.63, 1339.45, 500.0, 500.0, 100.0, 500.0, 500.0, 1000.0, 500.0, 50.0, 500.0, 500.0, 1000.0, 500.0, 500.0, 1.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0, 1.0, 1.0] problem['x'] = list(problem['xl']) # Starting point: lower bounds option['maxeval'] = 1000000 option['maxtime'] = 60*60*24 option['printeval'] = 2500 option['save2file'] = 1 option['resumable'] = 0 option['param1'] = 0.0001 # ACCURACY option['param2'] = 0.0 # SEED option['param3'] = 1.268643754 + 1.268643754*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)