using System; using System.Collections.Generic; using System.Runtime.InteropServices; /***********************************************************************/ /* // MIDACO 7 benchmark - MINLPLib st_testgr1: Surrogate mode // ---------------------------------------------------------- // // Integer quadratic program of the BARON test collection: ten integer // variables in 0..100, a separable convex quadratic objective and five // linear inequality constraints. Shown here as an EXPENSIVE problem: // with the SURROGATE mode MIDACO reaches the optimum in less than a // hundred evaluations, where the default search needs several thousand. // // Reference: M. Tawarmalani and N. V. Sahinidis, Convexification and // Global Optimization in Continuous and Mixed-Integer Nonlinear // Programming, Kluwer Academic Publishers, 2002. // MINLPLib instance st_testgr1: // https://www.minlplib.org/st_testgr1.html // // Variables: 10 integer variables // Constraints: 5 inequality constraints // Optimum: F(X) = -12.8116 (proven optimal) // // MIDACO setting: PARAM(14) = 4 (SURROGATE, quadratic model), budget // of 10000 evaluations, start at the lower bounds, the run stops // when F(X) reaches the optimum (FSTOP). With the default PARAM(14) // = 0 MIDACO needs between 5,000 and 19,000 evaluations (seeds 0 to // 7). // // Run it with: mcs st_testgr1_surrogate.cs Midaco.cs and mono st_testgr1_surrogate.exe // // This benchmark needs a full MIDACO license: the limited version // solves problems with up to 8 variables and the default parameters. */ /***********************************************************************/ class Optimizationproblem { public static void blackbox( double[] f, double[] g, double[] x ) { /* MINLPLib model st_testgr1 in scalar form: objective f, constraints g */ /* g[0..4] are inequality constraints (>= 0) */ double t; t = 0.00055*x[0]*x[0]-0.0583*x[0]+0.0019*x[1]*x[1]+0.2318*x[1]+ 0.0002*x[2]*x[2]-0.0108*x[2]+0.00095*x[3]*x[3]+0.1634*x[3]+ 0.0046*x[4]*x[4]-0.138*x[4]; t = t+0.0035*x[5]*x[5]+0.357*x[5]+0.00315*x[6]*x[6]-0.1953*x[6]+ 0.00475*x[7]*x[7]-0.361*x[7]+0.0048*x[8]*x[8]+0.1824*x[8]+ 0.003*x[9]*x[9]-0.162*x[9]; f[0] = t; g[0] = 530.0-(8.0*x[0]+7.0*x[1]+9.0*x[2]+9.0*x[4]+8.0*x[5]+ 2.0*x[6]+4.0*x[8]+x[9]); g[1] = 395.0-(3.0*x[0]+4.0*x[1]+6.0*x[2]+9.0*x[3]+6.0*x[5]+ 9.0*x[6]+x[7]+x[9]); g[2] = 350.0-(2.0*x[1]+x[2]+5.0*x[3]+5.0*x[4]+7.0*x[6]+4.0*x[7]+ 2.0*x[8]); g[3] = 405.0-(5.0*x[0]+7.0*x[2]+x[3]+7.0*x[4]+5.0*x[5]+7.0*x[7]+ 9.0*x[8]+5.0*x[9]); g[4] = 200.0-(x[0]+x[1]+x[2]+x[3]+x[4]+x[5]+x[6]+x[7]+x[8]+x[9]); } } /***********************************************************************/ 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 = "************************************************************"; problem["o"] = 1; /* Number of objectives */ problem["n"] = 10; /* Number of variables (in total) */ problem["ni"] = 10; /* Number of integer variables (0 <= ni <= n) */ problem["m"] = 5; /* Number of constraints (in total) */ problem["me"] = 0; /* Number of equality constraints (0 <= me <= m) */ n = problem["n"]; xl = new double[n]; xu = new double[n]; for(i=0;i