Guide to build Matlab interface for Windows using MinGW

The following guide for building Matlab interface for Windows using MinGW has been provided by a user in GitHub Issue #128.

* Update MATLAB’s MinGW using this link to supported compilers. Follow on-screen instructions (for example, dragging and dropping in MATLAB’s command window) NB: Updates will be displayed in MATLAB’s Command window while installation is in progress.

* Confirm set up by typing mex -setup in command window to verify installation following completion (Please check MATLAB and Simulink requirements on the same page using the link above as well)

_images/mexsetup.png

* Majority of the other installation procedures would be done using “Command Prompt Window”. This can easily be accessed by typing “Command window” in the search tile on your Windows operating system.

* Download CMake. I recommend using the Windows x64 Installer option to enable you make your own installation settings. Make sure it is available for all users of the PC. Confirm that cmake is on the PC by typing cmake on command prompt.

* Download your preferred NOMAD version and unzip the file. In the root folder, get a link which is done by easily double-clicking on the pane which bears the opened folder.

* The interface build is managed by CMake that can be run at NOMAD root. Use the command cd copiedAddress command in command prompt to change the directory to the location you have copied above (replace copiedAddress with the link obtained)

* To build the MATLAB interface, force the use of the 64bit version of the compiler with the command:

cmake -DTEST_OPENMP=OFF -DBUILD_INTERFACE_MATLAB=ON -S . -B build/release -A x64

* Following the completion, use the command below that might take some minutes:

cmake --build build/release --config Release

* Then, finally, use the command:

cmake --install build/release

which must be run before using the Matlab nomadOpt function. You can expect to see the following during the build process:

_images/mexbuild1.png
_images/mexbuild2.png
_images/mexbuild3.png

* Make sure to add NOMAD subfolders on MATLAB before testing the installation. On MATLAB’s Home, use the “Set Path” menu to “Add with Subfolders” the whole NOMAD folder so that functions can easily be accessed

* Run examples provided in the installation folder to confirm that the functions can now be called easily from MATLAB’s command window. For example, trying to solve problem three (3) should give you something similar to:

_images/mexrun1.png
_images/mexrun2.png

Complete list of parameters

A set of parameters is available in the table below for fine tuning algorithmic settings. Additional information on each parameter is available by typing $NOMAD_HOME/bin/nomad -h PARAM_NAME.

NOMAD 4 parameters

ADD_SEED_TO_FILE_NAMES

bool

advanced

The flag to add seed to the file names

true

ANISOTROPIC_MESH

bool

advanced

MADS uses anisotropic mesh for generating directions

true

ANISOTROPY_FACTOR

NOMAD::Double

advanced

MADS anisotropy factor for mesh size change

0.1

BB_EXE

std::string

basic

Blackbox executable

BB_INPUT_TYPE

NOMAD::BBInputTypeList

basic

The variable blackbox input types

  • R

BB_MAX_BLOCK_SIZE

size_t

advanced

Size of blocks of points, to be used for parallel evaluations

1

BB_OUTPUT_TYPE

NOMAD::BBOutputTypeList

basic

Type of outputs provided by the blackboxes

OBJ

BB_REDIRECTION

bool

basic

Blackbox executable redirection for outputs

true

CACHE_FILE

std::string

basic

Cache file name

CACHE_SIZE_MAX

size_t

advanced

Maximum number of evaluation points to be stored in the cache

INF

CS_OPTIMIZATION

bool

basic

Coordinate Search optimization

false

DIMENSION

size_t

basic

Dimension of the optimization problem (required)

0

DIRECTION_TYPE

NOMAD::DirectionTypeList

advanced

Direction types for Poll steps

ORTHO N+1 QUAD

DIRECTION_TYPE_SECONDARY_POLL

NOMAD::DirectionTypeList

advanced

Direction types for Mads secondary poll

DOUBLE

DISCO_MADS_DETECTION_RADIUS

NOMAD::Double

advanced

Radius used to reveal discontinuities in DiscoMads

1.0

DISCO_MADS_EXCLUSION_RADIUS

NOMAD::Double

advanced

Radius of exclusion balls around revealing points in DiscoMads

1

