import java.util.HashMap; import java.lang.Math; /***********************************************************************/ /* // This is an example call of MIDACO 6.0 // ------------------------------------- // // 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. */ /***********************************************************************/ /********************* OPTIMIZATION PROBLEM ************************/ /***********************************************************************/ class Optimizationproblem { public void blackbox( double[] f, double[] g, double[] x ) { /* Objective function value F(X) */ f[0] = 5.0e+0*x[10-1] + 8.0e+0*x[11-1] + 6.0e+0*x[12-1] + 10.0e+0*x[13-1] + 6.0e+0*x[14-1] + 7.0e+0*x[15-1] + 4.0e+0*x[16-1] + 5.0e+0*x[17-1] - 10.0e+0*x[1-1] - 15.0e+0*x[2-1] + 15.0e+0*x[3-1] + 80.0e+0*x[4-1] + 25.0e+0*x[5-1] + 35.0e+0*x[6-1] - 40.0e+0*x[7-1] + 15.0e+0*x[8-1] - 35.0e+0*x[9-1] + Math.exp(x[1-1]) + Math.exp(x[2-1]/1.2e+0) - 65.0e+0*Math.log(x[3-1]+x[4-1]+1.0e+0) - 90.0e+0*Math.log(x[5-1]+1.0e+0) - 80.0e+0*Math.log(x[6-1]+1.0e+0) + 120.0e+0; /* Equality constraints g[i] = 0 MUST COME FIRST in g[0:me-1] */ g[0] = 1.0e+0 - x[10-1] - x[11-1]; g[1] = -x[13-1] + x[15-1] + x[16-1]; /* Inequality constraints g[i] >= 0 MUST COME SECOND in g[me:m-1] */ g[2] = 1.5e+0*Math.log(x[5-1]+1.0e+0) + Math.log(x[6-1]+1.0e+0) + x[8-1]; g[3] = Math.log(x[3-1]+x[4-1]+1.0e+0); g[4] = x[1-1] + x[2-1] - x[3-1] - 2.0e+0*x[4-1] - 0.8e+0*x[5-1] - 0.8e+0*x[6-1] + 0.5e+0*x[7-1] + x[8-1] + 2.0e+0*x[9-1]; g[5] = x[1-1] + x[2-1] - 2.0e+0*x[4-1] - 0.8e+0*x[5-1] - 0.8e+0*x[6-1] + 2.0e+0*x[7-1] + x[8-1] + 2.0e+0*x[9-1]; g[6] = 2.0e+0*x[4-1] + 0.8e+0*x[5-1] + 0.8e+0*x[6-1] - 2.0e+0*x[7-1] - x[8-1] - 2.0e+0*x[9-1]; g[7] = 0.8e+0*x[5-1] + 0.8e+0*x[6-1] - x[8-1]; g[8] = x[4-1] - x[7-1] - x[9-1]; g[9] = 0.4e+0*x[5-1] + 0.4e+0*x[6-1] - 1.5e+0*x[8-1]; g[10] = -0.16e+0*x[5-1] - 0.16e+0*x[6-1] + 1.2e+0*x[8-1]; g[11] = -x[3-1] + 0.8e+0*x[4-1]; g[12] = x[3-1] - 0.4e+0*x[4-1]; g[13] = 1.0e+0 - Math.exp(x[1-1]) + 10.0e+0*x[10-1]; g[14] = 1.0e+0 - Math.exp(x[2-1]/1.2e+0) + 10.0e+0*x[11-1]; g[15] = -x[7-1] + 10.0e+0*x[12-1]; g[16] = -0.8e+0*x[5-1] - 0.8e+0*x[6-1] + 10.0e+0*x[13-1]; g[17] = -2.0e+0*x[4-1] + 2.0e+0*x[7-1] + 2.0e+0*x[9-1] + 10.0e+0*x[14-1]; g[18] = -x[5-1] + 10.0e+0*x[15-1]; g[19] = -x[6-1] + 10.0e+0*x[16-1]; g[20] = -x[3-1] - x[4-1] + 10.0e+0*x[17-1]; g[21] = 1.0e+0 - x[13-1] - x[14-1]; g[22] = -x[12-1] + x[17-1]; } } /***********************************************************************/ /************************ MAIN PROGRAM *****************************/ /***********************************************************************/ class Example { public static void main(String args[]) { int i,n; double[] x,xl,xu; HashMap problem = new HashMap (); HashMap option = new HashMap (); HashMap parameter = new HashMap (); HashMap solution = new HashMap(); String key = "************************************************************"; /*****************************************************************/ /*** Step 1: Problem definition ********************************/ /*****************************************************************/ /* STEP 1.A: Problem dimensions ******************************/ problem.put("o", 1); /* Number of objectives */ problem.put("n", 17); /* Number of variables (in total) */ problem.put("ni", 8); /* Number of integer variables (0 <= ni <= n) */ problem.put("m", 23); /* Number of constraints (in total) */ problem.put("me", 2); /* Number of equality constraints (0 <= me <= m) */ /* STEP 1.B: Lower and upper bounds 'xl' & 'xu' **********************************************/ n = problem.get("n"); xl = new double[n]; xu = new double[n]; for( i=0; i<9; i++) { xl[i] = 0.0; xu[i] = 2.0; } for( i=9; i<17; i++) { xl[i] = 0.0; xu[i] = 1.0; } /* STEP 1.C: Starting point 'x' ******************************/ x = new double[n]; for(i=0;i