using System; using System.Collections.Generic; using System.Runtime.InteropServices; /***********************************************************************/ /* // 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 static void blackbox( double[] f, double[] g, double[] x ) { double sum_A = 0.0; for(int i=0;i<=1;i++) { sum_A = sum_A - 10.0*Math.Exp(-0.2*Math.Sqrt(x[i]*x[i]+x[i+1]*x[i+1])); } double sum_B = 0.0; for(int i=0;i<=2;i++) { sum_B = sum_B + Math.Pow(Math.Abs(x[i]),0.8) + 5.0*Math.Sin(x[i]*x[i]*x[i]); } /* Objective Functions F(X) */ f[0] = sum_A; f[1] = sum_B; } } /***********************************************************************/ /************************ MAIN PROGRAM *****************************/ /***********************************************************************/ class Example { public static void Main() { long i,n; double[] x,xl,xu; Dictionary problem = new Dictionary(); Dictionary option = new Dictionary(); Dictionary parameter = new Dictionary(); Dictionary solution = new Dictionary(); string key = "MIDACO_LIMITED_VERSION___[CREATIVE_COMMONS_BY-NC-ND_LICENSE]"; /*****************************************************************/ /*** Step 1: Problem definition ********************************/ /*****************************************************************/ /* STEP 1.A: Problem dimensions ******************************/ problem["o"] = 2; /* Number of objectives */ problem["n"] = 3; /* Number of variables (in total) */ problem["ni"] = 0; /* Number of integer variables (0 <= ni <= n) */ problem["m"] = 0; /* Number of constraints (in total) */ problem["me"] = 0; /* Number of equality constraints (0 <= me <= m) */ /* STEP 1.B: Lower and upper bounds 'xl' & 'xu' **********************************************/ n = problem["n"]; xl = new double[n]; xu = new double[n]; for(i=0;i