######################################################################## # # MIDACO 7 benchmark - MINLPLib ex6_2_10: Surrogate mode # -------------------------------------------------------- # # Phase equilibrium of a liquid mixture: minimize the Gibbs free energy # of three components in two phases. Six mole numbers, three linear # mass balance equations and a non-convex objective with logarithms # (test problem 6.2.10 of the handbook of Floudas et al.). Shown here # as an EXPENSIVE problem: with the SURROGATE mode MIDACO reaches the # optimum in about fifty evaluations, where the default search needs # about fourteen thousand. # # Reference: C. A. Floudas et al., Handbook of Test Problems in Local # and Global Optimization, Kluwer Academic Publishers, 1999. # MINLPLib instance ex6_2_10: # https://www.minlplib.org/ex6_2_10.html # # Variables: 6 continuous variables # Constraints: 3 equality constraints # Optimum: F(X) = -3.051976126 (proven optimal) # # MIDACO setting: PARAM(14) = 4 (SURROGATE, quadratic model), # constraint accuracy 1e-4, budget of 10000 evaluations, start at # the lower bounds, the run stops when F(X) is within 0.01 % of the # optimum (FSTOP). With the default PARAM(14) = 0 the median run # needs about 14,000 evaluations (seeds 0 to 7). # # Run it with: Rscript ex6_2_10_surrogate.R # # This benchmark needs a full MIDACO license: the limited version # solves problems with up to 8 variables and the default parameters. # ######################################################################## source("midaco.R") # The MIDACO gateway, provides midaco() ######################################################################## problem_function <- function(x) { # MINLPLib model ex6_2_10 in scalar form: objective f, constraints g # g[1:3] are equality constraints (= 0) f <- numeric(1) # Objective F(X) g <- numeric(3) # Constraints G(X) t <- log(2.1055*x[1]+3.1878*x[3]+0.92*x[5])*(15.3261663216011*x[1]+ 23.2043471859416*x[3]+6.69678129464404*x[5])-2.46348749603266*x[1]- 4.33155441248417*x[3]-0.626542690017204*x[5]+ 6.4661663216011*log(x[1]/(2.1055*x[1]+3.1878*x[3]+0.92*x[5]))*x[1]+ 12.2043471859416*log(x[3]/(2.1055*x[1]+3.1878*x[3]+0.92*x[5]))*x[3]+ 0.696781294644034*log(x[5]/(2.1055*x[1]+3.1878*x[3]+ 0.92*x[5]))*x[5]+9.86*log(x[1]/(1.972*x[1]+2.4*x[3]+1.4*x[5]))*x[1]+ 12.0*log(x[3]/(1.972*x[1]+2.4*x[3]+1.4*x[5]))*x[3]+ 7.0*log(x[5]/(1.972*x[1]+2.4*x[3]+1.4*x[5]))*x[5] t <- t+log(1.972*x[1]+2.4*x[3]+1.4*x[5])*(1.972*x[1]+2.4*x[3]+1.4*x[5])+ 1.972*log(x[1]/(1.972*x[1]+0.283910843616504*x[3]+ 3.02002220174195*x[5]))*x[1]+2.4*log(x[3]/(1.45991339466884*x[1]+ 2.4*x[3]+0.415073537580851*x[5]))*x[3]+ 1.4*log(x[5]/(0.602183324335333*x[1]+0.115623371371275*x[3]+ 1.4*x[5]))*x[5]+log(2.1055*x[2]+3.1878*x[4]+ 0.92*x[6])*(15.3261663216011*x[2]+23.2043471859416*x[4]+ 6.69678129464404*x[6])-2.46348749603266*x[2]-4.33155441248417*x[4]- 0.626542690017204*x[6]+6.4661663216011*log(x[2]/(2.1055*x[2]+ 3.1878*x[4]+0.92*x[6]))*x[2]+12.2043471859416*log(x[4]/(2.1055*x[2]+ 3.1878*x[4]+0.92*x[6]))*x[4] t <- t+0.696781294644034*log(x[6]/(2.1055*x[2]+3.1878*x[4]+ 0.92*x[6]))*x[6]+9.86*log(x[2]/(1.972*x[2]+2.4*x[4]+1.4*x[6]))*x[2]+ 12.0*log(x[4]/(1.972*x[2]+2.4*x[4]+1.4*x[6]))*x[4]+ 7.0*log(x[6]/(1.972*x[2]+2.4*x[4]+1.4*x[6]))*x[6]+log(1.972*x[2]+ 2.4*x[4]+1.4*x[6])*(1.972*x[2]+2.4*x[4]+1.4*x[6])+ 1.972*log(x[2]/(1.972*x[2]+0.283910843616504*x[4]+ 3.02002220174195*x[6]))*x[2]+2.4*log(x[4]/(1.45991339466884*x[2]+ 2.4*x[4]+0.415073537580851*x[6]))*x[4]+ 1.4*log(x[6]/(0.602183324335333*x[2]+0.115623371371275*x[4]+ 1.4*x[6]))*x[6]-17.2981663216011*log(x[1])*x[1]- 25.6043471859416*log(x[3])*x[3] t <- t-8.09678129464404*log(x[5])*x[5]-17.2981663216011*log(x[2])*x[2]- 25.6043471859416*log(x[4])*x[4]-8.09678129464404*log(x[6])*x[6] f[1] <- t g[1] <- x[1]+x[2]-0.2 g[2] <- x[3]+x[4]-0.4 g[3] <- x[5]+x[6]-0.4 list(f = f, g = g) } ######################################################################## key <- "************************************************************" problem <- list() # Problem specifications option <- list() # MIDACO options problem$fn <- problem_function problem$o <- 1 # Number of objectives problem$n <- 6 # Number of variables (in total) problem$ni <- 0 # Number of integer variables (0 <= ni <= n) problem$m <- 3 # Number of constraints (in total) problem$me <- 3 # Number of equality constraints (0 <= me <= m) problem$xl <- c( 1e-07, 1e-07, 1e-07, 1e-07, 1e-07, 1e-07 ) problem$xu <- c( 0.2, 0.2, 0.4, 0.4, 0.4, 0.4 ) problem$x <- problem$xl # Starting point: lower bounds option$maxeval <- 10000 option$maxtime <- 60*60*24 option$printeval <- 1 option$save2file <- 1 option$resumable <- 0 option$param <- c( ACCURACY = 1e-4, SEED = 0.0, FSTOP = -3.051976126 + 1e-4*3.051976126, ALGOSTOP = 0.0, EVALSTOP = 0.0, FOCUS = 0.0, ANTS = 0.0, KERNEL = 0.0, ORACLE = 0.0, PARETOMAX = 0.0, EPSILON = 0.0, BALANCE = 0.0, CHARACTER = 0.0, SURROGATE = 4.0, PMISQP = 0.0 ) option$parallel <- 0 # Serial: 0 or 1, Parallel: 2,3,4,5,6,7,8... solution <- midaco(problem, option, key)