######################################################################## # # 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]*30 f[0] = (-(-(0.6*x[0]**2.0 + 0.1*x[3]**2.0) + 0.9*x[1] + 0.5*x[2] - x[4] + x[5] + 0.2*x[6] + x[7] + 0.2*x[8] + 0.9*x[9] + 0.9*x[10] + 0.1*x[11] + 0.8*x[12] + x[13] + 0.4*x[14] + x[15] + 0.3*x[16] + 0.1*x[17] + 0.3*x[18] + 0.5*x[19] + 0.9*x[20] + 0.8*x[21] + 0.1*x[22] + 0.9*x[23] + x[24] + x[25] + x[26] + 0.2*x[27] + 0.7*x[28] + 0.7*x[29])) g[0] = (-(9.57*(x[0] - 2.26)**2 + 2.74*(x[1] - 5.15)**2 + 9.75*(x[2] - 4.03)**2 + 3.96*(x[3] - 1.74)**2 + 8.67*(x[4] - 4.74)**2) - 1000.0*x[5] + 1077.83985) g[1] = (-(8.38*(x[0] - 5.51)**2 + 3.93*(x[1] - 9.01)**2 + 5.18*(x[2] - 3.84)**2 + 5.2*(x[3] - 1.47)**2 + 7.82*(x[4] - 9.92)**2) - 1000.0*x[6] + 1175.971) g[2] = (-(9.81*(x[0] - 4.06)**2 + 0.04*(x[1] - 1.8)**2 + 4.21*(x[2] - 0.71)**2 + 7.38*(x[3] - 9.09)**2 + 4.11*(x[4] - 8.13)**2) - 1000.0*x[7] + 1201.8226) g[3] = (-(7.41*(x[0] - 6.3)**2 + 6.08*(x[1] - 0.11)**2 + 5.46*(x[2] - 4.08)**2 + 4.86*(x[3] - 7.29)**2 + 1.48*(x[4] - 4.24)**2) - 1000.0*x[8] + 1143.9533) g[4] = (-(9.96*(x[0] - 2.81)**2 + 9.13*(x[1] - 1.65)**2 + 2.95*(x[2] - 8.08)**2 + 8.25*(x[3] - 3.99)**2 + 3.58*(x[4] - 3.51)**2) - 1000.0*x[9] + 1154.3895) g[5] = (-(9.39*(x[0] - 4.29)**2 + 4.27*(x[1] - 9.49)**2 + 5.09*(x[2] - 2.24)**2 + 1.81*(x[3] - 9.78)**2 + 7.58*(x[4] - 1.52)**2) - 1000.0*x[10] + 1433.3177) g[6] = (-(1.88*(x[0] - 9.76)**2 + 7.2*(x[1] - 3.64)**2 + 6.65*(x[2] - 6.62)**2 + 1.74*(x[3] - 3.66)**2 + 2.86*(x[4] - 9.08)**2) - 1000.0*x[11] + 1109.0764) g[7] = (-(4.01*(x[0] - 1.37)**2 + 2.67*(x[1] - 6.99)**2 + 4.86*(x[2] - 7.19)**2 + 2.55*(x[3] - 3.03)**2 + 6.91*(x[4] - 3.39)**2) - 1000.0*x[12] + 1041.5959) g[8] = (-(4.18*(x[0] - 8.89)**2 + 1.92*(x[1] - 8.29)**2 + 2.6*(x[2] - 6.05)**2 + 7.15*(x[3] - 7.48)**2 + 2.86*(x[4] - 4.09)**2) - 1000.0*x[13] + 1144.0623) g[9] = (-(7.81*(x[0] - 7.42)**2 + 2.14*(x[1] - 4.6)**2 + 9.63*(x[2] - 0.3)**2 + 7.61*(x[3] - 0.97)**2 + 9.17*(x[4] - 8.77)**2) - 1000.0*x[14] + 1099.8341) g[10] = (-(8.96*(x[0] - 1.54)**2 + 3.47*(x[1] - 7.06)**2 + 5.49*(x[2] - 0.01)**2 + 4.73*(x[3] - 1.23)**2 + 9.43*(x[4] - 3.11)**2) - 1000.0*x[15] + 1149.179) g[11] = (-(9.94*(x[0] - 7.74)**2 + 1.63*(x[1] - 4.4)**2 + 1.23*(x[2] - 7.93)**2 + 4.33*(x[3] - 5.95)**2 + 7.08*(x[4] - 4.88)**2) - 1000.0*x[16] + 1123.807) g[12] = (-(0.31*(x[0] - 9.94)**2 + 5.0*(x[1] - 5.21)**2 + 0.16*(x[2] - 8.58)**2 + 2.52*(x[3] - 0.13)**2 + 3.08*(x[4] - 4.57)**2) - 1000.0*x[17] + 1027.2219) g[13] = (-(6.02*(x[0] - 9.54)**2 + 0.92*(x[1] - 1.57)**2 + 7.47*(x[2] - 9.66)**2 + 9.74*(x[3] - 5.24)**2 + 1.76*(x[4] - 7.9)**2) - 1000.0*x[18] + 1089.9268) g[14] = (-(5.06*(x[0] - 7.46)**2 + 4.52*(x[1] - 8.81)**2 + 1.89*(x[2] - 1.67)**2 + 1.22*(x[3] - 6.47)**2 + 9.05*(x[4] - 1.81)**2) - 1000.0*x[19] + 1293.076) g[15] = (-(5.92*(x[0] - 0.56)**2 + 2.56*(x[1] - 8.1)**2 + 7.74*(x[2] - 0.19)**2 + 6.96*(x[3] - 6.11)**2 + 5.18*(x[4] - 6.4)**2) - 1000.0*x[20] + 1174.317) g[16] = (-(6.45*(x[0] - 3.86)**2 + 1.52*(x[1] - 6.68)**2 + 0.06*(x[2] - 6.42)**2 + 5.34*(x[3] - 7.29)**2 + 8.47*(x[4] - 4.66)**2) - 1000.0*x[21] + 1125.1028) g[17] = (-(1.04*(x[0] - 2.98)**2 + 1.36*(x[1] - 2.98)**2 + 5.99*(x[2] - 3.03)**2 + 8.1*(x[3] - 0.02)**2 + 5.22*(x[4] - 0.67)**2) - 1000.0*x[22] + 1222.8417) g[18] = (-(1.4*(x[0] - 3.61)**2 + 1.35*(x[1] - 7.62)**2 + 0.59*(x[2] - 1.79)**2 + 8.58*(x[3] - 7.8)**2 + 1.21*(x[4] - 9.81)**2) - 1000.0*x[23] + 1050.4859) g[19] = (-(6.68*(x[0] - 5.68)**2 + 9.48*(x[1] - 4.24)**2 + 1.6*(x[2] - 4.17)**2 + 6.74*(x[3] - 6.75)**2 + 8.92*(x[4] - 1.08)**2) - 1000.0*x[24] + 1361.1973) g[20] = (-(1.95*(x[0] - 5.48)**2 + 0.46*(x[1] - 3.74)**2 + 2.9*(x[2] - 3.34)**2 + 1.79*(x[3] - 6.22)**2 + 0.99*(x[4] - 7.94)**2) - 1000.0*x[25] + 1040.3264) g[21] = (-(5.18*(x[0] - 8.13)**2 + 5.1*(x[1] - 8.72)**2 + 8.81*(x[2] - 3.93)**2 + 3.27*(x[3] - 8.8)**2 + 9.63*(x[4] - 8.56)**2) - 1000.0*x[26] + 1161.8518) g[22] = (-(1.47*(x[0] - 1.37)**2 + 5.71*(x[1] - 0.54)**2 + 6.95*(x[2] - 1.55)**2 + 1.42*(x[3] - 5.56)**2 + 3.49*(x[4] - 5.85)**2) - 1000.0*x[27] + 1066.8582) g[23] = (-(5.4*(x[0] - 8.79)**2 + 3.12*(x[1] - 5.04)**2 + 5.37*(x[2] - 4.83)**2 + 6.1*(x[3] - 6.94)**2 + 3.71*(x[4] - 0.38)**2) - 1000.0*x[28] + 1340.5807) g[24] = (-(6.32*(x[0] - 2.66)**2 + 0.81*(x[1] - 4.19)**2 + 6.12*(x[2] - 6.49)**2 + 6.73*(x[3] - 8.04)**2 + 7.93*(x[4] - 1.66)**2) - 1000.0*x[29] + 1407.52) g[25] = (-x[0] + x[1] - x[2] - x[3] - x[4] + 10.0) g[26] = (-0.6*x[0] + 0.9*x[1] + 0.5*x[2] - 0.1*x[3] - x[4] - 0.64) g[27] = (-(-x[0] + x[1] - x[2] + x[3] - x[4]) - 0.69) g[28] = (-0.157*x[0] - 0.05*x[1] + 1.5) g[29] = (-(-0.25*x[1] - 1.05*x[3] + 0.3*x[4]) -4.5) return f, g ######################################################################## key = b'************************************************************' problem = {} option = {} problem['@'] = problem_function problem['o'] = 1 # Number of objectives problem['n'] = 30 # Number of variables (in total) problem['ni'] = 25 # Number of integer variables (0 <= ni <= n) problem['m'] = 30 # Number of constraints (in total) problem['me'] = 0 # Number of equality constraints (0 <= me <= m) problem['xl'] = [2.0, 0.0, 3.0, 0.0, 4.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'] = [4.5, 8.0, 9.0, 5.0, 10.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, 1.0, 1.0, 1.0, 1.0, 1.0] problem['x'] = list(problem['xl']) # Starting point: lower bounds option['maxeval'] = 3000 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'] = -8.0641 + 8.0641*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'] = 4.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)