######################################################################## # # This is an example call of MIDACO 7 # ----------------------------------- # # 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. # # Run it with: Rscript example_MINLP.R # or in R: source("example_MINLP.R") # ######################################################################## source("midaco.R") # The MIDACO gateway, provides midaco() ######################################################################## ###################### OPTIMIZATION PROBLEM ######################## ######################################################################## problem_function <- function(x) { f <- numeric(1) # Objectives F(X) g <- numeric(0) # Constraints G(X) # Objective functions F(X) f[1] <- (x[1] - 1)^2 + (x[2] - 2)^2 + (x[3] - 3)^2 + (x[4] - 4)^2 + 1.23456789 list(f = f, g = g) } ######################################################################## ######################### MAIN PROGRAM ############################# ######################################################################## key <- "MIDACO_LIMITED_VERSION___________________ALL_RIGHTS_RESERVED" problem <- list() # Problem specifications option <- list() # MIDACO options problem$fn <- problem_function # Problem function: list(f, g) <- fn(x) ######################################################################## ### Step 1: Problem definition ##################################### ######################################################################## # STEP 1.A: Problem dimensions ############################## problem$o <- 1 # Number of objectives problem$n <- 4 # Number of variables (in total) problem$ni <- 2 # 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' ############################################## problem$xl <- rep(1, problem$n) problem$xu <- rep(4, problem$n) # STEP 1.C: Starting point 'x' ############################## problem$x <- problem$xl # Here for example: starting point = lower bounds ######################################################################## ### Step 2: Choose stopping criteria and printing options ########### ######################################################################## # STEP 2.A: Stopping criteria ############################# option$maxeval <- 10000 # Maximum evaluation budget (e.g. 1000000) option$maxtime <- 60*60*24 # Maximum time limit (e.g. 60*60*24 = 1 Day) # STEP 2.B: Printing options ############################ option$printeval <- 1000 # Print-Frequency for current best solution (e.g. 1000) option$save2file <- 1 # Save SCREEN and SOLUTION to TXT-files [0=NO/1=YES] option$resumable <- 0 # Resumable mode [0=NO/1=YES] ######################################################################## ### Step 3: Choose MIDACO parameters (FOR ADVANCED USERS) ########### ######################################################################## option$param <- c( ACCURACY = 0.0, SEED = 0.0, FSTOP = 0.0, 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 = 0.0, PMISQP = 0.0 ) ######################################################################## ### Step 4: Choose Parallelization Factor ############################ ######################################################################## option$parallel <- 0 # Serial: 0 or 1, Parallel: 2,3,4,5,6,7,8... ######################################################################## ############################ Run MIDACO ################################ ######################################################################## solution <- midaco(problem, option, key) # print(solution$f) # print(solution$g) # print(solution$x) ######################################################################## ############################ END OF FILE ############################### ########################################################################