DISCO_MADS_LIMIT_RATE

NOMAD::Double

advanced

Limit rate of change used to reveal discontinuities in DiscoMads

1

DISCO_MADS_REVEALING_POLL_NB_POINTS

size_t

advanced

Number of random points sampled by the revealing poll in DiscoMads

1

DISCO_MADS_REVEALING_POLL_RADIUS

NOMAD::Double

advanced

Revealing poll radius in DiscoMads

2.02

DISPLAY_ALL_EVAL

bool

basic

Flag to display all evaluations

false

DISPLAY_DEGREE

int

basic

Level of verbose during execution

2

DISPLAY_FAILED

bool

advanced

Flag to display failed evaluation

false

DISPLAY_HEADER

size_t

advanced

Frequency at which the stats header is displayed

40

DISPLAY_INFEASIBLE

bool

advanced

Flag to display infeasible

true

DISPLAY_MAX_STEP_LEVEL

size_t

advanced

Depth of the step after which info is not printed

20

DISPLAY_STATS

NOMAD::ArrayOfString

basic

Format for displaying the evaluation points

BBE OBJ

DISPLAY_UNSUCCESSFUL

bool

advanced

Flag to display unsuccessful

false

DMULTIMADS_OPTIMIZATION

bool

advanced

DMultiMads solves multiobjective optimization problems

false

EVAL_OPPORTUNISTIC

bool

advanced

Opportunistic strategy: Terminate evaluations as soon as a success is found

true

EVAL_QUEUE_CLEAR

bool

advanced

Opportunistic strategy: Flag to clear EvaluatorControl queue between each run

true

EVAL_QUEUE_SORT

NOMAD::EvalSortType

advanced

How to sort points before evaluation

QUADRATIC_MODEL

EVAL_STATS_FILE

string

basic

The name of the file for stats about evaluations and successes

EVAL_SURROGATE_COST

size_t

advanced

Cost of the surrogate function versus the true function

INF

EVAL_SURROGATE_OPTIMIZATION

bool

advanced

Use static surrogate as blackbox for optimization

false

EVAL_USE_CACHE

bool

advanced

Use cache in algorithms

true

FIXED_VARIABLE

NOMAD::Point

advanced

Fix some variables to some specific values

FRAME_CENTER_USE_CACHE

bool

advanced

Find best points in the cache and use them as frame centers

false

GRANULARITY

NOMAD::ArrayOfDouble

advanced

The granularity of the variables

HISTORY_FILE

std::string

basic

The name of the history file

HOT_RESTART_FILE

std::string

advanced

The name of the hot restart file

hotrestart.txt

HOT_RESTART_ON_USER_INTERRUPT

bool

advanced

Flag to perform a hot restart on user interrupt

false

HOT_RESTART_READ_FILES

bool

advanced

Flag to read hot restart files

false

HOT_RESTART_WRITE_FILES

bool

advanced

Flag to write hot restart files

false

H_MAX_0

NOMAD::Double

advanced

Initial value of hMax.

NOMAD::INF

INITIAL_FRAME_SIZE

NOMAD::ArrayOfDouble

advanced

The initial frame size of MADS

INITIAL_MESH_SIZE

NOMAD::ArrayOfDouble

advanced

The initial mesh size of MADS

LH_EVAL

size_t

basic

Latin Hypercube Sampling of points (no optimization)

0

LH_SEARCH

NOMAD::LHSearchType

basic

Latin Hypercube Sampling Search method

LOWER_BOUND

NOMAD::ArrayOfDouble

basic

The optimization problem lower bounds for each variable

MAX_BB_EVAL

size_t

basic

Stopping criterion on the number of blackbox evaluations

INF

MAX_EVAL

size_t

advanced

Stopping criterion on the number of evaluations (blackbox and cache)

INF

MAX_ITERATIONS

size_t

advanced

The maximum number of iterations of the MADS algorithm

INF

MAX_ITERATION_PER_MEGAITERATION

size_t

advanced

Maximum number of Iterations to generate for each MegaIteration.

INF

MAX_SURROGATE_EVAL_OPTIMIZATION

size_t

basic

Stopping criterion on the number of static surrogate evaluations

