######################################################################## # # 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 midaco def problem_function(x): f = [0.0]*1 g = [0.0]*39 f[0] = ((670.0*(x[9]/(0.5*(x[0]**2.0*x[1] + x[0]*x[1]**2.0))**(1.0/3.0))**0.83 + 670.0*(x[10]/(0.5*(x[1]**2.0*x[2] + x[1]*x[2]**2.0))**(1.0/3.0))**0.83 + 670.0*(0.5*x[11]/(0.5*(x[3]**2.0*x[4] + x[3]*x[4]**2.0))**(1.0/3.0))**0.83 + 670.0*(0.5*x[12]/(0.5*(x[4]**2.0*x[5] + x[4]*x[5]**2.0))**(1.0/3.0))**0.83 + 670.0*((2.0/3.0)*x[13] /(1250.0*x[6]**2.0)**(1.0/3.0))**0.83 + 20.0*x[13] + 670.0*((2.0/3.0)*x[14] /(2450.0*x[7]**2.0)**(1.0/3.0))**0.83 + 120.0*x[14] + 670.0*(0.4*x[15] /(8712.0*x[8]**2.0)**(1.0/3.0))**0.83 + 120.0*x[15]) + 6600.0*x[25] + 6600.0*x[26] + 6600.0*x[27] + 6600.0*x[28] + 6600.0*x[29] + 6600.0*x[30] + 6600.0*x[31]) g[0] = x[9] + x[10] + x[11] + x[12] + x[13] - 1980.0 g[1] = x[9] + x[10] + x[14] - 1620.0 g[2] = x[11] + x[12] + x[15] - 360.0 g[3] = -x[9] - x[11] + 22.0*x[16] - 22.0*x[17] g[4] = -x[10] - x[12] + 22.0*x[17] - 22.0*x[18] g[5] = -x[9] + 20.0*x[19] - 20.0*x[20] g[6] = -x[10] + 20.0*x[20] - 20.0*x[21] g[7] = -x[11] + 7.5*x[22] - 7.5*x[23] g[8] = -x[12] + 7.5*x[23] - 7.5*x[24] g[9] = x[16] - 440.0 g[10] = x[21] - 349.0 g[11] = x[24] - 320.0 g[12] = -x[13] + 22.0*x[18] - 7700.0 g[13] = -x[14] - 20.0*x[19] + 8600.0 g[14] = -x[15] - 7.5*x[22] + 2760.0 g[15] = x[16] - x[17] g[16] = x[17] - x[18] g[17] = x[19] - x[20] g[18] = x[20] - x[21] g[19] = x[22] - x[23] g[20] = x[23] - x[24] g[21] = -(-1620.0*x[25] + x[9]) g[22] = -(-1620.0*x[26] + x[10]) g[23] = -(-360.0*x[27] + x[11]) g[24] = -(-360.0*x[28] + x[12]) g[25] = -(-1980.0*x[29] + x[13]) g[26] = -(-1620.0*x[30] + x[14]) g[27] = -(-360.0*x[31] + x[15]) g[28] = -(200.0*x[25] + x[0] - x[16] + x[19] - 200.0) g[29] = -(200.0*x[26] + x[1] - x[17] + x[20] - 200.0) g[30] = -(200.0*x[27] + x[3] - x[16] + x[22] - 200.0) g[31] = -(200.0*x[28] + x[4] - x[17] + x[23] - 200.0) g[32] = -(200.0*x[25] + x[1] - x[17] + x[20] - 200.0) g[33] = -(200.0*x[26] + x[2] - x[18] + x[21] - 200.0) g[34] = -(200.0*x[27] + x[4] - x[17] + x[23] - 200.0) g[35] = -(200.0*x[28] + x[5] - x[18] + x[24] - 200.0) g[36] = -(200.0*x[29] + x[6] - x[18] + 120.0) g[37] = -(200.0*x[30] + x[7] + x[19] - 700.0) g[38] = -(200.0*x[31] + x[8] + x[22] - 700.0) return f, g ######################################################################## key = b'************************************************************' problem = {} option = {} problem['@'] = problem_function problem['o'] = 1 # Number of objectives problem['n'] = 32 # Number of variables (in total) problem['ni'] = 7 # Number of integer variables (0 <= ni <= n) problem['m'] = 39 # Number of constraints (in total) problem['me'] = 15 # Number of equality constraints (0 <= me <= m) problem['xl'] = [0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 350.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'] = [1000.0, 1000.0, 1000.0, 1000.0, 1000.0, 1000.0, 1000.0, 1000.0, 1000.0, 1620.0, 1620.0, 360.0, 360.0, 1980.0, 1620.0, 360.0, 600.0, 600.0, 600.0, 430.0, 600.0, 600.0, 368.0, 600.0, 600.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'] = 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'] = 64868.07684 + 64868.07684*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'] = 1.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)