/***********************************************************************/ /* // MIDACO 7 benchmark - MINLPLib prob02: Surrogate mode // ------------------------------------------------------ // // A small integer nonlinear problem from the example models of the // AlphaECP solver: six integer variables in 1..100, a linear objective, // three linear and five bilinear inequality constraints. Shown here as // an EXPENSIVE problem: with the SURROGATE mode MIDACO reaches the // optimum in about forty evaluations, where the default search needs // about two thousand. // // MINLPLib instance prob02: // https://www.minlplib.org/prob02.html // // Variables: 6 integer variables // Constraints: 8 inequality constraints // Optimum: F(X) = 112235 (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 the median run needs about 2,100 evaluations (seeds 0 to 7). // // Run it with: java --enable-native-access=ALL-UNNAMED Prob02_surrogate.java // // This benchmark needs a full MIDACO license: the limited version // solves problems with up to 8 variables and the default parameters. */ /***********************************************************************/ public class Prob02_surrogate { static void problemFunction(double[] f, double[] g, double[] x) { /* MINLPLib model prob02 in scalar form: objective f, constraints g */ /* g[0..7] are inequality constraints (>= 0) */ f[0] = 8000.0*x[0]-330.0*x[1]-360.0*x[2]-370.0*x[3]-415.0*x[4]- 435.0*x[5]; g[0] = 8000.0-(330.0*x[1]+360.0*x[2]+370.0*x[3]+415.0*x[4]+ 435.0*x[5]); g[1] = 330.0*x[1]+360.0*x[2]+370.0*x[3]+415.0*x[4]+435.0*x[5]- 7700.0; g[2] = 20.0-(x[1]+x[2]+x[3]+x[4]+x[5]); g[3] = -60.0-(-x[0]*x[1]); g[4] = -30.0-(-x[0]*x[2]); g[5] = -75.0-(-x[0]*x[3]); g[6] = -30.0-(-x[0]*x[4]); g[7] = -100.0-(-x[0]*x[5]); } public static void main(String[] args) { String key = "************************************************************"; Midaco.Problem problem = new Midaco.Problem(); // Problem specifications Midaco.Option option = new Midaco.Option(); // MIDACO options problem.function = Prob02_surrogate::problemFunction; // Handle for problem function problem.o = 1; /* Number of objectives */ problem.n = 6; /* Number of variables (in total) */ problem.ni = 6; /* Number of integer variables (0 <= ni <= n) */ problem.m = 8; /* Number of constraints (in total) */ problem.me = 0; /* Number of equality constraints (0 <= me <= m) */ problem.xl = new double[] { 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 }; problem.xu = new double[] { 100.0, 100.0, 100.0, 100.0, 100.0, 100.0 }; problem.x = problem.xl.clone(); /* Starting point: lower bounds */ option.maxeval = 10000; option.maxtime = 60*60*24; option.printeval = 1; option.save2file = 1; option.resumable = 0; option.param[ 0] = 0.0; /* ACCURACY */ option.param[ 1] = 0.0; /* SEED */ option.param[ 2] = 112235.0; /* FSTOP */ option.param[ 3] = 0.0; /* ALGOSTOP */ option.param[ 4] = 0.0; /* EVALSTOP */ option.param[ 5] = 0.0; /* FOCUS */ option.param[ 6] = 0.0; /* ANTS */ option.param[ 7] = 0.0; /* KERNEL */ option.param[ 8] = 0.0; /* ORACLE */ option.param[ 9] = 0.0; /* PARETOMAX */ option.param[10] = 0.0; /* EPSILON */ option.param[11] = 0.0; /* BALANCE */ option.param[12] = 0.0; /* CHARACTER */ option.param[13] = 4.0; /* SURROGATE */ option.param[14] = 0.0; /* PMISQP */ option.parallel = 0; /* Serial: 0 or 1, Parallel: 2,3,4,5,6,7,8... */ Midaco.Solution solution = Midaco.run(problem, option, key); } }