######################################################################## # # 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]*32 # Objective: cost of the process f[0] = 0.9979 + 0.00432*x[4] + 0.01517*x[12] # Equality constraints G(X) = 0: mass balances ... g[0] = x[0] + x[1] + x[2] + x[3] - 300.0 g[1] = x[5] - x[6] - x[7] g[2] = x[8] - x[9] - x[10] - x[11] g[3] = x[13] - x[14] - x[15] - x[16] g[4] = x[17] - x[18] - x[19] # ... component balances of the pools (bilinear) ... g[5] = x[4]*x[20] - x[5]*x[21] - x[8]*x[22] g[6] = x[4]*x[23] - x[5]*x[24] - x[8]*x[25] g[7] = x[4]*x[26] - x[5]*x[27] - x[8]*x[28] g[8] = x[12]*x[29] - x[13]*x[30] - x[17]*x[31] g[9] = x[12]*x[32] - x[13]*x[33] - x[17]*x[34] g[10] = x[12]*x[35] - x[13]*x[36] - x[17]*x[37] g[11] = x[0]/3.0 + x[14]*x[30] - x[4]*x[20] g[12] = x[0]/3.0 + x[14]*x[33] - x[4]*x[23] g[13] = x[0]/3.0 + x[14]*x[36] - x[4]*x[26] g[14] = x[1]/3.0 + x[9]*x[22] - x[12]*x[29] g[15] = x[1]/3.0 + x[9]*x[25] - x[12]*x[32] g[16] = x[1]/3.0 + x[9]*x[28] - x[12]*x[35] # ... product specifications ... g[17] = x[2]/3.0 + x[6]*x[21] + x[10]*x[22] + x[15]*x[30] + x[18]*x[31] - 30.0 g[18] = x[2]/3.0 + x[6]*x[24] + x[10]*x[25] + x[15]*x[33] + x[18]*x[34] - 50.0 g[19] = x[2]/3.0 + x[6]*x[27] + x[10]*x[28] + x[15]*x[36] + x[18]*x[37] - 30.0 # ... compositions sum up to one ... g[20] = x[20] + x[23] + x[26] - 1.0 g[21] = x[21] + x[24] + x[27] - 1.0 g[22] = x[22] + x[25] + x[28] - 1.0 g[23] = x[29] + x[32] + x[35] - 1.0 g[24] = x[30] + x[33] + x[36] - 1.0 g[25] = x[31] + x[34] + x[37] - 1.0 # ... and six compositions that must vanish g[26] = x[24] g[27] = x[27] g[28] = x[22] g[29] = x[36] g[30] = x[31] g[31] = x[34] return f, g ######################################################################## key = b'************************************************************' problem = {} option = {} problem['@'] = problem_function problem['o'] = 1 # Number of objectives problem['n'] = 38 # Number of variables (in total) problem['ni'] = 0 # Number of integer variables (0 <= ni <= n) problem['m'] = 32 # Number of constraints (in total) problem['me'] = 32 # 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, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] problem['xu'] = [90.0, 150.0, 90.0, 150.0, 90.0, 90.0, 150.0, 90.0, 90.0, 90.0, 150.0, 150.0, 90.0, 90.0, 150.0, 90.0, 150.0, 90.0, 150.0, 90.0, 1.0, 1.2, 1.0, 1.0, 1.0, 0.5, 1.0, 1.0, 0.5, 0.5, 0.5, 1.2, 0.5, 1.2, 1.2, 0.5, 1.2, 1.2] problem['x'] = list(problem['xl']) # Starting point: lower bounds option['maxeval'] = 1000000 option['maxtime'] = 60*60*24 option['printeval'] = 100 option['save2file'] = 1 option['resumable'] = 0 option['param1'] = 0.0001 # ACCURACY option['param2'] = 0.0 # SEED option['param3'] = 1.863867 + 1.863867*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'] = 2.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)