INF

MAX_TIME

size_t

basic

Maximum wall-clock time in seconds

INF

MEGA_SEARCH_POLL

bool

advanced

Evaluate points generated from Search and Poll steps all at once

false

MIN_FRAME_SIZE

NOMAD::ArrayOfDouble

advanced

Termination criterion on minimal frame size of MADS

MIN_MESH_SIZE

NOMAD::ArrayOfDouble

advanced

Termination criterion on minimal mesh size of MADS

NB_THREADS_OPENMP

int

advanced

The number of threads when OpenMP parallel evaluations are enabled

1

NM_DELTA_E

NOMAD::Double

advanced

NM expansion parameter delta_e.

2

NM_DELTA_IC

NOMAD::Double

advanced

NM inside contraction parameter delta_ic.

-0.5

NM_DELTA_OC

NOMAD::Double

advanced

NM outside contraction parameter delta_oc.

0.5

NM_GAMMA

NOMAD::Double

advanced

NM shrink parameter gamma.

0.5

NM_OPTIMIZATION

bool

advanced

Nelder Mead stand alone optimization for constrained and unconstrained pbs

false

NM_SEARCH

bool

advanced

Nelder Mead optimization used as a search step for Mads

true

NM_SEARCH_MAX_TRIAL_PTS_NFACTOR

size_t

advanced

NM-Mads search stopping criterion.

80

NM_SEARCH_RANK_EPS

NOMAD::Double

advanced

NM-Mads epsilon for the rank of DZ.

0.01

NM_SEARCH_STOP_ON_SUCCESS

bool

advanced

NM-Mads search stops on success.

false

NM_SIMPLEX_INCLUDE_FACTOR

size_t

advanced

Construct NM simplex using points in cache.

8

NM_SIMPLEX_INCLUDE_LENGTH

NOMAD::Double

advanced

Construct NM simplex using points in cache.

INF

ORTHO_MESH_REFINE_FREQ

size_t

advanced

Control mesh refinement frequency

1

PSD_MADS_ITER_OPPORTUNISTIC

bool

advanced

Opportunistic strategy between the Mads subproblems in PSD-MADS

true

PSD_MADS_NB_SUBPROBLEM

size_t

advanced

Number of PSD-MADS subproblems

INF

PSD_MADS_NB_VAR_IN_SUBPROBLEM

size_t

advanced

Number of variables in PSD-MADS subproblems

2

PSD_MADS_OPTIMIZATION

bool

advanced

PSD-MADS optimization algorithm

0

PSD_MADS_ORIGINAL

bool

advanced

Use NOMAD 3 strategy for mesh update in PSD-MADS

false

PSD_MADS_SUBPROBLEM_MAX_BB_EVAL

size_t

advanced

Max number of evaluations for each subproblem

INF

PSD_MADS_SUBPROBLEM_PERCENT_COVERAGE

NOMAD::Double

advanced

Percentage of variables that must be covered in subproblems before updating mesh

70

QP_ABSOLUTETOL

NOMAD::Double

advanced

A quad model based search step for Mads using a QP solver

1e-3

QP_AUGLAG_ETA0

NOMAD::Double

advanced

A quad model based search step for Mads using a QP solver

1.0

QP_AUGLAG_MAXITERINNER

size_t

advanced

A quad model based search step for Mads using a QP solver

10

QP_AUGLAG_MAXSUCCESSIVFAIL

size_t

advanced

A quad model based search step for Mads using a QP solver

3

QP_AUGLAG_MU0

NOMAD::Double

advanced

A quad model based search step for Mads using a QP solver

0.5

QP_AUGLAG_MUDECREASE

NOMAD::Double

advanced

A quad model based search step for Mads using a QP solver

2

QP_AUGLAG_OMEGA0

NOMAD::Double

advanced

A quad model based search step for Mads using a QP solver

1.0

QP_AUGLAG_SUCCESSRATIO

NOMAD::Double

advanced

A quad model based search step for Mads using a QP solver

0.99

QP_AUGLAG_TOLDISTDXINNER

NOMAD::Double

advanced

A quad model based search step for Mads using a QP solver

1e-15

QP_MAXITER

size_t

