1%% GERAD NOMAD Build for Matlab
2
3% This file will help you compile NOMAD for use with MATLAB.
4
5% To recompile you will need to get / do the following:
6
7% 1) Get NOMAD
8% NOMAD is available from http://www.gerad.ca/NOMAD/PHP_Forms/Download.php.
9% Complete the download form then download the latest version. Define the
10% $NOMAD_HOME environment variable.
11
12% 2) NOMAD MEX Interface
13% The NOMAD MEX Interface is a simple MEX interface written to use NOMAD.
14
15% 3) Compile the MEX File
16% The code below will build the NOMAD MEX file. Once you have completed all the
17% above steps, simply run this file to compile NOMAD! You MUST BE in the
18% base directory of OPTI!
19
20clear nomad
21
22switch(computer)
23case 'PCWIN'
24libdir = ' -Lwin32\';
25case 'PCWIN64'
26libdir = ' -Lwin64\';
27case 'GLNX86'
28libdir = 'glnx86/';
29case 'GLNXA64'
30libdir = 'glnxa64/';
31case 'MACI64'
32libdir = 'maci64/';
33end
34
35clear nomad_home nomad_src;
36
37
38fprintf('\n------------------------------------------------\n');
39fprintf('NOMAD MEX FILE BUILD --- GERAD VERSION \n\n');
40
41nomad_home = getenv('NOMAD_HOME');
42if (length(nomad_home)<1)
43    error('opti:nomad','Please set NOMAD_HOME variables properly with the command setenv(''NOMAD_HOME'',ARG1)!');
44end
45nomad_src=[nomad_home filesep 'src' filesep];
46
47
48%Get NOMAD Libraries
49post = [' -I.  -I' nomad_src ' -lm -lut -output nomad'];
50
51%CD to Source Directory
52cdir = cd;
53cd 'Source';
54
55%Compile & Move
56pre = ['mex -v -g -largeArrayDims nomadmex.cpp ' nomad_src 'Parameters.cpp ' nomad_src 'Barrier.cpp ' nomad_src 'Cache.cpp '...
57nomad_src 'Cache_File_Point.cpp ' nomad_src 'Cache_Point.cpp ' nomad_src 'Cache_Search.cpp ' nomad_src 'Clock.cpp '...
58nomad_src 'Direction.cpp ' nomad_src 'Directions.cpp ' nomad_src 'Display.cpp '...
59nomad_src 'Double.cpp ' nomad_src 'Eval_Point.cpp ' nomad_src 'Evaluator.cpp ' nomad_src 'Evaluator_Control.cpp ' nomad_src 'Exception.cpp '...
60nomad_src 'Extended_Poll.cpp ' nomad_src 'L_Curve.cpp ' nomad_src 'LH_Search.cpp ' nomad_src 'OrthogonalMesh.cpp ' nomad_src 'Mads.cpp ' nomad_src 'Model_Sorted_Point.cpp '...
61nomad_src 'Model_Stats.cpp ' nomad_src 'Multi_Obj_Evaluator.cpp ' nomad_src 'Parameter_Entries.cpp '...
62nomad_src 'Parameter_Entry.cpp ' nomad_src 'Pareto_Front.cpp ' nomad_src 'Pareto_Point.cpp ' nomad_src 'Phase_One_Evaluator.cpp '...
63nomad_src 'Phase_One_Search.cpp ' nomad_src 'Point.cpp ' nomad_src 'Priority_Eval_Point.cpp ' nomad_src 'Quad_Model.cpp '...
64nomad_src 'Quad_Model_Evaluator.cpp ' nomad_src 'Quad_Model_Search.cpp ' nomad_src 'Random_Pickup.cpp ' nomad_src 'RNG.cpp '...
65nomad_src 'Signature.cpp ' nomad_src 'Slave.cpp ' nomad_src 'SMesh.cpp ' nomad_src 'Speculative_Search.cpp ' nomad_src 'Stats.cpp ' nomad_src 'utils.cpp '...
66nomad_src 'Variable_Group.cpp ' nomad_src 'VNS_Search.cpp ' nomad_src 'XMesh.cpp'];
67
68try
69    eval([pre post])
70    movefile(['nomad.' mexext],['..' filesep],'f')
71    cd(cdir);
72    clear nomad_home nomad_src cdir post pre libdir;
73    fprintf('Done!\n');
74catch ME
75    cd(cdir);
76	clear nomad_home nomad_src cdir post pre libdir;
77    error('opti:nomad','Error Compiling NOMAD!\n%s',ME.message);
78end
79fprintf('------------------------------------------------\n');
80