advanced

A quad model based search step for Mads using a QP solver

10

QP_OPTIMIZATION

bool

advanced

Quad model stand alone QP optimization for constrained and unconstrained pbs

false

QP_RELATIVETOL

NOMAD::Double

advanced

A quad model based search step for Mads using a QP solver

1e-3

QP_SEARCH

bool

advanced

A quad model based search step for Mads using a QP solver

false

QP_SELECTALGO

size_t

advanced

Select the algorithm for QP solver

0

QP_TOLCOND

NOMAD::Double

advanced

A quad model based search step for Mads using a QP solver

1e-15

QP_TOLDISTDX

NOMAD::Double

advanced

A quad model based search step for Mads using a QP solver

-1.0

QP_TOLMESH

NOMAD::Double

advanced

A quad model based search step for Mads using a QP solver

1.0

QP_VERBOSE

bool

advanced

A quad model based search step for Mads using a QP solver

false

QP_VERBOSEFULL

bool

advanced

A quad model based search step for Mads using a QP solver

false

QUAD_MODEL_AND_LH_SEARCH

bool

basic

Quad model and LH search

false

QUAD_MODEL_DISPLAY

std::string

advanced

Display of a model

QUAD_MODEL_MAX_BLOCK_SIZE

size_t

advanced

Size of blocks of points, to be used for parallel evaluations

INF

QUAD_MODEL_MAX_EVAL

size_t

advanced

Max number of model evaluations for optimization of the quad model problem

2000

QUAD_MODEL_OPTIMIZATION

bool

advanced

Quad model stand alone optimization for constrained and unconstrained pbs

false

QUAD_MODEL_SEARCH

bool

basic

Quad model search

true

QUAD_MODEL_SLD_SEARCH

bool

basic

Quad model (SLD) search

false

RANDOM_ALGO_DUMMY_FACTOR

size_t

advanced

Dummy factor for random algo (used as template)

1

RANDOM_ALGO_OPTIMIZATION

bool

advanced

A standalone random optimization algo (several iterations)

false

RANDOM_ALGO_SEARCH

bool

advanced

A random search step for Mads using an algo (several iterations)

false

RANDOM_SIMPLE_SEARCH

bool

advanced

A template for a simple (no iteration) random search step for Mads

false

REJECT_UNKNOWN_PARAMETERS

bool

advanced

Flag to reject unknown parameters when checking validity of parameters

true

RHO

NOMAD::Double

advanced

Rho parameter of the progressive barrier

0.1

SEARCH_METHOD_MESH_PROJECTION

bool

advanced

Projection on mesh for trial points from a search method

true

SEED

int

advanced

The seed for the pseudo-random number generator

0

SET_FILE

bool

advanced

Boolean to determine if the file of the set is already created

false

SET_FILE_NAME

string

advanced

File to load with the set

SGTELIB_MAX_POINTS_FOR_MODEL

size_t

advanced

Maximum number of valid points used to build a model

500

SGTELIB_MIN_POINTS_FOR_MODEL

size_t

advanced

Minimum number of valid points necessary to build a model

1

SGTELIB_MODEL_DEFINITION

NOMAD::ArrayOfString

advanced

Definition of the Sgtelib model

SGTELIB_MODEL_DISPLAY

std::string

advanced

Display of a model

SGTELIB_MODEL_DIVERSIFICATION

NOMAD::Double

advanced

Coefficient of the exploration term in the sgtelib model problem

0.01

SGTELIB_MODEL_EVAL

bool

advanced

Sgtelib Model Sampling of points

0

SGTELIB_MODEL_FEASIBILITY

NOMAD::SgtelibModelFeasibilityType

advanced

Method used to model the feasibility of a point

C

SGTELIB_MODEL_FORMULATION

NOMAD::SgtelibModelFormulationType

advanced

Formulation of the sgtelib model problem

FS

SGTELIB_MODEL_MAX_BLOCK_SIZE

size_t

advanced

Size of blocks of points, to be used for parallel evaluations

INF

SGTELIB_MODEL_MAX_EVAL

size_t

advanced

Max number of model evaluations for each optimization of the sgtelib model problem

2000

SGTELIB_MODEL_SEARCH

bool

basic

Model search using Sgtelib

false

SGTELIB_MODEL_SEARCH_CANDIDATES_NB

int

advanced

Number of candidates returned by the sgtelib model search

-1

SGTELIB_MODEL_SEARCH_EXCLUSION_AREA

NOMAD::Double

advanced

Exclusion area for the sgtelib model search around points of the cache

0.0

SGTELIB_MODEL_SEARCH_FILTER

std::string

advanced

Methods used in the sgtelib search filter to return several search candidates

2345

SIMPLE_LINE_SEARCH

bool

basic

MADS simple line search method complement speculative search

false

SOLUTION_FILE

std::string

basic

The name of the file containing the best feasible solution

SOLUTION_FILE_FINAL

bool

basic

Flag to decide when to write best feasible solution

false

SPECULATIVE_SEARCH

bool

basic

MADS speculative search method

true

SPECULATIVE_SEARCH_BASE_FACTOR

NOMAD::Double

advanced

Distance of the MADS speculative search method

4.0

SPECULATIVE_SEARCH_MAX

size_t

advanced

MADS speculative search method

1

SSD_MADS_ITER_OPPORTUNISTIC

bool

advanced

Opportunistic strategy between the Mads subproblems in SSD-MADS

true

SSD_MADS_NB_SUBPROBLEM

size_t

advanced

Number of SSD-MADS subproblems

INF

SSD_MADS_NB_VAR_IN_SUBPROBLEM

size_t

advanced

Number of variables in SSD-MADS subproblems

2

SSD_MADS_OPTIMIZATION

bool

advanced

SSD-MADS optimization algorithm

0

SSD_MADS_RESET_VAR_PICKUP_SUBPROBLEM

bool

advanced

Reset random variable pick-up for each subproblem

false

SSD_MADS_SUBPROBLEM_MAX_BB_EVAL

size_t

advanced

Max number of evaluations for each subproblem

INF

STATS_FILE

NOMAD::ArrayOfString

basic

The name of the stats file

STOP_IF_FEASIBLE

bool

advanced

Stop algorithm once a feasible point is obtained

false

STOP_IF_PHASE_ONE_SOLUTION

bool

advanced

Stop algorithm once a phase one solution is obtained

false

SURROGATE_EXE

std::string

advanced

Static surrogate executable

SURROGATE_MAX_BLOCK_SIZE

size_t

advanced

Size of blocks of points, to be used for parallel evaluations

1

SYSTEM_FILE_NAME

string

advanced

File with the constraints

TMP_DIR

std::string

advanced

Directory where to put temporary files

TRIAL_POINT_MAX_ADD_UP

size_t

advanced

Max number of trial points

0

UPPER_BOUND

NOMAD::ArrayOfDouble

basic

The optimization problem upper bounds for each variable

USER_CALLS_ENABLED

bool

advanced

Controls the automatic calls to user function

true

USE_CACHE_FILE_FOR_RERUN

bool

advanced

Cache file for rerun

false

USE_IBEX

bool

advanced

Boolean to determine if we want to use the functionnalities of IBEX

false

VARIABLE_GROUP

NOMAD::ListOfVariableGroup

advanced

The groups of variables)

VNSMART_MADS_SEARCH

bool

advanced

VNS Mads search under condition of consecutive fails

false

VNSMART_MADS_SEARCH_THRESHOLD

int

advanced

Threshold for VNS (SMART) Mads search

3

VNS_MADS_OPTIMIZATION

bool

advanced

VNS MADS stand alone optimization for constrained and unconstrained pbs

false

VNS_MADS_SEARCH

bool

advanced

VNS Mads optimization used as a search step for Mads

false

VNS_MADS_SEARCH_MAX_TRIAL_PTS_NFACTOR

size_t

advanced

VNS-Mads search stopping criterion.

100

VNS_MADS_SEARCH_TRIGGER

NOMAD::Double

advanced

VNS Mads search trigger

0.75

VNS_MADS_SEARCH_WITH_SURROGATE

bool

advanced

VNS Mads search with surrogate

false

X0

NOMAD::ArrayOfPoint

basic

The initial point(s)