diff --git a/CONTRIBUTORS b/CONTRIBUTORS new file mode 100644 index 0000000000000000000000000000000000000000..279bffe88a1260806473e4be0cb8639ad0aeec6d --- /dev/null +++ b/CONTRIBUTORS @@ -0,0 +1,30 @@ +# Some features of NOMAD have been developed under the impulsion of +# enthusiastic users/developers/researchers/students/engineers. +# Many feedbacks and tests significantly contributed to improve NOMAD. +# The constributors to the NOMAD project are listed below. +# Contact us at nomad@gerad.ca if you think your name is missing from +# the list. + +Maud Bay, +Eve Bélisle, +Vincent Garnier, +Michal Kvasnička, +Alexander Lutz, +Rosa-Maria Torres-Calderon, +Yuri Vilmanis, +Martin Posch, +Etienne Duclos, +Emmanuel Bigeon, +Walid Zghal, +Jerawan Armstrong, +Stéphane Alarie, +Klaus Truemper, +Andrea Ianni, +Pascal Côté, +Florian Chambon, +Mohamed Sylla, +Quentin Reynaud, +Anthony Guillou, +Dominic Orban, +Amina Ihaddadene, +Viviane Rochon Montplaisir diff --git a/ChangeLog b/ChangeLog index b2f50301d2ac181ab2609daba62233ed3d6ba57e..0545595a74d75b6d719c140fa8afde337140443f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2017-03: NOMAD 3.8 + -Surrogate library + -Granular variables 2015-03: NOMAD 3.7 -Anisotropic scaling -Block evaluations diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..65c5ca88a67c30becee01c5a8816d964b03862f9 --- /dev/null +++ b/LICENSE @@ -0,0 +1,165 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/README b/README index 4966d0ca513aa3232b18f363a00667390907fe0d..77dd913d1621dfba67b5fdf7ac90e35ac1f7c3ae 100644 --- a/README +++ b/README @@ -1,92 +1,77 @@ -####################################################################################### -# # -# README # -# # -####################################################################################### -# # -# NOMAD - Nonsmooth Optimization by Mesh Adaptive Direct search # -# V 3.7.2 # -# # -# Copyright (C) 2001-2015 # -# # -# Mark Abramson - the Boeing Company, Seattle # -# Charles Audet - Ecole Polytechnique, Montreal # -# Gilles Couture - Ecole Polytechnique, Montreal # -# John Dennis - Rice University, Houston # -# Sebastien Le Digabel - Ecole Polytechnique, Montreal # -# Christophe Tribes - Ecole Polytechnique, Montreal # -# # -#-------------------------------------------------------------------------------------# -# # -# Contact information: # -# Ecole Polytechnique de Montreal - GERAD # -# C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada # -# e-mail: nomad@gerad.ca # -# phone : 1-514-340-6053 #6928 # -# fax : 1-514-340-5665 # -# # -# This program is free software: you can redistribute it and/or modify it under the # -# terms of the GNU Lesser General Public License as published by the Free Software # -# Foundation, either version 3 of the License, or (at your option) any later # -# version. # -# # -# This program is distributed in the hope that it will be useful, but WITHOUT ANY # -# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A # -# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. # -# # -# -# You should have received a copy of the GNU Lesser General Public License along # -# with this program. If not, see <http://www.gnu.org/licenses/>. # -# # -# You can find information on the NOMAD software at www.gerad.ca/nomad # -####################################################################################### - - - AUTHORS : - -* Mark A. Abramson (Mark.A.Abramson@boeing.com), The Boeing Company. - -* Charles Audet (www.gerad.ca/Charles.Audet), GERAD and Departement de -mathematiques et de genie industriel, ecole Polytechnique de Montreal. - -* J.E. Dennis Jr. (www.caam.rice.edu/~dennis), Computational and Applied -Mathematics Department, Rice University. - -* Sebastien Le Digabel (www.gerad.ca/Sebastien.Le.Digabel), GERAD and Departement -de mathematiques et de genie industriel, ecole Polytechnique de Montreal. - -* Christophe Tribes, GERAD, Departement -de mathematiques et de genie industriel, Department of mechanical engineering, ecole Polytechnique de Montreal. - - DESCRIPTION : - -NOMAD is a C++ implementation of the Mesh Adaptive Direct Search (MADS) algorithm, -designed for constrained optimization of black-box functions. - -The project started in 2001, and was funded in part by AFOSR, CRIAQ, FQRNT, LANL, -NSERC, the Boeing Company, and ExxonMobil Upstream Research Company. - - - WEB PAGE : - -http://www.gerad.ca/nomad/ - - - FURTHER INSTRUCTIONS : +################################################################################ +# # +# README # +# # +#------------------------------------------------------------------------------# +# NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - # +# version 3.8.1 # +# # +# NOMAD - version 3.8.1 has been created by # +# Charles Audet - Ecole Polytechnique de Montreal # +# Sebastien Le Digabel - Ecole Polytechnique de Montreal # +# Christophe Tribes - Ecole Polytechnique de Montreal # +# # +# The copyright of NOMAD - version 3.8.1 is owned by # +# Sebastien Le Digabel - Ecole Polytechnique de Montreal # +# Christophe Tribes - Ecole Polytechnique de Montreal # +# # +# NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto # +# and IVADO. # +# # +# NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created # +# and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. # +# Dennis Jr., and were funded by AFOSR and Exxon Mobil. # +# # +# Contact information: # +# Ecole Polytechnique de Montreal - GERAD # +# C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada # +# e-mail: nomad@gerad.ca # +# phone : 1-514-340-6053 #6928 # +# fax : 1-514-340-5665 # +# # +# This program is free software: you can redistribute it and/or modify it # +# under the terms of the GNU Lesser General Public License as published by # +# the Free Software Foundation, either version 3 of the License, or (at your # +# option) any later version. # +# # +# This program is distributed in the hope that it will be useful, but WITHOUT # +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License # +# for more details. # +# # +# You should have received a copy of the GNU Lesser General Public License # +# along with this program. If not, see <http://www.gnu.org/licenses/>. # +# # +# You can find information on the NOMAD software at www.gerad.ca/nomad # +#------------------------------------------------------------------------------# + + +DESCRIPTION : + +NOMAD is a C++ implementation of the Mesh Adaptive Direct Search (MADS) +algorithm, designed for constrained optimization of black-box functions. + + +WEB PAGE : + +https://www.gerad.ca/nomad/ + + +FURTHER INSTRUCTIONS : Please visit the web page for futher instruction on the following: - * Downloading, configuring, compiling, and installing NOMAD - * Using NOMAD and setting the parameters - * Reports on NOMAD - * How to report bugs and make enhancement requests - * And more... +* Downloading, configuring, compiling, and installing NOMAD +* Using NOMAD and setting the parameters +* Reports on NOMAD +* How to report bugs and make enhancement requests +* And more... - BATCH OR LIBRARY MODE : +BATCH OR LIBRARY MODE : NOMAD is designed to be used in two different modes : batch and library. -The batch mode is intended for a basic ans simple usage of the MADS method, +The batch mode is intended for a basic and simple usage of the MADS method, while the library mode allows more flexibility. For example, in batch mode, users must define their separate black-box program, that will be called with system calls by NOMAD. @@ -94,21 +79,28 @@ In library mode, users can define their black-box function as C++ code that will be directly called by NOMAD, without system calls and temporary files. - TYPES OF USE : +EXECUTABLES : -There are two ways of using NOMAD, one can directly use an executable or compile -the source code. - -NOMAD batch mode executable is located in directory $NOMAD_HOME/bin or %NOMAD_HOME%\bin. +On Windows and Mac OS X platforms, NOMAD batch mode executable is located in +directory $NOMAD_HOME/bin or %NOMAD_HOME%\bin. In order to avoid compiling the code, you can simply use this executable. +COMPILATION : + +On Linux, Unix, and Mac OS X, NOMAD can be compiled using the makefile located +in $NOMAD_HOME/bin. Alternatively, using the script install.sh located in +directory $NOMAD_HOME/install will install all NOMAD binaries. + +On Windows, NOMAD can be compiled using the Microsoft Visual Studio projet +located in the %NOMAD_EXAMPLES%\VisualStudio directory. + - HOW TO EXECUTE NOMAD : +HOW TO EXECUTE NOMAD : For informations about the execution of NOMAD, please read the user guide : - $NOMAD_HOME/doc/user_guide.pdf or %NOMAD_HOME%\doc\user_guide.pdf +$NOMAD_HOME/doc/user_guide.pdf or %NOMAD_HOME%\doc\user_guide.pdf or - http://www.gerad.ca/NOMAD/Downloads/user_guide.pdf +https://www.gerad.ca/NOMAD/Downloads/user_guide.pdf diff --git a/doc/user_guide.pdf b/doc/user_guide.pdf index 89d8868221345c8ab22ef416259f945dd8a164ba..e20a6622939b1e82371ce68d66117e1738f09bef 100644 Binary files a/doc/user_guide.pdf and b/doc/user_guide.pdf differ diff --git a/examples/advanced/categorical/HeatShield/HS_Material.cpp b/examples/advanced/categorical/HeatShield/HS_Material.cpp new file mode 100644 index 0000000000000000000000000000000000000000..64c1c4a33418610c672afc064739681b109b1122 --- /dev/null +++ b/examples/advanced/categorical/HeatShield/HS_Material.cpp @@ -0,0 +1,551 @@ +#include "HS_Material.hpp" +using namespace std; + +/*------------------------*/ +/* conversion constants */ +/*------------------------*/ +const double HS_Material::DENSITY_CC = 2.767974E-2; +const double HS_Material::T_CC = 1/1.8; +const double HS_Material::K_CC = 1/57.7882; +const double HS_Material::S_CC = 689.476; +const double HS_Material::YM_CC = 6.89476E5; + +/*---------------*/ +/* constructor */ +/*---------------*/ +HS_Material::HS_Material ( material_type t , + double d ) : _type ( t ) , + _density ( d * DENSITY_CC ) , + _nT ( 0 ) , + _T ( NULL ) , + _nk ( 0 ) , + _k ( NULL ) , + _kA ( NULL ) , + _kB ( NULL ) , + _kC ( NULL ) , + _ns ( 0 ) , + _s ( NULL ) , + _sA ( NULL ) , + _sB ( NULL ) , + _sC ( NULL ) , + _nTCI ( 0 ) , + _TCI ( NULL ) , + _ne ( 0 ) , + _e ( NULL ) , + _ekA ( NULL ) , + _ekB ( NULL ) , + _ekC ( NULL ) , + _ksA ( NULL ) , + _ksB ( NULL ) , + _ksC ( NULL ) , + _nTEI ( 0 ) , + _TEI ( NULL ) , + _ny ( 0 ) , + _y ( NULL ) , + _yA ( NULL ) , + _yB ( NULL ) , + _yC ( NULL ) {} +/*--------------*/ +/* destructor */ +/*--------------*/ +HS_Material::~HS_Material ( void ) + { + delete [] _T; + delete [] _k; + delete [] _kA; + delete [] _kB; + delete [] _kC; + delete [] _s; + delete [] _sA; + delete [] _sB; + delete [] _sC; + delete [] _TCI; + delete [] _e; + delete [] _ekA; + delete [] _ekB; + delete [] _ekC; + delete [] _ksA; + delete [] _ksB; + delete [] _ksC; + delete [] _TEI; + delete [] _y; + delete [] _yA; + delete [] _yB; + delete [] _yC; +} + +/*---------------*/ +/* SET methods */ +/*---------------*/ + +// set_T: +void HS_Material::set_T ( int n , double * T , bool convert ) + { + delete [] _T; + double CC = (convert) ? T_CC : 1.0; + _nT = n; + _T = new double [_nT]; + for ( int i = 0 ; i < _nT ; ++i ) + _T[i] = T[i] * CC; +} + +// set_y: +void HS_Material::set_y ( int n , double * y , bool convert ) + { + delete [] _y; + double CC = (convert) ? YM_CC : 1.0; + _ny = n; + _y = new double [_ny]; + for ( int i = 0 ; i < _ny ; ++i ) + _y[i] = y[i] * CC; +} + +// set_k: +void HS_Material::set_k ( int n , double * k , bool convert ) + { + delete [] _k; + double CC = (convert) ? K_CC : 1.0; + _nk = n; + _k = new double [_nk]; + for ( int i = 0 ; i < _nk ; ++i ) + _k[i] = k[i] * CC; +} + +// set_yABC: +void HS_Material::set_yABC ( void ) + { + delete [] _yA; + delete [] _yB; + delete [] _yC; + _yA = new double [ _ny-1 ]; + _yB = new double [ _ny-1 ]; + _yC = new double [ _ny-1 ]; + + double * T = new double [ _ny ]; + int i1 = _ny-1; + int i2 = _nT-1; + while ( i1 >= 0 ) + T[i1--] = _T[i2--]; + + CSplineABC ( _ny-1 , T , _y , _yA , _yB , _yC ); + + delete [] T; +} + +// set_kABC: +void HS_Material::set_kABC ( void ) + { + delete [] _kA; + delete [] _kB; + delete [] _kC; + _kA = new double [ _nk-1 ]; + _kB = new double [ _nk-1 ]; + _kC = new double [ _nk-1 ]; + CSplineABC ( _nk-1 , _T , _k , _kA , _kB , _kC ); +} + +// set_s: +void HS_Material::set_s ( int n , double * s , bool convert ) + { + delete [] _s; + double CC = (convert) ? S_CC : 1.0; + _ns = n; + _s = new double [_ns]; + for ( int i = 0 ; i < _ns ; ++i ) + _s[i] = s[i] * CC; +} + +// set_e: +void HS_Material::set_e ( int n , double * e ) + { + delete [] _e; + _ne = n; + _e = new double [_ne]; + for ( int i = 0 ; i < _ne ; ++i ) + _e[i] = e[i]; +} + +// set_sABC: +void HS_Material::set_sABC ( void ) + { + delete [] _sA; + delete [] _sB; + delete [] _sC; + _sA = new double [ _ns-1 ]; + _sB = new double [ _ns-1 ]; + _sC = new double [ _ns-1 ]; + + // hypothesis: _ns may be smaller than _nT: + double * T = new double [ _ns ]; + int i1 = _ns-1; + int i2 = _nT-1; + while ( i1 >= 0 ) + T[i1--] = _T[i2--]; + + CSplineABC ( _ns-1 , T , _s , _sA , _sB , _sC ); + + delete [] T; +} + +// set_ksABC: +void HS_Material::set_ksABC ( void ) + { + delete [] _ksA; + delete [] _ksB; + delete [] _ksC; + + _ksA = new double [_nT-1]; + _ksB = new double [_nT-1]; + _ksC = new double [_nT-1]; + + double * ks = new double [_nT]; + + for ( int i = 0 ; i < _nT ; ++i ) + ks[i] = _k[i] / _s[i]; + + CSplineABC ( _nT-1 , _T , ks , _ksA , _ksB , _ksC ); + + delete [] ks; +} + +// set_ekABC1: +void HS_Material::set_ekABC1 ( void ) + { + + delete [] _ekA; + delete [] _ekB; + delete [] _ekC; + + _ekA = new double [_ne-1]; + _ekB = new double [_ne-1]; + _ekC = new double [_ne-1]; + + double * T = new double [ _ne ]; + int i1 = _ne-1; + int i2 = _nT-1; + while ( i1 >= 0 ) + T[i1--] = _T[i2--]; + T[0] = 0.0; + + CSplineABC ( _ne-1 , T , _e , _ekA , _ekB , _ekC ); + + delete [] T; +} + +// set_ekABC2: +void HS_Material::set_ekABC2 ( void ) + { + + delete [] _ekA; + delete [] _ekB; + delete [] _ekC; + + _ekA = new double [_nT-1]; + _ekB = new double [_nT-1]; + _ekC = new double [_nT-1]; + + double * ek = new double [ _nT ]; + for ( int i = 0 ; i < _nT ; ++i ) + ek[i] = _e[i] * _k[i]; + + CSplineABC ( _nT-1 , _T , ek , _ekA , _ekB , _ekC ); + + delete [] ek; +} + +// set_TCI: +void HS_Material::set_TCI ( void ) + { + + delete [] _TCI; + + int i; + int nx = _nT - 1; + double * x = new double [nx]; + double * fx = new double [nx]; + + for ( i = 0 ; i < nx ; ++i ) + x[i] = ( _T[i] + _T[i+1] ) / 2.0; + + thermal_conductivity ( nx , x , fx ); + + _nTCI = nx; + _TCI = new double[nx]; + for ( i = 0 ; i < nx ; ++i ) + _TCI[i] = (_k[i]+_k[i+1]+4*fx[i]) * (_T[i+1]-_T[i]) / 6.0; + + delete [] x; + delete [] fx; +} + +// set_TEI: +void HS_Material::set_TEI ( void ) + { + + delete [] _TEI; + + int i; + int nx = _nT - 1; + double * x = new double [nx]; + double * fx1 = new double [nx]; + double * fx2 = new double [nx]; + + for ( i = 0 ; i < nx ; ++i ) + x[i] = ( _T[i] + _T[i+1] ) / 2.0; + + thermal_conductivity_stress ( nx , x , fx1 ); + thermal_expansion ( nx , x , fx2 ); + + _nTEI = nx; + _TEI = new double[nx]; + for ( i = 0 ; i < nx ; ++i ) + _TEI[i] = ( _e[i]*_k[i] + _e[i+1]*_k[i+1] + 4*fx1[i]*fx2[i] ) * + (_T[i+1]-_T[i]) / 6; + + delete [] x; + delete [] fx1; + delete [] fx2; +} + +/*-------------------------------------------------*/ +/* Material: get the T indexes between T1 and T2 */ +/*-------------------------------------------------*/ +bool HS_Material::get_T_indexes ( double T1 , + double T2 , + int & indfirst , + int & indlast ) const { + indfirst = -1; + indlast = -1; + + if ( T2 <= _T[0] || T1 >= _T[_nT-1] || T2 <= T1 ) + return false; + + indfirst = 0; + while ( _T[indfirst] <= T1 ) + ++indfirst; + + indlast = _nT-1; + while ( _T[indlast] >= T2 ) + --indlast; + + if ( indfirst > indlast ) + { + indfirst = indlast = -1; + return false; + } + + return true; +} + +/*---------------------*/ +/* thermal expansion */ +/*---------------------*/ +void HS_Material::thermal_expansion ( int nx , + const double * x , + double * y ) const { + double w; + int ind; + for ( int i = 0 ; i < nx ; ++i ) + { + if ( x[i] <= _T[0] ) + ind = 0; + else if ( x[i] >= _T[_nT-1] ) + ind = _nT-2; + else + { + ind = 0; + while ( x[i] >= _T[ind+1] ) + ++ind; + } + w = x[i] - _T[ind]; + y[i] = _e[ind]*_k[ind] + w * ( _ekC[ind] + w * ( _ekB[ind] + w * _ekA[ind] ) ); + } +} + +/*-------------------------------*/ +/* thermal conductivity/stress */ +/*-------------------------------*/ +void HS_Material::thermal_conductivity_stress ( int nx , + const double * x , + double * y ) const { + double w; + int ind; + for ( int i = 0 ; i < nx ; ++i ) + { + if ( x[i] <= _T[0] ) + ind = 0; + else if ( x[i] >= _T[_nT-1] ) + ind = _nT-2; + else + { + ind = 0; + while ( x[i] >= _T[ind+1] ) + ++ind; + } + w = x[i] - _T[ind]; + y[i] = _k[ind] * _s[ind] + w * ( _ksC[ind] + w * ( _ksB[ind] + w * _ksA[ind] ) ); + } +} + +/*------------------------*/ +/* thermal conductivity */ +/*------------------------*/ +void HS_Material::thermal_conductivity ( int nx , + const double * x , + double * y ) const { + double w; + int ind; + for ( int i = 0 ; i < nx ; ++i ) + { + if ( x[i] <= _T[0] ) + ind = 0; + else if ( x[i] >= _T[_nT-1] ) + ind = _nT-2; + else + { + ind = 0; + while ( x[i] >= _T[ind+1] ) + ++ind; + } + w = x[i] - _T[ind]; + y[i] = _k[ind] + w * ( _kC[ind] + w * ( _kB[ind] + w * _kA[ind] ) ); + } +} + +/*------------------------*/ +/* thermal YoungModulus */ +/*------------------------*/ +void HS_Material::thermal_YM ( int nx , + const double * x , + double * y ) const { + double w; + int ind; + for ( int i = 0 ; i < nx ; ++i ) + { + if ( x[i] <= _T[0] ) + ind = 0; + else if ( x[i] >= _T[_nT-1] ) + ind = _nT-2; + else + { + ind = 0; + while ( x[i] >= _T[ind+1] ) + ++ind; + } + w = x[i] - _T[ind]; + + y[i] = _y[ind] + w * ( _yC[ind] + w * ( _yB[ind] + w * _yA[ind] ) ); + } +} + +/*------------------*/ +/* thermal stress */ +/*------------------*/ +double HS_Material::thermal_stress ( double T ) const { + + int ind; + if ( T <= _T[0] ) + ind = 0; + else if ( T >= _T[_nT-1] ) + ind = _nT-2; + else + { + ind = 0; + while ( T >= _T[ind+1] ) + ++ind; + } + + double w = T - _T[ind]; + + return _s[ind] + w * ( _sC[ind] + w * ( _sB[ind] + w * _sA[ind] ) ); +} + +/*---------------------------------------------------------*/ +/* tridiagonal solver to determine cubic spline z-values */ +/*---------------------------------------------------------*/ +void HS_Material::CSplineABC ( int n , + const double * x , // size n+1 + const double * y , // size n+1 + double * A , // size n + double * B , // size n + double * C ) const { // size n + + double * h = new double [n]; + double * b = new double [n]; + double * u = new double [n-1]; + double * v = new double [n-1]; + + int i; + + for ( i = 0 ; i < n ; ++i ) + { + h[i] = x[i+1] - x[i]; + b[i] = 6*(y[i+1]-y[i])/h[i]; + if ( i < n-1 ) + { + u[i] = 2 * ( h[i] + x[i+2] - x[i+1] ); + v[i] = -b[i] + 6 * ( y[i+2]-y[i+1] ) / (x[i+2]-x[i+1]); + } + } + + for ( i = 1 ; i < n-1 ; ++i ) + { + u[i] -= h[i]*h[i] / u[i-1]; + v[i] -= h[i]*v[i-1]/ u[i-1]; + } + + double * z = new double[n+1]; + z[0] = z[n] = 0; + + for ( i = n-1 ; i > 0 ; --i ) + z[i] = (v[i-1] - h[i]*z[i+1])/u[i-1]; + + // compute cubic spline coefficients: + for ( i = 0 ; i < n ; ++i ) + { + A[i] = (z[i+1] - z[i]) / (6*h[i]); + B[i] = z[i] / 2; + C[i] = -h[i]*z[i+1]/6 - h[i]*z[i]/3 + (y[i+1]-y[i])/h[i]; + } + + delete [] h; + delete [] b; + delete [] u; + delete [] v; + delete [] z; +} + +/*-------------------------*/ +/* display material type */ +/*-------------------------*/ +ostream & operator << ( ostream & out , material_type mt ) + { + + switch ( mt ) + { + case _NYLON_: + out << "nylon"; + break; + case _TEFLON_: + out << "teflon"; + break; + case _EPOXY_NORMAL_: + out << "epoxy_normal"; + break; + case _EPOXY_PLANE_: + out << "epoxy_plane"; + break; + case _ALUMINIUM_: + out << "aluminum"; + break; + case _STEEL_: + out << "steel"; + break; + case _CARBON_STEEL_: + out << "carbon_steel"; + break; + default: + out << "undefined"; + } + return out; +} diff --git a/examples/advanced/categorical/HeatShield/HS_Material.hpp b/examples/advanced/categorical/HeatShield/HS_Material.hpp new file mode 100644 index 0000000000000000000000000000000000000000..946f846e55eb3bf7d38dfbe98e3a3670d8c14c96 --- /dev/null +++ b/examples/advanced/categorical/HeatShield/HS_Material.hpp @@ -0,0 +1,138 @@ +#ifndef __HS_MATERIAL__ +#define __HS_MATERIAL__ + +#include <iostream> +#include <iomanip> +#include <fstream> + +/*----------------------*/ +/* types of materials */ +/*----------------------*/ +enum material_type { _NYLON_ , // 0 + _TEFLON_ , // 1 + _EPOXY_NORMAL_ , // 2 + _EPOXY_PLANE_ , // 3 + _ALUMINIUM_ , // 4 + _STEEL_ , // 5 + _CARBON_STEEL_ }; // 6 + +// display material type: +std::ostream & operator << ( std::ostream & , material_type ); + +/*-----------------*/ +/* material type */ +/*-----------------*/ +class HS_Material { + +private: + + material_type _type; + double _density; + int _nT; + double * _T; + int _nk; + double * _k; + double * _kA; + double * _kB; + double * _kC; + int _ns; + double * _s; + double * _sA; + double * _sB; + double * _sC; + int _nTCI; + double * _TCI; + int _ne; + double * _e; + double * _ekA; + double * _ekB; + double * _ekC; + double * _ksA; + double * _ksB; + double * _ksC; + int _nTEI; + double * _TEI; + int _ny; + double * _y; + double * _yA; + double * _yB; + double * _yC; + + // tridiagonal solver to determine cubic spline z-values: + void CSplineABC ( int n , + const double * x , + const double * y , + double * A , + double * B , + double * C ) const; +public: + + // conversion constants: + static const double DENSITY_CC; + static const double T_CC; + static const double K_CC; + static const double S_CC; + static const double YM_CC; + + // constructor: + HS_Material ( material_type t , double d ); + + // destructor: + ~HS_Material ( void ); + + // SET methods: + void set_T ( int n , double * T , bool convert = true ); + void set_y ( int n , double * y , bool convert = true ); + void set_k ( int n , double * k , bool convert = true ); + void set_s ( int n , double * s , bool convert = true ); + void set_e ( int n , double * e ); + void set_yABC ( void ); + void set_kABC ( void ); + void set_sABC ( void ); + void set_ekABC1 ( void ); + void set_ekABC2 ( void ); + void set_TCI ( void ); + void set_ksABC ( void ); + void set_TEI ( void ); + + // get the T indexes between T1 and T2: + bool get_T_indexes ( double T1 , + double T2 , + int & indfirst , + int & indlast ) const; + + // other GET methods: + double get_density ( void ) const { return _density; } + int get_nT ( void ) const { return _nT; } + double get_T ( int ind ) const { return _T [ind]; } + double get_k ( int ind ) const { return _k [ind]; } + double get_e ( int ind ) const { return _e [ind]; } + double get_TCI ( int ind ) const { return _TCI[ind]; } + double get_TEI ( int ind ) const { return _TEI[ind]; } + + // thermal expansion: + void thermal_expansion ( int nx , + const double * x , + double * y ) const; + + // thermal conductivity: + void thermal_conductivity ( int nx , + const double * x , + double * y ) const; + + // thermal stress: + double thermal_stress ( double T ) const; + + // thermal conductivity/stress: + void thermal_conductivity_stress ( int nx , + const double * x , + double * y ) const; + + // thermal YoungModulus: + void thermal_YM ( int nx , + const double * x , + double * y ) const; + +}; + +#endif diff --git a/examples/advanced/categorical/HeatShield/HS_Param.cpp b/examples/advanced/categorical/HeatShield/HS_Param.cpp new file mode 100644 index 0000000000000000000000000000000000000000..87a6a000eadef66ef4be9e65e917fcc81ba15d9c --- /dev/null +++ b/examples/advanced/categorical/HeatShield/HS_Param.cpp @@ -0,0 +1,325 @@ +#include "HS_Param.hpp" +using namespace std; + +/*---------------*/ +/* constructor */ +/*---------------*/ +HS_Param::HS_Param ( int load_flag , + double load , + double max_weight , + double TE_limit , + double T_cold , + double T_hot , + double L ) : _load_flag ( load_flag ) , + _load ( load ) , + _max_weight ( max_weight ) , + _TE_limit ( TE_limit ) , + _T_cold ( T_cold ) , + _T_hot ( T_hot ) , + _L ( L ) { + // materials: + // ---------- + _material = new HS_Material * [_CARBON_STEEL_ + 1]; + + double T1[18] = { 0 , 7.2 , 40 , 80 , 100 , 140 , 180 , 200 , 240 , + 280 , 300 , 340 , 380 , 400 , 440 , 480 , 500 , 540 }; + double T2[ 5] = { 0 , 20 , 77 , 195 , 297 }; + + double k1[18] = { 0 , 0.0072 , 0.064 , 0.125 , 0.148 , 0.17 , 0.185 , + 0.188 , 0.194 , 0.2 , 0.202 , 0.202 , 0.202 , 0.202, + 0.202 , 0.202 , 0.202 , 0.202 }; + double k2[18] = { 0 , 0.0266 , 0.0855 , 0.117 , 0.125 , 0.135 , 0.142 , + 0.142 , 0.143 , 0.146 , 0.148 , + 0.15 , 0.15 , 0.15 , 0.15 , 0.15 , 0.15 , 0.15 }; + double k3[ 5] = { 0 , 0.0015 , 0.002 , 0.003 , 0.0035 }; + double k4[ 5] = { 0 , 0.002 , 0.0026 , 0.0044 , 0.005 }; + double k5[18] = { 0 , 20 , 105 , 158 , 159 , 136 , 121 , 119 , 117 , + 116 , 116 , 116 , 116 , 116 , 116 ,116 , 116 , 116 }; + double k6[18] = { 0 , 0.14 , 1.26 , 3 , 3.7 , 4.68 , 5.49 , 5.72 , 5.24 , + 6.53 , 7 , 7.22 , 7.64 , 7.75 , 8.02 , 8.26 , 8.43 , 8.67 }; + double k7[18] = { 0 , 1.7 , 15 , 25.1 , 29.5 , 34.4 , 36.4 , 37 , + 37.6 , 37.6 , 37.6 , 37.6 , 37.6 , + 37.6 , 37.6 , 37.6 , 37.6 , 37.6 }; + + double s1[18] = { 29.9 , 29.8 , 29.6 , 29.1 , 28.9 , 28 , 27 , 26.5 , 25 , + 23.9 , 23.2 , 21 , 19.3 , 18.5 , 15.8 , 13.7 , 12 , 9 }; + double s2[18] = { 18.8 , 18.6 , 17.8 , 16.8 , 16.2 , 14.8 , 13.9 , 13 , 11.5 , + 10.6 , 9.6 , 8.2 , 7.6 , 6.4 , 4.8 , 3.9 , 3.2 , 1.9 }; + double s3[4] = { 117 , 125 , 90 , 81 }; + double s5[18] = { 51 , 50 , 43 , 36 , 35 , 32 , 29.5 , 29 , 28 , 28 , 28 , + 28 , 28 , 28 , 28 , 28 , 28 , 28 }; + double s6[18] = { 195.5 , 195 , 194 , 193 , 192 , 190 , 189 , 188 , 187 , + 186 , 186 , 182 , 181 , 180 , 178 , 176 , 175 , 173 }; + double s7[18] = { 102 , 100 , 92 , 87 , 82 , 78 , 72 , 70 , 66 , 63 , 60 , + 58 , 55 , 53 , 51 , 49 , 48 , 47 }; + double e1[17] = { 0.0145 , 0.01437, 0.01404 , 0.01376 , 0.01314 , + 0.01233 , 0.01186 , 0.01078 , 0.00979 , 0.00918 , + 0.00798 , 0.00664 , 0.00595 , 0.00444 , + 0.00273 , 0.00184 , 0 }; + double e2[17] = { 0.02695 , 0.02643 , 0.02563 , 0.02514 , 0.02406 , + 0.02285 , 0.02221 , 0.02087 , 0.0194 , 0.01858 , + 0.01671 , 0.01432 , 0.013 , 0.01024 , 0.00735 , + 0.00591 , 0 }; + double e3[5] = { 0.00249 , 0.002463 , 0.00214 , 0.001123 , 0 }; + double e4[5] = { 0.00249 , 0.002463 , 0.00214 , 0.001123 , 0 }; + + double e5[17] = { 0.00431 , 0.00431 , 0.00428 , 0.00423 , 0.004090 , + 0.00385 , 0.00371 , 0.00338 , 0.00301 , 0.00281 , + 0.00239 , 0.00195 , 0.00172 , 0.00125 , 0.000750 , + 0.0005 , 0 }; + double e6[17] = { 0.00304 , 0.003051 , 0.003051 , 0.003021 , 0.00291 , + 0.00274 , 0.00263 , 0.00239 , 0.00212 , 0.00198 , + 0.00167 , 0.00137 , 0.00121 , 0.00088 , 0.00053 , + 0.00035 , 0 }; + double e7[17] = { 0.0021 , 0.0021 , 0.00209 , 0.00207 , 0.00201 , + 0.0019 , 0.00183 , 0.00168 , 0.00151 , 0.00141 , + 0.0012 , 0.00098 , 0.00087 , 0.00064 , 0.00036 , + 0.00025 , 0 }; + double y1[18] = { 1.41 , 1.40 , 1.35 , 1.26 , 1.2 , 1.1 , 1.02 , + .96 , .83 , .76 , .71 , .58 , .52 , .50 , .46 , + .435 , .425 , .42 }; + double y2[18] = { .84 , .83 , .81 , .78 , .76 , .73 , .71 , .68 , + .60 , .55 , .48 , .32 , .235 , .19 , .12 , + .09 , .07 , .05 }; + double y3[4] = { 4.27 , 3.98 , 3.50 , 3.29 }; + double y5[18] = { 11 , 11 , 11 , 11 , 11 , 11 , 11 , 11 , 10.8 , + 10.7 , 10.6 , 10.5 , 10.4 , 10.3 , 10.2 , 10.1 , + 10 , 10 }; + double y6[18] = { 29 , 28.9 , 28.6 , 28.2 , 28 , 27.6 , 27.2 , 27 , + 26.6 , 26.2 , 26 , 25.6 , 25.2 , 25 , 24.6 , 24.2 , + 24 , 23.6 }; + double y7[18] = { 31.58 , 31.56 , 31.46 , 31.31 , 31.24 , 31.1 , 30.96 , + 30.89 , 30.76 , 30.62 , 30.55 , 30.41 , 30.28 , 30.21 , + 30.07 , 29.93 , 29.86 , 29.72 }; + + double tmp1 , tmp2; + + // nylon: + { + _material[_NYLON_] = new HS_Material ( _NYLON_ , 0.0379 ); + _material[_NYLON_]->set_T ( 18 , T1 ); + _material[_NYLON_]->set_k ( 18 , k1 ); + _material[_NYLON_]->set_s ( 18 , s1 ); + _material[_NYLON_]->set_kABC(); + _material[_NYLON_]->set_sABC(); + _material[_NYLON_]->set_TCI(); + _material[_NYLON_]->set_e ( 17 , e1 ); + _material[_NYLON_]->set_ekABC1(); + tmp1 = 4; + _material[_NYLON_]->thermal_expansion ( 1 , &tmp1 , &tmp2 ); + double etmp[18] = { 0.0145 , -1 , 0.01437, 0.01404 , 0.01376 , 0.01314 , + 0.01233 , 0.01186 , 0.01078 , 0.00979 , 0.00918 , + 0.00798 , 0.00664 , 0.00595 , 0.00444 , + 0.00273 , 0.00184 , 0 }; + etmp[1] = tmp2; + _material[_NYLON_]->set_e ( 18 , etmp ); + _material[_NYLON_]->set_ekABC2(); + + _material[_NYLON_]->set_ksABC(); + _material[_NYLON_]->set_TEI(); + + _material[_NYLON_]->set_y ( 18 , y1 ); + _material[_NYLON_]->set_yABC(); + } + + // teflon: + { + _material[_TEFLON_] = new HS_Material ( _TEFLON_ , 0.054 ); + _material[_TEFLON_]->set_T ( 18 , T1 ); + _material[_TEFLON_]->set_k ( 18 , k2 ); + _material[_TEFLON_]->set_s ( 18 , s2 ); + _material[_TEFLON_]->set_kABC(); + _material[_TEFLON_]->set_sABC(); + _material[_TEFLON_]->set_TCI(); + _material[_TEFLON_]->set_e ( 17 , e2 ); + _material[_TEFLON_]->set_ekABC1(); + + tmp1 = 4; + _material[_TEFLON_]->thermal_expansion ( 1 , &tmp1 , &tmp2 ); + double etmp[18] = { 0.02695 , -1 , 0.02643 , 0.02563 , 0.02514 , 0.02406 , + 0.02285 , 0.02221 , 0.02087 , 0.0194 , 0.01858 , + 0.01671 , 0.01432 , 0.013 , 0.01024 , 0.00735 , + 0.00591 , 0 }; + etmp[1] = tmp2; + _material[_TEFLON_]->set_e ( 18 , etmp ); + _material[_TEFLON_]->set_ekABC2(); + + _material[_TEFLON_]->set_ksABC(); + _material[_TEFLON_]->set_TEI(); + + _material[_TEFLON_]->set_y ( 18 , y2 ); + _material[_TEFLON_]->set_yABC(); + } + + // epoxy normal: + { + _material[_EPOXY_NORMAL_] = new HS_Material ( _EPOXY_NORMAL_ , 0.064 ); + _material[_EPOXY_NORMAL_]->set_T ( 5 , T2 , false ); + _material[_EPOXY_NORMAL_]->set_k ( 5 , k3 , false ); + _material[_EPOXY_NORMAL_]->set_s ( 4 , s3 ); + _material[_EPOXY_NORMAL_]->set_kABC(); + _material[_EPOXY_NORMAL_]->set_sABC(); + + _material[_EPOXY_NORMAL_]->set_e ( 5 , e3 ); + _material[_EPOXY_NORMAL_]->set_ekABC2(); + + double s32[5]; + s32[0] = _material[_EPOXY_NORMAL_]->thermal_stress(0); + s32[0] /= HS_Material::S_CC; + for ( int i = 1 ; i < 5 ; ++i ) + s32[i] = s3[i-1]; + _material[_EPOXY_NORMAL_]->set_s ( 5 , s32 ); + _material[_EPOXY_NORMAL_]->set_sABC(); + + _material[_EPOXY_NORMAL_]->set_TCI(); + + _material[_EPOXY_NORMAL_]->set_ksABC(); + _material[_EPOXY_NORMAL_]->set_TEI(); + + _material[_EPOXY_NORMAL_]->set_y ( 4 , y3 ); + _material[_EPOXY_NORMAL_]->set_yABC(); + + tmp1 = 0; + _material[_EPOXY_NORMAL_]->thermal_YM ( 1 , &tmp1 , &tmp2 ); + tmp2 /= HS_Material::YM_CC; + double ytmp[5] = { -1 , 4.27 , 3.98 , 3.50 , 3.29 }; + ytmp[0] = tmp2; + _material[_EPOXY_NORMAL_]->set_y ( 5 , ytmp ); + _material[_EPOXY_NORMAL_]->set_yABC(); + } + + // epoxy plane: + { + _material[_EPOXY_PLANE_] = new HS_Material ( _EPOXY_PLANE_ , 0.064 ); + _material[_EPOXY_PLANE_]->set_T ( 5 , T2 , false ); + _material[_EPOXY_PLANE_]->set_k ( 5 , k4 , false ); + _material[_EPOXY_PLANE_]->set_s ( 4 , s3 ); + _material[_EPOXY_PLANE_]->set_kABC(); + _material[_EPOXY_PLANE_]->set_sABC(); + + _material[_EPOXY_PLANE_]->set_e ( 5 , e4 ); + _material[_EPOXY_PLANE_]->set_ekABC2(); + + double s32[5]; + s32[0] = _material[_EPOXY_PLANE_]->thermal_stress(0); + s32[0] /= HS_Material::S_CC; + for ( int i = 1 ; i < 5 ; ++i ) + s32[i] = s3[i-1]; + _material[_EPOXY_PLANE_]->set_s ( 5 , s32 ); + _material[_EPOXY_PLANE_]->set_sABC(); + + _material[_EPOXY_PLANE_]->set_TCI(); + + _material[_EPOXY_PLANE_]->set_ksABC(); + _material[_EPOXY_PLANE_]->set_TEI(); + + _material[_EPOXY_PLANE_]->set_y ( 4 , y3 ); + _material[_EPOXY_PLANE_]->set_yABC(); + + tmp1 = 0; + _material[_EPOXY_PLANE_]->thermal_YM ( 1 , &tmp1 , &tmp2 ); + tmp2 /= HS_Material::YM_CC; + double ytmp[5] = { -1 , 4.27 , 3.98 , 3.50 , 3.29 }; + ytmp[0] = tmp2; + _material[_EPOXY_PLANE_]->set_y ( 5 , ytmp ); + _material[_EPOXY_PLANE_]->set_yABC(); + } + + // aluminium: + { + _material[_ALUMINIUM_] = new HS_Material ( _ALUMINIUM_ , 0.098 ); + _material[_ALUMINIUM_]->set_T ( 18 , T1 ); + _material[_ALUMINIUM_]->set_k ( 18 , k5 ); + _material[_ALUMINIUM_]->set_s ( 18 , s5 ); + _material[_ALUMINIUM_]->set_kABC(); + _material[_ALUMINIUM_]->set_sABC(); + _material[_ALUMINIUM_]->set_TCI(); + + _material[_ALUMINIUM_]->set_e ( 17 , e5 ); + _material[_ALUMINIUM_]->set_ekABC1(); + tmp1 = 4; + _material[_ALUMINIUM_]->thermal_expansion ( 1 , &tmp1 , &tmp2 ); + double etmp[18] = { 0.00431 , -1 , 0.00431 , 0.00428 , 0.00423 , 0.004090 , + 0.00385 , 0.00371 , 0.00338 , 0.00301 , 0.00281 , + 0.00239 , 0.00195 , 0.00172 , 0.00125 , 0.000750 , + 0.0005 , 0 }; + etmp[1] = tmp2; + _material[_ALUMINIUM_]->set_e ( 18 , etmp ); + _material[_ALUMINIUM_]->set_ekABC2(); + + _material[_ALUMINIUM_]->set_ksABC(); + _material[_ALUMINIUM_]->set_TEI(); + + _material[_ALUMINIUM_]->set_y ( 18 , y5 ); + _material[_ALUMINIUM_]->set_yABC(); + } + + // steel: + { + _material[_STEEL_] = new HS_Material ( _STEEL_ , 0.28 ); + _material[_STEEL_]->set_T ( 18 , T1 ); + _material[_STEEL_]->set_k ( 18 , k6 ); + _material[_STEEL_]->set_s ( 18 , s6 ); + _material[_STEEL_]->set_kABC(); + _material[_STEEL_]->set_sABC(); + _material[_STEEL_]->set_TCI(); + + _material[_STEEL_]->set_e ( 17 , e6 ); + _material[_STEEL_]->set_ekABC1(); + tmp1 = 4; + _material[_STEEL_]->thermal_expansion ( 1 , &tmp1 , &tmp2 ); + double etmp[18] = { 0.00304 , -1 , 0.003051 , 0.003051 , 0.003021 , + 0.00291 , 0.00274 , 0.00263 , 0.00239 , 0.00212 , + 0.00198 , 0.00167 , 0.00137 , 0.00121 , 0.00088 , + 0.00053 , 0.00035 , 0 }; + etmp[1] = tmp2; + _material[_STEEL_]->set_e ( 18 , etmp ); + _material[_STEEL_]->set_ekABC2(); + + _material[_STEEL_]->set_ksABC(); + _material[_STEEL_]->set_TEI(); + + _material[_STEEL_]->set_y ( 18 , y6 ); + _material[_STEEL_]->set_yABC(); + } + + // carbon steel: + { + _material[_CARBON_STEEL_] = new HS_Material ( _CARBON_STEEL_ , 0.282 ); + _material[_CARBON_STEEL_]->set_T ( 18 , T1 ); + _material[_CARBON_STEEL_]->set_k ( 18 , k7 ); + _material[_CARBON_STEEL_]->set_s ( 18 , s7 ); + _material[_CARBON_STEEL_]->set_kABC(); + _material[_CARBON_STEEL_]->set_sABC(); + _material[_CARBON_STEEL_]->set_TCI(); + + _material[_CARBON_STEEL_]->set_e ( 17 , e7 ); + _material[_CARBON_STEEL_]->set_ekABC1(); + tmp1 = 4; + _material[_CARBON_STEEL_]->thermal_expansion ( 1 , &tmp1 , &tmp2 ); + double etmp[18] = { 0.0021 , -1 , 0.0021 , 0.00209 , 0.00207 , 0.00201 , + 0.0019 , 0.00183 , 0.00168 , 0.00151 , 0.00141 , + 0.0012 , 0.00098 , 0.00087 , 0.00064 , 0.00036 , + 0.00025 , 0 }; + + etmp[1] = tmp2; + _material[_CARBON_STEEL_]->set_e ( 18 , etmp ); + _material[_CARBON_STEEL_]->set_ekABC2(); + + _material[_CARBON_STEEL_]->set_ksABC(); + _material[_CARBON_STEEL_]->set_TEI(); + + _material[_CARBON_STEEL_]->set_y ( 18 , y7 ); + _material[_CARBON_STEEL_]->set_yABC(); + } +} + +/*--------------*/ +/* destructor */ +/*--------------*/ +HS_Param::~HS_Param ( void ) + { + for ( int t = _NYLON_ ; t <= _CARBON_STEEL_ ; ++t ) + delete _material[t]; + delete [] _material; +} diff --git a/examples/advanced/categorical/HeatShield/HS_Param.hpp b/examples/advanced/categorical/HeatShield/HS_Param.hpp new file mode 100644 index 0000000000000000000000000000000000000000..0c41195d28b99294933eb896d0e3005d974446ed --- /dev/null +++ b/examples/advanced/categorical/HeatShield/HS_Param.hpp @@ -0,0 +1,44 @@ +#ifndef __HS_PARAM__ +#define __HS_PARAM__ + +#include "HS_Material.hpp" + +class HS_Param { + +private: + + int _load_flag; + double _load; + double _max_weight; + double _TE_limit; + double _T_cold; + double _T_hot; + double _L; + HS_Material ** _material; + +public: + + // constructor: + HS_Param ( int load_flag , + double load , + double max_weight , + double TE_limit , + double T_cold , + double T_hot , + double L ); + + // destructor: + ~HS_Param ( void ); + + // GET methods: + int get_load_flag ( void ) const { return _load_flag; } + double get_load ( void ) const { return _load; } + double get_max_weight ( void ) const { return _max_weight; } + double get_TE_limit ( void ) const { return _TE_limit; } + double get_T_cold ( void ) const { return _T_cold; } + double get_T_hot ( void ) const { return _T_hot; } + double get_L ( void ) const { return _L; } + HS_Material * get_material ( int m ) const { return _material[m]; } +}; + +#endif diff --git a/examples/advanced/categorical/HeatShield/makefile b/examples/advanced/categorical/HeatShield/makefile new file mode 100644 index 0000000000000000000000000000000000000000..cb1ac210dff3ed030cf5918a909de8b1c0158fef --- /dev/null +++ b/examples/advanced/categorical/HeatShield/makefile @@ -0,0 +1,66 @@ +UNAME := $(shell uname) + +EXE = nomad_HS.exe +COMPILATOR = g++ +COMPILATOR_OPTIONS = -ansi -Wall -O3 + +LIB_DIR = $(NOMAD_HOME)/lib +LIB_NOMAD = libnomad.so + + +CXXFLAGS = + +ifeq ($(UNAME), Darwin) +CXXFLAGS += -headerpad_max_install_names +endif + +ifeq ($(UNAME), Linux) +CXXFLAGS += -Wl,-rpath,'$(LIB_DIR)' +CXXFLAGS += -ansi +endif + +LDLIBS = -lm -lnomad +INCLUDE = -I$(NOMAD_HOME)/src -I$(NOMAD_HOME)/ext/sgtelib/src -I. + +COMPILE = $(COMPILATOR) $(COMPILATOR_OPTIONS) $(INCLUDE) -c +OBJS = nomad_HS.o HS_Param.o HS_Material.o + +ifndef NOMAD_HOME +define ECHO_NOMAD + @echo Please set NOMAD_HOME environment variable! + @false +endef +endif + +$(EXE): $(OBJS) + $(ECHO_NOMAD) + @echo " building the scalar version ..." + @echo " exe file : "$(EXE) + @$(COMPILATOR) -o $(EXE) $(OBJS) $(LDLIBS) $(CXXFLAGS) -L$(LIB_DIR) +ifeq ($(UNAME), Darwin) + @install_name_tool -change $(LIB_NOMAD) $(LIB_DIR)/$(LIB_NOMAD) $(EXE) +endif + +nomad_HS.o: nomad_HS.cpp HS_Param.o + $(ECHO_NOMAD) + $(COMPILE) nomad_HS.cpp + +HS_Param.o: HS_Param.cpp HS_Param.hpp HS_Material.o + $(ECHO_NOMAD) + $(COMPILE) HS_Param.cpp + +HS_Material.o: HS_Material.cpp HS_Material.hpp + $(ECHO_NOMAD) + $(COMPILE) HS_Material.cpp + +clean: + @echo " cleaning obj files" + @rm -f $(OBJS) + +del: + @echo " cleaning trash files" + @rm -f core *~ + @echo " cleaning obj files" + @rm -f $(OBJS) + @echo " cleaning exe file" + @rm -f $(EXE) diff --git a/examples/advanced/categorical/HeatShield/nomad_HS.cpp b/examples/advanced/categorical/HeatShield/nomad_HS.cpp new file mode 100644 index 0000000000000000000000000000000000000000..58e479a2b9ab82558c115fdcd8338c7dfe018679 --- /dev/null +++ b/examples/advanced/categorical/HeatShield/nomad_HS.cpp @@ -0,0 +1,830 @@ +/*------------------------------------------*/ +/* The Heatshield problem in library mode */ +/*------------------------------------------*/ +#include "nomad.hpp" +#include "HS_Param.hpp" +using namespace std; +using namespace NOMAD; + +const int LOAD_FLAG = 2; + +const double L = 100; +const double T_COLD = 4.2; +const double T_HOT = 300; + +const double EPS = 1e-13; + +const int N_MAX = 10; +const int NB_MAT = 7; + +// BB_OUTPUT_TYPE depends on Load_Flag values: +// ------------------------------------------- +// 0 : OBJ EB EB +// 1 : OBJ EB EB +// 2 : OBJ EB EB PB PB +// 3 : OBJ EB EB PB PB PB + +// Variables indexes: +// ------------------ +// 0 n +// ------------ +// 1 M[0] +// ... +// n+1 M[n] (n+1 materials) +// ------------ +// n+2 dx[0] +// ... +// 2n+1 dx[n-1] (dx's) +// ------------ +// 2n+2 T[1] (T's) +// ... +// 3n+1 T[n] +// ------------ + +// total: 3n+2 variables + +/*----------------------------------------*/ +/* The problem */ +/*----------------------------------------*/ +class My_Evaluator : public Evaluator { + +private: + + HS_Param _param; + +public: + + My_Evaluator ( const Parameters & p ) : + Evaluator ( p ) , + _param ( LOAD_FLAG , + 250000 , // Load + 10 , // Max_Weight + 0.05 , // TE_Limit + T_COLD , // T_cold + T_HOT , // T_hot + L ) + { + } // L + + ~My_Evaluator ( void ) + { + } + + bool eval_x ( Eval_Point & x , + const NOMAD::Double & h_max , + bool & count_eval ) const; +}; + +/*--------------------------------------------------*/ +/* user class to define categorical neighborhoods */ +/*--------------------------------------------------*/ +class My_Extended_Poll : public Extended_Poll { + +private: + + Signature ** _signatures; + int _km; + int _km_tag; + + // create 3 signatures from the current one (n , n-1, n+1): + void update_signatures ( const Signature & cur_signature , int n ); + + // create _signatures[n] : + void create_signature ( int n ); + +public: + + // constructor: + My_Extended_Poll ( Parameters & p ); + + // destructor: + virtual ~My_Extended_Poll ( void ); + + // construct the extended poll points: + virtual void construct_extended_points ( const Eval_Point & xk ); + +}; + +/*------------------------------------------*/ +/* NOMAD main function */ +/*------------------------------------------*/ +int main ( int argc , char ** argv ) +{ + + + // NOMAD initializations: + NOMAD::begin ( argc , argv ); + + // display: + NOMAD::Display out ( cout ); + out.precision ( DISPLAY_PRECISION_STD ); + + try { + + // parameters creation: + Parameters p ( out ); + + // (initial) number of variables: + int i , n = 1 , dim = 3*n+2; + p.set_DIMENSION ( dim ); + + // definition of output types: + { + vector<bb_output_type> bbot; + bbot.push_back ( OBJ ); + bbot.push_back ( EB ); + bbot.push_back ( EB ); + if ( LOAD_FLAG > 1 ) + { + + bbot.push_back ( PB ); + bbot.push_back ( PB ); + if ( LOAD_FLAG == 3 ) + bbot.push_back ( PB ); + } + p.set_BB_OUTPUT_TYPE ( bbot ); + } + + // starting point: + Point x0 ( dim ); + x0[0] = n; + x0[1] = 0; + x0[2] = 1; + x0[3] = 50; + x0[4] = 150; + + p.set_X0 ( x0 ); + + // categorical variables (n and materials): + for ( i = 0 ; i <= n+1 ; ++i ) + p.set_BB_INPUT_TYPE ( i , CATEGORICAL ); + + // display degree: + p.set_DISPLAY_DEGREE ( NORMAL_DISPLAY ); + + // display stats: + p.set_DISPLAY_STATS ( "bbe ( sol ) obj" ); + + // bounds: + Point lb ( dim , 0 ); + Point ub ( dim ); + for ( i = 2*n+2 ; i <= 3*n+1 ; ++i ) + { + + lb[i] = T_COLD; + ub[i] = T_HOT; + } + ub[0] = N_MAX; + for ( i = 1 ; i <= n+1 ; ++i ) + ub[i] = NB_MAT-1; + for ( i = n+2 ; i <= 2*n+1 ; ++i ) + ub[i] = L; + + p.set_LOWER_BOUND ( lb ); + p.set_UPPER_BOUND ( ub ); + + + // max number of evaluations: + p.set_MAX_BB_EVAL ( 30000 ); + + // extended poll trigger: + p.set_EXTENDED_POLL_TRIGGER ( 1.1 , true ); + + p.set_OPPORTUNISTIC_EVAL(false); + p.set_DIRECTION_TYPE(ORTHO_2N); + p.set_DISABLE_EVAL_SORT(); +// p.set_DIRECTION_TYPE(LT_2N); +// p.set_DIRECTION_TYPE(ORTHO_NP1_QUAD); + // parameters validation: + p.check(); + + // custom evaluator creation: + My_Evaluator ev ( p ); + + // extended poll: + My_Extended_Poll ep ( p ); + + // algorithm creation and execution: + Mads mads ( p , &ev , &ep , NULL , NULL ); + mads.run(); + + // display the solution and the matlab format: + const Eval_Point * xe = mads.get_best_feasible(); + if ( xe ) + { + + + // the solution: + out << endl << "solution:" << endl + << "\tf=" << xe->get_f() << endl << endl; + n = static_cast<int> ( (*xe)[0].value() ); + out << "\tn=" << n << endl << endl; + for ( i = 1 ; i <= n+1 ; ++i ) + out << "\tmat[" << setw(2) << i-1 << "]=" << (*xe)[i] << " (" + << static_cast<material_type> ( (*xe)[i].round() ) + << ")" << endl; + out << endl; + for ( i = n+2 ; i <= 2*n+1 ; ++i ) + out << "\tdx [" << setw(2) << i-n-2 << "]=" << (*xe)[i] << endl; + out << endl; + for ( i = 2*n+2 ; i <= 3*n+1 ; ++i ) + out << "\tT [" << setw(2) << i-2*n-1 << "]=" << (*xe)[i] << endl; + + // the solution in matlab format: + cout << endl << "Matlab:" << endl << "x = [ "; + for ( i = n+2 ; i <= 2*n+1 ; ++i ) + cout << (*xe)[i] << " "; + for ( i = 2*n+2 ; i <= 3*n+1 ; ++i ) + cout << (*xe)[i] << " "; + cout << "]'" << endl; + + cout << "p = { [" << n << "] "; + for ( i = 1 ; i <= n+1 ; ++i ) + cout << ", \'" << static_cast<material_type> ( (*xe)[i].round() ) + << "\' "; + cout << "}" << endl <<endl; + } + } + catch ( exception & e ) + { + + cerr << "\nNOMAD has been interrupted (" << e.what() << ")\n\n"; + return EXIT_FAILURE; + } + + NOMAD::end(); + + return EXIT_SUCCESS; +} + +/*------------------*/ +/* the evaluation */ +/*------------------*/ +bool My_Evaluator::eval_x ( Eval_Point & x , + const NOMAD::Double & h_max , + bool & count_eval ) const +{ + + // 1. number of heat intercepts: + int i , cur = 1 , n = int(x[0].value()); + + // 2. materials: + int * material = new int[n+1]; + for ( i = 0 ; i <= n ; ++i ) + material[i] = int(x[cur++].value());; + + // 3. dx: + double * dx = new double[n+1]; + double sumx = 0.0; + double min_dx = 999; + for ( i = 0 ; i < n ; ++i ) + { + + dx[i] = x[cur++].value(); + if ( dx[i] < min_dx ) + min_dx = dx[i]; + sumx += dx[i]; + } + dx[n] = _param.get_L() - sumx; + if ( dx[n] < min_dx ) + min_dx = dx[n]; + + // 4. T: + double * T = new double[n+2]; + double * objterm = new double[n+2]; + double cycle , v , max_T_viol = 0.0; + + for ( i = 0 ; i <= n+1 ; ++i ) + { + + + if ( i==0 ) + T[0 ] = _param.get_T_cold(); + else + { + + if ( i==n+1 ) + T[n+1] = _param.get_T_hot(); + else + T[i] = x[cur++].value(); + + v = T[i-1] - T[i]; + if ( v > max_T_viol ) + max_T_viol = v; + } + + if ( T[i] <= 4.2 ) + cycle = 5; + else cycle = ( T[i] >= 71 ) ? 2.5 : 4; + + objterm[i] = cycle * ( _param.get_T_hot() / T[i] - 1 ); + } + + /*--------------*/ + /* evaluation */ + /*--------------*/ + + double Ti , Tip1; + int indfirst , indlast; + HS_Material * mat; + + double TC_Integral , TE_Integral , q , a; + double power = 0; + double cx1 = 0; + double cx2 = 0; + double cx3 = 0; + + if ( dx[n] > -EPS && max_T_viol < EPS && min_dx > EPS ) + { + + + for ( i = 0 ; i <= n ; ++i ) + { + + + Ti = T[i ]; + Tip1 = T[i+1]; + + double * x; + int nx; + + mat = _param.get_material ( material[i] ); + + if ( mat->get_T_indexes ( Ti , + Tip1 , + indfirst , + indlast ) ) + { + + nx = 4; + x = new double [4]; + x[0] = Ti; + x[1] = ( Ti + mat->get_T ( indfirst ) ) / 2.0; + x[2] = ( Tip1 + mat->get_T ( indlast ) ) / 2.0; + x[3] = Tip1; + } + else + { + + nx = 3; + x = new double[3]; + x[0] = Ti; + x[1] = (Ti + Tip1) / 2.0; + x[2] = Tip1; + } + + double * y = new double [nx]; + + mat->thermal_conductivity ( nx , x , y ); + + double sum_TCI_Ends = ( nx==3 ) ? + ( y[0] + 4*y[1] + y[2] ) * (Tip1-Ti) / 6 : + ( y[0] + 4*y[1] + mat->get_k(indfirst) ) * + ( mat->get_T(indfirst) - Ti ) / 6 + + ( mat->get_k(indlast) + 4*y[2] + y[3] ) * + ( Tip1 - mat->get_T(indlast) ) / 6; + + double sum_TEI_Ends = 0; + + if ( _param.get_load_flag() >= 2 ) + { + + + mat->thermal_expansion ( nx , x , y ); + + sum_TEI_Ends = ( nx==3 ) ? + ( y[0] + 4*y[1] + y[2] ) * (Tip1-Ti) / 6 : + ( y[0] + 4*y[1] + mat->get_k(indfirst)*mat->get_e(indfirst) ) * + ( mat->get_T(indfirst) - Ti ) / 6 + + ( mat->get_k(indlast)*mat->get_e(indlast) + 4*y[2] + y[3] ) * + ( Tip1 - mat->get_T(indlast) ) / 6; + } + + delete [] x; + delete [] y; + + TC_Integral = sum_TCI_Ends; + TE_Integral = sum_TEI_Ends; + for ( int k = indfirst ; k < indlast ; ++k ) + { + + TC_Integral += mat->get_TCI(k); + TE_Integral += mat->get_TEI(k); + } + + double stress; + + if ( TC_Integral < EPS ) + { + + stress = -1e20; + cx2 = cx3 = 1e20; + a = q = 0; + } + + else + { + + + stress = mat->thermal_stress ( Tip1 ); + + if ( _param.get_load_flag() == 3 ) + { + + + double xtmp[2]; + double ytmp[2]; + xtmp[0] = Ti; + xtmp[1] = Tip1; + mat->thermal_YM ( 2 , xtmp , ytmp ); + + double young_modulus = ( ytmp[0] > ytmp[1] ) ? ytmp[0] : ytmp[1]; + + stress -= young_modulus * TE_Integral / TC_Integral; + + if ( stress < 0 ) + cx3 += stress*stress; + } + + if ( _param.get_load_flag() == 0 ) + q = TC_Integral / dx[i]; + else + { + + a = _param.get_load() / stress; + q = a * TC_Integral / dx[i]; + + if ( _param.get_load_flag() > 1 ) + { + + cx1 += mat->get_density() * dx[i] * a; + cx2 += (dx[i]*TE_Integral/TC_Integral); + } + } + } + power += q * ( objterm[i] - objterm[i+1] ); + } + + count_eval = true; + + dx[n] = -0.0; + + } + else + { + + power = 1e20 / L; + count_eval = false; + } + + // constraints: + x.set_bb_output ( 1 , -dx[n] ); + x.set_bb_output ( 2 , max_T_viol*max_T_viol ); + + if ( _param.get_load_flag() > 1 ) + { + + if ( _param.get_load_flag() == 3 ) + x.set_bb_output ( 5 , cx3 ); + x.set_bb_output ( 3 , cx1 / _param.get_max_weight() - 1 ); + x.set_bb_output ( 4 , cx2 / (_param.get_TE_limit()*_param.get_L()) - 1 ); + } + + // f(x): + x.set_bb_output ( 0 , power * L ); + + // clean memory: + delete [] material; + delete [] dx; + delete [] T; + delete [] objterm; + + return true; // the evaluation succeeded +} + +/*--------------------------------*/ +/* My_Extended_Poll constructor */ +/*--------------------------------*/ +My_Extended_Poll::My_Extended_Poll ( Parameters & p ) : +Extended_Poll ( p ) , +_signatures ( new Signature * [N_MAX+1] ) , +_km ( 1 ) , +_km_tag ( -1 ) +{ + for ( int i = 0 ; i <= N_MAX ; ++i ) + _signatures[i] = NULL; +} + +/*-------------------------------*/ +/* My_Extended_Poll destructor */ +/*-------------------------------*/ +My_Extended_Poll::~My_Extended_Poll ( void ) +{ + + for ( int i = 0 ; i <= N_MAX ; ++i ) + delete _signatures[i]; + delete [] _signatures; +} + +/*-------------------------*/ +/* create _signatures[n] */ +/*-------------------------*/ +void My_Extended_Poll::create_signature ( int n ) +{ + + // C.Tribes nov 25, 2015 --- Several modifs for the new versions + + + NOMAD::Double dm0_dx , dm0_T , dmmin_dx , dmmin_T , dpmin_dx , dpmin_T; + + { + int nref = (_p.get_dimension() - 2) / 3; + + const Point & delta_0 = _p.get_initial_mesh_size(); + const Point & delta_min = _p.get_min_mesh_size(); + const Point & Delta_min = _p.get_min_poll_size(); + + bool delta_min_def = delta_min.is_defined(); + bool Delta_min_def = Delta_min.is_defined(); + + dm0_dx = delta_0 [ nref+2 ]; + dm0_T = delta_0 [ 2*nref+2 ]; + dmmin_dx = (delta_min_def) ? delta_min [ nref+2 ] : NOMAD::Double(); + dmmin_T = (delta_min_def) ? delta_min [ 2*nref+2 ] : NOMAD::Double(); + dpmin_dx = (Delta_min_def) ? Delta_min [ nref+2 ] : NOMAD::Double(); + dpmin_T = (Delta_min_def) ? Delta_min [ 2*nref+2 ] : NOMAD::Double(); + } + + int i , dim = 3*n+2; + vector<bb_input_type> bbit ( dim ); + Point initial_poll_size ( dim , 1.0 ); + Point min_mesh_size ( dim ); + Point min_poll_size ( dim ); + Point lb ( dim , 0.0 ); + Point ub ( dim , N_MAX ); + Point fixed_variables ( dim ); + vector<bool> periodic_variables ( dim ); + +// set<int> var_ind_1; +// set<int> var_ind_2; + + // n and materials: + for ( i = 0 ; i <= n+1 ; ++i ) + { + + bbit[i] = CATEGORICAL; +// var_ind_1.insert ( i ); + } + + // dx's: + for ( i = n+2 ; i <= 2*n+1 ; ++i ) + { + + bbit [i] = CONTINUOUS; + initial_poll_size[i] = dm0_dx; + min_mesh_size [i] = dmmin_dx; + min_poll_size [i] = dpmin_dx; + ub [i] = L; +// var_ind_2.insert ( i ); + } + + // T's: + for ( i = 2*n+2 ; i < dim ; ++i ) + { + + bbit [i] = CONTINUOUS; + initial_poll_size[i] = dm0_T; + min_mesh_size [i] = dmmin_T; + min_poll_size [i] = dpmin_T; + lb [i] = T_COLD; + ub [i] = T_HOT; +// var_ind_2.insert ( i ); + } + +// C.Tribes nov 25, 2015 --- no halton seed in new version +// // construct a new Halton seed: +// int * primes = new int [dim]; +// construct_primes ( dim , primes ); +// int halton_seed_ref = primes[dim-1]; +// delete [] primes; + +// Variable_Group * vg1 = new Variable_Group ( var_ind_1 , +// _p.get_direction_types () , +// _p.get_sec_poll_dir_types() , +// _p.out() ); +// +// Variable_Group * vg2 = new Variable_Group ( var_ind_2 , +// _p.get_direction_types() , +// _p.get_sec_poll_dir_types() , +// _p.out() ); +// +// set<Variable_Group*,VG_Comp> var_groups; +// var_groups.insert ( vg1 ); +// var_groups.insert ( vg2 ); + + + NOMAD::Double mesh_update_basis = 1.0; + NOMAD::Double poll_update_basis = 1.0; + int mesh_coarsening_exponent = 1; + int mesh_refining_exponent = 1; + + +//// create the signature: +// _signatures[n] = new Signature ( dim , +// bbit , +// lb , +// ub , +// NOMAD::XMESH , +// false , +// NOMAD::Point() , +// initial_poll_size , +// min_poll_size , +// min_mesh_size , +// mesh_update_basis , +// poll_update_basis , +// mesh_coarsening_exponent, +// mesh_refining_exponent, +// 0 , +// NOMAD::Point() , +// fixed_variables , +// periodic_variables , +// var_groups ); +// +// +// delete vg1; +// delete vg2; + + + // create the signature: + _signatures[n] = new Signature ( dim , + bbit , + initial_poll_size , + lb , + ub , + _p.get_direction_types () , + _p.get_sec_poll_dir_types() , + _p.out() ); + + +} + +/*-----------------------------------------------------------*/ +/* create 3 signatures from the current one (n , n-1, n+1) */ +/*-----------------------------------------------------------*/ +void My_Extended_Poll::update_signatures ( const Signature & cur_signature , int n ) +{ + + + // n : + // --- + if ( !_signatures[n] ) + _signatures[n] = new Signature ( cur_signature ); + + // n-1 : + // ----- + if ( n > 1 && !_signatures[n-1] ) + create_signature ( n-1 ); + + // n+1 : + // ----- + if ( n < N_MAX && !_signatures[n+1] ) + create_signature ( n+1 ); +} + +/*--------------------------------------*/ +/* construct the extended poll points */ +/*--------------------------------------*/ +void My_Extended_Poll::construct_extended_points ( const Eval_Point & xk ) +{ + + + int tag = xk.get_tag(); + int i , k , mat , n = xk[0].round(); + + // create/update the signatures: + update_signatures ( *xk.get_signature() , n ); + + + // cout << endl << "NEIGHBORS OF " << xk << " :\n"; + + // 1. include neighbors in which 1 insulation material is changed: + { + int incr_m; + if ( tag == _km_tag ) + { + + incr_m = ++_km; + } + else + { + + incr_m = _km = 1; + } + if ( incr_m > NB_MAT ) + { + + incr_m = _km = 1; + } + for ( i = 1 ; i <= n+1 ; ++i ) + { + + mat = static_cast<int>(xk[i].value()+incr_m)%NB_MAT; + Point ep1 ( xk ); + ep1[i] = mat; + // cout << "\tN1(" << i << "/" << n+1 << ") = " << ep1 << endl; + add_extended_poll_point ( ep1 , *_signatures[n] ); + } + } + + // 2. add an intercept: + if ( n < N_MAX ) + { + + + NOMAD::Double xn = L; + for ( k = n+2 ; k <= 2*n+1 ; ++k ) + xn -= xk[k]; + + for ( k = 0 ; k <= n ; ++k ) + { + + + Point ep2 ( 3*n + 5 ); + ep2[0] = n+1; + + // materials: + for ( i = 1 ; i <= k+1 ; ++i ) + ep2[i] = xk[i]; + for ( i = k+2 ; i <= n+2 ; ++i ) + ep2[i] = xk[i-1]; + + // dx's: + for ( i = n+3 ; i < k+n+3 ; ++i ) + ep2[i] = xk[i-1]; + ep2[k+n+3] = ( k+n+2 <= 2*n+1 ) ? xk[k+n+2]/2 : xn/2; + if ( k+n+4 <= 2*n+3 ) + ep2[k+n+4] = xk[k+n+2]/2; + for ( i = k+n+5 ; i <= 2*n+3 ; ++i ) + ep2[i] = xk[i-2]; + + // T's: + if ( k == 0 ) + ep2[2*n+4] = 0.5 * ( T_COLD + xk[2*n+2] ); + else if ( k == n ) + ep2[3*n+4] = 0.5 * ( T_HOT + xk[3*n+1] ); + else + { + + ep2[2*n+4+k] = 0.5 * ( xk[2*n+1+k] + xk[2*n+2+k] ); + } + for ( i = 2*n+4 ; i < 2*n+4+k ; ++i ) + ep2[i] = xk[i-2]; + for ( i = 2*n+5+k ; i <= 3*n+4 ; ++i ) + ep2[i] = xk[i-3]; + + // cout << "\tN2(" << k+1 << "/" << n+1 << ") = " << ep2 << endl; + add_extended_poll_point ( ep2 , *_signatures[n+1] ); + + } + } + + // 3. remove an intercept: + if ( n > 1 ) + { + + + for ( k = 0 ; k < n ; ++k ) + { + + + Point ep3 ( 3*n - 1 ); + ep3[0] = n-1; + + // materials: + for ( i = 1 ; i <= k ; ++i ) + ep3[i] = xk[i]; + for ( i = k+1 ; i <= n ; ++i ) + ep3[i] = xk[i+1]; + + // dx's: + NOMAD::Double d = xk[n+2+k] / (n+1); + for ( i = n+1+k ; i <= 2*n-1 ; ++i ) + ep3[i] = xk[i+2] + d; + for ( i = n+1 ; i <= n+k ; ++i ) + ep3[i] = xk[i+1] + d; + + // T's: + for ( i = 2*n+k ; i <= 3*n-2 ; ++i ) + ep3[i] = xk[i+3]; + for ( i = 2*n ; i < 2*n+k ; ++i ) + ep3[i] = xk[i+2]; + + // cout << "\tN3(" << k+1 << "/" << n << ") = " << ep3 << endl; + add_extended_poll_point ( ep3 , *_signatures[n-1] ); + } + } + + _km_tag = tag; + + // cout << endl; +} diff --git a/examples/advanced/categorical/batch/param.txt b/examples/advanced/categorical/batch/param.txt index 60ed38ecbab6c4fdc837c401a9ac77c17b37afef..ded1a6f0c272e3937907fc005f891e582f84703c 100644 --- a/examples/advanced/categorical/batch/param.txt +++ b/examples/advanced/categorical/batch/param.txt @@ -1,26 +1,26 @@ -DIMENSION 4 - -DISPLAY_DEGREE 2 - -BB_OUTPUT_TYPE EB EB OBJ -BB_INPUT_TYPE ( C R C R ) - -BB_EXE bb.exe - -#NEIGHBORS_EXE "$python neighbors.py" -NEIGHBORS_EXE neighbors.exe - -x0 ( 0 100 1 100 ) - -# display_all_eval yes -display_stats bbe ( sol ) obj - - -lower_bound ( - 0.0 - 0.0 ) -upper_bound ( - 10000 - 10000 ) - -# TMP_DIR /tmp - -F_TARGET 0.0 - -MAX_BB_EVAL 500 +DIMENSION 4 + +DISPLAY_DEGREE 2 + +BB_OUTPUT_TYPE EB EB OBJ +BB_INPUT_TYPE ( C R C R ) + +BB_EXE bb.exe + +#NEIGHBORS_EXE "$python neighbors.py" +NEIGHBORS_EXE neighbors.exe + +x0 ( 0 100 1 100 ) + +# display_all_eval yes +display_stats bbe ( sol ) obj + + +lower_bound ( - 0.0 - 0.0 ) +upper_bound ( - 10000 - 10000 ) + +# TMP_DIR /tmp + +F_TARGET 0.0 + +MAX_BB_EVAL 500 diff --git a/examples/advanced/categorical/batch/readme.txt b/examples/advanced/categorical/batch/readme.txt index 970075c377c7ceb863c6ce801ce3c676d5804c64..d4f9f7021b7cf5f76924d7df9f0fe3a843b43f96 100644 --- a/examples/advanced/categorical/batch/readme.txt +++ b/examples/advanced/categorical/batch/readme.txt @@ -1,33 +1,33 @@ -This example illustrates how to run the batch mode of NOMAD -on a problem with categorical variables. - -In addition to the usual blackbox executable, the user must provide -an executable for the neighborhoods. -This executable takes a point as input and displays a list of neighbors. -The number of variables must remain constant. - -For example: - - neighbors.exe x.txt - - with x.txt containing '0 100 1 100' - - displays: - - '2 100 1 100 - 0 100 2 100' - - (two neighbors). - -To run the example: - -1. compile blackbox executable : g++ -o bb.exe bb.cpp -O3 -2. compile neighbors executable: g++ -o neighbors.exe neighbors.cpp -O3 -3. run nomad: nomad param.txt - -See more details in the NOMAD user guide. - -NOTE: another neighbor executable is given as a python script. -Replace NEIGHBORS_EXE neighbors.exe -with NEIGHBORS_EXE "$python neighbors.py" -in the parameters file to use it. +This example illustrates how to run the batch mode of NOMAD +on a problem with categorical variables. + +In addition to the usual blackbox executable, the user must provide +an executable for the neighborhoods. +This executable takes a point as input and displays a list of neighbors. +The number of variables must remain constant. + +For example: + + neighbors.exe x.txt + + with x.txt containing '0 100 1 100' + + displays: + + '2 100 1 100 + 0 100 2 100' + + (two neighbors). + +To run the example: + +1. compile blackbox executable : g++ -o bb.exe bb.cpp -O3 +2. compile neighbors executable: g++ -o neighbors.exe neighbors.cpp -O3 +3. run nomad: nomad param.txt + +See more details in the NOMAD user guide. + +NOTE: another neighbor executable is given as a python script. +Replace NEIGHBORS_EXE neighbors.exe +with NEIGHBORS_EXE "$python neighbors.py" +in the parameters file to use it. diff --git a/examples/advanced/categorical/batch/runExample.log b/examples/advanced/categorical/batch/runExample.log index 1eb0da5d245be883b19e5aea1b9f8e5517ddf878..78a23386f864877195b42f5ec5b45282300bda00 100644 --- a/examples/advanced/categorical/batch/runExample.log +++ b/examples/advanced/categorical/batch/runExample.log @@ -5,21 +5,22 @@ Warning: { Default anisotropic mesh is disabled with categorical and binary variables. } -NOMAD - version 3.7.3 has been created by { +NOMAD - version 3.8.1 has been created by { Charles Audet - Ecole Polytechnique de Montreal Sebastien Le Digabel - Ecole Polytechnique de Montreal Christophe Tribes - Ecole Polytechnique de Montreal } -The copyright of NOMAD - version 3.7.3 is owned by { +The copyright of NOMAD - version 3.8.1 is owned by { Sebastien Le Digabel - Ecole Polytechnique de Montreal Christophe Tribes - Ecole Polytechnique de Montreal } -NOMAD version 3 is a new version of Nomad v1 and v2, it has been funded by AFOSR and Exxon Mobil. -Nomad v1 and v2 were created and developed by Mark A. Abramson from The Boeing Company, Charles Audet and Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from Rice University, and were funded by AFOSR and Exxon Mobil. +NOMAD v3 has been funded by AFOSR and Exxon Mobil. +NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created +and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. +Dennis Jr., and were funded by AFOSR and Exxon Mobil. -Download : www.gerad.ca/nomad License : '$NOMAD_HOME/src/lgpl.txt' User guide: '$NOMAD_HOME/doc/user_guide.pdf' Examples : '$NOMAD_HOME/examples' @@ -27,58 +28,72 @@ Tools : '$NOMAD_HOME/tools' Please report bugs to nomad@gerad.ca +Seed: 0 + MADS run { BBE ( SOL ) OBJ 1 ( 0 100.0000000000 1 100.0000000000 ) 159.6461296475 - 5+ 2 ( 0 1100.0000000000 2 100.0000000000 ) 152.8902369239 (ExtendedPoll) - 5+ 3 ( 0 4100.0000000000 2 100.0000000000 ) 134.5175377184 (ExtendedPoll) - 5+ 6 ( 0 8100.0000000000 2 1100.0000000000 ) 93.9098509400 (ExtendedPoll) - 5+ 13 ( 0 3600.0000000000 2 4600.0000000000 ) 72.2375927442 (ExtendedPoll) - 5+ 23 ( 0 4600.0000000000 2 4600.0000000000 ) 63.9850651149 (ExtendedPoll) - 5+ 29 ( 0 4100.0000000000 2 5100.0000000000 ) 62.0438640124 (ExtendedPoll) - 41+ 5 ( 0 3975.0000000000 1 5725.0000000000 ) 55.6086573370 (ExtendedPoll) - 66+ 6 ( 2 3881.2500000000 1 5975.0000000000 ) 58.7730353554 (ExtendedPoll) - 85+ 7 ( 0 3943.7500000000 2 5975.0000000000 ) 54.5634971325 (ExtendedPoll) - 110 ( 0 3943.7500000000 1 5975.0000000000 ) 52.5611211856 - 114+ 12 ( 0 3914.4531250000 2 6029.6875000000 ) 54.3636860906 (ExtendedPoll) - 114+ 14 ( 0 3836.3281250000 2 6131.2500000000 ) 54.2565794588 (ExtendedPoll) - 114+ 26 ( 0 3863.6718750000 2 6115.6250000000 ) 54.1218203970 (ExtendedPoll) - 114+ 28 ( 0 3908.5937500000 2 6072.6562500000 ) 54.0518889750 (ExtendedPoll) - 114+ 29 ( 0 4043.3593750000 2 5943.7500000000 ) 53.9097569796 (ExtendedPoll) - 114+ 42 ( 0 4017.9687500000 2 5979.8828125000 ) 53.8237647156 (ExtendedPoll) - 166+ 12 ( 0 3945.7031250000 2 6037.5000000000 ) 53.9997469058 (ExtendedPoll) - 166+ 23 ( 0 3945.2148437500 2 6053.1250000000 ) 53.8701209592 (ExtendedPoll) - 199+ 8 ( 0 4100.0000000000 2 5881.2500000000 ) 53.9564900102 (ExtendedPoll) - 199+ 24 ( 0 4107.8125000000 2 5881.4331054688 ) 53.8832486375 (ExtendedPoll) - 199+ 26 ( 0 4121.8505859375 2 5874.7192382812 ) 53.8169487483 (ExtendedPoll) - 238+ 10 ( 0 4006.2500000000 2 5980.8593750000 ) 53.9245869941 (ExtendedPoll) - 238+ 18 ( 0 4030.6640625000 2 5961.3281250000 ) 53.8703341236 (ExtendedPoll) - 238+ 30 ( 0 4028.8024902344 2 5968.9270019531 ) 53.8199810273 (ExtendedPoll) - 238+ 38 ( 0 4026.6967773438 2 5972.2152709961 ) 53.8103680832 (ExtendedPoll) - 286+ 8 ( 0 4006.2500000000 2 5973.0468750000 ) 53.9937648079 (ExtendedPoll) - 286+ 19 ( 0 4006.3720703125 2 5988.6718750000 ) 53.8544733742 (ExtendedPoll) - 286+ 24 ( 0 4017.6025390625 2 5977.8076171875 ) 53.8455562804 (ExtendedPoll) - 286+ 25 ( 0 4051.2939453125 2 5945.2148437500 ) 53.8230307642 (ExtendedPoll) - 286+ 40 ( 0 4049.3560791016 2 5948.6022949219 ) 53.8105786370 (ExtendedPoll) - 286+ 48 ( 0 4049.1615295410 2 5950.5458831787 ) 53.7949509311 (ExtendedPoll) - 344+ 11 ( 0 4092.1875000000 2 5889.0625000000 ) 53.9562156297 (ExtendedPoll) - 344+ 26 ( 0 4082.9101562500 2 5901.6357421875 ) 53.9261842233 (ExtendedPoll) - 344+ 27 ( 0 4055.0781250000 2 5939.3554687500 ) 53.8406875009 (ExtendedPoll) - 344+ 41 ( 0 4054.7653198242 2 5943.2464599609 ) 53.8085676438 (ExtendedPoll) - 344+ 52 ( 0 4055.7056427002 2 5943.5101509094 ) 53.7974893949 (ExtendedPoll) - 344+ 55 ( 0 4057.1723937988 2 5942.2207832336 ) 53.7955084222 (ExtendedPoll) - 344+ 56 ( 0 4061.5726470947 2 5938.3526802063 ) 53.7896289020 (ExtendedPoll) - 416+ 8 ( 0 4092.1875000000 2 5873.4375000000 ) 54.1002366323 (ExtendedPoll) - 416+24 ( 0 4104.6386718750 2 5891.7480468750 ) 53.8173417481 (ExtendedPoll) - 416+33 ( 0 4111.5356445312 2 5888.0859375000 ) 53.7878645675 (ExtendedPoll) - 416+47 ( 0 4112.3014450073 2 5887.4798774719 ) 53.7864363345 (ExtendedPoll) - 475 ( 0 4004.2968750000 1 5986.7187500000 ) 51.9855654455 - 481+19 ( 0 3994.9005859375 2 5999.2932421875 ) 53.8684879252 (ExtendedPoll) - 500 ( 0 4004.2968750000 1 5986.7187500000 ) 51.9855654455 + 3 ( 0 1100.0000000000 1 1100.0000000000 ) 138.9085806533 + 4 ( 0 4100.0000000000 1 4100.0000000000 ) 76.9342961094 + 9 ( 2 4100.0000000000 1 4100.0000000000 ) 71.5898013935 + 11 ( 2 3100.0000000000 1 6100.0000000000 ) 59.7422200860 + 16 ( 0 3100.0000000000 1 6100.0000000000 ) 57.0646794705 + 24 ( 2 2750.0000000000 1 6600.0000000000 ) 57.8763193873 (ExtendedPoll#2) + 25 ( 2 1700.0000000000 1 8100.0000000000 ) 53.6053670812 (ExtendedPoll#2) + 34 ( 2 1510.0000000000 1 8300.0000000000 ) 53.3333168676 (ExtendedPoll#2) + 35 ( 2 940.0000000000 1 8900.0000000000 ) 52.7436128628 (ExtendedPoll#2) + 43 ( 2 1140.0000000000 1 8820.0000000000 ) 52.3755732678 (ExtendedPoll#2) + 57 ( 2 1160.0000000000 1 8820.3000000000 ) 52.3132227961 (ExtendedPoll#2) + 65 ( 2 1150.1000000000 1 8830.3000000000 ) 52.3052571441 (ExtendedPoll#2) + 66 ( 2 1120.4000000000 1 8860.3000000000 ) 52.2819610879 (ExtendedPoll#2) + 67 ( 2 1001.6000000000 1 8980.3000000000 ) 52.1977782384 (ExtendedPoll#2) + 68 ( 2 526.4000000000 1 9460.3000000000 ) 52.0042958291 (ExtendedPoll#2) + 82 ( 2 536.4000000000 1 9451.3000000000 ) 52.0017022122 (ExtendedPoll#2) + 83 ( 2 566.4000000000 1 9424.3000000000 ) 51.9945888409 (ExtendedPoll#2) + 95 ( 2 561.7830000000 1 9429.3000000000 ) 51.9923249640 (ExtendedPoll#2) + 96 ( 2 547.9320000000 1 9444.3000000000 ) 51.9856595521 (ExtendedPoll#2) + 97 ( 2 492.5280000000 1 9504.3000000000 ) 51.9608886236 (ExtendedPoll#2) + 116 ( 2 494.0160000000 1 9504.8120000000 ) 51.9532484770 (ExtendedPoll#2) + 119 ( 2 496.0160000000 1 9503.7280000000 ) 51.9498881495 (ExtendedPoll#2) + 134 ( 2 495.9102800000 1 9503.9280000000 ) 51.9495112649 (ExtendedPoll#2) + 136 ( 2 495.5300800000 1 9504.4280000000 ) 51.9490076572 (ExtendedPoll#2) + 150 ( 2 495.4800800000 1 9504.4769122000 ) 51.9490068534 (ExtendedPoll#2) + 151 ( 2 495.3300800000 1 9504.6236488000 ) 51.9490044573 (ExtendedPoll#2) + 152 ( 2 494.7300800000 1 9505.2105952000 ) 51.9489951037 (ExtendedPoll#2) + 153 ( 2 492.3300800000 1 9507.5583808000 ) 51.9489613784 (ExtendedPoll#2) + 154 ( 2 482.7300800000 1 9516.9495232000 ) 51.9488854987 (ExtendedPoll#2) + 164 ( 2 483.3753000000 1 9516.5947532000 ) 51.9478129130 (ExtendedPoll#2) + 172 ( 2 483.5753000000 1 9516.4235132000 ) 51.9477187970 (ExtendedPoll#2) + 198 ( 2 483.5763000000 1 9516.4234955670 ) 51.9477150667 (ExtendedPoll#2) + 212 ( 2 483.5764000000 1 9516.4235948416 ) 51.9477143009 (ExtendedPoll#2) + 234 ( 2 483.5764014262 1 9516.4235974154 ) 51.9477142855 (ExtendedPoll#2) + 245 ( 2 483.5764015171 1 9516.4235979154 ) 51.9477142832 (ExtendedPoll#2) + 248 ( 2 483.5764006485 1 9516.4235989154 ) 51.9477142826 (ExtendedPoll#2) + 249 ( 2 483.5763980425 1 9516.4236019154 ) 51.9477142808 (ExtendedPoll#2) + 272 ( 2 483.5763980625 1 9516.4236019140 ) 51.9477142808 (ExtendedPoll#2) + 277 ( 2 483.5763980825 1 9516.4236018977 ) 51.9477142808 (ExtendedPoll#2) + 278 ( 2 483.5763981425 1 9516.4236018488 ) 51.9477142807 (ExtendedPoll#2) + 289 ( 2 483.5763981400 1 9516.4236018588 ) 51.9477142807 (ExtendedPoll#2) + 306 ( 2 483.5763981402 1 9516.4236018593 ) 51.9477142807 (ExtendedPoll#2) + 314 ( 2 483.5763981402 1 9516.4236018595 ) 51.9477142807 (ExtendedPoll#2) + 319 ( 2 483.5763981404 1 9516.4236018595 ) 51.9477142807 (ExtendedPoll#2) + 331 ( 2 483.5763981404 1 9516.4236018595 ) 51.9477142807 (ExtendedPoll#2) + 341 ( 2 483.5763981404 1 9516.4236018596 ) 51.9477142807 (ExtendedPoll#2) + 346 ( 2 483.5763981404 1 9516.4236018596 ) 51.9477142807 (ExtendedPoll#2) + 347 ( 2 483.5763981404 1 9516.4236018596 ) 51.9477142807 (ExtendedPoll#2) + 375 ( 0 483.5760000000 1 9516.4200000000 ) 48.9166183112 + 425 ( 2 483.5860000000 1 9516.4138032000 ) 51.9477158960 (ExtendedPoll#4) + 445 ( 2 483.5859584813 1 9516.4140032000 ) 51.9477152763 (ExtendedPoll#4) + 462 ( 2 483.5859684813 1 9516.4140002255 ) 51.9477152498 (ExtendedPoll#4) + 463 ( 2 483.5859984813 1 9516.4139913022 ) 51.9477151706 (ExtendedPoll#4) + 468 ( 2 483.5860184813 1 9516.4139807162 ) 51.9477151357 (ExtendedPoll#4) + 482 ( 2 483.5860204813 1 9516.4139791329 ) 51.9477151343 (ExtendedPoll#4) + 497 ( 2 483.5860205245 1 9516.4139793329 ) 51.9477151333 (ExtendedPoll#4) + 500 ( 0 483.5760000000 1 9516.4200000000 ) 48.9166183112 } end of run (max number of blackbox evaluations) blackbox evaluations : 500 -best feasible solution : ( 0 4004.296875 1 5986.71875 ) h=0 f=51.98556545 +best feasible solution : ( 0 483.576 1 9516.42 ) h=0 f=48.91661831 diff --git a/examples/advanced/categorical/bi_obj/makefile b/examples/advanced/categorical/bi_obj/makefile index 89f48dd249cced0f4354b0aa57ec8b1e7644a87e..033d2b6ce521df0967246ac911e4834c74fc582a 100644 --- a/examples/advanced/categorical/bi_obj/makefile +++ b/examples/advanced/categorical/bi_obj/makefile @@ -25,7 +25,7 @@ CXXFLAGS_MPI = $(CXXFLAGS) -DUSE_MPI LDLIBS = -lm -lnomad LDLIBS_MPI = -lm -lmpi -lnomad.MPI -INCLUDE = -I$(NOMAD_HOME)/src -I. +INCLUDE = -I$(NOMAD_HOME)/src -I$(NOMAD_HOME)/ext/sgtelib/src -I. COMPILE = $(COMPILATOR) $(COMPILATOR_OPTIONS) $(INCLUDE) -c COMPILE_MPI = $(COMPILATOR_MPI) $(COMPILATOR_OPTIONS_MPI) $(INCLUDE) -c diff --git a/examples/advanced/categorical/bi_obj/runExample.log b/examples/advanced/categorical/bi_obj/runExample.log index fb0204896a0c6e018c6d94c8bf2d60f2a52552cd..87a8bebe60822cfabbe9aac9659d9c3bc0e71890 100644 --- a/examples/advanced/categorical/bi_obj/runExample.log +++ b/examples/advanced/categorical/bi_obj/runExample.log @@ -7,52 +7,49 @@ Warning: { multi-MADS run { - MADS run 1/30 ...... OK [bb eval= 60] [overall bb eval= 60] [# dominant pts= 6] [# new pts= 6] [f1=52.02241823 f2=52.95541823] - MADS run 2/30 ...... OK [bb eval= 74] [overall bb eval= 134] [# dominant pts= 6] [# new pts= 0] [f1=52.02241826 f2=51.05441826] - MADS run 3/30 ...... OK [bb eval= 58] [overall bb eval= 192] [# dominant pts= 7] [# new pts= 1] [f1=52.02241823 f2=51.45041823] - MADS run 4/30 ...... OK [bb eval= 68] [overall bb eval= 260] [# dominant pts= 6] [# new pts= -1] [f1=52.02241823 f2=51.51641823] - MADS run 5/30 ...... OK [bb eval= 54] [overall bb eval= 314] [# dominant pts= 7] [# new pts= 1] [f1=52.02241823 f2=51.41441823] - MADS run 6/30 ...... OK [bb eval= 0] [overall bb eval= 314] [# dominant pts= 7] [# new pts= 0] [f1=52.02241823 f2=51.51641823] - MADS run 7/30 ...... OK [bb eval= 0] [overall bb eval= 314] [# dominant pts= 7] [# new pts= 0] [f1=52.02241823 f2=51.41441823] - MADS run 8/30 ...... OK [bb eval= 0] [overall bb eval= 314] [# dominant pts= 7] [# new pts= 0] [f1=52.02241823 f2=51.51641823] - MADS run 9/30 ...... OK [bb eval= 0] [overall bb eval= 314] [# dominant pts= 7] [# new pts= 0] [f1=52.02241823 f2=51.41441823] - MADS run 10/30 ...... OK [bb eval= 0] [overall bb eval= 314] [# dominant pts= 7] [# new pts= 0] [f1=52.02241823 f2=51.51641823] - MADS run 11/30 ...... OK [bb eval= 0] [overall bb eval= 314] [# dominant pts= 7] [# new pts= 0] [f1=52.02241823 f2=51.41441823] - MADS run 12/30 ...... OK [bb eval= 0] [overall bb eval= 314] [# dominant pts= 7] [# new pts= 0] [f1=52.02241823 f2=51.51641823] - MADS run 13/30 ...... OK [bb eval= 0] [overall bb eval= 314] [# dominant pts= 7] [# new pts= 0] [f1=52.02241823 f2=51.41441823] - MADS run 14/30 ...... OK [bb eval= 49] [overall bb eval= 363] [# dominant pts= 7] [# new pts= 0] [f1=52.02241823 f2=51.25241823] - MADS run 15/30 ...... OK [bb eval= 57] [overall bb eval= 420] [# dominant pts= 7] [# new pts= 0] [f1=52.02241823 f2=51.06141823] - MADS run 16/30 ...... OK [bb eval= 50] [overall bb eval= 470] [# dominant pts= 7] [# new pts= 0] [f1=52.02241823 f2=51.22141823] - MADS run 17/30 ...... OK [bb eval= 0] [overall bb eval= 470] [# dominant pts= 7] [# new pts= 0] [f1=52.02241823 f2=51.51641823] - MADS run 18/30 ...... OK [bb eval= 0] [overall bb eval= 470] [# dominant pts= 7] [# new pts= 0] [f1=52.02241823 f2=51.41441823] - MADS run 19/30 ...... OK [bb eval= 0] [overall bb eval= 470] [# dominant pts= 7] [# new pts= 0] [f1=52.02241823 f2=51.25241823] - MADS run 20/30 ...... OK [bb eval= 0] [overall bb eval= 470] [# dominant pts= 7] [# new pts= 0] [f1=52.02241823 f2=51.51641823] - MADS run 21/30 ...... OK [bb eval= 0] [overall bb eval= 470] [# dominant pts= 7] [# new pts= 0] [f1=52.02241823 f2=51.41441823] - MADS run 22/30 ...... OK [bb eval= 0] [overall bb eval= 470] [# dominant pts= 7] [# new pts= 0] [f1=52.02241823 f2=51.06141823] - MADS run 23/30 ...... OK [bb eval= 0] [overall bb eval= 470] [# dominant pts= 7] [# new pts= 0] [f1=52.02241823 f2=51.22141823] - MADS run 24/30 ...... OK [bb eval= 0] [overall bb eval= 470] [# dominant pts= 7] [# new pts= 0] [f1=52.02241823 f2=51.25241823] - MADS run 25/30 ...... OK [bb eval= 0] [overall bb eval= 470] [# dominant pts= 7] [# new pts= 0] [f1=52.02241823 f2=51.51641823] - MADS run 26/30 ...... OK [bb eval= 0] [overall bb eval= 470] [# dominant pts= 7] [# new pts= 0] [f1=52.02241823 f2=51.41441823] - MADS run 27/30 ...... OK [bb eval= 0] [overall bb eval= 470] [# dominant pts= 7] [# new pts= 0] [f1=52.02241823 f2=51.06141823] - MADS run 28/30 ...... OK [bb eval= 0] [overall bb eval= 470] [# dominant pts= 7] [# new pts= 0] [f1=52.02241823 f2=51.22141823] - MADS run 29/30 ...... OK [bb eval= 0] [overall bb eval= 470] [# dominant pts= 7] [# new pts= 0] [f1=52.02241823 f2=51.51641823] - MADS run 30/30 ...... OK [bb eval= 0] [overall bb eval= 470] [# dominant pts= 7] [# new pts= 0] [f1=52.02241823 f2=51.25241823] + MADS run 1/30 ...... OK [bb eval= 59] [overall bb eval= 59] [# dominant pts= 4] [# new pts= 4] [f1=52.02241823 f2=51.86541823] + MADS run 2/30 ...... OK [bb eval= 73] [overall bb eval= 132] [# dominant pts= 4] [# new pts= 0] [f1=52.02241825 f2=51.05441825] + MADS run 3/30 ...... OK [bb eval= 75] [overall bb eval= 207] [# dominant pts= 5] [# new pts= 1] [f1=52.02241823 f2=51.10341823] + MADS run 4/30 ...... OK [bb eval= 9] [overall bb eval= 216] [# dominant pts= 4] [# new pts= -1] [f1=52.02241823 f2=51.25241823] + MADS run 5/30 ...... OK [bb eval= 0] [overall bb eval= 216] [# dominant pts= 4] [# new pts= 0] [f1=52.02241823 f2=51.25241823] + MADS run 6/30 ...... OK [bb eval= 57] [overall bb eval= 273] [# dominant pts= 4] [# new pts= 0] [f1=52.02241823 f2=51.08641823] + MADS run 7/30 ...... OK [bb eval= 0] [overall bb eval= 273] [# dominant pts= 4] [# new pts= 0] [f1=52.02241823 f2=51.25241823] + MADS run 8/30 ...... OK [bb eval= 0] [overall bb eval= 273] [# dominant pts= 4] [# new pts= 0] [f1=52.02241823 f2=51.25241823] + MADS run 9/30 ...... OK [bb eval= 0] [overall bb eval= 273] [# dominant pts= 4] [# new pts= 0] [f1=52.02241823 f2=51.08641823] + MADS run 10/30 ...... OK [bb eval= 0] [overall bb eval= 273] [# dominant pts= 4] [# new pts= 0] [f1=52.02241823 f2=51.25241823] + MADS run 11/30 ...... OK [bb eval= 0] [overall bb eval= 273] [# dominant pts= 4] [# new pts= 0] [f1=52.02241823 f2=51.08641823] + MADS run 12/30 ...... OK [bb eval= 0] [overall bb eval= 273] [# dominant pts= 4] [# new pts= 0] [f1=52.02241823 f2=51.25241823] + MADS run 13/30 ...... OK [bb eval= 0] [overall bb eval= 273] [# dominant pts= 4] [# new pts= 0] [f1=52.02241823 f2=51.08641823] + MADS run 14/30 ...... OK [bb eval= 0] [overall bb eval= 273] [# dominant pts= 4] [# new pts= 0] [f1=52.02241823 f2=51.25241823] + MADS run 15/30 ...... OK [bb eval= 0] [overall bb eval= 273] [# dominant pts= 4] [# new pts= 0] [f1=52.02241823 f2=51.08641823] + MADS run 16/30 ...... OK [bb eval= 0] [overall bb eval= 273] [# dominant pts= 4] [# new pts= 0] [f1=52.02241823 f2=51.25241823] + MADS run 17/30 ...... OK [bb eval= 0] [overall bb eval= 273] [# dominant pts= 4] [# new pts= 0] [f1=52.02241823 f2=51.08641823] + MADS run 18/30 ...... OK [bb eval= 0] [overall bb eval= 273] [# dominant pts= 4] [# new pts= 0] [f1=52.02241823 f2=51.25241823] + MADS run 19/30 ...... OK [bb eval= 0] [overall bb eval= 273] [# dominant pts= 4] [# new pts= 0] [f1=52.02241823 f2=51.08641823] + MADS run 20/30 ...... OK [bb eval= 0] [overall bb eval= 273] [# dominant pts= 4] [# new pts= 0] [f1=52.02241823 f2=51.25241823] + MADS run 21/30 ...... OK [bb eval= 0] [overall bb eval= 273] [# dominant pts= 4] [# new pts= 0] [f1=52.02241823 f2=51.08641823] + MADS run 22/30 ...... OK [bb eval= 0] [overall bb eval= 273] [# dominant pts= 4] [# new pts= 0] [f1=52.02241823 f2=51.25241823] + MADS run 23/30 ...... OK [bb eval= 0] [overall bb eval= 273] [# dominant pts= 4] [# new pts= 0] [f1=52.02241823 f2=51.08641823] + MADS run 24/30 ...... OK [bb eval= 0] [overall bb eval= 273] [# dominant pts= 4] [# new pts= 0] [f1=52.02241823 f2=51.25241823] + MADS run 25/30 ...... OK [bb eval= 0] [overall bb eval= 273] [# dominant pts= 4] [# new pts= 0] [f1=52.02241823 f2=51.08641823] + MADS run 26/30 ...... OK [bb eval= 0] [overall bb eval= 273] [# dominant pts= 4] [# new pts= 0] [f1=52.02241823 f2=51.25241823] + MADS run 27/30 ...... OK [bb eval= 0] [overall bb eval= 273] [# dominant pts= 4] [# new pts= 0] [f1=52.02241823 f2=51.08641823] + MADS run 28/30 ...... OK [bb eval= 0] [overall bb eval= 273] [# dominant pts= 4] [# new pts= 0] [f1=52.02241823 f2=51.25241823] + MADS run 29/30 ...... OK [bb eval= 0] [overall bb eval= 273] [# dominant pts= 4] [# new pts= 0] [f1=52.02241823 f2=51.08641823] + MADS run 30/30 ...... OK [bb eval= 0] [overall bb eval= 273] [# dominant pts= 4] [# new pts= 0] [f1=52.02241823 f2=51.25241823] } end of run (max number of MADS runs) -blackbox evaluations : 470 +blackbox evaluations : 273 number of MADS runs : 30 Pareto front { - 52.0224182340 52.9554182340 - 52.0224182340 52.5564182340 - 52.0224182340 51.4504182340 + 52.0224182340 51.8654182340 52.0224182340 51.2524182340 - 52.0224182340 51.2214182340 - 52.0224182340 51.0614182340 - 52.0224182340 51.0254182340 + 52.0224182340 51.0864182340 + 52.0224182491 51.0544182491 } -number of Pareto points: 7 +number of Pareto points: 4 diff --git a/examples/advanced/categorical/single_obj/makefile b/examples/advanced/categorical/single_obj/makefile index 89f48dd249cced0f4354b0aa57ec8b1e7644a87e..033d2b6ce521df0967246ac911e4834c74fc582a 100644 --- a/examples/advanced/categorical/single_obj/makefile +++ b/examples/advanced/categorical/single_obj/makefile @@ -25,7 +25,7 @@ CXXFLAGS_MPI = $(CXXFLAGS) -DUSE_MPI LDLIBS = -lm -lnomad LDLIBS_MPI = -lm -lmpi -lnomad.MPI -INCLUDE = -I$(NOMAD_HOME)/src -I. +INCLUDE = -I$(NOMAD_HOME)/src -I$(NOMAD_HOME)/ext/sgtelib/src -I. COMPILE = $(COMPILATOR) $(COMPILATOR_OPTIONS) $(INCLUDE) -c COMPILE_MPI = $(COMPILATOR_MPI) $(COMPILATOR_OPTIONS_MPI) $(INCLUDE) -c diff --git a/examples/advanced/categorical/single_obj/runExample.log b/examples/advanced/categorical/single_obj/runExample.log index 270473f5c679680fa6abeef93990291fa60a572a..e7fe77e856f058b976075c3702a60e456948a47b 100644 --- a/examples/advanced/categorical/single_obj/runExample.log +++ b/examples/advanced/categorical/single_obj/runExample.log @@ -10,2192 +10,2192 @@ MADS run { BBE ( SOL ) OBJ 1 ( 1 0 100.0000000000 ) 160.6247422680 - 2 ( 1 0 1254.7005383793 ) 153.5536894866 - 3 ( 1 0 4718.8021535170 ) 132.3405311424 + 2 ( 1 0 1100.0000000000 ) 154.5010309278 + 3 ( 1 0 4100.0000000000 ) 136.1298969072 4 ( 1 0 10000.0000000000 ) 100.0000000000 - 6 ( 2 0 5000.0000000000 1 5000.0000000000 ) 58.5324359492 - 9 ( 2 0 5000.0000000000 2 5000.0000000000 ) 55.9016994375 - 13 ( 3 0 3333.3333333333 2 3333.3333333333 1 3333.3333333333 ) 47.1682905221 - 25+1 ( 2 0 4664.5898033750 2 5335.4101966250 ) 54.6460175208 (ExtendedPoll) - 25+2 ( 2 0 3658.3592135001 2 6341.6407864999 ) 54.3665216385 (ExtendedPoll) - 36+5 ( 2 0 4853.2580389766 2 5104.8156864453 ) 55.7859562011 (ExtendedPoll) - 46+6 ( 2 0 4952.8329410996 2 5040.1793464707 ) 55.7796437455 (ExtendedPoll) - 46+7 ( 2 0 4811.3317643985 2 5160.7173858828 ) 55.4595714411 (ExtendedPoll) - 46+8 ( 2 0 4245.3270575938 2 5642.8695435312 ) 54.9467100128 (ExtendedPoll) - 46+14 ( 2 0 4217.3762078751 2 5761.6606548359 ) 54.0237235981 (ExtendedPoll) - 68+2 ( 2 0 4105.5728090001 2 5894.4271909999 ) 53.7841727607 (ExtendedPoll) - 83+6 ( 2 0 4077.6219592813 2 5838.5254915624 ) 54.5583352238 (ExtendedPoll) - 83+13 ( 2 0 4079.3688873888 2 5901.4149034296 ) 53.9607874220 (ExtendedPoll) - 83+17 ( 2 0 4048.3609134820 2 5933.2963413900 ) 53.9575135294 (ExtendedPoll) - 83+20 ( 2 0 4114.7441815640 2 5872.1538576303 ) 53.9056113440 (ExtendedPoll) - 83+26 ( 2 0 4103.7166978859 2 5883.2905243151 ) 53.9036253851 (ExtendedPoll) - 83+27 ( 2 0 4070.6342468517 2 5916.7005243695 ) 53.9019093307 (ExtendedPoll) - 83+33 ( 2 0 4066.9220246234 2 5931.8769623028 ) 53.7986288783 (ExtendedPoll) - 135+3 ( 2 0 4552.7864045000 2 5447.2135955000 ) 54.3435557967 (ExtendedPoll) - 135+17 ( 2 0 4547.0542966476 2 5452.5362670773 ) 54.3341271736 (ExtendedPoll) - 135+18 ( 2 0 4529.8579730901 2 5468.5042818092 ) 54.3067391679 (ExtendedPoll) - 135+19 ( 2 0 4461.0726788604 2 5532.3763407368 ) 54.2108013388 (ExtendedPoll) - 135+20 ( 2 0 4185.9315019415 2 5787.8645764472 ) 54.0536810905 (ExtendedPoll) - 135+24 ( 2 0 4166.7152927598 2 5812.7583019780 ) 53.9898429352 (ExtendedPoll) - 135+25 ( 2 0 4109.0666652149 2 5887.4394785702 ) 53.8164151300 (ExtendedPoll) - 135+30 ( 2 0 4087.2300638722 2 5910.1495439667 ) 53.8086966314 (ExtendedPoll) - 135+31 ( 2 0 4021.7202598438 2 5978.2797401562 ) 53.8029621572 (ExtendedPoll) - 178+9 ( 2 0 4997.1817136392 2 5002.7091033541 ) 55.8904416155 (ExtendedPoll) - 178+10 ( 2 0 4988.7268545568 2 5010.8364134164 ) 55.8568544583 (ExtendedPoll) - 178+11 ( 2 0 4954.9074182272 2 5043.3456536654 ) 55.7253209743 (ExtendedPoll) - 178+12 ( 2 0 4819.6296729087 2 5173.3826146616 ) 55.2455191020 (ExtendedPoll) - 178+13 ( 2 0 4278.5186916348 2 5693.5304586464 ) 54.1478187840 (ExtendedPoll) - 178+17 ( 2 0 4250.5678419161 2 5749.4321580839 ) 53.8463541922 (ExtendedPoll) - 209+11 ( 2 0 4991.4018382213 2 5006.9604166780 ) 55.8833196229 (ExtendedPoll) - 209+12 ( 2 0 4965.6073528851 2 5027.8416667120 ) 55.8295760866 (ExtendedPoll) - 209+13 ( 2 0 4862.4294115405 2 5111.3666668481 ) 55.6359728814 (ExtendedPoll) - 209+14 ( 2 0 4449.7176461622 2 5445.4666673925 ) 55.2305749540 (ExtendedPoll) - 209+18 ( 2 0 4416.5260121211 2 5499.6214387226 ) 54.9360602700 (ExtendedPoll) - 209+19 ( 2 0 4316.9511099981 2 5662.0857527128 ) 54.1235694449 (ExtendedPoll) - 209+21 ( 2 0 4226.1108484122 2 5745.9383018691 ) 54.0981732449 (ExtendedPoll) - 209+28 ( 2 0 4295.9879727091 2 5690.0366024316 ) 54.0285296848 (ExtendedPoll) - 209+39 ( 2 0 4295.1963959104 2 5693.8580076666 ) 53.9975464791 (ExtendedPoll) - 209+40 ( 2 0 4292.8216655143 2 5705.3222233715 ) 53.9048916226 (ExtendedPoll) - 258+8 ( 2 0 4991.6202042347 2 5007.1787826914 ) 55.8789766881 (ExtendedPoll) - 258+9 ( 2 0 4966.4808169388 2 5028.7151307657 ) 55.8122316385 (ExtendedPoll) - 258+10 ( 2 0 4865.9232677554 2 5114.8605230630 ) 55.5670382161 (ExtendedPoll) - 258+11 ( 2 0 4463.6930710215 2 5459.4420922519 ) 54.9622403869 (ExtendedPoll) - 258+15 ( 2 0 4465.4399991290 2 5522.3315041191 ) 54.2792880205 (ExtendedPoll) - 258+22 ( 2 0 4465.8494354041 2 5530.1380890991 ) 54.1936457881 (ExtendedPoll) - 258+25 ( 2 0 4460.3083978134 2 5535.6518309382 ) 54.1829242335 (ExtendedPoll) - 258+26 ( 2 0 4443.6852850412 2 5552.1930564553 ) 54.1517073596 (ExtendedPoll) - 258+27 ( 2 0 4377.1928339525 2 5618.3579585239 ) 54.0411998177 (ExtendedPoll) - 258+28 ( 2 0 4111.2230295975 2 5883.0175667983 ) 53.8374230147 (ExtendedPoll) - 258+38 ( 2 0 4118.0196717655 2 5879.1961615633 ) 53.8105466009 (ExtendedPoll) - 258+41 ( 2 0 4124.3795819065 2 5874.6650667847 ) 53.7943634220 (ExtendedPoll) - 258+50 ( 2 0 4124.8617357702 2 5874.5877643630 ) 53.7906784892 (ExtendedPoll) - 258+51 ( 2 0 4125.6516065844 2 5874.0132740894 ) 53.7887889498 (ExtendedPoll) - 258+53 ( 2 0 4123.8654408339 2 5876.1201649220 ) 53.7855913617 (ExtendedPoll) - 345+4 ( 2 0 4926.6290194883 2 5050.6609151152 ) 55.8573545355 (ExtendedPoll) - 345+5 ( 2 0 4706.5160779532 2 5202.6436604609 ) 55.8124774768 (ExtendedPoll) - 345+9 ( 2 0 4650.6143785157 2 5314.4470593359 ) 54.9951723917 (ExtendedPoll) - 345+18 ( 2 0 4648.1031693612 2 5329.8418632826 ) 54.8434056052 (ExtendedPoll) - 345+21 ( 2 0 4663.2796072945 2 5326.0204580476 ) 54.7617474708 (ExtendedPoll) - 345+24 ( 2 0 4676.3815681001 2 5317.5041835239 ) 54.7500380050 (ExtendedPoll) - 345+31 ( 2 0 4680.0460227630 2 5316.1598677537 ) 54.7351963289 (ExtendedPoll) - 345+34 ( 2 0 4683.8264843704 2 5315.1840446312 ) 54.7152907223 (ExtendedPoll) - 345+39 ( 2 0 4684.6722261763 2 5314.6957065739 ) 54.7138745538 (ExtendedPoll) - 345+42 ( 2 0 4683.5902055200 2 5315.5546697595 ) 54.7130556687 (ExtendedPoll) - 345+43 ( 2 0 4680.3441435508 2 5318.1315593164 ) 54.7106238781 (ExtendedPoll) - 345+44 ( 2 0 4667.3598956743 2 5328.4391175440 ) 54.7012704968 (ExtendedPoll) - 345+45 ( 2 0 4615.4229041681 2 5369.6693504543 ) 54.6698883036 (ExtendedPoll) - 345+46 ( 2 0 4407.6749381433 2 5534.5902820956 ) 54.6440687766 (ExtendedPoll) - 345+48 ( 2 0 4390.6423890959 2 5560.7942037069 ) 54.5173881146 (ExtendedPoll) - 345+49 ( 2 0 4339.5447419538 2 5639.4059685409 ) 54.1546080629 (ExtendedPoll) - 345+53 ( 2 0 4329.0631733093 2 5668.6670143402 ) 53.9515249195 (ExtendedPoll) - 345+60 ( 2 0 4327.2889494502 2 5672.1472226792 ) 53.9321944673 (ExtendedPoll) - 345+66 ( 2 0 4327.7553229574 2 5672.0024272464 ) 53.9295614439 (ExtendedPoll) - 345+67 ( 2 0 4328.5409288104 2 5671.4219660272 ) 53.9284968785 (ExtendedPoll) - 345+75 ( 2 0 4328.4706502466 2 5671.5217727832 ) 53.9281125932 (ExtendedPoll) - 425+16 ( 2 0 4999.6291616237 2 5000.3176329854 ) 55.9006895585 (ExtendedPoll) - 425+17 ( 2 0 4998.5166464947 2 5001.2705319414 ) 55.8976626910 (ExtendedPoll) - 425+18 ( 2 0 4994.0665859789 2 5005.0821277656 ) 55.8855968012 (ExtendedPoll) - 425+19 ( 2 0 4976.2663439156 2 5020.3285110625 ) 55.8380009177 (ExtendedPoll) - 425+20 ( 2 0 4905.0653756623 2 5081.3140442501 ) 55.6584535115 (ExtendedPoll) - 425+21 ( 2 0 4620.2615026492 2 5325.2561770006 ) 55.1234133107 (ExtendedPoll) - 425+24 ( 2 0 4630.7430712937 2 5354.9539548267 ) 54.7064652424 (ExtendedPoll) - 425+27 ( 2 0 4621.4625157231 2 5367.5100005988 ) 54.6438867561 (ExtendedPoll) - 425+28 ( 2 0 4593.6208490110 2 5405.1781379151 ) 54.4600465872 (ExtendedPoll) - 425+29 ( 2 0 4549.9476463255 2 5448.8513406007 ) 54.3496410161 (ExtendedPoll) - 425+30 ( 2 0 4418.9280382689 2 5579.8709486573 ) 54.0763891883 (ExtendedPoll) - 425+31 ( 2 0 3894.8496060423 2 6103.9493808838 ) 53.9197049939 (ExtendedPoll) - 425+44 ( 2 0 3903.2294018076 2 6096.7705981924 ) 53.8996693169 (ExtendedPoll) - 425+51 ( 2 0 3903.5746504167 2 6096.4253495832 ) 53.8992666551 (ExtendedPoll) - 425+52 ( 2 0 3904.6103962441 2 6095.3896037559 ) 53.8980629375 (ExtendedPoll) - 425+53 ( 2 0 3908.7533795536 2 6091.2466204464 ) 53.8933120622 (ExtendedPoll) - 425+54 ( 2 0 3925.3253127913 2 6074.6746872087 ) 53.8753312613 (ExtendedPoll) - 425+55 ( 2 0 3991.6130457425 2 6008.3869542575 ) 53.8196897705 (ExtendedPoll) - 525+3 ( 2 0 4720.4915028125 2 5223.6067977500 ) 55.4583179735 (ExtendedPoll) - 525+4 ( 2 0 4385.0813061876 2 5559.0169943749 ) 54.5837536207 (ExtendedPoll) - 525+15 ( 2 0 4367.6120251133 2 5584.7841839594 ) 54.4682528290 (ExtendedPoll) - 525+16 ( 2 0 4315.2041818907 2 5662.0857527128 ) 54.1388753912 (ExtendedPoll) - 525+18 ( 2 0 4283.7594759571 2 5716.2405240429 ) 53.8770977719 (ExtendedPoll) - 566+16 ( 2 0 3661.9622527217 2 6337.4508886172 ) 54.3613643939 (ExtendedPoll) - 566+17 ( 2 0 3672.7713703864 2 6324.8811949693 ) 54.3464807033 (ExtendedPoll) - 566+18 ( 2 0 3716.0078410450 2 6274.6024203776 ) 54.2957519362 (ExtendedPoll) - 566+19 ( 2 0 3888.9537236798 2 6073.4873220106 ) 54.2325516547 (ExtendedPoll) - 566+23 ( 2 0 3910.7903250226 2 6051.2139886410 ) 54.2135842543 (ExtendedPoll) - 566+24 ( 2 0 3976.3001290509 2 5984.3939885321 ) 54.1740869612 (ExtendedPoll) - 566+28 ( 2 0 4033.9487565958 2 5959.9369950282 ) 53.8521950489 (ExtendedPoll) - 566+34 ( 2 0 4047.3782664216 2 5951.9666355381 ) 53.7987546224 (ExtendedPoll) - 566+46 ( 2 0 4047.6136123118 2 5951.9017281599 ) 53.7971533414 (ExtendedPoll) - 566+50 ( 2 0 4047.8134790560 2 5952.0419387593 ) 53.7940433602 (ExtendedPoll) - 566+52 ( 2 0 4047.6531698269 2 5952.2260518031 ) 53.7938806683 (ExtendedPoll) - 566+53 ( 2 0 4047.1722421396 2 5952.7783909345 ) 53.7933936767 (ExtendedPoll) - 566+59 ( 2 0 4047.2240480902 2 5952.7461205054 ) 53.7932021747 (ExtendedPoll) - 566+64 ( 2 0 4047.2545309008 2 5952.7446673365 ) 53.7929324376 (ExtendedPoll) - 638+17 ( 2 0 4999.9134679357 2 5000.0860989042 ) 55.9013177479 (ExtendedPoll) - 638+18 ( 2 0 4999.6538717426 2 5000.3443956169 ) 55.9001728626 (ExtendedPoll) - 638+19 ( 2 0 4998.6154869705 2 5001.3775824675 ) 55.8955960762 (ExtendedPoll) - 638+20 ( 2 0 4994.4619478821 2 5005.5103298701 ) 55.8773330446 (ExtendedPoll) - 638+21 ( 2 0 4977.8477915284 2 5022.0413194804 ) 55.8049893023 (ExtendedPoll) - 638+22 ( 2 0 4911.3911661138 2 5088.1652779214 ) 55.5271121019 (ExtendedPoll) - 638+23 ( 2 0 4645.5646644551 2 5352.6611116858 ) 54.6099568042 (ExtendedPoll) - 638+29 ( 2 0 4643.1899340591 2 5355.7660034392 ) 54.5949958366 (ExtendedPoll) - 638+37 ( 2 0 4643.2514561244 2 5356.2503964074 ) 54.5891116760 (ExtendedPoll) - 638+39 ( 2 0 4642.9300912980 2 5356.6179294388 ) 54.5876751049 (ExtendedPoll) - 638+40 ( 2 0 4641.9659968188 2 5357.7205285330 ) 54.5833690042 (ExtendedPoll) - 638+41 ( 2 0 4640.6472708158 2 5359.1620854185 ) 54.5782267385 (ExtendedPoll) - 638+46 ( 2 0 4639.9154034740 2 5359.8086535364 ) 54.5770790094 (ExtendedPoll) - 638+47 ( 2 0 4637.7198014483 2 5361.7483578901 ) 54.5736490458 (ExtendedPoll) - 638+48 ( 2 0 4628.9373933458 2 5369.5071753047 ) 54.5601278395 (ExtendedPoll) - 638+49 ( 2 0 4593.8077609356 2 5400.5424449631 ) 54.5092397286 (ExtendedPoll) - 638+50 ( 2 0 4453.2892312949 2 5524.6835235967 ) 54.3579916958 (ExtendedPoll) - 638+55 ( 2 0 4453.1800482882 2 5540.2966935568 ) 54.1950044054 (ExtendedPoll) - 638+59 ( 2 0 4449.7953750800 2 5547.3389974899 ) 54.1501982295 (ExtendedPoll) - 638+63 ( 2 0 4458.8302688856 2 5540.9790873488 ) 54.1396632915 (ExtendedPoll) - 638+73 ( 2 0 4458.3987614362 2 5541.5182850685 ) 54.1376935988 (ExtendedPoll) - 638+86 ( 2 0 4458.4198350926 2 5541.5559487575 ) 54.1371193459 (ExtendedPoll) - 638+88 ( 2 0 4458.4486331602 2 5541.5458498792 ) 54.1369795760 (ExtendedPoll) - 638+95 ( 2 0 4458.4524474032 2 5541.5457910551 ) 54.1369476680 (ExtendedPoll) - 738+11 ( 2 0 4695.1610452549 2 5241.9495428779 ) 55.4530370223 (ExtendedPoll) - 738+12 ( 2 0 4619.1696725821 2 5296.9777782617 ) 55.4492782592 (ExtendedPoll) - 738+15 ( 2 0 4772.8993460352 2 5199.1498042461 ) 55.3189871998 (ExtendedPoll) - 738+21 ( 2 0 4803.9073199419 2 5194.3457519507 ) 55.1267190068 (ExtendedPoll) - 738+24 ( 2 0 4779.8870584649 2 5214.4354251860 ) 55.0861821831 (ExtendedPoll) - 738+25 ( 2 0 4707.8262740337 2 5274.7044448921 ) 54.9771582390 (ExtendedPoll) - 738+26 ( 2 0 4419.5831363091 2 5515.7805237163 ) 54.7394753219 (ExtendedPoll) - 738+28 ( 2 0 4251.8780379967 2 5711.4364717475 ) 54.2065798938 (ExtendedPoll) - 738+29 ( 2 0 3916.4678413717 2 6046.8466683725 ) 54.1969206166 (ExtendedPoll) - 738+38 ( 2 0 3947.9125473053 2 6047.2834003993 ) 53.8946625323 (ExtendedPoll) - 738+43 ( 2 0 3960.2502270639 2 6037.7844788152 ) 53.8597225819 (ExtendedPoll) - 738+52 ( 2 0 3961.1262500944 2 6037.3528647418 ) 53.8551714185 (ExtendedPoll) - 738+53 ( 2 0 3963.7543191857 2 6036.0580225215 ) 53.8415309007 (ExtendedPoll) - 738+63 ( 2 0 3963.8724386189 2 6036.0888168742 ) 53.8401500357 (ExtendedPoll) - 738+69 ( 2 0 3963.8977126790 2 6036.0717128804 ) 53.8400591085 (ExtendedPoll) - 738+70 ( 2 0 3963.9735348593 2 6036.0204008990 ) 53.8397863412 (ExtendedPoll) - 738+71 ( 2 0 3964.0565483307 2 6035.9309033538 ) 53.8397753773 (ExtendedPoll) - 738+72 ( 2 0 3964.3055887447 2 6035.6624107183 ) 53.8397427557 (ExtendedPoll) - 738+73 ( 2 0 3965.3017504010 2 6034.5884401761 ) 53.8396163244 (ExtendedPoll) - 738+74 ( 2 0 3969.2863970259 2 6030.2925580077 ) 53.8391754528 (ExtendedPoll) - 738+75 ( 2 0 3985.2249835255 2 6013.1090293339 ) 53.8384482501 (ExtendedPoll) - 738+78 ( 2 0 3987.0145612449 2 6012.3276884421 ) 53.8284510125 (ExtendedPoll) - 738+83 ( 2 0 3987.3798551717 2 6012.0036580149 ) 53.8278471786 (ExtendedPoll) - 738+84 ( 2 0 3988.4757369520 2 6011.0315667334 ) 53.8260397128 (ExtendedPoll) - 738+86 ( 2 0 3986.7339267980 2 6013.1742832402 ) 53.8237018301 (ExtendedPoll) - 738+95 ( 2 0 3986.6783090383 2 6013.2829464548 ) 53.8232765676 (ExtendedPoll) - 738+99 ( 2 0 3986.8030524894 2 6013.1636141732 ) 53.8231454979 (ExtendedPoll) - 738+100 ( 2 0 3987.1772828427 2 6012.8056173285 ) 53.8227528066 (ExtendedPoll) - 738+110 ( 2 0 3987.1736824074 2 6012.8204452533 ) 53.8226572738 (ExtendedPoll) - 738+112 ( 2 0 3987.1869497063 2 6012.8129081631 ) 53.8225983976 (ExtendedPoll) - 738+113 ( 2 0 3987.2077526376 2 6012.7905795918 ) 53.8225977726 (ExtendedPoll) - 738+114 ( 2 0 3987.2701614317 2 6012.7235938779 ) 53.8225959146 (ExtendedPoll) - 738+115 ( 2 0 3987.5197966079 2 6012.4556510226 ) 53.8225887344 (ExtendedPoll) - 738+116 ( 2 0 3988.5183373128 2 6011.3838796011 ) 53.8225640459 (ExtendedPoll) - 738+117 ( 2 0 3992.5125001324 2 6007.0967939151 ) 53.8225297822 (ExtendedPoll) - 738+121 ( 2 0 3992.8719297375 2 6006.7662594221 ) 53.8220484338 (ExtendedPoll) - 738+122 ( 2 0 3993.9502185528 2 6005.7746559431 ) 53.8206084721 (ExtendedPoll) - 738+130 ( 2 0 3994.1935345893 2 6005.7947812288 ) 53.8181500804 (ExtendedPoll) - 738+138 ( 2 0 3994.2169631374 2 6005.7752257153 ) 53.8181014599 (ExtendedPoll) - 738+143 ( 2 0 3994.2052365766 2 6005.7933405549 ) 53.8180529267 (ExtendedPoll) - 738+149 ( 2 0 3994.2070325934 2 6005.7926984484 ) 53.8180416998 (ExtendedPoll) - 892+10 ( 2 0 4983.7317319996 2 5014.9580719198 ) 55.8453986667 (ExtendedPoll) - 892+11 ( 2 0 4934.9269279985 2 5059.8322876792 ) 55.6824111014 (ExtendedPoll) - 892+12 ( 2 0 4739.7077119942 2 5239.3291507168 ) 55.1228042284 (ExtendedPoll) - 892+13 ( 2 0 3958.8308479767 2 5957.3166028671 ) 54.5781023915 (ExtendedPoll) - 892+20 ( 2 0 3979.7939852657 2 6016.7121585194 ) 53.8581095439 (ExtendedPoll) - 892+27 ( 2 0 3988.6378088095 2 6010.1065866132 ) 53.8325947095 (ExtendedPoll) - 892+35 ( 2 0 3989.5633053899 2 6010.4187817731 ) 53.8211783096 (ExtendedPoll) - 892+45 ( 2 0 3989.5756322315 2 6010.4097884943 ) 53.8211411134 (ExtendedPoll) - 892+46 ( 2 0 3989.6126127563 2 6010.3828086579 ) 53.8210295286 (ExtendedPoll) - 892+51 ( 2 0 3989.6241534539 2 6010.3728265038 ) 53.8210083518 (ExtendedPoll) - 892+55 ( 2 0 3989.6276603588 2 6010.3713253267 ) 53.8209885364 (ExtendedPoll) - 957+13 ( 2 0 3659.6318779221 2 6340.1599919713 ) 54.3646950351 (ExtendedPoll) - 957+14 ( 2 0 3663.4498711882 2 6335.7176083856 ) 54.3592886738 (ExtendedPoll) - 957+15 ( 2 0 3678.7218442523 2 6317.9480740430 ) 54.3387643534 (ExtendedPoll) - 957+16 ( 2 0 3739.8097365087 2 6246.8699366722 ) 54.2742427310 (ExtendedPoll) - 957+22 ( 2 0 3747.2068852135 2 6244.3587275178 ) 54.2206960776 (ExtendedPoll) - 957+24 ( 2 0 3733.7773753877 2 6261.9371915988 ) 54.2169921066 (ExtendedPoll) - 957+28 ( 2 0 3729.6284211326 2 6268.5700592566 ) 54.2069023761 (ExtendedPoll) - 957+39 ( 2 0 3729.8079759991 2 6269.9395382979 ) 54.1945664870 (ExtendedPoll) - 957+46 ( 2 0 3730.0391102401 2 6269.8609297318 ) 54.1928795948 (ExtendedPoll) - 957+47 ( 2 0 3730.4171990505 2 6269.5520399169 ) 54.1915098832 (ExtendedPoll) - 957+54 ( 2 0 3730.5280413937 2 6269.4196928396 ) 54.1914305422 (ExtendedPoll) - 957+55 ( 2 0 3730.8605684232 2 6269.0226516079 ) 54.1911930941 (ExtendedPoll) - 957+56 ( 2 0 3732.1906765414 2 6267.4344866812 ) 54.1902519228 (ExtendedPoll) - 957+57 ( 2 0 3737.5111090140 2 6261.0818269741 ) 54.1866251399 (ExtendedPoll) - 957+58 ( 2 0 3758.7928389047 2 6235.6711881460 ) 54.1743221404 (ExtendedPoll) - 957+59 ( 2 0 3843.9197584675 2 6134.0286328333 ) 54.1602124163 (ExtendedPoll) - 957+61 ( 2 0 3850.7164006354 2 6130.1799318466 ) 54.1262487754 (ExtendedPoll) - 957+62 ( 2 0 3871.1063271392 2 6118.6338288866 ) 54.0252546165 (ExtendedPoll) - 957+68 ( 2 0 3874.9618520638 2 6118.0196744739 ) 53.9932699228 (ExtendedPoll) - 957+71 ( 2 0 3878.5580673474 2 6116.4979363178 ) 53.9713481391 (ExtendedPoll) - 957+74 ( 2 0 3882.4477119616 2 6116.1772112356 ) 53.9366512244 (ExtendedPoll) - 957+77 ( 2 0 3883.8176174990 2 6114.7851279000 ) 53.9350795566 (ExtendedPoll) - 957+78 ( 2 0 3887.9273341111 2 6110.6088778932 ) 53.9304333927 (ExtendedPoll) - 957+79 ( 2 0 3904.3662005594 2 6093.9038778659 ) 53.9128801378 (ExtendedPoll) - 957+80 ( 2 0 3970.1216663528 2 6027.0838777571 ) 53.8590909037 (ExtendedPoll) - 957+86 ( 2 0 3973.0218399687 2 6024.4703095339 ) 53.8544261587 (ExtendedPoll) - 957+87 ( 2 0 3981.7223608162 2 6016.6296048642 ) 53.8406919834 (ExtendedPoll) - 957+92 ( 2 0 3984.9637313280 2 6014.4459447299 ) 53.8292462452 (ExtendedPoll) - 957+97 ( 2 0 3985.8052081727 2 6013.9503562385 ) 53.8256595333 (ExtendedPoll) - 957+105 ( 2 0 3985.8396877184 2 6014.0674560795 ) 53.8243145748 (ExtendedPoll) - 957+108 ( 2 0 3985.9527091902 2 6014.0213411865 ) 53.8236546852 (ExtendedPoll) - 957+113 ( 2 0 3986.0162471161 2 6013.9629145501 ) 53.8235671131 (ExtendedPoll) - 957+114 ( 2 0 3986.2068608937 2 6013.7876346407 ) 53.8233045248 (ExtendedPoll) - 957+120 ( 2 0 3986.1976307305 2 6013.7997850945 ) 53.8232852967 (ExtendedPoll) - 957+126 ( 2 0 3986.2011589420 2 6013.7983347110 ) 53.8232647945 (ExtendedPoll) - 957+130 ( 2 0 3986.1999003828 2 6013.7997678928 ) 53.8232641222 (ExtendedPoll) - 957+133 ( 2 0 3986.1980746415 2 6013.8017534985 ) 53.8232639619 (ExtendedPoll) - 1130+15 ( 2 0 4999.7419965034 2 5000.2294282565 ) 55.9008939292 (ExtendedPoll) - 1130+16 ( 2 0 4998.9679860137 2 5000.9177130262 ) 55.8984788107 (ExtendedPoll) - 1130+17 ( 2 0 4995.8719440548 2 5003.6708521046 ) 55.8888394453 (ExtendedPoll) - 1130+18 ( 2 0 4983.4877762190 2 5014.6834084185 ) 55.8506205863 (ExtendedPoll) - 1130+19 ( 2 0 4933.9511048760 2 5058.7336336741 ) 55.7032178511 (ExtendedPoll) - 1130+20 ( 2 0 4735.8044195041 2 5234.9345346965 ) 55.2046851896 (ExtendedPoll) - 1130+21 ( 2 0 3943.2176780166 2 5939.7381387862 ) 54.8819022435 (ExtendedPoll) - 1130+23 ( 2 0 3935.3565015332 2 5969.8726486392 ) 54.6880709245 (ExtendedPoll) - 1130+24 ( 2 0 3911.7729720830 2 6060.2761781983 ) 54.1268308179 (ExtendedPoll) - 1130+30 ( 2 0 3902.3832335056 2 6072.7230409636 ) 54.1106121774 (ExtendedPoll) - 1130+31 ( 2 0 3874.2140177734 2 6110.0636292598 ) 54.0666592435 (ExtendedPoll) - 1130+34 ( 2 0 3854.9978085918 2 6134.5206227637 ) 54.0491056788 (ExtendedPoll) - 1130+41 ( 2 0 3852.6503739474 2 6141.9723629719 ) 54.0104767054 (ExtendedPoll) - 1130+45 ( 2 0 3860.8118036993 2 6134.5206227637 ) 53.9930000229 (ExtendedPoll) - 1130+46 ( 2 0 3885.2960929549 2 6112.1654021390 ) 53.9427035432 (ExtendedPoll) - 1130+54 ( 2 0 3886.8263610334 2 6110.9507411893 ) 53.9381441910 (ExtendedPoll) - 1130+55 ( 2 0 3891.4171652688 2 6107.3067583403 ) 53.9245293625 (ExtendedPoll) - 1130+56 ( 2 0 3897.5041178931 2 6102.3935230381 ) 53.9073073325 (ExtendedPoll) - 1130+66 ( 2 0 3897.7068634861 2 6102.2575240879 ) 53.9065051034 (ExtendedPoll) - 1130+74 ( 2 0 3897.7316573216 2 6102.2397316194 ) 53.9064167304 (ExtendedPoll) - 1130+75 ( 2 0 3897.8060388280 2 6102.1863542139 ) 53.9061516260 (ExtendedPoll) - 1130+81 ( 2 0 3897.8185626742 2 6102.1776373870 ) 53.9061047270 (ExtendedPoll) - 1130+87 ( 2 0 3897.8165360562 2 6102.1808692197 ) 53.9060970673 (ExtendedPoll) - 1130+90 ( 2 0 3897.8201618133 2 6102.1796835545 ) 53.9060722877 (ExtendedPoll) - 1130+103 ( 2 0 3897.8200835182 2 6102.1797734473 ) 53.9060722845 (ExtendedPoll) - 1130+104 ( 2 0 3897.8198486328 2 6102.1800431259 ) 53.9060722750 (ExtendedPoll) - 1241+5 ( 2 0 4966.3716339321 2 5028.8243137725 ) 55.8117570732 (ExtendedPoll) - 1241+6 ( 2 0 4865.4865357285 2 5115.2972550898 ) 55.5653095642 (ExtendedPoll) - 1241+7 ( 2 0 4461.9461429141 2 5461.1890203593 ) 54.9583349271 (ExtendedPoll) - 1241+13 ( 2 0 4468.9338553438 2 5524.0784322265 ) 54.2311656305 (ExtendedPoll) - 1241+14 ( 2 0 4385.0813061876 2 5614.9186938124 ) 54.0080105561 (ExtendedPoll) - 1291+22 ( 2 0 4999.9828435272 2 5000.0130887244 ) 55.9016722791 (ExtendedPoll) - 1291+23 ( 2 0 4999.9313741087 2 5000.0523548977 ) 55.9015908089 (ExtendedPoll) - 1291+24 ( 2 0 4999.7254964348 2 5000.2094195909 ) 55.9012650053 (ExtendedPoll) - 1291+25 ( 2 0 4998.9019857391 2 5000.8376783636 ) 55.8999630243 (ExtendedPoll) - 1291+26 ( 2 0 4995.6079429565 2 5003.3507134546 ) 55.8947748483 (ExtendedPoll) - 1291+27 ( 2 0 4982.4317718259 2 5013.4028538183 ) 55.8743389196 (ExtendedPoll) - 1291+28 ( 2 0 4929.7270873038 2 5053.6114152732 ) 55.7977153969 (ExtendedPoll) - 1291+29 ( 2 0 4718.9083492152 2 5214.4456610929 ) 55.5764644844 (ExtendedPoll) - 1291+32 ( 2 0 4720.0070032202 2 5218.1920030108 ) 55.5244848408 (ExtendedPoll) - 1291+33 ( 2 0 4723.3029652354 2 5229.4310287644 ) 55.3687307229 (ExtendedPoll) - 1291+34 ( 2 0 4734.5488149269 2 5240.3493294358 ) 55.1527367318 (ExtendedPoll) - 1291+35 ( 2 0 4725.8141743898 2 5270.4838392888 ) 54.8793050383 (ExtendedPoll) - 1291+43 ( 2 0 4724.6472810056 2 5274.2097093929 ) 54.8463890957 (ExtendedPoll) - 1291+48 ( 2 0 4723.8706315711 2 5274.8016860074 ) 54.8459531010 (ExtendedPoll) - 1291+49 ( 2 0 4721.5406832677 2 5276.5776158510 ) 54.8446571102 (ExtendedPoll) - 1291+50 ( 2 0 4712.2208900540 2 5283.6813352253 ) 54.8396533297 (ExtendedPoll) - 1291+51 ( 2 0 4674.9417171991 2 5312.0962127226 ) 54.8225390616 (ExtendedPoll) - 1291+52 ( 2 0 4525.8250257796 2 5425.7557227117 ) 54.8016355518 (ExtendedPoll) - 1291+55 ( 2 0 4527.5719538871 2 5456.7636966185 ) 54.4520740351 (ExtendedPoll) - 1291+59 ( 2 0 4517.3087512560 2 5468.5554613436 ) 54.4117744769 (ExtendedPoll) - 1291+60 ( 2 0 4486.5191433627 2 5503.9307555188 ) 54.2947627479 (ExtendedPoll) - 1291+61 ( 2 0 4439.3520844623 2 5545.8570300970 ) 54.2549299012 (ExtendedPoll) - 1291+62 ( 2 0 4297.8509077611 2 5671.6358538313 ) 54.1955288613 (ExtendedPoll) - 1291+64 ( 2 0 4130.1458094486 2 5867.2918018626 ) 53.8101176125 (ExtendedPoll) - 1291+75 ( 2 0 4128.0235647556 2 5870.5672920640 ) 53.7990789831 (ExtendedPoll) - 1291+79 ( 2 0 4127.0989211675 2 5872.2886304042 ) 53.7915583989 (ExtendedPoll) - 1291+85 ( 2 0 4128.1741178860 2 5871.4215637923 ) 53.7897866464 (ExtendedPoll) - 1291+88 ( 2 0 4127.2012802363 2 5872.4020783721 ) 53.7895735461 (ExtendedPoll) - 1291+89 ( 2 0 4124.2827672873 2 5875.3436221116 ) 53.7889669943 (ExtendedPoll) - 1291+90 ( 2 0 4112.6087154913 2 5887.1097970695 ) 53.7870326237 (ExtendedPoll) - 1291+103 ( 2 0 4112.6224699912 2 5887.2310885676 ) 53.7857898087 (ExtendedPoll) - 1291+105 ( 2 0 4112.6068429068 2 5887.3521534897 ) 53.7848179668 (ExtendedPoll) - 1291+111 ( 2 0 4112.6094751875 2 5887.3825571652 ) 53.7845139164 (ExtendedPoll) - 1291+115 ( 2 0 4112.6011895425 2 5887.3953703748 ) 53.7844717434 (ExtendedPoll) - 1291+121 ( 2 0 4112.6098291866 2 5887.3889072301 ) 53.7844522046 (ExtendedPoll) - 1291+126 ( 2 0 4112.6115497632 2 5887.3880840681 ) 53.7844440412 (ExtendedPoll) - 1291+133 ( 2 0 4112.6117769427 2 5887.3881564070 ) 53.7844412964 (ExtendedPoll) - 1291+139 ( 2 0 4112.6117384418 2 5887.3882019087 ) 53.7844412297 (ExtendedPoll) - 1291+140 ( 2 0 4112.6116229393 2 5887.3883384136 ) 53.7844410296 (ExtendedPoll) - 1291+144 ( 2 0 4112.6116767374 2 5887.3883127527 ) 53.7844407736 (ExtendedPoll) - 1291+147 ( 2 0 4112.6116387835 2 5887.3883587115 ) 53.7844406977 (ExtendedPoll) - 1444+2 ( 2 0 4902.1720259844 2 5076.8648367266 ) 55.7342800977 (ExtendedPoll) - 1444+3 ( 2 0 4608.6881039375 2 5307.4593469062 ) 55.4177822439 (ExtendedPoll) - 1444+6 ( 2 0 4440.9830056251 2 5503.1152949375 ) 54.6903788761 (ExtendedPoll) - 1444+9 ( 2 0 4273.2779073126 2 5698.7712429687 ) 54.1421759642 (ExtendedPoll) - 1444+10 ( 2 0 3937.8677106876 2 6034.1814395937 ) 54.1025876908 (ExtendedPoll) - 1444+19 ( 2 0 3985.0347695880 2 5992.2551650155 ) 54.0228541969 (ExtendedPoll) - 1444+20 ( 2 0 4126.5359462891 2 5866.4763412812 ) 53.8506010417 (ExtendedPoll) - 1444+30 ( 2 0 4130.4392387792 2 5866.5172849087 ) 53.8146342551 (ExtendedPoll) - 1444+32 ( 2 0 4128.6854867338 2 5870.0111411235 ) 53.7981997187 (ExtendedPoll) - 1444+38 ( 2 0 4129.0689067457 2 5870.9093419522 ) 53.7863749691 (ExtendedPoll) - 1444+51 ( 2 0 4129.0636273984 2 5870.9236583107 ) 53.7862903829 (ExtendedPoll) - 1444+56 ( 2 0 4129.0651471032 2 5870.9311348262 ) 53.7862072107 (ExtendedPoll) - 1444+60 ( 2 0 4129.0646772976 2 5870.9349204804 ) 53.7861763981 (ExtendedPoll) - 1444+66 ( 2 0 4129.0641711296 2 5870.9357287432 ) 53.7861735204 (ExtendedPoll) - 1444+74 ( 2 0 4129.0643025908 2 5870.9356231986 ) 53.7861733001 (ExtendedPoll) - 1444+77 ( 2 0 4129.0644472731 2 5870.9355366612 ) 53.7861727831 (ExtendedPoll) - 1444+82 ( 2 0 4129.0644281460 2 5870.9355595157 ) 53.7861727456 (ExtendedPoll) - 1444+83 ( 2 0 4129.0643707645 2 5870.9356280794 ) 53.7861726332 (ExtendedPoll) - 1626+2 ( 2 0 4867.2334638359 2 5118.7911113047 ) 55.5101747565 (ExtendedPoll) - 1626+3 ( 2 0 4468.9338553438 2 5475.1644452187 ) 54.7497453707 (ExtendedPoll) - 1626+10 ( 2 0 4531.8232672110 2 5468.1767327890 ) 54.2937328699 (ExtendedPoll) - 1626+12 ( 2 0 4406.0444434766 2 5593.9555565234 ) 54.0419580454 (ExtendedPoll) - 1626+13 ( 2 0 4028.7079722735 2 5971.2920277265 ) 53.7998378556 (ExtendedPoll) - 1626+19 ( 2 0 4154.4867960079 2 5845.5132039921 ) 53.7918826239 (ExtendedPoll) - 1689+27 ( 2 0 4999.9918793150 2 5000.0071042165 ) 55.9016755069 (ExtendedPoll) - 1689+28 ( 2 0 4999.9675172600 2 5000.0284168659 ) 55.9016037165 (ExtendedPoll) - 1689+29 ( 2 0 4999.8700690400 2 5000.1136674635 ) 55.9013165752 (ExtendedPoll) - 1689+30 ( 2 0 4999.4802761598 2 5000.4546698539 ) 55.9001683374 (ExtendedPoll) - 1689+31 ( 2 0 4997.9211046392 2 5001.8186794156 ) 55.8955806263 (ExtendedPoll) - 1689+32 ( 2 0 4991.6844185568 2 5007.2747176624 ) 55.8773137258 (ExtendedPoll) - 1689+33 ( 2 0 4966.7376742271 2 5029.0988706497 ) 55.8055960661 (ExtendedPoll) - 1689+34 ( 2 0 4866.9506969084 2 5116.3954825988 ) 55.5407618647 (ExtendedPoll) - 1689+35 ( 2 0 4467.8027876336 2 5465.5819303951 ) 54.8617064546 (ExtendedPoll) - 1689+37 ( 2 0 4466.8269645111 2 5469.3623920026 ) 54.8295561915 (ExtendedPoll) - 1689+38 ( 2 0 4463.8994951436 2 5480.7037768250 ) 54.7333779337 (ExtendedPoll) - 1689+39 ( 2 0 4452.1896176735 2 5526.0693161146 ) 54.3527873521 (ExtendedPoll) - 1689+40 ( 2 0 4432.0999444382 2 5550.0895775916 ) 54.2727755505 (ExtendedPoll) - 1689+41 ( 2 0 4371.8309247321 2 5622.1503620228 ) 54.0490159101 (ExtendedPoll) - 1689+48 ( 2 0 4367.1633511951 2 5628.4010891571 ) 54.0259049915 (ExtendedPoll) - 1689+52 ( 2 0 4367.4363087119 2 5632.2975577092 ) 53.9839463746 (ExtendedPoll) - 1689+64 ( 2 0 4367.5173563027 2 5632.3888412069 ) 53.9823156833 (ExtendedPoll) - 1689+67 ( 2 0 4367.5750698909 2 5632.4087032645 ) 53.9816128497 (ExtendedPoll) - 1689+77 ( 2 0 4367.5769053809 2 5632.4193356014 ) 53.9814889495 (ExtendedPoll) - 1689+82 ( 2 0 4367.5805624212 2 5632.4182502476 ) 53.9814682147 (ExtendedPoll) - 1689+86 ( 2 0 4367.5821046999 2 5632.4171280385 ) 53.9814662175 (ExtendedPoll) - 1689+90 ( 2 0 4367.5818878523 2 5632.4180567321 ) 53.9814586704 (ExtendedPoll) - 1689+104 ( 2 0 4367.5819056985 2 5632.4180679393 ) 53.9814584017 (ExtendedPoll) - 1689+105 ( 2 0 4367.5819346476 2 5632.4180608593 ) 53.9814582222 (ExtendedPoll) - 1689+109 ( 2 0 4367.5819216978 2 5632.4180774844 ) 53.9814581658 (ExtendedPoll) - 1689+115 ( 2 0 4367.5819257648 2 5632.4180741356 ) 53.9814581645 (ExtendedPoll) - 1689+120 ( 2 0 4367.5819244247 2 5632.4180754292 ) 53.9814581630 (ExtendedPoll) - 1689+121 ( 2 0 4367.5819204043 2 5632.4180793101 ) 53.9814581585 (ExtendedPoll) - 1689+122 ( 2 0 4367.5819043228 2 5632.4180948339 ) 53.9814581405 (ExtendedPoll) - 1689+123 ( 2 0 4367.5818399969 2 5632.4181569287 ) 53.9814580686 (ExtendedPoll) - 1689+124 ( 2 0 4367.5815826929 2 5632.4184053083 ) 53.9814577808 (ExtendedPoll) - 1689+125 ( 2 0 4367.5805534773 2 5632.4193988263 ) 53.9814566296 (ExtendedPoll) - 1689+126 ( 2 0 4367.5764366146 2 5632.4233728987 ) 53.9814520249 (ExtendedPoll) - 1689+127 ( 2 0 4367.5599691638 2 5632.4392691879 ) 53.9814336068 (ExtendedPoll) - 1689+128 ( 2 0 4367.4940993607 2 5632.5028543451 ) 53.9813599484 (ExtendedPoll) - 1689+129 ( 2 0 4367.2306201483 2 5632.7571949737 ) 53.9810655359 (ExtendedPoll) - 1689+130 ( 2 0 4366.1767032985 2 5633.7745574881 ) 53.9798914222 (ExtendedPoll) - 1689+131 ( 2 0 4361.9610358996 2 5637.8440075457 ) 53.9752515834 (ExtendedPoll) - 1689+132 ( 2 0 4345.0983663039 2 5654.1218077760 ) 53.9576001475 (ExtendedPoll) - 1689+133 ( 2 0 4277.6476879210 2 5719.2330086971 ) 53.9016513465 (ExtendedPoll) - 1689+135 ( 2 0 4277.6290591203 2 5719.2571811144 ) 53.9015782727 (ExtendedPoll) - 1689+136 ( 2 0 4277.5731727181 2 5719.3296983663 ) 53.9013590679 (ExtendedPoll) - 1689+137 ( 2 0 4277.3496271092 2 5719.6197673739 ) 53.9004824970 (ExtendedPoll) - 1689+138 ( 2 0 4276.4554446736 2 5720.7800434043 ) 53.8969801836 (ExtendedPoll) - 1689+139 ( 2 0 4272.8787149315 2 5725.4211475259 ) 53.8830344924 (ExtendedPoll) - 1689+140 ( 2 0 4272.2449416972 2 5726.1641037669 ) 53.8813532804 (ExtendedPoll) - 1689+141 ( 2 0 4270.3436219944 2 5728.3929724899 ) 53.8763261624 (ExtendedPoll) - 1689+145 ( 2 0 4269.8544309447 2 5729.2382877997 ) 53.8723721175 (ExtendedPoll) - 1689+146 ( 2 0 4268.9604950773 2 5730.9749800002 ) 53.8632736922 (ExtendedPoll) - 1689+157 ( 2 0 4268.9281879962 2 5731.0267642928 ) 53.8630526551 (ExtendedPoll) - 1689+162 ( 2 0 4268.9081672520 2 5731.0497967493 ) 53.8630044126 (ExtendedPoll) - 1689+163 ( 2 0 4268.8481050197 2 5731.1188941187 ) 53.8628597009 (ExtendedPoll) - 1689+167 ( 2 0 4268.9130457179 2 5731.0620335227 ) 53.8628413313 (ExtendedPoll) - 1689+168 ( 2 0 4269.1078678127 2 5730.8914517347 ) 53.8627863397 (ExtendedPoll) - 1689+172 ( 2 0 4268.9798523367 2 5731.0072720873 ) 53.8627858887 (ExtendedPoll) - 1689+173 ( 2 0 4268.5958059087 2 5731.3547331451 ) 53.8627850104 (ExtendedPoll) - 1689+182 ( 2 0 4268.5734598444 2 5731.3755169174 ) 53.8627794333 (ExtendedPoll) - 1689+183 ( 2 0 4268.5064216515 2 5731.4378682344 ) 53.8627627170 (ExtendedPoll) - 1689+184 ( 2 0 4268.2382688801 2 5731.6872735026 ) 53.8626960762 (ExtendedPoll) - 1689+185 ( 2 0 4267.1656577944 2 5732.6848945752 ) 53.8624331084 (ExtendedPoll) - 1689+186 ( 2 0 4262.8752134514 2 5736.6753788658 ) 53.8614387941 (ExtendedPoll) - 1689+187 ( 2 0 4245.7134360797 2 5752.6373160280 ) 53.8583843412 (ExtendedPoll) - 1689+190 ( 2 0 4247.8459166796 2 5750.8801520137 ) 53.8564841075 (ExtendedPoll) - 1689+191 ( 2 0 4254.2433584792 2 5745.6086599708 ) 53.8509013362 (ExtendedPoll) - 1689+203 ( 2 0 4254.3648432334 2 5745.5967180794 ) 53.8499381914 (ExtendedPoll) - 1689+208 ( 2 0 4254.3884937761 2 5745.5774316250 ) 53.8499159225 (ExtendedPoll) - 1689+209 ( 2 0 4254.4594454040 2 5745.5195722617 ) 53.8498491302 (ExtendedPoll) - 1689+216 ( 2 0 4254.4747041982 2 5745.5195660142 ) 53.8497136099 (ExtendedPoll) - 1689+222 ( 2 0 4254.4785171266 2 5745.5196821982 ) 53.8496785985 (ExtendedPoll) - 1689+225 ( 2 0 4254.4745684192 2 5745.5233580070 ) 53.8496778754 (ExtendedPoll) - 1689+226 ( 2 0 4254.4627222968 2 5745.5343854333 ) 53.8496757065 (ExtendedPoll) - 1689+227 ( 2 0 4254.4153378073 2 5745.5784951385 ) 53.8496670379 (ExtendedPoll) - 1689+228 ( 2 0 4254.2257998495 2 5745.7549339594 ) 53.8496324765 (ExtendedPoll) - 1689+229 ( 2 0 4253.4676480183 2 5746.4606892429 ) 53.8494960362 (ExtendedPoll) - 1689+230 ( 2 0 4250.4350406932 2 5749.2837103771 ) 53.8489791731 (ExtendedPoll) - 1689+231 ( 2 0 4238.3046113928 2 5760.5757949136 ) 53.8473747522 (ExtendedPoll) - 1689+233 ( 2 0 4237.9514726055 2 5760.9129400964 ) 53.8472576934 (ExtendedPoll) - 1689+234 ( 2 0 4236.8920562434 2 5761.9243756450 ) 53.8469104201 (ExtendedPoll) - 1689+235 ( 2 0 4232.6543907954 2 5765.9701178391 ) 53.8455799016 (ExtendedPoll) - 1689+236 ( 2 0 4215.7037290030 2 5782.1530866154 ) 53.8411968855 (ExtendedPoll) - 1689+237 ( 2 0 4147.9010818337 2 5846.8849617209 ) 53.8388064213 (ExtendedPoll) - 1689+239 ( 2 0 4139.4939903168 2 5859.9869225266 ) 53.7929039460 (ExtendedPoll) - 1689+243 ( 2 0 4134.1713187395 2 5865.6917346274 ) 53.7882968215 (ExtendedPoll) - 1689+250 ( 2 0 4133.4948958932 2 5866.3963062176 ) 53.7879136446 (ExtendedPoll) - 1689+251 ( 2 0 4131.4656273543 2 5868.5100209882 ) 53.7867806418 (ExtendedPoll) - 1689+261 ( 2 0 4131.5933562783 2 5868.3938874275 ) 53.7866942837 (ExtendedPoll) - 1689+270 ( 2 0 4131.5998202039 2 5868.3898345950 ) 53.7866729850 (ExtendedPoll) - 1689+271 ( 2 0 4131.6192119808 2 5868.3776760976 ) 53.7866090899 (ExtendedPoll) - 1689+279 ( 2 0 4131.6209541211 2 5868.3784525807 ) 53.7865860060 (ExtendedPoll) - 1689+284 ( 2 0 4131.6214166274 2 5868.3783365570 ) 53.7865828676 (ExtendedPoll) - 1689+287 ( 2 0 4131.6210066099 2 5868.3788719382 ) 53.7865816357 (ExtendedPoll) - 1689+293 ( 2 0 4131.6209362583 2 5868.3789681750 ) 53.7865813838 (ExtendedPoll) - 1689+294 ( 2 0 4131.6207252036 2 5868.3792568852 ) 53.7865806279 (ExtendedPoll) - 1689+298 ( 2 0 4131.6206891940 2 5868.3793043828 ) 53.7865805153 (ExtendedPoll) - 1689+304 ( 2 0 4131.6206796375 2 5868.3793158160 ) 53.7865804962 (ExtendedPoll) - 1689+308 ( 2 0 4131.6206768768 2 5868.3793227362 ) 53.7865804572 (ExtendedPoll) - 1689+313 ( 2 0 4131.6206782642 2 5868.3793214934 ) 53.7865804561 (ExtendedPoll) - 1689+315 ( 2 0 4131.6206745081 2 5868.3793251876 ) 53.7865804560 (ExtendedPoll) - 1689+316 ( 2 0 4131.6206632396 2 5868.3793362702 ) 53.7865804559 (ExtendedPoll) - 1689+317 ( 2 0 4131.6206181660 2 5868.3793806004 ) 53.7865804552 (ExtendedPoll) - 1689+318 ( 2 0 4131.6204378713 2 5868.3795579212 ) 53.7865804528 (ExtendedPoll) - 1689+319 ( 2 0 4131.6197166927 2 5868.3802672046 ) 53.7865804428 (ExtendedPoll) - 1689+320 ( 2 0 4131.6168319783 2 5868.3831043383 ) 53.7865804032 (ExtendedPoll) - 1689+321 ( 2 0 4131.6052931206 2 5868.3944528729 ) 53.7865802452 (ExtendedPoll) - 1689+322 ( 2 0 4131.5591376898 2 5868.4398470112 ) 53.7865796204 (ExtendedPoll) - 1689+323 ( 2 0 4131.3745159668 2 5868.6214235646 ) 53.7865772402 (ExtendedPoll) - 1689+324 ( 2 0 4130.6360290747 2 5869.3477297782 ) 53.7865696199 (ExtendedPoll) - 1689+325 ( 2 0 4127.6820815062 2 5872.2529546326 ) 53.7865695587 (ExtendedPoll) - 1689+328 ( 2 0 4127.6840140147 2 5872.2603352230 ) 53.7864835442 (ExtendedPoll) - 1689+329 ( 2 0 4127.6898115401 2 5872.2824769939 ) 53.7862255016 (ExtendedPoll) - 1689+330 ( 2 0 4127.6796235307 2 5872.3112438240 ) 53.7860518834 (ExtendedPoll) - 1689+338 ( 2 0 4127.6784943469 2 5872.3148875688 ) 53.7860284213 (ExtendedPoll) - 1689+339 ( 2 0 4127.6750287014 2 5872.3216844082 ) 53.7859970553 (ExtendedPoll) - 1689+345 ( 2 0 4127.6738721701 2 5872.3232011194 ) 53.7859935510 (ExtendedPoll) - 1689+346 ( 2 0 4127.6704025761 2 5872.3277512530 ) 53.7859830384 (ExtendedPoll) - 1689+352 ( 2 0 4127.6704920471 2 5872.3287007212 ) 53.7859734249 (ExtendedPoll) - 1689+357 ( 2 0 4127.6702519860 2 5872.3291127215 ) 53.7859717972 (ExtendedPoll) - 1689+358 ( 2 0 4127.6695318024 2 5872.3303487226 ) 53.7859669139 (ExtendedPoll) - 1689+364 ( 2 0 4127.6693723329 2 5872.3305259594 ) 53.7859667262 (ExtendedPoll) - 1689+365 ( 2 0 4127.6688939242 2 5872.3310576698 ) 53.7859661633 (ExtendedPoll) - 1689+372 ( 2 0 4127.6688751072 2 5872.3311142263 ) 53.7859658109 (ExtendedPoll) - 1689+374 ( 2 0 4127.6689990935 2 5872.3309999936 ) 53.7859657384 (ExtendedPoll) - 1689+382 ( 2 0 4127.6690021165 2 5872.3309978166 ) 53.7859657310 (ExtendedPoll) - 2076+20 ( 2 0 4999.9878997345 2 5000.0092959702 ) 55.9016794952 (ExtendedPoll) - 2076+21 ( 2 0 4999.9515989379 2 5000.0371838810 ) 55.9016196708 (ExtendedPoll) - 2076+22 ( 2 0 4999.8063957515 2 5000.1487355238 ) 55.9013804121 (ExtendedPoll) - 2076+23 ( 2 0 4999.2255830062 2 5000.5949420954 ) 55.9004239959 (ExtendedPoll) - 2076+24 ( 2 0 4996.9023320246 2 5002.3797683814 ) 55.8966082342 (ExtendedPoll) - 2076+25 ( 2 0 4987.6093280984 2 5009.5190735258 ) 55.8815039246 (ExtendedPoll) - 2076+26 ( 2 0 4950.4373123937 2 5038.0762941031 ) 55.8236448341 (ExtendedPoll) - 2076+27 ( 2 0 4801.7492495748 2 5152.3051764124 ) 55.6343152023 (ExtendedPoll) - 2076+28 ( 2 0 4206.9969982993 2 5609.2207056496 ) 55.6253373563 (ExtendedPoll) - 2076+32 ( 2 0 4217.9971862258 2 5610.1214654550 ) 55.5187948731 (ExtendedPoll) - 2076+33 ( 2 0 4250.9977500050 2 5612.8237448711 ) 55.2000072940 (ExtendedPoll) - 2076+34 ( 2 0 4279.8220637775 2 5600.5952481192 ) 55.0710067569 (ExtendedPoll) - 2076+35 ( 2 0 4366.2950050949 2 5563.9097578633 ) 54.6951789859 (ExtendedPoll) - 2076+39 ( 2 0 4393.3723907599 2 5548.1874048965 ) 54.6249740689 (ExtendedPoll) - 2076+40 ( 2 0 4474.6045477550 2 5501.0203459961 ) 54.4266469861 (ExtendedPoll) - 2076+42 ( 2 0 4525.2654628702 2 5464.3348557403 ) 54.3900963042 (ExtendedPoll) - 2076+48 ( 2 0 4514.4563452056 2 5483.6602479286 ) 54.2742359116 (ExtendedPoll) - 2076+49 ( 2 0 4491.7462798091 2 5505.0601172445 ) 54.2385084897 (ExtendedPoll) - 2076+50 ( 2 0 4423.6160836196 2 5569.2597251923 ) 54.1460338788 (ExtendedPoll) - 2076+51 ( 2 0 4151.0952988618 2 5826.0581569833 ) 54.0054730693 (ExtendedPoll) - 2076+57 ( 2 0 4119.6505929283 2 5880.2129283134 ) 53.7862527117 (ExtendedPoll) - 2076+75 ( 2 0 4119.5665931846 2 5880.3014995623 ) 53.7862021958 (ExtendedPoll) - 2076+76 ( 2 0 4119.3145939537 2 5880.5672133090 ) 53.7860509080 (ExtendedPoll) - 2076+77 ( 2 0 4118.3065970302 2 5881.6300682960 ) 53.7854496575 (ExtendedPoll) - 2076+88 ( 2 0 4118.3108711544 2 5881.6602849630 ) 53.7851316932 (ExtendedPoll) - 2076+96 ( 2 0 4118.3198847115 2 5881.6662155602 ) 53.7849945777 (ExtendedPoll) - 2076+97 ( 2 0 4118.3348277986 2 5881.6631276284 ) 53.7848865134 (ExtendedPoll) - 2076+99 ( 2 0 4118.3462668702 2 5881.6530292707 ) 53.7848751796 (ExtendedPoll) - 2076+108 ( 2 0 4118.3455932557 2 5881.6537043543 ) 53.7848751047 (ExtendedPoll) - 2076+109 ( 2 0 4118.3435724122 2 5881.6557296052 ) 53.7848748801 (ExtendedPoll) - 2076+110 ( 2 0 4118.3354890381 2 5881.6638306090 ) 53.7848739818 (ExtendedPoll) - 2076+111 ( 2 0 4118.3031555418 2 5881.6962346240 ) 53.7848703922 (ExtendedPoll) - 2076+112 ( 2 0 4118.1738215565 2 5881.8258506839 ) 53.7848560937 (ExtendedPoll) - 2076+122 ( 2 0 4118.1735085463 2 5881.8262104036 ) 53.7848556344 (ExtendedPoll) - 2076+123 ( 2 0 4118.1725695157 2 5881.8272895629 ) 53.7848542566 (ExtendedPoll) - 2076+132 ( 2 0 4118.1726545887 2 5881.8272060557 ) 53.7848542498 (ExtendedPoll) - 2076+133 ( 2 0 4118.1729098077 2 5881.8269555344 ) 53.7848542294 (ExtendedPoll) - 2076+134 ( 2 0 4118.1739306837 2 5881.8259534489 ) 53.7848541479 (ExtendedPoll) - 2076+135 ( 2 0 4118.1780141879 2 5881.8219451070 ) 53.7848538220 (ExtendedPoll) - 2076+151 ( 2 0 4118.1780093963 2 5881.8219592167 ) 53.7848537356 (ExtendedPoll) - 2076+152 ( 2 0 4118.1779950216 2 5881.8220015460 ) 53.7848534763 (ExtendedPoll) - 2076+159 ( 2 0 4118.1779947385 2 5881.8220052606 ) 53.7848534446 (ExtendedPoll) - 2244+6 ( 2 0 4168.4622208673 2 5740.6975175468 ) 54.6654457702 (ExtendedPoll) - 2244+7 ( 2 0 3937.8677106876 2 6034.1814395937 ) 54.1025876908 (ExtendedPoll) - 2244+15 ( 2 0 3968.8756845943 2 6029.8141193251 ) 53.8471893590 (ExtendedPoll) - 2244+23 ( 2 0 3966.3440036262 2 6032.7893562581 ) 53.8453293272 (ExtendedPoll) - 2244+29 ( 2 0 3967.2852805629 2 6032.5287671287 ) 53.8387026417 (ExtendedPoll) - 2244+32 ( 2 0 3966.9613567598 2 6032.8941676795 ) 53.8385991104 (ExtendedPoll) - 2244+33 ( 2 0 3965.9895853505 2 6033.9903693319 ) 53.8382928991 (ExtendedPoll) - 2244+45 ( 2 0 3966.0039197226 2 6033.9851390276 ) 53.8382028409 (ExtendedPoll) - 2244+46 ( 2 0 3966.0291479677 2 6033.9679675607 ) 53.8381131770 (ExtendedPoll) - 2244+52 ( 2 0 3966.0378553973 2 6033.9615960721 ) 53.8380860741 (ExtendedPoll) - 2244+64 ( 2 0 3966.0380469160 2 6033.9618735742 ) 53.8380818691 (ExtendedPoll) - 2244+69 ( 2 0 3966.0381004053 2 6033.9618472758 ) 53.8380815916 (ExtendedPoll) - 2244+74 ( 2 0 3966.0381302064 2 6033.9618470067 ) 53.8380813128 (ExtendedPoll) - 2244+79 ( 2 0 3966.0381451069 2 6033.9618471499 ) 53.8380811710 (ExtendedPoll) - 2244+84 ( 2 0 3966.0381513080 2 6033.9618430199 ) 53.8380811481 (ExtendedPoll) - 2244+86 ( 2 0 3966.0381381930 2 6033.9618595149 ) 53.8380811293 (ExtendedPoll) - 2244+91 ( 2 0 3966.0381418784 2 6033.9618557502 ) 53.8380811271 (ExtendedPoll) - 2244+92 ( 2 0 3966.0381529347 2 6033.9618444560 ) 53.8380811204 (ExtendedPoll) - 2244+93 ( 2 0 3966.0381971599 2 6033.9617992793 ) 53.8380810935 (ExtendedPoll) - 2244+94 ( 2 0 3966.0383740607 2 6033.9616185725 ) 53.8380809858 (ExtendedPoll) - 2244+95 ( 2 0 3966.0390816638 2 6033.9608957451 ) 53.8380805552 (ExtendedPoll) - 2244+96 ( 2 0 3966.0419120761 2 6033.9580044356 ) 53.8380788327 (ExtendedPoll) - 2244+97 ( 2 0 3966.0532337255 2 6033.9464391976 ) 53.8380719433 (ExtendedPoll) - 2244+98 ( 2 0 3966.0985203229 2 6033.9001782457 ) 53.8380443936 (ExtendedPoll) - 2244+99 ( 2 0 3966.2796667126 2 6033.7151344380 ) 53.8379343190 (ExtendedPoll) - 2244+100 ( 2 0 3967.0042522715 2 6032.9749592074 ) 53.8374960138 (ExtendedPoll) - 2244+101 ( 2 0 3969.9025945070 2 6030.0142582847 ) 53.8357746693 (ExtendedPoll) - 2244+102 ( 2 0 3981.4959634492 2 6018.1714545940 ) 53.8293988351 (ExtendedPoll) - 2244+103 ( 2 0 4027.8694392178 2 5970.8002398312 ) 53.8120165816 (ExtendedPoll) - 2244+105 ( 2 0 4027.8996279793 2 5970.7957732839 ) 53.8117751288 (ExtendedPoll) - 2244+106 ( 2 0 4027.9901942637 2 5970.7823736422 ) 53.8110507797 (ExtendedPoll) - 2244+107 ( 2 0 4028.3524594017 2 5970.7287750751 ) 53.8081535202 (ExtendedPoll) - 2244+108 ( 2 0 4028.5782890972 2 5970.8215646372 ) 53.8052259801 (ExtendedPoll) - 2244+109 ( 2 0 4029.0659874104 2 5970.8447020517 ) 53.8004791353 (ExtendedPoll) - 2244+117 ( 2 0 4029.1224148462 2 5970.8679660822 ) 53.7997469853 (ExtendedPoll) - 2244+125 ( 2 0 4029.1289146169 2 5970.8639709871 ) 53.7997219690 (ExtendedPoll) - 2244+129 ( 2 0 4029.1327113864 2 5970.8636015775 ) 53.7996898997 (ExtendedPoll) - 2244+134 ( 2 0 4029.1345329350 2 5970.8641672091 ) 53.7996679124 (ExtendedPoll) - 2244+136 ( 2 0 4029.1361890843 2 5970.8632210851 ) 53.7996608999 (ExtendedPoll) - 2244+142 ( 2 0 4029.1366590260 2 5970.8631402857 ) 53.7996572423 (ExtendedPoll) - 2244+146 ( 2 0 4029.1368554851 2 5970.8630052034 ) 53.7996566135 (ExtendedPoll) - 2244+147 ( 2 0 4029.1372198865 2 5970.8626976562 ) 53.7996559536 (ExtendedPoll) - 2244+158 ( 2 0 4029.1372434032 2 5970.8627159631 ) 53.7996555720 (ExtendedPoll) - 2244+159 ( 2 0 4029.1372160758 2 5970.8627689341 ) 53.7996553557 (ExtendedPoll) - 2244+165 ( 2 0 4029.1372107574 2 5970.8627828538 ) 53.7996552815 (ExtendedPoll) - 2244+168 ( 2 0 4029.1372020883 2 5970.8627949737 ) 53.7996552545 (ExtendedPoll) - 2244+172 ( 2 0 4029.1371973626 2 5970.8628007338 ) 53.7996552473 (ExtendedPoll) - 2244+179 ( 2 0 4029.1371969852 2 5970.8628025579 ) 53.7996552346 (ExtendedPoll) - 2244+181 ( 2 0 4029.1372006890 2 5970.8627988111 ) 53.7996552334 (ExtendedPoll) - 2244+182 ( 2 0 4029.1372118001 2 5970.8627875709 ) 53.7996552298 (ExtendedPoll) - 2244+183 ( 2 0 4029.1372562449 2 5970.8627426102 ) 53.7996552156 (ExtendedPoll) - 2244+184 ( 2 0 4029.1374340239 2 5970.8625627674 ) 53.7996551585 (ExtendedPoll) - 2244+185 ( 2 0 4029.1381451401 2 5970.8618433959 ) 53.7996549302 (ExtendedPoll) - 2244+186 ( 2 0 4029.1409896047 2 5970.8589659099 ) 53.7996540170 (ExtendedPoll) - 2244+187 ( 2 0 4029.1523674632 2 5970.8474559659 ) 53.7996503647 (ExtendedPoll) - 2244+188 ( 2 0 4029.1978788972 2 5970.8014161900 ) 53.7996357631 (ExtendedPoll) - 2244+189 ( 2 0 4029.3799246331 2 5970.6172570866 ) 53.7995774796 (ExtendedPoll) - 2244+190 ( 2 0 4030.1081075767 2 5969.8806206727 ) 53.7993463077 (ExtendedPoll) - 2244+191 ( 2 0 4033.0208393511 2 5966.9340750174 ) 53.7984530101 (ExtendedPoll) - 2244+192 ( 2 0 4044.6717664489 2 5955.1478923961 ) 53.7953815270 (ExtendedPoll) - 2244+193 ( 2 0 4091.2754748399 2 5908.0031619108 ) 53.7910882360 (ExtendedPoll) - 2244+196 ( 2 0 4091.3024169829 2 5908.0174949293 ) 53.7907097823 (ExtendedPoll) - 2244+197 ( 2 0 4091.3832434122 2 5908.0604939849 ) 53.7895744291 (ExtendedPoll) - 2244+198 ( 2 0 4091.7065491291 2 5908.2324902073 ) 53.7850331320 (ExtendedPoll) - 2244+201 ( 2 0 4091.7062625770 2 5908.2935241345 ) 53.7844786297 (ExtendedPoll) - 2244+218 ( 2 0 4091.7061814853 2 5908.2937483387 ) 53.7844773284 (ExtendedPoll) - 2244+225 ( 2 0 4091.7061774429 2 5908.2938078061 ) 53.7844768227 (ExtendedPoll) - 2244+228 ( 2 0 4091.7061404988 2 5908.2938545806 ) 53.7844767353 (ExtendedPoll) - 2244+237 ( 2 0 4091.7061392073 2 5908.2938580748 ) 53.7844767152 (ExtendedPoll) - 2244+242 ( 2 0 4091.7061402086 2 5908.2938596455 ) 53.7844766917 (ExtendedPoll) - 2494+9 ( 2 0 4996.9428758120 2 5002.4361458373 ) 55.8956087809 (ExtendedPoll) - 2494+10 ( 2 0 4987.7715032480 2 5009.7445833492 ) 55.8775091797 (ExtendedPoll) - 2494+11 ( 2 0 4951.0860129922 2 5038.9783333968 ) 55.8077152532 (ExtendedPoll) - 2494+12 ( 2 0 4804.3440519688 2 5155.9133335874 ) 55.5714059083 (ExtendedPoll) - 2494+13 ( 2 0 4217.3762078751 2 5623.6533343496 ) 55.3875012518 (ExtendedPoll) - 2494+15 ( 2 0 4161.4745084376 2 5735.4567332245 ) 54.7792090326 (ExtendedPoll) - 2494+19 ( 2 0 4301.2287570313 2 5616.6656219199 ) 54.7199123025 (ExtendedPoll) - 2494+25 ( 2 0 4362.3712407911 2 5630.6410467792 ) 54.0447637843 (ExtendedPoll) - 2494+30 ( 2 0 4360.6789041870 2 5638.2565614975 ) 53.9822178137 (ExtendedPoll) - 2494+34 ( 2 0 4357.7855545091 2 5640.8837775966 ) 53.9807745427 (ExtendedPoll) - 2494+35 ( 2 0 4349.1055054753 2 5648.7654258937 ) 53.9766818176 (ExtendedPoll) - 2494+36 ( 2 0 4314.3853093403 2 5680.2920190824 ) 53.9638836443 (ExtendedPoll) - 2494+38 ( 2 0 4293.8589040781 2 5703.8755485326 ) 53.9100589240 (ExtendedPoll) - 2494+44 ( 2 0 4288.6181197559 2 5709.6895436401 ) 53.8988093078 (ExtendedPoll) - 2494+48 ( 2 0 4286.0250233464 2 5712.6101890697 ) 53.8928738710 (ExtendedPoll) - 2494+49 ( 2 0 4278.2457341180 2 5721.3721253585 ) 53.8753278023 (ExtendedPoll) - 2494+58 ( 2 0 4278.6875840983 2 5721.1643151240 ) 53.8734640832 (ExtendedPoll) - 2494+62 ( 2 0 4278.5548371810 2 5721.3692198536 ) 53.8726233086 (ExtendedPoll) - 2494+70 ( 2 0 4278.5803407327 2 5721.3524598889 ) 53.8725625799 (ExtendedPoll) - 2494+71 ( 2 0 4278.6568513877 2 5721.3021799948 ) 53.8723804067 (ExtendedPoll) - 2494+76 ( 2 0 4278.6854324587 2 5721.3128786333 ) 53.8720225267 (ExtendedPoll) - 2494+84 ( 2 0 4278.6872107890 2 5721.3121890539 ) 53.8720135829 (ExtendedPoll) - 2494+86 ( 2 0 4278.6834607716 2 5721.3160673533 ) 53.8720086108 (ExtendedPoll) - 2494+87 ( 2 0 4278.6722107195 2 5721.3277022515 ) 53.8719936947 (ExtendedPoll) - 2494+96 ( 2 0 4278.6723989724 2 5721.3275559496 ) 53.8719934685 (ExtendedPoll) - 2494+98 ( 2 0 4278.6719110434 2 5721.3280214306 ) 53.8719932064 (ExtendedPoll) - 2494+99 ( 2 0 4278.6704472565 2 5721.3294178739 ) 53.8719924200 (ExtendedPoll) - 2494+100 ( 2 0 4278.6645921088 2 5721.3350036468 ) 53.8719892745 (ExtendedPoll) - 2494+101 ( 2 0 4278.6411715181 2 5721.3573467387 ) 53.8719766944 (ExtendedPoll) - 2494+102 ( 2 0 4278.5474891555 2 5721.4467191061 ) 53.8719264022 (ExtendedPoll) - 2494+103 ( 2 0 4278.1727597049 2 5721.8042085755 ) 53.8717256857 (ExtendedPoll) - 2494+104 ( 2 0 4276.6738419026 2 5723.2341664534 ) 53.8709300560 (ExtendedPoll) - 2494+105 ( 2 0 4270.6781706935 2 5728.9539979649 ) 53.8678634044 (ExtendedPoll) - 2494+106 ( 2 0 4246.6954858570 2 5751.8333240110 ) 53.8574561057 (ExtendedPoll) - 2494+107 ( 2 0 4150.7647465111 2 5843.3506281954 ) 53.8459142947 (ExtendedPoll) - 2494+110 ( 2 0 4151.0319463303 2 5843.7593181024 ) 53.8396594450 (ExtendedPoll) - 2494+111 ( 2 0 4151.8335457878 2 5844.9853878233 ) 53.8208980002 (ExtendedPoll) - 2494+112 ( 2 0 4153.3279881922 2 5846.2426983850 ) 53.7955624715 (ExtendedPoll) - 2494+116 ( 2 0 4153.1058903377 2 5846.6776178033 ) 53.7935050825 (ExtendedPoll) - 2494+118 ( 2 0 4152.8591623323 2 5847.0989959699 ) 53.7917987292 (ExtendedPoll) - 2494+127 ( 2 0 4152.8542659569 2 5847.1291180913 ) 53.7915611730 (ExtendedPoll) - 2494+129 ( 2 0 4152.9186835311 2 5847.0716643992 ) 53.7915145196 (ExtendedPoll) - 2494+133 ( 2 0 4152.8895239414 2 5847.1034820926 ) 53.7914812417 (ExtendedPoll) - 2494+138 ( 2 0 4152.8811001224 2 5847.1162049217 ) 53.7914385729 (ExtendedPoll) - 2494+141 ( 2 0 4152.8973868388 2 5847.1020486033 ) 53.7914233161 (ExtendedPoll) - 2494+150 ( 2 0 4152.8955121262 2 5847.1039880394 ) 53.7914221706 (ExtendedPoll) - 2494+151 ( 2 0 4152.8898879885 2 5847.1098063475 ) 53.7914187344 (ExtendedPoll) - 2494+159 ( 2 0 4152.8896638419 2 5847.1102272180 ) 53.7914168283 (ExtendedPoll) - 2494+168 ( 2 0 4152.8897034201 2 5847.1102717856 ) 53.7914160520 (ExtendedPoll) - 2494+172 ( 2 0 4152.8897151731 2 5847.1102626252 ) 53.7914160311 (ExtendedPoll) - 2494+173 ( 2 0 4152.8897504319 2 5847.1102351440 ) 53.7914159684 (ExtendedPoll) - 2494+177 ( 2 0 4152.8897404990 2 5847.1102462518 ) 53.7914159546 (ExtendedPoll) - 2494+178 ( 2 0 4152.8897107004 2 5847.1102795751 ) 53.7914159130 (ExtendedPoll) - 2494+182 ( 2 0 4152.8897044864 2 5847.1102931188 ) 53.7914158426 (ExtendedPoll) - 2494+188 ( 2 0 4152.8897024353 2 5847.1102962286 ) 53.7914158321 (ExtendedPoll) - 2494+193 ( 2 0 4152.8897041880 2 5847.1102955980 ) 53.7914158221 (ExtendedPoll) - 2494+202 ( 2 0 4152.8897041652 2 5847.1102957121 ) 53.7914158212 (ExtendedPoll) - 2494+205 ( 2 0 4152.8897042523 2 5847.1102956349 ) 53.7914158212 (ExtendedPoll) - 2494+206 ( 2 0 4152.8897045137 2 5847.1102954032 ) 53.7914158210 (ExtendedPoll) - 2494+207 ( 2 0 4152.8897048775 2 5847.1102951127 ) 53.7914158204 (ExtendedPoll) - 2761 ( 3 0 3333.3333333249 2 3333.3333333165 1 3333.3333333555 ) 47.1682905221 - 2762 ( 3 0 3333.3333332996 2 3333.3333332658 1 3333.3333334220 ) 47.1682905221 - 2763 ( 3 0 3333.3333331985 2 3333.3333330633 1 3333.3333336880 ) 47.1682905221 - 2764 ( 3 0 3333.3333327939 2 3333.3333322533 1 3333.3333347518 ) 47.1682905219 - 2765 ( 3 0 3333.3333311757 2 3333.3333290134 1 3333.3333390073 ) 47.1682905212 - 2766 ( 3 0 3333.3333247026 2 3333.3333160534 1 3333.3333560290 ) 47.1682905185 - 2767 ( 3 0 3333.3332988105 2 3333.3332642138 1 3333.3334241161 ) 47.1682905075 - 2768 ( 3 0 3333.3331952421 2 3333.3330568551 1 3333.3336964646 ) 47.1682904637 - 2769 ( 3 0 3333.3327809684 2 3333.3322274206 1 3333.3347858583 ) 47.1682902884 - 2770 ( 3 0 3333.3311238738 2 3333.3289096824 1 3333.3391434333 ) 47.1682895873 - 2771 ( 3 0 3333.3244954951 2 3333.3156387294 1 3333.3565737331 ) 47.1682867830 - 2772 ( 3 0 3333.2979819803 2 3333.2625549176 1 3333.4262949324 ) 47.1682755667 - 2773 ( 3 0 3333.1919279212 2 3333.0502196704 1 3333.7051797296 ) 47.1682307194 - 2774 ( 3 0 3332.7677116849 2 3332.2008786818 1 3334.8207189184 ) 47.1680516124 - 2775 ( 3 0 3331.0708467397 2 3328.8035147270 1 3339.2828756735 ) 47.1673397044 - 2776 ( 3 0 3324.2833869587 2 3315.2140589080 1 3357.1315026938 ) 47.1645644377 - 2777 ( 3 0 3297.1335478348 2 3260.8562356320 1 3428.5260107754 ) 47.1546240959 - 2778 ( 3 0 3188.5341913391 2 3043.4249425281 1 3714.1040431015 ) 47.1336301248 - 2783 ( 3 0 3188.5440963277 2 3043.4291749044 1 3714.1116982164 ) 47.1334189419 - 2784 ( 3 0 3188.5738112936 2 3043.4418720333 1 3714.1346635611 ) 47.1327853954 - 2785 ( 3 0 3188.6926711573 2 3043.4926605491 1 3714.2265249397 ) 47.1302512441 - 2786 ( 3 0 3189.1681106120 2 3043.6958146122 1 3714.5939704540 ) 47.1201151932 - 2787 ( 3 0 3191.0698684310 2 3044.5084308647 1 3716.0637525116 ) 47.0795798665 - 2788 ( 3 0 3198.6768997067 2 3047.7588958743 1 3721.9428807416 ) 46.9175811367 - 2789 ( 3 0 3198.8948848743 2 3047.5863280381 1 3722.3442473958 ) 46.9131329647 - 2790 ( 3 0 3199.5488403769 2 3047.0686245294 1 3723.5483473581 ) 46.8997895433 - 2791 ( 3 0 3202.1646623876 2 3044.9978104945 1 3728.3647472073 ) 46.8464322782 - 2792 ( 3 0 3212.6279504301 2 3036.7145543550 1 3747.6303466044 ) 46.6332660653 - 2797+6 ( 2 0 4900.6584516792 2 5075.3512624213 ) 55.7642295241 (ExtendedPoll) - 2797+7 ( 2 0 4607.1745296323 2 5305.9457726010 ) 55.4472050367 (ExtendedPoll) - 2797+13 ( 2 0 4509.3465556167 2 5389.7983217572 ) 55.3312037272 (ExtendedPoll) - 2797+14 ( 2 0 4215.8626335698 2 5641.3559692260 ) 55.2227885943 (ExtendedPoll) - 2797+16 ( 2 0 3880.4524369449 2 6088.5695647259 ) 54.1867250496 (ExtendedPoll) - 2797+25 ( 2 0 3865.6035480318 2 6116.0836824178 ) 54.0994049526 (ExtendedPoll) - 2797+30 ( 2 0 3858.1791035753 2 6129.8407412638 ) 54.0570067200 (ExtendedPoll) - 2797+35 ( 2 0 3865.9856885553 2 6129.2948262302 ) 53.9862513494 (ExtendedPoll) - 2797+41 ( 2 0 3867.9219809400 2 6129.0355165892 ) 53.9697415456 (ExtendedPoll) - 2797+42 ( 2 0 3871.2247668931 2 6126.9473915858 ) 53.9552082161 (ExtendedPoll) - 2797+47 ( 2 0 3872.9461052333 2 6126.0261599667 ) 53.9462662728 (ExtendedPoll) - 2797+51 ( 2 0 3873.9223548519 2 6126.0547352067 ) 53.9366367060 (ExtendedPoll) - 2797+63 ( 2 0 3873.9150839053 2 6126.0681502590 ) 53.9365956057 (ExtendedPoll) - 2797+64 ( 2 0 3873.9023656577 2 6126.0958912493 ) 53.9364883221 (ExtendedPoll) - 2797+71 ( 2 0 3873.8992381518 2 6126.1002869850 ) 53.9364820231 (ExtendedPoll) - 2797+82 ( 2 0 3873.8993365564 2 6126.1005041485 ) 53.9364792786 (ExtendedPoll) - 2797+86 ( 2 0 3873.8994440785 2 6126.1004526718 ) 53.9364786703 (ExtendedPoll) - 2797+89 ( 2 0 3873.8995441434 2 6126.1003878808 ) 53.9364782440 (ExtendedPoll) - 2797+90 ( 2 0 3873.8997141999 2 6126.1002207754 ) 53.9364779912 (ExtendedPoll) - 2797+91 ( 2 0 3873.9002243693 2 6126.0997194591 ) 53.9364772329 (ExtendedPoll) - 2797+92 ( 2 0 3873.9022650468 2 6126.0977141941 ) 53.9364741996 (ExtendedPoll) - 2797+99 ( 2 0 3873.9023564295 2 6126.0976376432 ) 53.9364739541 (ExtendedPoll) - 2797+108 ( 2 0 3873.9023666523 2 6126.0976268016 ) 53.9364739455 (ExtendedPoll) - 2797+109 ( 2 0 3873.9023973206 2 6126.0975942769 ) 53.9364739197 (ExtendedPoll) - 2797+110 ( 2 0 3873.9025199938 2 6126.0974641781 ) 53.9364738164 (ExtendedPoll) - 2797+111 ( 2 0 3873.9030106867 2 6126.0969437827 ) 53.9364734034 (ExtendedPoll) - 2797+112 ( 2 0 3873.9049734581 2 6126.0948622015 ) 53.9364717515 (ExtendedPoll) - 2797+113 ( 2 0 3873.9128245438 2 6126.0865358764 ) 53.9364651438 (ExtendedPoll) - 2797+114 ( 2 0 3873.9442288869 2 6126.0532305760 ) 53.9364387171 (ExtendedPoll) - 2797+115 ( 2 0 3874.0698462589 2 6125.9200093744 ) 53.9363330745 (ExtendedPoll) - 2797+116 ( 2 0 3874.5723157471 2 6125.3871245682 ) 53.9359115277 (ExtendedPoll) - 2797+117 ( 2 0 3876.5821937000 2 6123.2555853431 ) 53.9342417174 (ExtendedPoll) - 2797+118 ( 2 0 3884.6217055116 2 6114.7294284431 ) 53.9278243645 (ExtendedPoll) - 2797+119 ( 2 0 3916.7797527577 2 6080.6248008429 ) 53.9063357782 (ExtendedPoll) - 2797+120 ( 2 0 4045.4119417422 2 5944.2062904420 ) 53.8866188839 (ExtendedPoll) - 2797+123 ( 2 0 4045.5215045970 2 5944.2601089211 ) 53.8851192623 (ExtendedPoll) - 2797+124 ( 2 0 4045.8501931615 2 5944.4215643586 ) 53.8806205222 (ExtendedPoll) - 2797+125 ( 2 0 4047.1649474193 2 5945.0673861082 ) 53.8626274298 (ExtendedPoll) - 2797+126 ( 2 0 4048.1386380613 2 5945.1403169447 ) 53.8529449201 (ExtendedPoll) - 2797+127 ( 2 0 4051.0597099870 2 5945.3591094543 ) 53.8239051878 (ExtendedPoll) - 2797+130 ( 2 0 4052.9055851942 2 5944.7227772433 ) 53.8125206018 (ExtendedPoll) - 2797+135 ( 2 0 4053.8541125651 2 5944.9547911326 ) 53.8016493716 (ExtendedPoll) - 2797+138 ( 2 0 4054.7420774868 2 5944.5483403302 ) 53.7970783073 (ExtendedPoll) - 2797+144 ( 2 0 4055.1565250914 2 5944.8064771068 ) 53.7909201097 (ExtendedPoll) - 2797+153 ( 2 0 4055.1705529195 2 5944.8124812684 ) 53.7907362425 (ExtendedPoll) - 2797+158 ( 2 0 4055.1759264999 2 5944.8178972016 ) 53.7906378043 (ExtendedPoll) - 2797+159 ( 2 0 4055.1662131965 2 5944.8296651001 ) 53.7906219881 (ExtendedPoll) - 2797+163 ( 2 0 4055.1612269352 2 5944.8354395879 ) 53.7906162644 (ExtendedPoll) - 2797+164 ( 2 0 4055.1462681513 2 5944.8527630512 ) 53.7905990941 (ExtendedPoll) - 2797+170 ( 2 0 4055.1439936051 2 5944.8558254594 ) 53.7905926341 (ExtendedPoll) - 2797+176 ( 2 0 4055.1459887350 2 5944.8540101306 ) 53.7905904735 (ExtendedPoll) - 2797+198 ( 2 0 4055.1459891780 2 5944.8540106179 ) 53.7905904650 (ExtendedPoll) - 2797+200 ( 2 0 4055.1459895782 2 5944.8540103798 ) 53.7905904635 (ExtendedPoll) - 2797+211 ( 2 0 4055.1459895943 2 5944.8540104040 ) 53.7905904631 (ExtendedPoll) - 3014 ( 3 0 3210.5286604494 2 3038.4216692843 1 3750.4447793258 ) 46.6015154107 - 3019+6 ( 2 0 4692.2382076236 2 5223.3043522798 ) 55.6902400114 (ExtendedPoll) - 3019+14 ( 2 0 4751.6337632759 2 5242.5205614614 ) 54.9900785314 (ExtendedPoll) - 3019+23 ( 2 0 4744.8371211080 2 5251.2279062468 ) 54.9451839171 (ExtendedPoll) - 3019+24 ( 2 0 4735.4473825306 2 5263.6747690122 ) 54.8789033947 (ExtendedPoll) - 3019+33 ( 2 0 4734.9854872326 2 5264.5350116862 ) 54.8728327514 (ExtendedPoll) - 3019+34 ( 2 0 4733.7844741588 2 5266.0755156716 ) 54.8649914704 (ExtendedPoll) - 3019+39 ( 2 0 4733.0120896855 2 5266.6730367357 ) 54.8644320425 (ExtendedPoll) - 3019+40 ( 2 0 4730.6949362657 2 5268.4655999279 ) 54.8627657851 (ExtendedPoll) - 3019+41 ( 2 0 4721.4263225864 2 5275.6358526969 ) 54.8562814361 (ExtendedPoll) - 3019+42 ( 2 0 4684.3518678691 2 5304.3168637731 ) 54.8332529571 (ExtendedPoll) - 3019+43 ( 2 0 4536.0540490000 2 5419.0409080777 ) 54.7888275928 (ExtendedPoll) - 3019+46 ( 2 0 4533.8703888657 2 5450.0488819844 ) 54.4714998393 (ExtendedPoll) - 3019+49 ( 2 0 4509.4133953618 2 5469.7018231929 ) 54.4660067399 (ExtendedPoll) - 3019+50 ( 2 0 4436.0424148501 2 5528.6606468184 ) 54.4633610125 (ExtendedPoll) - 3019+53 ( 2 0 4390.6222840571 2 5570.5869213965 ) 54.4160608763 (ExtendedPoll) - 3019+54 ( 2 0 4254.3618916782 2 5696.3657451309 ) 54.3333134172 (ExtendedPoll) - 3019+58 ( 2 0 4163.5216300923 2 5787.2060067168 ) 54.2619287838 (ExtendedPoll) - 3019+64 ( 2 0 4151.2931333404 2 5848.3484904766 ) 53.7943165716 (ExtendedPoll) - 3019+80 ( 2 0 4151.1660641526 2 5848.5569671112 ) 53.7935193903 (ExtendedPoll) - 3019+81 ( 2 0 4150.7848565894 2 5849.1823970151 ) 53.7911289956 (ExtendedPoll) - 3019+86 ( 2 0 4150.6155109737 2 5849.3582466966 ) 53.7910215159 (ExtendedPoll) - 3019+87 ( 2 0 4150.1074741268 2 5849.8857957410 ) 53.7907001042 (ExtendedPoll) - 3019+102 ( 2 0 4150.1089861817 2 5849.8869583539 ) 53.7906755049 (ExtendedPoll) - 3019+103 ( 2 0 4150.1127107275 2 5849.8861339310 ) 53.7906493993 (ExtendedPoll) - 3019+107 ( 2 0 4150.1143060889 2 5849.8850885612 ) 53.7906446904 (ExtendedPoll) - 3019+108 ( 2 0 4150.1171485655 2 5849.8825445004 ) 53.7906426731 (ExtendedPoll) - 3019+114 ( 2 0 4150.1178834653 2 5849.8819367039 ) 53.7906416845 (ExtendedPoll) - 3019+125 ( 2 0 4150.1179323692 2 5849.8819026286 ) 53.7906415591 (ExtendedPoll) - 3019+126 ( 2 0 4150.1180790807 2 5849.8818004026 ) 53.7906411831 (ExtendedPoll) - 3019+127 ( 2 0 4150.1182616331 2 5849.8816470466 ) 53.7906409597 (ExtendedPoll) - 3019+128 ( 2 0 4150.1188092902 2 5849.8811869788 ) 53.7906402897 (ExtendedPoll) - 3019+142 ( 2 0 4150.1188123412 2 5849.8811848413 ) 53.7906402820 (ExtendedPoll) - 3019+143 ( 2 0 4150.1188214943 2 5849.8811784287 ) 53.7906402588 (ExtendedPoll) - 3019+153 ( 2 0 4150.1188216858 2 5849.8811782962 ) 53.7906402583 (ExtendedPoll) - 3181+18 ( 2 0 4999.8309411913 2 5000.1672333819 ) 55.9009656850 (ExtendedPoll) - 3181+20 ( 2 0 4999.4491205399 2 5000.4715383635 ) 55.9002031428 (ExtendedPoll) - 3181+21 ( 2 0 4998.3036585857 2 5001.3844533083 ) 55.8979182003 (ExtendedPoll) - 3181+22 ( 2 0 4993.7218107688 2 5005.0361130876 ) 55.8888187275 (ExtendedPoll) - 3181+23 ( 2 0 4975.3944195012 2 5019.6427522045 ) 55.8530679233 (ExtendedPoll) - 3181+24 ( 2 0 4902.0848544307 2 5078.0693086723 ) 55.7205670458 (ExtendedPoll) - 3181+25 ( 2 0 4608.8465941490 2 5311.7755345433 ) 55.3681229992 (ExtendedPoll) - 3181+27 ( 2 0 4583.9528686182 2 5330.5550116980 ) 55.3637996156 (ExtendedPoll) - 3181+28 ( 2 0 4509.2716920260 2 5386.8934431624 ) 55.3635911500 (ExtendedPoll) - 3181+30 ( 2 0 4432.4068552994 2 5484.7214171780 ) 54.9584061960 (ExtendedPoll) - 3181+31 ( 2 0 4201.8123451197 2 5778.2053392249 ) 54.0036331278 (ExtendedPoll) - 3181+43 ( 2 0 4200.8569938110 2 5785.9573327015 ) 53.9378132020 (ExtendedPoll) - 3181+44 ( 2 0 4192.2315362806 2 5799.0592935072 ) 53.8900546358 (ExtendedPoll) - 3181+52 ( 2 0 4194.7836890625 2 5802.0140586264 ) 53.8389301385 (ExtendedPoll) - 3181+54 ( 2 0 4192.4430783561 2 5805.1394221936 ) 53.8302201837 (ExtendedPoll) - 3181+55 ( 2 0 4185.4212462368 2 5814.5155128951 ) 53.8043694686 (ExtendedPoll) - 3181+71 ( 2 0 4185.4407963358 2 5814.5389460247 ) 53.8039710219 (ExtendedPoll) - 3181+77 ( 2 0 4185.4480076188 2 5814.5364550417 ) 53.8039296544 (ExtendedPoll) - 3181+78 ( 2 0 4185.4696414679 2 5814.5289820924 ) 53.8038055528 (ExtendedPoll) - 3181+81 ( 2 0 4185.4807342197 2 5814.5185044072 ) 53.8038049529 (ExtendedPoll) - 3181+90 ( 2 0 4185.4816714853 2 5814.5183282598 ) 53.8037981763 (ExtendedPoll) - 3181+108 ( 2 0 4185.4816706336 2 5814.5183292645 ) 53.8037981745 (ExtendedPoll) - 3181+112 ( 2 0 4185.4816710094 2 5814.5183289895 ) 53.8037981737 (ExtendedPoll) - 3304+6 ( 2 0 4901.8695805142 2 5076.5623912563 ) 55.7402643064 (ExtendedPoll) - 3304+7 ( 2 0 4608.3856584673 2 5307.1569014360 ) 55.4236611469 (ExtendedPoll) - 3304+15 ( 2 0 4606.6387303599 2 5338.1648753428 ) 55.0917439291 (ExtendedPoll) - 3304+16 ( 2 0 4589.1694492857 2 5397.5604309951 ) 54.5804183615 (ExtendedPoll) - 3304+22 ( 2 0 4562.9655276744 2 5433.3724571972 ) 54.4082368778 (ExtendedPoll) - 3304+23 ( 2 0 4514.0515406666 2 5471.8048755605 ) 54.4043973012 (ExtendedPoll) - 3304+30 ( 2 0 4527.6994165058 2 5464.1620650905 ) 54.3714868324 (ExtendedPoll) - 3304+37 ( 2 0 4526.1776783497 2 5467.7582803742 ) 54.3456878637 (ExtendedPoll) - 3304+38 ( 2 0 4521.0733727858 2 5473.6814584884 ) 54.3251632561 (ExtendedPoll) - 3304+39 ( 2 0 4505.7604560942 2 5491.4509928311 ) 54.2645642604 (ExtendedPoll) - 3304+43 ( 2 0 4501.4477273290 2 5497.9746774822 ) 54.2316163720 (ExtendedPoll) - 3304+45 ( 2 0 4495.7156194766 2 5503.2973490595 ) 54.2235944245 (ExtendedPoll) - 3304+46 ( 2 0 4478.5192959191 2 5519.2653637914 ) 54.2004433791 (ExtendedPoll) - 3304+47 ( 2 0 4409.7340016894 2 5583.1374227190 ) 54.1217038236 (ExtendedPoll) - 3304+48 ( 2 0 4134.5928247705 2 5838.6256584295 ) 54.0371198163 (ExtendedPoll) - 3304+50 ( 2 0 4057.7279880439 2 5936.4536324451 ) 53.8423122971 (ExtendedPoll) - 3304+55 ( 2 0 4036.3281187280 2 5959.1636978416 ) 53.8369788559 (ExtendedPoll) - 3304+63 ( 2 0 4033.2436987883 2 5966.3424805330 ) 53.8016467560 (ExtendedPoll) - 3304+73 ( 2 0 4033.3453648009 2 5966.5644451074 ) 53.7987246325 (ExtendedPoll) - 3304+77 ( 2 0 4033.4533282953 2 5966.5074812194 ) 53.7982274597 (ExtendedPoll) - 3304+84 ( 2 0 4033.4322917074 2 5966.5295898786 ) 53.7982263075 (ExtendedPoll) - 3304+85 ( 2 0 4033.3691819436 2 5966.5959158563 ) 53.7982228672 (ExtendedPoll) - 3304+86 ( 2 0 4033.1167428886 2 5966.8612197669 ) 53.7982093544 (ExtendedPoll) - 3304+94 ( 2 0 4033.1071823367 2 5966.8731120948 ) 53.7981924297 (ExtendedPoll) - 3304+95 ( 2 0 4033.0785006809 2 5966.9087890783 ) 53.7981416597 (ExtendedPoll) - 3304+100 ( 2 0 4033.0925954613 2 5966.9029438115 ) 53.7980625663 (ExtendedPoll) - 3304+105 ( 2 0 4033.0991795212 2 5966.8990892331 ) 53.7980356267 (ExtendedPoll) - 3304+115 ( 2 0 4033.0989658428 2 5966.8995155138 ) 53.7980338197 (ExtendedPoll) - 3304+116 ( 2 0 4033.0983248077 2 5966.9007943557 ) 53.7980283990 (ExtendedPoll) - 3304+119 ( 2 0 4033.0980226539 2 5966.9016988988 ) 53.7980231575 (ExtendedPoll) - 3304+127 ( 2 0 4033.0981418065 2 5966.9016952224 ) 53.7980220818 (ExtendedPoll) - 3304+129 ( 2 0 4033.0982490223 2 5966.9016431107 ) 53.7980215482 (ExtendedPoll) - 3304+133 ( 2 0 4033.0983032868 2 5966.9016184516 ) 53.7980212629 (ExtendedPoll) - 3304+134 ( 2 0 4033.0983898253 2 5966.9015364642 ) 53.7980211876 (ExtendedPoll) - 3304+135 ( 2 0 4033.0986494409 2 5966.9012905019 ) 53.7980209620 (ExtendedPoll) - 3304+136 ( 2 0 4033.0996879031 2 5966.9003066526 ) 53.7980200592 (ExtendedPoll) - 3304+144 ( 2 0 4033.0996674107 2 5966.9003282915 ) 53.7980200572 (ExtendedPoll) - 3304+145 ( 2 0 4033.0996059334 2 5966.9003932080 ) 53.7980200513 (ExtendedPoll) - 3304+160 ( 2 0 4033.0996058034 2 5966.9003936551 ) 53.7980200485 (ExtendedPoll) - 3304+167 ( 2 0 4033.0996061081 2 5966.9003937799 ) 53.7980200446 (ExtendedPoll) - 3304+171 ( 2 0 4033.0996062242 2 5966.9003937721 ) 53.7980200436 (ExtendedPoll) - 3483 ( 3 0 3210.2889578675 2 3039.3458759311 1 3750.2389595149 ) 46.5961289316 - 3488+3 ( 2 0 4552.7233011568 2 5335.3470932817 ) 55.5692389089 (ExtendedPoll) - 3488+7 ( 2 0 4440.9199022818 2 5558.9538910317 ) 54.1048755479 (ExtendedPoll) - 3488+29 ( 2 0 4440.9496420561 2 5559.0071913847 ) 54.1040659660 (ExtendedPoll) - 3488+33 ( 2 0 4440.9365610370 2 5559.0347632759 ) 54.1038907469 (ExtendedPoll) - 3488+34 ( 2 0 4440.8905377740 2 5559.0748522452 ) 54.1038670525 (ExtendedPoll) - 3488+35 ( 2 0 4440.7524679852 2 5559.1951191530 ) 54.1037960247 (ExtendedPoll) - 3488+36 ( 2 0 4440.2001888298 2 5559.6761867843 ) 54.1035127440 (ExtendedPoll) - 3488+37 ( 2 0 4437.9910722084 2 5561.6004573097 ) 54.1023929098 (ExtendedPoll) - 3488+38 ( 2 0 4429.1546057226 2 5569.2975394109 ) 54.0981264568 (ExtendedPoll) - 3488+39 ( 2 0 4393.8087397796 2 5600.0858678158 ) 54.0844835555 (ExtendedPoll) - 3488+42 ( 2 0 4394.2113521169 2 5603.9686884921 ) 54.0411680120 (ExtendedPoll) - 3488+43 ( 2 0 4388.9432720429 2 5609.7553878479 ) 54.0274056417 (ExtendedPoll) - 3488+48 ( 2 0 4388.0032745945 2 5611.4664902813 ) 54.0180260116 (ExtendedPoll) - 3488+51 ( 2 0 4386.7886136448 2 5612.9967583598 ) 54.0128824739 (ExtendedPoll) - 3488+57 ( 2 0 4386.4467770046 2 5613.3454189378 ) 54.0122750804 (ExtendedPoll) - 3488+58 ( 2 0 4385.4212670842 2 5614.3914006721 ) 54.0104567213 (ExtendedPoll) - 3488+59 ( 2 0 4381.3192274022 2 5618.5753276090 ) 54.0032406382 (ExtendedPoll) - 3488+62 ( 2 0 4380.5784036418 2 5619.2116598200 ) 54.0031640007 (ExtendedPoll) - 3488+63 ( 2 0 4378.3559323606 2 5621.1206564531 ) 54.0029484717 (ExtendedPoll) - 3488+64 ( 2 0 4369.4660472359 2 5628.7566429851 ) 54.0023023644 (ExtendedPoll) - 3488+72 ( 2 0 4369.5969815447 2 5629.7243626813 ) 53.9913292971 (ExtendedPoll) - 3488+75 ( 2 0 4369.6824940167 2 5630.2051304326 ) 53.9857012024 (ExtendedPoll) - 3488+82 ( 2 0 4369.6472614388 2 5630.3220036975 ) 53.9848193694 (ExtendedPoll) - 3488+85 ( 2 0 4369.6050333250 2 5630.3660727419 ) 53.9847380922 (ExtendedPoll) - 3488+86 ( 2 0 4369.4783489833 2 5630.4982798750 ) 53.9844943213 (ExtendedPoll) - 3488+87 ( 2 0 4368.9716116168 2 5631.0271084078 ) 53.9835201449 (ExtendedPoll) - 3488+91 ( 2 0 4368.8845997443 2 5631.1127275039 ) 53.9834056991 (ExtendedPoll) - 3488+92 ( 2 0 4368.6235641269 2 5631.3695847921 ) 53.9830625988 (ExtendedPoll) - 3488+93 ( 2 0 4367.5794216571 2 5632.3970139452 ) 53.9816937566 (ExtendedPoll) - 3488+94 ( 2 0 4363.4028517782 2 5636.5067305573 ) 53.9762753650 (ExtendedPoll) - 3488+95 ( 2 0 4346.6965722627 2 5652.9455970056 ) 53.9555155106 (ExtendedPoll) - 3488+96 ( 2 0 4279.8714542003 2 5718.7010627990 ) 53.8872266051 (ExtendedPoll) - 3488+97 ( 2 0 4012.5709819511 2 5981.7229259727 ) 53.8578815474 (ExtendedPoll) - 3488+99 ( 2 0 4003.8363414140 2 5994.7157037717 ) 53.8249871296 (ExtendedPoll) - 3488+107 ( 2 0 4003.0106449257 2 5996.4848096773 ) 53.8171655728 (ExtendedPoll) - 3488+110 ( 2 0 4002.3593853505 2 5997.2124120580 ) 53.8168706752 (ExtendedPoll) - 3488+111 ( 2 0 4000.4056066249 2 5999.3952192000 ) 53.8160033453 (ExtendedPoll) - 3488+119 ( 2 0 4000.3383801740 2 5999.4971117887 ) 53.8157389067 (ExtendedPoll) - 3488+120 ( 2 0 4000.1367008212 2 5999.8027895547 ) 53.8149458834 (ExtendedPoll) - 3488+126 ( 2 0 4000.1340485485 2 5999.8637668378 ) 53.8144356991 (ExtendedPoll) - 3488+134 ( 2 0 4000.1293216626 2 5999.8697555108 ) 53.8144274351 (ExtendedPoll) - 3488+142 ( 2 0 4000.1301279381 2 5999.8692461828 ) 53.8144243508 (ExtendedPoll) - 3488+146 ( 2 0 4000.1294111560 2 5999.8703886418 ) 53.8144210416 (ExtendedPoll) - 3488+148 ( 2 0 4000.1312576800 2 5999.8684223480 ) 53.8144209958 (ExtendedPoll) - 3488+149 ( 2 0 4000.1367972520 2 5999.8625234666 ) 53.8144208588 (ExtendedPoll) - 3488+150 ( 2 0 4000.1589555398 2 5999.8389279410 ) 53.8144203127 (ExtendedPoll) - 3488+151 ( 2 0 4000.2475886910 2 5999.7445458387 ) 53.8144181595 (ExtendedPoll) - 3488+152 ( 2 0 4000.6021212960 2 5999.3670174292 ) 53.8144100483 (ExtendedPoll) - 3488+153 ( 2 0 4002.0202517159 2 5997.8569037914 ) 53.8143856278 (ExtendedPoll) - 3488+155 ( 2 0 4002.1422495983 2 5997.8527654463 ) 53.8132795659 (ExtendedPoll) - 3488+164 ( 2 0 4002.1489902101 2 5997.8491916670 ) 53.8132478315 (ExtendedPoll) - 3488+169 ( 2 0 4002.1460036830 2 5997.8536843822 ) 53.8132363424 (ExtendedPoll) - 3488+176 ( 2 0 4002.1464898557 2 5997.8532170669 ) 53.8132358938 (ExtendedPoll) - 3488+177 ( 2 0 4002.1479483737 2 5997.8518151211 ) 53.8132345481 (ExtendedPoll) - 3488+178 ( 2 0 4002.1537824458 2 5997.8462073379 ) 53.8132291653 (ExtendedPoll) - 3488+194 ( 2 0 4002.1537952967 2 5997.8461997948 ) 53.8132291112 (ExtendedPoll) - 3488+205 ( 2 0 4002.1537979211 2 5997.8462000219 ) 53.8132290846 (ExtendedPoll) - 3488+207 ( 2 0 4002.1537995406 2 5997.8461991017 ) 53.8132290775 (ExtendedPoll) - 3488+208 ( 2 0 4002.1538022459 2 5997.8461965406 ) 53.8132290747 (ExtendedPoll) - 3488+209 ( 2 0 4002.1538103616 2 5997.8461888572 ) 53.8132290662 (ExtendedPoll) - 3488+218 ( 2 0 4002.1538099327 2 5997.8461896839 ) 53.8132290629 (ExtendedPoll) - 3488+226 ( 2 0 4002.1538099976 2 5997.8461897805 ) 53.8132290615 (ExtendedPoll) - 3488+229 ( 2 0 4002.1538101107 2 5997.8461898084 ) 53.8132290602 (ExtendedPoll) - 3488+234 ( 2 0 4002.1538101371 2 5997.8461898603 ) 53.8132290595 (ExtendedPoll) - 3729+22 ( 2 0 4999.8953615990 2 4999.9816204393 ) 55.9027305088 (ExtendedPoll) - 3729+23 ( 2 0 4999.7707564260 2 5000.1157917870 ) 55.9020567360 (ExtendedPoll) - 3729+24 ( 2 0 4999.2723357338 2 5000.6524771780 ) 55.8993623523 (ExtendedPoll) - 3729+27 ( 2 0 4999.1349773271 2 5000.8543164668 ) 55.8979629118 (ExtendedPoll) - 3729+34 ( 2 0 4999.0739417340 2 5000.9153520600 ) 55.8976901754 (ExtendedPoll) - 3729+35 ( 2 0 4998.8908349545 2 5001.0984588395 ) 55.8968720583 (ExtendedPoll) - 3729+36 ( 2 0 4998.1584078364 2 5001.8308859575 ) 55.8936009704 (ExtendedPoll) - 3729+37 ( 2 0 4995.2286993643 2 5004.7605944297 ) 55.8805387184 (ExtendedPoll) - 3729+38 ( 2 0 4983.5098654757 2 5016.4794283182 ) 55.8286442151 (ExtendedPoll) - 3729+39 ( 2 0 4936.6345299214 2 5063.3547638726 ) 55.6267962813 (ExtendedPoll) - 3729+40 ( 2 0 4749.1331877041 2 5250.8561060898 ) 54.9147822323 (ExtendedPoll) - 3729+41 ( 2 0 3999.1278188349 2 6000.8614749590 ) 53.8151109452 (ExtendedPoll) - 3729+58 ( 2 0 3999.1207593662 2 6000.8750024663 ) 53.8150584528 (ExtendedPoll) - 3729+65 ( 2 0 3999.1195214058 2 6000.8764534763 ) 53.8150573268 (ExtendedPoll) - 3729+66 ( 2 0 3999.1158075247 2 6000.8808065061 ) 53.8150539489 (ExtendedPoll) - 3729+67 ( 2 0 3999.1009520003 2 6000.8982186254 ) 53.8150404383 (ExtendedPoll) - 3729+77 ( 2 0 3999.1012090993 2 6000.8986202144 ) 53.8150345073 (ExtendedPoll) - 3729+84 ( 2 0 3999.1012443818 2 6000.8986682546 ) 53.8150337554 (ExtendedPoll) - 3729+85 ( 2 0 3999.1011692098 2 6000.8987607750 ) 53.8150336483 (ExtendedPoll) - 3729+86 ( 2 0 3999.1009436941 2 6000.8990383364 ) 53.8150333272 (ExtendedPoll) - 3729+96 ( 2 0 3999.1009378077 2 6000.8990520256 ) 53.8150332623 (ExtendedPoll) - 3729+100 ( 2 0 3999.1009370763 2 6000.8990594402 ) 53.8150332041 (ExtendedPoll) - 3729+103 ( 2 0 3999.1009434424 2 6000.8990555693 ) 53.8150331784 (ExtendedPoll) - 3729+109 ( 2 0 3999.1009426080 2 6000.8990572346 ) 53.8150331716 (ExtendedPoll) - 3729+113 ( 2 0 3999.1009445289 2 6000.8990554321 ) 53.8150331694 (ExtendedPoll) - 3857+21 ( 2 0 4999.7695768976 2 5000.1146922267 ) 55.9020792324 (ExtendedPoll) - 3857+22 ( 2 0 4999.2676176204 2 5000.6480789368 ) 55.8994523349 (ExtendedPoll) - 3857+26 ( 2 0 4999.0614867145 2 5000.9250615107 ) 55.8976679710 (ExtendedPoll) - 3857+37 ( 2 0 4999.0655499855 2 5000.9315188764 ) 55.8975579561 (ExtendedPoll) - 3857+39 ( 2 0 4999.0601491243 2 5000.9369076070 ) 55.8975339712 (ExtendedPoll) - 3857+40 ( 2 0 4999.0439465409 2 5000.9530737988 ) 55.8974620175 (ExtendedPoll) - 3857+41 ( 2 0 4998.9791362072 2 5001.0177385657 ) 55.8971742134 (ExtendedPoll) - 3857+42 ( 2 0 4998.7198948722 2 5001.2763976335 ) 55.8960231692 (ExtendedPoll) - 3857+43 ( 2 0 4997.6829295325 2 5002.3110339045 ) 55.8914217511 (ExtendedPoll) - 3857+44 ( 2 0 4993.5350681737 2 5006.4495789887 ) 55.8730602592 (ExtendedPoll) - 3857+45 ( 2 0 4976.9436227384 2 5023.0037593255 ) 55.8003237383 (ExtendedPoll) - 3857+46 ( 2 0 4910.5778409973 2 5089.2204806727 ) 55.5208926377 (ExtendedPoll) - 3857+47 ( 2 0 4645.1147140329 2 5354.0873660614 ) 54.5978092091 (ExtendedPoll) - 3857+49 ( 2 0 4641.9961744036 2 5356.4416246436 ) 54.5973154410 (ExtendedPoll) - 3857+50 ( 2 0 4632.6405555159 2 5363.5044003904 ) 54.5960322314 (ExtendedPoll) - 3857+51 ( 2 0 4595.2180799647 2 5391.7555033777 ) 54.5938886963 (ExtendedPoll) - 3857+54 ( 2 0 4589.5405636156 2 5406.2768432706 ) 54.4819217775 (ExtendedPoll) - 3857+59 ( 2 0 4586.8655799511 2 5409.1224253831 ) 54.4730509300 (ExtendedPoll) - 3857+60 ( 2 0 4578.8406289576 2 5417.6591717205 ) 54.4466693127 (ExtendedPoll) - 3857+61 ( 2 0 4546.7408249837 2 5451.8061570703 ) 54.3446263871 (ExtendedPoll) - 3857+67 ( 2 0 4544.4002142773 2 5454.9315206375 ) 54.3305581908 (ExtendedPoll) - 3857+70 ( 2 0 4543.3834475273 2 5456.5982674743 ) 54.3211315639 (ExtendedPoll) - 3857+84 ( 2 0 4543.3817833230 2 5456.6057131428 ) 54.3210653441 (ExtendedPoll) - 3857+87 ( 2 0 4543.3799196151 2 5456.6131114083 ) 54.3210013080 (ExtendedPoll) - 3857+88 ( 2 0 4543.3724892530 2 5456.6264388915 ) 54.3209201075 (ExtendedPoll) - 3857+99 ( 2 0 4543.3733273061 2 5456.6259837410 ) 54.3209179808 (ExtendedPoll) - 3857+101 ( 2 0 4543.3714783336 2 5456.6279477327 ) 54.3209123378 (ExtendedPoll) - 3857+102 ( 2 0 4543.3659314160 2 5456.6338397077 ) 54.3208954091 (ExtendedPoll) - 3857+112 ( 2 0 4543.3658531448 2 5456.6339296214 ) 54.3208950973 (ExtendedPoll) - 3857+113 ( 2 0 4543.3656183312 2 5456.6341993626 ) 54.3208941618 (ExtendedPoll) - 3857+114 ( 2 0 4543.3646790771 2 5456.6352783273 ) 54.3208904201 (ExtendedPoll) - 3857+118 ( 2 0 4543.3645278465 2 5456.6354626442 ) 54.3208897035 (ExtendedPoll) - 3857+127 ( 2 0 4543.3645352524 2 5456.6354634587 ) 54.3208896327 (ExtendedPoll) - 3857+131 ( 2 0 4543.3645324236 2 5456.6354658827 ) 54.3208896303 (ExtendedPoll) - 3857+132 ( 2 0 4543.3645239373 2 5456.6354731547 ) 54.3208896231 (ExtendedPoll) - 3857+133 ( 2 0 4543.3644899919 2 5456.6355022427 ) 54.3208895946 (ExtendedPoll) - 3857+134 ( 2 0 4543.3643542104 2 5456.6356185947 ) 54.3208894804 (ExtendedPoll) - 3857+135 ( 2 0 4543.3638110842 2 5456.6360840029 ) 54.3208890235 (ExtendedPoll) - 3857+136 ( 2 0 4543.3616385797 2 5456.6379456356 ) 54.3208871959 (ExtendedPoll) - 3857+137 ( 2 0 4543.3529485614 2 5456.6453921663 ) 54.3208798860 (ExtendedPoll) - 3857+138 ( 2 0 4543.3181884885 2 5456.6751782893 ) 54.3208506492 (ExtendedPoll) - 3857+139 ( 2 0 4543.1791481970 2 5456.7943227813 ) 54.3207337517 (ExtendedPoll) - 3857+140 ( 2 0 4542.6229870307 2 5457.2709007492 ) 54.3202669568 (ExtendedPoll) - 3857+141 ( 2 0 4540.3983423657 2 5459.1772126208 ) 54.3184125004 (ExtendedPoll) - 3857+142 ( 2 0 4531.4997637056 2 5466.8024601073 ) 54.3111985229 (ExtendedPoll) - 3857+143 ( 2 0 4495.9054490650 2 5497.3034500534 ) 54.2856217202 (ExtendedPoll) - 3857+144 ( 2 0 4353.5281905028 2 5619.3074098378 ) 54.2368825197 (ExtendedPoll) - 3857+146 ( 2 0 4353.5041867680 2 5619.3635257316 ) 54.2365196285 (ExtendedPoll) - 3857+147 ( 2 0 4353.4321755638 2 5619.5318734129 ) 54.2354310246 (ExtendedPoll) - 3857+148 ( 2 0 4353.1441307467 2 5620.2052641384 ) 54.2310776574 (ExtendedPoll) - 3857+149 ( 2 0 4351.9919514786 2 5622.8988270401 ) 54.2136809672 (ExtendedPoll) - 3857+150 ( 2 0 4347.3832344061 2 5633.6730786469 ) 54.1443630877 (ExtendedPoll) - 3857+151 ( 2 0 4346.4159412060 2 5635.3688272200 ) 54.1355996268 (ExtendedPoll) - 3857+152 ( 2 0 4343.5140616057 2 5640.4560729390 ) 54.1093792188 (ExtendedPoll) - 3857+153 ( 2 0 4331.9065432045 2 5660.8050558153 ) 54.0055500944 (ExtendedPoll) - 3857+156 ( 2 0 4329.8320660769 2 5668.3386832786 ) 53.9480883416 (ExtendedPoll) - 3857+162 ( 2 0 4334.3358651038 2 5665.1314324564 ) 53.9408691910 (ExtendedPoll) - 3857+170 ( 2 0 4334.7698249059 2 5664.9075219934 ) 53.9393230537 (ExtendedPoll) - 3857+174 ( 2 0 4335.0132475664 2 5664.9262078546 ) 53.9370077879 (ExtendedPoll) - 3857+178 ( 2 0 4335.0593141454 2 5664.8861671994 ) 53.9370070214 (ExtendedPoll) - 3857+179 ( 2 0 4335.1975138822 2 5664.7660452336 ) 53.9370047791 (ExtendedPoll) - 3857+185 ( 2 0 4335.2265889224 2 5664.7567731080 ) 53.9368437214 (ExtendedPoll) - 3857+191 ( 2 0 4335.2341353579 2 5664.7556510827 ) 53.9367890253 (ExtendedPoll) - 3857+193 ( 2 0 4335.2400852963 2 5664.7508755444 ) 53.9367849554 (ExtendedPoll) - 3857+194 ( 2 0 4335.2579351117 2 5664.7365489296 ) 53.9367727467 (ExtendedPoll) - 3857+197 ( 2 0 4335.2420401136 2 5664.7511438225 ) 53.9367651768 (ExtendedPoll) - 3857+198 ( 2 0 4335.1943551193 2 5664.7949285015 ) 53.9367424744 (ExtendedPoll) - 3857+199 ( 2 0 4335.0036151422 2 5664.9700672173 ) 53.9366517744 (ExtendedPoll) - 3857+200 ( 2 0 4334.2406552335 2 5665.6706220803 ) 53.9362907282 (ExtendedPoll) - 3857+201 ( 2 0 4331.1888155990 2 5668.4728415326 ) 53.9348746183 (ExtendedPoll) - 3857+202 ( 2 0 4318.9814570610 2 5679.6817193417 ) 53.9296600779 (ExtendedPoll) - 3857+203 ( 2 0 4270.1520229090 2 5724.5172305782 ) 53.9160449943 (ExtendedPoll) - 3857+206 ( 2 0 4270.2287922106 2 5726.4688768232 ) 53.8962132135 (ExtendedPoll) - 3857+209 ( 2 0 4269.9967783213 2 5728.4085811769 ) 53.8792448146 (ExtendedPoll) - 3857+210 ( 2 0 4267.4719212911 2 5731.3906420478 ) 53.8723914551 (ExtendedPoll) - 3857+213 ( 2 0 4266.5745734546 2 5733.1256282638 ) 53.8633577202 (ExtendedPoll) - 3857+222 ( 2 0 4266.4308176062 2 5733.3229626873 ) 53.8627005560 (ExtendedPoll) - 3857+223 ( 2 0 4265.9995500609 2 5733.9149659579 ) 53.8607301402 (ExtendedPoll) - 3857+227 ( 2 0 4265.8268724443 2 5734.0875636064 ) 53.8605721022 (ExtendedPoll) - 3857+228 ( 2 0 4265.3088395946 2 5734.6053565521 ) 53.8600989724 (ExtendedPoll) - 3857+229 ( 2 0 4263.2367081957 2 5736.6765283347 ) 53.8582212182 (ExtendedPoll) - 3857+230 ( 2 0 4254.9481826001 2 5744.9612154653 ) 53.8509466860 (ExtendedPoll) - 3857+231 ( 2 0 4221.7940802176 2 5778.0999639874 ) 53.8256476388 (ExtendedPoll) - 3857+232 ( 2 0 4089.1776706878 2 5910.6549580759 ) 53.7861774796 (ExtendedPoll) - 3857+247 ( 2 0 4089.1136696138 2 5910.7589031772 ) 53.7858180957 (ExtendedPoll) - 3857+248 ( 2 0 4088.9216663918 2 5911.0707384809 ) 53.7847402348 (ExtendedPoll) - 3857+252 ( 2 0 4088.8359939837 2 5911.1576970414 ) 53.7847351920 (ExtendedPoll) - 3857+253 ( 2 0 4088.5789767594 2 5911.4185727227 ) 53.7847203220 (ExtendedPoll) - 3857+266 ( 2 0 4088.5833028094 2 5911.4153495129 ) 53.7847099233 (ExtendedPoll) - 3857+273 ( 2 0 4088.5841710836 2 5911.4149550584 ) 53.7847055346 (ExtendedPoll) - 3857+276 ( 2 0 4088.5850132823 2 5911.4145076255 ) 53.7847018687 (ExtendedPoll) - 3857+280 ( 2 0 4088.5854359861 2 5911.4142869556 ) 53.7846999932 (ExtendedPoll) - 3857+283 ( 2 0 4088.5850617172 2 5911.4148479102 ) 53.7846983212 (ExtendedPoll) - 3857+291 ( 2 0 4088.5850276880 2 5911.4148968462 ) 53.7846981880 (ExtendedPoll) - 3857+292 ( 2 0 4088.5849256003 2 5911.4150436540 ) 53.7846977884 (ExtendedPoll) - 3857+297 ( 2 0 4088.5849005844 2 5911.4150977550 ) 53.7846975253 (ExtendedPoll) - 3857+308 ( 2 0 4088.5849003997 2 5911.4150986678 ) 53.7846975187 (ExtendedPoll) - 3857+309 ( 2 0 4088.5848992968 2 5911.4151001689 ) 53.7846975151 (ExtendedPoll) - 3857+313 ( 2 0 4088.5848988407 2 5911.4151009808 ) 53.7846975119 (ExtendedPoll) - 3857+316 ( 2 0 4088.5848979979 2 5911.4151019930 ) 53.7846975104 (ExtendedPoll) - 4187+1 ( 2 0 4105.5097056568 2 5894.3640876566 ) 53.7853303801 (ExtendedPoll) - 4187+33 ( 2 0 4105.5249912111 2 5894.4490403525 ) 53.7844103322 (ExtendedPoll) - 4187+38 ( 2 0 4105.5402085635 2 5894.4501641740 ) 53.7842605703 (ExtendedPoll) - 4187+42 ( 2 0 4105.5590123984 2 5894.4395775740 ) 53.7841854603 (ExtendedPoll) - 4187+50 ( 2 0 4105.5607070024 2 5894.4387021916 ) 53.7841779690 (ExtendedPoll) - 4187+51 ( 2 0 4105.5636102425 2 5894.4362276993 ) 53.7841740843 (ExtendedPoll) - 4187+61 ( 2 0 4105.5638149153 2 5894.4361054192 ) 53.7841733315 (ExtendedPoll) - 4187+65 ( 2 0 4105.5638612668 2 5894.4360679458 ) 53.7841732508 (ExtendedPoll) - 4187+66 ( 2 0 4105.5640003213 2 5894.4359555257 ) 53.7841730088 (ExtendedPoll) - 4187+72 ( 2 0 4105.5640265310 2 5894.4359413401 ) 53.7841728988 (ExtendedPoll) - 4187+79 ( 2 0 4105.5640472452 2 5894.4359452146 ) 53.7841726734 (ExtendedPoll) - 4187+85 ( 2 0 4105.5640494603 2 5894.4359482098 ) 53.7841726256 (ExtendedPoll) - 4187+91 ( 2 0 4105.5640494863 2 5894.4359491407 ) 53.7841726169 (ExtendedPoll) - 4187+92 ( 2 0 4105.5640486402 2 5894.4359508001 ) 53.7841726094 (ExtendedPoll) - 4187+98 ( 2 0 4105.5640493116 2 5894.4359501547 ) 53.7841726092 (ExtendedPoll) - 4187+99 ( 2 0 4105.5640513257 2 5894.4359482183 ) 53.7841726085 (ExtendedPoll) - 4187+100 ( 2 0 4105.5640593820 2 5894.4359404726 ) 53.7841726058 (ExtendedPoll) - 4187+112 ( 2 0 4105.5640593940 2 5894.4359405296 ) 53.7841726051 (ExtendedPoll) - 4187+113 ( 2 0 4105.5640595037 2 5894.4359404905 ) 53.7841726045 (ExtendedPoll) - 4310+8 ( 2 0 4986.7257528443 2 5008.3439881737 ) 55.9026187973 (ExtendedPoll) - 4310+12 ( 2 0 4975.6982691662 2 5019.3714718518 ) 55.8540052955 (ExtendedPoll) - 4310+13 ( 2 0 4942.6158181319 2 5052.4539228861 ) 55.7112095080 (ExtendedPoll) - 4310+14 ( 2 0 4810.2860139947 2 5184.7837270233 ) 55.1870194047 (ExtendedPoll) - 4310+15 ( 2 0 4280.9667974460 2 5714.1029435721 ) 53.9228267897 (ExtendedPoll) - 4310+31 ( 2 0 4282.9099137686 2 5713.8982254345 ) 53.9076802800 (ExtendedPoll) - 4310+34 ( 2 0 4283.1982251457 2 5715.8293998657 ) 53.8861047342 (ExtendedPoll) - 4310+37 ( 2 0 4285.4740084419 2 5714.2633061132 ) 53.8814393469 (ExtendedPoll) - 4310+44 ( 2 0 4285.1205497824 2 5714.8564555920 ) 53.8787142179 (ExtendedPoll) - 4310+55 ( 2 0 4285.1005852658 2 5714.8795367790 ) 53.8786630424 (ExtendedPoll) - 4310+56 ( 2 0 4285.0406917160 2 5714.9487803400 ) 53.8785095322 (ExtendedPoll) - 4310+58 ( 2 0 4285.0005710927 2 5714.9947752809 ) 53.8784105470 (ExtendedPoll) - 4310+70 ( 2 0 4285.0007834768 2 5714.9966707681 ) 53.8783899929 (ExtendedPoll) - 4310+71 ( 2 0 4284.9983617564 2 5714.9996181702 ) 53.8783823323 (ExtendedPoll) - 4310+72 ( 2 0 4284.9910965952 2 5715.0084603766 ) 53.8783593509 (ExtendedPoll) - 4310+76 ( 2 0 4284.9884190656 2 5715.0111774997 ) 53.8783562185 (ExtendedPoll) - 4310+77 ( 2 0 4284.9803864769 2 5715.0193288691 ) 53.8783468217 (ExtendedPoll) - 4310+93 ( 2 0 4284.9804412318 2 5715.0194883169 ) 53.8783447670 (ExtendedPoll) - 4310+98 ( 2 0 4284.9804170022 2 5715.0195427745 ) 53.8783444443 (ExtendedPoll) - 4310+105 ( 2 0 4284.9804316104 2 5715.0195457146 ) 53.8783442863 (ExtendedPoll) - 4310+107 ( 2 0 4284.9804399767 2 5715.0195580455 ) 53.8783440910 (ExtendedPoll) - 4310+114 ( 2 0 4284.9804363154 2 5715.0195618337 ) 53.8783440860 (ExtendedPoll) - 4310+115 ( 2 0 4284.9804253315 2 5715.0195731983 ) 53.8783440710 (ExtendedPoll) - 4310+123 ( 2 0 4284.9804248959 2 5715.0195740214 ) 53.8783440667 (ExtendedPoll) - 4310+124 ( 2 0 4284.9804240703 2 5715.0195756911 ) 53.8783440575 (ExtendedPoll) - 4310+134 ( 2 0 4284.9804241092 2 5715.0195758008 ) 53.8783440561 (ExtendedPoll) - 4310+139 ( 2 0 4284.9804241503 2 5715.0195758421 ) 53.8783440553 (ExtendedPoll) - 4454 ( 3 0 3210.2718306224 2 3039.4036796793 1 3750.2294356176 ) 46.5957725777 - 4455 ( 3 0 3210.2204488871 2 3039.5770909239 1 3750.2008639259 ) 46.5947035783 - 4459+17 ( 2 0 4999.8234054990 2 5000.1686007961 ) 55.9010071498 (ExtendedPoll) - 4459+18 ( 2 0 4999.2960163907 2 5000.6767975791 ) 55.8988833670 (ExtendedPoll) - 4459+19 ( 2 0 4997.1864599572 2 5002.7095847109 ) 55.8903991267 (ExtendedPoll) - 4459+20 ( 2 0 4988.7482342235 2 5010.8407332383 ) 55.8566367335 (ExtendedPoll) - 4459+21 ( 2 0 4954.9953312886 2 5043.3653273476 ) 55.7244004145 (ExtendedPoll) - 4459+22 ( 2 0 4819.9837195490 2 5173.4637037851 ) 55.2417552587 (ExtendedPoll) - 4459+23 ( 2 0 4279.9372725906 2 5693.8572095350 ) 54.1320597545 (ExtendedPoll) - 4459+25 ( 2 0 4260.7210634090 2 5718.3142030389 ) 54.0605176484 (ExtendedPoll) - 4459+26 ( 2 0 4203.0724358640 2 5791.6851835507 ) 53.8630778677 (ExtendedPoll) - 4459+35 ( 2 0 4211.2611613676 2 5784.2607390941 ) 53.8607636217 (ExtendedPoll) - 4459+36 ( 2 0 4235.8273378782 2 5761.9874057245 ) 53.8557950144 (ExtendedPoll) - 4459+41 ( 2 0 4239.2666025897 2 5760.1381185483 ) 53.8430394257 (ExtendedPoll) - 4459+48 ( 2 0 4238.4020949545 2 5761.2154477473 ) 53.8403110732 (ExtendedPoll) - 4459+49 ( 2 0 4236.9895398051 2 5762.5631754865 ) 53.8398579750 (ExtendedPoll) - 4459+50 ( 2 0 4232.7518743570 2 5766.6063587038 ) 53.8385611120 (ExtendedPoll) - 4459+51 ( 2 0 4215.8012125647 2 5782.7790915733 ) 53.8343120215 (ExtendedPoll) - 4459+52 ( 2 0 4147.9985653954 2 5847.4700230513 ) 53.8324459450 (ExtendedPoll) - 4459+58 ( 2 0 4142.8942598315 2 5853.3659054138 ) 53.8237142063 (ExtendedPoll) - 4459+59 ( 2 0 4127.5813431399 2 5871.0535525015 ) 53.7986042338 (ExtendedPoll) - 4459+68 ( 2 0 4129.7411194915 2 5869.3305081768 ) 53.7948876409 (ExtendedPoll) - 4459+73 ( 2 0 4130.5591390496 2 5868.7973880268 ) 53.7923765042 (ExtendedPoll) - 4459+78 ( 2 0 4131.0192217390 2 5868.6337201408 ) 53.7897014772 (ExtendedPoll) - 4459+79 ( 2 0 4131.7293377788 2 5867.9632682402 ) 53.7894517155 (ExtendedPoll) - 4459+80 ( 2 0 4133.8596858981 2 5865.9519125383 ) 53.7887184190 (ExtendedPoll) - 4459+85 ( 2 0 4134.5843028059 2 5865.2972409942 ) 53.7882006022 (ExtendedPoll) - 4459+88 ( 2 0 4134.9640976007 2 5864.9903770359 ) 53.7875931645 (ExtendedPoll) - 4459+96 ( 2 0 4134.9859247059 2 5864.9690484814 ) 53.7875925935 (ExtendedPoll) - 4459+97 ( 2 0 4135.0514060213 2 5864.9050628179 ) 53.7875908962 (ExtendedPoll) - 4459+98 ( 2 0 4135.3133312830 2 5864.6491201639 ) 53.7875843437 (ExtendedPoll) - 4459+99 ( 2 0 4136.3610323297 2 5863.6253495479 ) 53.7875619231 (ExtendedPoll) - 4459+112 ( 2 0 4136.3648032632 2 5863.6247733590 ) 53.7875329472 (ExtendedPoll) - 4459+113 ( 2 0 4136.3761160637 2 5863.6230447924 ) 53.7874460195 (ExtendedPoll) - 4459+119 ( 2 0 4136.3737259452 2 5863.6260178809 ) 53.7874401351 (ExtendedPoll) - 4459+133 ( 2 0 4136.3738000302 2 5863.6261693177 ) 53.7874380524 (ExtendedPoll) - 4459+138 ( 2 0 4136.3737497999 2 5863.6262370108 ) 53.7874378803 (ExtendedPoll) - 4459+140 ( 2 0 4136.3737091508 2 5863.6262806039 ) 53.7874378451 (ExtendedPoll) - 4459+141 ( 2 0 4136.3735872034 2 5863.6264113833 ) 53.7874377393 (ExtendedPoll) - 4459+150 ( 2 0 4136.3735928884 2 5863.6264065675 ) 53.7874377323 (ExtendedPoll) - 4459+157 ( 2 0 4136.3735936795 2 5863.6264060760 ) 53.7874377297 (ExtendedPoll) - 4459+158 ( 2 0 4136.3735950382 2 5863.6264048019 ) 53.7874377291 (ExtendedPoll) - 4459+167 ( 2 0 4136.3735951385 2 5863.6264047429 ) 53.7874377288 (ExtendedPoll) - 4459+171 ( 2 0 4136.3735950627 2 5863.6264048312 ) 53.7874377287 (ExtendedPoll) - 4459+172 ( 2 0 4136.3735948352 2 5863.6264050962 ) 53.7874377283 (ExtendedPoll) - 4459+181 ( 2 0 4136.3735948402 2 5863.6264051370 ) 53.7874377278 (ExtendedPoll) - 4646+2 ( 2 0 4105.5720108686 2 5894.4263928684 ) 53.7841874022 (ExtendedPoll) - 4646+29 ( 2 0 4105.5833069765 2 5894.4161347829 ) 53.7841780742 (ExtendedPoll) - 4646+42 ( 2 0 4105.5835293721 2 5894.4160488549 ) 53.7841768253 (ExtendedPoll) - 4646+43 ( 2 0 4105.5841965588 2 5894.4157910708 ) 53.7841730784 (ExtendedPoll) - 4646+48 ( 2 0 4105.5842867579 2 5894.4157131287 ) 53.7841729675 (ExtendedPoll) - 4646+67 ( 2 0 4105.5842868659 2 5894.4157130854 ) 53.7841729669 (ExtendedPoll) - 4646+74 ( 2 0 4105.5842868950 2 5894.4157130859 ) 53.7841729666 (ExtendedPoll) - 4725+19 ( 2 0 4999.8031735893 2 5000.1447170134 ) 55.9014542318 (ExtendedPoll) - 4725+20 ( 2 0 4999.2150887519 2 5000.5812624482 ) 55.9006716187 (ExtendedPoll) - 4725+21 ( 2 0 4996.8627494022 2 5002.3274441874 ) 55.8975509135 (ExtendedPoll) - 4725+22 ( 2 0 4987.4533920033 2 5009.3121711443 ) 55.8852243268 (ExtendedPoll) - 4725+23 ( 2 0 4949.8159624076 2 5037.2510789717 ) 55.8384358459 (ExtendedPoll) - 4725+24 ( 2 0 4799.2662440251 2 5149.0067102812 ) 55.6927299999 (ExtendedPoll) - 4725+27 ( 2 0 4798.1744139579 2 5164.6198802413 ) 55.5187163710 (ExtendedPoll) - 4725+28 ( 2 0 4798.1744139579 2 5196.0645861749 ) 55.1525452486 (ExtendedPoll) - 4725+33 ( 2 0 4792.1420528370 2 5201.0324129804 ) 55.1431419649 (ExtendedPoll) - 4725+34 ( 2 0 4774.0449694742 2 5215.9358933968 ) 55.1157026271 (ExtendedPoll) - 4725+35 ( 2 0 4701.6566360229 2 5275.5498150626 ) 55.0176540485 (ExtendedPoll) - 4725+36 ( 2 0 4412.1033022177 2 5514.0055017256 ) 54.8221696457 (ExtendedPoll) - 4725+40 ( 2 0 4371.9239557470 2 5561.1725606260 ) 54.6749065998 (ExtendedPoll) - 4725+41 ( 2 0 4251.3859163349 2 5702.6737373272 ) 54.2973393293 (ExtendedPoll) - 4725+44 ( 2 0 4391.1401649287 2 5590.8703384522 ) 54.2022453171 (ExtendedPoll) - 4725+50 ( 2 0 4362.3158511562 2 5624.4987045201 ) 54.1076851285 (ExtendedPoll) - 4725+55 ( 2 0 4358.6036289279 2 5639.6751424533 ) 53.9858955384 (ExtendedPoll) - 4725+60 ( 2 0 4355.6625116846 2 5642.2409431111 ) 53.9855132092 (ExtendedPoll) - 4725+61 ( 2 0 4346.8391599545 2 5649.9383450844 ) 53.9845992440 (ExtendedPoll) - 4725+62 ( 2 0 4311.5457530343 2 5680.7279529777 ) 53.9844549147 (ExtendedPoll) - 4725+67 ( 2 0 4308.5432203496 2 5687.9340314208 ) 53.9390274262 (ExtendedPoll) - 4725+71 ( 2 0 4307.7243477993 2 5691.7554366558 ) 53.9082186256 (ExtendedPoll) - 4725+83 ( 2 0 4308.0052488063 2 5691.9562363603 ) 53.9037540967 (ExtendedPoll) - 4725+87 ( 2 0 4308.1049356103 2 5691.8857845325 ) 53.9035781830 (ExtendedPoll) - 4725+93 ( 2 0 4308.1185770304 2 5691.8789477872 ) 53.9035262437 (ExtendedPoll) - 4725+96 ( 2 0 4308.1246647783 2 5691.8743491833 ) 53.9035184462 (ExtendedPoll) - 4725+100 ( 2 0 4308.1208413138 2 5691.8781550898 ) 53.9035142224 (ExtendedPoll) - 4725+101 ( 2 0 4308.1093709201 2 5691.8895728093 ) 53.9035015515 (ExtendedPoll) - 4725+102 ( 2 0 4308.0634893453 2 5691.9352436871 ) 53.9034508749 (ExtendedPoll) - 4725+103 ( 2 0 4307.8799630460 2 5692.1179271984 ) 53.9032482824 (ExtendedPoll) - 4725+104 ( 2 0 4307.1458578490 2 5692.8486612434 ) 53.9024397326 (ExtendedPoll) - 4725+105 ( 2 0 4304.2094370610 2 5695.7715974237 ) 53.8992346674 (ExtendedPoll) - 4725+106 ( 2 0 4292.4637539088 2 5707.4633421446 ) 53.8868812553 (ExtendedPoll) - 4725+107 ( 2 0 4245.4810213003 2 5754.2303210285 ) 53.8449818536 (ExtendedPoll) - 4725+108 ( 2 0 4057.5500908662 2 5941.2982365638 ) 53.8003145611 (ExtendedPoll) - 4725+112 ( 2 0 4057.3125325273 2 5942.2454844463 ) 53.7939890318 (ExtendedPoll) - 4725+119 ( 2 0 4057.4393884670 2 5942.4540943610 ) 53.7909379794 (ExtendedPoll) - 4725+120 ( 2 0 4057.1333775009 2 5942.8346355240 ) 53.7903471560 (ExtendedPoll) - 4725+123 ( 2 0 4057.6371760427 2 5942.3623976952 ) 53.7899322822 (ExtendedPoll) - 4725+143 ( 2 0 4057.6378562203 2 5942.3617292243 ) 53.7899320010 (ExtendedPoll) - 4725+144 ( 2 0 4057.6398967532 2 5942.3597238116 ) 53.7899311575 (ExtendedPoll) - 4725+145 ( 2 0 4057.6480588849 2 5942.3517021609 ) 53.7899277838 (ExtendedPoll) - 4725+154 ( 2 0 4057.6479540349 2 5942.3519162868 ) 53.7899268277 (ExtendedPoll) - 4725+158 ( 2 0 4057.6478865326 2 5942.3520145431 ) 53.7899265685 (ExtendedPoll) - 4725+159 ( 2 0 4057.6476840256 2 5942.3523093118 ) 53.7899257907 (ExtendedPoll) - 4725+171 ( 2 0 4057.6476847788 2 5942.3523129602 ) 53.7899257509 (ExtendedPoll) - 4725+175 ( 2 0 4057.6476860982 2 5942.3523116454 ) 53.7899257506 (ExtendedPoll) - 4725+176 ( 2 0 4057.6476900565 2 5942.3523077012 ) 53.7899257494 (ExtendedPoll) - 4725+177 ( 2 0 4057.6477058896 2 5942.3522919242 ) 53.7899257448 (ExtendedPoll) - 4725+178 ( 2 0 4057.6477692222 2 5942.3522288165 ) 53.7899257264 (ExtendedPoll) - 4725+179 ( 2 0 4057.6480225525 2 5942.3519763854 ) 53.7899256529 (ExtendedPoll) - 4725+190 ( 2 0 4057.6480214853 2 5942.3519779120 ) 53.7899256490 (ExtendedPoll) - 4725+197 ( 2 0 4057.6480212763 2 5942.3519783281 ) 53.7899256472 (ExtendedPoll) - 4725+200 ( 2 0 4057.6480210350 2 5942.3519787264 ) 53.7899256458 (ExtendedPoll) - 4725+203 ( 2 0 4057.6480213991 2 5942.3519784360 ) 53.7899256451 (ExtendedPoll) - 4725+207 ( 2 0 4057.6480219221 2 5942.3519780358 ) 53.7899256438 (ExtendedPoll) - 4725+211 ( 2 0 4057.6480221025 2 5942.3519778887 ) 53.7899256435 (ExtendedPoll) - 4725+216 ( 2 0 4057.6480219897 2 5942.3519780086 ) 53.7899256435 (ExtendedPoll) - 4725+221 ( 2 0 4057.6480219698 2 5942.3519780298 ) 53.7899256435 (ExtendedPoll) - 4950 ( 3 0 3210.2137213322 2 3039.6012428177 1 3750.1834642275 ) 46.5946997610 - 4951 ( 3 0 3210.1935386677 2 3039.6736984988 1 3750.1312651323 ) 46.5946883143 - 4952 ( 3 0 3210.1128080096 2 3039.9635212235 1 3749.9224687515 ) 46.5946426050 - 4953 ( 3 0 3209.7898853771 2 3041.1228121224 1 3749.0872832281 ) 46.5944610083 - 4957+21 ( 2 0 4999.9515314082 2 5000.0370988583 ) 55.9016212277 (ExtendedPoll) - 4957+22 ( 2 0 4999.8061545413 2 5000.1484243416 ) 55.9013860644 (ExtendedPoll) - 4957+23 ( 2 0 4999.2246470737 2 5000.5937262748 ) 55.9004460290 (ExtendedPoll) - 4957+24 ( 2 0 4996.8986172034 2 5002.3749340079 ) 55.8966957757 (ExtendedPoll) - 4957+25 ( 2 0 4987.5944977221 2 5009.4997649402 ) 55.8818532664 (ExtendedPoll) - 4957+26 ( 2 0 4950.3780197968 2 5037.9990886692 ) 55.8250376177 (ExtendedPoll) - 4957+27 ( 2 0 4801.5121080959 2 5151.9963835853 ) 55.6398202521 (ExtendedPoll) - 4957+29 ( 2 0 4799.9016587469 2 5159.6391940553 ) 55.5631771412 (ExtendedPoll) - 4957+30 ( 2 0 4795.0703106998 2 5182.5676254652 ) 55.3341978198 (ExtendedPoll) - 4957+31 ( 2 0 4780.2214217867 2 5210.0817431571 ) 55.1338115001 (ExtendedPoll) - 4957+36 ( 2 0 4799.2192649549 2 5198.7267104589 ) 55.1133076930 (ExtendedPoll) - 4957+47 ( 2 0 4800.1328196439 2 5199.0717458199 ) 55.1020064789 (ExtendedPoll) - 4957+51 ( 2 0 4800.6067634573 2 5199.1893521250 ) 55.0968559487 (ExtendedPoll) - 4957+57 ( 2 0 4800.7025918042 2 5199.2649685543 ) 55.0952132428 (ExtendedPoll) - 4957+63 ( 2 0 4800.7285047755 2 5199.2488491668 ) 55.0951932210 (ExtendedPoll) - 4957+65 ( 2 0 4800.7568088740 2 5199.2374387295 ) 55.0950994742 (ExtendedPoll) - 4957+69 ( 2 0 4800.7456186612 2 5199.2478121856 ) 55.0950685340 (ExtendedPoll) - 4957+70 ( 2 0 4800.7120480229 2 5199.2789325537 ) 55.0949757164 (ExtendedPoll) - 4957+71 ( 2 0 4800.5777654696 2 5199.4034140262 ) 55.0946044924 (ExtendedPoll) - 4957+72 ( 2 0 4800.0406352565 2 5199.9013399163 ) 55.0931203333 (ExtendedPoll) - 4957+73 ( 2 0 4797.8921144041 2 5201.8930434766 ) 55.0871954955 (ExtendedPoll) - 4957+74 ( 2 0 4789.2980309945 2 5209.8598577177 ) 55.0636852238 (ExtendedPoll) - 4957+75 ( 2 0 4754.9216973563 2 5241.7271146822 ) 54.9726888507 (ExtendedPoll) - 4957+76 ( 2 0 4617.4163628032 2 5369.1961425400 ) 54.6586519092 (ExtendedPoll) - 4957+77 ( 2 0 4067.3950245908 2 5879.0722539713 ) 54.2760732951 (ExtendedPoll) - 4957+81 ( 2 0 4078.4498040205 2 5879.1268454747 ) 54.1738605186 (ExtendedPoll) - 4957+82 ( 2 0 4111.6141423099 2 5879.2906199847 ) 53.8682373433 (ExtendedPoll) - 4957+83 ( 2 0 4135.6344037869 2 5859.2009467494 ) 53.8353496249 (ExtendedPoll) - 4957+91 ( 2 0 4139.1419078776 2 5857.4881383315 ) 53.8193865804 (ExtendedPoll) - 4957+96 ( 2 0 4141.0884361692 2 5857.6587367795 ) 53.8000899204 (ExtendedPoll) - 4957+101 ( 2 0 4141.5688840483 2 5857.7459552361 ) 53.7949073397 (ExtendedPoll) - 4957+104 ( 2 0 4141.9346044712 2 5857.4223513050 ) 53.7945977867 (ExtendedPoll) - 4957+105 ( 2 0 4143.0317657398 2 5856.4515395119 ) 53.7936730233 (ExtendedPoll) - 4957+106 ( 2 0 4147.4204108144 2 5852.5682923396 ) 53.7900323766 (ExtendedPoll) - 4957+117 ( 2 0 4147.4162293615 2 5852.5829669923 ) 53.7899332894 (ExtendedPoll) - 4957+128 ( 2 0 4147.4160645968 2 5852.5834144589 ) 53.7899306065 (ExtendedPoll) - 4957+129 ( 2 0 4147.4153897141 2 5852.5840882751 ) 53.7899304432 (ExtendedPoll) - 4957+130 ( 2 0 4147.4133650660 2 5852.5861097238 ) 53.7899299534 (ExtendedPoll) - 4957+131 ( 2 0 4147.4052664734 2 5852.5941955188 ) 53.7899279944 (ExtendedPoll) - 4957+132 ( 2 0 4147.3728721030 2 5852.6265386988 ) 53.7899201620 (ExtendedPoll) - 4957+133 ( 2 0 4147.2432946213 2 5852.7559114185 ) 53.7898888919 (ExtendedPoll) - 4957+134 ( 2 0 4146.7249846949 2 5853.2734022975 ) 53.7897647629 (ExtendedPoll) - 4957+135 ( 2 0 4144.6517449892 2 5855.3433658132 ) 53.7892834747 (ExtendedPoll) - 4957+136 ( 2 0 4136.3587861663 2 5863.6232198764 ) 53.7876021773 (ExtendedPoll) - 4957+137 ( 2 0 4103.1869508749 2 5896.7426361291 ) 53.7847922558 (ExtendedPoll) - 4957+145 ( 2 0 4103.1682983337 2 5896.8007512235 ) 53.7844302124 (ExtendedPoll) - 4957+150 ( 2 0 4103.1669213843 2 5896.8312377825 ) 53.7841632090 (ExtendedPoll) - 4957+157 ( 2 0 4103.1650483182 2 5896.8345609654 ) 53.7841499007 (ExtendedPoll) - 4957+160 ( 2 0 4103.1624316887 2 5896.8373367825 ) 53.7841484300 (ExtendedPoll) - 4957+170 ( 2 0 4103.1626410673 2 5896.8372227473 ) 53.7841475564 (ExtendedPoll) - 4957+174 ( 2 0 4103.1625629696 2 5896.8373128117 ) 53.7841474463 (ExtendedPoll) - 4957+175 ( 2 0 4103.1623286764 2 5896.8375830050 ) 53.7841471160 (ExtendedPoll) - 4957+184 ( 2 0 4103.1623613751 2 5896.8376095974 ) 53.7841465724 (ExtendedPoll) - 4957+185 ( 2 0 4103.1623318769 2 5896.8376613910 ) 53.7841463677 (ExtendedPoll) - 4957+189 ( 2 0 4103.1623225735 2 5896.8376730311 ) 53.7841463463 (ExtendedPoll) - 4957+199 ( 2 0 4103.1623243672 2 5896.8376725291 ) 53.7841463344 (ExtendedPoll) - 4957+202 ( 2 0 4103.1623260046 2 5896.8376734171 ) 53.7841463113 (ExtendedPoll) - 4957+206 ( 2 0 4103.1623267413 2 5896.8376728473 ) 53.7841463097 (ExtendedPoll) - 4957+214 ( 2 0 4103.1623267301 2 5896.8376730798 ) 53.7841463077 (ExtendedPoll) - 4957+216 ( 2 0 4103.1623264493 2 5896.8376734513 ) 53.7841463069 (ExtendedPoll) - 4957+221 ( 2 0 4103.1623262249 2 5896.8376736923 ) 53.7841463067 (ExtendedPoll) - 4957+222 ( 2 0 4103.1623255517 2 5896.8376744152 ) 53.7841463063 (ExtendedPoll) - 4957+228 ( 2 0 4103.1623256446 2 5896.8376743450 ) 53.7841463061 (ExtendedPoll) - 5195+2 ( 2 0 4552.7863948639 2 5335.4101869888 ) 55.5680147602 (ExtendedPoll) - 5195+12 ( 2 0 4572.0026040455 2 5394.8057426411 ) 54.7532818545 (ExtendedPoll) - 5195+14 ( 2 0 4528.3294013600 2 5438.4789453267 ) 54.6428900648 (ExtendedPoll) - 5195+15 ( 2 0 4397.3097933033 2 5569.4985533833 ) 54.3697111024 (ExtendedPoll) - 5195+16 ( 2 0 3873.2313610768 2 6093.5769856098 ) 54.2139782157 (ExtendedPoll) - 5195+25 ( 2 0 3901.1822107956 2 6079.1648287236 ) 54.0675524851 (ExtendedPoll) - 5195+30 ( 2 0 3904.6760670104 2 6094.4504496635 ) 53.9053251878 (ExtendedPoll) - 5195+38 ( 2 0 3905.5158378706 2 6093.9518756993 ) 53.9014892203 (ExtendedPoll) - 5195+42 ( 2 0 3905.9712291027 2 6093.7758394257 ) 53.8986171016 (ExtendedPoll) - 5195+47 ( 2 0 3906.2152648514 2 6093.7828499557 ) 53.8962262883 (ExtendedPoll) - 5195+53 ( 2 0 3906.2570598051 2 6093.7383694092 ) 53.8962008251 (ExtendedPoll) - 5195+54 ( 2 0 3906.3824446664 2 6093.6049277697 ) 53.8961245036 (ExtendedPoll) - 5195+55 ( 2 0 3906.8839841115 2 6093.0711612115 ) 53.8958202370 (ExtendedPoll) - 5195+56 ( 2 0 3908.8901418918 2 6090.9360949789 ) 53.8946194836 (ExtendedPoll) - 5195+57 ( 2 0 3916.9147730132 2 6082.3958300485 ) 53.8900773214 (ExtendedPoll) - 5195+58 ( 2 0 3949.0132974987 2 6048.2347703268 ) 53.8760722747 (ExtendedPoll) - 5195+60 ( 2 0 3952.3160834518 2 6046.1534692613 ) 53.8626856098 (ExtendedPoll) - 5195+68 ( 2 0 3953.1776056142 2 6046.6132320786 ) 53.8505840740 (ExtendedPoll) - 5195+71 ( 2 0 3953.5789384631 2 6046.3350499844 ) 53.8491773294 (ExtendedPoll) - 5195+80 ( 2 0 3953.6091921986 2 6046.3390542165 ) 53.8488567166 (ExtendedPoll) - 5195+81 ( 2 0 3953.6616312293 2 6046.3078233717 ) 53.8486289876 (ExtendedPoll) - 5195+82 ( 2 0 3953.7497026781 2 6046.2232971719 ) 53.8485221437 (ExtendedPoll) - 5195+83 ( 2 0 3954.0139170244 2 6045.9697185726 ) 53.8482018728 (ExtendedPoll) - 5195+94 ( 2 0 3954.0185845590 2 6045.9794463233 ) 53.8480741214 (ExtendedPoll) - 5195+100 ( 2 0 3954.0184347508 2 6045.9813477797 ) 53.8480591976 (ExtendedPoll) - 5195+112 ( 2 0 3954.0185244766 2 6045.9812692933 ) 53.8480590234 (ExtendedPoll) - 5195+113 ( 2 0 3954.0187936542 2 6045.9810338338 ) 53.8480585006 (ExtendedPoll) - 5195+114 ( 2 0 3954.0198703645 2 6045.9800919962 ) 53.8480564096 (ExtendedPoll) - 5195+119 ( 2 0 3954.0199556739 2 6045.9800087306 ) 53.8480563182 (ExtendedPoll) - 5195+120 ( 2 0 3954.0202116021 2 6045.9797589338 ) 53.8480560440 (ExtendedPoll) - 5195+121 ( 2 0 3954.0212353150 2 6045.9787597466 ) 53.8480549472 (ExtendedPoll) - 5195+131 ( 2 0 3954.0212561678 2 6045.9787384550 ) 53.8480549329 (ExtendedPoll) - 5195+132 ( 2 0 3954.0213187265 2 6045.9786745799 ) 53.8480548901 (ExtendedPoll) - 5195+133 ( 2 0 3954.0215689610 2 6045.9784190796 ) 53.8480547188 (ExtendedPoll) - 5195+134 ( 2 0 3954.0225698990 2 6045.9773970786 ) 53.8480540335 (ExtendedPoll) - 5195+135 ( 2 0 3954.0265736512 2 6045.9733090745 ) 53.8480512924 (ExtendedPoll) - 5195+136 ( 2 0 3954.0425886598 2 6045.9569570580 ) 53.8480403289 (ExtendedPoll) - 5195+137 ( 2 0 3954.1066486941 2 6045.8915489921 ) 53.8479964904 (ExtendedPoll) - 5195+138 ( 2 0 3954.3628888317 2 6045.6299167285 ) 53.8478213863 (ExtendedPoll) - 5195+139 ( 2 0 3955.3878493820 2 6044.5833876740 ) 53.8471249631 (ExtendedPoll) - 5195+140 ( 2 0 3959.4876915833 2 6040.3972714563 ) 53.8444031448 (ExtendedPoll) - 5195+141 ( 2 0 3975.8870603884 2 6023.6528065852 ) 53.8345365224 (ExtendedPoll) - 5195+142 ( 2 0 4041.4845356089 2 5956.6749471009 ) 53.8113115046 (ExtendedPoll) - 5195+145 ( 2 0 4041.6035546824 2 5956.7020629246 ) 53.8099638531 (ExtendedPoll) - 5195+146 ( 2 0 4041.9606119028 2 5956.7834103954 ) 53.8059210158 (ExtendedPoll) - 5195+147 ( 2 0 4042.3009558066 2 5957.1335637099 ) 53.7996303534 (ExtendedPoll) - 5195+148 ( 2 0 4043.0741932721 2 5956.5373221342 ) 53.7977822528 (ExtendedPoll) - 5195+151 ( 2 0 4043.9165231091 2 5956.0430131312 ) 53.7943836123 (ExtendedPoll) - 5195+153 ( 2 0 4044.5989169010 2 5955.3444124866 ) 53.7942993075 (ExtendedPoll) - 5195+154 ( 2 0 4046.6460982769 2 5953.2486105531 ) 53.7940631506 (ExtendedPoll) - 5195+155 ( 2 0 4054.8348237804 2 5944.8654028188 ) 53.7933696899 (ExtendedPoll) - 5195+166 ( 2 0 4055.0724354313 2 5944.9214870586 ) 53.7906651766 (ExtendedPoll) - 5195+176 ( 2 0 4055.0761548684 2 5944.9206398974 ) 53.7906383460 (ExtendedPoll) - 5195+180 ( 2 0 4055.0778890903 2 5944.9198458871 ) 53.7906294220 (ExtendedPoll) - 5195+181 ( 2 0 4055.0811305415 2 5944.9178346926 ) 53.7906174793 (ExtendedPoll) - 5195+184 ( 2 0 4055.0777945058 2 5944.9220743514 ) 53.7906102701 (ExtendedPoll) - 5195+198 ( 2 0 4055.0778330577 2 5944.9221198097 ) 53.7906095046 (ExtendedPoll) - 5195+199 ( 2 0 4055.0777705351 2 5944.9222213074 ) 53.7906091714 (ExtendedPoll) - 5195+201 ( 2 0 4055.0780084500 2 5944.9219823862 ) 53.7906091154 (ExtendedPoll) - 5195+202 ( 2 0 4055.0787221949 2 5944.9212656228 ) 53.7906089474 (ExtendedPoll) - 5195+203 ( 2 0 4055.0815771745 2 5944.9183985692 ) 53.7906082755 (ExtendedPoll) - 5195+204 ( 2 0 4055.0929970928 2 5944.9069303548 ) 53.7906055884 (ExtendedPoll) - 5195+205 ( 2 0 4055.1386767659 2 5944.8610574972 ) 53.7905948477 (ExtendedPoll) - 5195+206 ( 2 0 4055.3213954584 2 5944.6775660669 ) 53.7905520064 (ExtendedPoll) - 5195+207 ( 2 0 4056.0522702285 2 5943.9436003453 ) 53.7903825885 (ExtendedPoll) - 5195+208 ( 2 0 4058.9757693086 2 5941.0077374592 ) 53.7897360619 (ExtendedPoll) - 5195+209 ( 2 0 4070.6697656292 2 5929.2642859147 ) 53.7876477253 (ExtendedPoll) - 5195+210 ( 2 0 4117.4457509116 2 5882.2904797367 ) 53.7872228417 (ExtendedPoll) - 5195+213 ( 2 0 4117.6891202600 2 5882.3097520301 ) 53.7848204977 (ExtendedPoll) - 5195+228 ( 2 0 4117.6899942270 2 5882.3093703541 ) 53.7848160313 (ExtendedPoll) - 5195+229 ( 2 0 4117.6915671836 2 5882.3082915651 ) 53.7848116087 (ExtendedPoll) - 5195+235 ( 2 0 4117.6919572521 2 5882.3080173020 ) 53.7848105741 (ExtendedPoll) - 5195+242 ( 2 0 4117.6920091373 2 5882.3079879653 ) 53.7848103706 (ExtendedPoll) - 5195+245 ( 2 0 4117.6920521121 2 5882.3079466630 ) 53.7848103589 (ExtendedPoll) - 5195+253 ( 2 0 4117.6920497867 2 5882.3079495734 ) 53.7848103533 (ExtendedPoll) - 5195+263 ( 2 0 4117.6920499996 2 5882.3079496675 ) 53.7848103505 (ExtendedPoll) - 5195+266 ( 2 0 4117.6920502143 2 5882.3079495774 ) 53.7848103493 (ExtendedPoll) - 5195+269 ( 2 0 4117.6920504410 2 5882.3079495242 ) 53.7848103478 (ExtendedPoll) - 5195+275 ( 2 0 4117.6920503703 2 5882.3079496167 ) 53.7848103475 (ExtendedPoll) - 5478+3 ( 2 0 4909.1597287779 2 5083.8525395201 ) 55.5960691542 (ExtendedPoll) - 5478+4 ( 2 0 4636.6389440201 2 5335.4101869888 ) 54.8753885588 (ExtendedPoll) - 5478+13 ( 2 0 4690.7937153502 2 5303.9654810552 ) 54.7846942177 (ExtendedPoll) - 5478+15 ( 2 0 4565.0148916158 2 5429.7443047896 ) 54.4304906658 (ExtendedPoll) - 5478+16 ( 2 0 4187.6784204127 2 5807.0807759926 ) 53.8546415124 (ExtendedPoll) - 5478+28 ( 2 0 4195.7852586612 2 5799.5744442811 ) 53.8531825911 (ExtendedPoll) - 5478+29 ( 2 0 4220.1057734067 2 5777.0554491463 ) 53.8508015438 (ExtendedPoll) - 5478+31 ( 2 0 4231.5699891117 2 5766.4646974951 ) 53.8504789320 (ExtendedPoll) - 5478+34 ( 2 0 4237.6296459843 2 5761.5514621930 ) 53.8439440609 (ExtendedPoll) - 5478+41 ( 2 0 4239.1257943732 2 5760.2958576158 ) 53.8427664280 (ExtendedPoll) - 5478+46 ( 2 0 4239.9101207378 2 5759.7136904120 ) 53.8414160967 (ExtendedPoll) - 5478+50 ( 2 0 4239.7094543134 2 5760.1588457372 ) 53.8388916705 (ExtendedPoll) - 5478+54 ( 2 0 4239.2194102715 2 5760.6452645620 ) 53.8385475799 (ExtendedPoll) - 5478+55 ( 2 0 4237.7492781460 2 5762.1045210365 ) 53.8375232191 (ExtendedPoll) - 5478+56 ( 2 0 4231.8687496437 2 5767.9415469345 ) 53.8335445270 (ExtendedPoll) - 5478+57 ( 2 0 4208.3466356348 2 5791.2896505265 ) 53.8195350703 (ExtendedPoll) - 5478+58 ( 2 0 4114.2581795991 2 5884.6820648944 ) 53.7943112519 (ExtendedPoll) - 5478+71 ( 2 0 4114.9485701934 2 5884.6988048671 ) 53.7878427663 (ExtendedPoll) - 5478+74 ( 2 0 4115.3912731659 2 5884.4929138652 ) 53.7856923145 (ExtendedPoll) - 5478+80 ( 2 0 4115.5104388474 2 5884.4664511137 ) 53.7848465681 (ExtendedPoll) - 5478+86 ( 2 0 4115.5040354705 2 5884.4803013045 ) 53.7847774342 (ExtendedPoll) - 5478+92 ( 2 0 4115.5085943246 2 5884.4864188582 ) 53.7846793465 (ExtendedPoll) - 5478+94 ( 2 0 4115.5038751700 2 5884.4924136225 ) 53.7846672332 (ExtendedPoll) - 5478+99 ( 2 0 4115.5033916134 2 5884.4961975456 ) 53.7846367702 (ExtendedPoll) - 5478+108 ( 2 0 4115.5032700638 2 5884.4964026531 ) 53.7846359908 (ExtendedPoll) - 5478+109 ( 2 0 4115.5029054151 2 5884.4970179759 ) 53.7846336525 (ExtendedPoll) - 5478+117 ( 2 0 4115.5029626983 2 5884.4970015034 ) 53.7846332805 (ExtendedPoll) - 5478+121 ( 2 0 4115.5030374021 2 5884.4969624551 ) 53.7846329574 (ExtendedPoll) - 5478+142 ( 2 0 4115.5030374174 2 5884.4969625705 ) 53.7846329562 (ExtendedPoll) - 5629+9 ( 2 0 4975.5429968599 2 5019.6529315723 ) 55.8517940762 (ExtendedPoll) - 5629+10 ( 2 0 4902.1720163482 2 5078.6117551978 ) 55.7134020563 (ExtendedPoll) - 5629+11 ( 2 0 4608.6880943013 2 5314.4470496997 ) 55.3395226272 (ExtendedPoll) - 5629+15 ( 2 0 4552.7863948639 2 5426.2504485747 ) 54.5705629398 (ExtendedPoll) - 5629+20 ( 2 0 4591.6555452540 2 5405.2873112856 ) 54.4751741266 (ExtendedPoll) - 5629+33 ( 2 0 4592.5840273072 2 5406.3096224852 ) 54.4562806449 (ExtendedPoll) - 5629+37 ( 2 0 4592.3579843636 2 5406.7424094230 ) 54.4534252540 (ExtendedPoll) - 5629+38 ( 2 0 4591.6798555328 2 5408.0407702362 ) 54.4448631609 (ExtendedPoll) - 5629+44 ( 2 0 4591.6012203107 2 5408.2719044772 ) 54.4429899385 (ExtendedPoll) - 5629+48 ( 2 0 4591.5696196138 2 5408.3898106624 ) 54.4419637140 (ExtendedPoll) - 5629+52 ( 2 0 4591.5680918914 2 5408.4202901410 ) 54.4416432602 (ExtendedPoll) - 5629+58 ( 2 0 4591.5700204171 2 5408.4276717726 ) 54.4415465559 (ExtendedPoll) - 5629+60 ( 2 0 4591.5654575021 2 5408.4337863066 ) 54.4415176321 (ExtendedPoll) - 5629+67 ( 2 0 4591.5646332830 2 5408.4348538518 ) 54.4415128113 (ExtendedPoll) - 5629+71 ( 2 0 4591.5645519834 2 5408.4353237071 ) 54.4415083512 (ExtendedPoll) - 5629+79 ( 2 0 4591.5646115597 2 5408.4353255431 ) 54.4415078361 (ExtendedPoll) - 5629+84 ( 2 0 4591.5645990175 2 5408.4353525777 ) 54.4415076449 (ExtendedPoll) - 5629+85 ( 2 0 4591.5645613907 2 5408.4354336816 ) 54.4415070710 (ExtendedPoll) - 5629+94 ( 2 0 4591.5645699689 2 5408.4354275629 ) 54.4415070666 (ExtendedPoll) - 5629+101 ( 2 0 4591.5645717027 2 5408.4354268822 ) 54.4415070596 (ExtendedPoll) - 5629+103 ( 2 0 4591.5645704450 2 5408.4354282562 ) 54.4415070551 (ExtendedPoll) - 5629+104 ( 2 0 4591.5645666721 2 5408.4354323781 ) 54.4415070414 (ExtendedPoll) - 5629+109 ( 2 0 4591.5645657541 2 5408.4354339988 ) 54.4415070313 (ExtendedPoll) - 5629+119 ( 2 0 4591.5645658577 2 5408.4354341268 ) 54.4415070290 (ExtendedPoll) - 5755+17 ( 2 0 4999.4391479660 2 5000.4028159491 ) 55.9011173930 (ExtendedPoll) - 5755+18 ( 2 0 4997.7566207727 2 5001.6112927051 ) 55.8993758016 (ExtendedPoll) - 5755+19 ( 2 0 4991.0265119995 2 5006.4451997289 ) 55.8924862980 (ExtendedPoll) - 5755+20 ( 2 0 4964.1060769066 2 5025.7808278241 ) 55.8661643975 (ExtendedPoll) - 5755+21 ( 2 0 4856.4243365351 2 5103.1233402051 ) 55.7810605478 (ExtendedPoll) - 5755+24 ( 2 0 4863.9579639983 2 5116.7712160443 ) 55.5599122421 (ExtendedPoll) - 5755+25 ( 2 0 4848.2356110316 2 5143.8486017093 ) 55.3646109717 (ExtendedPoll) - 5755+31 ( 2 0 4842.8037564475 2 5149.4715265551 ) 55.3415309539 (ExtendedPoll) - 5755+32 ( 2 0 4826.5081926955 2 5166.3403010924 ) 55.2731138922 (ExtendedPoll) - 5755+33 ( 2 0 4761.3259376873 2 5233.8153992415 ) 55.0119577195 (ExtendedPoll) - 5755+36 ( 2 0 4739.4893363446 2 5256.0887326112 ) 54.9328003343 (ExtendedPoll) - 5755+37 ( 2 0 4673.9795323162 2 5322.9087327200 ) 54.7090508194 (ExtendedPoll) - 5755+39 ( 2 0 4628.5594015233 2 5364.8350072982 ) 54.6149385255 (ExtendedPoll) - 5755+40 ( 2 0 4492.2990091444 2 5490.6138310325 ) 54.3872651867 (ExtendedPoll) - 5755+41 ( 2 0 3947.2574396288 2 5993.7291259700 ) 54.3655883138 (ExtendedPoll) - 5755+49 ( 2 0 3928.0412304472 2 6053.1246816223 ) 54.0330892795 (ExtendedPoll) - 5755+58 ( 2 0 3929.8700458096 2 6060.7129005889 ) 53.9508748031 (ExtendedPoll) - 5755+60 ( 2 0 3925.2024722726 2 6066.9909234750 ) 53.9417691814 (ExtendedPoll) - 5755+61 ( 2 0 3911.1997516616 2 6085.8249921331 ) 53.9156381344 (ExtendedPoll) - 5755+66 ( 2 0 3919.7706176886 2 6078.8372797034 ) 53.8929555395 (ExtendedPoll) - 5755+74 ( 2 0 3920.5459876347 2 6078.2435971044 ) 53.8905945920 (ExtendedPoll) - 5755+75 ( 2 0 3922.8720974731 2 6076.4625493074 ) 53.8835272419 (ExtendedPoll) - 5755+81 ( 2 0 3922.0826531550 2 6077.5957494982 ) 53.8814445368 (ExtendedPoll) - 5755+87 ( 2 0 3922.3040046412 2 6077.4927773412 ) 53.8802087502 (ExtendedPoll) - 5755+90 ( 2 0 3922.2317402049 2 6077.7259640948 ) 53.8789219399 (ExtendedPoll) - 5755+100 ( 2 0 3922.2265169811 2 6077.7403010701 ) 53.8788502601 (ExtendedPoll) - 5755+101 ( 2 0 3922.2108473095 2 6077.7833119959 ) 53.8786352255 (ExtendedPoll) - 5755+107 ( 2 0 3922.2085611664 2 6077.7905908301 ) 53.8785953531 (ExtendedPoll) - 5755+113 ( 2 0 3922.2107347292 2 6077.7889934610 ) 53.8785881820 (ExtendedPoll) - 5755+122 ( 2 0 3922.2108535295 2 6077.7889835942 ) 53.8785871342 (ExtendedPoll) - 5755+123 ( 2 0 3922.2110146221 2 6077.7888078314 ) 53.8785870886 (ExtendedPoll) - 5755+124 ( 2 0 3922.2114979001 2 6077.7882805429 ) 53.8785869518 (ExtendedPoll) - 5755+125 ( 2 0 3922.2134310120 2 6077.7861713891 ) 53.8785864048 (ExtendedPoll) - 5755+126 ( 2 0 3922.2211634595 2 6077.7777347737 ) 53.8785842169 (ExtendedPoll) - 5755+127 ( 2 0 3922.2520932495 2 6077.7439883121 ) 53.8785754693 (ExtendedPoll) - 5755+128 ( 2 0 3922.3758124097 2 6077.6090024659 ) 53.8785405430 (ExtendedPoll) - 5755+129 ( 2 0 3922.8706890504 2 6077.0690590808 ) 53.8784018624 (ExtendedPoll) - 5755+130 ( 2 0 3924.8501956130 2 6074.9092855406 ) 53.8778635334 (ExtendedPoll) - 5755+131 ( 2 0 3932.7682218633 2 6066.2701913799 ) 53.8759723517 (ExtendedPoll) - 5755+132 ( 2 0 3964.4403268649 2 6031.7138147370 ) 53.8725913899 (ExtendedPoll) - 5755+134 ( 2 0 3964.6765257473 2 6031.6520794236 ) 53.8708963698 (ExtendedPoll) - 5755+135 ( 2 0 3965.3851223947 2 6031.4668734835 ) 53.8658119765 (ExtendedPoll) - 5755+136 ( 2 0 3968.2195089840 2 6030.7260497231 ) 53.8454844045 (ExtendedPoll) - 5755+138 ( 2 0 3966.5220544265 2 6032.9062978884 ) 53.8426385768 (ExtendedPoll) - 5755+139 ( 2 0 3964.0381410238 2 6035.9224784489 ) 53.8400218659 (ExtendedPoll) - 5755+154 ( 2 0 3964.1134625710 2 6035.8803219730 ) 53.8396748316 (ExtendedPoll) - 5755+157 ( 2 0 3964.1376216602 2 6035.8616765123 ) 53.8396077632 (ExtendedPoll) - 5755+166 ( 2 0 3964.1391333458 2 6035.8605134178 ) 53.8396035356 (ExtendedPoll) - 5755+171 ( 2 0 3964.1395137360 2 6035.8602258817 ) 53.8396024275 (ExtendedPoll) - 5755+175 ( 2 0 3964.1397422881 2 6035.8601580043 ) 53.8396008562 (ExtendedPoll) - 5755+176 ( 2 0 3964.1401032802 2 6035.8598464624 ) 53.8396001384 (ExtendedPoll) - 5755+184 ( 2 0 3964.1401437730 2 6035.8598027239 ) 53.8396001338 (ExtendedPoll) - 5755+185 ( 2 0 3964.1402652513 2 6035.8596715087 ) 53.8396001200 (ExtendedPoll) - 5755+186 ( 2 0 3964.1407511646 2 6035.8591466477 ) 53.8396000647 (ExtendedPoll) - 5755+187 ( 2 0 3964.1426948176 2 6035.8570472037 ) 53.8395998438 (ExtendedPoll) - 5755+188 ( 2 0 3964.1504694296 2 6035.8486494278 ) 53.8395989603 (ExtendedPoll) - 5755+189 ( 2 0 3964.1815678778 2 6035.8150583240 ) 53.8395954303 (ExtendedPoll) - 5755+190 ( 2 0 3964.3059616705 2 6035.6806939089 ) 53.8395813737 (ExtendedPoll) - 5755+191 ( 2 0 3964.8035368415 2 6035.1432362487 ) 53.8395261614 (ExtendedPoll) - 5755+192 ( 2 0 3966.7938375252 2 6032.9934056075 ) 53.8393215384 (ExtendedPoll) - 5755+193 ( 2 0 3974.7550402603 2 6024.3940830430 ) 53.8387624914 (ExtendedPoll) - 5755+195 ( 2 0 3974.8020931115 2 6024.3552069220 ) 53.8386567319 (ExtendedPoll) - 5755+196 ( 2 0 3974.9432516652 2 6024.2385785592 ) 53.8383395150 (ExtendedPoll) - 5755+197 ( 2 0 3975.5078858801 2 6023.7720651080 ) 53.8370715717 (ExtendedPoll) - 5755+198 ( 2 0 3977.7664227394 2 6021.9060113031 ) 53.8320145804 (ExtendedPoll) - 5755+201 ( 2 0 3978.1694615728 2 6021.6302815615 ) 53.8306170085 (ExtendedPoll) - 5755+206 ( 2 0 3978.2884006782 2 6021.6028192098 ) 53.8297362750 (ExtendedPoll) - 5755+211 ( 2 0 3978.3433620337 2 6021.5762764903 ) 53.8294496693 (ExtendedPoll) - 5755+214 ( 2 0 3978.4034030246 2 6021.5653058772 ) 53.8289799544 (ExtendedPoll) - 5755+218 ( 2 0 3978.4320361581 2 6021.5547475992 ) 53.8288022372 (ExtendedPoll) - 5755+219 ( 2 0 3978.4762518106 2 6021.5126727574 ) 53.8287517449 (ExtendedPoll) - 5755+220 ( 2 0 3978.6088987679 2 6021.3864482319 ) 53.8286003328 (ExtendedPoll) - 5755+224 ( 2 0 3978.6514101019 2 6021.3426524116 ) 53.8285808779 (ExtendedPoll) - 5755+225 ( 2 0 3978.7789441037 2 6021.2112649506 ) 53.8285225798 (ExtendedPoll) - 5755+226 ( 2 0 3979.2890801112 2 6020.6857151068 ) 53.8282903842 (ExtendedPoll) - 5755+227 ( 2 0 3981.3296241412 2 6018.5835157314 ) 53.8273775476 (ExtendedPoll) - 5755+228 ( 2 0 3989.4918002613 2 6010.1747182300 ) 53.8239811631 (ExtendedPoll) - 5755+229 ( 2 0 4022.1405047416 2 5976.5395282242 ) 53.8144637068 (ExtendedPoll) - 5755+234 ( 2 0 4020.7893650335 2 5978.9483783098 ) 53.8057221545 (ExtendedPoll) - 5755+239 ( 2 0 4021.8359865119 2 5978.0476185044 ) 53.8039392071 (ExtendedPoll) - 5755+248 ( 2 0 4021.8964440029 2 5978.0392385221 ) 53.8034496620 (ExtendedPoll) - 5755+251 ( 2 0 4021.9498759700 2 5978.0097369858 ) 53.8032127550 (ExtendedPoll) - 5755+255 ( 2 0 4021.9714769156 2 5977.9881793562 ) 53.8032023063 (ExtendedPoll) - 5755+256 ( 2 0 4022.0362797523 2 5977.9235064675 ) 53.8031709766 (ExtendedPoll) - 5755+257 ( 2 0 4022.2954910992 2 5977.6648149127 ) 53.8030459025 (ExtendedPoll) - 5755+258 ( 2 0 4023.3323364869 2 5976.6300486937 ) 53.8025495188 (ExtendedPoll) - 5755+259 ( 2 0 4027.4797180376 2 5972.4909838173 ) 53.8006265679 (ExtendedPoll) - 5755+272 ( 2 0 4027.4926149637 2 5972.4991384731 ) 53.8004340240 (ExtendedPoll) - 5755+274 ( 2 0 4027.4867594927 2 5972.5132290886 ) 53.8003634319 (ExtendedPoll) - 5755+291 ( 2 0 4027.4868017206 2 5972.5131870229 ) 53.8003634121 (ExtendedPoll) - 5755+292 ( 2 0 4027.4869284044 2 5972.5130608261 ) 53.8003633529 (ExtendedPoll) - 5755+293 ( 2 0 4027.4874351394 2 5972.5125560387 ) 53.8003631157 (ExtendedPoll) - 5755+294 ( 2 0 4027.4894620797 2 5972.5105368890 ) 53.8003621672 (ExtendedPoll) - 5755+309 ( 2 0 4027.4894630105 2 5972.5105368589 ) 53.8003621588 (ExtendedPoll) - 5755+315 ( 2 0 4027.4894632002 2 5972.5105367239 ) 53.8003621582 (ExtendedPoll) - 5755+320 ( 2 0 4027.4894631259 2 5972.5105368136 ) 53.8003621581 (ExtendedPoll) - 5755+321 ( 2 0 4027.4894629032 2 5972.5105370826 ) 53.8003621578 (ExtendedPoll) - 5755+329 ( 2 0 4027.4894628766 2 5972.5105371140 ) 53.8003621577 (ExtendedPoll) - 6087+4 ( 2 0 4748.4423428951 2 5251.5576378325 ) 54.9123291399 (ExtendedPoll) - 6087+5 ( 2 0 3993.7694004889 2 6006.2305802387 ) 53.8183151870 (ExtendedPoll) - 6087+44 ( 2 0 3993.7694619626 2 6006.2305225636 ) 53.8183151149 (ExtendedPoll) - 6087+45 ( 2 0 3993.7696463836 2 6006.2303495384 ) 53.8183148988 (ExtendedPoll) - 6087+56 ( 2 0 3993.7696499094 2 6006.2303483359 ) 53.8183148762 (ExtendedPoll) - 6087+64 ( 2 0 3993.7696494122 2 6006.2303491234 ) 53.8183148740 (ExtendedPoll) - 6087+65 ( 2 0 3993.7696479206 2 6006.2303514859 ) 53.8183148673 (ExtendedPoll) - 6087+70 ( 2 0 3993.7696473156 2 6006.2303521939 ) 53.8183148668 (ExtendedPoll) - 6087+71 ( 2 0 3993.7696455004 2 6006.2303543179 ) 53.8183148653 (ExtendedPoll) - 6087+80 ( 2 0 3993.7696457355 2 6006.2303540873 ) 53.8183148651 (ExtendedPoll) - 6087+81 ( 2 0 3993.7696464408 2 6006.2303533957 ) 53.8183148645 (ExtendedPoll) - 6087+82 ( 2 0 3993.7696492618 2 6006.2303506290 ) 53.8183148623 (ExtendedPoll) - 6087+85 ( 2 0 3993.7696499024 2 6006.2303499530 ) 53.8183148622 (ExtendedPoll) - 6087+86 ( 2 0 3993.7696518242 2 6006.2303479249 ) 53.8183148619 (ExtendedPoll) - 6087+87 ( 2 0 3993.7696595112 2 6006.2303398127 ) 53.8183148607 (ExtendedPoll) - 6087+88 ( 2 0 3993.7696902595 2 6006.2303073636 ) 53.8183148562 (ExtendedPoll) - 6087+89 ( 2 0 3993.7698132527 2 6006.2301775672 ) 53.8183148381 (ExtendedPoll) - 6087+90 ( 2 0 3993.7703052255 2 6006.2296583817 ) 53.8183147657 (ExtendedPoll) - 6087+91 ( 2 0 3993.7722731166 2 6006.2275816398 ) 53.8183144759 (ExtendedPoll) - 6087+92 ( 2 0 3993.7801446810 2 6006.2192746722 ) 53.8183133172 (ExtendedPoll) - 6087+93 ( 2 0 3993.8116309384 2 6006.1860468016 ) 53.8183086862 (ExtendedPoll) - 6087+94 ( 2 0 3993.9375759683 2 6006.0531353193 ) 53.8182902249 (ExtendedPoll) - 6087+95 ( 2 0 3994.4413560878 2 6005.5214893902 ) 53.8182173813 (ExtendedPoll) - 6087+96 ( 2 0 3996.4564765659 2 6003.3949056739 ) 53.8179420284 (ExtendedPoll) - 6087+97 ( 2 0 4004.5169584783 2 5994.8885708083 ) 53.8170967872 (ExtendedPoll) - 6087+99 ( 2 0 4004.5245453924 2 5994.8877669371 ) 53.8170328494 (ExtendedPoll) - 6087+100 ( 2 0 4004.5473061346 2 5994.8853553233 ) 53.8168410364 (ExtendedPoll) - 6087+101 ( 2 0 4004.6383491034 2 5994.8757088682 ) 53.8160737928 (ExtendedPoll) - 6087+102 ( 2 0 4005.0025209789 2 5994.8371230479 ) 53.8130049524 (ExtendedPoll) - 6087+105 ( 2 0 4005.0443542507 2 5994.7926791534 ) 53.8130042923 (ExtendedPoll) - 6087+106 ( 2 0 4005.1698540660 2 5994.6593474699 ) 53.8130023789 (ExtendedPoll) - 6087+107 ( 2 0 4005.6718533272 2 5994.1260207358 ) 53.8129957265 (ExtendedPoll) - 6087+108 ( 2 0 4007.6798503720 2 5991.9927137997 ) 53.8129851374 (ExtendedPoll) - 6087+113 ( 2 0 4007.2403461204 2 5992.5254074536 ) 53.8124063797 (ExtendedPoll) - 6087+117 ( 2 0 4007.7373207242 2 5992.0459191907 ) 53.8119791690 (ExtendedPoll) - 6087+118 ( 2 0 4009.2282445356 2 5990.6074544020 ) 53.8107058155 (ExtendedPoll) - 6087+126 ( 2 0 4009.3503023939 2 5990.6056218015 ) 53.8095807273 (ExtendedPoll) - 6087+128 ( 2 0 4009.4380806266 2 5990.5207890577 ) 53.8095074272 (ExtendedPoll) - 6087+129 ( 2 0 4009.7014153247 2 5990.2662908261 ) 53.8092877859 (ExtendedPoll) - 6087+136 ( 2 0 4009.7506106525 2 5990.2301636059 ) 53.8091461907 (ExtendedPoll) - 6087+143 ( 2 0 4009.7635053921 2 5990.2220054099 ) 53.8090975243 (ExtendedPoll) - 6087+144 ( 2 0 4009.8021896106 2 5990.1975308217 ) 53.8089515284 (ExtendedPoll) - 6087+154 ( 2 0 4009.8017843826 2 5990.1980698371 ) 53.8089505672 (ExtendedPoll) - 6087+161 ( 2 0 4009.8017202471 2 5990.1981703234 ) 53.8089502814 (ExtendedPoll) - 6087+162 ( 2 0 4009.8015278408 2 5990.1984717824 ) 53.8089494238 (ExtendedPoll) - 6087+177 ( 2 0 4009.8015265652 2 5990.1984731397 ) 53.8089494237 (ExtendedPoll) - 6087+178 ( 2 0 4009.8015227385 2 5990.1984772118 ) 53.8089494236 (ExtendedPoll) - 6087+182 ( 2 0 4009.8015264517 2 5990.1984734744 ) 53.8089494218 (ExtendedPoll) - 6087+183 ( 2 0 4009.8015375912 2 5990.1984622623 ) 53.8089494165 (ExtendedPoll) - 6087+184 ( 2 0 4009.8015821493 2 5990.1984174139 ) 53.8089493951 (ExtendedPoll) - 6087+185 ( 2 0 4009.8017603815 2 5990.1982380201 ) 53.8089493096 (ExtendedPoll) - 6087+186 ( 2 0 4009.8024733106 2 5990.1975204453 ) 53.8089489676 (ExtendedPoll) - 6087+187 ( 2 0 4009.8053250269 2 5990.1946501458 ) 53.8089475994 (ExtendedPoll) - 6087+188 ( 2 0 4009.8167318920 2 5990.1831689481 ) 53.8089421273 (ExtendedPoll) - 6087+189 ( 2 0 4009.8623593525 2 5990.1372441570 ) 53.8089202465 (ExtendedPoll) - 6087+190 ( 2 0 4010.0448691945 2 5989.9535449926 ) 53.8088328461 (ExtendedPoll) - 6087+191 ( 2 0 4010.7749085625 2 5989.2187483350 ) 53.8084852115 (ExtendedPoll) - 6087+192 ( 2 0 4013.6950660346 2 5986.2795617047 ) 53.8071261335 (ExtendedPoll) - 6087+193 ( 2 0 4025.3756959228 2 5974.5228151836 ) 53.8021926744 (ExtendedPoll) - 6087+194 ( 2 0 4072.0982154756 2 5927.4958290993 ) 53.7904707641 (ExtendedPoll) - 6087+196 ( 2 0 4072.1230863636 2 5927.4781440878 ) 53.7904013936 (ExtendedPoll) - 6087+197 ( 2 0 4072.1976990276 2 5927.4250890534 ) 53.7901932963 (ExtendedPoll) - 6087+198 ( 2 0 4072.4961496835 2 5927.2128689157 ) 53.7893611206 (ExtendedPoll) - 6087+201 ( 2 0 4072.6142224687 2 5927.1818879709 ) 53.7885522474 (ExtendedPoll) - 6087+205 ( 2 0 4072.7124431924 2 5927.2543656553 ) 53.7869896937 (ExtendedPoll) - 6087+206 ( 2 0 4072.8894390822 2 5927.0862195600 ) 53.7868793477 (ExtendedPoll) - 6087+212 ( 2 0 4072.8331432603 2 5927.1516517284 ) 53.7868061997 (ExtendedPoll) - 6087+222 ( 2 0 4072.8364485532 2 5927.1585279631 ) 53.7867134349 (ExtendedPoll) - 6087+225 ( 2 0 4072.8360952700 2 5927.1623262685 ) 53.7866822980 (ExtendedPoll) - 6087+231 ( 2 0 4072.8355323017 2 5927.1630960486 ) 53.7866805212 (ExtendedPoll) - 6087+232 ( 2 0 4072.8338433970 2 5927.1654053888 ) 53.7866751908 (ExtendedPoll) - 6087+236 ( 2 0 4072.8348036881 2 5927.1644583778 ) 53.7866749068 (ExtendedPoll) - 6087+237 ( 2 0 4072.8376845612 2 5927.1616173446 ) 53.7866740546 (ExtendedPoll) - 6087+238 ( 2 0 4072.8492080538 2 5927.1502532121 ) 53.7866706465 (ExtendedPoll) - 6087+239 ( 2 0 4072.8546839370 2 5927.1449407271 ) 53.7866682334 (ExtendedPoll) - 6087+251 ( 2 0 4072.8548902901 2 5927.1448213042 ) 53.7866674110 (ExtendedPoll) - 6087+252 ( 2 0 4072.8555093493 2 5927.1444630354 ) 53.7866649438 (ExtendedPoll) - 6087+257 ( 2 0 4072.8556843793 2 5927.1443011469 ) 53.7866647950 (ExtendedPoll) - 6087+265 ( 2 0 4072.8556567359 2 5927.1443329620 ) 53.7866647619 (ExtendedPoll) - 6087+271 ( 2 0 4072.8556523714 2 5927.1443390004 ) 53.7866647475 (ExtendedPoll) - 6087+272 ( 2 0 4072.8556392781 2 5927.1443571157 ) 53.7866647042 (ExtendedPoll) - 6087+277 ( 2 0 4072.8556357434 2 5927.1443636744 ) 53.7866646774 (ExtendedPoll) - 6087+284 ( 2 0 4072.8556351991 2 5927.1443644301 ) 53.7866646756 (ExtendedPoll) - 6087+289 ( 2 0 4072.8556348885 2 5927.1443647771 ) 53.7866646753 (ExtendedPoll) - 6087+290 ( 2 0 4072.8556339570 2 5927.1443658182 ) 53.7866646745 (ExtendedPoll) - 6087+291 ( 2 0 4072.8556327029 2 5927.1443671954 ) 53.7866646736 (ExtendedPoll) - 6087+300 ( 2 0 4072.8556329763 2 5927.1443670119 ) 53.7866646727 (ExtendedPoll) - 6399+7 ( 2 0 4954.5798595708 2 5043.6731930494 ) 55.7239163641 (ExtendedPoll) - 6399+8 ( 2 0 4818.3194671920 2 5174.6928011060 ) 55.2406520186 (ExtendedPoll) - 6399+9 ( 2 0 4273.2778976764 2 5698.7712333325 ) 54.1421761447 (ExtendedPoll) - 6399+20 ( 2 0 4267.0544662937 2 5713.0742072120 ) 54.0559868372 (ExtendedPoll) - 6399+22 ( 2 0 4305.9236166838 2 5692.5478019498 ) 53.9161736343 (ExtendedPoll) - 6399+38 ( 2 0 4306.4284814658 2 5693.0189735384 ) 53.9070540230 (ExtendedPoll) - 6399+39 ( 2 0 4307.3369182014 2 5692.6607167976 ) 53.9026276457 (ExtendedPoll) - 6399+55 ( 2 0 4307.3366998789 2 5692.6626116095 ) 53.9026107377 (ExtendedPoll) - 6399+61 ( 2 0 4307.3371752453 2 5692.6626490319 ) 53.9026061874 (ExtendedPoll) - 6399+63 ( 2 0 4307.3375784896 2 5692.6623945369 ) 53.9026051716 (ExtendedPoll) - 6399+76 ( 2 0 4307.3375909856 2 5692.6624026545 ) 53.9026049811 (ExtendedPoll) - 6399+81 ( 2 0 4307.3375975611 2 5692.6623991511 ) 53.9026049581 (ExtendedPoll) - 6399+89 ( 2 0 4307.3375983269 2 5692.6623986211 ) 53.9026049566 (ExtendedPoll) - 6399+90 ( 2 0 4307.3376006244 2 5692.6623970312 ) 53.9026049522 (ExtendedPoll) - 6399+92 ( 2 0 4307.3375976707 2 5692.6624013936 ) 53.9026049349 (ExtendedPoll) - 6399+97 ( 2 0 4307.3375969844 2 5692.6624020232 ) 53.9026049346 (ExtendedPoll) - 6399+98 ( 2 0 4307.3375949256 2 5692.6624039121 ) 53.9026049340 (ExtendedPoll) - 6399+99 ( 2 0 4307.3375866905 2 5692.6624114674 ) 53.9026049313 (ExtendedPoll) - 6399+100 ( 2 0 4307.3375537500 2 5692.6624416886 ) 53.9026049205 (ExtendedPoll) - 6399+101 ( 2 0 4307.3374219878 2 5692.6625625735 ) 53.9026048776 (ExtendedPoll) - 6399+102 ( 2 0 4307.3368949392 2 5692.6630461130 ) 53.9026047059 (ExtendedPoll) - 6399+103 ( 2 0 4307.3347867446 2 5692.6649802712 ) 53.9026040190 (ExtendedPoll) - 6399+104 ( 2 0 4307.3263539663 2 5692.6727169040 ) 53.9026012717 (ExtendedPoll) - 6399+105 ( 2 0 4307.2926228530 2 5692.7036634351 ) 53.9025902858 (ExtendedPoll) - 6399+106 ( 2 0 4307.1576983999 2 5692.8274495597 ) 53.9025463974 (ExtendedPoll) - 6399+107 ( 2 0 4306.6180005874 2 5693.3225940580 ) 53.9023717283 (ExtendedPoll) - 6399+108 ( 2 0 4304.4592093375 2 5695.3031720513 ) 53.9016872027 (ExtendedPoll) - 6399+109 ( 2 0 4295.8240443380 2 5703.2254840245 ) 53.8991757562 (ExtendedPoll) - 6399+110 ( 2 0 4261.2833843400 2 5734.9147319171 ) 53.8927720075 (ExtendedPoll) - 6399+113 ( 2 0 4261.2854283144 2 5734.9298531621 ) 53.8926060076 (ExtendedPoll) - 6399+114 ( 2 0 4261.2915602373 2 5734.9752168971 ) 53.8921080120 (ExtendedPoll) - 6399+115 ( 2 0 4261.3160879292 2 5735.1566718371 ) 53.8901160910 (ExtendedPoll) - 6399+116 ( 2 0 4261.4141986968 2 5735.8824915973 ) 53.8821493903 (ExtendedPoll) - 6399+117 ( 2 0 4261.5839708086 2 5736.0579414386 ) 53.8789281638 (ExtendedPoll) - 6399+118 ( 2 0 4262.0932871439 2 5736.5842909627 ) 53.8692650726 (ExtendedPoll) - 6399+119 ( 2 0 4262.1303923063 2 5737.5601140852 ) 53.8593995884 (ExtendedPoll) - 6399+127 ( 2 0 4262.0592807423 2 5737.6593344091 ) 53.8590609755 (ExtendedPoll) - 6399+128 ( 2 0 4261.8459460503 2 5737.9569953809 ) 53.8580454076 (ExtendedPoll) - 6399+133 ( 2 0 4261.8066484312 2 5738.0725691654 ) 53.8572649584 (ExtendedPoll) - 6399+134 ( 2 0 4261.6592140538 2 5738.2671580201 ) 53.8566720935 (ExtendedPoll) - 6399+139 ( 2 0 4261.6094206317 2 5738.3786067875 ) 53.8560252022 (ExtendedPoll) - 6399+146 ( 2 0 4261.6039575038 2 5738.3928541111 ) 53.8559345028 (ExtendedPoll) - 6399+147 ( 2 0 4261.5822528497 2 5738.4143071991 ) 53.8559175202 (ExtendedPoll) - 6399+148 ( 2 0 4261.5171388874 2 5738.4786664632 ) 53.8558665878 (ExtendedPoll) - 6399+149 ( 2 0 4261.2566830381 2 5738.7361035197 ) 53.8556630883 (ExtendedPoll) - 6399+150 ( 2 0 4260.2148596411 2 5739.7658517453 ) 53.8548527711 (ExtendedPoll) - 6399+151 ( 2 0 4256.0475660528 2 5743.8848446480 ) 53.8516704284 (ExtendedPoll) - 6399+152 ( 2 0 4239.3783916996 2 5760.3608162588 ) 53.8398857910 (ExtendedPoll) - 6399+153 ( 2 0 4172.7016942871 2 5826.2647027020 ) 53.8079830812 (ExtendedPoll) - 6399+159 ( 2 0 4172.3873666467 2 5827.1893462901 ) 53.8020966299 (ExtendedPoll) - 6399+161 ( 2 0 4171.7493284512 2 5827.9288905621 ) 53.8008851851 (ExtendedPoll) - 6399+162 ( 2 0 4169.8352138647 2 5830.1475233783 ) 53.7972677698 (ExtendedPoll) - 6399+173 ( 2 0 4169.8728479823 2 5830.1263964098 ) 53.7971266241 (ExtendedPoll) - 6399+180 ( 2 0 4169.8744650652 2 5830.1253849637 ) 53.7971215364 (ExtendedPoll) - 6399+188 ( 2 0 4169.8742332961 2 5830.1256298513 ) 53.7971213238 (ExtendedPoll) - 6399+189 ( 2 0 4169.8735379888 2 5830.1263645140 ) 53.7971206859 (ExtendedPoll) - 6399+197 ( 2 0 4169.8735402993 2 5830.1264240738 ) 53.7971201036 (ExtendedPoll) - 6399+202 ( 2 0 4169.8735394760 2 5830.1264538648 ) 53.7971198303 (ExtendedPoll) - 6399+207 ( 2 0 4169.8735316923 2 5830.1264665714 ) 53.7971197809 (ExtendedPoll) - 6399+208 ( 2 0 4169.8735105156 2 5830.1264875411 ) 53.7971197747 (ExtendedPoll) - 6399+209 ( 2 0 4169.8734469856 2 5830.1265504500 ) 53.7971197562 (ExtendedPoll) - 6399+210 ( 2 0 4169.8731928654 2 5830.1268020859 ) 53.7971196820 (ExtendedPoll) - 6399+211 ( 2 0 4169.8721763846 2 5830.1278086295 ) 53.7971193855 (ExtendedPoll) - 6399+212 ( 2 0 4169.8681104615 2 5830.1318348037 ) 53.7971181995 (ExtendedPoll) - 6399+213 ( 2 0 4169.8518467691 2 5830.1479395006 ) 53.7971134562 (ExtendedPoll) - 6399+214 ( 2 0 4169.7867919994 2 5830.2123582880 ) 53.7970944980 (ExtendedPoll) - 6399+215 ( 2 0 4169.5265729207 2 5830.4700334377 ) 53.7970189008 (ExtendedPoll) - 6399+216 ( 2 0 4168.4856966058 2 5831.5007340364 ) 53.7967202870 (ExtendedPoll) - 6399+217 ( 2 0 4164.3221913464 2 5835.6235364314 ) 53.7955862535 (ExtendedPoll) - 6399+218 ( 2 0 4147.6681703088 2 5852.1147460114 ) 53.7920186238 (ExtendedPoll) - 6399+220 ( 2 0 4147.6602068265 2 5852.1752601464 ) 53.7915256228 (ExtendedPoll) - 6399+221 ( 2 0 4147.6363163798 2 5852.3568025514 ) 53.7900466951 (ExtendedPoll) - 6399+229 ( 2 0 4147.6523233123 2 5852.3423304219 ) 53.7900364877 (ExtendedPoll) - 6399+230 ( 2 0 4147.7003441098 2 5852.2989140332 ) 53.7900058731 (ExtendedPoll) - 6399+244 ( 2 0 4147.7008030485 2 5852.2990434509 ) 53.7900004953 (ExtendedPoll) - 6399+246 ( 2 0 4147.7011719978 2 5852.2987413745 ) 53.7899999659 (ExtendedPoll) - 6399+252 ( 2 0 4147.7010771141 2 5852.2988807259 ) 53.7899995260 (ExtendedPoll) - 6399+259 ( 2 0 4147.7010935191 2 5852.2989056067 ) 53.7899991446 (ExtendedPoll) - 6399+268 ( 2 0 4147.7010938504 2 5852.2989059339 ) 53.7899991385 (ExtendedPoll) - 6399+271 ( 2 0 4147.7010940528 2 5852.2989058189 ) 53.7899991377 (ExtendedPoll) - 6399+275 ( 2 0 4147.7010940473 2 5852.2989059352 ) 53.7899991367 (ExtendedPoll) - 6399+282 ( 2 0 4147.7010940274 2 5852.2989059712 ) 53.7899991366 (ExtendedPoll) - 6685+2 ( 2 0 4105.5727993639 2 5894.4271813637 ) 53.7841729375 (ExtendedPoll) - 6685+41 ( 2 0 4105.5727574055 2 5894.4272236982 ) 53.7841729333 (ExtendedPoll) - 6685+42 ( 2 0 4105.5726315303 2 5894.4273507015 ) 53.7841729207 (ExtendedPoll) - 6685+43 ( 2 0 4105.5721280294 2 5894.4278587149 ) 53.7841728703 (ExtendedPoll) - 6685+53 ( 2 0 4105.5721311970 2 5894.4278654586 ) 53.7841727793 (ExtendedPoll) - 6685+57 ( 2 0 4105.5721285679 2 5894.4278680979 ) 53.7841727792 (ExtendedPoll) - 6685+58 ( 2 0 4105.5721206809 2 5894.4278760159 ) 53.7841727787 (ExtendedPoll) - 6685+59 ( 2 0 4105.5720891326 2 5894.4279076878 ) 53.7841727770 (ExtendedPoll) - 6685+60 ( 2 0 4105.5719629396 2 5894.4280343754 ) 53.7841727702 (ExtendedPoll) - 6685+61 ( 2 0 4105.5714581674 2 5894.4285411256 ) 53.7841727431 (ExtendedPoll) - 6685+74 ( 2 0 4105.5714585929 2 5894.4285413146 ) 53.7841727374 (ExtendedPoll) - 6685+81 ( 2 0 4105.5714586508 2 5894.4285413214 ) 53.7841727368 (ExtendedPoll) - 6774+17 ( 2 0 4999.8038288046 2 5000.1453455727 ) 55.9014415188 (ExtendedPoll) - 6774+18 ( 2 0 4999.2153441271 2 5000.5814111994 ) 55.9006678364 (ExtendedPoll) - 6774+19 ( 2 0 4996.8614054169 2 5002.3256737060 ) 55.8975828466 (ExtendedPoll) - 6774+20 ( 2 0 4987.4456505762 2 5009.3027237327 ) 55.8853990072 (ExtendedPoll) - 6774+21 ( 2 0 4949.7826312134 2 5037.2109238395 ) 55.8391796750 (ExtendedPoll) - 6774+22 ( 2 0 4799.1305537620 2 5148.8437242665 ) 55.6957204380 (ExtendedPoll) - 6774+24 ( 2 0 4791.8152923122 2 5162.6007831124 ) 55.5930004110 (ExtendedPoll) - 6774+25 ( 2 0 4769.8695079627 2 5203.8719596503 ) 55.2886042603 (ExtendedPoll) - 6774+27 ( 2 0 4753.7104229690 2 5230.5126132884 ) 55.1111870096 (ExtendedPoll) - 6774+28 ( 2 0 4703.0495078538 2 5267.1981035443 ) 55.1012158213 (ExtendedPoll) - 6774+34 ( 2 0 4699.1189196121 2 5298.2060774510 ) 54.7818521507 (ExtendedPoll) - 6774+37 ( 2 0 4689.4016320146 2 5310.4345742030 ) 54.7232027437 (ExtendedPoll) - 6774+38 ( 2 0 4665.3813705375 2 5330.5242474383 ) 54.6941438059 (ExtendedPoll) - 6774+39 ( 2 0 4593.3205861064 2 5390.7932671444 ) 54.6201919010 (ExtendedPoll) - 6774+40 ( 2 0 4305.0774483818 2 5631.8693459686 ) 54.5320542946 (ExtendedPoll) - 6774+45 ( 2 0 4291.1020235224 2 5693.0118297283 ) 54.0420071399 (ExtendedPoll) - 6774+50 ( 2 0 4279.6378078175 2 5703.6025813796 ) 54.0382097940 (ExtendedPoll) - 6774+51 ( 2 0 4245.2451607026 2 5735.3748363333 ) 54.0307112653 (ExtendedPoll) - 6774+58 ( 2 0 4249.5032979644 2 5750.4420912598 ) 53.8459996564 (ExtendedPoll) - 6774+69 ( 2 0 4249.5962541266 2 5750.3629695656 ) 53.8459422263 (ExtendedPoll) - 6774+76 ( 2 0 4249.6238551729 2 5750.3759885262 ) 53.8455701397 (ExtendedPoll) - 6774+80 ( 2 0 4249.6129514080 2 5750.3866626954 ) 53.8455633271 (ExtendedPoll) - 6774+81 ( 2 0 4249.5802401136 2 5750.4186852027 ) 53.8455428930 (ExtendedPoll) - 6774+82 ( 2 0 4249.4493949358 2 5750.5467752323 ) 53.8454612142 (ExtendedPoll) - 6774+83 ( 2 0 4248.9260142245 2 5751.0591353504 ) 53.8451354192 (ExtendedPoll) - 6774+84 ( 2 0 4246.8324913796 2 5753.1085758229 ) 53.8438469662 (ExtendedPoll) - 6774+85 ( 2 0 4238.4583999999 2 5761.3063377130 ) 53.8389290219 (ExtendedPoll) - 6774+86 ( 2 0 4204.9620344812 2 5794.0973852733 ) 53.8230461425 (ExtendedPoll) - 6774+87 ( 2 0 4070.9765724063 2 5925.2615755146 ) 53.8210579913 (ExtendedPoll) - 6774+92 ( 2 0 4071.7886210187 2 5927.0375053582 ) 53.7974776434 (ExtendedPoll) - 6774+98 ( 2 0 4072.0432392023 2 5927.4540854434 ) 53.7913560161 (ExtendedPoll) - 6774+100 ( 2 0 4071.7200617674 2 5927.8201257384 ) 53.7910242574 (ExtendedPoll) - 6774+101 ( 2 0 4070.7505294627 2 5928.9182466233 ) 53.7900332794 (ExtendedPoll) - 6774+110 ( 2 0 4070.7703482043 2 5929.0386984572 ) 53.7887604316 (ExtendedPoll) - 6774+112 ( 2 0 4070.7520288631 2 5929.1593835311 ) 53.7878375424 (ExtendedPoll) - 6774+114 ( 2 0 4070.6714077684 2 5929.2510402129 ) 53.7877524096 (ExtendedPoll) - 6774+115 ( 2 0 4070.4295444844 2 5929.5260102582 ) 53.7874972799 (ExtendedPoll) - 6774+123 ( 2 0 4070.4383638744 2 5929.5552256590 ) 53.7871515709 (ExtendedPoll) - 6774+129 ( 2 0 4070.4346738395 2 5929.5619033272 ) 53.7871252238 (ExtendedPoll) - 6774+135 ( 2 0 4070.4365087991 2 5929.5624238125 ) 53.7871035769 (ExtendedPoll) - 6774+139 ( 2 0 4070.4373937138 2 5929.5620682560 ) 53.7870986249 (ExtendedPoll) - 6774+141 ( 2 0 4070.4382753416 2 5929.5617046258 ) 53.7870937763 (ExtendedPoll) - 6774+149 ( 2 0 4070.4383956527 2 5929.5615865285 ) 53.7870937340 (ExtendedPoll) - 6774+150 ( 2 0 4070.4387565859 2 5929.5612322368 ) 53.7870936074 (ExtendedPoll) - 6774+158 ( 2 0 4070.4387684909 2 5929.5612232749 ) 53.7870935786 (ExtendedPoll) - 6774+161 ( 2 0 4070.4387865750 2 5929.5612124557 ) 53.7870935095 (ExtendedPoll) - 6774+169 ( 2 0 4070.4387882509 2 5929.5612116428 ) 53.7870935014 (ExtendedPoll) - 6774+177 ( 2 0 4070.4387881954 2 5929.5612117452 ) 53.7870935010 (ExtendedPoll) - 6774+179 ( 2 0 4070.4387882946 2 5929.5612116843 ) 53.7870935006 (ExtendedPoll) - 6961+15 ( 2 0 4999.8058280052 2 5000.1479845174 ) 55.9013939424 (ExtendedPoll) - 6961+16 ( 2 0 4999.2233409293 2 5000.5919669783 ) 55.9004775395 (ExtendedPoll) - 6961+17 ( 2 0 4996.8933926259 2 5002.3678968219 ) 55.8968217946 (ExtendedPoll) - 6961+18 ( 2 0 4987.5735994122 2 5009.4716161962 ) 55.8823569716 (ExtendedPoll) - 6961+19 ( 2 0 4950.2944265573 2 5037.8864936935 ) 55.8270464781 (ExtendedPoll) - 6961+20 ( 2 0 4801.1777351379 2 5151.5460036826 ) 55.6477582520 (ExtendedPoll) - 6961+23 ( 2 0 4799.7583560506 2 5167.1591736427 ) 55.4764322556 (ExtendedPoll) - 6961+26 ( 2 0 4792.1155455806 2 5180.8070494820 ) 55.3782799039 (ExtendedPoll) - 6961+27 ( 2 0 4769.1871141707 2 5221.7506769997 ) 55.0876212670 (ExtendedPoll) - 6961+31 ( 2 0 4761.8718527209 2 5235.6169188523 ) 54.9868701218 (ExtendedPoll) - 6961+34 ( 2 0 4749.6433559689 2 5245.3342064498 ) 54.9738791762 (ExtendedPoll) - 6961+35 ( 2 0 4712.9578657131 2 5274.4860692424 ) 54.9380022491 (ExtendedPoll) - 6961+36 ( 2 0 4566.2159046897 2 5391.0935204128 ) 54.8421122279 (ExtendedPoll) - 6961+38 ( 2 0 4475.3756431037 2 5474.9460695691 ) 54.6975024335 (ExtendedPoll) - 6961+39 ( 2 0 4202.8548583459 2 5726.5037170378 ) 54.4953088368 (ExtendedPoll) - 6961+50 ( 2 0 4223.8179956350 2 5749.6505144612 ) 54.0825598595 (ExtendedPoll) - 6961+52 ( 2 0 4202.8548583459 2 5772.7973118845 ) 54.0462974249 (ExtendedPoll) - 6961+53 ( 2 0 4139.9654464788 2 5842.2377041545 ) 53.9544164694 (ExtendedPoll) - 6961+59 ( 2 0 4139.3103484385 2 5857.8508741146 ) 53.8144735666 (ExtendedPoll) - 6961+66 ( 2 0 4138.2372842006 2 5859.4835012619 ) 53.8090274109 (ExtendedPoll) - 6961+67 ( 2 0 4135.0180914870 2 5864.3813827037 ) 53.7927617458 (ExtendedPoll) - 6961+75 ( 2 0 4135.1400160653 2 5864.5928981232 ) 53.7896852883 (ExtendedPoll) - 6961+77 ( 2 0 4135.3836253179 2 5864.5767445826 ) 53.7876169219 (ExtendedPoll) - 6961+86 ( 2 0 4135.3975076833 2 5864.5830777793 ) 53.7874316321 (ExtendedPoll) - 6961+87 ( 2 0 4135.4221274217 2 5864.5650445737 ) 53.7873750497 (ExtendedPoll) - 6961+91 ( 2 0 4135.4358288178 2 5864.5583287176 ) 53.7873127014 (ExtendedPoll) - 6961+96 ( 2 0 4135.4417746173 2 5864.5535479991 ) 53.7873029931 (ExtendedPoll) - 6961+97 ( 2 0 4135.4596120157 2 5864.5392058436 ) 53.7872738692 (ExtendedPoll) - 6961+108 ( 2 0 4135.4600654422 2 5864.5390582696 ) 53.7872711118 (ExtendedPoll) - 6961+109 ( 2 0 4135.4609366779 2 5864.5386703998 ) 53.7872667832 (ExtendedPoll) - 6961+114 ( 2 0 4135.4606620754 2 5864.5390602294 ) 53.7872656603 (ExtendedPoll) - 6961+119 ( 2 0 4135.4605743562 2 5864.5392819246 ) 53.7872643984 (ExtendedPoll) - 6961+121 ( 2 0 4135.4610972036 2 5864.5388560396 ) 53.7872635958 (ExtendedPoll) - 6961+126 ( 2 0 4135.4612010194 2 5864.5387974466 ) 53.7872631950 (ExtendedPoll) - 6961+137 ( 2 0 4135.4612024119 2 5864.5387962096 ) 53.7872631938 (ExtendedPoll) - 6961+138 ( 2 0 4135.4612065894 2 5864.5387924983 ) 53.7872631903 (ExtendedPoll) - 6961+145 ( 2 0 4135.4612070035 2 5864.5387922853 ) 53.7872631885 (ExtendedPoll) - 6961+146 ( 2 0 4135.4612082457 2 5864.5387916463 ) 53.7872631831 (ExtendedPoll) - 6961+156 ( 2 0 4135.4612082147 2 5864.5387916956 ) 53.7872631829 (ExtendedPoll) - 6961+157 ( 2 0 4135.4612081217 2 5864.5387918434 ) 53.7872631824 (ExtendedPoll) - 6961+163 ( 2 0 4135.4612081460 2 5864.5387918272 ) 53.7872631824 (ExtendedPoll) - 6961+164 ( 2 0 4135.4612082186 2 5864.5387917788 ) 53.7872631821 (ExtendedPoll) - 7131+3 ( 2 0 4874.2211666294 2 5125.7788140982 ) 55.3724275680 (ExtendedPoll) - 7131+4 ( 2 0 4496.8846954264 2 5503.1152853013 ) 54.2156316564 (ExtendedPoll) - 7131+39 ( 2 0 4496.8846529014 2 5503.1153270666 ) 54.2156315732 (ExtendedPoll) - 7131+40 ( 2 0 4496.8845253266 2 5503.1154523626 ) 54.2156313235 (ExtendedPoll) - 7131+41 ( 2 0 4496.8840150275 2 5503.1159535467 ) 54.2156303249 (ExtendedPoll) - 7131+42 ( 2 0 4496.8819738307 2 5503.1179582832 ) 54.2156263303 (ExtendedPoll) - 7131+43 ( 2 0 4496.8738090439 2 5503.1259772290 ) 54.2156103523 (ExtendedPoll) - 7131+44 ( 2 0 4496.8411498966 2 5503.1580530122 ) 54.2155464435 (ExtendedPoll) - 7131+45 ( 2 0 4496.7105133072 2 5503.2863561450 ) 54.2152908615 (ExtendedPoll) - 7131+46 ( 2 0 4496.1879669499 2 5503.7995686762 ) 54.2142693849 (ExtendedPoll) - 7131+47 ( 2 0 4494.0977815204 2 5505.8524188009 ) 54.2101971068 (ExtendedPoll) - 7131+48 ( 2 0 4485.7370398025 2 5514.0638192997 ) 54.1941263256 (ExtendedPoll) - 7131+49 ( 2 0 4452.2940729307 2 5546.9094212948 ) 54.1333544119 (ExtendedPoll) - 7131+50 ( 2 0 4318.5222054439 2 5678.2918292755 ) 53.9475643989 (ExtendedPoll) - 7131+53 ( 2 0 4318.5963891128 2 5678.5244295969 ) 53.9445911411 (ExtendedPoll) - 7131+54 ( 2 0 4318.8189401194 2 5679.2222305612 ) 53.9356722784 (ExtendedPoll) - 7131+55 ( 2 0 4318.7890853910 2 5680.1984801799 ) 53.9261887566 (ExtendedPoll) - 7131+56 ( 2 0 4317.9105033838 2 5681.9437023028 ) 53.9164801493 (ExtendedPoll) - 7131+63 ( 2 0 4317.7577644608 2 5682.1341594764 ) 53.9159200953 (ExtendedPoll) - 7131+69 ( 2 0 4317.7221920188 2 5682.1837563103 ) 53.9157374211 (ExtendedPoll) - 7131+70 ( 2 0 4317.6154746928 2 5682.3325468122 ) 53.9151894649 (ExtendedPoll) - 7131+74 ( 2 0 4317.6823945996 2 5682.2780286129 ) 53.9151462258 (ExtendedPoll) - 7131+75 ( 2 0 4317.8831543201 2 5682.1144740148 ) 53.9150166207 (ExtendedPoll) - 7131+87 ( 2 0 4317.8850608152 2 5682.1144169722 ) 53.9150004675 (ExtendedPoll) - 7131+92 ( 2 0 4317.8855375905 2 5682.1144246562 ) 53.9149962090 (ExtendedPoll) - 7131+100 ( 2 0 4317.8855643890 2 5682.1144116170 ) 53.9149961040 (ExtendedPoll) - 7131+105 ( 2 0 4317.8855791781 2 5682.1144097931 ) 53.9149959925 (ExtendedPoll) - 7131+107 ( 2 0 4317.8855925920 2 5682.1144033038 ) 53.9149959395 (ExtendedPoll) - 7131+111 ( 2 0 4317.8855821380 2 5682.1144139226 ) 53.9149959253 (ExtendedPoll) - 7131+112 ( 2 0 4317.8855507760 2 5682.1144457789 ) 53.9149958826 (ExtendedPoll) - 7131+113 ( 2 0 4317.8854253280 2 5682.1145732043 ) 53.9149957120 (ExtendedPoll) - 7131+120 ( 2 0 4317.8854184488 2 5682.1145811854 ) 53.9149956927 (ExtendedPoll) - 7131+129 ( 2 0 4317.8854186637 2 5682.1145810957 ) 53.9149956917 (ExtendedPoll) - 7131+136 ( 2 0 4317.8854187880 2 5682.1145812036 ) 53.9149956895 (ExtendedPoll) - 7275+1 ( 2 0 4664.5897937388 2 5335.4101869888 ) 54.6460177074 (ExtendedPoll) - 7275+2 ( 2 0 3658.3592038639 2 6341.6407768637 ) 54.3665218070 (ExtendedPoll) - 7275+37 ( 2 0 3658.3592901848 2 6341.6406946471 ) 54.3665215475 (ExtendedPoll) - 7275+38 ( 2 0 3658.3595491473 2 6341.6404479973 ) 54.3665207691 (ExtendedPoll) - 7275+39 ( 2 0 3658.3598690753 2 6341.6400944160 ) 54.3665201699 (ExtendedPoll) - 7275+40 ( 2 0 3658.3608288593 2 6341.6390336723 ) 54.3665183724 (ExtendedPoll) - 7275+41 ( 2 0 3658.3646679955 2 6341.6347906973 ) 54.3665111823 (ExtendedPoll) - 7275+42 ( 2 0 3658.3800245403 2 6341.6178187975 ) 54.3664824230 (ExtendedPoll) - 7275+43 ( 2 0 3658.4414507195 2 6341.5499311982 ) 54.3663674021 (ExtendedPoll) - 7275+44 ( 2 0 3658.6871554362 2 6341.2783808011 ) 54.3659075842 (ExtendedPoll) - 7275+45 ( 2 0 3659.6699743029 2 6340.1921792124 ) 54.3640725584 (ExtendedPoll) - 7275+46 ( 2 0 3663.6012497698 2 6335.8473728577 ) 54.3568003795 (ExtendedPoll) - 7275+47 ( 2 0 3679.3263516374 2 6318.4681474388 ) 54.3287978530 (ExtendedPoll) - 7275+48 ( 2 0 3742.2267591076 2 6248.9512457632 ) 54.2341245206 (ExtendedPoll) - 7275+49 ( 2 0 3993.8283889887 2 5970.8836390611 ) 54.1291421044 (ExtendedPoll) - 7275+51 ( 2 0 3994.6101563766 2 5970.2984863845 ) 54.1270135487 (ExtendedPoll) - 7275+52 ( 2 0 3996.9554585404 2 5968.5430283547 ) 54.1206429804 (ExtendedPoll) - 7275+53 ( 2 0 4006.3366671954 2 5961.5211962354 ) 54.0953869891 (ExtendedPoll) - 7275+54 ( 2 0 4043.8615018154 2 5933.4338677582 ) 53.9979707862 (ExtendedPoll) - 7275+55 ( 2 0 4058.8195737352 2 5928.7389984696 ) 53.9018789159 (ExtendedPoll) - 7275+56 ( 2 0 4085.0234953465 2 5911.2697173953 ) 53.8187819628 (ExtendedPoll) - 7275+62 ( 2 0 4079.2095002390 2 5920.6867517244 ) 53.7866402997 (ExtendedPoll) - 7275+75 ( 2 0 4079.1688898115 2 5920.8018656928 ) 53.7859692077 (ExtendedPoll) - 7275+79 ( 2 0 4079.1419239280 2 5920.8566204642 ) 53.7857204969 (ExtendedPoll) - 7275+92 ( 2 0 4079.1420265196 2 5920.8575686043 ) 53.7857109426 (ExtendedPoll) - 7275+94 ( 2 0 4079.1415632502 2 5920.8584021968 ) 53.7857076422 (ExtendedPoll) - 7275+101 ( 2 0 4079.1418084008 2 5920.8581707058 ) 53.7857074853 (ExtendedPoll) - 7275+109 ( 2 0 4079.1417949665 2 5920.8581973084 ) 53.7857073675 (ExtendedPoll) - 7275+116 ( 2 0 4079.1417913882 2 5920.8582038435 ) 53.7857073412 (ExtendedPoll) - 7275+120 ( 2 0 4079.1417981276 2 5920.8582006667 ) 53.7857073079 (ExtendedPoll) - 7275+130 ( 2 0 4079.1417985233 2 5920.8582009121 ) 53.7857073020 (ExtendedPoll) - 7275+131 ( 2 0 4079.1417993958 2 5920.8582005863 ) 53.7857072969 (ExtendedPoll) - 7275+139 ( 2 0 4079.1417992378 2 5920.8582007573 ) 53.7857072968 (ExtendedPoll) - 7423+14 ( 2 0 4999.1900742320 2 5000.5459053974 ) 55.9012953652 (ExtendedPoll) - 7423+15 ( 2 0 4996.7603258365 2 5002.1836504981 ) 55.9000925053 (ExtendedPoll) - 7423+16 ( 2 0 4987.0413322545 2 5008.7346309009 ) 55.8954303274 (ExtendedPoll) - 7423+17 ( 2 0 4948.1653579264 2 5034.9385525122 ) 55.8791873269 (ExtendedPoll) - 7423+18 ( 2 0 4792.6614606142 2 5139.7542389575 ) 55.8538338094 (ExtendedPoll) - 7423+20 ( 2 0 4775.1921795400 2 5165.9581605689 ) 55.6864877206 (ExtendedPoll) - 7423+21 ( 2 0 4722.7843363173 2 5244.5699254029 ) 55.1994445339 (ExtendedPoll) - 7423+26 ( 2 0 4722.3476042905 2 5276.0146313364 ) 54.8445124513 (ExtendedPoll) - 7423+29 ( 2 0 4697.8906107866 2 5295.6675725449 ) 54.8205115310 (ExtendedPoll) - 7423+30 ( 2 0 4624.5196302749 2 5354.6263961704 ) 54.7613812550 (ExtendedPoll) - 7423+31 ( 2 0 4331.0357082280 2 5590.4616906724 ) 54.7273149903 (ExtendedPoll) - 7423+36 ( 2 0 4308.3256428315 2 5648.1103182173 ) 54.3396439948 (ExtendedPoll) - 7423+38 ( 2 0 4455.0676038550 2 5543.2946317720 ) 54.1475041698 (ExtendedPoll) - 7423+47 ( 2 0 4447.5339763917 2 5551.3741742688 ) 54.1273594464 (ExtendedPoll) - 7423+58 ( 2 0 4447.2091995963 2 5551.7388284514 ) 54.1263276850 (ExtendedPoll) - 7423+59 ( 2 0 4446.2348692102 2 5552.8327909991 ) 54.1232362635 (ExtendedPoll) - 7423+60 ( 2 0 4442.3375476659 2 5557.2086411901 ) 54.1109285550 (ExtendedPoll) - 7423+69 ( 2 0 4442.5740664204 2 5557.2691503271 ) 54.1082748289 (ExtendedPoll) - 7423+73 ( 2 0 4442.6925323818 2 5557.2986052154 ) 54.1069545527 (ExtendedPoll) - 7423+79 ( 2 0 4442.7168164211 2 5557.2801226062 ) 54.1069394344 (ExtendedPoll) - 7423+82 ( 2 0 4442.7071793373 2 5557.2919529796 ) 54.1068985868 (ExtendedPoll) - 7423+86 ( 2 0 4442.7017183179 2 5557.2972807450 ) 54.1068897802 (ExtendedPoll) - 7423+87 ( 2 0 4442.6853352597 2 5557.3132640411 ) 54.1068633612 (ExtendedPoll) - 7423+88 ( 2 0 4442.6198030272 2 5557.3771972256 ) 54.1067576985 (ExtendedPoll) - 7423+89 ( 2 0 4442.3576740969 2 5557.6329299635 ) 54.1063352645 (ExtendedPoll) - 7423+90 ( 2 0 4441.3091583760 2 5558.6558609153 ) 54.1046489915 (ExtendedPoll) - 7423+91 ( 2 0 4437.1150954922 2 5562.7475847223 ) 54.0979593435 (ExtendedPoll) - 7423+92 ( 2 0 4420.3388439569 2 5579.1144799504 ) 54.0720900340 (ExtendedPoll) - 7423+93 ( 2 0 4353.2338378159 2 5644.5820608629 ) 53.9829787440 (ExtendedPoll) - 7423+94 ( 2 0 4084.8138132516 2 5906.4523845126 ) 53.8646582524 (ExtendedPoll) - 7423+96 ( 2 0 4082.5755616140 2 5909.6528113969 ) 53.8560492754 (ExtendedPoll) - 7423+97 ( 2 0 4075.8608067011 2 5919.2540920498 ) 53.8305130308 (ExtendedPoll) - 7423+98 ( 2 0 4066.9078001506 2 5932.0285038353 ) 53.7973908395 (ExtendedPoll) - 7423+110 ( 2 0 4066.8994834762 2 5932.5167352687 ) 53.7930561968 (ExtendedPoll) - 7423+113 ( 2 0 4066.7294181484 2 5932.9744722294 ) 53.7904920157 (ExtendedPoll) - 7423+115 ( 2 0 4066.4042148569 2 5933.3386999159 ) 53.7902064369 (ExtendedPoll) - 7423+116 ( 2 0 4065.4286049825 2 5934.4313829753 ) 53.7893539893 (ExtendedPoll) - 7423+122 ( 2 0 4065.9681225742 2 5934.0003020220 ) 53.7882608591 (ExtendedPoll) - 7423+134 ( 2 0 4065.9833434669 2 5933.9992277641 ) 53.7881299256 (ExtendedPoll) - 7423+135 ( 2 0 4066.0088195296 2 5933.9824261494 ) 53.7880462489 (ExtendedPoll) - 7423+138 ( 2 0 4066.0322468281 2 5933.9628689699 ) 53.7880063853 (ExtendedPoll) - 7423+149 ( 2 0 4066.0333397798 2 5933.9653350231 ) 53.7879740199 (ExtendedPoll) - 7423+154 ( 2 0 4066.0330666936 2 5933.9662487622 ) 53.7879682924 (ExtendedPoll) - 7423+160 ( 2 0 4066.0329389515 2 5933.9664500713 ) 53.7879676549 (ExtendedPoll) - 7423+161 ( 2 0 4066.0325557253 2 5933.9670539988 ) 53.7879657426 (ExtendedPoll) - 7423+164 ( 2 0 4066.0323799541 2 5933.9674972574 ) 53.7879633642 (ExtendedPoll) - 7423+171 ( 2 0 4066.0324936658 2 5933.9674614732 ) 53.7879626367 (ExtendedPoll) - 7423+175 ( 2 0 4066.0325420577 2 5933.9674266746 ) 53.7879625038 (ExtendedPoll) - 7423+180 ( 2 0 4066.0325530871 2 5933.9674366944 ) 53.7879623114 (ExtendedPoll) - 7423+181 ( 2 0 4066.0325776078 2 5933.9674197559 ) 53.7879622378 (ExtendedPoll) - 7423+192 ( 2 0 4066.0325784803 2 5933.9674194301 ) 53.7879622327 (ExtendedPoll) - 7423+193 ( 2 0 4066.0325810978 2 5933.9674184529 ) 53.7879622173 (ExtendedPoll) - 7423+197 ( 2 0 4066.0325804614 2 5933.9674191328 ) 53.7879622170 (ExtendedPoll) - 7423+198 ( 2 0 4066.0325785520 2 5933.9674211726 ) 53.7879622163 (ExtendedPoll) - 7423+203 ( 2 0 4066.0325782752 2 5933.9674215470 ) 53.7879622154 (ExtendedPoll) - 7423+206 ( 2 0 4066.0325779836 2 5933.9674219101 ) 53.7879622149 (ExtendedPoll) - 7423+208 ( 2 0 4066.0325777001 2 5933.9674222795 ) 53.7879622141 (ExtendedPoll) - 7423+214 ( 2 0 4066.0325779310 2 5933.9674220447 ) 53.7879622141 (ExtendedPoll) - 7423+215 ( 2 0 4066.0325786236 2 5933.9674213404 ) 53.7879622141 (ExtendedPoll) - 7423+216 ( 2 0 4066.0325813941 2 5933.9674185232 ) 53.7879622139 (ExtendedPoll) - 7423+217 ( 2 0 4066.0325924760 2 5933.9674072542 ) 53.7879622133 (ExtendedPoll) - 7423+218 ( 2 0 4066.0326368038 2 5933.9673621781 ) 53.7879622107 (ExtendedPoll) - 7423+219 ( 2 0 4066.0328141148 2 5933.9671818738 ) 53.7879622005 (ExtendedPoll) - 7423+220 ( 2 0 4066.0335233590 2 5933.9664606566 ) 53.7879621598 (ExtendedPoll) - 7423+221 ( 2 0 4066.0363603358 2 5933.9635757879 ) 53.7879619968 (ExtendedPoll) - 7423+222 ( 2 0 4066.0477082430 2 5933.9520363132 ) 53.7879613453 (ExtendedPoll) - 7423+223 ( 2 0 4066.0930998717 2 5933.9058784143 ) 53.7879587467 (ExtendedPoll) - 7423+224 ( 2 0 4066.2746663863 2 5933.7212468186 ) 53.7879484746 (ExtendedPoll) - 7423+225 ( 2 0 4067.0009324450 2 5932.9827204360 ) 53.7879093366 (ExtendedPoll) - 7423+226 ( 2 0 4069.9059966798 2 5930.0286149054 ) 53.7877839844 (ExtendedPoll) - 7423+227 ( 2 0 4081.5262536188 2 5918.2121927832 ) 53.7877812112 (ExtendedPoll) - 7423+230 ( 2 0 4081.5299687022 2 5918.2130588562 ) 53.7877391250 (ExtendedPoll) - 7423+231 ( 2 0 4081.5411139525 2 5918.2156570750 ) 53.7876128665 (ExtendedPoll) - 7423+232 ( 2 0 4081.5856949536 2 5918.2260499504 ) 53.7871078341 (ExtendedPoll) - 7423+233 ( 2 0 4081.6155830020 2 5918.2198824166 ) 53.7868886494 (ExtendedPoll) - 7423+234 ( 2 0 4081.7052471472 2 5918.2013798154 ) 53.7862311047 (ExtendedPoll) - 7423+236 ( 2 0 4081.6080460159 2 5918.3440427676 ) 53.7858294673 (ExtendedPoll) - 7423+240 ( 2 0 4081.5880590083 2 5918.4017130398 ) 53.7854893417 (ExtendedPoll) - 7423+247 ( 2 0 4081.6043092810 2 5918.3875148632 ) 53.7854687399 (ExtendedPoll) - 7423+248 ( 2 0 4081.6530600991 2 5918.3449203333 ) 53.7854069422 (ExtendedPoll) - 7423+257 ( 2 0 4081.6496579113 2 5918.3491070966 ) 53.7854002178 (ExtendedPoll) - 7423+266 ( 2 0 4081.6498661605 2 5918.3495360557 ) 53.7853944010 (ExtendedPoll) - 7423+267 ( 2 0 4081.6493358875 2 5918.3503287128 ) 53.7853920795 (ExtendedPoll) - 7423+274 ( 2 0 4081.6491972063 2 5918.3505226482 ) 53.7853915938 (ExtendedPoll) - 7423+275 ( 2 0 4081.6487811625 2 5918.3511044543 ) 53.7853901369 (ExtendedPoll) - 7423+284 ( 2 0 4081.6488121122 2 5918.3511553938 ) 53.7853893889 (ExtendedPoll) - 7423+287 ( 2 0 4081.6488409573 2 5918.3511479011 ) 53.7853891913 (ExtendedPoll) - 7423+293 ( 2 0 4081.6488473913 2 5918.3511516580 ) 53.7853890979 (ExtendedPoll) - 7423+298 ( 2 0 4081.6488480521 2 5918.3511510017 ) 53.7853890978 (ExtendedPoll) - 7423+299 ( 2 0 4081.6488500345 2 5918.3511490328 ) 53.7853890974 (ExtendedPoll) - 7423+300 ( 2 0 4081.6488579640 2 5918.3511411574 ) 53.7853890960 (ExtendedPoll) - 7423+301 ( 2 0 4081.6488896822 2 5918.3511096556 ) 53.7853890902 (ExtendedPoll) - 7423+310 ( 2 0 4081.6488900669 2 5918.3511093933 ) 53.7853890891 (ExtendedPoll) - 7423+311 ( 2 0 4081.6488912210 2 5918.3511086061 ) 53.7853890856 (ExtendedPoll) - 7423+319 ( 2 0 4081.6488912536 2 5918.3511087179 ) 53.7853890843 (ExtendedPoll) - 7423+323 ( 2 0 4081.6488912181 2 5918.3511087641 ) 53.7853890842 (ExtendedPoll) - 7752 ( 3 0 3209.7898482266 2 3041.1228583258 1 3749.0872770800 ) 46.5944609002 - 7753 ( 3 0 3209.7897367750 2 3041.1229969359 1 3749.0872586356 ) 46.5944605757 - 7758+32 ( 2 0 4999.9999577432 2 5000.0000417347 ) 55.9016992549 (ExtendedPoll) - 7758+39 ( 2 0 4999.9999505368 2 5000.0000494217 ) 55.9016992168 (ExtendedPoll) - 7758+40 ( 2 0 4999.9999398266 2 5000.0000597821 ) 55.9016991732 (ExtendedPoll) - 7758+41 ( 2 0 4999.9999076961 2 5000.0000908630 ) 55.9016990423 (ExtendedPoll) - 7758+42 ( 2 0 4999.9997791737 2 5000.0002151869 ) 55.9016985186 (ExtendedPoll) - 7758+43 ( 2 0 4999.9992650844 2 5000.0007124825 ) 55.9016964242 (ExtendedPoll) - 7758+44 ( 2 0 4999.9972087269 2 5000.0027016649 ) 55.9016880465 (ExtendedPoll) - 7758+45 ( 2 0 4999.9889832972 2 5000.0106583944 ) 55.9016545357 (ExtendedPoll) - 7758+46 ( 2 0 4999.9560815784 2 5000.0424853122 ) 55.9015204952 (ExtendedPoll) - 7758+47 ( 2 0 4999.8244747033 2 5000.1697929837 ) 55.9009843757 (ExtendedPoll) - 7758+48 ( 2 0 4999.2980472026 2 5000.6790236696 ) 55.8988405794 (ExtendedPoll) - 7758+49 ( 2 0 4997.1923371998 2 5002.7159464134 ) 55.8902763014 (ExtendedPoll) - 7758+50 ( 2 0 4988.7694971886 2 5010.8636373882 ) 55.8561940243 (ExtendedPoll) - 7758+51 ( 2 0 4955.0781371440 2 5043.4544012877 ) 55.7226824798 (ExtendedPoll) - 7758+52 ( 2 0 4820.3126969657 2 5173.8174568856 ) 55.2350077198 (ExtendedPoll) - 7758+53 ( 2 0 4281.2509362523 2 5695.2696792774 ) 54.1064641659 (ExtendedPoll) - 7758+55 ( 2 0 4281.1646507560 2 5695.4980679496 ) 54.1049615847 (ExtendedPoll) - 7758+56 ( 2 0 4280.9057942672 2 5696.1832339664 ) 54.1004549928 (ExtendedPoll) - 7758+57 ( 2 0 4279.8703683119 2 5698.9238980333 ) 54.0824459107 (ExtendedPoll) - 7758+58 ( 2 0 4275.7286644908 2 5709.8865543012 ) 54.0106865894 (ExtendedPoll) - 7758+59 ( 2 0 4276.7931988063 2 5713.6465440949 ) 53.9642063625 (ExtendedPoll) - 7758+60 ( 2 0 4274.1455108935 2 5720.9891012964 ) 53.9153574311 (ExtendedPoll) - 7758+61 ( 2 0 4264.8649553228 2 5733.5451470685 ) 53.8744070070 (ExtendedPoll) - 7758+68 ( 2 0 4267.0690872708 2 5731.8801062161 ) 53.8711681165 (ExtendedPoll) - 7758+71 ( 2 0 4268.6471229147 2 5730.7285666922 ) 53.8684637360 (ExtendedPoll) - 7758+80 ( 2 0 4268.8897458950 2 5730.7013509085 ) 53.8665809105 (ExtendedPoll) - 7758+83 ( 2 0 4269.1151490944 2 5730.6075484182 ) 53.8655030390 (ExtendedPoll) - 7758+88 ( 2 0 4269.2342348079 2 5730.5807124826 ) 53.8647110142 (ExtendedPoll) - 7758+91 ( 2 0 4269.3362140286 2 5730.5136259757 ) 53.8644648872 (ExtendedPoll) - 7758+92 ( 2 0 4269.6421516907 2 5730.3123664551 ) 53.8637267148 (ExtendedPoll) - 7758+99 ( 2 0 4269.6705853207 2 5730.3012821375 ) 53.8635834586 (ExtendedPoll) - 7758+104 ( 2 0 4269.6856215996 2 5730.3038783910 ) 53.8634248321 (ExtendedPoll) - 7758+107 ( 2 0 4269.6932509707 2 5730.3038560301 ) 53.8633574718 (ExtendedPoll) - 7758+111 ( 2 0 4269.6964158444 2 5730.3017263609 ) 53.8633503046 (ExtendedPoll) - 7758+119 ( 2 0 4269.6971078879 2 5730.3023825398 ) 53.8633377454 (ExtendedPoll) - 7758+120 ( 2 0 4269.6986534873 2 5730.3012649089 ) 53.8633350054 (ExtendedPoll) - 7758+129 ( 2 0 4269.6987532838 2 5730.3011997053 ) 53.8633347603 (ExtendedPoll) - 7758+137 ( 2 0 4269.6987734099 2 5730.3012216853 ) 53.8633343667 (ExtendedPoll) - 7758+139 ( 2 0 4269.6987532218 2 5730.3012436083 ) 53.8633343307 (ExtendedPoll) - 7758+146 ( 2 0 4269.6987565277 2 5730.3012418911 ) 53.8633343182 (ExtendedPoll) - 7758+148 ( 2 0 4269.6987598023 2 5730.3012401148 ) 53.8633343066 (ExtendedPoll) - 7758+158 ( 2 0 4269.6987598456 2 5730.3012400760 ) 53.8633343066 (ExtendedPoll) - 7758+159 ( 2 0 4269.6987599757 2 5730.3012399595 ) 53.8633343066 (ExtendedPoll) - 7758+160 ( 2 0 4269.6987604960 2 5730.3012394935 ) 53.8633343066 (ExtendedPoll) - 7928 ( 3 0 3209.7896557217 2 3041.1230842797 1 3749.0872551315 ) 46.5944603702 - 7933+5 ( 2 0 4909.1597359805 2 5083.8525467227 ) 55.5960690117 (ExtendedPoll) - 7933+6 ( 2 0 4636.6389512227 2 5335.4101941914 ) 54.8753884193 (ExtendedPoll) - 7933+10 ( 2 0 4468.9338529103 2 5503.1152925039 ) 54.4525845141 (ExtendedPoll) - 7933+11 ( 2 0 3965.8185579728 2 6006.2305874414 ) 54.0810898671 (ExtendedPoll) - 7933+19 ( 2 0 4063.6465319884 2 5929.3657507148 ) 53.8515922697 (ExtendedPoll) - 7933+32 ( 2 0 4065.8046023555 2 5931.0905010240 ) 53.8160592307 (ExtendedPoll) - 7933+33 ( 2 0 4064.4534626474 2 5934.7549556868 ) 53.7954447026 (ExtendedPoll) - 7933+39 ( 2 0 4065.1985513690 2 5934.1237414293 ) 53.7942572358 (ExtendedPoll) - 7933+40 ( 2 0 4067.4338175338 2 5932.2300986566 ) 53.7907104457 (ExtendedPoll) - 7933+47 ( 2 0 4067.6763605460 2 5932.2578742164 ) 53.7882192511 (ExtendedPoll) - 7933+56 ( 2 0 4067.6961659596 2 5932.2810920154 ) 53.7878265281 (ExtendedPoll) - 7933+64 ( 2 0 4067.7064620507 2 5932.2843178088 ) 53.7877022834 (ExtendedPoll) - 7933+68 ( 2 0 4067.7096029627 2 5932.2864826593 ) 53.7876537119 (ExtendedPoll) - 7933+69 ( 2 0 4067.7163863700 2 5932.2829908004 ) 53.7876226117 (ExtendedPoll) - 7933+81 ( 2 0 4067.7165647188 2 5932.2828325755 ) 53.7876223942 (ExtendedPoll) - 7933+82 ( 2 0 4067.7170997651 2 5932.2823579007 ) 53.7876217416 (ExtendedPoll) - 7933+83 ( 2 0 4067.7192399506 2 5932.2804592016 ) 53.7876191311 (ExtendedPoll) - 7933+86 ( 2 0 4067.7200409230 2 5932.2799415742 ) 53.7876164105 (ExtendedPoll) - 7933+101 ( 2 0 4067.7200445311 2 5932.2799480928 ) 53.7876163183 (ExtendedPoll) - 7933+105 ( 2 0 4067.7200436470 2 5932.2799517117 ) 53.7876162938 (ExtendedPoll) - 7933+110 ( 2 0 4067.7200455038 2 5932.2799515643 ) 53.7876162780 (ExtendedPoll) - 7933+111 ( 2 0 4067.7200489601 2 5932.2799501743 ) 53.7876162586 (ExtendedPoll) - 7933+119 ( 2 0 4067.7200493934 2 5932.2799500040 ) 53.7876162561 (ExtendedPoll) - 7933+122 ( 2 0 4067.7200493924 2 5932.2799504696 ) 53.7876162519 (ExtendedPoll) - 7933+129 ( 2 0 4067.7200493199 2 5932.2799505607 ) 53.7876162518 (ExtendedPoll) - 7933+130 ( 2 0 4067.7200491022 2 5932.2799508337 ) 53.7876162513 (ExtendedPoll) - 7933+141 ( 2 0 4067.7200491111 2 5932.2799508739 ) 53.7876162509 (ExtendedPoll) - 8079+2 ( 2 0 4664.5898009415 2 5335.4101941914 ) 54.6460175679 (ExtendedPoll) - 8079+3 ( 2 0 3658.3592110666 2 6341.6407840663 ) 54.3665216810 (ExtendedPoll) - 8079+47 ( 2 0 3658.3592086607 2 6341.6407911178 ) 54.3665216529 (ExtendedPoll) - 8079+49 ( 2 0 3658.3592231902 2 6341.6407758540 ) 54.3665216198 (ExtendedPoll) - 8079+50 ( 2 0 3658.3592667787 2 6341.6407300627 ) 54.3665215205 (ExtendedPoll) - 8079+51 ( 2 0 3658.3594411326 2 6341.6405468973 ) 54.3665211233 (ExtendedPoll) - 8079+52 ( 2 0 3658.3601385484 2 6341.6398142359 ) 54.3665195344 (ExtendedPoll) - 8079+53 ( 2 0 3658.3629282116 2 6341.6368835902 ) 54.3665131789 (ExtendedPoll) - 8079+54 ( 2 0 3658.3740868643 2 6341.6251610074 ) 54.3664877574 (ExtendedPoll) - 8079+55 ( 2 0 3658.4187214749 2 6341.5782706765 ) 54.3663860796 (ExtendedPoll) - 8079+56 ( 2 0 3658.5972599177 2 6341.3907093526 ) 54.3659794991 (ExtendedPoll) - 8079+57 ( 2 0 3659.3114136885 2 6340.6404640569 ) 54.3643552693 (ExtendedPoll) - 8079+58 ( 2 0 3662.1680287720 2 6337.6394828742 ) 54.3578918193 (ExtendedPoll) - 8079+59 ( 2 0 3673.5944891057 2 6325.6355581437 ) 54.3325733144 (ExtendedPoll) - 8079+60 ( 2 0 3719.3003304408 2 6277.6198592213 ) 54.2398493355 (ExtendedPoll) - 8079+61 ( 2 0 3902.1236957812 2 6085.5570635318 ) 54.0045822968 (ExtendedPoll) - 8079+63 ( 2 0 3902.2168451994 2 6085.4781750776 ) 54.0043572353 (ExtendedPoll) - 8079+64 ( 2 0 3902.4962934540 2 6085.2415097151 ) 54.0036823026 (ExtendedPoll) - 8079+65 ( 2 0 3903.6140864724 2 6084.2948482648 ) 54.0009863502 (ExtendedPoll) - 8079+66 ( 2 0 3908.0852585462 2 6080.5082024636 ) 53.9902629755 (ExtendedPoll) - 8079+67 ( 2 0 3925.9699468413 2 6065.3616192587 ) 53.9483351232 (ExtendedPoll) - 8079+68 ( 2 0 3929.8118238900 2 6064.6724015289 ) 53.9176744624 (ExtendedPoll) - 8079+71 ( 2 0 3933.6400530629 2 6065.4639783275 ) 53.8745546326 (ExtendedPoll) - 8079+74 ( 2 0 3935.2163827223 2 6064.3107328191 ) 53.8694071337 (ExtendedPoll) - 8079+80 ( 2 0 3934.4145700168 2 6065.4354030875 ) 53.8674407841 (ExtendedPoll) - 8079+86 ( 2 0 3934.3391268516 2 6065.5313647145 ) 53.8673400617 (ExtendedPoll) - 8079+87 ( 2 0 3934.1127973559 2 6065.8192495955 ) 53.8670381792 (ExtendedPoll) - 8079+97 ( 2 0 3934.1264743868 2 6065.8465307696 ) 53.8666759354 (ExtendedPoll) - 8079+99 ( 2 0 3934.1212739663 2 6065.8766020781 ) 53.8664692539 (ExtendedPoll) - 8079+109 ( 2 0 3934.1202740309 2 6065.8782263033 ) 53.8664649210 (ExtendedPoll) - 8079+113 ( 2 0 3934.1223533865 2 6065.8765080955 ) 53.8664598006 (ExtendedPoll) - 8079+114 ( 2 0 3934.1285914536 2 6065.8713534722 ) 53.8664444397 (ExtendedPoll) - 8079+118 ( 2 0 3934.1299504561 2 6065.8700151548 ) 53.8664429271 (ExtendedPoll) - 8079+132 ( 2 0 3934.1299636052 2 6065.8700081445 ) 53.8664428619 (ExtendedPoll) - 8079+133 ( 2 0 3934.1300030527 2 6065.8699871137 ) 53.8664426663 (ExtendedPoll) - 8079+138 ( 2 0 3934.1300169838 2 6065.8699818250 ) 53.8664425790 (ExtendedPoll) - 8079+144 ( 2 0 3934.1300195727 2 6065.8699791463 ) 53.8664425772 (ExtendedPoll) - 8079+145 ( 2 0 3934.1300273392 2 6065.8699711101 ) 53.8664425718 (ExtendedPoll) - 8079+146 ( 2 0 3934.1300584054 2 6065.8699389652 ) 53.8664425505 (ExtendedPoll) - 8079+147 ( 2 0 3934.1301826702 2 6065.8698103857 ) 53.8664424650 (ExtendedPoll) - 8079+148 ( 2 0 3934.1306797292 2 6065.8692960676 ) 53.8664421232 (ExtendedPoll) - 8079+149 ( 2 0 3934.1326679655 2 6065.8672387954 ) 53.8664407559 (ExtendedPoll) - 8079+150 ( 2 0 3934.1406209105 2 6065.8590097066 ) 53.8664352870 (ExtendedPoll) - 8079+151 ( 2 0 3934.1724326905 2 6065.8260933514 ) 53.8664134151 (ExtendedPoll) - 8079+152 ( 2 0 3934.2996798107 2 6065.6944279307 ) 53.8663259908 (ExtendedPoll) - 8079+153 ( 2 0 3934.8086682912 2 6065.1677662475 ) 53.8659772994 (ExtendedPoll) - 8079+154 ( 2 0 3936.8446222133 2 6063.0611195148 ) 53.8645986296 (ExtendedPoll) - 8079+155 ( 2 0 3944.9884379019 2 6054.6345325840 ) 53.8593413213 (ExtendedPoll) - 8079+156 ( 2 0 3977.5637006562 2 6020.9281848608 ) 53.8424195173 (ExtendedPoll) - 8079+157 ( 2 0 4107.8647516735 2 5886.1027939679 ) 53.8397272797 (ExtendedPoll) - 8079+160 ( 2 0 4107.9148966216 2 5886.1375900537 ) 53.8389476963 (ExtendedPoll) - 8079+161 ( 2 0 4108.0653314659 2 5886.2419783111 ) 53.8366089797 (ExtendedPoll) - 8079+162 ( 2 0 4108.6670708432 2 5886.6595313405 ) 53.8272546148 (ExtendedPoll) - 8079+163 ( 2 0 4111.0740283523 2 5888.3297434584 ) 53.7898451866 (ExtendedPoll) - 8079+164 ( 2 0 4110.6415612866 2 5889.2053399927 ) 53.7857457298 (ExtendedPoll) - 8079+169 ( 2 0 4110.3275535183 2 5889.5792704659 ) 53.7851798069 (ExtendedPoll) - 8079+177 ( 2 0 4110.3514722870 2 5889.6354230117 ) 53.7844442616 (ExtendedPoll) - 8079+179 ( 2 0 4110.3094657512 2 5889.6797036381 ) 53.7844214421 (ExtendedPoll) - 8079+180 ( 2 0 4110.1834461437 2 5889.8125455175 ) 53.7843530488 (ExtendedPoll) - 8079+189 ( 2 0 4110.1987859472 2 5889.7973681491 ) 53.7843522353 (ExtendedPoll) - 8079+190 ( 2 0 4110.2448053575 2 5889.7518360439 ) 53.7843498028 (ExtendedPoll) - 8079+191 ( 2 0 4110.4288829988 2 5889.5697076232 ) 53.7843401922 (ExtendedPoll) - 8079+198 ( 2 0 4110.4212701576 2 5889.5773535241 ) 53.7843395401 (ExtendedPoll) - 8079+199 ( 2 0 4110.3984316340 2 5889.6002912268 ) 53.7843375858 (ExtendedPoll) - 8079+200 ( 2 0 4110.3070775395 2 5889.6920420376 ) 53.7843297986 (ExtendedPoll) - 8079+213 ( 2 0 4110.3073348959 2 5889.6924434618 ) 53.7843237498 (ExtendedPoll) - 8079+218 ( 2 0 4110.3074006879 2 5889.6925428714 ) 53.7843222330 (ExtendedPoll) - 8079+220 ( 2 0 4110.3073219352 2 5889.6926323636 ) 53.7843221306 (ExtendedPoll) - 8079+221 ( 2 0 4110.3070856770 2 5889.6929008404 ) 53.7843218236 (ExtendedPoll) - 8079+229 ( 2 0 4110.3070782245 2 5889.6929137441 ) 53.7843217731 (ExtendedPoll) - 8079+234 ( 2 0 4110.3070784835 2 5889.6929211901 ) 53.7843217023 (ExtendedPoll) - 8079+244 ( 2 0 4110.3070782010 2 5889.6929215603 ) 53.7843217014 (ExtendedPoll) - 8079+248 ( 2 0 4110.3070784332 2 5889.6929215433 ) 53.7843216995 (ExtendedPoll) - 8079+255 ( 2 0 4110.3070784211 2 5889.6929215697 ) 53.7843216993 (ExtendedPoll) - 8338 ( 3 0 3209.7896175644 2 3041.1231297861 1 3749.0872500424 ) 46.5944602659 - 8342+4 ( 2 0 4720.4915015090 2 5223.6067964464 ) 55.4583179990 (ExtendedPoll) - 8342+6 ( 2 0 4385.0813048840 2 5559.0169930714 ) 54.5837536455 (ExtendedPoll) - 8342+11 ( 2 0 4580.7372529152 2 5419.2627444776 ) 54.4134065463 (ExtendedPoll) - 8342+19 ( 2 0 4558.0271875187 2 5440.6626137936 ) 54.3705316119 (ExtendedPoll) - 8342+20 ( 2 0 4489.8969913293 2 5504.8622217413 ) 54.2562699395 (ExtendedPoll) - 8342+21 ( 2 0 4217.3762065715 2 5761.6606535323 ) 54.0237236224 (ExtendedPoll) - 8342+31 ( 2 0 4224.1455529878 2 5775.7452613984 ) 53.8272825836 (ExtendedPoll) - 8342+40 ( 2 0 4224.0014506112 2 5775.9423292618 ) 53.8266734099 (ExtendedPoll) - 8342+42 ( 2 0 4224.5165513001 2 5775.4823531964 ) 53.8264974549 (ExtendedPoll) - 8342+55 ( 2 0 4224.5193698410 2 5775.4797826488 ) 53.8264970122 (ExtendedPoll) - 8342+56 ( 2 0 4224.5278254637 2 5775.4720710060 ) 53.8264956843 (ExtendedPoll) - 8342+72 ( 2 0 4224.5278620041 2 5775.4721180965 ) 53.8264949041 (ExtendedPoll) - 8342+75 ( 2 0 4224.5278401629 2 5775.4721383731 ) 53.8264949041 (ExtendedPoll) - 8342+76 ( 2 0 4224.5277746392 2 5775.4721992028 ) 53.8264949041 (ExtendedPoll) - 8342+77 ( 2 0 4224.5275125446 2 5775.4724425218 ) 53.8264949040 (ExtendedPoll) - 8342+78 ( 2 0 4224.5264641662 2 5775.4734157976 ) 53.8264949035 (ExtendedPoll) - 8342+79 ( 2 0 4224.5222706526 2 5775.4773089008 ) 53.8264949018 (ExtendedPoll) - 8342+80 ( 2 0 4224.5054965982 2 5775.4928813139 ) 53.8264948957 (ExtendedPoll) - 8342+81 ( 2 0 4224.4384003804 2 5775.5551709661 ) 53.8264948856 (ExtendedPoll) - 8342+83 ( 2 0 4224.4377205871 2 5775.5589246019 ) 53.8264648146 (ExtendedPoll) - 8342+86 ( 2 0 4224.4354746818 2 5775.5620080759 ) 53.8264551993 (ExtendedPoll) - 8342+87 ( 2 0 4224.4287369659 2 5775.5712584979 ) 53.8264263535 (ExtendedPoll) - 8342+108 ( 2 0 4224.4287371566 2 5775.5712603508 ) 53.8264263340 (ExtendedPoll) - 8342+110 ( 2 0 4224.4287369462 2 5775.5712622015 ) 53.8264263180 (ExtendedPoll) - 8342+112 ( 2 0 4224.4287384895 2 5775.5712611586 ) 53.8264263143 (ExtendedPoll) - 8342+120 ( 2 0 4224.4287387223 2 5775.5712611587 ) 53.8264263122 (ExtendedPoll) - 8342+123 ( 2 0 4224.4287389206 2 5775.5712610366 ) 53.8264263116 (ExtendedPoll) - 8342+128 ( 2 0 4224.4287388106 2 5775.5712611591 ) 53.8264263114 (ExtendedPoll) - 8342+134 ( 2 0 4224.4287388393 2 5775.5712611545 ) 53.8264263112 (ExtendedPoll) - 8479+5 ( 2 0 4748.4423512277 2 5251.5576461652 ) 54.9123289774 (ExtendedPoll) - 8479+6 ( 2 0 3993.7694088215 2 6006.2305885713 ) 53.8183150359 (ExtendedPoll) - 8479+51 ( 2 0 3993.7694094976 2 6006.2305892118 ) 53.8183150239 (ExtendedPoll) - 8479+52 ( 2 0 3993.7694111450 2 6006.2305883426 ) 53.8183150161 (ExtendedPoll) - 8479+63 ( 2 0 3993.7694114742 2 6006.2305883502 ) 53.8183150129 (ExtendedPoll) - 8479+65 ( 2 0 3993.7694113839 2 6006.2305885648 ) 53.8183150119 (ExtendedPoll) - 8479+70 ( 2 0 3993.7694115223 2 6006.2305884756 ) 53.8183150114 (ExtendedPoll) - 8557 ( 3 0 3209.7895991439 2 3041.1231230634 1 3749.0872724849 ) 46.5944602388 - 8558 ( 3 0 3209.7895438823 2 3041.1231028951 1 3749.0873398125 ) 46.5944601576 - 8559 ( 3 0 3209.7893228358 2 3041.1230222222 1 3749.0876091228 ) 46.5944598326 - 8560 ( 3 0 3209.7884386500 2 3041.1226995306 1 3749.0886863640 ) 46.5944585328 - 8561 ( 3 0 3209.7849019068 2 3041.1214087641 1 3749.0929953290 ) 46.5944533336 - 8562 ( 3 0 3209.7707549341 2 3041.1162456982 1 3749.1102311888 ) 46.5944325369 - 8563 ( 3 0 3209.7141670434 2 3041.0955934346 1 3749.1791746282 ) 46.5943493545 - 8564 ( 3 0 3209.4878154802 2 3041.0129843799 1 3749.4549483857 ) 46.5940166899 - 8565 ( 3 0 3208.5824092276 2 3040.6825481613 1 3750.5580434156 ) 46.5926870780 - 8566 ( 3 0 3204.9607842173 2 3039.3608032869 1 3754.9704235351 ) 46.5873853782 - 8567 ( 3 0 3190.4742841761 2 3034.0738237895 1 3772.6199440134 ) 46.5664471002 - 8568 ( 3 0 3132.5282840110 2 3012.9259057995 1 3843.2180259264 ) 46.4870256328 - 8569 ( 3 0 2900.7442833508 2 2928.3342338397 1 4125.6103535787 ) 46.2408879908 - 8571 ( 3 0 2900.7614274922 2 2928.3321612234 1 4125.8538859951 ) 46.2381909255 - 8572 ( 3 0 2900.8128599165 2 2928.3259433745 1 4126.5844832443 ) 46.2301005176 - 8573 ( 3 0 2901.0185896137 2 2928.3010719787 1 4129.5068722413 ) 46.1977507173 - 8574 ( 3 0 2901.8415084025 2 2928.2015863959 1 4141.1964282293 ) 46.0685414984 - 8575 ( 3 0 2900.9072090155 2 2929.0263074597 1 4144.8990220964 ) 46.0294803754 - 8576 ( 3 0 2898.1043108544 2 2931.5004706513 1 4156.0068036976 ) 45.9126009127 - 8577 ( 3 0 2893.3059337557 2 2930.6699823072 1 4170.8633174072 ) 45.8058560157 - 8578 ( 3 0 2906.2246413292 2 2906.6780968135 1 4186.3657664955 ) 45.7664430594 - 8585 ( 3 0 2885.1856032809 2 2904.8325671601 1 4209.2503341972 ) 45.7234233185 - 8586 ( 3 0 2822.0684891358 2 2899.2959782000 1 4277.9040373024 ) 45.6027586237 - 8587 ( 3 0 2569.6000325554 2 2877.1496223596 1 4552.5188497232 ) 45.2497134209 - 8604 ( 3 0 2569.6580658121 2 2876.7761909688 1 4553.4192663392 ) 45.2437144482 - 8605 ( 3 0 2570.2146083482 2 2875.2291180641 1 4554.4732367897 ) 45.2420565509 - 8619 ( 3 0 2570.1792950214 2 2875.1673676151 1 4554.5724351350 ) 45.2419430091 - 8620 ( 3 0 2570.0733550410 2 2874.9821162682 1 4554.8700301708 ) 45.2416024126 - 8621 ( 3 0 2569.6495951193 2 2874.2411108805 1 4556.0604103143 ) 45.2402404599 - 8628 ( 3 0 2569.2779660036 2 2874.5306463677 1 4556.1885520705 ) 45.2397502250 - 8645 ( 3 0 2569.2890178965 2 2874.5245089523 1 4556.1847035137 ) 45.2397436100 - 8656 ( 3 0 2569.2838215385 2 2874.5258438228 1 4556.1885598972 ) 45.2397403650 - 8657 ( 3 0 2569.2682324643 2 2874.5298484341 1 4556.2001290477 ) 45.2397306308 - 8658 ( 3 0 2569.2058761675 2 2874.5458668797 1 4556.2464056497 ) 45.2396917036 - 8659 ( 3 0 2568.9564509805 2 2874.6099406618 1 4556.4315120578 ) 45.2395361495 - 8660 ( 3 0 2567.9587502324 2 2874.8662357905 1 4557.1719376902 ) 45.2389164047 - 8661 ( 3 0 2563.9679472400 2 2875.8914163050 1 4560.1336402198 ) 45.2364769895 - 8662 ( 3 0 2548.0047352705 2 2879.9921383632 1 4571.9804503382 ) 45.2273531705 - 8663 ( 3 0 2484.1518873922 2 2896.3950265960 1 4619.3676908119 ) 45.2010503608 - 8675 ( 3 0 2484.0736686549 2 2896.3896310350 1 4619.4612514156 ) 45.2009055791 - 8676 ( 3 0 2483.8390124432 2 2896.3734443522 1 4619.7419332265 ) 45.2004713862 - 8689 ( 3 0 2483.8404577833 2 2896.3642671817 1 4619.7710023038 ) 45.2002598293 - 8696 ( 3 0 2483.8253676018 2 2896.3813588741 1 4619.7912874024 ) 45.2000581939 - 8712 ( 3 0 2483.8253703113 2 2896.3815984832 1 4619.7922104815 ) 45.2000473949 - 8714 ( 3 0 2483.8245414630 2 2896.3833077377 1 4619.7920389071 ) 45.2000420407 - 8717 ( 3 0 2483.8258603227 2 2896.3779360857 1 4619.7956529999 ) 45.2000411600 - 8718 ( 3 0 2483.8298169016 2 2896.3618211298 1 4619.8064952782 ) 45.2000385180 - 8719 ( 3 0 2483.8456432174 2 2896.2973613061 1 4619.8498643917 ) 45.2000279546 - 8720 ( 3 0 2483.9089484806 2 2896.0395220115 1 4620.0233408456 ) 45.1999857711 - 8721 ( 3 0 2484.1621695335 2 2895.0081648328 1 4620.7172466613 ) 45.1998181601 - 8722 ( 3 0 2485.1750537449 2 2890.8827361181 1 4623.4928699239 ) 45.1991656831 - 8723 ( 3 0 2489.2265905905 2 2874.3810212593 1 4634.5953629742 ) 45.1968429324 - 8724 ( 3 0 2505.4327379729 2 2808.3741618241 1 4679.0053351755 ) 45.1921264676 - 8727 ( 3 0 2505.3685769810 2 2808.4952747076 1 4679.9720755135 ) 45.1823799799 - 8728 ( 3 0 2505.1760940054 2 2808.8586133581 1 4682.8722965274 ) 45.1531602599 - 8729 ( 3 0 2503.1517786669 2 2810.5022882056 1 4685.7790057314 ) 45.1291493448 - 8738 ( 3 0 2502.1929683392 2 2809.7986800253 1 4687.3275204562 ) 45.1288718569 - 8739 ( 3 0 2499.3165373560 2 2807.6878554842 1 4691.9730646305 ) 45.1280529948 - 8740 ( 3 0 2487.8108134233 2 2799.2445573201 1 4710.5552413278 ) 45.1249818571 - 8741 ( 3 0 2441.7879176925 2 2765.4713646635 1 4784.8839481171 ) 45.1159841138 - 8744 ( 3 0 2462.0887438795 2 2743.6941147538 1 4794.1115963840 ) 45.0330234211 - 8760 ( 3 0 2462.3136002207 2 2743.6052851221 1 4794.0775784423 ) 45.0321070688 - 8776 ( 3 0 2462.3185474349 2 2743.6003098574 1 4794.0805750106 ) 45.0320771528 - 8786 ( 3 0 2462.3197386852 2 2743.5989064226 1 4794.0810742815 ) 45.0320738114 - 8793 ( 3 0 2462.3211643858 2 2743.5976465736 1 4794.0809396072 ) 45.0320731778 - 8794 ( 3 0 2462.3254414876 2 2743.5938670266 1 4794.0805355845 ) 45.0320712769 - 8812 ( 3 0 2462.3255079460 2 2743.5937832827 1 4794.0805883207 ) 45.0320709008 - 8813 ( 3 0 2462.3257073210 2 2743.5935320511 1 4794.0807465293 ) 45.0320697728 - 8826 ( 3 0 2462.3257104845 2 2743.5935091129 1 4794.0807652912 ) 45.0320697624 - 8827 ( 3 0 2462.3257199749 2 2743.5934402983 1 4794.0808215770 ) 45.0320697313 - 8828 ( 3 0 2462.3257579368 2 2743.5931650398 1 4794.0810467200 ) 45.0320696068 - 8829 ( 3 0 2462.3259097844 2 2743.5920640060 1 4794.0819472921 ) 45.0320691088 - 8830 ( 3 0 2462.3265171749 2 2743.5876598710 1 4794.0855495803 ) 45.0320671166 - 8831 ( 3 0 2462.3289467365 2 2743.5700433307 1 4794.0999587333 ) 45.0320591485 - 8832 ( 3 0 2462.3386649831 2 2743.4995771695 1 4794.1575953453 ) 45.0320272796 - 8833 ( 3 0 2462.3775379695 2 2743.2177125248 1 4794.3881417933 ) 45.0318998663 - 8834 ( 3 0 2462.5330299152 2 2742.0902539461 1 4795.3103275852 ) 45.0313912035 - 8835 ( 3 0 2463.1549976977 2 2737.5804196312 1 4798.9990707529 ) 45.0293724005 - 8836 ( 3 0 2465.6428688278 2 2719.5410823714 1 4813.7540434236 ) 45.0215504519 - 8837 ( 3 0 2475.5943533484 2 2647.3837333325 1 4872.7739341066 ) 44.9942951687 - 8838 ( 3 0 2515.4002914308 2 2358.7543371766 1 5108.8534968384 ) 44.9485005040 - 8840 ( 3 0 2515.2855315668 2 2358.6893426326 1 5109.0589561943 ) 44.9480836817 - 8841 ( 3 0 2514.9412519750 2 2358.4943590004 1 5109.6753342622 ) 44.9468335445 - 8842 ( 3 0 2513.5641336077 2 2357.7144244716 1 5112.1408465335 ) 44.9418379464 - 8843 ( 3 0 2508.0556601384 2 2354.5946863564 1 5122.0028956186 ) 44.9219348254 - 8844 ( 3 0 2486.0217662612 2 2342.1157338955 1 5161.4510919593 ) 44.8435947921 - 8845 ( 3 0 2483.0458496952 2 2338.7707113988 1 5167.8643075048 ) 44.8377804120 - 8846 ( 3 0 2474.1180999970 2 2328.7356439086 1 5187.1039541411 ) 44.8205099552 - 8847 ( 3 0 2438.4071012044 2 2288.5953739479 1 5264.0625406864 ) 44.7540328039 - 8848 ( 3 0 2295.5631060339 2 2128.0342941051 1 5571.8968868678 ) 44.5306991822 - 8855 ( 3 0 2246.8411231851 2 2159.0391922817 1 5594.0432427082 ) 44.4908538729 - 8881 ( 3 0 2246.8591149590 2 2159.0973578929 1 5594.0389538567 ) 44.4902351182 - 8890 ( 3 0 2246.8486392353 2 2159.1084209401 1 5594.0397904890 ) 44.4902262093 - 8903 ( 3 0 2246.8540260785 2 2159.1053127856 1 5594.0375595191 ) 44.4902251751 - 8904 ( 3 0 2246.8701866083 2 2159.0959883223 1 5594.0308666095 ) 44.4902220731 - 8905 ( 3 0 2246.9348287276 2 2159.0586904689 1 5594.0040949708 ) 44.4902096777 - 8906 ( 3 0 2247.1933972044 2 2158.9094990553 1 5593.8970084161 ) 44.4901602933 - 8927 ( 3 0 2247.1934312789 2 2158.9093352501 1 5593.8971782696 ) 44.4901598382 - 8933 ( 3 0 2247.1936064494 2 2158.9091736740 1 5593.8971710678 ) 44.4901597251 - 8934 ( 3 0 2247.1941319611 2 2158.9086889458 1 5593.8971494625 ) 44.4901593859 - 8944 ( 3 0 2247.1941525712 2 2158.9086089656 1 5593.8972354233 ) 44.4901591006 - 8961 ( 3 0 2247.1941592110 2 2158.9086060982 1 5593.8972336338 ) 44.4901590823 - 8969 ( 3 0 2247.1941622393 2 2158.9086061446 1 5593.8972314647 ) 44.4901590747 - 8979 ( 3 0 2247.1941629850 2 2158.9086060136 1 5593.8972309224 ) 44.4901590742 - 8988 ( 3 0 2247.1941631028 2 2158.9086062984 1 5593.8972305733 ) 44.4901590739 - 8998 ( 3 0 2247.1941631943 2 2158.9086062904 1 5593.8972305018 ) 44.4901590738 - 9011 ( 3 0 2247.1941631861 2 2158.9086062987 1 5593.8972305106 ) 44.4901590737 - 9021 ( 3 0 2247.1941631897 2 2158.9086062984 1 5593.8972305098 ) 44.4901590737 - 9027 ( 3 0 2247.1941631931 2 2158.9086062979 1 5593.8972305086 ) 44.4901590737 - 9037 ( 3 0 2247.1941631947 2 2158.9086062989 1 5593.8972305060 ) 44.4901590737 - 9047 ( 3 0 2247.1941631950 2 2158.9086062987 1 5593.8972305061 ) 44.4901590737 - 9056 ( 3 0 2247.1941631952 2 2158.9086062985 1 5593.8972305062 ) 44.4901590737 - 9065 ( 3 0 2247.1941631953 2 2158.9086062986 1 5593.8972305060 ) 44.4901590737 - 9074 ( 3 0 2247.1941631953 2 2158.9086062986 1 5593.8972305061 ) 44.4901590737 - 9091 ( 3 0 2247.1941631953 2 2158.9086062986 1 5593.8972305061 ) 44.4901590737 + 5 ( 2 0 5000.0000000000 1 5000.0000000000 ) 58.5324359492 + 8 ( 2 0 5000.0000000000 2 5000.0000000000 ) 55.9016994375 + 12 ( 3 0 3333.3333333333 2 3333.3333333333 1 3333.3333333333 ) 47.1682905221 + 25 ( 2 0 4664.5898033750 2 5335.4101966250 ) 54.6460175208 (ExtendedPoll#6) + 26 ( 2 0 3658.3592135001 2 6341.6407864999 ) 54.3665216385 (ExtendedPoll#6) + 40 ( 2 0 4853.2580389766 2 5104.8156864453 ) 55.7859562011 (ExtendedPoll#7) + 51 ( 2 0 4952.8329410996 2 5040.1793464707 ) 55.7796437455 (ExtendedPoll#8) + 52 ( 2 0 4811.3317643985 2 5160.7173858828 ) 55.4595714411 (ExtendedPoll#8) + 53 ( 2 0 4245.3270575938 2 5642.8695435312 ) 54.9467100128 (ExtendedPoll#8) + 59 ( 2 0 4217.3762078751 2 5761.6606548359 ) 54.0237235981 (ExtendedPoll#8) + 69 ( 2 0 4105.5728090001 2 5894.4271909999 ) 53.7841727607 (ExtendedPoll#9) + 88 ( 2 0 4077.6219592813 2 5838.5254915624 ) 54.5583352238 (ExtendedPoll#10) + 95 ( 2 0 4079.3688873888 2 5901.4149034296 ) 53.9607874220 (ExtendedPoll#10) + 99 ( 2 0 4048.3609134820 2 5933.2963413900 ) 53.9575135294 (ExtendedPoll#10) + 102 ( 2 0 4114.7441815640 2 5872.1538576303 ) 53.9056113440 (ExtendedPoll#10) + 108 ( 2 0 4103.7166978859 2 5883.2905243151 ) 53.9036253851 (ExtendedPoll#10) + 109 ( 2 0 4070.6342468517 2 5916.7005243695 ) 53.9019093307 (ExtendedPoll#10) + 115 ( 2 0 4066.9220246234 2 5931.8769623028 ) 53.7986288783 (ExtendedPoll#10) + 137 ( 2 0 4552.7864045000 2 5447.2135955000 ) 54.3435557967 (ExtendedPoll#12) + 151 ( 2 0 4547.0542966476 2 5452.5362670773 ) 54.3341271736 (ExtendedPoll#12) + 152 ( 2 0 4529.8579730901 2 5468.5042818092 ) 54.3067391679 (ExtendedPoll#12) + 153 ( 2 0 4461.0726788604 2 5532.3763407368 ) 54.2108013388 (ExtendedPoll#12) + 154 ( 2 0 4185.9315019415 2 5787.8645764472 ) 54.0536810905 (ExtendedPoll#12) + 158 ( 2 0 4166.7152927598 2 5812.7583019780 ) 53.9898429352 (ExtendedPoll#12) + 159 ( 2 0 4109.0666652149 2 5887.4394785702 ) 53.8164151300 (ExtendedPoll#12) + 164 ( 2 0 4087.2300638722 2 5910.1495439667 ) 53.8086966314 (ExtendedPoll#12) + 165 ( 2 0 4021.7202598438 2 5978.2797401562 ) 53.8029621572 (ExtendedPoll#12) + 186 ( 2 0 4997.1817136392 2 5002.7091033541 ) 55.8904416155 (ExtendedPoll#13) + 187 ( 2 0 4988.7268545568 2 5010.8364134164 ) 55.8568544583 (ExtendedPoll#13) + 188 ( 2 0 4954.9074182272 2 5043.3456536654 ) 55.7253209743 (ExtendedPoll#13) + 189 ( 2 0 4819.6296729087 2 5173.3826146616 ) 55.2455191020 (ExtendedPoll#13) + 190 ( 2 0 4278.5186916348 2 5693.5304586464 ) 54.1478187840 (ExtendedPoll#13) + 194 ( 2 0 4250.5678419161 2 5749.4321580839 ) 53.8463541922 (ExtendedPoll#13) + 219 ( 2 0 4991.4018382213 2 5006.9604166780 ) 55.8833196229 (ExtendedPoll#14) + 220 ( 2 0 4965.6073528851 2 5027.8416667120 ) 55.8295760866 (ExtendedPoll#14) + 221 ( 2 0 4862.4294115405 2 5111.3666668481 ) 55.6359728814 (ExtendedPoll#14) + 222 ( 2 0 4449.7176461622 2 5445.4666673925 ) 55.2305749540 (ExtendedPoll#14) + 226 ( 2 0 4416.5260121211 2 5499.6214387226 ) 54.9360602700 (ExtendedPoll#14) + 227 ( 2 0 4316.9511099981 2 5662.0857527128 ) 54.1235694449 (ExtendedPoll#14) + 229 ( 2 0 4226.1108484122 2 5745.9383018691 ) 54.0981732449 (ExtendedPoll#14) + 236 ( 2 0 4295.9879727091 2 5690.0366024316 ) 54.0285296848 (ExtendedPoll#14) + 247 ( 2 0 4295.1963959104 2 5693.8580076666 ) 53.9975464791 (ExtendedPoll#14) + 248 ( 2 0 4292.8216655143 2 5705.3222233715 ) 53.9048916226 (ExtendedPoll#14) + 265 ( 2 0 4991.6202042347 2 5007.1787826914 ) 55.8789766881 (ExtendedPoll#15) + 266 ( 2 0 4966.4808169388 2 5028.7151307657 ) 55.8122316385 (ExtendedPoll#15) + 267 ( 2 0 4865.9232677554 2 5114.8605230630 ) 55.5670382161 (ExtendedPoll#15) + 268 ( 2 0 4463.6930710215 2 5459.4420922519 ) 54.9622403869 (ExtendedPoll#15) + 272 ( 2 0 4465.4399991290 2 5522.3315041191 ) 54.2792880205 (ExtendedPoll#15) + 279 ( 2 0 4465.8494354041 2 5530.1380890991 ) 54.1936457881 (ExtendedPoll#15) + 282 ( 2 0 4460.3083978134 2 5535.6518309382 ) 54.1829242335 (ExtendedPoll#15) + 283 ( 2 0 4443.6852850412 2 5552.1930564553 ) 54.1517073596 (ExtendedPoll#15) + 284 ( 2 0 4377.1928339525 2 5618.3579585239 ) 54.0411998177 (ExtendedPoll#15) + 285 ( 2 0 4111.2230295975 2 5883.0175667983 ) 53.8374230147 (ExtendedPoll#15) + 295 ( 2 0 4118.0196717655 2 5879.1961615633 ) 53.8105466009 (ExtendedPoll#15) + 298 ( 2 0 4124.3795819065 2 5874.6650667847 ) 53.7943634220 (ExtendedPoll#15) + 307 ( 2 0 4124.8617357702 2 5874.5877643630 ) 53.7906784892 (ExtendedPoll#15) + 308 ( 2 0 4125.6516065844 2 5874.0132740894 ) 53.7887889498 (ExtendedPoll#15) + 310 ( 2 0 4123.8654408339 2 5876.1201649220 ) 53.7855913617 (ExtendedPoll#15) + 348 ( 2 0 4926.6290194883 2 5050.6609151152 ) 55.8573545355 (ExtendedPoll#17) + 349 ( 2 0 4706.5160779532 2 5202.6436604609 ) 55.8124774768 (ExtendedPoll#17) + 353 ( 2 0 4650.6143785157 2 5314.4470593359 ) 54.9951723917 (ExtendedPoll#17) + 362 ( 2 0 4648.1031693612 2 5329.8418632826 ) 54.8434056052 (ExtendedPoll#17) + 365 ( 2 0 4663.2796072945 2 5326.0204580476 ) 54.7617474708 (ExtendedPoll#17) + 368 ( 2 0 4676.3815681001 2 5317.5041835239 ) 54.7500380050 (ExtendedPoll#17) + 375 ( 2 0 4680.0460227630 2 5316.1598677537 ) 54.7351963289 (ExtendedPoll#17) + 378 ( 2 0 4683.8264843704 2 5315.1840446312 ) 54.7152907223 (ExtendedPoll#17) + 383 ( 2 0 4684.6722261763 2 5314.6957065739 ) 54.7138745538 (ExtendedPoll#17) + 386 ( 2 0 4683.5902055200 2 5315.5546697595 ) 54.7130556687 (ExtendedPoll#17) + 387 ( 2 0 4680.3441435508 2 5318.1315593164 ) 54.7106238781 (ExtendedPoll#17) + 388 ( 2 0 4667.3598956743 2 5328.4391175440 ) 54.7012704968 (ExtendedPoll#17) + 389 ( 2 0 4615.4229041681 2 5369.6693504543 ) 54.6698883036 (ExtendedPoll#17) + 390 ( 2 0 4407.6749381433 2 5534.5902820956 ) 54.6440687766 (ExtendedPoll#17) + 392 ( 2 0 4390.6423890959 2 5560.7942037069 ) 54.5173881146 (ExtendedPoll#17) + 393 ( 2 0 4339.5447419538 2 5639.4059685409 ) 54.1546080629 (ExtendedPoll#17) + 397 ( 2 0 4329.0631733093 2 5668.6670143402 ) 53.9515249195 (ExtendedPoll#17) + 404 ( 2 0 4327.2889494502 2 5672.1472226792 ) 53.9321944673 (ExtendedPoll#17) + 410 ( 2 0 4327.7553229574 2 5672.0024272464 ) 53.9295614439 (ExtendedPoll#17) + 411 ( 2 0 4328.5409288104 2 5671.4219660272 ) 53.9284968785 (ExtendedPoll#17) + 419 ( 2 0 4328.4706502466 2 5671.5217727832 ) 53.9281125932 (ExtendedPoll#17) + 440 ( 2 0 4999.6291616237 2 5000.3176329854 ) 55.9006895585 (ExtendedPoll#18) + 441 ( 2 0 4998.5166464947 2 5001.2705319414 ) 55.8976626910 (ExtendedPoll#18) + 442 ( 2 0 4994.0665859789 2 5005.0821277656 ) 55.8855968012 (ExtendedPoll#18) + 443 ( 2 0 4976.2663439156 2 5020.3285110625 ) 55.8380009177 (ExtendedPoll#18) + 444 ( 2 0 4905.0653756623 2 5081.3140442501 ) 55.6584535115 (ExtendedPoll#18) + 445 ( 2 0 4620.2615026492 2 5325.2561770006 ) 55.1234133107 (ExtendedPoll#18) + 448 ( 2 0 4630.7430712937 2 5354.9539548267 ) 54.7064652424 (ExtendedPoll#18) + 451 ( 2 0 4621.4625157231 2 5367.5100005988 ) 54.6438867561 (ExtendedPoll#18) + 452 ( 2 0 4593.6208490110 2 5405.1781379151 ) 54.4600465872 (ExtendedPoll#18) + 453 ( 2 0 4549.9476463255 2 5448.8513406007 ) 54.3496410161 (ExtendedPoll#18) + 454 ( 2 0 4418.9280382689 2 5579.8709486573 ) 54.0763891883 (ExtendedPoll#18) + 455 ( 2 0 3894.8496060423 2 6103.9493808838 ) 53.9197049939 (ExtendedPoll#18) + 468 ( 2 0 3903.2294018076 2 6096.7705981924 ) 53.8996693169 (ExtendedPoll#18) + 475 ( 2 0 3903.5746504167 2 6096.4253495832 ) 53.8992666551 (ExtendedPoll#18) + 476 ( 2 0 3904.6103962441 2 6095.3896037559 ) 53.8980629375 (ExtendedPoll#18) + 477 ( 2 0 3908.7533795536 2 6091.2466204464 ) 53.8933120622 (ExtendedPoll#18) + 478 ( 2 0 3925.3253127913 2 6074.6746872087 ) 53.8753312613 (ExtendedPoll#18) + 479 ( 2 0 3991.6130457425 2 6008.3869542575 ) 53.8196897705 (ExtendedPoll#18) + 527 ( 2 0 4720.4915028125 2 5223.6067977500 ) 55.4583179735 (ExtendedPoll#20) + 528 ( 2 0 4385.0813061876 2 5559.0169943749 ) 54.5837536207 (ExtendedPoll#20) + 539 ( 2 0 4367.6120251133 2 5584.7841839594 ) 54.4682528290 (ExtendedPoll#20) + 540 ( 2 0 4315.2041818907 2 5662.0857527128 ) 54.1388753912 (ExtendedPoll#20) + 542 ( 2 0 4283.7594759571 2 5716.2405240429 ) 53.8770977719 (ExtendedPoll#20) + 581 ( 2 0 3661.9622527217 2 6337.4508886172 ) 54.3613643939 (ExtendedPoll#21) + 582 ( 2 0 3672.7713703864 2 6324.8811949693 ) 54.3464807033 (ExtendedPoll#21) + 583 ( 2 0 3716.0078410450 2 6274.6024203776 ) 54.2957519362 (ExtendedPoll#21) + 584 ( 2 0 3888.9537236798 2 6073.4873220106 ) 54.2325516547 (ExtendedPoll#21) + 588 ( 2 0 3910.7903250226 2 6051.2139886410 ) 54.2135842543 (ExtendedPoll#21) + 589 ( 2 0 3976.3001290509 2 5984.3939885321 ) 54.1740869612 (ExtendedPoll#21) + 593 ( 2 0 4033.9487565958 2 5959.9369950282 ) 53.8521950489 (ExtendedPoll#21) + 599 ( 2 0 4047.3782664216 2 5951.9666355381 ) 53.7987546224 (ExtendedPoll#21) + 611 ( 2 0 4047.6136123118 2 5951.9017281599 ) 53.7971533414 (ExtendedPoll#21) + 615 ( 2 0 4047.8134790560 2 5952.0419387593 ) 53.7940433602 (ExtendedPoll#21) + 617 ( 2 0 4047.6531698269 2 5952.2260518031 ) 53.7938806683 (ExtendedPoll#21) + 618 ( 2 0 4047.1722421396 2 5952.7783909345 ) 53.7933936767 (ExtendedPoll#21) + 624 ( 2 0 4047.2240480902 2 5952.7461205054 ) 53.7932021747 (ExtendedPoll#21) + 629 ( 2 0 4047.2545309008 2 5952.7446673365 ) 53.7929324376 (ExtendedPoll#21) + 654 ( 2 0 4999.9134679357 2 5000.0860989042 ) 55.9013177479 (ExtendedPoll#22) + 655 ( 2 0 4999.6538717426 2 5000.3443956169 ) 55.9001728626 (ExtendedPoll#22) + 656 ( 2 0 4998.6154869705 2 5001.3775824675 ) 55.8955960762 (ExtendedPoll#22) + 657 ( 2 0 4994.4619478821 2 5005.5103298701 ) 55.8773330446 (ExtendedPoll#22) + 658 ( 2 0 4977.8477915284 2 5022.0413194804 ) 55.8049893023 (ExtendedPoll#22) + 659 ( 2 0 4911.3911661138 2 5088.1652779214 ) 55.5271121019 (ExtendedPoll#22) + 660 ( 2 0 4645.5646644551 2 5352.6611116858 ) 54.6099568042 (ExtendedPoll#22) + 666 ( 2 0 4643.1899340591 2 5355.7660034392 ) 54.5949958366 (ExtendedPoll#22) + 674 ( 2 0 4643.2514561244 2 5356.2503964074 ) 54.5891116760 (ExtendedPoll#22) + 676 ( 2 0 4642.9300912980 2 5356.6179294388 ) 54.5876751049 (ExtendedPoll#22) + 677 ( 2 0 4641.9659968188 2 5357.7205285330 ) 54.5833690042 (ExtendedPoll#22) + 678 ( 2 0 4640.6472708158 2 5359.1620854185 ) 54.5782267385 (ExtendedPoll#22) + 683 ( 2 0 4639.9154034740 2 5359.8086535364 ) 54.5770790094 (ExtendedPoll#22) + 684 ( 2 0 4637.7198014483 2 5361.7483578901 ) 54.5736490458 (ExtendedPoll#22) + 685 ( 2 0 4628.9373933458 2 5369.5071753047 ) 54.5601278395 (ExtendedPoll#22) + 686 ( 2 0 4593.8077609356 2 5400.5424449631 ) 54.5092397286 (ExtendedPoll#22) + 687 ( 2 0 4453.2892312949 2 5524.6835235967 ) 54.3579916958 (ExtendedPoll#22) + 692 ( 2 0 4453.1800482882 2 5540.2966935568 ) 54.1950044054 (ExtendedPoll#22) + 696 ( 2 0 4449.7953750800 2 5547.3389974899 ) 54.1501982295 (ExtendedPoll#22) + 700 ( 2 0 4458.8302688856 2 5540.9790873488 ) 54.1396632915 (ExtendedPoll#22) + 710 ( 2 0 4458.3987614362 2 5541.5182850685 ) 54.1376935988 (ExtendedPoll#22) + 723 ( 2 0 4458.4198350926 2 5541.5559487575 ) 54.1371193459 (ExtendedPoll#22) + 725 ( 2 0 4458.4486331602 2 5541.5458498792 ) 54.1369795760 (ExtendedPoll#22) + 732 ( 2 0 4458.4524474032 2 5541.5457910551 ) 54.1369476680 (ExtendedPoll#22) + 748 ( 2 0 4695.1610452549 2 5241.9495428779 ) 55.4530370223 (ExtendedPoll#23) + 749 ( 2 0 4619.1696725821 2 5296.9777782617 ) 55.4492782592 (ExtendedPoll#23) + 752 ( 2 0 4772.8993460352 2 5199.1498042461 ) 55.3189871998 (ExtendedPoll#23) + 758 ( 2 0 4803.9073199419 2 5194.3457519507 ) 55.1267190068 (ExtendedPoll#23) + 761 ( 2 0 4779.8870584649 2 5214.4354251860 ) 55.0861821831 (ExtendedPoll#23) + 762 ( 2 0 4707.8262740337 2 5274.7044448921 ) 54.9771582390 (ExtendedPoll#23) + 763 ( 2 0 4419.5831363091 2 5515.7805237163 ) 54.7394753219 (ExtendedPoll#23) + 765 ( 2 0 4251.8780379967 2 5711.4364717475 ) 54.2065798938 (ExtendedPoll#23) + 766 ( 2 0 3916.4678413717 2 6046.8466683725 ) 54.1969206166 (ExtendedPoll#23) + 775 ( 2 0 3947.9125473053 2 6047.2834003993 ) 53.8946625323 (ExtendedPoll#23) + 780 ( 2 0 3960.2502270639 2 6037.7844788152 ) 53.8597225819 (ExtendedPoll#23) + 789 ( 2 0 3961.1262500944 2 6037.3528647418 ) 53.8551714185 (ExtendedPoll#23) + 790 ( 2 0 3963.7543191857 2 6036.0580225215 ) 53.8415309007 (ExtendedPoll#23) + 800 ( 2 0 3963.8724386189 2 6036.0888168742 ) 53.8401500357 (ExtendedPoll#23) + 806 ( 2 0 3963.8977126790 2 6036.0717128804 ) 53.8400591085 (ExtendedPoll#23) + 807 ( 2 0 3963.9735348593 2 6036.0204008990 ) 53.8397863412 (ExtendedPoll#23) + 808 ( 2 0 3964.0565483307 2 6035.9309033538 ) 53.8397753773 (ExtendedPoll#23) + 809 ( 2 0 3964.3055887447 2 6035.6624107183 ) 53.8397427557 (ExtendedPoll#23) + 810 ( 2 0 3965.3017504010 2 6034.5884401761 ) 53.8396163244 (ExtendedPoll#23) + 811 ( 2 0 3969.2863970259 2 6030.2925580077 ) 53.8391754528 (ExtendedPoll#23) + 812 ( 2 0 3985.2249835255 2 6013.1090293339 ) 53.8384482501 (ExtendedPoll#23) + 815 ( 2 0 3987.0145612449 2 6012.3276884421 ) 53.8284510125 (ExtendedPoll#23) + 820 ( 2 0 3987.3798551717 2 6012.0036580149 ) 53.8278471786 (ExtendedPoll#23) + 821 ( 2 0 3988.4757369520 2 6011.0315667334 ) 53.8260397128 (ExtendedPoll#23) + 823 ( 2 0 3986.7339267980 2 6013.1742832402 ) 53.8237018301 (ExtendedPoll#23) + 832 ( 2 0 3986.6783090383 2 6013.2829464548 ) 53.8232765676 (ExtendedPoll#23) + 836 ( 2 0 3986.8030524894 2 6013.1636141732 ) 53.8231454979 (ExtendedPoll#23) + 837 ( 2 0 3987.1772828427 2 6012.8056173285 ) 53.8227528066 (ExtendedPoll#23) + 847 ( 2 0 3987.1736824074 2 6012.8204452533 ) 53.8226572738 (ExtendedPoll#23) + 849 ( 2 0 3987.1869497063 2 6012.8129081631 ) 53.8225983976 (ExtendedPoll#23) + 850 ( 2 0 3987.2077526376 2 6012.7905795918 ) 53.8225977726 (ExtendedPoll#23) + 851 ( 2 0 3987.2701614317 2 6012.7235938779 ) 53.8225959146 (ExtendedPoll#23) + 852 ( 2 0 3987.5197966079 2 6012.4556510226 ) 53.8225887344 (ExtendedPoll#23) + 853 ( 2 0 3988.5183373128 2 6011.3838796011 ) 53.8225640459 (ExtendedPoll#23) + 854 ( 2 0 3992.5125001324 2 6007.0967939151 ) 53.8225297822 (ExtendedPoll#23) + 858 ( 2 0 3992.8719297375 2 6006.7662594221 ) 53.8220484338 (ExtendedPoll#23) + 859 ( 2 0 3993.9502185528 2 6005.7746559431 ) 53.8206084721 (ExtendedPoll#23) + 867 ( 2 0 3994.1935345893 2 6005.7947812288 ) 53.8181500804 (ExtendedPoll#23) + 875 ( 2 0 3994.2169631374 2 6005.7752257153 ) 53.8181014599 (ExtendedPoll#23) + 880 ( 2 0 3994.2052365766 2 6005.7933405549 ) 53.8180529267 (ExtendedPoll#23) + 886 ( 2 0 3994.2070325934 2 6005.7926984484 ) 53.8180416998 (ExtendedPoll#23) + 901 ( 2 0 4983.7317319996 2 5014.9580719198 ) 55.8453986667 (ExtendedPoll#24) + 902 ( 2 0 4934.9269279985 2 5059.8322876792 ) 55.6824111014 (ExtendedPoll#24) + 903 ( 2 0 4739.7077119942 2 5239.3291507168 ) 55.1228042284 (ExtendedPoll#24) + 904 ( 2 0 3958.8308479767 2 5957.3166028671 ) 54.5781023915 (ExtendedPoll#24) + 911 ( 2 0 3979.7939852657 2 6016.7121585194 ) 53.8581095439 (ExtendedPoll#24) + 918 ( 2 0 3988.6378088095 2 6010.1065866132 ) 53.8325947095 (ExtendedPoll#24) + 926 ( 2 0 3989.5633053899 2 6010.4187817731 ) 53.8211783096 (ExtendedPoll#24) + 936 ( 2 0 3989.5756322315 2 6010.4097884943 ) 53.8211411134 (ExtendedPoll#24) + 937 ( 2 0 3989.6126127563 2 6010.3828086579 ) 53.8210295286 (ExtendedPoll#24) + 942 ( 2 0 3989.6241534539 2 6010.3728265038 ) 53.8210083518 (ExtendedPoll#24) + 946 ( 2 0 3989.6276603588 2 6010.3713253267 ) 53.8209885364 (ExtendedPoll#24) + 969 ( 2 0 3659.6318779221 2 6340.1599919713 ) 54.3646950351 (ExtendedPoll#25) + 970 ( 2 0 3663.4498711882 2 6335.7176083856 ) 54.3592886738 (ExtendedPoll#25) + 971 ( 2 0 3678.7218442523 2 6317.9480740430 ) 54.3387643534 (ExtendedPoll#25) + 972 ( 2 0 3739.8097365087 2 6246.8699366722 ) 54.2742427310 (ExtendedPoll#25) + 978 ( 2 0 3747.2068852135 2 6244.3587275178 ) 54.2206960776 (ExtendedPoll#25) + 980 ( 2 0 3733.7773753877 2 6261.9371915988 ) 54.2169921066 (ExtendedPoll#25) + 984 ( 2 0 3729.6284211326 2 6268.5700592566 ) 54.2069023761 (ExtendedPoll#25) + 995 ( 2 0 3729.8079759991 2 6269.9395382979 ) 54.1945664870 (ExtendedPoll#25) + 1002 ( 2 0 3730.0391102401 2 6269.8609297318 ) 54.1928795948 (ExtendedPoll#25) + 1003 ( 2 0 3730.4171990505 2 6269.5520399169 ) 54.1915098832 (ExtendedPoll#25) + 1010 ( 2 0 3730.5280413937 2 6269.4196928396 ) 54.1914305422 (ExtendedPoll#25) + 1011 ( 2 0 3730.8605684232 2 6269.0226516079 ) 54.1911930941 (ExtendedPoll#25) + 1012 ( 2 0 3732.1906765414 2 6267.4344866812 ) 54.1902519228 (ExtendedPoll#25) + 1013 ( 2 0 3737.5111090140 2 6261.0818269741 ) 54.1866251399 (ExtendedPoll#25) + 1014 ( 2 0 3758.7928389047 2 6235.6711881460 ) 54.1743221404 (ExtendedPoll#25) + 1015 ( 2 0 3843.9197584675 2 6134.0286328333 ) 54.1602124163 (ExtendedPoll#25) + 1017 ( 2 0 3850.7164006354 2 6130.1799318466 ) 54.1262487754 (ExtendedPoll#25) + 1018 ( 2 0 3871.1063271392 2 6118.6338288866 ) 54.0252546165 (ExtendedPoll#25) + 1024 ( 2 0 3874.9618520638 2 6118.0196744739 ) 53.9932699228 (ExtendedPoll#25) + 1027 ( 2 0 3878.5580673474 2 6116.4979363178 ) 53.9713481391 (ExtendedPoll#25) + 1030 ( 2 0 3882.4477119616 2 6116.1772112356 ) 53.9366512244 (ExtendedPoll#25) + 1033 ( 2 0 3883.8176174990 2 6114.7851279000 ) 53.9350795566 (ExtendedPoll#25) + 1034 ( 2 0 3887.9273341111 2 6110.6088778932 ) 53.9304333927 (ExtendedPoll#25) + 1035 ( 2 0 3904.3662005594 2 6093.9038778659 ) 53.9128801378 (ExtendedPoll#25) + 1036 ( 2 0 3970.1216663528 2 6027.0838777571 ) 53.8590909037 (ExtendedPoll#25) + 1042 ( 2 0 3973.0218399687 2 6024.4703095339 ) 53.8544261587 (ExtendedPoll#25) + 1043 ( 2 0 3981.7223608162 2 6016.6296048642 ) 53.8406919834 (ExtendedPoll#25) + 1048 ( 2 0 3984.9637313280 2 6014.4459447299 ) 53.8292462452 (ExtendedPoll#25) + 1053 ( 2 0 3985.8052081727 2 6013.9503562385 ) 53.8256595333 (ExtendedPoll#25) + 1061 ( 2 0 3985.8396877184 2 6014.0674560795 ) 53.8243145748 (ExtendedPoll#25) + 1064 ( 2 0 3985.9527091902 2 6014.0213411865 ) 53.8236546852 (ExtendedPoll#25) + 1069 ( 2 0 3986.0162471161 2 6013.9629145501 ) 53.8235671131 (ExtendedPoll#25) + 1070 ( 2 0 3986.2068608937 2 6013.7876346407 ) 53.8233045248 (ExtendedPoll#25) + 1076 ( 2 0 3986.1976307305 2 6013.7997850945 ) 53.8232852967 (ExtendedPoll#25) + 1082 ( 2 0 3986.2011589420 2 6013.7983347110 ) 53.8232647945 (ExtendedPoll#25) + 1086 ( 2 0 3986.1999003828 2 6013.7997678928 ) 53.8232641222 (ExtendedPoll#25) + 1089 ( 2 0 3986.1980746415 2 6013.8017534985 ) 53.8232639619 (ExtendedPoll#25) + 1144 ( 2 0 4999.7419965034 2 5000.2294282565 ) 55.9008939292 (ExtendedPoll#27) + 1145 ( 2 0 4998.9679860137 2 5000.9177130262 ) 55.8984788107 (ExtendedPoll#27) + 1146 ( 2 0 4995.8719440548 2 5003.6708521046 ) 55.8888394453 (ExtendedPoll#27) + 1147 ( 2 0 4983.4877762190 2 5014.6834084185 ) 55.8506205863 (ExtendedPoll#27) + 1148 ( 2 0 4933.9511048760 2 5058.7336336741 ) 55.7032178511 (ExtendedPoll#27) + 1149 ( 2 0 4735.8044195041 2 5234.9345346965 ) 55.2046851896 (ExtendedPoll#27) + 1150 ( 2 0 3943.2176780166 2 5939.7381387862 ) 54.8819022435 (ExtendedPoll#27) + 1152 ( 2 0 3935.3565015332 2 5969.8726486392 ) 54.6880709245 (ExtendedPoll#27) + 1153 ( 2 0 3911.7729720830 2 6060.2761781983 ) 54.1268308179 (ExtendedPoll#27) + 1159 ( 2 0 3902.3832335056 2 6072.7230409636 ) 54.1106121774 (ExtendedPoll#27) + 1160 ( 2 0 3874.2140177734 2 6110.0636292598 ) 54.0666592435 (ExtendedPoll#27) + 1163 ( 2 0 3854.9978085918 2 6134.5206227637 ) 54.0491056788 (ExtendedPoll#27) + 1170 ( 2 0 3852.6503739474 2 6141.9723629719 ) 54.0104767054 (ExtendedPoll#27) + 1174 ( 2 0 3860.8118036993 2 6134.5206227637 ) 53.9930000229 (ExtendedPoll#27) + 1175 ( 2 0 3885.2960929549 2 6112.1654021390 ) 53.9427035432 (ExtendedPoll#27) + 1183 ( 2 0 3886.8263610334 2 6110.9507411893 ) 53.9381441910 (ExtendedPoll#27) + 1184 ( 2 0 3891.4171652688 2 6107.3067583403 ) 53.9245293625 (ExtendedPoll#27) + 1185 ( 2 0 3897.5041178931 2 6102.3935230381 ) 53.9073073325 (ExtendedPoll#27) + 1195 ( 2 0 3897.7068634861 2 6102.2575240879 ) 53.9065051034 (ExtendedPoll#27) + 1203 ( 2 0 3897.7316573216 2 6102.2397316194 ) 53.9064167304 (ExtendedPoll#27) + 1204 ( 2 0 3897.8060388280 2 6102.1863542139 ) 53.9061516260 (ExtendedPoll#27) + 1210 ( 2 0 3897.8185626742 2 6102.1776373870 ) 53.9061047270 (ExtendedPoll#27) + 1216 ( 2 0 3897.8165360562 2 6102.1808692197 ) 53.9060970673 (ExtendedPoll#27) + 1219 ( 2 0 3897.8201618133 2 6102.1796835545 ) 53.9060722877 (ExtendedPoll#27) + 1232 ( 2 0 3897.8200835182 2 6102.1797734473 ) 53.9060722845 (ExtendedPoll#27) + 1233 ( 2 0 3897.8198486328 2 6102.1800431259 ) 53.9060722750 (ExtendedPoll#27) + 1245 ( 2 0 4966.3716339321 2 5028.8243137725 ) 55.8117570732 (ExtendedPoll#28) + 1246 ( 2 0 4865.4865357285 2 5115.2972550898 ) 55.5653095642 (ExtendedPoll#28) + 1247 ( 2 0 4461.9461429141 2 5461.1890203593 ) 54.9583349271 (ExtendedPoll#28) + 1253 ( 2 0 4468.9338553438 2 5524.0784322265 ) 54.2311656305 (ExtendedPoll#28) + 1254 ( 2 0 4385.0813061876 2 5614.9186938124 ) 54.0080105561 (ExtendedPoll#28) + 1312 ( 2 0 4999.9828435272 2 5000.0130887244 ) 55.9016722791 (ExtendedPoll#29) + 1313 ( 2 0 4999.9313741087 2 5000.0523548977 ) 55.9015908089 (ExtendedPoll#29) + 1314 ( 2 0 4999.7254964348 2 5000.2094195909 ) 55.9012650053 (ExtendedPoll#29) + 1315 ( 2 0 4998.9019857391 2 5000.8376783636 ) 55.8999630243 (ExtendedPoll#29) + 1316 ( 2 0 4995.6079429565 2 5003.3507134546 ) 55.8947748483 (ExtendedPoll#29) + 1317 ( 2 0 4982.4317718259 2 5013.4028538183 ) 55.8743389196 (ExtendedPoll#29) + 1318 ( 2 0 4929.7270873038 2 5053.6114152732 ) 55.7977153969 (ExtendedPoll#29) + 1319 ( 2 0 4718.9083492152 2 5214.4456610929 ) 55.5764644844 (ExtendedPoll#29) + 1322 ( 2 0 4720.0070032202 2 5218.1920030108 ) 55.5244848408 (ExtendedPoll#29) + 1323 ( 2 0 4723.3029652354 2 5229.4310287644 ) 55.3687307229 (ExtendedPoll#29) + 1324 ( 2 0 4734.5488149269 2 5240.3493294358 ) 55.1527367318 (ExtendedPoll#29) + 1325 ( 2 0 4725.8141743898 2 5270.4838392888 ) 54.8793050383 (ExtendedPoll#29) + 1333 ( 2 0 4724.6472810056 2 5274.2097093929 ) 54.8463890957 (ExtendedPoll#29) + 1338 ( 2 0 4723.8706315711 2 5274.8016860074 ) 54.8459531010 (ExtendedPoll#29) + 1339 ( 2 0 4721.5406832677 2 5276.5776158510 ) 54.8446571102 (ExtendedPoll#29) + 1340 ( 2 0 4712.2208900540 2 5283.6813352253 ) 54.8396533297 (ExtendedPoll#29) + 1341 ( 2 0 4674.9417171991 2 5312.0962127226 ) 54.8225390616 (ExtendedPoll#29) + 1342 ( 2 0 4525.8250257796 2 5425.7557227117 ) 54.8016355518 (ExtendedPoll#29) + 1345 ( 2 0 4527.5719538871 2 5456.7636966185 ) 54.4520740351 (ExtendedPoll#29) + 1349 ( 2 0 4517.3087512560 2 5468.5554613436 ) 54.4117744769 (ExtendedPoll#29) + 1350 ( 2 0 4486.5191433627 2 5503.9307555188 ) 54.2947627479 (ExtendedPoll#29) + 1351 ( 2 0 4439.3520844623 2 5545.8570300970 ) 54.2549299012 (ExtendedPoll#29) + 1352 ( 2 0 4297.8509077611 2 5671.6358538313 ) 54.1955288613 (ExtendedPoll#29) + 1354 ( 2 0 4130.1458094486 2 5867.2918018626 ) 53.8101176125 (ExtendedPoll#29) + 1365 ( 2 0 4128.0235647556 2 5870.5672920640 ) 53.7990789831 (ExtendedPoll#29) + 1369 ( 2 0 4127.0989211675 2 5872.2886304042 ) 53.7915583989 (ExtendedPoll#29) + 1375 ( 2 0 4128.1741178860 2 5871.4215637923 ) 53.7897866464 (ExtendedPoll#29) + 1378 ( 2 0 4127.2012802363 2 5872.4020783721 ) 53.7895735461 (ExtendedPoll#29) + 1379 ( 2 0 4124.2827672873 2 5875.3436221116 ) 53.7889669943 (ExtendedPoll#29) + 1380 ( 2 0 4112.6087154913 2 5887.1097970695 ) 53.7870326237 (ExtendedPoll#29) + 1393 ( 2 0 4112.6224699912 2 5887.2310885676 ) 53.7857898087 (ExtendedPoll#29) + 1395 ( 2 0 4112.6068429068 2 5887.3521534897 ) 53.7848179668 (ExtendedPoll#29) + 1401 ( 2 0 4112.6094751875 2 5887.3825571652 ) 53.7845139164 (ExtendedPoll#29) + 1405 ( 2 0 4112.6011895425 2 5887.3953703748 ) 53.7844717434 (ExtendedPoll#29) + 1411 ( 2 0 4112.6098291866 2 5887.3889072301 ) 53.7844522046 (ExtendedPoll#29) + 1416 ( 2 0 4112.6115497632 2 5887.3880840681 ) 53.7844440412 (ExtendedPoll#29) + 1423 ( 2 0 4112.6117769427 2 5887.3881564070 ) 53.7844412964 (ExtendedPoll#29) + 1429 ( 2 0 4112.6117384418 2 5887.3882019087 ) 53.7844412297 (ExtendedPoll#29) + 1430 ( 2 0 4112.6116229393 2 5887.3883384136 ) 53.7844410296 (ExtendedPoll#29) + 1434 ( 2 0 4112.6116767374 2 5887.3883127527 ) 53.7844407736 (ExtendedPoll#29) + 1437 ( 2 0 4112.6116387835 2 5887.3883587115 ) 53.7844406977 (ExtendedPoll#29) + 1445 ( 2 0 4902.1720259844 2 5076.8648367266 ) 55.7342800977 (ExtendedPoll#30) + 1446 ( 2 0 4608.6881039375 2 5307.4593469062 ) 55.4177822439 (ExtendedPoll#30) + 1449 ( 2 0 4440.9830056251 2 5503.1152949375 ) 54.6903788761 (ExtendedPoll#30) + 1452 ( 2 0 4273.2779073126 2 5698.7712429687 ) 54.1421759642 (ExtendedPoll#30) + 1453 ( 2 0 3937.8677106876 2 6034.1814395937 ) 54.1025876908 (ExtendedPoll#30) + 1462 ( 2 0 3985.0347695880 2 5992.2551650155 ) 54.0228541969 (ExtendedPoll#30) + 1463 ( 2 0 4126.5359462891 2 5866.4763412812 ) 53.8506010417 (ExtendedPoll#30) + 1473 ( 2 0 4130.4392387792 2 5866.5172849087 ) 53.8146342551 (ExtendedPoll#30) + 1475 ( 2 0 4128.6854867338 2 5870.0111411235 ) 53.7981997187 (ExtendedPoll#30) + 1481 ( 2 0 4129.0689067457 2 5870.9093419522 ) 53.7863749691 (ExtendedPoll#30) + 1494 ( 2 0 4129.0636273984 2 5870.9236583107 ) 53.7862903829 (ExtendedPoll#30) + 1499 ( 2 0 4129.0651471032 2 5870.9311348262 ) 53.7862072107 (ExtendedPoll#30) + 1503 ( 2 0 4129.0646772976 2 5870.9349204804 ) 53.7861763981 (ExtendedPoll#30) + 1509 ( 2 0 4129.0641711296 2 5870.9357287432 ) 53.7861735204 (ExtendedPoll#30) + 1517 ( 2 0 4129.0643025908 2 5870.9356231986 ) 53.7861733001 (ExtendedPoll#30) + 1520 ( 2 0 4129.0644472731 2 5870.9355366612 ) 53.7861727831 (ExtendedPoll#30) + 1525 ( 2 0 4129.0644281460 2 5870.9355595157 ) 53.7861727456 (ExtendedPoll#30) + 1526 ( 2 0 4129.0643707645 2 5870.9356280794 ) 53.7861726332 (ExtendedPoll#30) + 1627 ( 2 0 4867.2334638359 2 5118.7911113047 ) 55.5101747565 (ExtendedPoll#33) + 1628 ( 2 0 4468.9338553438 2 5475.1644452187 ) 54.7497453707 (ExtendedPoll#33) + 1635 ( 2 0 4531.8232672110 2 5468.1767327890 ) 54.2937328699 (ExtendedPoll#33) + 1637 ( 2 0 4406.0444434766 2 5593.9555565234 ) 54.0419580454 (ExtendedPoll#33) + 1638 ( 2 0 4028.7079722735 2 5971.2920277265 ) 53.7998378556 (ExtendedPoll#33) + 1644 ( 2 0 4154.4867960079 2 5845.5132039921 ) 53.7918826239 (ExtendedPoll#33) + 1715 ( 2 0 4999.9918793150 2 5000.0071042165 ) 55.9016755069 (ExtendedPoll#34) + 1716 ( 2 0 4999.9675172600 2 5000.0284168659 ) 55.9016037165 (ExtendedPoll#34) + 1717 ( 2 0 4999.8700690400 2 5000.1136674635 ) 55.9013165752 (ExtendedPoll#34) + 1718 ( 2 0 4999.4802761598 2 5000.4546698539 ) 55.9001683374 (ExtendedPoll#34) + 1719 ( 2 0 4997.9211046392 2 5001.8186794156 ) 55.8955806263 (ExtendedPoll#34) + 1720 ( 2 0 4991.6844185568 2 5007.2747176624 ) 55.8773137258 (ExtendedPoll#34) + 1721 ( 2 0 4966.7376742271 2 5029.0988706497 ) 55.8055960661 (ExtendedPoll#34) + 1722 ( 2 0 4866.9506969084 2 5116.3954825988 ) 55.5407618647 (ExtendedPoll#34) + 1723 ( 2 0 4467.8027876336 2 5465.5819303951 ) 54.8617064546 (ExtendedPoll#34) + 1725 ( 2 0 4466.8269645111 2 5469.3623920026 ) 54.8295561915 (ExtendedPoll#34) + 1726 ( 2 0 4463.8994951436 2 5480.7037768250 ) 54.7333779337 (ExtendedPoll#34) + 1727 ( 2 0 4452.1896176735 2 5526.0693161146 ) 54.3527873521 (ExtendedPoll#34) + 1728 ( 2 0 4432.0999444382 2 5550.0895775916 ) 54.2727755505 (ExtendedPoll#34) + 1729 ( 2 0 4371.8309247321 2 5622.1503620228 ) 54.0490159101 (ExtendedPoll#34) + 1736 ( 2 0 4367.1633511951 2 5628.4010891571 ) 54.0259049915 (ExtendedPoll#34) + 1740 ( 2 0 4367.4363087119 2 5632.2975577092 ) 53.9839463746 (ExtendedPoll#34) + 1752 ( 2 0 4367.5173563027 2 5632.3888412069 ) 53.9823156833 (ExtendedPoll#34) + 1755 ( 2 0 4367.5750698909 2 5632.4087032645 ) 53.9816128497 (ExtendedPoll#34) + 1765 ( 2 0 4367.5769053809 2 5632.4193356014 ) 53.9814889495 (ExtendedPoll#34) + 1770 ( 2 0 4367.5805624212 2 5632.4182502476 ) 53.9814682147 (ExtendedPoll#34) + 1774 ( 2 0 4367.5821046999 2 5632.4171280385 ) 53.9814662175 (ExtendedPoll#34) + 1778 ( 2 0 4367.5818878523 2 5632.4180567321 ) 53.9814586704 (ExtendedPoll#34) + 1792 ( 2 0 4367.5819056985 2 5632.4180679393 ) 53.9814584017 (ExtendedPoll#34) + 1793 ( 2 0 4367.5819346476 2 5632.4180608593 ) 53.9814582222 (ExtendedPoll#34) + 1797 ( 2 0 4367.5819216978 2 5632.4180774844 ) 53.9814581658 (ExtendedPoll#34) + 1803 ( 2 0 4367.5819257648 2 5632.4180741356 ) 53.9814581645 (ExtendedPoll#34) + 1808 ( 2 0 4367.5819244247 2 5632.4180754292 ) 53.9814581630 (ExtendedPoll#34) + 1809 ( 2 0 4367.5819204043 2 5632.4180793101 ) 53.9814581585 (ExtendedPoll#34) + 1810 ( 2 0 4367.5819043228 2 5632.4180948339 ) 53.9814581405 (ExtendedPoll#34) + 1811 ( 2 0 4367.5818399969 2 5632.4181569287 ) 53.9814580686 (ExtendedPoll#34) + 1812 ( 2 0 4367.5815826929 2 5632.4184053083 ) 53.9814577808 (ExtendedPoll#34) + 1813 ( 2 0 4367.5805534773 2 5632.4193988263 ) 53.9814566296 (ExtendedPoll#34) + 1814 ( 2 0 4367.5764366146 2 5632.4233728987 ) 53.9814520249 (ExtendedPoll#34) + 1815 ( 2 0 4367.5599691638 2 5632.4392691879 ) 53.9814336068 (ExtendedPoll#34) + 1816 ( 2 0 4367.4940993607 2 5632.5028543451 ) 53.9813599484 (ExtendedPoll#34) + 1817 ( 2 0 4367.2306201483 2 5632.7571949737 ) 53.9810655359 (ExtendedPoll#34) + 1818 ( 2 0 4366.1767032985 2 5633.7745574881 ) 53.9798914222 (ExtendedPoll#34) + 1819 ( 2 0 4361.9610358996 2 5637.8440075457 ) 53.9752515834 (ExtendedPoll#34) + 1820 ( 2 0 4345.0983663039 2 5654.1218077760 ) 53.9576001475 (ExtendedPoll#34) + 1821 ( 2 0 4277.6476879210 2 5719.2330086971 ) 53.9016513465 (ExtendedPoll#34) + 1823 ( 2 0 4277.6290591203 2 5719.2571811144 ) 53.9015782727 (ExtendedPoll#34) + 1824 ( 2 0 4277.5731727181 2 5719.3296983663 ) 53.9013590679 (ExtendedPoll#34) + 1825 ( 2 0 4277.3496271092 2 5719.6197673739 ) 53.9004824970 (ExtendedPoll#34) + 1826 ( 2 0 4276.4554446736 2 5720.7800434043 ) 53.8969801836 (ExtendedPoll#34) + 1827 ( 2 0 4272.8787149315 2 5725.4211475259 ) 53.8830344924 (ExtendedPoll#34) + 1828 ( 2 0 4272.2449416972 2 5726.1641037669 ) 53.8813532804 (ExtendedPoll#34) + 1829 ( 2 0 4270.3436219944 2 5728.3929724899 ) 53.8763261624 (ExtendedPoll#34) + 1833 ( 2 0 4269.8544309447 2 5729.2382877997 ) 53.8723721175 (ExtendedPoll#34) + 1834 ( 2 0 4268.9604950773 2 5730.9749800002 ) 53.8632736922 (ExtendedPoll#34) + 1845 ( 2 0 4268.9281879962 2 5731.0267642928 ) 53.8630526551 (ExtendedPoll#34) + 1850 ( 2 0 4268.9081672520 2 5731.0497967493 ) 53.8630044126 (ExtendedPoll#34) + 1851 ( 2 0 4268.8481050197 2 5731.1188941187 ) 53.8628597009 (ExtendedPoll#34) + 1855 ( 2 0 4268.9130457179 2 5731.0620335227 ) 53.8628413313 (ExtendedPoll#34) + 1856 ( 2 0 4269.1078678127 2 5730.8914517347 ) 53.8627863397 (ExtendedPoll#34) + 1860 ( 2 0 4268.9798523367 2 5731.0072720873 ) 53.8627858887 (ExtendedPoll#34) + 1861 ( 2 0 4268.5958059087 2 5731.3547331451 ) 53.8627850104 (ExtendedPoll#34) + 1870 ( 2 0 4268.5734598444 2 5731.3755169174 ) 53.8627794333 (ExtendedPoll#34) + 1871 ( 2 0 4268.5064216515 2 5731.4378682344 ) 53.8627627170 (ExtendedPoll#34) + 1872 ( 2 0 4268.2382688801 2 5731.6872735026 ) 53.8626960762 (ExtendedPoll#34) + 1873 ( 2 0 4267.1656577944 2 5732.6848945752 ) 53.8624331084 (ExtendedPoll#34) + 1874 ( 2 0 4262.8752134514 2 5736.6753788658 ) 53.8614387941 (ExtendedPoll#34) + 1875 ( 2 0 4245.7134360797 2 5752.6373160280 ) 53.8583843412 (ExtendedPoll#34) + 1878 ( 2 0 4247.8459166796 2 5750.8801520137 ) 53.8564841075 (ExtendedPoll#34) + 1879 ( 2 0 4254.2433584792 2 5745.6086599708 ) 53.8509013362 (ExtendedPoll#34) + 1891 ( 2 0 4254.3648432334 2 5745.5967180794 ) 53.8499381914 (ExtendedPoll#34) + 1896 ( 2 0 4254.3884937761 2 5745.5774316250 ) 53.8499159225 (ExtendedPoll#34) + 1897 ( 2 0 4254.4594454040 2 5745.5195722617 ) 53.8498491302 (ExtendedPoll#34) + 1904 ( 2 0 4254.4747041982 2 5745.5195660142 ) 53.8497136099 (ExtendedPoll#34) + 1910 ( 2 0 4254.4785171266 2 5745.5196821982 ) 53.8496785985 (ExtendedPoll#34) + 1913 ( 2 0 4254.4745684192 2 5745.5233580070 ) 53.8496778754 (ExtendedPoll#34) + 1914 ( 2 0 4254.4627222968 2 5745.5343854333 ) 53.8496757065 (ExtendedPoll#34) + 1915 ( 2 0 4254.4153378073 2 5745.5784951385 ) 53.8496670379 (ExtendedPoll#34) + 1916 ( 2 0 4254.2257998495 2 5745.7549339594 ) 53.8496324765 (ExtendedPoll#34) + 1917 ( 2 0 4253.4676480183 2 5746.4606892429 ) 53.8494960362 (ExtendedPoll#34) + 1918 ( 2 0 4250.4350406932 2 5749.2837103771 ) 53.8489791731 (ExtendedPoll#34) + 1919 ( 2 0 4238.3046113928 2 5760.5757949136 ) 53.8473747522 (ExtendedPoll#34) + 1921 ( 2 0 4237.9514726055 2 5760.9129400964 ) 53.8472576934 (ExtendedPoll#34) + 1922 ( 2 0 4236.8920562434 2 5761.9243756450 ) 53.8469104201 (ExtendedPoll#34) + 1923 ( 2 0 4232.6543907954 2 5765.9701178391 ) 53.8455799016 (ExtendedPoll#34) + 1924 ( 2 0 4215.7037290030 2 5782.1530866154 ) 53.8411968855 (ExtendedPoll#34) + 1925 ( 2 0 4147.9010818337 2 5846.8849617209 ) 53.8388064213 (ExtendedPoll#34) + 1927 ( 2 0 4139.4939903168 2 5859.9869225266 ) 53.7929039460 (ExtendedPoll#34) + 1931 ( 2 0 4134.1713187395 2 5865.6917346274 ) 53.7882968215 (ExtendedPoll#34) + 1938 ( 2 0 4133.4948958932 2 5866.3963062176 ) 53.7879136446 (ExtendedPoll#34) + 1939 ( 2 0 4131.4656273543 2 5868.5100209882 ) 53.7867806418 (ExtendedPoll#34) + 1949 ( 2 0 4131.5933562783 2 5868.3938874275 ) 53.7866942837 (ExtendedPoll#34) + 1958 ( 2 0 4131.5998202039 2 5868.3898345950 ) 53.7866729850 (ExtendedPoll#34) + 1959 ( 2 0 4131.6192119808 2 5868.3776760976 ) 53.7866090899 (ExtendedPoll#34) + 1967 ( 2 0 4131.6209541211 2 5868.3784525807 ) 53.7865860060 (ExtendedPoll#34) + 1972 ( 2 0 4131.6214166274 2 5868.3783365570 ) 53.7865828676 (ExtendedPoll#34) + 1975 ( 2 0 4131.6210066099 2 5868.3788719382 ) 53.7865816357 (ExtendedPoll#34) + 1981 ( 2 0 4131.6209362583 2 5868.3789681750 ) 53.7865813838 (ExtendedPoll#34) + 1982 ( 2 0 4131.6207252036 2 5868.3792568852 ) 53.7865806279 (ExtendedPoll#34) + 1986 ( 2 0 4131.6206891940 2 5868.3793043828 ) 53.7865805153 (ExtendedPoll#34) + 1992 ( 2 0 4131.6206796375 2 5868.3793158160 ) 53.7865804962 (ExtendedPoll#34) + 1996 ( 2 0 4131.6206768768 2 5868.3793227362 ) 53.7865804572 (ExtendedPoll#34) + 2001 ( 2 0 4131.6206782642 2 5868.3793214934 ) 53.7865804561 (ExtendedPoll#34) + 2003 ( 2 0 4131.6206745081 2 5868.3793251876 ) 53.7865804560 (ExtendedPoll#34) + 2004 ( 2 0 4131.6206632396 2 5868.3793362702 ) 53.7865804559 (ExtendedPoll#34) + 2005 ( 2 0 4131.6206181660 2 5868.3793806004 ) 53.7865804552 (ExtendedPoll#34) + 2006 ( 2 0 4131.6204378713 2 5868.3795579212 ) 53.7865804528 (ExtendedPoll#34) + 2007 ( 2 0 4131.6197166927 2 5868.3802672046 ) 53.7865804428 (ExtendedPoll#34) + 2008 ( 2 0 4131.6168319783 2 5868.3831043383 ) 53.7865804032 (ExtendedPoll#34) + 2009 ( 2 0 4131.6052931206 2 5868.3944528729 ) 53.7865802452 (ExtendedPoll#34) + 2010 ( 2 0 4131.5591376898 2 5868.4398470112 ) 53.7865796204 (ExtendedPoll#34) + 2011 ( 2 0 4131.3745159668 2 5868.6214235646 ) 53.7865772402 (ExtendedPoll#34) + 2012 ( 2 0 4130.6360290747 2 5869.3477297782 ) 53.7865696199 (ExtendedPoll#34) + 2013 ( 2 0 4127.6820815062 2 5872.2529546326 ) 53.7865695587 (ExtendedPoll#34) + 2016 ( 2 0 4127.6840140147 2 5872.2603352230 ) 53.7864835442 (ExtendedPoll#34) + 2017 ( 2 0 4127.6898115401 2 5872.2824769939 ) 53.7862255016 (ExtendedPoll#34) + 2018 ( 2 0 4127.6796235307 2 5872.3112438240 ) 53.7860518834 (ExtendedPoll#34) + 2026 ( 2 0 4127.6784943469 2 5872.3148875688 ) 53.7860284213 (ExtendedPoll#34) + 2027 ( 2 0 4127.6750287014 2 5872.3216844082 ) 53.7859970553 (ExtendedPoll#34) + 2033 ( 2 0 4127.6738721701 2 5872.3232011194 ) 53.7859935510 (ExtendedPoll#34) + 2034 ( 2 0 4127.6704025761 2 5872.3277512530 ) 53.7859830384 (ExtendedPoll#34) + 2040 ( 2 0 4127.6704920471 2 5872.3287007212 ) 53.7859734249 (ExtendedPoll#34) + 2045 ( 2 0 4127.6702519860 2 5872.3291127215 ) 53.7859717972 (ExtendedPoll#34) + 2046 ( 2 0 4127.6695318024 2 5872.3303487226 ) 53.7859669139 (ExtendedPoll#34) + 2052 ( 2 0 4127.6693723329 2 5872.3305259594 ) 53.7859667262 (ExtendedPoll#34) + 2053 ( 2 0 4127.6688939242 2 5872.3310576698 ) 53.7859661633 (ExtendedPoll#34) + 2060 ( 2 0 4127.6688751072 2 5872.3311142263 ) 53.7859658109 (ExtendedPoll#34) + 2062 ( 2 0 4127.6689990935 2 5872.3309999936 ) 53.7859657384 (ExtendedPoll#34) + 2070 ( 2 0 4127.6690021165 2 5872.3309978166 ) 53.7859657310 (ExtendedPoll#34) + 2095 ( 2 0 4999.9878997345 2 5000.0092959702 ) 55.9016794952 (ExtendedPoll#35) + 2096 ( 2 0 4999.9515989379 2 5000.0371838810 ) 55.9016196708 (ExtendedPoll#35) + 2097 ( 2 0 4999.8063957515 2 5000.1487355238 ) 55.9013804121 (ExtendedPoll#35) + 2098 ( 2 0 4999.2255830062 2 5000.5949420954 ) 55.9004239959 (ExtendedPoll#35) + 2099 ( 2 0 4996.9023320246 2 5002.3797683814 ) 55.8966082342 (ExtendedPoll#35) + 2100 ( 2 0 4987.6093280984 2 5009.5190735258 ) 55.8815039246 (ExtendedPoll#35) + 2101 ( 2 0 4950.4373123937 2 5038.0762941031 ) 55.8236448341 (ExtendedPoll#35) + 2102 ( 2 0 4801.7492495748 2 5152.3051764124 ) 55.6343152023 (ExtendedPoll#35) + 2103 ( 2 0 4206.9969982993 2 5609.2207056496 ) 55.6253373563 (ExtendedPoll#35) + 2107 ( 2 0 4217.9971862258 2 5610.1214654550 ) 55.5187948731 (ExtendedPoll#35) + 2108 ( 2 0 4250.9977500050 2 5612.8237448711 ) 55.2000072940 (ExtendedPoll#35) + 2109 ( 2 0 4279.8220637775 2 5600.5952481192 ) 55.0710067569 (ExtendedPoll#35) + 2110 ( 2 0 4366.2950050949 2 5563.9097578633 ) 54.6951789859 (ExtendedPoll#35) + 2114 ( 2 0 4393.3723907599 2 5548.1874048965 ) 54.6249740689 (ExtendedPoll#35) + 2115 ( 2 0 4474.6045477550 2 5501.0203459961 ) 54.4266469861 (ExtendedPoll#35) + 2117 ( 2 0 4525.2654628702 2 5464.3348557403 ) 54.3900963042 (ExtendedPoll#35) + 2123 ( 2 0 4514.4563452056 2 5483.6602479286 ) 54.2742359116 (ExtendedPoll#35) + 2124 ( 2 0 4491.7462798091 2 5505.0601172445 ) 54.2385084897 (ExtendedPoll#35) + 2125 ( 2 0 4423.6160836196 2 5569.2597251923 ) 54.1460338788 (ExtendedPoll#35) + 2126 ( 2 0 4151.0952988618 2 5826.0581569833 ) 54.0054730693 (ExtendedPoll#35) + 2132 ( 2 0 4119.6505929283 2 5880.2129283134 ) 53.7862527117 (ExtendedPoll#35) + 2150 ( 2 0 4119.5665931846 2 5880.3014995623 ) 53.7862021958 (ExtendedPoll#35) + 2151 ( 2 0 4119.3145939537 2 5880.5672133090 ) 53.7860509080 (ExtendedPoll#35) + 2152 ( 2 0 4118.3065970302 2 5881.6300682960 ) 53.7854496575 (ExtendedPoll#35) + 2163 ( 2 0 4118.3108711544 2 5881.6602849630 ) 53.7851316932 (ExtendedPoll#35) + 2171 ( 2 0 4118.3198847115 2 5881.6662155602 ) 53.7849945777 (ExtendedPoll#35) + 2172 ( 2 0 4118.3348277986 2 5881.6631276284 ) 53.7848865134 (ExtendedPoll#35) + 2174 ( 2 0 4118.3462668702 2 5881.6530292707 ) 53.7848751796 (ExtendedPoll#35) + 2183 ( 2 0 4118.3455932557 2 5881.6537043543 ) 53.7848751047 (ExtendedPoll#35) + 2184 ( 2 0 4118.3435724122 2 5881.6557296052 ) 53.7848748801 (ExtendedPoll#35) + 2185 ( 2 0 4118.3354890381 2 5881.6638306090 ) 53.7848739818 (ExtendedPoll#35) + 2186 ( 2 0 4118.3031555418 2 5881.6962346240 ) 53.7848703922 (ExtendedPoll#35) + 2187 ( 2 0 4118.1738215565 2 5881.8258506839 ) 53.7848560937 (ExtendedPoll#35) + 2197 ( 2 0 4118.1735085463 2 5881.8262104036 ) 53.7848556344 (ExtendedPoll#35) + 2198 ( 2 0 4118.1725695157 2 5881.8272895629 ) 53.7848542566 (ExtendedPoll#35) + 2207 ( 2 0 4118.1726545887 2 5881.8272060557 ) 53.7848542498 (ExtendedPoll#35) + 2208 ( 2 0 4118.1729098077 2 5881.8269555344 ) 53.7848542294 (ExtendedPoll#35) + 2209 ( 2 0 4118.1739306837 2 5881.8259534489 ) 53.7848541479 (ExtendedPoll#35) + 2210 ( 2 0 4118.1780141879 2 5881.8219451070 ) 53.7848538220 (ExtendedPoll#35) + 2226 ( 2 0 4118.1780093963 2 5881.8219592167 ) 53.7848537356 (ExtendedPoll#35) + 2227 ( 2 0 4118.1779950216 2 5881.8220015460 ) 53.7848534763 (ExtendedPoll#35) + 2234 ( 2 0 4118.1779947385 2 5881.8220052606 ) 53.7848534446 (ExtendedPoll#35) + 2249 ( 2 0 4168.4622208673 2 5740.6975175468 ) 54.6654457702 (ExtendedPoll#36) + 2250 ( 2 0 3937.8677106876 2 6034.1814395937 ) 54.1025876908 (ExtendedPoll#36) + 2258 ( 2 0 3968.8756845943 2 6029.8141193251 ) 53.8471893590 (ExtendedPoll#36) + 2266 ( 2 0 3966.3440036262 2 6032.7893562581 ) 53.8453293272 (ExtendedPoll#36) + 2272 ( 2 0 3967.2852805629 2 6032.5287671287 ) 53.8387026417 (ExtendedPoll#36) + 2275 ( 2 0 3966.9613567598 2 6032.8941676795 ) 53.8385991104 (ExtendedPoll#36) + 2276 ( 2 0 3965.9895853505 2 6033.9903693319 ) 53.8382928991 (ExtendedPoll#36) + 2288 ( 2 0 3966.0039197226 2 6033.9851390276 ) 53.8382028409 (ExtendedPoll#36) + 2289 ( 2 0 3966.0291479677 2 6033.9679675607 ) 53.8381131770 (ExtendedPoll#36) + 2295 ( 2 0 3966.0378553973 2 6033.9615960721 ) 53.8380860741 (ExtendedPoll#36) + 2307 ( 2 0 3966.0380469160 2 6033.9618735742 ) 53.8380818691 (ExtendedPoll#36) + 2312 ( 2 0 3966.0381004053 2 6033.9618472758 ) 53.8380815916 (ExtendedPoll#36) + 2317 ( 2 0 3966.0381302064 2 6033.9618470067 ) 53.8380813128 (ExtendedPoll#36) + 2322 ( 2 0 3966.0381451069 2 6033.9618471499 ) 53.8380811710 (ExtendedPoll#36) + 2327 ( 2 0 3966.0381513080 2 6033.9618430199 ) 53.8380811481 (ExtendedPoll#36) + 2329 ( 2 0 3966.0381381930 2 6033.9618595149 ) 53.8380811293 (ExtendedPoll#36) + 2334 ( 2 0 3966.0381418784 2 6033.9618557502 ) 53.8380811271 (ExtendedPoll#36) + 2335 ( 2 0 3966.0381529347 2 6033.9618444560 ) 53.8380811204 (ExtendedPoll#36) + 2336 ( 2 0 3966.0381971599 2 6033.9617992793 ) 53.8380810935 (ExtendedPoll#36) + 2337 ( 2 0 3966.0383740607 2 6033.9616185725 ) 53.8380809858 (ExtendedPoll#36) + 2338 ( 2 0 3966.0390816638 2 6033.9608957451 ) 53.8380805552 (ExtendedPoll#36) + 2339 ( 2 0 3966.0419120761 2 6033.9580044356 ) 53.8380788327 (ExtendedPoll#36) + 2340 ( 2 0 3966.0532337255 2 6033.9464391976 ) 53.8380719433 (ExtendedPoll#36) + 2341 ( 2 0 3966.0985203229 2 6033.9001782457 ) 53.8380443936 (ExtendedPoll#36) + 2342 ( 2 0 3966.2796667126 2 6033.7151344380 ) 53.8379343190 (ExtendedPoll#36) + 2343 ( 2 0 3967.0042522715 2 6032.9749592074 ) 53.8374960138 (ExtendedPoll#36) + 2344 ( 2 0 3969.9025945070 2 6030.0142582847 ) 53.8357746693 (ExtendedPoll#36) + 2345 ( 2 0 3981.4959634492 2 6018.1714545940 ) 53.8293988351 (ExtendedPoll#36) + 2346 ( 2 0 4027.8694392178 2 5970.8002398312 ) 53.8120165816 (ExtendedPoll#36) + 2348 ( 2 0 4027.8996279793 2 5970.7957732839 ) 53.8117751288 (ExtendedPoll#36) + 2349 ( 2 0 4027.9901942637 2 5970.7823736422 ) 53.8110507797 (ExtendedPoll#36) + 2350 ( 2 0 4028.3524594017 2 5970.7287750751 ) 53.8081535202 (ExtendedPoll#36) + 2351 ( 2 0 4028.5782890972 2 5970.8215646372 ) 53.8052259801 (ExtendedPoll#36) + 2352 ( 2 0 4029.0659874104 2 5970.8447020517 ) 53.8004791353 (ExtendedPoll#36) + 2360 ( 2 0 4029.1224148462 2 5970.8679660822 ) 53.7997469853 (ExtendedPoll#36) + 2368 ( 2 0 4029.1289146169 2 5970.8639709871 ) 53.7997219690 (ExtendedPoll#36) + 2372 ( 2 0 4029.1327113864 2 5970.8636015775 ) 53.7996898997 (ExtendedPoll#36) + 2377 ( 2 0 4029.1345329350 2 5970.8641672091 ) 53.7996679124 (ExtendedPoll#36) + 2379 ( 2 0 4029.1361890843 2 5970.8632210851 ) 53.7996608999 (ExtendedPoll#36) + 2385 ( 2 0 4029.1366590260 2 5970.8631402857 ) 53.7996572423 (ExtendedPoll#36) + 2389 ( 2 0 4029.1368554851 2 5970.8630052034 ) 53.7996566135 (ExtendedPoll#36) + 2390 ( 2 0 4029.1372198865 2 5970.8626976562 ) 53.7996559536 (ExtendedPoll#36) + 2401 ( 2 0 4029.1372434032 2 5970.8627159631 ) 53.7996555720 (ExtendedPoll#36) + 2402 ( 2 0 4029.1372160758 2 5970.8627689341 ) 53.7996553557 (ExtendedPoll#36) + 2408 ( 2 0 4029.1372107574 2 5970.8627828538 ) 53.7996552815 (ExtendedPoll#36) + 2411 ( 2 0 4029.1372020883 2 5970.8627949737 ) 53.7996552545 (ExtendedPoll#36) + 2415 ( 2 0 4029.1371973626 2 5970.8628007338 ) 53.7996552473 (ExtendedPoll#36) + 2422 ( 2 0 4029.1371969852 2 5970.8628025579 ) 53.7996552346 (ExtendedPoll#36) + 2424 ( 2 0 4029.1372006890 2 5970.8627988111 ) 53.7996552334 (ExtendedPoll#36) + 2425 ( 2 0 4029.1372118001 2 5970.8627875709 ) 53.7996552298 (ExtendedPoll#36) + 2426 ( 2 0 4029.1372562449 2 5970.8627426102 ) 53.7996552156 (ExtendedPoll#36) + 2427 ( 2 0 4029.1374340239 2 5970.8625627674 ) 53.7996551585 (ExtendedPoll#36) + 2428 ( 2 0 4029.1381451401 2 5970.8618433959 ) 53.7996549302 (ExtendedPoll#36) + 2429 ( 2 0 4029.1409896047 2 5970.8589659099 ) 53.7996540170 (ExtendedPoll#36) + 2430 ( 2 0 4029.1523674632 2 5970.8474559659 ) 53.7996503647 (ExtendedPoll#36) + 2431 ( 2 0 4029.1978788972 2 5970.8014161900 ) 53.7996357631 (ExtendedPoll#36) + 2432 ( 2 0 4029.3799246331 2 5970.6172570866 ) 53.7995774796 (ExtendedPoll#36) + 2433 ( 2 0 4030.1081075767 2 5969.8806206727 ) 53.7993463077 (ExtendedPoll#36) + 2434 ( 2 0 4033.0208393511 2 5966.9340750174 ) 53.7984530101 (ExtendedPoll#36) + 2435 ( 2 0 4044.6717664489 2 5955.1478923961 ) 53.7953815270 (ExtendedPoll#36) + 2436 ( 2 0 4091.2754748399 2 5908.0031619108 ) 53.7910882360 (ExtendedPoll#36) + 2439 ( 2 0 4091.3024169829 2 5908.0174949293 ) 53.7907097823 (ExtendedPoll#36) + 2440 ( 2 0 4091.3832434122 2 5908.0604939849 ) 53.7895744291 (ExtendedPoll#36) + 2441 ( 2 0 4091.7065491291 2 5908.2324902073 ) 53.7850331320 (ExtendedPoll#36) + 2444 ( 2 0 4091.7062625770 2 5908.2935241345 ) 53.7844786297 (ExtendedPoll#36) + 2461 ( 2 0 4091.7061814853 2 5908.2937483387 ) 53.7844773284 (ExtendedPoll#36) + 2468 ( 2 0 4091.7061774429 2 5908.2938078061 ) 53.7844768227 (ExtendedPoll#36) + 2471 ( 2 0 4091.7061404988 2 5908.2938545806 ) 53.7844767353 (ExtendedPoll#36) + 2480 ( 2 0 4091.7061392073 2 5908.2938580748 ) 53.7844767152 (ExtendedPoll#36) + 2485 ( 2 0 4091.7061402086 2 5908.2938596455 ) 53.7844766917 (ExtendedPoll#36) + 2502 ( 2 0 4996.9428758120 2 5002.4361458373 ) 55.8956087809 (ExtendedPoll#37) + 2503 ( 2 0 4987.7715032480 2 5009.7445833492 ) 55.8775091797 (ExtendedPoll#37) + 2504 ( 2 0 4951.0860129922 2 5038.9783333968 ) 55.8077152532 (ExtendedPoll#37) + 2505 ( 2 0 4804.3440519688 2 5155.9133335874 ) 55.5714059083 (ExtendedPoll#37) + 2506 ( 2 0 4217.3762078751 2 5623.6533343496 ) 55.3875012518 (ExtendedPoll#37) + 2508 ( 2 0 4161.4745084376 2 5735.4567332245 ) 54.7792090326 (ExtendedPoll#37) + 2512 ( 2 0 4301.2287570313 2 5616.6656219199 ) 54.7199123025 (ExtendedPoll#37) + 2518 ( 2 0 4362.3712407911 2 5630.6410467792 ) 54.0447637843 (ExtendedPoll#37) + 2523 ( 2 0 4360.6789041870 2 5638.2565614975 ) 53.9822178137 (ExtendedPoll#37) + 2527 ( 2 0 4357.7855545091 2 5640.8837775966 ) 53.9807745427 (ExtendedPoll#37) + 2528 ( 2 0 4349.1055054753 2 5648.7654258937 ) 53.9766818176 (ExtendedPoll#37) + 2529 ( 2 0 4314.3853093403 2 5680.2920190824 ) 53.9638836443 (ExtendedPoll#37) + 2531 ( 2 0 4293.8589040781 2 5703.8755485326 ) 53.9100589240 (ExtendedPoll#37) + 2537 ( 2 0 4288.6181197559 2 5709.6895436401 ) 53.8988093078 (ExtendedPoll#37) + 2541 ( 2 0 4286.0250233464 2 5712.6101890697 ) 53.8928738710 (ExtendedPoll#37) + 2542 ( 2 0 4278.2457341180 2 5721.3721253585 ) 53.8753278023 (ExtendedPoll#37) + 2551 ( 2 0 4278.6875840983 2 5721.1643151240 ) 53.8734640832 (ExtendedPoll#37) + 2555 ( 2 0 4278.5548371810 2 5721.3692198536 ) 53.8726233086 (ExtendedPoll#37) + 2563 ( 2 0 4278.5803407327 2 5721.3524598889 ) 53.8725625799 (ExtendedPoll#37) + 2564 ( 2 0 4278.6568513877 2 5721.3021799948 ) 53.8723804067 (ExtendedPoll#37) + 2569 ( 2 0 4278.6854324587 2 5721.3128786333 ) 53.8720225267 (ExtendedPoll#37) + 2577 ( 2 0 4278.6872107890 2 5721.3121890539 ) 53.8720135829 (ExtendedPoll#37) + 2579 ( 2 0 4278.6834607716 2 5721.3160673533 ) 53.8720086108 (ExtendedPoll#37) + 2580 ( 2 0 4278.6722107195 2 5721.3277022515 ) 53.8719936947 (ExtendedPoll#37) + 2589 ( 2 0 4278.6723989724 2 5721.3275559496 ) 53.8719934685 (ExtendedPoll#37) + 2591 ( 2 0 4278.6719110434 2 5721.3280214306 ) 53.8719932064 (ExtendedPoll#37) + 2592 ( 2 0 4278.6704472565 2 5721.3294178739 ) 53.8719924200 (ExtendedPoll#37) + 2593 ( 2 0 4278.6645921088 2 5721.3350036468 ) 53.8719892745 (ExtendedPoll#37) + 2594 ( 2 0 4278.6411715181 2 5721.3573467387 ) 53.8719766944 (ExtendedPoll#37) + 2595 ( 2 0 4278.5474891555 2 5721.4467191061 ) 53.8719264022 (ExtendedPoll#37) + 2596 ( 2 0 4278.1727597049 2 5721.8042085755 ) 53.8717256857 (ExtendedPoll#37) + 2597 ( 2 0 4276.6738419026 2 5723.2341664534 ) 53.8709300560 (ExtendedPoll#37) + 2598 ( 2 0 4270.6781706935 2 5728.9539979649 ) 53.8678634044 (ExtendedPoll#37) + 2599 ( 2 0 4246.6954858570 2 5751.8333240110 ) 53.8574561057 (ExtendedPoll#37) + 2600 ( 2 0 4150.7647465111 2 5843.3506281954 ) 53.8459142947 (ExtendedPoll#37) + 2603 ( 2 0 4151.0319463303 2 5843.7593181024 ) 53.8396594450 (ExtendedPoll#37) + 2604 ( 2 0 4151.8335457878 2 5844.9853878233 ) 53.8208980002 (ExtendedPoll#37) + 2605 ( 2 0 4153.3279881922 2 5846.2426983850 ) 53.7955624715 (ExtendedPoll#37) + 2609 ( 2 0 4153.1058903377 2 5846.6776178033 ) 53.7935050825 (ExtendedPoll#37) + 2611 ( 2 0 4152.8591623323 2 5847.0989959699 ) 53.7917987292 (ExtendedPoll#37) + 2620 ( 2 0 4152.8542659569 2 5847.1291180913 ) 53.7915611730 (ExtendedPoll#37) + 2622 ( 2 0 4152.9186835311 2 5847.0716643992 ) 53.7915145196 (ExtendedPoll#37) + 2626 ( 2 0 4152.8895239414 2 5847.1034820926 ) 53.7914812417 (ExtendedPoll#37) + 2631 ( 2 0 4152.8811001224 2 5847.1162049217 ) 53.7914385729 (ExtendedPoll#37) + 2634 ( 2 0 4152.8973868388 2 5847.1020486033 ) 53.7914233161 (ExtendedPoll#37) + 2643 ( 2 0 4152.8955121262 2 5847.1039880394 ) 53.7914221706 (ExtendedPoll#37) + 2644 ( 2 0 4152.8898879885 2 5847.1098063475 ) 53.7914187344 (ExtendedPoll#37) + 2652 ( 2 0 4152.8896638419 2 5847.1102272180 ) 53.7914168283 (ExtendedPoll#37) + 2661 ( 2 0 4152.8897034201 2 5847.1102717856 ) 53.7914160520 (ExtendedPoll#37) + 2665 ( 2 0 4152.8897151731 2 5847.1102626252 ) 53.7914160311 (ExtendedPoll#37) + 2666 ( 2 0 4152.8897504319 2 5847.1102351440 ) 53.7914159684 (ExtendedPoll#37) + 2670 ( 2 0 4152.8897404990 2 5847.1102462518 ) 53.7914159546 (ExtendedPoll#37) + 2671 ( 2 0 4152.8897107004 2 5847.1102795751 ) 53.7914159130 (ExtendedPoll#37) + 2675 ( 2 0 4152.8897044864 2 5847.1102931188 ) 53.7914158426 (ExtendedPoll#37) + 2681 ( 2 0 4152.8897024353 2 5847.1102962286 ) 53.7914158321 (ExtendedPoll#37) + 2686 ( 2 0 4152.8897041880 2 5847.1102955980 ) 53.7914158221 (ExtendedPoll#37) + 2695 ( 2 0 4152.8897041652 2 5847.1102957121 ) 53.7914158212 (ExtendedPoll#37) + 2698 ( 2 0 4152.8897042523 2 5847.1102956349 ) 53.7914158212 (ExtendedPoll#37) + 2699 ( 2 0 4152.8897045137 2 5847.1102954032 ) 53.7914158210 (ExtendedPoll#37) + 2700 ( 2 0 4152.8897048775 2 5847.1102951127 ) 53.7914158204 (ExtendedPoll#37) + 2760 ( 3 0 3333.3333333249 2 3333.3333333165 1 3333.3333333555 ) 47.1682905221 + 2761 ( 3 0 3333.3333332996 2 3333.3333332658 1 3333.3333334220 ) 47.1682905221 + 2762 ( 3 0 3333.3333331985 2 3333.3333330633 1 3333.3333336880 ) 47.1682905221 + 2763 ( 3 0 3333.3333327939 2 3333.3333322533 1 3333.3333347518 ) 47.1682905219 + 2764 ( 3 0 3333.3333311757 2 3333.3333290134 1 3333.3333390073 ) 47.1682905212 + 2765 ( 3 0 3333.3333247026 2 3333.3333160534 1 3333.3333560290 ) 47.1682905185 + 2766 ( 3 0 3333.3332988105 2 3333.3332642138 1 3333.3334241161 ) 47.1682905075 + 2767 ( 3 0 3333.3331952421 2 3333.3330568551 1 3333.3336964646 ) 47.1682904637 + 2768 ( 3 0 3333.3327809684 2 3333.3322274206 1 3333.3347858583 ) 47.1682902884 + 2769 ( 3 0 3333.3311238738 2 3333.3289096824 1 3333.3391434333 ) 47.1682895873 + 2770 ( 3 0 3333.3244954951 2 3333.3156387294 1 3333.3565737331 ) 47.1682867830 + 2771 ( 3 0 3333.2979819803 2 3333.2625549176 1 3333.4262949324 ) 47.1682755667 + 2772 ( 3 0 3333.1919279212 2 3333.0502196704 1 3333.7051797296 ) 47.1682307194 + 2773 ( 3 0 3332.7677116849 2 3332.2008786818 1 3334.8207189184 ) 47.1680516124 + 2774 ( 3 0 3331.0708467397 2 3328.8035147270 1 3339.2828756735 ) 47.1673397044 + 2775 ( 3 0 3324.2833869587 2 3315.2140589080 1 3357.1315026938 ) 47.1645644377 + 2776 ( 3 0 3297.1335478348 2 3260.8562356320 1 3428.5260107754 ) 47.1546240959 + 2777 ( 3 0 3188.5341913391 2 3043.4249425281 1 3714.1040431015 ) 47.1336301248 + 2782 ( 3 0 3188.5440963277 2 3043.4291749044 1 3714.1116982164 ) 47.1334189419 + 2783 ( 3 0 3188.5738112936 2 3043.4418720333 1 3714.1346635611 ) 47.1327853954 + 2784 ( 3 0 3188.6926711573 2 3043.4926605491 1 3714.2265249397 ) 47.1302512441 + 2785 ( 3 0 3189.1681106120 2 3043.6958146122 1 3714.5939704540 ) 47.1201151932 + 2786 ( 3 0 3191.0698684310 2 3044.5084308647 1 3716.0637525116 ) 47.0795798665 + 2787 ( 3 0 3198.6768997067 2 3047.7588958743 1 3721.9428807416 ) 46.9175811367 + 2788 ( 3 0 3198.8948848743 2 3047.5863280381 1 3722.3442473958 ) 46.9131329647 + 2789 ( 3 0 3199.5488403769 2 3047.0686245294 1 3723.5483473581 ) 46.8997895433 + 2790 ( 3 0 3202.1646623876 2 3044.9978104945 1 3728.3647472073 ) 46.8464322782 + 2791 ( 3 0 3212.6279504301 2 3036.7145543550 1 3747.6303466044 ) 46.6332660653 + 2802 ( 2 0 4900.6584516792 2 5075.3512624213 ) 55.7642295241 (ExtendedPoll#39) + 2803 ( 2 0 4607.1745296323 2 5305.9457726010 ) 55.4472050367 (ExtendedPoll#39) + 2809 ( 2 0 4509.3465556167 2 5389.7983217572 ) 55.3312037272 (ExtendedPoll#39) + 2810 ( 2 0 4215.8626335698 2 5641.3559692260 ) 55.2227885943 (ExtendedPoll#39) + 2812 ( 2 0 3880.4524369449 2 6088.5695647259 ) 54.1867250496 (ExtendedPoll#39) + 2821 ( 2 0 3865.6035480318 2 6116.0836824178 ) 54.0994049526 (ExtendedPoll#39) + 2826 ( 2 0 3858.1791035753 2 6129.8407412638 ) 54.0570067200 (ExtendedPoll#39) + 2831 ( 2 0 3865.9856885553 2 6129.2948262302 ) 53.9862513494 (ExtendedPoll#39) + 2837 ( 2 0 3867.9219809400 2 6129.0355165892 ) 53.9697415456 (ExtendedPoll#39) + 2838 ( 2 0 3871.2247668931 2 6126.9473915858 ) 53.9552082161 (ExtendedPoll#39) + 2843 ( 2 0 3872.9461052333 2 6126.0261599667 ) 53.9462662728 (ExtendedPoll#39) + 2847 ( 2 0 3873.9223548519 2 6126.0547352067 ) 53.9366367060 (ExtendedPoll#39) + 2859 ( 2 0 3873.9150839053 2 6126.0681502590 ) 53.9365956057 (ExtendedPoll#39) + 2860 ( 2 0 3873.9023656577 2 6126.0958912493 ) 53.9364883221 (ExtendedPoll#39) + 2867 ( 2 0 3873.8992381518 2 6126.1002869850 ) 53.9364820231 (ExtendedPoll#39) + 2878 ( 2 0 3873.8993365564 2 6126.1005041485 ) 53.9364792786 (ExtendedPoll#39) + 2882 ( 2 0 3873.8994440785 2 6126.1004526718 ) 53.9364786703 (ExtendedPoll#39) + 2885 ( 2 0 3873.8995441434 2 6126.1003878808 ) 53.9364782440 (ExtendedPoll#39) + 2886 ( 2 0 3873.8997141999 2 6126.1002207754 ) 53.9364779912 (ExtendedPoll#39) + 2887 ( 2 0 3873.9002243693 2 6126.0997194591 ) 53.9364772329 (ExtendedPoll#39) + 2888 ( 2 0 3873.9022650468 2 6126.0977141941 ) 53.9364741996 (ExtendedPoll#39) + 2895 ( 2 0 3873.9023564295 2 6126.0976376432 ) 53.9364739541 (ExtendedPoll#39) + 2904 ( 2 0 3873.9023666523 2 6126.0976268016 ) 53.9364739455 (ExtendedPoll#39) + 2905 ( 2 0 3873.9023973206 2 6126.0975942769 ) 53.9364739197 (ExtendedPoll#39) + 2906 ( 2 0 3873.9025199938 2 6126.0974641781 ) 53.9364738164 (ExtendedPoll#39) + 2907 ( 2 0 3873.9030106867 2 6126.0969437827 ) 53.9364734034 (ExtendedPoll#39) + 2908 ( 2 0 3873.9049734581 2 6126.0948622015 ) 53.9364717515 (ExtendedPoll#39) + 2909 ( 2 0 3873.9128245438 2 6126.0865358764 ) 53.9364651438 (ExtendedPoll#39) + 2910 ( 2 0 3873.9442288869 2 6126.0532305760 ) 53.9364387171 (ExtendedPoll#39) + 2911 ( 2 0 3874.0698462589 2 6125.9200093744 ) 53.9363330745 (ExtendedPoll#39) + 2912 ( 2 0 3874.5723157471 2 6125.3871245682 ) 53.9359115277 (ExtendedPoll#39) + 2913 ( 2 0 3876.5821937000 2 6123.2555853431 ) 53.9342417174 (ExtendedPoll#39) + 2914 ( 2 0 3884.6217055116 2 6114.7294284431 ) 53.9278243645 (ExtendedPoll#39) + 2915 ( 2 0 3916.7797527577 2 6080.6248008429 ) 53.9063357782 (ExtendedPoll#39) + 2916 ( 2 0 4045.4119417422 2 5944.2062904420 ) 53.8866188839 (ExtendedPoll#39) + 2919 ( 2 0 4045.5215045970 2 5944.2601089211 ) 53.8851192623 (ExtendedPoll#39) + 2920 ( 2 0 4045.8501931615 2 5944.4215643586 ) 53.8806205222 (ExtendedPoll#39) + 2921 ( 2 0 4047.1649474193 2 5945.0673861082 ) 53.8626274298 (ExtendedPoll#39) + 2922 ( 2 0 4048.1386380613 2 5945.1403169447 ) 53.8529449201 (ExtendedPoll#39) + 2923 ( 2 0 4051.0597099870 2 5945.3591094543 ) 53.8239051878 (ExtendedPoll#39) + 2926 ( 2 0 4052.9055851942 2 5944.7227772433 ) 53.8125206018 (ExtendedPoll#39) + 2931 ( 2 0 4053.8541125651 2 5944.9547911326 ) 53.8016493716 (ExtendedPoll#39) + 2934 ( 2 0 4054.7420774868 2 5944.5483403302 ) 53.7970783073 (ExtendedPoll#39) + 2940 ( 2 0 4055.1565250914 2 5944.8064771068 ) 53.7909201097 (ExtendedPoll#39) + 2949 ( 2 0 4055.1705529195 2 5944.8124812684 ) 53.7907362425 (ExtendedPoll#39) + 2954 ( 2 0 4055.1759264999 2 5944.8178972016 ) 53.7906378043 (ExtendedPoll#39) + 2955 ( 2 0 4055.1662131965 2 5944.8296651001 ) 53.7906219881 (ExtendedPoll#39) + 2959 ( 2 0 4055.1612269352 2 5944.8354395879 ) 53.7906162644 (ExtendedPoll#39) + 2960 ( 2 0 4055.1462681513 2 5944.8527630512 ) 53.7905990941 (ExtendedPoll#39) + 2966 ( 2 0 4055.1439936051 2 5944.8558254594 ) 53.7905926341 (ExtendedPoll#39) + 2972 ( 2 0 4055.1459887350 2 5944.8540101306 ) 53.7905904735 (ExtendedPoll#39) + 2994 ( 2 0 4055.1459891780 2 5944.8540106179 ) 53.7905904650 (ExtendedPoll#39) + 2996 ( 2 0 4055.1459895782 2 5944.8540103798 ) 53.7905904635 (ExtendedPoll#39) + 3007 ( 2 0 4055.1459895943 2 5944.8540104040 ) 53.7905904631 (ExtendedPoll#39) + 3013 ( 3 0 3210.5286604494 2 3038.4216692843 1 3750.4447793258 ) 46.6015154107 + 3024 ( 2 0 4692.2382076236 2 5223.3043522798 ) 55.6902400114 (ExtendedPoll#40) + 3032 ( 2 0 4751.6337632759 2 5242.5205614614 ) 54.9900785314 (ExtendedPoll#40) + 3041 ( 2 0 4744.8371211080 2 5251.2279062468 ) 54.9451839171 (ExtendedPoll#40) + 3042 ( 2 0 4735.4473825306 2 5263.6747690122 ) 54.8789033947 (ExtendedPoll#40) + 3051 ( 2 0 4734.9854872326 2 5264.5350116862 ) 54.8728327514 (ExtendedPoll#40) + 3052 ( 2 0 4733.7844741588 2 5266.0755156716 ) 54.8649914704 (ExtendedPoll#40) + 3057 ( 2 0 4733.0120896855 2 5266.6730367357 ) 54.8644320425 (ExtendedPoll#40) + 3058 ( 2 0 4730.6949362657 2 5268.4655999279 ) 54.8627657851 (ExtendedPoll#40) + 3059 ( 2 0 4721.4263225864 2 5275.6358526969 ) 54.8562814361 (ExtendedPoll#40) + 3060 ( 2 0 4684.3518678691 2 5304.3168637731 ) 54.8332529571 (ExtendedPoll#40) + 3061 ( 2 0 4536.0540490000 2 5419.0409080777 ) 54.7888275928 (ExtendedPoll#40) + 3064 ( 2 0 4533.8703888657 2 5450.0488819844 ) 54.4714998393 (ExtendedPoll#40) + 3067 ( 2 0 4509.4133953618 2 5469.7018231929 ) 54.4660067399 (ExtendedPoll#40) + 3068 ( 2 0 4436.0424148501 2 5528.6606468184 ) 54.4633610125 (ExtendedPoll#40) + 3071 ( 2 0 4390.6222840571 2 5570.5869213965 ) 54.4160608763 (ExtendedPoll#40) + 3072 ( 2 0 4254.3618916782 2 5696.3657451309 ) 54.3333134172 (ExtendedPoll#40) + 3076 ( 2 0 4163.5216300923 2 5787.2060067168 ) 54.2619287838 (ExtendedPoll#40) + 3082 ( 2 0 4151.2931333404 2 5848.3484904766 ) 53.7943165716 (ExtendedPoll#40) + 3098 ( 2 0 4151.1660641526 2 5848.5569671112 ) 53.7935193903 (ExtendedPoll#40) + 3099 ( 2 0 4150.7848565894 2 5849.1823970151 ) 53.7911289956 (ExtendedPoll#40) + 3104 ( 2 0 4150.6155109737 2 5849.3582466966 ) 53.7910215159 (ExtendedPoll#40) + 3105 ( 2 0 4150.1074741268 2 5849.8857957410 ) 53.7907001042 (ExtendedPoll#40) + 3120 ( 2 0 4150.1089861817 2 5849.8869583539 ) 53.7906755049 (ExtendedPoll#40) + 3121 ( 2 0 4150.1127107275 2 5849.8861339310 ) 53.7906493993 (ExtendedPoll#40) + 3125 ( 2 0 4150.1143060889 2 5849.8850885612 ) 53.7906446904 (ExtendedPoll#40) + 3126 ( 2 0 4150.1171485655 2 5849.8825445004 ) 53.7906426731 (ExtendedPoll#40) + 3132 ( 2 0 4150.1178834653 2 5849.8819367039 ) 53.7906416845 (ExtendedPoll#40) + 3143 ( 2 0 4150.1179323692 2 5849.8819026286 ) 53.7906415591 (ExtendedPoll#40) + 3144 ( 2 0 4150.1180790807 2 5849.8818004026 ) 53.7906411831 (ExtendedPoll#40) + 3145 ( 2 0 4150.1182616331 2 5849.8816470466 ) 53.7906409597 (ExtendedPoll#40) + 3146 ( 2 0 4150.1188092902 2 5849.8811869788 ) 53.7906402897 (ExtendedPoll#40) + 3160 ( 2 0 4150.1188123412 2 5849.8811848413 ) 53.7906402820 (ExtendedPoll#40) + 3161 ( 2 0 4150.1188214943 2 5849.8811784287 ) 53.7906402588 (ExtendedPoll#40) + 3171 ( 2 0 4150.1188216858 2 5849.8811782962 ) 53.7906402583 (ExtendedPoll#40) + 3198 ( 2 0 4999.8309411913 2 5000.1672333819 ) 55.9009656850 (ExtendedPoll#41) + 3200 ( 2 0 4999.4491205399 2 5000.4715383635 ) 55.9002031428 (ExtendedPoll#41) + 3201 ( 2 0 4998.3036585857 2 5001.3844533083 ) 55.8979182003 (ExtendedPoll#41) + 3202 ( 2 0 4993.7218107688 2 5005.0361130876 ) 55.8888187275 (ExtendedPoll#41) + 3203 ( 2 0 4975.3944195012 2 5019.6427522045 ) 55.8530679233 (ExtendedPoll#41) + 3204 ( 2 0 4902.0848544307 2 5078.0693086723 ) 55.7205670458 (ExtendedPoll#41) + 3205 ( 2 0 4608.8465941490 2 5311.7755345433 ) 55.3681229992 (ExtendedPoll#41) + 3207 ( 2 0 4583.9528686182 2 5330.5550116980 ) 55.3637996156 (ExtendedPoll#41) + 3208 ( 2 0 4509.2716920260 2 5386.8934431624 ) 55.3635911500 (ExtendedPoll#41) + 3210 ( 2 0 4432.4068552994 2 5484.7214171780 ) 54.9584061960 (ExtendedPoll#41) + 3211 ( 2 0 4201.8123451197 2 5778.2053392249 ) 54.0036331278 (ExtendedPoll#41) + 3223 ( 2 0 4200.8569938110 2 5785.9573327015 ) 53.9378132020 (ExtendedPoll#41) + 3224 ( 2 0 4192.2315362806 2 5799.0592935072 ) 53.8900546358 (ExtendedPoll#41) + 3232 ( 2 0 4194.7836890625 2 5802.0140586264 ) 53.8389301385 (ExtendedPoll#41) + 3234 ( 2 0 4192.4430783561 2 5805.1394221936 ) 53.8302201837 (ExtendedPoll#41) + 3235 ( 2 0 4185.4212462368 2 5814.5155128951 ) 53.8043694686 (ExtendedPoll#41) + 3251 ( 2 0 4185.4407963358 2 5814.5389460247 ) 53.8039710219 (ExtendedPoll#41) + 3257 ( 2 0 4185.4480076188 2 5814.5364550417 ) 53.8039296544 (ExtendedPoll#41) + 3258 ( 2 0 4185.4696414679 2 5814.5289820924 ) 53.8038055528 (ExtendedPoll#41) + 3261 ( 2 0 4185.4807342197 2 5814.5185044072 ) 53.8038049529 (ExtendedPoll#41) + 3270 ( 2 0 4185.4816714853 2 5814.5183282598 ) 53.8037981763 (ExtendedPoll#41) + 3288 ( 2 0 4185.4816706336 2 5814.5183292645 ) 53.8037981745 (ExtendedPoll#41) + 3292 ( 2 0 4185.4816710094 2 5814.5183289895 ) 53.8037981737 (ExtendedPoll#41) + 3309 ( 2 0 4901.8695805142 2 5076.5623912563 ) 55.7402643064 (ExtendedPoll#42) + 3310 ( 2 0 4608.3856584673 2 5307.1569014360 ) 55.4236611469 (ExtendedPoll#42) + 3318 ( 2 0 4606.6387303599 2 5338.1648753428 ) 55.0917439291 (ExtendedPoll#42) + 3319 ( 2 0 4589.1694492857 2 5397.5604309951 ) 54.5804183615 (ExtendedPoll#42) + 3325 ( 2 0 4562.9655276744 2 5433.3724571972 ) 54.4082368778 (ExtendedPoll#42) + 3326 ( 2 0 4514.0515406666 2 5471.8048755605 ) 54.4043973012 (ExtendedPoll#42) + 3333 ( 2 0 4527.6994165058 2 5464.1620650905 ) 54.3714868324 (ExtendedPoll#42) + 3340 ( 2 0 4526.1776783497 2 5467.7582803742 ) 54.3456878637 (ExtendedPoll#42) + 3341 ( 2 0 4521.0733727858 2 5473.6814584884 ) 54.3251632561 (ExtendedPoll#42) + 3342 ( 2 0 4505.7604560942 2 5491.4509928311 ) 54.2645642604 (ExtendedPoll#42) + 3346 ( 2 0 4501.4477273290 2 5497.9746774822 ) 54.2316163720 (ExtendedPoll#42) + 3348 ( 2 0 4495.7156194766 2 5503.2973490595 ) 54.2235944245 (ExtendedPoll#42) + 3349 ( 2 0 4478.5192959191 2 5519.2653637914 ) 54.2004433791 (ExtendedPoll#42) + 3350 ( 2 0 4409.7340016894 2 5583.1374227190 ) 54.1217038236 (ExtendedPoll#42) + 3351 ( 2 0 4134.5928247705 2 5838.6256584295 ) 54.0371198163 (ExtendedPoll#42) + 3353 ( 2 0 4057.7279880439 2 5936.4536324451 ) 53.8423122971 (ExtendedPoll#42) + 3358 ( 2 0 4036.3281187280 2 5959.1636978416 ) 53.8369788559 (ExtendedPoll#42) + 3366 ( 2 0 4033.2436987883 2 5966.3424805330 ) 53.8016467560 (ExtendedPoll#42) + 3376 ( 2 0 4033.3453648009 2 5966.5644451074 ) 53.7987246325 (ExtendedPoll#42) + 3380 ( 2 0 4033.4533282953 2 5966.5074812194 ) 53.7982274597 (ExtendedPoll#42) + 3387 ( 2 0 4033.4322917074 2 5966.5295898786 ) 53.7982263075 (ExtendedPoll#42) + 3388 ( 2 0 4033.3691819436 2 5966.5959158563 ) 53.7982228672 (ExtendedPoll#42) + 3389 ( 2 0 4033.1167428886 2 5966.8612197669 ) 53.7982093544 (ExtendedPoll#42) + 3397 ( 2 0 4033.1071823367 2 5966.8731120948 ) 53.7981924297 (ExtendedPoll#42) + 3398 ( 2 0 4033.0785006809 2 5966.9087890783 ) 53.7981416597 (ExtendedPoll#42) + 3403 ( 2 0 4033.0925954613 2 5966.9029438115 ) 53.7980625663 (ExtendedPoll#42) + 3408 ( 2 0 4033.0991795212 2 5966.8990892331 ) 53.7980356267 (ExtendedPoll#42) + 3418 ( 2 0 4033.0989658428 2 5966.8995155138 ) 53.7980338197 (ExtendedPoll#42) + 3419 ( 2 0 4033.0983248077 2 5966.9007943557 ) 53.7980283990 (ExtendedPoll#42) + 3422 ( 2 0 4033.0980226539 2 5966.9016988988 ) 53.7980231575 (ExtendedPoll#42) + 3430 ( 2 0 4033.0981418065 2 5966.9016952224 ) 53.7980220818 (ExtendedPoll#42) + 3432 ( 2 0 4033.0982490223 2 5966.9016431107 ) 53.7980215482 (ExtendedPoll#42) + 3436 ( 2 0 4033.0983032868 2 5966.9016184516 ) 53.7980212629 (ExtendedPoll#42) + 3437 ( 2 0 4033.0983898253 2 5966.9015364642 ) 53.7980211876 (ExtendedPoll#42) + 3438 ( 2 0 4033.0986494409 2 5966.9012905019 ) 53.7980209620 (ExtendedPoll#42) + 3439 ( 2 0 4033.0996879031 2 5966.9003066526 ) 53.7980200592 (ExtendedPoll#42) + 3447 ( 2 0 4033.0996674107 2 5966.9003282915 ) 53.7980200572 (ExtendedPoll#42) + 3448 ( 2 0 4033.0996059334 2 5966.9003932080 ) 53.7980200513 (ExtendedPoll#42) + 3463 ( 2 0 4033.0996058034 2 5966.9003936551 ) 53.7980200485 (ExtendedPoll#42) + 3470 ( 2 0 4033.0996061081 2 5966.9003937799 ) 53.7980200446 (ExtendedPoll#42) + 3474 ( 2 0 4033.0996062242 2 5966.9003937721 ) 53.7980200436 (ExtendedPoll#42) + 3482 ( 3 0 3210.2889578675 2 3039.3458759311 1 3750.2389595149 ) 46.5961289316 + 3490 ( 2 0 4552.7233011568 2 5335.3470932817 ) 55.5692389089 (ExtendedPoll#43) + 3494 ( 2 0 4440.9199022818 2 5558.9538910317 ) 54.1048755479 (ExtendedPoll#43) + 3516 ( 2 0 4440.9496420561 2 5559.0071913847 ) 54.1040659660 (ExtendedPoll#43) + 3520 ( 2 0 4440.9365610370 2 5559.0347632759 ) 54.1038907469 (ExtendedPoll#43) + 3521 ( 2 0 4440.8905377740 2 5559.0748522452 ) 54.1038670525 (ExtendedPoll#43) + 3522 ( 2 0 4440.7524679852 2 5559.1951191530 ) 54.1037960247 (ExtendedPoll#43) + 3523 ( 2 0 4440.2001888298 2 5559.6761867843 ) 54.1035127440 (ExtendedPoll#43) + 3524 ( 2 0 4437.9910722084 2 5561.6004573097 ) 54.1023929098 (ExtendedPoll#43) + 3525 ( 2 0 4429.1546057226 2 5569.2975394109 ) 54.0981264568 (ExtendedPoll#43) + 3526 ( 2 0 4393.8087397796 2 5600.0858678158 ) 54.0844835555 (ExtendedPoll#43) + 3529 ( 2 0 4394.2113521169 2 5603.9686884921 ) 54.0411680120 (ExtendedPoll#43) + 3530 ( 2 0 4388.9432720429 2 5609.7553878479 ) 54.0274056417 (ExtendedPoll#43) + 3535 ( 2 0 4388.0032745945 2 5611.4664902813 ) 54.0180260116 (ExtendedPoll#43) + 3538 ( 2 0 4386.7886136448 2 5612.9967583598 ) 54.0128824739 (ExtendedPoll#43) + 3544 ( 2 0 4386.4467770046 2 5613.3454189378 ) 54.0122750804 (ExtendedPoll#43) + 3545 ( 2 0 4385.4212670842 2 5614.3914006721 ) 54.0104567213 (ExtendedPoll#43) + 3546 ( 2 0 4381.3192274022 2 5618.5753276090 ) 54.0032406382 (ExtendedPoll#43) + 3549 ( 2 0 4380.5784036418 2 5619.2116598200 ) 54.0031640007 (ExtendedPoll#43) + 3550 ( 2 0 4378.3559323606 2 5621.1206564531 ) 54.0029484717 (ExtendedPoll#43) + 3551 ( 2 0 4369.4660472359 2 5628.7566429851 ) 54.0023023644 (ExtendedPoll#43) + 3559 ( 2 0 4369.5969815447 2 5629.7243626813 ) 53.9913292971 (ExtendedPoll#43) + 3562 ( 2 0 4369.6824940167 2 5630.2051304326 ) 53.9857012024 (ExtendedPoll#43) + 3569 ( 2 0 4369.6472614388 2 5630.3220036975 ) 53.9848193694 (ExtendedPoll#43) + 3572 ( 2 0 4369.6050333250 2 5630.3660727419 ) 53.9847380922 (ExtendedPoll#43) + 3573 ( 2 0 4369.4783489833 2 5630.4982798750 ) 53.9844943213 (ExtendedPoll#43) + 3574 ( 2 0 4368.9716116168 2 5631.0271084078 ) 53.9835201449 (ExtendedPoll#43) + 3578 ( 2 0 4368.8845997443 2 5631.1127275039 ) 53.9834056991 (ExtendedPoll#43) + 3579 ( 2 0 4368.6235641269 2 5631.3695847921 ) 53.9830625988 (ExtendedPoll#43) + 3580 ( 2 0 4367.5794216571 2 5632.3970139452 ) 53.9816937566 (ExtendedPoll#43) + 3581 ( 2 0 4363.4028517782 2 5636.5067305573 ) 53.9762753650 (ExtendedPoll#43) + 3582 ( 2 0 4346.6965722627 2 5652.9455970056 ) 53.9555155106 (ExtendedPoll#43) + 3583 ( 2 0 4279.8714542003 2 5718.7010627990 ) 53.8872266051 (ExtendedPoll#43) + 3584 ( 2 0 4012.5709819511 2 5981.7229259727 ) 53.8578815474 (ExtendedPoll#43) + 3586 ( 2 0 4003.8363414140 2 5994.7157037717 ) 53.8249871296 (ExtendedPoll#43) + 3594 ( 2 0 4003.0106449257 2 5996.4848096773 ) 53.8171655728 (ExtendedPoll#43) + 3597 ( 2 0 4002.3593853505 2 5997.2124120580 ) 53.8168706752 (ExtendedPoll#43) + 3598 ( 2 0 4000.4056066249 2 5999.3952192000 ) 53.8160033453 (ExtendedPoll#43) + 3606 ( 2 0 4000.3383801740 2 5999.4971117887 ) 53.8157389067 (ExtendedPoll#43) + 3607 ( 2 0 4000.1367008212 2 5999.8027895547 ) 53.8149458834 (ExtendedPoll#43) + 3613 ( 2 0 4000.1340485485 2 5999.8637668378 ) 53.8144356991 (ExtendedPoll#43) + 3621 ( 2 0 4000.1293216626 2 5999.8697555108 ) 53.8144274351 (ExtendedPoll#43) + 3629 ( 2 0 4000.1301279381 2 5999.8692461828 ) 53.8144243508 (ExtendedPoll#43) + 3633 ( 2 0 4000.1294111560 2 5999.8703886418 ) 53.8144210416 (ExtendedPoll#43) + 3635 ( 2 0 4000.1312576800 2 5999.8684223480 ) 53.8144209958 (ExtendedPoll#43) + 3636 ( 2 0 4000.1367972520 2 5999.8625234666 ) 53.8144208588 (ExtendedPoll#43) + 3637 ( 2 0 4000.1589555398 2 5999.8389279410 ) 53.8144203127 (ExtendedPoll#43) + 3638 ( 2 0 4000.2475886910 2 5999.7445458387 ) 53.8144181595 (ExtendedPoll#43) + 3639 ( 2 0 4000.6021212960 2 5999.3670174292 ) 53.8144100483 (ExtendedPoll#43) + 3640 ( 2 0 4002.0202517159 2 5997.8569037914 ) 53.8143856278 (ExtendedPoll#43) + 3642 ( 2 0 4002.1422495983 2 5997.8527654463 ) 53.8132795659 (ExtendedPoll#43) + 3651 ( 2 0 4002.1489902101 2 5997.8491916670 ) 53.8132478315 (ExtendedPoll#43) + 3656 ( 2 0 4002.1460036830 2 5997.8536843822 ) 53.8132363424 (ExtendedPoll#43) + 3663 ( 2 0 4002.1464898557 2 5997.8532170669 ) 53.8132358938 (ExtendedPoll#43) + 3664 ( 2 0 4002.1479483737 2 5997.8518151211 ) 53.8132345481 (ExtendedPoll#43) + 3665 ( 2 0 4002.1537824458 2 5997.8462073379 ) 53.8132291653 (ExtendedPoll#43) + 3681 ( 2 0 4002.1537952967 2 5997.8461997948 ) 53.8132291112 (ExtendedPoll#43) + 3692 ( 2 0 4002.1537979211 2 5997.8462000219 ) 53.8132290846 (ExtendedPoll#43) + 3694 ( 2 0 4002.1537995406 2 5997.8461991017 ) 53.8132290775 (ExtendedPoll#43) + 3695 ( 2 0 4002.1538022459 2 5997.8461965406 ) 53.8132290747 (ExtendedPoll#43) + 3696 ( 2 0 4002.1538103616 2 5997.8461888572 ) 53.8132290662 (ExtendedPoll#43) + 3705 ( 2 0 4002.1538099327 2 5997.8461896839 ) 53.8132290629 (ExtendedPoll#43) + 3713 ( 2 0 4002.1538099976 2 5997.8461897805 ) 53.8132290615 (ExtendedPoll#43) + 3716 ( 2 0 4002.1538101107 2 5997.8461898084 ) 53.8132290602 (ExtendedPoll#43) + 3721 ( 2 0 4002.1538101371 2 5997.8461898603 ) 53.8132290595 (ExtendedPoll#43) + 3750 ( 2 0 4999.8953615990 2 4999.9816204393 ) 55.9027305088 (ExtendedPoll#44) + 3751 ( 2 0 4999.7707564260 2 5000.1157917870 ) 55.9020567360 (ExtendedPoll#44) + 3752 ( 2 0 4999.2723357338 2 5000.6524771780 ) 55.8993623523 (ExtendedPoll#44) + 3755 ( 2 0 4999.1349773271 2 5000.8543164668 ) 55.8979629118 (ExtendedPoll#44) + 3762 ( 2 0 4999.0739417340 2 5000.9153520600 ) 55.8976901754 (ExtendedPoll#44) + 3763 ( 2 0 4998.8908349545 2 5001.0984588395 ) 55.8968720583 (ExtendedPoll#44) + 3764 ( 2 0 4998.1584078364 2 5001.8308859575 ) 55.8936009704 (ExtendedPoll#44) + 3765 ( 2 0 4995.2286993643 2 5004.7605944297 ) 55.8805387184 (ExtendedPoll#44) + 3766 ( 2 0 4983.5098654757 2 5016.4794283182 ) 55.8286442151 (ExtendedPoll#44) + 3767 ( 2 0 4936.6345299214 2 5063.3547638726 ) 55.6267962813 (ExtendedPoll#44) + 3768 ( 2 0 4749.1331877041 2 5250.8561060898 ) 54.9147822323 (ExtendedPoll#44) + 3769 ( 2 0 3999.1278188349 2 6000.8614749590 ) 53.8151109452 (ExtendedPoll#44) + 3786 ( 2 0 3999.1207593662 2 6000.8750024663 ) 53.8150584528 (ExtendedPoll#44) + 3793 ( 2 0 3999.1195214058 2 6000.8764534763 ) 53.8150573268 (ExtendedPoll#44) + 3794 ( 2 0 3999.1158075247 2 6000.8808065061 ) 53.8150539489 (ExtendedPoll#44) + 3795 ( 2 0 3999.1009520003 2 6000.8982186254 ) 53.8150404383 (ExtendedPoll#44) + 3805 ( 2 0 3999.1012090993 2 6000.8986202144 ) 53.8150345073 (ExtendedPoll#44) + 3812 ( 2 0 3999.1012443818 2 6000.8986682546 ) 53.8150337554 (ExtendedPoll#44) + 3813 ( 2 0 3999.1011692098 2 6000.8987607750 ) 53.8150336483 (ExtendedPoll#44) + 3814 ( 2 0 3999.1009436941 2 6000.8990383364 ) 53.8150333272 (ExtendedPoll#44) + 3824 ( 2 0 3999.1009378077 2 6000.8990520256 ) 53.8150332623 (ExtendedPoll#44) + 3828 ( 2 0 3999.1009370763 2 6000.8990594402 ) 53.8150332041 (ExtendedPoll#44) + 3831 ( 2 0 3999.1009434424 2 6000.8990555693 ) 53.8150331784 (ExtendedPoll#44) + 3837 ( 2 0 3999.1009426080 2 6000.8990572346 ) 53.8150331716 (ExtendedPoll#44) + 3841 ( 2 0 3999.1009445289 2 6000.8990554321 ) 53.8150331694 (ExtendedPoll#44) + 3877 ( 2 0 4999.7695768976 2 5000.1146922267 ) 55.9020792324 (ExtendedPoll#45) + 3878 ( 2 0 4999.2676176204 2 5000.6480789368 ) 55.8994523349 (ExtendedPoll#45) + 3882 ( 2 0 4999.0614867145 2 5000.9250615107 ) 55.8976679710 (ExtendedPoll#45) + 3893 ( 2 0 4999.0655499855 2 5000.9315188764 ) 55.8975579561 (ExtendedPoll#45) + 3895 ( 2 0 4999.0601491243 2 5000.9369076070 ) 55.8975339712 (ExtendedPoll#45) + 3896 ( 2 0 4999.0439465409 2 5000.9530737988 ) 55.8974620175 (ExtendedPoll#45) + 3897 ( 2 0 4998.9791362072 2 5001.0177385657 ) 55.8971742134 (ExtendedPoll#45) + 3898 ( 2 0 4998.7198948722 2 5001.2763976335 ) 55.8960231692 (ExtendedPoll#45) + 3899 ( 2 0 4997.6829295325 2 5002.3110339045 ) 55.8914217511 (ExtendedPoll#45) + 3900 ( 2 0 4993.5350681737 2 5006.4495789887 ) 55.8730602592 (ExtendedPoll#45) + 3901 ( 2 0 4976.9436227384 2 5023.0037593255 ) 55.8003237383 (ExtendedPoll#45) + 3902 ( 2 0 4910.5778409973 2 5089.2204806727 ) 55.5208926377 (ExtendedPoll#45) + 3903 ( 2 0 4645.1147140329 2 5354.0873660614 ) 54.5978092091 (ExtendedPoll#45) + 3905 ( 2 0 4641.9961744036 2 5356.4416246436 ) 54.5973154410 (ExtendedPoll#45) + 3906 ( 2 0 4632.6405555159 2 5363.5044003904 ) 54.5960322314 (ExtendedPoll#45) + 3907 ( 2 0 4595.2180799647 2 5391.7555033777 ) 54.5938886963 (ExtendedPoll#45) + 3910 ( 2 0 4589.5405636156 2 5406.2768432706 ) 54.4819217775 (ExtendedPoll#45) + 3915 ( 2 0 4586.8655799511 2 5409.1224253831 ) 54.4730509300 (ExtendedPoll#45) + 3916 ( 2 0 4578.8406289576 2 5417.6591717205 ) 54.4466693127 (ExtendedPoll#45) + 3917 ( 2 0 4546.7408249837 2 5451.8061570703 ) 54.3446263871 (ExtendedPoll#45) + 3923 ( 2 0 4544.4002142773 2 5454.9315206375 ) 54.3305581908 (ExtendedPoll#45) + 3926 ( 2 0 4543.3834475273 2 5456.5982674743 ) 54.3211315639 (ExtendedPoll#45) + 3940 ( 2 0 4543.3817833230 2 5456.6057131428 ) 54.3210653441 (ExtendedPoll#45) + 3943 ( 2 0 4543.3799196151 2 5456.6131114083 ) 54.3210013080 (ExtendedPoll#45) + 3944 ( 2 0 4543.3724892530 2 5456.6264388915 ) 54.3209201075 (ExtendedPoll#45) + 3955 ( 2 0 4543.3733273061 2 5456.6259837410 ) 54.3209179808 (ExtendedPoll#45) + 3957 ( 2 0 4543.3714783336 2 5456.6279477327 ) 54.3209123378 (ExtendedPoll#45) + 3958 ( 2 0 4543.3659314160 2 5456.6338397077 ) 54.3208954091 (ExtendedPoll#45) + 3968 ( 2 0 4543.3658531448 2 5456.6339296214 ) 54.3208950973 (ExtendedPoll#45) + 3969 ( 2 0 4543.3656183312 2 5456.6341993626 ) 54.3208941618 (ExtendedPoll#45) + 3970 ( 2 0 4543.3646790771 2 5456.6352783273 ) 54.3208904201 (ExtendedPoll#45) + 3974 ( 2 0 4543.3645278465 2 5456.6354626442 ) 54.3208897035 (ExtendedPoll#45) + 3983 ( 2 0 4543.3645352524 2 5456.6354634587 ) 54.3208896327 (ExtendedPoll#45) + 3987 ( 2 0 4543.3645324236 2 5456.6354658827 ) 54.3208896303 (ExtendedPoll#45) + 3988 ( 2 0 4543.3645239373 2 5456.6354731547 ) 54.3208896231 (ExtendedPoll#45) + 3989 ( 2 0 4543.3644899919 2 5456.6355022427 ) 54.3208895946 (ExtendedPoll#45) + 3990 ( 2 0 4543.3643542104 2 5456.6356185947 ) 54.3208894804 (ExtendedPoll#45) + 3991 ( 2 0 4543.3638110842 2 5456.6360840029 ) 54.3208890235 (ExtendedPoll#45) + 3992 ( 2 0 4543.3616385797 2 5456.6379456356 ) 54.3208871959 (ExtendedPoll#45) + 3993 ( 2 0 4543.3529485614 2 5456.6453921663 ) 54.3208798860 (ExtendedPoll#45) + 3994 ( 2 0 4543.3181884885 2 5456.6751782893 ) 54.3208506492 (ExtendedPoll#45) + 3995 ( 2 0 4543.1791481970 2 5456.7943227813 ) 54.3207337517 (ExtendedPoll#45) + 3996 ( 2 0 4542.6229870307 2 5457.2709007492 ) 54.3202669568 (ExtendedPoll#45) + 3997 ( 2 0 4540.3983423657 2 5459.1772126208 ) 54.3184125004 (ExtendedPoll#45) + 3998 ( 2 0 4531.4997637056 2 5466.8024601073 ) 54.3111985229 (ExtendedPoll#45) + 3999 ( 2 0 4495.9054490650 2 5497.3034500534 ) 54.2856217202 (ExtendedPoll#45) + 4000 ( 2 0 4353.5281905028 2 5619.3074098378 ) 54.2368825197 (ExtendedPoll#45) + 4002 ( 2 0 4353.5041867680 2 5619.3635257316 ) 54.2365196285 (ExtendedPoll#45) + 4003 ( 2 0 4353.4321755638 2 5619.5318734129 ) 54.2354310246 (ExtendedPoll#45) + 4004 ( 2 0 4353.1441307467 2 5620.2052641384 ) 54.2310776574 (ExtendedPoll#45) + 4005 ( 2 0 4351.9919514786 2 5622.8988270401 ) 54.2136809672 (ExtendedPoll#45) + 4006 ( 2 0 4347.3832344061 2 5633.6730786469 ) 54.1443630877 (ExtendedPoll#45) + 4007 ( 2 0 4346.4159412060 2 5635.3688272200 ) 54.1355996268 (ExtendedPoll#45) + 4008 ( 2 0 4343.5140616057 2 5640.4560729390 ) 54.1093792188 (ExtendedPoll#45) + 4009 ( 2 0 4331.9065432045 2 5660.8050558153 ) 54.0055500944 (ExtendedPoll#45) + 4012 ( 2 0 4329.8320660769 2 5668.3386832786 ) 53.9480883416 (ExtendedPoll#45) + 4018 ( 2 0 4334.3358651038 2 5665.1314324564 ) 53.9408691910 (ExtendedPoll#45) + 4026 ( 2 0 4334.7698249059 2 5664.9075219934 ) 53.9393230537 (ExtendedPoll#45) + 4030 ( 2 0 4335.0132475664 2 5664.9262078546 ) 53.9370077879 (ExtendedPoll#45) + 4034 ( 2 0 4335.0593141454 2 5664.8861671994 ) 53.9370070214 (ExtendedPoll#45) + 4035 ( 2 0 4335.1975138822 2 5664.7660452336 ) 53.9370047791 (ExtendedPoll#45) + 4041 ( 2 0 4335.2265889224 2 5664.7567731080 ) 53.9368437214 (ExtendedPoll#45) + 4047 ( 2 0 4335.2341353579 2 5664.7556510827 ) 53.9367890253 (ExtendedPoll#45) + 4049 ( 2 0 4335.2400852963 2 5664.7508755444 ) 53.9367849554 (ExtendedPoll#45) + 4050 ( 2 0 4335.2579351117 2 5664.7365489296 ) 53.9367727467 (ExtendedPoll#45) + 4053 ( 2 0 4335.2420401136 2 5664.7511438225 ) 53.9367651768 (ExtendedPoll#45) + 4054 ( 2 0 4335.1943551193 2 5664.7949285015 ) 53.9367424744 (ExtendedPoll#45) + 4055 ( 2 0 4335.0036151422 2 5664.9700672173 ) 53.9366517744 (ExtendedPoll#45) + 4056 ( 2 0 4334.2406552335 2 5665.6706220803 ) 53.9362907282 (ExtendedPoll#45) + 4057 ( 2 0 4331.1888155990 2 5668.4728415326 ) 53.9348746183 (ExtendedPoll#45) + 4058 ( 2 0 4318.9814570610 2 5679.6817193417 ) 53.9296600779 (ExtendedPoll#45) + 4059 ( 2 0 4270.1520229090 2 5724.5172305782 ) 53.9160449943 (ExtendedPoll#45) + 4062 ( 2 0 4270.2287922106 2 5726.4688768232 ) 53.8962132135 (ExtendedPoll#45) + 4065 ( 2 0 4269.9967783213 2 5728.4085811769 ) 53.8792448146 (ExtendedPoll#45) + 4066 ( 2 0 4267.4719212911 2 5731.3906420478 ) 53.8723914551 (ExtendedPoll#45) + 4069 ( 2 0 4266.5745734546 2 5733.1256282638 ) 53.8633577202 (ExtendedPoll#45) + 4078 ( 2 0 4266.4308176062 2 5733.3229626873 ) 53.8627005560 (ExtendedPoll#45) + 4079 ( 2 0 4265.9995500609 2 5733.9149659579 ) 53.8607301402 (ExtendedPoll#45) + 4083 ( 2 0 4265.8268724443 2 5734.0875636064 ) 53.8605721022 (ExtendedPoll#45) + 4084 ( 2 0 4265.3088395946 2 5734.6053565521 ) 53.8600989724 (ExtendedPoll#45) + 4085 ( 2 0 4263.2367081957 2 5736.6765283347 ) 53.8582212182 (ExtendedPoll#45) + 4086 ( 2 0 4254.9481826001 2 5744.9612154653 ) 53.8509466860 (ExtendedPoll#45) + 4087 ( 2 0 4221.7940802176 2 5778.0999639874 ) 53.8256476388 (ExtendedPoll#45) + 4088 ( 2 0 4089.1776706878 2 5910.6549580759 ) 53.7861774796 (ExtendedPoll#45) + 4103 ( 2 0 4089.1136696138 2 5910.7589031772 ) 53.7858180957 (ExtendedPoll#45) + 4104 ( 2 0 4088.9216663918 2 5911.0707384809 ) 53.7847402348 (ExtendedPoll#45) + 4108 ( 2 0 4088.8359939837 2 5911.1576970414 ) 53.7847351920 (ExtendedPoll#45) + 4109 ( 2 0 4088.5789767594 2 5911.4185727227 ) 53.7847203220 (ExtendedPoll#45) + 4122 ( 2 0 4088.5833028094 2 5911.4153495129 ) 53.7847099233 (ExtendedPoll#45) + 4129 ( 2 0 4088.5841710836 2 5911.4149550584 ) 53.7847055346 (ExtendedPoll#45) + 4132 ( 2 0 4088.5850132823 2 5911.4145076255 ) 53.7847018687 (ExtendedPoll#45) + 4136 ( 2 0 4088.5854359861 2 5911.4142869556 ) 53.7846999932 (ExtendedPoll#45) + 4139 ( 2 0 4088.5850617172 2 5911.4148479102 ) 53.7846983212 (ExtendedPoll#45) + 4147 ( 2 0 4088.5850276880 2 5911.4148968462 ) 53.7846981880 (ExtendedPoll#45) + 4148 ( 2 0 4088.5849256003 2 5911.4150436540 ) 53.7846977884 (ExtendedPoll#45) + 4153 ( 2 0 4088.5849005844 2 5911.4150977550 ) 53.7846975253 (ExtendedPoll#45) + 4164 ( 2 0 4088.5849003997 2 5911.4150986678 ) 53.7846975187 (ExtendedPoll#45) + 4165 ( 2 0 4088.5848992968 2 5911.4151001689 ) 53.7846975151 (ExtendedPoll#45) + 4169 ( 2 0 4088.5848988407 2 5911.4151009808 ) 53.7846975119 (ExtendedPoll#45) + 4172 ( 2 0 4088.5848979979 2 5911.4151019930 ) 53.7846975104 (ExtendedPoll#45) + 4187 ( 2 0 4105.5097056568 2 5894.3640876566 ) 53.7853303801 (ExtendedPoll#46) + 4219 ( 2 0 4105.5249912111 2 5894.4490403525 ) 53.7844103322 (ExtendedPoll#46) + 4224 ( 2 0 4105.5402085635 2 5894.4501641740 ) 53.7842605703 (ExtendedPoll#46) + 4228 ( 2 0 4105.5590123984 2 5894.4395775740 ) 53.7841854603 (ExtendedPoll#46) + 4236 ( 2 0 4105.5607070024 2 5894.4387021916 ) 53.7841779690 (ExtendedPoll#46) + 4237 ( 2 0 4105.5636102425 2 5894.4362276993 ) 53.7841740843 (ExtendedPoll#46) + 4247 ( 2 0 4105.5638149153 2 5894.4361054192 ) 53.7841733315 (ExtendedPoll#46) + 4251 ( 2 0 4105.5638612668 2 5894.4360679458 ) 53.7841732508 (ExtendedPoll#46) + 4252 ( 2 0 4105.5640003213 2 5894.4359555257 ) 53.7841730088 (ExtendedPoll#46) + 4258 ( 2 0 4105.5640265310 2 5894.4359413401 ) 53.7841728988 (ExtendedPoll#46) + 4265 ( 2 0 4105.5640472452 2 5894.4359452146 ) 53.7841726734 (ExtendedPoll#46) + 4271 ( 2 0 4105.5640494603 2 5894.4359482098 ) 53.7841726256 (ExtendedPoll#46) + 4277 ( 2 0 4105.5640494863 2 5894.4359491407 ) 53.7841726169 (ExtendedPoll#46) + 4278 ( 2 0 4105.5640486402 2 5894.4359508001 ) 53.7841726094 (ExtendedPoll#46) + 4284 ( 2 0 4105.5640493116 2 5894.4359501547 ) 53.7841726092 (ExtendedPoll#46) + 4285 ( 2 0 4105.5640513257 2 5894.4359482183 ) 53.7841726085 (ExtendedPoll#46) + 4286 ( 2 0 4105.5640593820 2 5894.4359404726 ) 53.7841726058 (ExtendedPoll#46) + 4298 ( 2 0 4105.5640593940 2 5894.4359405296 ) 53.7841726051 (ExtendedPoll#46) + 4299 ( 2 0 4105.5640595037 2 5894.4359404905 ) 53.7841726045 (ExtendedPoll#46) + 4317 ( 2 0 4986.7257528443 2 5008.3439881737 ) 55.9026187973 (ExtendedPoll#47) + 4321 ( 2 0 4975.6982691662 2 5019.3714718518 ) 55.8540052955 (ExtendedPoll#47) + 4322 ( 2 0 4942.6158181319 2 5052.4539228861 ) 55.7112095080 (ExtendedPoll#47) + 4323 ( 2 0 4810.2860139947 2 5184.7837270233 ) 55.1870194047 (ExtendedPoll#47) + 4324 ( 2 0 4280.9667974460 2 5714.1029435721 ) 53.9228267897 (ExtendedPoll#47) + 4340 ( 2 0 4282.9099137686 2 5713.8982254345 ) 53.9076802800 (ExtendedPoll#47) + 4343 ( 2 0 4283.1982251457 2 5715.8293998657 ) 53.8861047342 (ExtendedPoll#47) + 4346 ( 2 0 4285.4740084419 2 5714.2633061132 ) 53.8814393469 (ExtendedPoll#47) + 4353 ( 2 0 4285.1205497824 2 5714.8564555920 ) 53.8787142179 (ExtendedPoll#47) + 4364 ( 2 0 4285.1005852658 2 5714.8795367790 ) 53.8786630424 (ExtendedPoll#47) + 4365 ( 2 0 4285.0406917160 2 5714.9487803400 ) 53.8785095322 (ExtendedPoll#47) + 4367 ( 2 0 4285.0005710927 2 5714.9947752809 ) 53.8784105470 (ExtendedPoll#47) + 4379 ( 2 0 4285.0007834768 2 5714.9966707681 ) 53.8783899929 (ExtendedPoll#47) + 4380 ( 2 0 4284.9983617564 2 5714.9996181702 ) 53.8783823323 (ExtendedPoll#47) + 4381 ( 2 0 4284.9910965952 2 5715.0084603766 ) 53.8783593509 (ExtendedPoll#47) + 4385 ( 2 0 4284.9884190656 2 5715.0111774997 ) 53.8783562185 (ExtendedPoll#47) + 4386 ( 2 0 4284.9803864769 2 5715.0193288691 ) 53.8783468217 (ExtendedPoll#47) + 4402 ( 2 0 4284.9804412318 2 5715.0194883169 ) 53.8783447670 (ExtendedPoll#47) + 4407 ( 2 0 4284.9804170022 2 5715.0195427745 ) 53.8783444443 (ExtendedPoll#47) + 4414 ( 2 0 4284.9804316104 2 5715.0195457146 ) 53.8783442863 (ExtendedPoll#47) + 4416 ( 2 0 4284.9804399767 2 5715.0195580455 ) 53.8783440910 (ExtendedPoll#47) + 4423 ( 2 0 4284.9804363154 2 5715.0195618337 ) 53.8783440860 (ExtendedPoll#47) + 4424 ( 2 0 4284.9804253315 2 5715.0195731983 ) 53.8783440710 (ExtendedPoll#47) + 4432 ( 2 0 4284.9804248959 2 5715.0195740214 ) 53.8783440667 (ExtendedPoll#47) + 4433 ( 2 0 4284.9804240703 2 5715.0195756911 ) 53.8783440575 (ExtendedPoll#47) + 4443 ( 2 0 4284.9804241092 2 5715.0195758008 ) 53.8783440561 (ExtendedPoll#47) + 4448 ( 2 0 4284.9804241503 2 5715.0195758421 ) 53.8783440553 (ExtendedPoll#47) + 4453 ( 3 0 3210.2718306224 2 3039.4036796793 1 3750.2294356176 ) 46.5957725777 + 4454 ( 3 0 3210.2204488871 2 3039.5770909239 1 3750.2008639259 ) 46.5947035783 + 4475 ( 2 0 4999.8234054990 2 5000.1686007961 ) 55.9010071498 (ExtendedPoll#48) + 4476 ( 2 0 4999.2960163907 2 5000.6767975791 ) 55.8988833670 (ExtendedPoll#48) + 4477 ( 2 0 4997.1864599572 2 5002.7095847109 ) 55.8903991267 (ExtendedPoll#48) + 4478 ( 2 0 4988.7482342235 2 5010.8407332383 ) 55.8566367335 (ExtendedPoll#48) + 4479 ( 2 0 4954.9953312886 2 5043.3653273476 ) 55.7244004145 (ExtendedPoll#48) + 4480 ( 2 0 4819.9837195490 2 5173.4637037851 ) 55.2417552587 (ExtendedPoll#48) + 4481 ( 2 0 4279.9372725906 2 5693.8572095350 ) 54.1320597545 (ExtendedPoll#48) + 4483 ( 2 0 4260.7210634090 2 5718.3142030389 ) 54.0605176484 (ExtendedPoll#48) + 4484 ( 2 0 4203.0724358640 2 5791.6851835507 ) 53.8630778677 (ExtendedPoll#48) + 4493 ( 2 0 4211.2611613676 2 5784.2607390941 ) 53.8607636217 (ExtendedPoll#48) + 4494 ( 2 0 4235.8273378782 2 5761.9874057245 ) 53.8557950144 (ExtendedPoll#48) + 4499 ( 2 0 4239.2666025897 2 5760.1381185483 ) 53.8430394257 (ExtendedPoll#48) + 4506 ( 2 0 4238.4020949545 2 5761.2154477473 ) 53.8403110732 (ExtendedPoll#48) + 4507 ( 2 0 4236.9895398051 2 5762.5631754865 ) 53.8398579750 (ExtendedPoll#48) + 4508 ( 2 0 4232.7518743570 2 5766.6063587038 ) 53.8385611120 (ExtendedPoll#48) + 4509 ( 2 0 4215.8012125647 2 5782.7790915733 ) 53.8343120215 (ExtendedPoll#48) + 4510 ( 2 0 4147.9985653954 2 5847.4700230513 ) 53.8324459450 (ExtendedPoll#48) + 4516 ( 2 0 4142.8942598315 2 5853.3659054138 ) 53.8237142063 (ExtendedPoll#48) + 4517 ( 2 0 4127.5813431399 2 5871.0535525015 ) 53.7986042338 (ExtendedPoll#48) + 4526 ( 2 0 4129.7411194915 2 5869.3305081768 ) 53.7948876409 (ExtendedPoll#48) + 4531 ( 2 0 4130.5591390496 2 5868.7973880268 ) 53.7923765042 (ExtendedPoll#48) + 4536 ( 2 0 4131.0192217390 2 5868.6337201408 ) 53.7897014772 (ExtendedPoll#48) + 4537 ( 2 0 4131.7293377788 2 5867.9632682402 ) 53.7894517155 (ExtendedPoll#48) + 4538 ( 2 0 4133.8596858981 2 5865.9519125383 ) 53.7887184190 (ExtendedPoll#48) + 4543 ( 2 0 4134.5843028059 2 5865.2972409942 ) 53.7882006022 (ExtendedPoll#48) + 4546 ( 2 0 4134.9640976007 2 5864.9903770359 ) 53.7875931645 (ExtendedPoll#48) + 4554 ( 2 0 4134.9859247059 2 5864.9690484814 ) 53.7875925935 (ExtendedPoll#48) + 4555 ( 2 0 4135.0514060213 2 5864.9050628179 ) 53.7875908962 (ExtendedPoll#48) + 4556 ( 2 0 4135.3133312830 2 5864.6491201639 ) 53.7875843437 (ExtendedPoll#48) + 4557 ( 2 0 4136.3610323297 2 5863.6253495479 ) 53.7875619231 (ExtendedPoll#48) + 4570 ( 2 0 4136.3648032632 2 5863.6247733590 ) 53.7875329472 (ExtendedPoll#48) + 4571 ( 2 0 4136.3761160637 2 5863.6230447924 ) 53.7874460195 (ExtendedPoll#48) + 4577 ( 2 0 4136.3737259452 2 5863.6260178809 ) 53.7874401351 (ExtendedPoll#48) + 4591 ( 2 0 4136.3738000302 2 5863.6261693177 ) 53.7874380524 (ExtendedPoll#48) + 4596 ( 2 0 4136.3737497999 2 5863.6262370108 ) 53.7874378803 (ExtendedPoll#48) + 4598 ( 2 0 4136.3737091508 2 5863.6262806039 ) 53.7874378451 (ExtendedPoll#48) + 4599 ( 2 0 4136.3735872034 2 5863.6264113833 ) 53.7874377393 (ExtendedPoll#48) + 4608 ( 2 0 4136.3735928884 2 5863.6264065675 ) 53.7874377323 (ExtendedPoll#48) + 4615 ( 2 0 4136.3735936795 2 5863.6264060760 ) 53.7874377297 (ExtendedPoll#48) + 4616 ( 2 0 4136.3735950382 2 5863.6264048019 ) 53.7874377291 (ExtendedPoll#48) + 4625 ( 2 0 4136.3735951385 2 5863.6264047429 ) 53.7874377288 (ExtendedPoll#48) + 4629 ( 2 0 4136.3735950627 2 5863.6264048312 ) 53.7874377287 (ExtendedPoll#48) + 4630 ( 2 0 4136.3735948352 2 5863.6264050962 ) 53.7874377283 (ExtendedPoll#48) + 4639 ( 2 0 4136.3735948402 2 5863.6264051370 ) 53.7874377278 (ExtendedPoll#48) + 4647 ( 2 0 4105.5720108686 2 5894.4263928684 ) 53.7841874022 (ExtendedPoll#49) + 4674 ( 2 0 4105.5833069765 2 5894.4161347829 ) 53.7841780742 (ExtendedPoll#49) + 4687 ( 2 0 4105.5835293721 2 5894.4160488549 ) 53.7841768253 (ExtendedPoll#49) + 4688 ( 2 0 4105.5841965588 2 5894.4157910708 ) 53.7841730784 (ExtendedPoll#49) + 4693 ( 2 0 4105.5842867579 2 5894.4157131287 ) 53.7841729675 (ExtendedPoll#49) + 4712 ( 2 0 4105.5842868659 2 5894.4157130854 ) 53.7841729669 (ExtendedPoll#49) + 4719 ( 2 0 4105.5842868950 2 5894.4157130859 ) 53.7841729666 (ExtendedPoll#49) + 4743 ( 2 0 4999.8031735893 2 5000.1447170134 ) 55.9014542318 (ExtendedPoll#50) + 4744 ( 2 0 4999.2150887519 2 5000.5812624482 ) 55.9006716187 (ExtendedPoll#50) + 4745 ( 2 0 4996.8627494022 2 5002.3274441874 ) 55.8975509135 (ExtendedPoll#50) + 4746 ( 2 0 4987.4533920033 2 5009.3121711443 ) 55.8852243268 (ExtendedPoll#50) + 4747 ( 2 0 4949.8159624076 2 5037.2510789717 ) 55.8384358459 (ExtendedPoll#50) + 4748 ( 2 0 4799.2662440251 2 5149.0067102812 ) 55.6927299999 (ExtendedPoll#50) + 4751 ( 2 0 4798.1744139579 2 5164.6198802413 ) 55.5187163710 (ExtendedPoll#50) + 4752 ( 2 0 4798.1744139579 2 5196.0645861749 ) 55.1525452486 (ExtendedPoll#50) + 4757 ( 2 0 4792.1420528370 2 5201.0324129804 ) 55.1431419649 (ExtendedPoll#50) + 4758 ( 2 0 4774.0449694742 2 5215.9358933968 ) 55.1157026271 (ExtendedPoll#50) + 4759 ( 2 0 4701.6566360229 2 5275.5498150626 ) 55.0176540485 (ExtendedPoll#50) + 4760 ( 2 0 4412.1033022177 2 5514.0055017256 ) 54.8221696457 (ExtendedPoll#50) + 4764 ( 2 0 4371.9239557470 2 5561.1725606260 ) 54.6749065998 (ExtendedPoll#50) + 4765 ( 2 0 4251.3859163349 2 5702.6737373272 ) 54.2973393293 (ExtendedPoll#50) + 4768 ( 2 0 4391.1401649287 2 5590.8703384522 ) 54.2022453171 (ExtendedPoll#50) + 4774 ( 2 0 4362.3158511562 2 5624.4987045201 ) 54.1076851285 (ExtendedPoll#50) + 4779 ( 2 0 4358.6036289279 2 5639.6751424533 ) 53.9858955384 (ExtendedPoll#50) + 4784 ( 2 0 4355.6625116846 2 5642.2409431111 ) 53.9855132092 (ExtendedPoll#50) + 4785 ( 2 0 4346.8391599545 2 5649.9383450844 ) 53.9845992440 (ExtendedPoll#50) + 4786 ( 2 0 4311.5457530343 2 5680.7279529777 ) 53.9844549147 (ExtendedPoll#50) + 4791 ( 2 0 4308.5432203496 2 5687.9340314208 ) 53.9390274262 (ExtendedPoll#50) + 4795 ( 2 0 4307.7243477993 2 5691.7554366558 ) 53.9082186256 (ExtendedPoll#50) + 4807 ( 2 0 4308.0052488063 2 5691.9562363603 ) 53.9037540967 (ExtendedPoll#50) + 4811 ( 2 0 4308.1049356103 2 5691.8857845325 ) 53.9035781830 (ExtendedPoll#50) + 4817 ( 2 0 4308.1185770304 2 5691.8789477872 ) 53.9035262437 (ExtendedPoll#50) + 4820 ( 2 0 4308.1246647783 2 5691.8743491833 ) 53.9035184462 (ExtendedPoll#50) + 4824 ( 2 0 4308.1208413138 2 5691.8781550898 ) 53.9035142224 (ExtendedPoll#50) + 4825 ( 2 0 4308.1093709201 2 5691.8895728093 ) 53.9035015515 (ExtendedPoll#50) + 4826 ( 2 0 4308.0634893453 2 5691.9352436871 ) 53.9034508749 (ExtendedPoll#50) + 4827 ( 2 0 4307.8799630460 2 5692.1179271984 ) 53.9032482824 (ExtendedPoll#50) + 4828 ( 2 0 4307.1458578490 2 5692.8486612434 ) 53.9024397326 (ExtendedPoll#50) + 4829 ( 2 0 4304.2094370610 2 5695.7715974237 ) 53.8992346674 (ExtendedPoll#50) + 4830 ( 2 0 4292.4637539088 2 5707.4633421446 ) 53.8868812553 (ExtendedPoll#50) + 4831 ( 2 0 4245.4810213003 2 5754.2303210285 ) 53.8449818536 (ExtendedPoll#50) + 4832 ( 2 0 4057.5500908662 2 5941.2982365638 ) 53.8003145611 (ExtendedPoll#50) + 4836 ( 2 0 4057.3125325273 2 5942.2454844463 ) 53.7939890318 (ExtendedPoll#50) + 4843 ( 2 0 4057.4393884670 2 5942.4540943610 ) 53.7909379794 (ExtendedPoll#50) + 4844 ( 2 0 4057.1333775009 2 5942.8346355240 ) 53.7903471560 (ExtendedPoll#50) + 4847 ( 2 0 4057.6371760427 2 5942.3623976952 ) 53.7899322822 (ExtendedPoll#50) + 4867 ( 2 0 4057.6378562203 2 5942.3617292243 ) 53.7899320010 (ExtendedPoll#50) + 4868 ( 2 0 4057.6398967532 2 5942.3597238116 ) 53.7899311575 (ExtendedPoll#50) + 4869 ( 2 0 4057.6480588849 2 5942.3517021609 ) 53.7899277838 (ExtendedPoll#50) + 4878 ( 2 0 4057.6479540349 2 5942.3519162868 ) 53.7899268277 (ExtendedPoll#50) + 4882 ( 2 0 4057.6478865326 2 5942.3520145431 ) 53.7899265685 (ExtendedPoll#50) + 4883 ( 2 0 4057.6476840256 2 5942.3523093118 ) 53.7899257907 (ExtendedPoll#50) + 4895 ( 2 0 4057.6476847788 2 5942.3523129602 ) 53.7899257509 (ExtendedPoll#50) + 4899 ( 2 0 4057.6476860982 2 5942.3523116454 ) 53.7899257506 (ExtendedPoll#50) + 4900 ( 2 0 4057.6476900565 2 5942.3523077012 ) 53.7899257494 (ExtendedPoll#50) + 4901 ( 2 0 4057.6477058896 2 5942.3522919242 ) 53.7899257448 (ExtendedPoll#50) + 4902 ( 2 0 4057.6477692222 2 5942.3522288165 ) 53.7899257264 (ExtendedPoll#50) + 4903 ( 2 0 4057.6480225525 2 5942.3519763854 ) 53.7899256529 (ExtendedPoll#50) + 4914 ( 2 0 4057.6480214853 2 5942.3519779120 ) 53.7899256490 (ExtendedPoll#50) + 4921 ( 2 0 4057.6480212763 2 5942.3519783281 ) 53.7899256472 (ExtendedPoll#50) + 4924 ( 2 0 4057.6480210350 2 5942.3519787264 ) 53.7899256458 (ExtendedPoll#50) + 4927 ( 2 0 4057.6480213991 2 5942.3519784360 ) 53.7899256451 (ExtendedPoll#50) + 4931 ( 2 0 4057.6480219221 2 5942.3519780358 ) 53.7899256438 (ExtendedPoll#50) + 4935 ( 2 0 4057.6480221025 2 5942.3519778887 ) 53.7899256435 (ExtendedPoll#50) + 4940 ( 2 0 4057.6480219897 2 5942.3519780086 ) 53.7899256435 (ExtendedPoll#50) + 4945 ( 2 0 4057.6480219698 2 5942.3519780298 ) 53.7899256435 (ExtendedPoll#50) + 4949 ( 3 0 3210.2137213322 2 3039.6012428177 1 3750.1834642275 ) 46.5946997610 + 4950 ( 3 0 3210.1935386677 2 3039.6736984988 1 3750.1312651323 ) 46.5946883143 + 4951 ( 3 0 3210.1128080096 2 3039.9635212235 1 3749.9224687515 ) 46.5946426050 + 4952 ( 3 0 3209.7898853771 2 3041.1228121224 1 3749.0872832281 ) 46.5944610083 + 4977 ( 2 0 4999.9515314082 2 5000.0370988583 ) 55.9016212277 (ExtendedPoll#51) + 4978 ( 2 0 4999.8061545413 2 5000.1484243416 ) 55.9013860644 (ExtendedPoll#51) + 4979 ( 2 0 4999.2246470737 2 5000.5937262748 ) 55.9004460290 (ExtendedPoll#51) + 4980 ( 2 0 4996.8986172034 2 5002.3749340079 ) 55.8966957757 (ExtendedPoll#51) + 4981 ( 2 0 4987.5944977221 2 5009.4997649402 ) 55.8818532664 (ExtendedPoll#51) + 4982 ( 2 0 4950.3780197968 2 5037.9990886692 ) 55.8250376177 (ExtendedPoll#51) + 4983 ( 2 0 4801.5121080959 2 5151.9963835853 ) 55.6398202521 (ExtendedPoll#51) + 4985 ( 2 0 4799.9016587469 2 5159.6391940553 ) 55.5631771412 (ExtendedPoll#51) + 4986 ( 2 0 4795.0703106998 2 5182.5676254652 ) 55.3341978198 (ExtendedPoll#51) + 4987 ( 2 0 4780.2214217867 2 5210.0817431571 ) 55.1338115001 (ExtendedPoll#51) + 4992 ( 2 0 4799.2192649549 2 5198.7267104589 ) 55.1133076930 (ExtendedPoll#51) + 5003 ( 2 0 4800.1328196439 2 5199.0717458199 ) 55.1020064789 (ExtendedPoll#51) + 5007 ( 2 0 4800.6067634573 2 5199.1893521250 ) 55.0968559487 (ExtendedPoll#51) + 5013 ( 2 0 4800.7025918042 2 5199.2649685543 ) 55.0952132428 (ExtendedPoll#51) + 5019 ( 2 0 4800.7285047755 2 5199.2488491668 ) 55.0951932210 (ExtendedPoll#51) + 5021 ( 2 0 4800.7568088740 2 5199.2374387295 ) 55.0950994742 (ExtendedPoll#51) + 5025 ( 2 0 4800.7456186612 2 5199.2478121856 ) 55.0950685340 (ExtendedPoll#51) + 5026 ( 2 0 4800.7120480229 2 5199.2789325537 ) 55.0949757164 (ExtendedPoll#51) + 5027 ( 2 0 4800.5777654696 2 5199.4034140262 ) 55.0946044924 (ExtendedPoll#51) + 5028 ( 2 0 4800.0406352565 2 5199.9013399163 ) 55.0931203333 (ExtendedPoll#51) + 5029 ( 2 0 4797.8921144041 2 5201.8930434766 ) 55.0871954955 (ExtendedPoll#51) + 5030 ( 2 0 4789.2980309945 2 5209.8598577177 ) 55.0636852238 (ExtendedPoll#51) + 5031 ( 2 0 4754.9216973563 2 5241.7271146822 ) 54.9726888507 (ExtendedPoll#51) + 5032 ( 2 0 4617.4163628032 2 5369.1961425400 ) 54.6586519092 (ExtendedPoll#51) + 5033 ( 2 0 4067.3950245908 2 5879.0722539713 ) 54.2760732951 (ExtendedPoll#51) + 5037 ( 2 0 4078.4498040205 2 5879.1268454747 ) 54.1738605186 (ExtendedPoll#51) + 5038 ( 2 0 4111.6141423099 2 5879.2906199847 ) 53.8682373433 (ExtendedPoll#51) + 5039 ( 2 0 4135.6344037869 2 5859.2009467494 ) 53.8353496249 (ExtendedPoll#51) + 5047 ( 2 0 4139.1419078776 2 5857.4881383315 ) 53.8193865804 (ExtendedPoll#51) + 5052 ( 2 0 4141.0884361692 2 5857.6587367795 ) 53.8000899204 (ExtendedPoll#51) + 5057 ( 2 0 4141.5688840483 2 5857.7459552361 ) 53.7949073397 (ExtendedPoll#51) + 5060 ( 2 0 4141.9346044712 2 5857.4223513050 ) 53.7945977867 (ExtendedPoll#51) + 5061 ( 2 0 4143.0317657398 2 5856.4515395119 ) 53.7936730233 (ExtendedPoll#51) + 5062 ( 2 0 4147.4204108144 2 5852.5682923396 ) 53.7900323766 (ExtendedPoll#51) + 5073 ( 2 0 4147.4162293615 2 5852.5829669923 ) 53.7899332894 (ExtendedPoll#51) + 5084 ( 2 0 4147.4160645968 2 5852.5834144589 ) 53.7899306065 (ExtendedPoll#51) + 5085 ( 2 0 4147.4153897141 2 5852.5840882751 ) 53.7899304432 (ExtendedPoll#51) + 5086 ( 2 0 4147.4133650660 2 5852.5861097238 ) 53.7899299534 (ExtendedPoll#51) + 5087 ( 2 0 4147.4052664734 2 5852.5941955188 ) 53.7899279944 (ExtendedPoll#51) + 5088 ( 2 0 4147.3728721030 2 5852.6265386988 ) 53.7899201620 (ExtendedPoll#51) + 5089 ( 2 0 4147.2432946213 2 5852.7559114185 ) 53.7898888919 (ExtendedPoll#51) + 5090 ( 2 0 4146.7249846949 2 5853.2734022975 ) 53.7897647629 (ExtendedPoll#51) + 5091 ( 2 0 4144.6517449892 2 5855.3433658132 ) 53.7892834747 (ExtendedPoll#51) + 5092 ( 2 0 4136.3587861663 2 5863.6232198764 ) 53.7876021773 (ExtendedPoll#51) + 5093 ( 2 0 4103.1869508749 2 5896.7426361291 ) 53.7847922558 (ExtendedPoll#51) + 5101 ( 2 0 4103.1682983337 2 5896.8007512235 ) 53.7844302124 (ExtendedPoll#51) + 5106 ( 2 0 4103.1669213843 2 5896.8312377825 ) 53.7841632090 (ExtendedPoll#51) + 5113 ( 2 0 4103.1650483182 2 5896.8345609654 ) 53.7841499007 (ExtendedPoll#51) + 5116 ( 2 0 4103.1624316887 2 5896.8373367825 ) 53.7841484300 (ExtendedPoll#51) + 5126 ( 2 0 4103.1626410673 2 5896.8372227473 ) 53.7841475564 (ExtendedPoll#51) + 5130 ( 2 0 4103.1625629696 2 5896.8373128117 ) 53.7841474463 (ExtendedPoll#51) + 5131 ( 2 0 4103.1623286764 2 5896.8375830050 ) 53.7841471160 (ExtendedPoll#51) + 5140 ( 2 0 4103.1623613751 2 5896.8376095974 ) 53.7841465724 (ExtendedPoll#51) + 5141 ( 2 0 4103.1623318769 2 5896.8376613910 ) 53.7841463677 (ExtendedPoll#51) + 5145 ( 2 0 4103.1623225735 2 5896.8376730311 ) 53.7841463463 (ExtendedPoll#51) + 5155 ( 2 0 4103.1623243672 2 5896.8376725291 ) 53.7841463344 (ExtendedPoll#51) + 5158 ( 2 0 4103.1623260046 2 5896.8376734171 ) 53.7841463113 (ExtendedPoll#51) + 5162 ( 2 0 4103.1623267413 2 5896.8376728473 ) 53.7841463097 (ExtendedPoll#51) + 5170 ( 2 0 4103.1623267301 2 5896.8376730798 ) 53.7841463077 (ExtendedPoll#51) + 5172 ( 2 0 4103.1623264493 2 5896.8376734513 ) 53.7841463069 (ExtendedPoll#51) + 5177 ( 2 0 4103.1623262249 2 5896.8376736923 ) 53.7841463067 (ExtendedPoll#51) + 5178 ( 2 0 4103.1623255517 2 5896.8376744152 ) 53.7841463063 (ExtendedPoll#51) + 5184 ( 2 0 4103.1623256446 2 5896.8376743450 ) 53.7841463061 (ExtendedPoll#51) + 5196 ( 2 0 4552.7863948639 2 5335.4101869888 ) 55.5680147602 (ExtendedPoll#52) + 5206 ( 2 0 4572.0026040455 2 5394.8057426411 ) 54.7532818545 (ExtendedPoll#52) + 5208 ( 2 0 4528.3294013600 2 5438.4789453267 ) 54.6428900648 (ExtendedPoll#52) + 5209 ( 2 0 4397.3097933033 2 5569.4985533833 ) 54.3697111024 (ExtendedPoll#52) + 5210 ( 2 0 3873.2313610768 2 6093.5769856098 ) 54.2139782157 (ExtendedPoll#52) + 5219 ( 2 0 3901.1822107956 2 6079.1648287236 ) 54.0675524851 (ExtendedPoll#52) + 5224 ( 2 0 3904.6760670104 2 6094.4504496635 ) 53.9053251878 (ExtendedPoll#52) + 5232 ( 2 0 3905.5158378706 2 6093.9518756993 ) 53.9014892203 (ExtendedPoll#52) + 5236 ( 2 0 3905.9712291027 2 6093.7758394257 ) 53.8986171016 (ExtendedPoll#52) + 5241 ( 2 0 3906.2152648514 2 6093.7828499557 ) 53.8962262883 (ExtendedPoll#52) + 5247 ( 2 0 3906.2570598051 2 6093.7383694092 ) 53.8962008251 (ExtendedPoll#52) + 5248 ( 2 0 3906.3824446664 2 6093.6049277697 ) 53.8961245036 (ExtendedPoll#52) + 5249 ( 2 0 3906.8839841115 2 6093.0711612115 ) 53.8958202370 (ExtendedPoll#52) + 5250 ( 2 0 3908.8901418918 2 6090.9360949789 ) 53.8946194836 (ExtendedPoll#52) + 5251 ( 2 0 3916.9147730132 2 6082.3958300485 ) 53.8900773214 (ExtendedPoll#52) + 5252 ( 2 0 3949.0132974987 2 6048.2347703268 ) 53.8760722747 (ExtendedPoll#52) + 5254 ( 2 0 3952.3160834518 2 6046.1534692613 ) 53.8626856098 (ExtendedPoll#52) + 5262 ( 2 0 3953.1776056142 2 6046.6132320786 ) 53.8505840740 (ExtendedPoll#52) + 5265 ( 2 0 3953.5789384631 2 6046.3350499844 ) 53.8491773294 (ExtendedPoll#52) + 5274 ( 2 0 3953.6091921986 2 6046.3390542165 ) 53.8488567166 (ExtendedPoll#52) + 5275 ( 2 0 3953.6616312293 2 6046.3078233717 ) 53.8486289876 (ExtendedPoll#52) + 5276 ( 2 0 3953.7497026781 2 6046.2232971719 ) 53.8485221437 (ExtendedPoll#52) + 5277 ( 2 0 3954.0139170244 2 6045.9697185726 ) 53.8482018728 (ExtendedPoll#52) + 5288 ( 2 0 3954.0185845590 2 6045.9794463233 ) 53.8480741214 (ExtendedPoll#52) + 5294 ( 2 0 3954.0184347508 2 6045.9813477797 ) 53.8480591976 (ExtendedPoll#52) + 5306 ( 2 0 3954.0185244766 2 6045.9812692933 ) 53.8480590234 (ExtendedPoll#52) + 5307 ( 2 0 3954.0187936542 2 6045.9810338338 ) 53.8480585006 (ExtendedPoll#52) + 5308 ( 2 0 3954.0198703645 2 6045.9800919962 ) 53.8480564096 (ExtendedPoll#52) + 5313 ( 2 0 3954.0199556739 2 6045.9800087306 ) 53.8480563182 (ExtendedPoll#52) + 5314 ( 2 0 3954.0202116021 2 6045.9797589338 ) 53.8480560440 (ExtendedPoll#52) + 5315 ( 2 0 3954.0212353150 2 6045.9787597466 ) 53.8480549472 (ExtendedPoll#52) + 5325 ( 2 0 3954.0212561678 2 6045.9787384550 ) 53.8480549329 (ExtendedPoll#52) + 5326 ( 2 0 3954.0213187265 2 6045.9786745799 ) 53.8480548901 (ExtendedPoll#52) + 5327 ( 2 0 3954.0215689610 2 6045.9784190796 ) 53.8480547188 (ExtendedPoll#52) + 5328 ( 2 0 3954.0225698990 2 6045.9773970786 ) 53.8480540335 (ExtendedPoll#52) + 5329 ( 2 0 3954.0265736512 2 6045.9733090745 ) 53.8480512924 (ExtendedPoll#52) + 5330 ( 2 0 3954.0425886598 2 6045.9569570580 ) 53.8480403289 (ExtendedPoll#52) + 5331 ( 2 0 3954.1066486941 2 6045.8915489921 ) 53.8479964904 (ExtendedPoll#52) + 5332 ( 2 0 3954.3628888317 2 6045.6299167285 ) 53.8478213863 (ExtendedPoll#52) + 5333 ( 2 0 3955.3878493820 2 6044.5833876740 ) 53.8471249631 (ExtendedPoll#52) + 5334 ( 2 0 3959.4876915833 2 6040.3972714563 ) 53.8444031448 (ExtendedPoll#52) + 5335 ( 2 0 3975.8870603884 2 6023.6528065852 ) 53.8345365224 (ExtendedPoll#52) + 5336 ( 2 0 4041.4845356089 2 5956.6749471009 ) 53.8113115046 (ExtendedPoll#52) + 5339 ( 2 0 4041.6035546824 2 5956.7020629246 ) 53.8099638531 (ExtendedPoll#52) + 5340 ( 2 0 4041.9606119028 2 5956.7834103954 ) 53.8059210158 (ExtendedPoll#52) + 5341 ( 2 0 4042.3009558066 2 5957.1335637099 ) 53.7996303534 (ExtendedPoll#52) + 5342 ( 2 0 4043.0741932721 2 5956.5373221342 ) 53.7977822528 (ExtendedPoll#52) + 5345 ( 2 0 4043.9165231091 2 5956.0430131312 ) 53.7943836123 (ExtendedPoll#52) + 5347 ( 2 0 4044.5989169010 2 5955.3444124866 ) 53.7942993075 (ExtendedPoll#52) + 5348 ( 2 0 4046.6460982769 2 5953.2486105531 ) 53.7940631506 (ExtendedPoll#52) + 5349 ( 2 0 4054.8348237804 2 5944.8654028188 ) 53.7933696899 (ExtendedPoll#52) + 5360 ( 2 0 4055.0724354313 2 5944.9214870586 ) 53.7906651766 (ExtendedPoll#52) + 5370 ( 2 0 4055.0761548684 2 5944.9206398974 ) 53.7906383460 (ExtendedPoll#52) + 5374 ( 2 0 4055.0778890903 2 5944.9198458871 ) 53.7906294220 (ExtendedPoll#52) + 5375 ( 2 0 4055.0811305415 2 5944.9178346926 ) 53.7906174793 (ExtendedPoll#52) + 5378 ( 2 0 4055.0777945058 2 5944.9220743514 ) 53.7906102701 (ExtendedPoll#52) + 5392 ( 2 0 4055.0778330577 2 5944.9221198097 ) 53.7906095046 (ExtendedPoll#52) + 5393 ( 2 0 4055.0777705351 2 5944.9222213074 ) 53.7906091714 (ExtendedPoll#52) + 5395 ( 2 0 4055.0780084500 2 5944.9219823862 ) 53.7906091154 (ExtendedPoll#52) + 5396 ( 2 0 4055.0787221949 2 5944.9212656228 ) 53.7906089474 (ExtendedPoll#52) + 5397 ( 2 0 4055.0815771745 2 5944.9183985692 ) 53.7906082755 (ExtendedPoll#52) + 5398 ( 2 0 4055.0929970928 2 5944.9069303548 ) 53.7906055884 (ExtendedPoll#52) + 5399 ( 2 0 4055.1386767659 2 5944.8610574972 ) 53.7905948477 (ExtendedPoll#52) + 5400 ( 2 0 4055.3213954584 2 5944.6775660669 ) 53.7905520064 (ExtendedPoll#52) + 5401 ( 2 0 4056.0522702285 2 5943.9436003453 ) 53.7903825885 (ExtendedPoll#52) + 5402 ( 2 0 4058.9757693086 2 5941.0077374592 ) 53.7897360619 (ExtendedPoll#52) + 5403 ( 2 0 4070.6697656292 2 5929.2642859147 ) 53.7876477253 (ExtendedPoll#52) + 5404 ( 2 0 4117.4457509116 2 5882.2904797367 ) 53.7872228417 (ExtendedPoll#52) + 5407 ( 2 0 4117.6891202600 2 5882.3097520301 ) 53.7848204977 (ExtendedPoll#52) + 5422 ( 2 0 4117.6899942270 2 5882.3093703541 ) 53.7848160313 (ExtendedPoll#52) + 5423 ( 2 0 4117.6915671836 2 5882.3082915651 ) 53.7848116087 (ExtendedPoll#52) + 5429 ( 2 0 4117.6919572521 2 5882.3080173020 ) 53.7848105741 (ExtendedPoll#52) + 5436 ( 2 0 4117.6920091373 2 5882.3079879653 ) 53.7848103706 (ExtendedPoll#52) + 5439 ( 2 0 4117.6920521121 2 5882.3079466630 ) 53.7848103589 (ExtendedPoll#52) + 5447 ( 2 0 4117.6920497867 2 5882.3079495734 ) 53.7848103533 (ExtendedPoll#52) + 5457 ( 2 0 4117.6920499996 2 5882.3079496675 ) 53.7848103505 (ExtendedPoll#52) + 5460 ( 2 0 4117.6920502143 2 5882.3079495774 ) 53.7848103493 (ExtendedPoll#52) + 5463 ( 2 0 4117.6920504410 2 5882.3079495242 ) 53.7848103478 (ExtendedPoll#52) + 5469 ( 2 0 4117.6920503703 2 5882.3079496167 ) 53.7848103475 (ExtendedPoll#52) + 5480 ( 2 0 4909.1597287779 2 5083.8525395201 ) 55.5960691542 (ExtendedPoll#53) + 5481 ( 2 0 4636.6389440201 2 5335.4101869888 ) 54.8753885588 (ExtendedPoll#53) + 5490 ( 2 0 4690.7937153502 2 5303.9654810552 ) 54.7846942177 (ExtendedPoll#53) + 5492 ( 2 0 4565.0148916158 2 5429.7443047896 ) 54.4304906658 (ExtendedPoll#53) + 5493 ( 2 0 4187.6784204127 2 5807.0807759926 ) 53.8546415124 (ExtendedPoll#53) + 5505 ( 2 0 4195.7852586612 2 5799.5744442811 ) 53.8531825911 (ExtendedPoll#53) + 5506 ( 2 0 4220.1057734067 2 5777.0554491463 ) 53.8508015438 (ExtendedPoll#53) + 5508 ( 2 0 4231.5699891117 2 5766.4646974951 ) 53.8504789320 (ExtendedPoll#53) + 5511 ( 2 0 4237.6296459843 2 5761.5514621930 ) 53.8439440609 (ExtendedPoll#53) + 5518 ( 2 0 4239.1257943732 2 5760.2958576158 ) 53.8427664280 (ExtendedPoll#53) + 5523 ( 2 0 4239.9101207378 2 5759.7136904120 ) 53.8414160967 (ExtendedPoll#53) + 5527 ( 2 0 4239.7094543134 2 5760.1588457372 ) 53.8388916705 (ExtendedPoll#53) + 5531 ( 2 0 4239.2194102715 2 5760.6452645620 ) 53.8385475799 (ExtendedPoll#53) + 5532 ( 2 0 4237.7492781460 2 5762.1045210365 ) 53.8375232191 (ExtendedPoll#53) + 5533 ( 2 0 4231.8687496437 2 5767.9415469345 ) 53.8335445270 (ExtendedPoll#53) + 5534 ( 2 0 4208.3466356348 2 5791.2896505265 ) 53.8195350703 (ExtendedPoll#53) + 5535 ( 2 0 4114.2581795991 2 5884.6820648944 ) 53.7943112519 (ExtendedPoll#53) + 5548 ( 2 0 4114.9485701934 2 5884.6988048671 ) 53.7878427663 (ExtendedPoll#53) + 5551 ( 2 0 4115.3912731659 2 5884.4929138652 ) 53.7856923145 (ExtendedPoll#53) + 5557 ( 2 0 4115.5104388474 2 5884.4664511137 ) 53.7848465681 (ExtendedPoll#53) + 5563 ( 2 0 4115.5040354705 2 5884.4803013045 ) 53.7847774342 (ExtendedPoll#53) + 5569 ( 2 0 4115.5085943246 2 5884.4864188582 ) 53.7846793465 (ExtendedPoll#53) + 5571 ( 2 0 4115.5038751700 2 5884.4924136225 ) 53.7846672332 (ExtendedPoll#53) + 5576 ( 2 0 4115.5033916134 2 5884.4961975456 ) 53.7846367702 (ExtendedPoll#53) + 5585 ( 2 0 4115.5032700638 2 5884.4964026531 ) 53.7846359908 (ExtendedPoll#53) + 5586 ( 2 0 4115.5029054151 2 5884.4970179759 ) 53.7846336525 (ExtendedPoll#53) + 5594 ( 2 0 4115.5029626983 2 5884.4970015034 ) 53.7846332805 (ExtendedPoll#53) + 5598 ( 2 0 4115.5030374021 2 5884.4969624551 ) 53.7846329574 (ExtendedPoll#53) + 5619 ( 2 0 4115.5030374174 2 5884.4969625705 ) 53.7846329562 (ExtendedPoll#53) + 5637 ( 2 0 4975.5429968599 2 5019.6529315723 ) 55.8517940762 (ExtendedPoll#54) + 5638 ( 2 0 4902.1720163482 2 5078.6117551978 ) 55.7134020563 (ExtendedPoll#54) + 5639 ( 2 0 4608.6880943013 2 5314.4470496997 ) 55.3395226272 (ExtendedPoll#54) + 5643 ( 2 0 4552.7863948639 2 5426.2504485747 ) 54.5705629398 (ExtendedPoll#54) + 5648 ( 2 0 4591.6555452540 2 5405.2873112856 ) 54.4751741266 (ExtendedPoll#54) + 5661 ( 2 0 4592.5840273072 2 5406.3096224852 ) 54.4562806449 (ExtendedPoll#54) + 5665 ( 2 0 4592.3579843636 2 5406.7424094230 ) 54.4534252540 (ExtendedPoll#54) + 5666 ( 2 0 4591.6798555328 2 5408.0407702362 ) 54.4448631609 (ExtendedPoll#54) + 5672 ( 2 0 4591.6012203107 2 5408.2719044772 ) 54.4429899385 (ExtendedPoll#54) + 5676 ( 2 0 4591.5696196138 2 5408.3898106624 ) 54.4419637140 (ExtendedPoll#54) + 5680 ( 2 0 4591.5680918914 2 5408.4202901410 ) 54.4416432602 (ExtendedPoll#54) + 5686 ( 2 0 4591.5700204171 2 5408.4276717726 ) 54.4415465559 (ExtendedPoll#54) + 5688 ( 2 0 4591.5654575021 2 5408.4337863066 ) 54.4415176321 (ExtendedPoll#54) + 5695 ( 2 0 4591.5646332830 2 5408.4348538518 ) 54.4415128113 (ExtendedPoll#54) + 5699 ( 2 0 4591.5645519834 2 5408.4353237071 ) 54.4415083512 (ExtendedPoll#54) + 5707 ( 2 0 4591.5646115597 2 5408.4353255431 ) 54.4415078361 (ExtendedPoll#54) + 5712 ( 2 0 4591.5645990175 2 5408.4353525777 ) 54.4415076449 (ExtendedPoll#54) + 5713 ( 2 0 4591.5645613907 2 5408.4354336816 ) 54.4415070710 (ExtendedPoll#54) + 5722 ( 2 0 4591.5645699689 2 5408.4354275629 ) 54.4415070666 (ExtendedPoll#54) + 5729 ( 2 0 4591.5645717027 2 5408.4354268822 ) 54.4415070596 (ExtendedPoll#54) + 5731 ( 2 0 4591.5645704450 2 5408.4354282562 ) 54.4415070551 (ExtendedPoll#54) + 5732 ( 2 0 4591.5645666721 2 5408.4354323781 ) 54.4415070414 (ExtendedPoll#54) + 5737 ( 2 0 4591.5645657541 2 5408.4354339988 ) 54.4415070313 (ExtendedPoll#54) + 5747 ( 2 0 4591.5645658577 2 5408.4354341268 ) 54.4415070290 (ExtendedPoll#54) + 5771 ( 2 0 4999.4391479660 2 5000.4028159491 ) 55.9011173930 (ExtendedPoll#55) + 5772 ( 2 0 4997.7566207727 2 5001.6112927051 ) 55.8993758016 (ExtendedPoll#55) + 5773 ( 2 0 4991.0265119995 2 5006.4451997289 ) 55.8924862980 (ExtendedPoll#55) + 5774 ( 2 0 4964.1060769066 2 5025.7808278241 ) 55.8661643975 (ExtendedPoll#55) + 5775 ( 2 0 4856.4243365351 2 5103.1233402051 ) 55.7810605478 (ExtendedPoll#55) + 5778 ( 2 0 4863.9579639983 2 5116.7712160443 ) 55.5599122421 (ExtendedPoll#55) + 5779 ( 2 0 4848.2356110316 2 5143.8486017093 ) 55.3646109717 (ExtendedPoll#55) + 5785 ( 2 0 4842.8037564475 2 5149.4715265551 ) 55.3415309539 (ExtendedPoll#55) + 5786 ( 2 0 4826.5081926955 2 5166.3403010924 ) 55.2731138922 (ExtendedPoll#55) + 5787 ( 2 0 4761.3259376873 2 5233.8153992415 ) 55.0119577195 (ExtendedPoll#55) + 5790 ( 2 0 4739.4893363446 2 5256.0887326112 ) 54.9328003343 (ExtendedPoll#55) + 5791 ( 2 0 4673.9795323162 2 5322.9087327200 ) 54.7090508194 (ExtendedPoll#55) + 5793 ( 2 0 4628.5594015233 2 5364.8350072982 ) 54.6149385255 (ExtendedPoll#55) + 5794 ( 2 0 4492.2990091444 2 5490.6138310325 ) 54.3872651867 (ExtendedPoll#55) + 5795 ( 2 0 3947.2574396288 2 5993.7291259700 ) 54.3655883138 (ExtendedPoll#55) + 5803 ( 2 0 3928.0412304472 2 6053.1246816223 ) 54.0330892795 (ExtendedPoll#55) + 5812 ( 2 0 3929.8700458096 2 6060.7129005889 ) 53.9508748031 (ExtendedPoll#55) + 5814 ( 2 0 3925.2024722726 2 6066.9909234750 ) 53.9417691814 (ExtendedPoll#55) + 5815 ( 2 0 3911.1997516616 2 6085.8249921331 ) 53.9156381344 (ExtendedPoll#55) + 5820 ( 2 0 3919.7706176886 2 6078.8372797034 ) 53.8929555395 (ExtendedPoll#55) + 5828 ( 2 0 3920.5459876347 2 6078.2435971044 ) 53.8905945920 (ExtendedPoll#55) + 5829 ( 2 0 3922.8720974731 2 6076.4625493074 ) 53.8835272419 (ExtendedPoll#55) + 5835 ( 2 0 3922.0826531550 2 6077.5957494982 ) 53.8814445368 (ExtendedPoll#55) + 5841 ( 2 0 3922.3040046412 2 6077.4927773412 ) 53.8802087502 (ExtendedPoll#55) + 5844 ( 2 0 3922.2317402049 2 6077.7259640948 ) 53.8789219399 (ExtendedPoll#55) + 5854 ( 2 0 3922.2265169811 2 6077.7403010701 ) 53.8788502601 (ExtendedPoll#55) + 5855 ( 2 0 3922.2108473095 2 6077.7833119959 ) 53.8786352255 (ExtendedPoll#55) + 5861 ( 2 0 3922.2085611664 2 6077.7905908301 ) 53.8785953531 (ExtendedPoll#55) + 5867 ( 2 0 3922.2107347292 2 6077.7889934610 ) 53.8785881820 (ExtendedPoll#55) + 5876 ( 2 0 3922.2108535295 2 6077.7889835942 ) 53.8785871342 (ExtendedPoll#55) + 5877 ( 2 0 3922.2110146221 2 6077.7888078314 ) 53.8785870886 (ExtendedPoll#55) + 5878 ( 2 0 3922.2114979001 2 6077.7882805429 ) 53.8785869518 (ExtendedPoll#55) + 5879 ( 2 0 3922.2134310120 2 6077.7861713891 ) 53.8785864048 (ExtendedPoll#55) + 5880 ( 2 0 3922.2211634595 2 6077.7777347737 ) 53.8785842169 (ExtendedPoll#55) + 5881 ( 2 0 3922.2520932495 2 6077.7439883121 ) 53.8785754693 (ExtendedPoll#55) + 5882 ( 2 0 3922.3758124097 2 6077.6090024659 ) 53.8785405430 (ExtendedPoll#55) + 5883 ( 2 0 3922.8706890504 2 6077.0690590808 ) 53.8784018624 (ExtendedPoll#55) + 5884 ( 2 0 3924.8501956130 2 6074.9092855406 ) 53.8778635334 (ExtendedPoll#55) + 5885 ( 2 0 3932.7682218633 2 6066.2701913799 ) 53.8759723517 (ExtendedPoll#55) + 5886 ( 2 0 3964.4403268649 2 6031.7138147370 ) 53.8725913899 (ExtendedPoll#55) + 5888 ( 2 0 3964.6765257473 2 6031.6520794236 ) 53.8708963698 (ExtendedPoll#55) + 5889 ( 2 0 3965.3851223947 2 6031.4668734835 ) 53.8658119765 (ExtendedPoll#55) + 5890 ( 2 0 3968.2195089840 2 6030.7260497231 ) 53.8454844045 (ExtendedPoll#55) + 5892 ( 2 0 3966.5220544265 2 6032.9062978884 ) 53.8426385768 (ExtendedPoll#55) + 5893 ( 2 0 3964.0381410238 2 6035.9224784489 ) 53.8400218659 (ExtendedPoll#55) + 5908 ( 2 0 3964.1134625710 2 6035.8803219730 ) 53.8396748316 (ExtendedPoll#55) + 5911 ( 2 0 3964.1376216602 2 6035.8616765123 ) 53.8396077632 (ExtendedPoll#55) + 5920 ( 2 0 3964.1391333458 2 6035.8605134178 ) 53.8396035356 (ExtendedPoll#55) + 5925 ( 2 0 3964.1395137360 2 6035.8602258817 ) 53.8396024275 (ExtendedPoll#55) + 5929 ( 2 0 3964.1397422881 2 6035.8601580043 ) 53.8396008562 (ExtendedPoll#55) + 5930 ( 2 0 3964.1401032802 2 6035.8598464624 ) 53.8396001384 (ExtendedPoll#55) + 5938 ( 2 0 3964.1401437730 2 6035.8598027239 ) 53.8396001338 (ExtendedPoll#55) + 5939 ( 2 0 3964.1402652513 2 6035.8596715087 ) 53.8396001200 (ExtendedPoll#55) + 5940 ( 2 0 3964.1407511646 2 6035.8591466477 ) 53.8396000647 (ExtendedPoll#55) + 5941 ( 2 0 3964.1426948176 2 6035.8570472037 ) 53.8395998438 (ExtendedPoll#55) + 5942 ( 2 0 3964.1504694296 2 6035.8486494278 ) 53.8395989603 (ExtendedPoll#55) + 5943 ( 2 0 3964.1815678778 2 6035.8150583240 ) 53.8395954303 (ExtendedPoll#55) + 5944 ( 2 0 3964.3059616705 2 6035.6806939089 ) 53.8395813737 (ExtendedPoll#55) + 5945 ( 2 0 3964.8035368415 2 6035.1432362487 ) 53.8395261614 (ExtendedPoll#55) + 5946 ( 2 0 3966.7938375252 2 6032.9934056075 ) 53.8393215384 (ExtendedPoll#55) + 5947 ( 2 0 3974.7550402603 2 6024.3940830430 ) 53.8387624914 (ExtendedPoll#55) + 5949 ( 2 0 3974.8020931115 2 6024.3552069220 ) 53.8386567319 (ExtendedPoll#55) + 5950 ( 2 0 3974.9432516652 2 6024.2385785592 ) 53.8383395150 (ExtendedPoll#55) + 5951 ( 2 0 3975.5078858801 2 6023.7720651080 ) 53.8370715717 (ExtendedPoll#55) + 5952 ( 2 0 3977.7664227394 2 6021.9060113031 ) 53.8320145804 (ExtendedPoll#55) + 5955 ( 2 0 3978.1694615728 2 6021.6302815615 ) 53.8306170085 (ExtendedPoll#55) + 5960 ( 2 0 3978.2884006782 2 6021.6028192098 ) 53.8297362750 (ExtendedPoll#55) + 5965 ( 2 0 3978.3433620337 2 6021.5762764903 ) 53.8294496693 (ExtendedPoll#55) + 5968 ( 2 0 3978.4034030246 2 6021.5653058772 ) 53.8289799544 (ExtendedPoll#55) + 5972 ( 2 0 3978.4320361581 2 6021.5547475992 ) 53.8288022372 (ExtendedPoll#55) + 5973 ( 2 0 3978.4762518106 2 6021.5126727574 ) 53.8287517449 (ExtendedPoll#55) + 5974 ( 2 0 3978.6088987679 2 6021.3864482319 ) 53.8286003328 (ExtendedPoll#55) + 5978 ( 2 0 3978.6514101019 2 6021.3426524116 ) 53.8285808779 (ExtendedPoll#55) + 5979 ( 2 0 3978.7789441037 2 6021.2112649506 ) 53.8285225798 (ExtendedPoll#55) + 5980 ( 2 0 3979.2890801112 2 6020.6857151068 ) 53.8282903842 (ExtendedPoll#55) + 5981 ( 2 0 3981.3296241412 2 6018.5835157314 ) 53.8273775476 (ExtendedPoll#55) + 5982 ( 2 0 3989.4918002613 2 6010.1747182300 ) 53.8239811631 (ExtendedPoll#55) + 5983 ( 2 0 4022.1405047416 2 5976.5395282242 ) 53.8144637068 (ExtendedPoll#55) + 5988 ( 2 0 4020.7893650335 2 5978.9483783098 ) 53.8057221545 (ExtendedPoll#55) + 5993 ( 2 0 4021.8359865119 2 5978.0476185044 ) 53.8039392071 (ExtendedPoll#55) + 6002 ( 2 0 4021.8964440029 2 5978.0392385221 ) 53.8034496620 (ExtendedPoll#55) + 6005 ( 2 0 4021.9498759700 2 5978.0097369858 ) 53.8032127550 (ExtendedPoll#55) + 6009 ( 2 0 4021.9714769156 2 5977.9881793562 ) 53.8032023063 (ExtendedPoll#55) + 6010 ( 2 0 4022.0362797523 2 5977.9235064675 ) 53.8031709766 (ExtendedPoll#55) + 6011 ( 2 0 4022.2954910992 2 5977.6648149127 ) 53.8030459025 (ExtendedPoll#55) + 6012 ( 2 0 4023.3323364869 2 5976.6300486937 ) 53.8025495188 (ExtendedPoll#55) + 6013 ( 2 0 4027.4797180376 2 5972.4909838173 ) 53.8006265679 (ExtendedPoll#55) + 6026 ( 2 0 4027.4926149637 2 5972.4991384731 ) 53.8004340240 (ExtendedPoll#55) + 6028 ( 2 0 4027.4867594927 2 5972.5132290886 ) 53.8003634319 (ExtendedPoll#55) + 6045 ( 2 0 4027.4868017206 2 5972.5131870229 ) 53.8003634121 (ExtendedPoll#55) + 6046 ( 2 0 4027.4869284044 2 5972.5130608261 ) 53.8003633529 (ExtendedPoll#55) + 6047 ( 2 0 4027.4874351394 2 5972.5125560387 ) 53.8003631157 (ExtendedPoll#55) + 6048 ( 2 0 4027.4894620797 2 5972.5105368890 ) 53.8003621672 (ExtendedPoll#55) + 6063 ( 2 0 4027.4894630105 2 5972.5105368589 ) 53.8003621588 (ExtendedPoll#55) + 6069 ( 2 0 4027.4894632002 2 5972.5105367239 ) 53.8003621582 (ExtendedPoll#55) + 6074 ( 2 0 4027.4894631259 2 5972.5105368136 ) 53.8003621581 (ExtendedPoll#55) + 6075 ( 2 0 4027.4894629032 2 5972.5105370826 ) 53.8003621578 (ExtendedPoll#55) + 6083 ( 2 0 4027.4894628766 2 5972.5105371140 ) 53.8003621577 (ExtendedPoll#55) + 6090 ( 2 0 4748.4423428951 2 5251.5576378325 ) 54.9123291399 (ExtendedPoll#56) + 6091 ( 2 0 3993.7694004889 2 6006.2305802387 ) 53.8183151870 (ExtendedPoll#56) + 6130 ( 2 0 3993.7694619626 2 6006.2305225636 ) 53.8183151149 (ExtendedPoll#56) + 6131 ( 2 0 3993.7696463836 2 6006.2303495384 ) 53.8183148988 (ExtendedPoll#56) + 6142 ( 2 0 3993.7696499094 2 6006.2303483359 ) 53.8183148762 (ExtendedPoll#56) + 6150 ( 2 0 3993.7696494122 2 6006.2303491234 ) 53.8183148740 (ExtendedPoll#56) + 6151 ( 2 0 3993.7696479206 2 6006.2303514859 ) 53.8183148673 (ExtendedPoll#56) + 6156 ( 2 0 3993.7696473156 2 6006.2303521939 ) 53.8183148668 (ExtendedPoll#56) + 6157 ( 2 0 3993.7696455004 2 6006.2303543179 ) 53.8183148653 (ExtendedPoll#56) + 6166 ( 2 0 3993.7696457355 2 6006.2303540873 ) 53.8183148651 (ExtendedPoll#56) + 6167 ( 2 0 3993.7696464408 2 6006.2303533957 ) 53.8183148645 (ExtendedPoll#56) + 6168 ( 2 0 3993.7696492618 2 6006.2303506290 ) 53.8183148623 (ExtendedPoll#56) + 6171 ( 2 0 3993.7696499024 2 6006.2303499530 ) 53.8183148622 (ExtendedPoll#56) + 6172 ( 2 0 3993.7696518242 2 6006.2303479249 ) 53.8183148619 (ExtendedPoll#56) + 6173 ( 2 0 3993.7696595112 2 6006.2303398127 ) 53.8183148607 (ExtendedPoll#56) + 6174 ( 2 0 3993.7696902595 2 6006.2303073636 ) 53.8183148562 (ExtendedPoll#56) + 6175 ( 2 0 3993.7698132527 2 6006.2301775672 ) 53.8183148381 (ExtendedPoll#56) + 6176 ( 2 0 3993.7703052255 2 6006.2296583817 ) 53.8183147657 (ExtendedPoll#56) + 6177 ( 2 0 3993.7722731166 2 6006.2275816398 ) 53.8183144759 (ExtendedPoll#56) + 6178 ( 2 0 3993.7801446810 2 6006.2192746722 ) 53.8183133172 (ExtendedPoll#56) + 6179 ( 2 0 3993.8116309384 2 6006.1860468016 ) 53.8183086862 (ExtendedPoll#56) + 6180 ( 2 0 3993.9375759683 2 6006.0531353193 ) 53.8182902249 (ExtendedPoll#56) + 6181 ( 2 0 3994.4413560878 2 6005.5214893902 ) 53.8182173813 (ExtendedPoll#56) + 6182 ( 2 0 3996.4564765659 2 6003.3949056739 ) 53.8179420284 (ExtendedPoll#56) + 6183 ( 2 0 4004.5169584783 2 5994.8885708083 ) 53.8170967872 (ExtendedPoll#56) + 6185 ( 2 0 4004.5245453924 2 5994.8877669371 ) 53.8170328494 (ExtendedPoll#56) + 6186 ( 2 0 4004.5473061346 2 5994.8853553233 ) 53.8168410364 (ExtendedPoll#56) + 6187 ( 2 0 4004.6383491034 2 5994.8757088682 ) 53.8160737928 (ExtendedPoll#56) + 6188 ( 2 0 4005.0025209789 2 5994.8371230479 ) 53.8130049524 (ExtendedPoll#56) + 6191 ( 2 0 4005.0443542507 2 5994.7926791534 ) 53.8130042923 (ExtendedPoll#56) + 6192 ( 2 0 4005.1698540660 2 5994.6593474699 ) 53.8130023789 (ExtendedPoll#56) + 6193 ( 2 0 4005.6718533272 2 5994.1260207358 ) 53.8129957265 (ExtendedPoll#56) + 6194 ( 2 0 4007.6798503720 2 5991.9927137997 ) 53.8129851374 (ExtendedPoll#56) + 6199 ( 2 0 4007.2403461204 2 5992.5254074536 ) 53.8124063797 (ExtendedPoll#56) + 6203 ( 2 0 4007.7373207242 2 5992.0459191907 ) 53.8119791690 (ExtendedPoll#56) + 6204 ( 2 0 4009.2282445356 2 5990.6074544020 ) 53.8107058155 (ExtendedPoll#56) + 6212 ( 2 0 4009.3503023939 2 5990.6056218015 ) 53.8095807273 (ExtendedPoll#56) + 6214 ( 2 0 4009.4380806266 2 5990.5207890577 ) 53.8095074272 (ExtendedPoll#56) + 6215 ( 2 0 4009.7014153247 2 5990.2662908261 ) 53.8092877859 (ExtendedPoll#56) + 6222 ( 2 0 4009.7506106525 2 5990.2301636059 ) 53.8091461907 (ExtendedPoll#56) + 6229 ( 2 0 4009.7635053921 2 5990.2220054099 ) 53.8090975243 (ExtendedPoll#56) + 6230 ( 2 0 4009.8021896106 2 5990.1975308217 ) 53.8089515284 (ExtendedPoll#56) + 6240 ( 2 0 4009.8017843826 2 5990.1980698371 ) 53.8089505672 (ExtendedPoll#56) + 6247 ( 2 0 4009.8017202471 2 5990.1981703234 ) 53.8089502814 (ExtendedPoll#56) + 6248 ( 2 0 4009.8015278408 2 5990.1984717824 ) 53.8089494238 (ExtendedPoll#56) + 6263 ( 2 0 4009.8015265652 2 5990.1984731397 ) 53.8089494237 (ExtendedPoll#56) + 6264 ( 2 0 4009.8015227385 2 5990.1984772118 ) 53.8089494236 (ExtendedPoll#56) + 6268 ( 2 0 4009.8015264517 2 5990.1984734744 ) 53.8089494218 (ExtendedPoll#56) + 6269 ( 2 0 4009.8015375912 2 5990.1984622623 ) 53.8089494165 (ExtendedPoll#56) + 6270 ( 2 0 4009.8015821493 2 5990.1984174139 ) 53.8089493951 (ExtendedPoll#56) + 6271 ( 2 0 4009.8017603815 2 5990.1982380201 ) 53.8089493096 (ExtendedPoll#56) + 6272 ( 2 0 4009.8024733106 2 5990.1975204453 ) 53.8089489676 (ExtendedPoll#56) + 6273 ( 2 0 4009.8053250269 2 5990.1946501458 ) 53.8089475994 (ExtendedPoll#56) + 6274 ( 2 0 4009.8167318920 2 5990.1831689481 ) 53.8089421273 (ExtendedPoll#56) + 6275 ( 2 0 4009.8623593525 2 5990.1372441570 ) 53.8089202465 (ExtendedPoll#56) + 6276 ( 2 0 4010.0448691945 2 5989.9535449926 ) 53.8088328461 (ExtendedPoll#56) + 6277 ( 2 0 4010.7749085625 2 5989.2187483350 ) 53.8084852115 (ExtendedPoll#56) + 6278 ( 2 0 4013.6950660346 2 5986.2795617047 ) 53.8071261335 (ExtendedPoll#56) + 6279 ( 2 0 4025.3756959228 2 5974.5228151836 ) 53.8021926744 (ExtendedPoll#56) + 6280 ( 2 0 4072.0982154756 2 5927.4958290993 ) 53.7904707641 (ExtendedPoll#56) + 6282 ( 2 0 4072.1230863636 2 5927.4781440878 ) 53.7904013936 (ExtendedPoll#56) + 6283 ( 2 0 4072.1976990276 2 5927.4250890534 ) 53.7901932963 (ExtendedPoll#56) + 6284 ( 2 0 4072.4961496835 2 5927.2128689157 ) 53.7893611206 (ExtendedPoll#56) + 6287 ( 2 0 4072.6142224687 2 5927.1818879709 ) 53.7885522474 (ExtendedPoll#56) + 6291 ( 2 0 4072.7124431924 2 5927.2543656553 ) 53.7869896937 (ExtendedPoll#56) + 6292 ( 2 0 4072.8894390822 2 5927.0862195600 ) 53.7868793477 (ExtendedPoll#56) + 6298 ( 2 0 4072.8331432603 2 5927.1516517284 ) 53.7868061997 (ExtendedPoll#56) + 6308 ( 2 0 4072.8364485532 2 5927.1585279631 ) 53.7867134349 (ExtendedPoll#56) + 6311 ( 2 0 4072.8360952700 2 5927.1623262685 ) 53.7866822980 (ExtendedPoll#56) + 6317 ( 2 0 4072.8355323017 2 5927.1630960486 ) 53.7866805212 (ExtendedPoll#56) + 6318 ( 2 0 4072.8338433970 2 5927.1654053888 ) 53.7866751908 (ExtendedPoll#56) + 6322 ( 2 0 4072.8348036881 2 5927.1644583778 ) 53.7866749068 (ExtendedPoll#56) + 6323 ( 2 0 4072.8376845612 2 5927.1616173446 ) 53.7866740546 (ExtendedPoll#56) + 6324 ( 2 0 4072.8492080538 2 5927.1502532121 ) 53.7866706465 (ExtendedPoll#56) + 6325 ( 2 0 4072.8546839370 2 5927.1449407271 ) 53.7866682334 (ExtendedPoll#56) + 6337 ( 2 0 4072.8548902901 2 5927.1448213042 ) 53.7866674110 (ExtendedPoll#56) + 6338 ( 2 0 4072.8555093493 2 5927.1444630354 ) 53.7866649438 (ExtendedPoll#56) + 6343 ( 2 0 4072.8556843793 2 5927.1443011469 ) 53.7866647950 (ExtendedPoll#56) + 6351 ( 2 0 4072.8556567359 2 5927.1443329620 ) 53.7866647619 (ExtendedPoll#56) + 6357 ( 2 0 4072.8556523714 2 5927.1443390004 ) 53.7866647475 (ExtendedPoll#56) + 6358 ( 2 0 4072.8556392781 2 5927.1443571157 ) 53.7866647042 (ExtendedPoll#56) + 6363 ( 2 0 4072.8556357434 2 5927.1443636744 ) 53.7866646774 (ExtendedPoll#56) + 6370 ( 2 0 4072.8556351991 2 5927.1443644301 ) 53.7866646756 (ExtendedPoll#56) + 6375 ( 2 0 4072.8556348885 2 5927.1443647771 ) 53.7866646753 (ExtendedPoll#56) + 6376 ( 2 0 4072.8556339570 2 5927.1443658182 ) 53.7866646745 (ExtendedPoll#56) + 6377 ( 2 0 4072.8556327029 2 5927.1443671954 ) 53.7866646736 (ExtendedPoll#56) + 6386 ( 2 0 4072.8556329763 2 5927.1443670119 ) 53.7866646727 (ExtendedPoll#56) + 6405 ( 2 0 4954.5798595708 2 5043.6731930494 ) 55.7239163641 (ExtendedPoll#57) + 6406 ( 2 0 4818.3194671920 2 5174.6928011060 ) 55.2406520186 (ExtendedPoll#57) + 6407 ( 2 0 4273.2778976764 2 5698.7712333325 ) 54.1421761447 (ExtendedPoll#57) + 6418 ( 2 0 4267.0544662937 2 5713.0742072120 ) 54.0559868372 (ExtendedPoll#57) + 6420 ( 2 0 4305.9236166838 2 5692.5478019498 ) 53.9161736343 (ExtendedPoll#57) + 6436 ( 2 0 4306.4284814658 2 5693.0189735384 ) 53.9070540230 (ExtendedPoll#57) + 6437 ( 2 0 4307.3369182014 2 5692.6607167976 ) 53.9026276457 (ExtendedPoll#57) + 6453 ( 2 0 4307.3366998789 2 5692.6626116095 ) 53.9026107377 (ExtendedPoll#57) + 6459 ( 2 0 4307.3371752453 2 5692.6626490319 ) 53.9026061874 (ExtendedPoll#57) + 6461 ( 2 0 4307.3375784896 2 5692.6623945369 ) 53.9026051716 (ExtendedPoll#57) + 6474 ( 2 0 4307.3375909856 2 5692.6624026545 ) 53.9026049811 (ExtendedPoll#57) + 6479 ( 2 0 4307.3375975611 2 5692.6623991511 ) 53.9026049581 (ExtendedPoll#57) + 6487 ( 2 0 4307.3375983269 2 5692.6623986211 ) 53.9026049566 (ExtendedPoll#57) + 6488 ( 2 0 4307.3376006244 2 5692.6623970312 ) 53.9026049522 (ExtendedPoll#57) + 6490 ( 2 0 4307.3375976707 2 5692.6624013936 ) 53.9026049349 (ExtendedPoll#57) + 6495 ( 2 0 4307.3375969844 2 5692.6624020232 ) 53.9026049346 (ExtendedPoll#57) + 6496 ( 2 0 4307.3375949256 2 5692.6624039121 ) 53.9026049340 (ExtendedPoll#57) + 6497 ( 2 0 4307.3375866905 2 5692.6624114674 ) 53.9026049313 (ExtendedPoll#57) + 6498 ( 2 0 4307.3375537500 2 5692.6624416886 ) 53.9026049205 (ExtendedPoll#57) + 6499 ( 2 0 4307.3374219878 2 5692.6625625735 ) 53.9026048776 (ExtendedPoll#57) + 6500 ( 2 0 4307.3368949392 2 5692.6630461130 ) 53.9026047059 (ExtendedPoll#57) + 6501 ( 2 0 4307.3347867446 2 5692.6649802712 ) 53.9026040190 (ExtendedPoll#57) + 6502 ( 2 0 4307.3263539663 2 5692.6727169040 ) 53.9026012717 (ExtendedPoll#57) + 6503 ( 2 0 4307.2926228530 2 5692.7036634351 ) 53.9025902858 (ExtendedPoll#57) + 6504 ( 2 0 4307.1576983999 2 5692.8274495597 ) 53.9025463974 (ExtendedPoll#57) + 6505 ( 2 0 4306.6180005874 2 5693.3225940580 ) 53.9023717283 (ExtendedPoll#57) + 6506 ( 2 0 4304.4592093375 2 5695.3031720513 ) 53.9016872027 (ExtendedPoll#57) + 6507 ( 2 0 4295.8240443380 2 5703.2254840245 ) 53.8991757562 (ExtendedPoll#57) + 6508 ( 2 0 4261.2833843400 2 5734.9147319171 ) 53.8927720075 (ExtendedPoll#57) + 6511 ( 2 0 4261.2854283144 2 5734.9298531621 ) 53.8926060076 (ExtendedPoll#57) + 6512 ( 2 0 4261.2915602373 2 5734.9752168971 ) 53.8921080120 (ExtendedPoll#57) + 6513 ( 2 0 4261.3160879292 2 5735.1566718371 ) 53.8901160910 (ExtendedPoll#57) + 6514 ( 2 0 4261.4141986968 2 5735.8824915973 ) 53.8821493903 (ExtendedPoll#57) + 6515 ( 2 0 4261.5839708086 2 5736.0579414386 ) 53.8789281638 (ExtendedPoll#57) + 6516 ( 2 0 4262.0932871439 2 5736.5842909627 ) 53.8692650726 (ExtendedPoll#57) + 6517 ( 2 0 4262.1303923063 2 5737.5601140852 ) 53.8593995884 (ExtendedPoll#57) + 6525 ( 2 0 4262.0592807423 2 5737.6593344091 ) 53.8590609755 (ExtendedPoll#57) + 6526 ( 2 0 4261.8459460503 2 5737.9569953809 ) 53.8580454076 (ExtendedPoll#57) + 6531 ( 2 0 4261.8066484312 2 5738.0725691654 ) 53.8572649584 (ExtendedPoll#57) + 6532 ( 2 0 4261.6592140538 2 5738.2671580201 ) 53.8566720935 (ExtendedPoll#57) + 6537 ( 2 0 4261.6094206317 2 5738.3786067875 ) 53.8560252022 (ExtendedPoll#57) + 6544 ( 2 0 4261.6039575038 2 5738.3928541111 ) 53.8559345028 (ExtendedPoll#57) + 6545 ( 2 0 4261.5822528497 2 5738.4143071991 ) 53.8559175202 (ExtendedPoll#57) + 6546 ( 2 0 4261.5171388874 2 5738.4786664632 ) 53.8558665878 (ExtendedPoll#57) + 6547 ( 2 0 4261.2566830381 2 5738.7361035197 ) 53.8556630883 (ExtendedPoll#57) + 6548 ( 2 0 4260.2148596411 2 5739.7658517453 ) 53.8548527711 (ExtendedPoll#57) + 6549 ( 2 0 4256.0475660528 2 5743.8848446480 ) 53.8516704284 (ExtendedPoll#57) + 6550 ( 2 0 4239.3783916996 2 5760.3608162588 ) 53.8398857910 (ExtendedPoll#57) + 6551 ( 2 0 4172.7016942871 2 5826.2647027020 ) 53.8079830812 (ExtendedPoll#57) + 6557 ( 2 0 4172.3873666467 2 5827.1893462901 ) 53.8020966299 (ExtendedPoll#57) + 6559 ( 2 0 4171.7493284512 2 5827.9288905621 ) 53.8008851851 (ExtendedPoll#57) + 6560 ( 2 0 4169.8352138647 2 5830.1475233783 ) 53.7972677698 (ExtendedPoll#57) + 6571 ( 2 0 4169.8728479823 2 5830.1263964098 ) 53.7971266241 (ExtendedPoll#57) + 6578 ( 2 0 4169.8744650652 2 5830.1253849637 ) 53.7971215364 (ExtendedPoll#57) + 6586 ( 2 0 4169.8742332961 2 5830.1256298513 ) 53.7971213238 (ExtendedPoll#57) + 6587 ( 2 0 4169.8735379888 2 5830.1263645140 ) 53.7971206859 (ExtendedPoll#57) + 6595 ( 2 0 4169.8735402993 2 5830.1264240738 ) 53.7971201036 (ExtendedPoll#57) + 6600 ( 2 0 4169.8735394760 2 5830.1264538648 ) 53.7971198303 (ExtendedPoll#57) + 6605 ( 2 0 4169.8735316923 2 5830.1264665714 ) 53.7971197809 (ExtendedPoll#57) + 6606 ( 2 0 4169.8735105156 2 5830.1264875411 ) 53.7971197747 (ExtendedPoll#57) + 6607 ( 2 0 4169.8734469856 2 5830.1265504500 ) 53.7971197562 (ExtendedPoll#57) + 6608 ( 2 0 4169.8731928654 2 5830.1268020859 ) 53.7971196820 (ExtendedPoll#57) + 6609 ( 2 0 4169.8721763846 2 5830.1278086295 ) 53.7971193855 (ExtendedPoll#57) + 6610 ( 2 0 4169.8681104615 2 5830.1318348037 ) 53.7971181995 (ExtendedPoll#57) + 6611 ( 2 0 4169.8518467691 2 5830.1479395006 ) 53.7971134562 (ExtendedPoll#57) + 6612 ( 2 0 4169.7867919994 2 5830.2123582880 ) 53.7970944980 (ExtendedPoll#57) + 6613 ( 2 0 4169.5265729207 2 5830.4700334377 ) 53.7970189008 (ExtendedPoll#57) + 6614 ( 2 0 4168.4856966058 2 5831.5007340364 ) 53.7967202870 (ExtendedPoll#57) + 6615 ( 2 0 4164.3221913464 2 5835.6235364314 ) 53.7955862535 (ExtendedPoll#57) + 6616 ( 2 0 4147.6681703088 2 5852.1147460114 ) 53.7920186238 (ExtendedPoll#57) + 6618 ( 2 0 4147.6602068265 2 5852.1752601464 ) 53.7915256228 (ExtendedPoll#57) + 6619 ( 2 0 4147.6363163798 2 5852.3568025514 ) 53.7900466951 (ExtendedPoll#57) + 6627 ( 2 0 4147.6523233123 2 5852.3423304219 ) 53.7900364877 (ExtendedPoll#57) + 6628 ( 2 0 4147.7003441098 2 5852.2989140332 ) 53.7900058731 (ExtendedPoll#57) + 6642 ( 2 0 4147.7008030485 2 5852.2990434509 ) 53.7900004953 (ExtendedPoll#57) + 6644 ( 2 0 4147.7011719978 2 5852.2987413745 ) 53.7899999659 (ExtendedPoll#57) + 6650 ( 2 0 4147.7010771141 2 5852.2988807259 ) 53.7899995260 (ExtendedPoll#57) + 6657 ( 2 0 4147.7010935191 2 5852.2989056067 ) 53.7899991446 (ExtendedPoll#57) + 6666 ( 2 0 4147.7010938504 2 5852.2989059339 ) 53.7899991385 (ExtendedPoll#57) + 6669 ( 2 0 4147.7010940528 2 5852.2989058189 ) 53.7899991377 (ExtendedPoll#57) + 6673 ( 2 0 4147.7010940473 2 5852.2989059352 ) 53.7899991367 (ExtendedPoll#57) + 6680 ( 2 0 4147.7010940274 2 5852.2989059712 ) 53.7899991366 (ExtendedPoll#57) + 6686 ( 2 0 4105.5727993639 2 5894.4271813637 ) 53.7841729375 (ExtendedPoll#58) + 6725 ( 2 0 4105.5727574055 2 5894.4272236982 ) 53.7841729333 (ExtendedPoll#58) + 6726 ( 2 0 4105.5726315303 2 5894.4273507015 ) 53.7841729207 (ExtendedPoll#58) + 6727 ( 2 0 4105.5721280294 2 5894.4278587149 ) 53.7841728703 (ExtendedPoll#58) + 6737 ( 2 0 4105.5721311970 2 5894.4278654586 ) 53.7841727793 (ExtendedPoll#58) + 6741 ( 2 0 4105.5721285679 2 5894.4278680979 ) 53.7841727792 (ExtendedPoll#58) + 6742 ( 2 0 4105.5721206809 2 5894.4278760159 ) 53.7841727787 (ExtendedPoll#58) + 6743 ( 2 0 4105.5720891326 2 5894.4279076878 ) 53.7841727770 (ExtendedPoll#58) + 6744 ( 2 0 4105.5719629396 2 5894.4280343754 ) 53.7841727702 (ExtendedPoll#58) + 6745 ( 2 0 4105.5714581674 2 5894.4285411256 ) 53.7841727431 (ExtendedPoll#58) + 6758 ( 2 0 4105.5714585929 2 5894.4285413146 ) 53.7841727374 (ExtendedPoll#58) + 6765 ( 2 0 4105.5714586508 2 5894.4285413214 ) 53.7841727368 (ExtendedPoll#58) + 6790 ( 2 0 4999.8038288046 2 5000.1453455727 ) 55.9014415188 (ExtendedPoll#59) + 6791 ( 2 0 4999.2153441271 2 5000.5814111994 ) 55.9006678364 (ExtendedPoll#59) + 6792 ( 2 0 4996.8614054169 2 5002.3256737060 ) 55.8975828466 (ExtendedPoll#59) + 6793 ( 2 0 4987.4456505762 2 5009.3027237327 ) 55.8853990072 (ExtendedPoll#59) + 6794 ( 2 0 4949.7826312134 2 5037.2109238395 ) 55.8391796750 (ExtendedPoll#59) + 6795 ( 2 0 4799.1305537620 2 5148.8437242665 ) 55.6957204380 (ExtendedPoll#59) + 6797 ( 2 0 4791.8152923122 2 5162.6007831124 ) 55.5930004110 (ExtendedPoll#59) + 6798 ( 2 0 4769.8695079627 2 5203.8719596503 ) 55.2886042603 (ExtendedPoll#59) + 6800 ( 2 0 4753.7104229690 2 5230.5126132884 ) 55.1111870096 (ExtendedPoll#59) + 6801 ( 2 0 4703.0495078538 2 5267.1981035443 ) 55.1012158213 (ExtendedPoll#59) + 6807 ( 2 0 4699.1189196121 2 5298.2060774510 ) 54.7818521507 (ExtendedPoll#59) + 6810 ( 2 0 4689.4016320146 2 5310.4345742030 ) 54.7232027437 (ExtendedPoll#59) + 6811 ( 2 0 4665.3813705375 2 5330.5242474383 ) 54.6941438059 (ExtendedPoll#59) + 6812 ( 2 0 4593.3205861064 2 5390.7932671444 ) 54.6201919010 (ExtendedPoll#59) + 6813 ( 2 0 4305.0774483818 2 5631.8693459686 ) 54.5320542946 (ExtendedPoll#59) + 6818 ( 2 0 4291.1020235224 2 5693.0118297283 ) 54.0420071399 (ExtendedPoll#59) + 6823 ( 2 0 4279.6378078175 2 5703.6025813796 ) 54.0382097940 (ExtendedPoll#59) + 6824 ( 2 0 4245.2451607026 2 5735.3748363333 ) 54.0307112653 (ExtendedPoll#59) + 6831 ( 2 0 4249.5032979644 2 5750.4420912598 ) 53.8459996564 (ExtendedPoll#59) + 6842 ( 2 0 4249.5962541266 2 5750.3629695656 ) 53.8459422263 (ExtendedPoll#59) + 6849 ( 2 0 4249.6238551729 2 5750.3759885262 ) 53.8455701397 (ExtendedPoll#59) + 6853 ( 2 0 4249.6129514080 2 5750.3866626954 ) 53.8455633271 (ExtendedPoll#59) + 6854 ( 2 0 4249.5802401136 2 5750.4186852027 ) 53.8455428930 (ExtendedPoll#59) + 6855 ( 2 0 4249.4493949358 2 5750.5467752323 ) 53.8454612142 (ExtendedPoll#59) + 6856 ( 2 0 4248.9260142245 2 5751.0591353504 ) 53.8451354192 (ExtendedPoll#59) + 6857 ( 2 0 4246.8324913796 2 5753.1085758229 ) 53.8438469662 (ExtendedPoll#59) + 6858 ( 2 0 4238.4583999999 2 5761.3063377130 ) 53.8389290219 (ExtendedPoll#59) + 6859 ( 2 0 4204.9620344812 2 5794.0973852733 ) 53.8230461425 (ExtendedPoll#59) + 6860 ( 2 0 4070.9765724063 2 5925.2615755146 ) 53.8210579913 (ExtendedPoll#59) + 6865 ( 2 0 4071.7886210187 2 5927.0375053582 ) 53.7974776434 (ExtendedPoll#59) + 6871 ( 2 0 4072.0432392023 2 5927.4540854434 ) 53.7913560161 (ExtendedPoll#59) + 6873 ( 2 0 4071.7200617674 2 5927.8201257384 ) 53.7910242574 (ExtendedPoll#59) + 6874 ( 2 0 4070.7505294627 2 5928.9182466233 ) 53.7900332794 (ExtendedPoll#59) + 6883 ( 2 0 4070.7703482043 2 5929.0386984572 ) 53.7887604316 (ExtendedPoll#59) + 6885 ( 2 0 4070.7520288631 2 5929.1593835311 ) 53.7878375424 (ExtendedPoll#59) + 6887 ( 2 0 4070.6714077684 2 5929.2510402129 ) 53.7877524096 (ExtendedPoll#59) + 6888 ( 2 0 4070.4295444844 2 5929.5260102582 ) 53.7874972799 (ExtendedPoll#59) + 6896 ( 2 0 4070.4383638744 2 5929.5552256590 ) 53.7871515709 (ExtendedPoll#59) + 6902 ( 2 0 4070.4346738395 2 5929.5619033272 ) 53.7871252238 (ExtendedPoll#59) + 6908 ( 2 0 4070.4365087991 2 5929.5624238125 ) 53.7871035769 (ExtendedPoll#59) + 6912 ( 2 0 4070.4373937138 2 5929.5620682560 ) 53.7870986249 (ExtendedPoll#59) + 6914 ( 2 0 4070.4382753416 2 5929.5617046258 ) 53.7870937763 (ExtendedPoll#59) + 6922 ( 2 0 4070.4383956527 2 5929.5615865285 ) 53.7870937340 (ExtendedPoll#59) + 6923 ( 2 0 4070.4387565859 2 5929.5612322368 ) 53.7870936074 (ExtendedPoll#59) + 6931 ( 2 0 4070.4387684909 2 5929.5612232749 ) 53.7870935786 (ExtendedPoll#59) + 6934 ( 2 0 4070.4387865750 2 5929.5612124557 ) 53.7870935095 (ExtendedPoll#59) + 6942 ( 2 0 4070.4387882509 2 5929.5612116428 ) 53.7870935014 (ExtendedPoll#59) + 6950 ( 2 0 4070.4387881954 2 5929.5612117452 ) 53.7870935010 (ExtendedPoll#59) + 6952 ( 2 0 4070.4387882946 2 5929.5612116843 ) 53.7870935006 (ExtendedPoll#59) + 6975 ( 2 0 4999.8058280052 2 5000.1479845174 ) 55.9013939424 (ExtendedPoll#60) + 6976 ( 2 0 4999.2233409293 2 5000.5919669783 ) 55.9004775395 (ExtendedPoll#60) + 6977 ( 2 0 4996.8933926259 2 5002.3678968219 ) 55.8968217946 (ExtendedPoll#60) + 6978 ( 2 0 4987.5735994122 2 5009.4716161962 ) 55.8823569716 (ExtendedPoll#60) + 6979 ( 2 0 4950.2944265573 2 5037.8864936935 ) 55.8270464781 (ExtendedPoll#60) + 6980 ( 2 0 4801.1777351379 2 5151.5460036826 ) 55.6477582520 (ExtendedPoll#60) + 6983 ( 2 0 4799.7583560506 2 5167.1591736427 ) 55.4764322556 (ExtendedPoll#60) + 6986 ( 2 0 4792.1155455806 2 5180.8070494820 ) 55.3782799039 (ExtendedPoll#60) + 6987 ( 2 0 4769.1871141707 2 5221.7506769997 ) 55.0876212670 (ExtendedPoll#60) + 6991 ( 2 0 4761.8718527209 2 5235.6169188523 ) 54.9868701218 (ExtendedPoll#60) + 6994 ( 2 0 4749.6433559689 2 5245.3342064498 ) 54.9738791762 (ExtendedPoll#60) + 6995 ( 2 0 4712.9578657131 2 5274.4860692424 ) 54.9380022491 (ExtendedPoll#60) + 6996 ( 2 0 4566.2159046897 2 5391.0935204128 ) 54.8421122279 (ExtendedPoll#60) + 6998 ( 2 0 4475.3756431037 2 5474.9460695691 ) 54.6975024335 (ExtendedPoll#60) + 6999 ( 2 0 4202.8548583459 2 5726.5037170378 ) 54.4953088368 (ExtendedPoll#60) + 7010 ( 2 0 4223.8179956350 2 5749.6505144612 ) 54.0825598595 (ExtendedPoll#60) + 7012 ( 2 0 4202.8548583459 2 5772.7973118845 ) 54.0462974249 (ExtendedPoll#60) + 7013 ( 2 0 4139.9654464788 2 5842.2377041545 ) 53.9544164694 (ExtendedPoll#60) + 7019 ( 2 0 4139.3103484385 2 5857.8508741146 ) 53.8144735666 (ExtendedPoll#60) + 7026 ( 2 0 4138.2372842006 2 5859.4835012619 ) 53.8090274109 (ExtendedPoll#60) + 7027 ( 2 0 4135.0180914870 2 5864.3813827037 ) 53.7927617458 (ExtendedPoll#60) + 7035 ( 2 0 4135.1400160653 2 5864.5928981232 ) 53.7896852883 (ExtendedPoll#60) + 7037 ( 2 0 4135.3836253179 2 5864.5767445826 ) 53.7876169219 (ExtendedPoll#60) + 7046 ( 2 0 4135.3975076833 2 5864.5830777793 ) 53.7874316321 (ExtendedPoll#60) + 7047 ( 2 0 4135.4221274217 2 5864.5650445737 ) 53.7873750497 (ExtendedPoll#60) + 7051 ( 2 0 4135.4358288178 2 5864.5583287176 ) 53.7873127014 (ExtendedPoll#60) + 7056 ( 2 0 4135.4417746173 2 5864.5535479991 ) 53.7873029931 (ExtendedPoll#60) + 7057 ( 2 0 4135.4596120157 2 5864.5392058436 ) 53.7872738692 (ExtendedPoll#60) + 7068 ( 2 0 4135.4600654422 2 5864.5390582696 ) 53.7872711118 (ExtendedPoll#60) + 7069 ( 2 0 4135.4609366779 2 5864.5386703998 ) 53.7872667832 (ExtendedPoll#60) + 7074 ( 2 0 4135.4606620754 2 5864.5390602294 ) 53.7872656603 (ExtendedPoll#60) + 7079 ( 2 0 4135.4605743562 2 5864.5392819246 ) 53.7872643984 (ExtendedPoll#60) + 7081 ( 2 0 4135.4610972036 2 5864.5388560396 ) 53.7872635958 (ExtendedPoll#60) + 7086 ( 2 0 4135.4612010194 2 5864.5387974466 ) 53.7872631950 (ExtendedPoll#60) + 7097 ( 2 0 4135.4612024119 2 5864.5387962096 ) 53.7872631938 (ExtendedPoll#60) + 7098 ( 2 0 4135.4612065894 2 5864.5387924983 ) 53.7872631903 (ExtendedPoll#60) + 7105 ( 2 0 4135.4612070035 2 5864.5387922853 ) 53.7872631885 (ExtendedPoll#60) + 7106 ( 2 0 4135.4612082457 2 5864.5387916463 ) 53.7872631831 (ExtendedPoll#60) + 7116 ( 2 0 4135.4612082147 2 5864.5387916956 ) 53.7872631829 (ExtendedPoll#60) + 7117 ( 2 0 4135.4612081217 2 5864.5387918434 ) 53.7872631824 (ExtendedPoll#60) + 7123 ( 2 0 4135.4612081460 2 5864.5387918272 ) 53.7872631824 (ExtendedPoll#60) + 7124 ( 2 0 4135.4612082186 2 5864.5387917788 ) 53.7872631821 (ExtendedPoll#60) + 7133 ( 2 0 4874.2211666294 2 5125.7788140982 ) 55.3724275680 (ExtendedPoll#61) + 7134 ( 2 0 4496.8846954264 2 5503.1152853013 ) 54.2156316564 (ExtendedPoll#61) + 7169 ( 2 0 4496.8846529014 2 5503.1153270666 ) 54.2156315732 (ExtendedPoll#61) + 7170 ( 2 0 4496.8845253266 2 5503.1154523626 ) 54.2156313235 (ExtendedPoll#61) + 7171 ( 2 0 4496.8840150275 2 5503.1159535467 ) 54.2156303249 (ExtendedPoll#61) + 7172 ( 2 0 4496.8819738307 2 5503.1179582832 ) 54.2156263303 (ExtendedPoll#61) + 7173 ( 2 0 4496.8738090439 2 5503.1259772290 ) 54.2156103523 (ExtendedPoll#61) + 7174 ( 2 0 4496.8411498966 2 5503.1580530122 ) 54.2155464435 (ExtendedPoll#61) + 7175 ( 2 0 4496.7105133072 2 5503.2863561450 ) 54.2152908615 (ExtendedPoll#61) + 7176 ( 2 0 4496.1879669499 2 5503.7995686762 ) 54.2142693849 (ExtendedPoll#61) + 7177 ( 2 0 4494.0977815204 2 5505.8524188009 ) 54.2101971068 (ExtendedPoll#61) + 7178 ( 2 0 4485.7370398025 2 5514.0638192997 ) 54.1941263256 (ExtendedPoll#61) + 7179 ( 2 0 4452.2940729307 2 5546.9094212948 ) 54.1333544119 (ExtendedPoll#61) + 7180 ( 2 0 4318.5222054439 2 5678.2918292755 ) 53.9475643989 (ExtendedPoll#61) + 7183 ( 2 0 4318.5963891128 2 5678.5244295969 ) 53.9445911411 (ExtendedPoll#61) + 7184 ( 2 0 4318.8189401194 2 5679.2222305612 ) 53.9356722784 (ExtendedPoll#61) + 7185 ( 2 0 4318.7890853910 2 5680.1984801799 ) 53.9261887566 (ExtendedPoll#61) + 7186 ( 2 0 4317.9105033838 2 5681.9437023028 ) 53.9164801493 (ExtendedPoll#61) + 7193 ( 2 0 4317.7577644608 2 5682.1341594764 ) 53.9159200953 (ExtendedPoll#61) + 7199 ( 2 0 4317.7221920188 2 5682.1837563103 ) 53.9157374211 (ExtendedPoll#61) + 7200 ( 2 0 4317.6154746928 2 5682.3325468122 ) 53.9151894649 (ExtendedPoll#61) + 7204 ( 2 0 4317.6823945996 2 5682.2780286129 ) 53.9151462258 (ExtendedPoll#61) + 7205 ( 2 0 4317.8831543201 2 5682.1144740148 ) 53.9150166207 (ExtendedPoll#61) + 7217 ( 2 0 4317.8850608152 2 5682.1144169722 ) 53.9150004675 (ExtendedPoll#61) + 7222 ( 2 0 4317.8855375905 2 5682.1144246562 ) 53.9149962090 (ExtendedPoll#61) + 7230 ( 2 0 4317.8855643890 2 5682.1144116170 ) 53.9149961040 (ExtendedPoll#61) + 7235 ( 2 0 4317.8855791781 2 5682.1144097931 ) 53.9149959925 (ExtendedPoll#61) + 7237 ( 2 0 4317.8855925920 2 5682.1144033038 ) 53.9149959395 (ExtendedPoll#61) + 7241 ( 2 0 4317.8855821380 2 5682.1144139226 ) 53.9149959253 (ExtendedPoll#61) + 7242 ( 2 0 4317.8855507760 2 5682.1144457789 ) 53.9149958826 (ExtendedPoll#61) + 7243 ( 2 0 4317.8854253280 2 5682.1145732043 ) 53.9149957120 (ExtendedPoll#61) + 7250 ( 2 0 4317.8854184488 2 5682.1145811854 ) 53.9149956927 (ExtendedPoll#61) + 7259 ( 2 0 4317.8854186637 2 5682.1145810957 ) 53.9149956917 (ExtendedPoll#61) + 7266 ( 2 0 4317.8854187880 2 5682.1145812036 ) 53.9149956895 (ExtendedPoll#61) + 7275 ( 2 0 4664.5897937388 2 5335.4101869888 ) 54.6460177074 (ExtendedPoll#62) + 7276 ( 2 0 3658.3592038639 2 6341.6407768637 ) 54.3665218070 (ExtendedPoll#62) + 7311 ( 2 0 3658.3592901848 2 6341.6406946471 ) 54.3665215475 (ExtendedPoll#62) + 7312 ( 2 0 3658.3595491473 2 6341.6404479973 ) 54.3665207691 (ExtendedPoll#62) + 7313 ( 2 0 3658.3598690753 2 6341.6400944160 ) 54.3665201699 (ExtendedPoll#62) + 7314 ( 2 0 3658.3608288593 2 6341.6390336723 ) 54.3665183724 (ExtendedPoll#62) + 7315 ( 2 0 3658.3646679955 2 6341.6347906973 ) 54.3665111823 (ExtendedPoll#62) + 7316 ( 2 0 3658.3800245403 2 6341.6178187975 ) 54.3664824230 (ExtendedPoll#62) + 7317 ( 2 0 3658.4414507195 2 6341.5499311982 ) 54.3663674021 (ExtendedPoll#62) + 7318 ( 2 0 3658.6871554362 2 6341.2783808011 ) 54.3659075842 (ExtendedPoll#62) + 7319 ( 2 0 3659.6699743029 2 6340.1921792124 ) 54.3640725584 (ExtendedPoll#62) + 7320 ( 2 0 3663.6012497698 2 6335.8473728577 ) 54.3568003795 (ExtendedPoll#62) + 7321 ( 2 0 3679.3263516374 2 6318.4681474388 ) 54.3287978530 (ExtendedPoll#62) + 7322 ( 2 0 3742.2267591076 2 6248.9512457632 ) 54.2341245206 (ExtendedPoll#62) + 7323 ( 2 0 3993.8283889887 2 5970.8836390611 ) 54.1291421044 (ExtendedPoll#62) + 7325 ( 2 0 3994.6101563766 2 5970.2984863845 ) 54.1270135487 (ExtendedPoll#62) + 7326 ( 2 0 3996.9554585404 2 5968.5430283547 ) 54.1206429804 (ExtendedPoll#62) + 7327 ( 2 0 4006.3366671954 2 5961.5211962354 ) 54.0953869891 (ExtendedPoll#62) + 7328 ( 2 0 4043.8615018154 2 5933.4338677582 ) 53.9979707862 (ExtendedPoll#62) + 7329 ( 2 0 4058.8195737352 2 5928.7389984696 ) 53.9018789159 (ExtendedPoll#62) + 7330 ( 2 0 4085.0234953465 2 5911.2697173953 ) 53.8187819628 (ExtendedPoll#62) + 7336 ( 2 0 4079.2095002390 2 5920.6867517244 ) 53.7866402997 (ExtendedPoll#62) + 7349 ( 2 0 4079.1688898115 2 5920.8018656928 ) 53.7859692077 (ExtendedPoll#62) + 7353 ( 2 0 4079.1419239280 2 5920.8566204642 ) 53.7857204969 (ExtendedPoll#62) + 7366 ( 2 0 4079.1420265196 2 5920.8575686043 ) 53.7857109426 (ExtendedPoll#62) + 7368 ( 2 0 4079.1415632502 2 5920.8584021968 ) 53.7857076422 (ExtendedPoll#62) + 7375 ( 2 0 4079.1418084008 2 5920.8581707058 ) 53.7857074853 (ExtendedPoll#62) + 7383 ( 2 0 4079.1417949665 2 5920.8581973084 ) 53.7857073675 (ExtendedPoll#62) + 7390 ( 2 0 4079.1417913882 2 5920.8582038435 ) 53.7857073412 (ExtendedPoll#62) + 7394 ( 2 0 4079.1417981276 2 5920.8582006667 ) 53.7857073079 (ExtendedPoll#62) + 7404 ( 2 0 4079.1417985233 2 5920.8582009121 ) 53.7857073020 (ExtendedPoll#62) + 7405 ( 2 0 4079.1417993958 2 5920.8582005863 ) 53.7857072969 (ExtendedPoll#62) + 7413 ( 2 0 4079.1417992378 2 5920.8582007573 ) 53.7857072968 (ExtendedPoll#62) + 7436 ( 2 0 4999.1900742320 2 5000.5459053974 ) 55.9012953652 (ExtendedPoll#63) + 7437 ( 2 0 4996.7603258365 2 5002.1836504981 ) 55.9000925053 (ExtendedPoll#63) + 7438 ( 2 0 4987.0413322545 2 5008.7346309009 ) 55.8954303274 (ExtendedPoll#63) + 7439 ( 2 0 4948.1653579264 2 5034.9385525122 ) 55.8791873269 (ExtendedPoll#63) + 7440 ( 2 0 4792.6614606142 2 5139.7542389575 ) 55.8538338094 (ExtendedPoll#63) + 7442 ( 2 0 4775.1921795400 2 5165.9581605689 ) 55.6864877206 (ExtendedPoll#63) + 7443 ( 2 0 4722.7843363173 2 5244.5699254029 ) 55.1994445339 (ExtendedPoll#63) + 7448 ( 2 0 4722.3476042905 2 5276.0146313364 ) 54.8445124513 (ExtendedPoll#63) + 7451 ( 2 0 4697.8906107866 2 5295.6675725449 ) 54.8205115310 (ExtendedPoll#63) + 7452 ( 2 0 4624.5196302749 2 5354.6263961704 ) 54.7613812550 (ExtendedPoll#63) + 7453 ( 2 0 4331.0357082280 2 5590.4616906724 ) 54.7273149903 (ExtendedPoll#63) + 7458 ( 2 0 4308.3256428315 2 5648.1103182173 ) 54.3396439948 (ExtendedPoll#63) + 7460 ( 2 0 4455.0676038550 2 5543.2946317720 ) 54.1475041698 (ExtendedPoll#63) + 7469 ( 2 0 4447.5339763917 2 5551.3741742688 ) 54.1273594464 (ExtendedPoll#63) + 7480 ( 2 0 4447.2091995963 2 5551.7388284514 ) 54.1263276850 (ExtendedPoll#63) + 7481 ( 2 0 4446.2348692102 2 5552.8327909991 ) 54.1232362635 (ExtendedPoll#63) + 7482 ( 2 0 4442.3375476659 2 5557.2086411901 ) 54.1109285550 (ExtendedPoll#63) + 7491 ( 2 0 4442.5740664204 2 5557.2691503271 ) 54.1082748289 (ExtendedPoll#63) + 7495 ( 2 0 4442.6925323818 2 5557.2986052154 ) 54.1069545527 (ExtendedPoll#63) + 7501 ( 2 0 4442.7168164211 2 5557.2801226062 ) 54.1069394344 (ExtendedPoll#63) + 7504 ( 2 0 4442.7071793373 2 5557.2919529796 ) 54.1068985868 (ExtendedPoll#63) + 7508 ( 2 0 4442.7017183179 2 5557.2972807450 ) 54.1068897802 (ExtendedPoll#63) + 7509 ( 2 0 4442.6853352597 2 5557.3132640411 ) 54.1068633612 (ExtendedPoll#63) + 7510 ( 2 0 4442.6198030272 2 5557.3771972256 ) 54.1067576985 (ExtendedPoll#63) + 7511 ( 2 0 4442.3576740969 2 5557.6329299635 ) 54.1063352645 (ExtendedPoll#63) + 7512 ( 2 0 4441.3091583760 2 5558.6558609153 ) 54.1046489915 (ExtendedPoll#63) + 7513 ( 2 0 4437.1150954922 2 5562.7475847223 ) 54.0979593435 (ExtendedPoll#63) + 7514 ( 2 0 4420.3388439569 2 5579.1144799504 ) 54.0720900340 (ExtendedPoll#63) + 7515 ( 2 0 4353.2338378159 2 5644.5820608629 ) 53.9829787440 (ExtendedPoll#63) + 7516 ( 2 0 4084.8138132516 2 5906.4523845126 ) 53.8646582524 (ExtendedPoll#63) + 7518 ( 2 0 4082.5755616140 2 5909.6528113969 ) 53.8560492754 (ExtendedPoll#63) + 7519 ( 2 0 4075.8608067011 2 5919.2540920498 ) 53.8305130308 (ExtendedPoll#63) + 7520 ( 2 0 4066.9078001506 2 5932.0285038353 ) 53.7973908395 (ExtendedPoll#63) + 7532 ( 2 0 4066.8994834762 2 5932.5167352687 ) 53.7930561968 (ExtendedPoll#63) + 7535 ( 2 0 4066.7294181484 2 5932.9744722294 ) 53.7904920157 (ExtendedPoll#63) + 7537 ( 2 0 4066.4042148569 2 5933.3386999159 ) 53.7902064369 (ExtendedPoll#63) + 7538 ( 2 0 4065.4286049825 2 5934.4313829753 ) 53.7893539893 (ExtendedPoll#63) + 7544 ( 2 0 4065.9681225742 2 5934.0003020220 ) 53.7882608591 (ExtendedPoll#63) + 7556 ( 2 0 4065.9833434669 2 5933.9992277641 ) 53.7881299256 (ExtendedPoll#63) + 7557 ( 2 0 4066.0088195296 2 5933.9824261494 ) 53.7880462489 (ExtendedPoll#63) + 7560 ( 2 0 4066.0322468281 2 5933.9628689699 ) 53.7880063853 (ExtendedPoll#63) + 7571 ( 2 0 4066.0333397798 2 5933.9653350231 ) 53.7879740199 (ExtendedPoll#63) + 7576 ( 2 0 4066.0330666936 2 5933.9662487622 ) 53.7879682924 (ExtendedPoll#63) + 7582 ( 2 0 4066.0329389515 2 5933.9664500713 ) 53.7879676549 (ExtendedPoll#63) + 7583 ( 2 0 4066.0325557253 2 5933.9670539988 ) 53.7879657426 (ExtendedPoll#63) + 7586 ( 2 0 4066.0323799541 2 5933.9674972574 ) 53.7879633642 (ExtendedPoll#63) + 7593 ( 2 0 4066.0324936658 2 5933.9674614732 ) 53.7879626367 (ExtendedPoll#63) + 7597 ( 2 0 4066.0325420577 2 5933.9674266746 ) 53.7879625038 (ExtendedPoll#63) + 7602 ( 2 0 4066.0325530871 2 5933.9674366944 ) 53.7879623114 (ExtendedPoll#63) + 7603 ( 2 0 4066.0325776078 2 5933.9674197559 ) 53.7879622378 (ExtendedPoll#63) + 7614 ( 2 0 4066.0325784803 2 5933.9674194301 ) 53.7879622327 (ExtendedPoll#63) + 7615 ( 2 0 4066.0325810978 2 5933.9674184529 ) 53.7879622173 (ExtendedPoll#63) + 7619 ( 2 0 4066.0325804614 2 5933.9674191328 ) 53.7879622170 (ExtendedPoll#63) + 7620 ( 2 0 4066.0325785520 2 5933.9674211726 ) 53.7879622163 (ExtendedPoll#63) + 7625 ( 2 0 4066.0325782752 2 5933.9674215470 ) 53.7879622154 (ExtendedPoll#63) + 7628 ( 2 0 4066.0325779836 2 5933.9674219101 ) 53.7879622149 (ExtendedPoll#63) + 7630 ( 2 0 4066.0325777001 2 5933.9674222795 ) 53.7879622141 (ExtendedPoll#63) + 7636 ( 2 0 4066.0325779310 2 5933.9674220447 ) 53.7879622141 (ExtendedPoll#63) + 7637 ( 2 0 4066.0325786236 2 5933.9674213404 ) 53.7879622141 (ExtendedPoll#63) + 7638 ( 2 0 4066.0325813941 2 5933.9674185232 ) 53.7879622139 (ExtendedPoll#63) + 7639 ( 2 0 4066.0325924760 2 5933.9674072542 ) 53.7879622133 (ExtendedPoll#63) + 7640 ( 2 0 4066.0326368038 2 5933.9673621781 ) 53.7879622107 (ExtendedPoll#63) + 7641 ( 2 0 4066.0328141148 2 5933.9671818738 ) 53.7879622005 (ExtendedPoll#63) + 7642 ( 2 0 4066.0335233590 2 5933.9664606566 ) 53.7879621598 (ExtendedPoll#63) + 7643 ( 2 0 4066.0363603358 2 5933.9635757879 ) 53.7879619968 (ExtendedPoll#63) + 7644 ( 2 0 4066.0477082430 2 5933.9520363132 ) 53.7879613453 (ExtendedPoll#63) + 7645 ( 2 0 4066.0930998717 2 5933.9058784143 ) 53.7879587467 (ExtendedPoll#63) + 7646 ( 2 0 4066.2746663863 2 5933.7212468186 ) 53.7879484746 (ExtendedPoll#63) + 7647 ( 2 0 4067.0009324450 2 5932.9827204360 ) 53.7879093366 (ExtendedPoll#63) + 7648 ( 2 0 4069.9059966798 2 5930.0286149054 ) 53.7877839844 (ExtendedPoll#63) + 7649 ( 2 0 4081.5262536188 2 5918.2121927832 ) 53.7877812112 (ExtendedPoll#63) + 7652 ( 2 0 4081.5299687022 2 5918.2130588562 ) 53.7877391250 (ExtendedPoll#63) + 7653 ( 2 0 4081.5411139525 2 5918.2156570750 ) 53.7876128665 (ExtendedPoll#63) + 7654 ( 2 0 4081.5856949536 2 5918.2260499504 ) 53.7871078341 (ExtendedPoll#63) + 7655 ( 2 0 4081.6155830020 2 5918.2198824166 ) 53.7868886494 (ExtendedPoll#63) + 7656 ( 2 0 4081.7052471472 2 5918.2013798154 ) 53.7862311047 (ExtendedPoll#63) + 7658 ( 2 0 4081.6080460159 2 5918.3440427676 ) 53.7858294673 (ExtendedPoll#63) + 7662 ( 2 0 4081.5880590083 2 5918.4017130398 ) 53.7854893417 (ExtendedPoll#63) + 7669 ( 2 0 4081.6043092810 2 5918.3875148632 ) 53.7854687399 (ExtendedPoll#63) + 7670 ( 2 0 4081.6530600991 2 5918.3449203333 ) 53.7854069422 (ExtendedPoll#63) + 7679 ( 2 0 4081.6496579113 2 5918.3491070966 ) 53.7854002178 (ExtendedPoll#63) + 7688 ( 2 0 4081.6498661605 2 5918.3495360557 ) 53.7853944010 (ExtendedPoll#63) + 7689 ( 2 0 4081.6493358875 2 5918.3503287128 ) 53.7853920795 (ExtendedPoll#63) + 7696 ( 2 0 4081.6491972063 2 5918.3505226482 ) 53.7853915938 (ExtendedPoll#63) + 7697 ( 2 0 4081.6487811625 2 5918.3511044543 ) 53.7853901369 (ExtendedPoll#63) + 7706 ( 2 0 4081.6488121122 2 5918.3511553938 ) 53.7853893889 (ExtendedPoll#63) + 7709 ( 2 0 4081.6488409573 2 5918.3511479011 ) 53.7853891913 (ExtendedPoll#63) + 7715 ( 2 0 4081.6488473913 2 5918.3511516580 ) 53.7853890979 (ExtendedPoll#63) + 7720 ( 2 0 4081.6488480521 2 5918.3511510017 ) 53.7853890978 (ExtendedPoll#63) + 7721 ( 2 0 4081.6488500345 2 5918.3511490328 ) 53.7853890974 (ExtendedPoll#63) + 7722 ( 2 0 4081.6488579640 2 5918.3511411574 ) 53.7853890960 (ExtendedPoll#63) + 7723 ( 2 0 4081.6488896822 2 5918.3511096556 ) 53.7853890902 (ExtendedPoll#63) + 7732 ( 2 0 4081.6488900669 2 5918.3511093933 ) 53.7853890891 (ExtendedPoll#63) + 7733 ( 2 0 4081.6488912210 2 5918.3511086061 ) 53.7853890856 (ExtendedPoll#63) + 7741 ( 2 0 4081.6488912536 2 5918.3511087179 ) 53.7853890843 (ExtendedPoll#63) + 7745 ( 2 0 4081.6488912181 2 5918.3511087641 ) 53.7853890842 (ExtendedPoll#63) + 7751 ( 3 0 3209.7898482266 2 3041.1228583258 1 3749.0872770800 ) 46.5944609002 + 7752 ( 3 0 3209.7897367750 2 3041.1229969359 1 3749.0872586356 ) 46.5944605757 + 7789 ( 2 0 4999.9999577432 2 5000.0000417347 ) 55.9016992549 (ExtendedPoll#64) + 7796 ( 2 0 4999.9999505368 2 5000.0000494217 ) 55.9016992168 (ExtendedPoll#64) + 7797 ( 2 0 4999.9999398266 2 5000.0000597821 ) 55.9016991732 (ExtendedPoll#64) + 7798 ( 2 0 4999.9999076961 2 5000.0000908630 ) 55.9016990423 (ExtendedPoll#64) + 7799 ( 2 0 4999.9997791737 2 5000.0002151869 ) 55.9016985186 (ExtendedPoll#64) + 7800 ( 2 0 4999.9992650844 2 5000.0007124825 ) 55.9016964242 (ExtendedPoll#64) + 7801 ( 2 0 4999.9972087269 2 5000.0027016649 ) 55.9016880465 (ExtendedPoll#64) + 7802 ( 2 0 4999.9889832972 2 5000.0106583944 ) 55.9016545357 (ExtendedPoll#64) + 7803 ( 2 0 4999.9560815784 2 5000.0424853122 ) 55.9015204952 (ExtendedPoll#64) + 7804 ( 2 0 4999.8244747033 2 5000.1697929837 ) 55.9009843757 (ExtendedPoll#64) + 7805 ( 2 0 4999.2980472026 2 5000.6790236696 ) 55.8988405794 (ExtendedPoll#64) + 7806 ( 2 0 4997.1923371998 2 5002.7159464134 ) 55.8902763014 (ExtendedPoll#64) + 7807 ( 2 0 4988.7694971886 2 5010.8636373882 ) 55.8561940243 (ExtendedPoll#64) + 7808 ( 2 0 4955.0781371440 2 5043.4544012877 ) 55.7226824798 (ExtendedPoll#64) + 7809 ( 2 0 4820.3126969657 2 5173.8174568856 ) 55.2350077198 (ExtendedPoll#64) + 7810 ( 2 0 4281.2509362523 2 5695.2696792774 ) 54.1064641659 (ExtendedPoll#64) + 7812 ( 2 0 4281.1646507560 2 5695.4980679496 ) 54.1049615847 (ExtendedPoll#64) + 7813 ( 2 0 4280.9057942672 2 5696.1832339664 ) 54.1004549928 (ExtendedPoll#64) + 7814 ( 2 0 4279.8703683119 2 5698.9238980333 ) 54.0824459107 (ExtendedPoll#64) + 7815 ( 2 0 4275.7286644908 2 5709.8865543012 ) 54.0106865894 (ExtendedPoll#64) + 7816 ( 2 0 4276.7931988063 2 5713.6465440949 ) 53.9642063625 (ExtendedPoll#64) + 7817 ( 2 0 4274.1455108935 2 5720.9891012964 ) 53.9153574311 (ExtendedPoll#64) + 7818 ( 2 0 4264.8649553228 2 5733.5451470685 ) 53.8744070070 (ExtendedPoll#64) + 7825 ( 2 0 4267.0690872708 2 5731.8801062161 ) 53.8711681165 (ExtendedPoll#64) + 7828 ( 2 0 4268.6471229147 2 5730.7285666922 ) 53.8684637360 (ExtendedPoll#64) + 7837 ( 2 0 4268.8897458950 2 5730.7013509085 ) 53.8665809105 (ExtendedPoll#64) + 7840 ( 2 0 4269.1151490944 2 5730.6075484182 ) 53.8655030390 (ExtendedPoll#64) + 7845 ( 2 0 4269.2342348079 2 5730.5807124826 ) 53.8647110142 (ExtendedPoll#64) + 7848 ( 2 0 4269.3362140286 2 5730.5136259757 ) 53.8644648872 (ExtendedPoll#64) + 7849 ( 2 0 4269.6421516907 2 5730.3123664551 ) 53.8637267148 (ExtendedPoll#64) + 7856 ( 2 0 4269.6705853207 2 5730.3012821375 ) 53.8635834586 (ExtendedPoll#64) + 7861 ( 2 0 4269.6856215996 2 5730.3038783910 ) 53.8634248321 (ExtendedPoll#64) + 7864 ( 2 0 4269.6932509707 2 5730.3038560301 ) 53.8633574718 (ExtendedPoll#64) + 7868 ( 2 0 4269.6964158444 2 5730.3017263609 ) 53.8633503046 (ExtendedPoll#64) + 7876 ( 2 0 4269.6971078879 2 5730.3023825398 ) 53.8633377454 (ExtendedPoll#64) + 7877 ( 2 0 4269.6986534873 2 5730.3012649089 ) 53.8633350054 (ExtendedPoll#64) + 7886 ( 2 0 4269.6987532838 2 5730.3011997053 ) 53.8633347603 (ExtendedPoll#64) + 7894 ( 2 0 4269.6987734099 2 5730.3012216853 ) 53.8633343667 (ExtendedPoll#64) + 7896 ( 2 0 4269.6987532218 2 5730.3012436083 ) 53.8633343307 (ExtendedPoll#64) + 7903 ( 2 0 4269.6987565277 2 5730.3012418911 ) 53.8633343182 (ExtendedPoll#64) + 7905 ( 2 0 4269.6987598023 2 5730.3012401148 ) 53.8633343066 (ExtendedPoll#64) + 7915 ( 2 0 4269.6987598456 2 5730.3012400760 ) 53.8633343066 (ExtendedPoll#64) + 7916 ( 2 0 4269.6987599757 2 5730.3012399595 ) 53.8633343066 (ExtendedPoll#64) + 7917 ( 2 0 4269.6987604960 2 5730.3012394935 ) 53.8633343066 (ExtendedPoll#64) + 7927 ( 3 0 3209.7896557217 2 3041.1230842797 1 3749.0872551315 ) 46.5944603702 + 7937 ( 2 0 4909.1597359805 2 5083.8525467227 ) 55.5960690117 (ExtendedPoll#65) + 7938 ( 2 0 4636.6389512227 2 5335.4101941914 ) 54.8753884193 (ExtendedPoll#65) + 7942 ( 2 0 4468.9338529103 2 5503.1152925039 ) 54.4525845141 (ExtendedPoll#65) + 7943 ( 2 0 3965.8185579728 2 6006.2305874414 ) 54.0810898671 (ExtendedPoll#65) + 7951 ( 2 0 4063.6465319884 2 5929.3657507148 ) 53.8515922697 (ExtendedPoll#65) + 7964 ( 2 0 4065.8046023555 2 5931.0905010240 ) 53.8160592307 (ExtendedPoll#65) + 7965 ( 2 0 4064.4534626474 2 5934.7549556868 ) 53.7954447026 (ExtendedPoll#65) + 7971 ( 2 0 4065.1985513690 2 5934.1237414293 ) 53.7942572358 (ExtendedPoll#65) + 7972 ( 2 0 4067.4338175338 2 5932.2300986566 ) 53.7907104457 (ExtendedPoll#65) + 7979 ( 2 0 4067.6763605460 2 5932.2578742164 ) 53.7882192511 (ExtendedPoll#65) + 7988 ( 2 0 4067.6961659596 2 5932.2810920154 ) 53.7878265281 (ExtendedPoll#65) + 7996 ( 2 0 4067.7064620507 2 5932.2843178088 ) 53.7877022834 (ExtendedPoll#65) + 8000 ( 2 0 4067.7096029627 2 5932.2864826593 ) 53.7876537119 (ExtendedPoll#65) + 8001 ( 2 0 4067.7163863700 2 5932.2829908004 ) 53.7876226117 (ExtendedPoll#65) + 8013 ( 2 0 4067.7165647188 2 5932.2828325755 ) 53.7876223942 (ExtendedPoll#65) + 8014 ( 2 0 4067.7170997651 2 5932.2823579007 ) 53.7876217416 (ExtendedPoll#65) + 8015 ( 2 0 4067.7192399506 2 5932.2804592016 ) 53.7876191311 (ExtendedPoll#65) + 8018 ( 2 0 4067.7200409230 2 5932.2799415742 ) 53.7876164105 (ExtendedPoll#65) + 8033 ( 2 0 4067.7200445311 2 5932.2799480928 ) 53.7876163183 (ExtendedPoll#65) + 8037 ( 2 0 4067.7200436470 2 5932.2799517117 ) 53.7876162938 (ExtendedPoll#65) + 8042 ( 2 0 4067.7200455038 2 5932.2799515643 ) 53.7876162780 (ExtendedPoll#65) + 8043 ( 2 0 4067.7200489601 2 5932.2799501743 ) 53.7876162586 (ExtendedPoll#65) + 8051 ( 2 0 4067.7200493934 2 5932.2799500040 ) 53.7876162561 (ExtendedPoll#65) + 8054 ( 2 0 4067.7200493924 2 5932.2799504696 ) 53.7876162519 (ExtendedPoll#65) + 8061 ( 2 0 4067.7200493199 2 5932.2799505607 ) 53.7876162518 (ExtendedPoll#65) + 8062 ( 2 0 4067.7200491022 2 5932.2799508337 ) 53.7876162513 (ExtendedPoll#65) + 8073 ( 2 0 4067.7200491111 2 5932.2799508739 ) 53.7876162509 (ExtendedPoll#65) + 8080 ( 2 0 4664.5898009415 2 5335.4101941914 ) 54.6460175679 (ExtendedPoll#66) + 8081 ( 2 0 3658.3592110666 2 6341.6407840663 ) 54.3665216810 (ExtendedPoll#66) + 8125 ( 2 0 3658.3592086607 2 6341.6407911178 ) 54.3665216529 (ExtendedPoll#66) + 8127 ( 2 0 3658.3592231902 2 6341.6407758540 ) 54.3665216198 (ExtendedPoll#66) + 8128 ( 2 0 3658.3592667787 2 6341.6407300627 ) 54.3665215205 (ExtendedPoll#66) + 8129 ( 2 0 3658.3594411326 2 6341.6405468973 ) 54.3665211233 (ExtendedPoll#66) + 8130 ( 2 0 3658.3601385484 2 6341.6398142359 ) 54.3665195344 (ExtendedPoll#66) + 8131 ( 2 0 3658.3629282116 2 6341.6368835902 ) 54.3665131789 (ExtendedPoll#66) + 8132 ( 2 0 3658.3740868643 2 6341.6251610074 ) 54.3664877574 (ExtendedPoll#66) + 8133 ( 2 0 3658.4187214749 2 6341.5782706765 ) 54.3663860796 (ExtendedPoll#66) + 8134 ( 2 0 3658.5972599177 2 6341.3907093526 ) 54.3659794991 (ExtendedPoll#66) + 8135 ( 2 0 3659.3114136885 2 6340.6404640569 ) 54.3643552693 (ExtendedPoll#66) + 8136 ( 2 0 3662.1680287720 2 6337.6394828742 ) 54.3578918193 (ExtendedPoll#66) + 8137 ( 2 0 3673.5944891057 2 6325.6355581437 ) 54.3325733144 (ExtendedPoll#66) + 8138 ( 2 0 3719.3003304408 2 6277.6198592213 ) 54.2398493355 (ExtendedPoll#66) + 8139 ( 2 0 3902.1236957812 2 6085.5570635318 ) 54.0045822968 (ExtendedPoll#66) + 8141 ( 2 0 3902.2168451994 2 6085.4781750776 ) 54.0043572353 (ExtendedPoll#66) + 8142 ( 2 0 3902.4962934540 2 6085.2415097151 ) 54.0036823026 (ExtendedPoll#66) + 8143 ( 2 0 3903.6140864724 2 6084.2948482648 ) 54.0009863502 (ExtendedPoll#66) + 8144 ( 2 0 3908.0852585462 2 6080.5082024636 ) 53.9902629755 (ExtendedPoll#66) + 8145 ( 2 0 3925.9699468413 2 6065.3616192587 ) 53.9483351232 (ExtendedPoll#66) + 8146 ( 2 0 3929.8118238900 2 6064.6724015289 ) 53.9176744624 (ExtendedPoll#66) + 8149 ( 2 0 3933.6400530629 2 6065.4639783275 ) 53.8745546326 (ExtendedPoll#66) + 8152 ( 2 0 3935.2163827223 2 6064.3107328191 ) 53.8694071337 (ExtendedPoll#66) + 8158 ( 2 0 3934.4145700168 2 6065.4354030875 ) 53.8674407841 (ExtendedPoll#66) + 8164 ( 2 0 3934.3391268516 2 6065.5313647145 ) 53.8673400617 (ExtendedPoll#66) + 8165 ( 2 0 3934.1127973559 2 6065.8192495955 ) 53.8670381792 (ExtendedPoll#66) + 8175 ( 2 0 3934.1264743868 2 6065.8465307696 ) 53.8666759354 (ExtendedPoll#66) + 8177 ( 2 0 3934.1212739663 2 6065.8766020781 ) 53.8664692539 (ExtendedPoll#66) + 8187 ( 2 0 3934.1202740309 2 6065.8782263033 ) 53.8664649210 (ExtendedPoll#66) + 8191 ( 2 0 3934.1223533865 2 6065.8765080955 ) 53.8664598006 (ExtendedPoll#66) + 8192 ( 2 0 3934.1285914536 2 6065.8713534722 ) 53.8664444397 (ExtendedPoll#66) + 8196 ( 2 0 3934.1299504561 2 6065.8700151548 ) 53.8664429271 (ExtendedPoll#66) + 8210 ( 2 0 3934.1299636052 2 6065.8700081445 ) 53.8664428619 (ExtendedPoll#66) + 8211 ( 2 0 3934.1300030527 2 6065.8699871137 ) 53.8664426663 (ExtendedPoll#66) + 8216 ( 2 0 3934.1300169838 2 6065.8699818250 ) 53.8664425790 (ExtendedPoll#66) + 8222 ( 2 0 3934.1300195727 2 6065.8699791463 ) 53.8664425772 (ExtendedPoll#66) + 8223 ( 2 0 3934.1300273392 2 6065.8699711101 ) 53.8664425718 (ExtendedPoll#66) + 8224 ( 2 0 3934.1300584054 2 6065.8699389652 ) 53.8664425505 (ExtendedPoll#66) + 8225 ( 2 0 3934.1301826702 2 6065.8698103857 ) 53.8664424650 (ExtendedPoll#66) + 8226 ( 2 0 3934.1306797292 2 6065.8692960676 ) 53.8664421232 (ExtendedPoll#66) + 8227 ( 2 0 3934.1326679655 2 6065.8672387954 ) 53.8664407559 (ExtendedPoll#66) + 8228 ( 2 0 3934.1406209105 2 6065.8590097066 ) 53.8664352870 (ExtendedPoll#66) + 8229 ( 2 0 3934.1724326905 2 6065.8260933514 ) 53.8664134151 (ExtendedPoll#66) + 8230 ( 2 0 3934.2996798107 2 6065.6944279307 ) 53.8663259908 (ExtendedPoll#66) + 8231 ( 2 0 3934.8086682912 2 6065.1677662475 ) 53.8659772994 (ExtendedPoll#66) + 8232 ( 2 0 3936.8446222133 2 6063.0611195148 ) 53.8645986296 (ExtendedPoll#66) + 8233 ( 2 0 3944.9884379019 2 6054.6345325840 ) 53.8593413213 (ExtendedPoll#66) + 8234 ( 2 0 3977.5637006562 2 6020.9281848608 ) 53.8424195173 (ExtendedPoll#66) + 8235 ( 2 0 4107.8647516735 2 5886.1027939679 ) 53.8397272797 (ExtendedPoll#66) + 8238 ( 2 0 4107.9148966216 2 5886.1375900537 ) 53.8389476963 (ExtendedPoll#66) + 8239 ( 2 0 4108.0653314659 2 5886.2419783111 ) 53.8366089797 (ExtendedPoll#66) + 8240 ( 2 0 4108.6670708432 2 5886.6595313405 ) 53.8272546148 (ExtendedPoll#66) + 8241 ( 2 0 4111.0740283523 2 5888.3297434584 ) 53.7898451866 (ExtendedPoll#66) + 8242 ( 2 0 4110.6415612866 2 5889.2053399927 ) 53.7857457298 (ExtendedPoll#66) + 8247 ( 2 0 4110.3275535183 2 5889.5792704659 ) 53.7851798069 (ExtendedPoll#66) + 8255 ( 2 0 4110.3514722870 2 5889.6354230117 ) 53.7844442616 (ExtendedPoll#66) + 8257 ( 2 0 4110.3094657512 2 5889.6797036381 ) 53.7844214421 (ExtendedPoll#66) + 8258 ( 2 0 4110.1834461437 2 5889.8125455175 ) 53.7843530488 (ExtendedPoll#66) + 8267 ( 2 0 4110.1987859472 2 5889.7973681491 ) 53.7843522353 (ExtendedPoll#66) + 8268 ( 2 0 4110.2448053575 2 5889.7518360439 ) 53.7843498028 (ExtendedPoll#66) + 8269 ( 2 0 4110.4288829988 2 5889.5697076232 ) 53.7843401922 (ExtendedPoll#66) + 8276 ( 2 0 4110.4212701576 2 5889.5773535241 ) 53.7843395401 (ExtendedPoll#66) + 8277 ( 2 0 4110.3984316340 2 5889.6002912268 ) 53.7843375858 (ExtendedPoll#66) + 8278 ( 2 0 4110.3070775395 2 5889.6920420376 ) 53.7843297986 (ExtendedPoll#66) + 8291 ( 2 0 4110.3073348959 2 5889.6924434618 ) 53.7843237498 (ExtendedPoll#66) + 8296 ( 2 0 4110.3074006879 2 5889.6925428714 ) 53.7843222330 (ExtendedPoll#66) + 8298 ( 2 0 4110.3073219352 2 5889.6926323636 ) 53.7843221306 (ExtendedPoll#66) + 8299 ( 2 0 4110.3070856770 2 5889.6929008404 ) 53.7843218236 (ExtendedPoll#66) + 8307 ( 2 0 4110.3070782245 2 5889.6929137441 ) 53.7843217731 (ExtendedPoll#66) + 8312 ( 2 0 4110.3070784835 2 5889.6929211901 ) 53.7843217023 (ExtendedPoll#66) + 8322 ( 2 0 4110.3070782010 2 5889.6929215603 ) 53.7843217014 (ExtendedPoll#66) + 8326 ( 2 0 4110.3070784332 2 5889.6929215433 ) 53.7843216995 (ExtendedPoll#66) + 8333 ( 2 0 4110.3070784211 2 5889.6929215697 ) 53.7843216993 (ExtendedPoll#66) + 8337 ( 3 0 3209.7896175644 2 3041.1231297861 1 3749.0872500424 ) 46.5944602659 + 8345 ( 2 0 4720.4915015090 2 5223.6067964464 ) 55.4583179990 (ExtendedPoll#67) + 8347 ( 2 0 4385.0813048840 2 5559.0169930714 ) 54.5837536455 (ExtendedPoll#67) + 8352 ( 2 0 4580.7372529152 2 5419.2627444776 ) 54.4134065463 (ExtendedPoll#67) + 8360 ( 2 0 4558.0271875187 2 5440.6626137936 ) 54.3705316119 (ExtendedPoll#67) + 8361 ( 2 0 4489.8969913293 2 5504.8622217413 ) 54.2562699395 (ExtendedPoll#67) + 8362 ( 2 0 4217.3762065715 2 5761.6606535323 ) 54.0237236224 (ExtendedPoll#67) + 8372 ( 2 0 4224.1455529878 2 5775.7452613984 ) 53.8272825836 (ExtendedPoll#67) + 8381 ( 2 0 4224.0014506112 2 5775.9423292618 ) 53.8266734099 (ExtendedPoll#67) + 8383 ( 2 0 4224.5165513001 2 5775.4823531964 ) 53.8264974549 (ExtendedPoll#67) + 8396 ( 2 0 4224.5193698410 2 5775.4797826488 ) 53.8264970122 (ExtendedPoll#67) + 8397 ( 2 0 4224.5278254637 2 5775.4720710060 ) 53.8264956843 (ExtendedPoll#67) + 8413 ( 2 0 4224.5278620041 2 5775.4721180965 ) 53.8264949041 (ExtendedPoll#67) + 8416 ( 2 0 4224.5278401629 2 5775.4721383731 ) 53.8264949041 (ExtendedPoll#67) + 8417 ( 2 0 4224.5277746392 2 5775.4721992028 ) 53.8264949041 (ExtendedPoll#67) + 8418 ( 2 0 4224.5275125446 2 5775.4724425218 ) 53.8264949040 (ExtendedPoll#67) + 8419 ( 2 0 4224.5264641662 2 5775.4734157976 ) 53.8264949035 (ExtendedPoll#67) + 8420 ( 2 0 4224.5222706526 2 5775.4773089008 ) 53.8264949018 (ExtendedPoll#67) + 8421 ( 2 0 4224.5054965982 2 5775.4928813139 ) 53.8264948957 (ExtendedPoll#67) + 8422 ( 2 0 4224.4384003804 2 5775.5551709661 ) 53.8264948856 (ExtendedPoll#67) + 8424 ( 2 0 4224.4377205871 2 5775.5589246019 ) 53.8264648146 (ExtendedPoll#67) + 8427 ( 2 0 4224.4354746818 2 5775.5620080759 ) 53.8264551993 (ExtendedPoll#67) + 8428 ( 2 0 4224.4287369659 2 5775.5712584979 ) 53.8264263535 (ExtendedPoll#67) + 8449 ( 2 0 4224.4287371566 2 5775.5712603508 ) 53.8264263340 (ExtendedPoll#67) + 8451 ( 2 0 4224.4287369462 2 5775.5712622015 ) 53.8264263180 (ExtendedPoll#67) + 8453 ( 2 0 4224.4287384895 2 5775.5712611586 ) 53.8264263143 (ExtendedPoll#67) + 8461 ( 2 0 4224.4287387223 2 5775.5712611587 ) 53.8264263122 (ExtendedPoll#67) + 8464 ( 2 0 4224.4287389206 2 5775.5712610366 ) 53.8264263116 (ExtendedPoll#67) + 8469 ( 2 0 4224.4287388106 2 5775.5712611591 ) 53.8264263114 (ExtendedPoll#67) + 8475 ( 2 0 4224.4287388393 2 5775.5712611545 ) 53.8264263112 (ExtendedPoll#67) + 8483 ( 2 0 4748.4423512277 2 5251.5576461652 ) 54.9123289774 (ExtendedPoll#68) + 8484 ( 2 0 3993.7694088215 2 6006.2305885713 ) 53.8183150359 (ExtendedPoll#68) + 8529 ( 2 0 3993.7694094976 2 6006.2305892118 ) 53.8183150239 (ExtendedPoll#68) + 8530 ( 2 0 3993.7694111450 2 6006.2305883426 ) 53.8183150161 (ExtendedPoll#68) + 8541 ( 2 0 3993.7694114742 2 6006.2305883502 ) 53.8183150129 (ExtendedPoll#68) + 8543 ( 2 0 3993.7694113839 2 6006.2305885648 ) 53.8183150119 (ExtendedPoll#68) + 8548 ( 2 0 3993.7694115223 2 6006.2305884756 ) 53.8183150114 (ExtendedPoll#68) + 8556 ( 3 0 3209.7895991439 2 3041.1231230634 1 3749.0872724849 ) 46.5944602388 + 8557 ( 3 0 3209.7895438823 2 3041.1231028951 1 3749.0873398125 ) 46.5944601576 + 8558 ( 3 0 3209.7893228358 2 3041.1230222222 1 3749.0876091228 ) 46.5944598326 + 8559 ( 3 0 3209.7884386500 2 3041.1226995306 1 3749.0886863640 ) 46.5944585328 + 8560 ( 3 0 3209.7849019068 2 3041.1214087641 1 3749.0929953290 ) 46.5944533336 + 8561 ( 3 0 3209.7707549341 2 3041.1162456982 1 3749.1102311888 ) 46.5944325369 + 8562 ( 3 0 3209.7141670434 2 3041.0955934346 1 3749.1791746282 ) 46.5943493545 + 8563 ( 3 0 3209.4878154802 2 3041.0129843799 1 3749.4549483857 ) 46.5940166899 + 8564 ( 3 0 3208.5824092276 2 3040.6825481613 1 3750.5580434156 ) 46.5926870780 + 8565 ( 3 0 3204.9607842173 2 3039.3608032869 1 3754.9704235351 ) 46.5873853782 + 8566 ( 3 0 3190.4742841761 2 3034.0738237895 1 3772.6199440134 ) 46.5664471002 + 8567 ( 3 0 3132.5282840110 2 3012.9259057995 1 3843.2180259264 ) 46.4870256328 + 8568 ( 3 0 2900.7442833508 2 2928.3342338397 1 4125.6103535787 ) 46.2408879908 + 8570 ( 3 0 2900.7614274922 2 2928.3321612234 1 4125.8538859951 ) 46.2381909255 + 8571 ( 3 0 2900.8128599165 2 2928.3259433745 1 4126.5844832443 ) 46.2301005176 + 8572 ( 3 0 2901.0185896137 2 2928.3010719787 1 4129.5068722413 ) 46.1977507173 + 8573 ( 3 0 2901.8415084025 2 2928.2015863959 1 4141.1964282293 ) 46.0685414984 + 8574 ( 3 0 2900.9072090155 2 2929.0263074597 1 4144.8990220964 ) 46.0294803754 + 8575 ( 3 0 2898.1043108544 2 2931.5004706513 1 4156.0068036976 ) 45.9126009127 + 8576 ( 3 0 2893.3059337557 2 2930.6699823072 1 4170.8633174072 ) 45.8058560157 + 8577 ( 3 0 2906.2246413292 2 2906.6780968135 1 4186.3657664955 ) 45.7664430594 + 8584 ( 3 0 2885.1856032809 2 2904.8325671601 1 4209.2503341972 ) 45.7234233185 + 8585 ( 3 0 2822.0684891358 2 2899.2959782000 1 4277.9040373024 ) 45.6027586237 + 8586 ( 3 0 2569.6000325554 2 2877.1496223596 1 4552.5188497232 ) 45.2497134209 + 8603 ( 3 0 2569.6580658121 2 2876.7761909688 1 4553.4192663392 ) 45.2437144482 + 8604 ( 3 0 2570.2146083482 2 2875.2291180641 1 4554.4732367897 ) 45.2420565509 + 8618 ( 3 0 2570.1792950214 2 2875.1673676151 1 4554.5724351350 ) 45.2419430091 + 8619 ( 3 0 2570.0733550410 2 2874.9821162682 1 4554.8700301708 ) 45.2416024126 + 8620 ( 3 0 2569.6495951193 2 2874.2411108805 1 4556.0604103143 ) 45.2402404599 + 8627 ( 3 0 2569.2779660036 2 2874.5306463677 1 4556.1885520705 ) 45.2397502250 + 8644 ( 3 0 2569.2890178965 2 2874.5245089523 1 4556.1847035137 ) 45.2397436100 + 8655 ( 3 0 2569.2838215385 2 2874.5258438228 1 4556.1885598972 ) 45.2397403650 + 8656 ( 3 0 2569.2682324643 2 2874.5298484341 1 4556.2001290477 ) 45.2397306308 + 8657 ( 3 0 2569.2058761675 2 2874.5458668797 1 4556.2464056497 ) 45.2396917036 + 8658 ( 3 0 2568.9564509805 2 2874.6099406618 1 4556.4315120578 ) 45.2395361495 + 8659 ( 3 0 2567.9587502324 2 2874.8662357905 1 4557.1719376902 ) 45.2389164047 + 8660 ( 3 0 2563.9679472400 2 2875.8914163050 1 4560.1336402198 ) 45.2364769895 + 8661 ( 3 0 2548.0047352705 2 2879.9921383632 1 4571.9804503382 ) 45.2273531705 + 8662 ( 3 0 2484.1518873922 2 2896.3950265960 1 4619.3676908119 ) 45.2010503608 + 8674 ( 3 0 2484.0736686549 2 2896.3896310350 1 4619.4612514156 ) 45.2009055791 + 8675 ( 3 0 2483.8390124432 2 2896.3734443522 1 4619.7419332265 ) 45.2004713862 + 8688 ( 3 0 2483.8404577833 2 2896.3642671817 1 4619.7710023038 ) 45.2002598293 + 8695 ( 3 0 2483.8253676018 2 2896.3813588741 1 4619.7912874024 ) 45.2000581939 + 8711 ( 3 0 2483.8253703113 2 2896.3815984832 1 4619.7922104815 ) 45.2000473949 + 8713 ( 3 0 2483.8245414630 2 2896.3833077377 1 4619.7920389071 ) 45.2000420407 + 8716 ( 3 0 2483.8258603227 2 2896.3779360857 1 4619.7956529999 ) 45.2000411600 + 8717 ( 3 0 2483.8298169016 2 2896.3618211298 1 4619.8064952782 ) 45.2000385180 + 8718 ( 3 0 2483.8456432174 2 2896.2973613061 1 4619.8498643917 ) 45.2000279546 + 8719 ( 3 0 2483.9089484806 2 2896.0395220115 1 4620.0233408456 ) 45.1999857711 + 8720 ( 3 0 2484.1621695335 2 2895.0081648328 1 4620.7172466613 ) 45.1998181601 + 8721 ( 3 0 2485.1750537449 2 2890.8827361181 1 4623.4928699239 ) 45.1991656831 + 8722 ( 3 0 2489.2265905905 2 2874.3810212593 1 4634.5953629742 ) 45.1968429324 + 8723 ( 3 0 2505.4327379729 2 2808.3741618241 1 4679.0053351755 ) 45.1921264676 + 8726 ( 3 0 2505.3685769810 2 2808.4952747076 1 4679.9720755135 ) 45.1823799799 + 8727 ( 3 0 2505.1760940054 2 2808.8586133581 1 4682.8722965274 ) 45.1531602599 + 8728 ( 3 0 2503.1517786669 2 2810.5022882056 1 4685.7790057314 ) 45.1291493448 + 8737 ( 3 0 2502.1929683392 2 2809.7986800253 1 4687.3275204562 ) 45.1288718569 + 8738 ( 3 0 2499.3165373560 2 2807.6878554842 1 4691.9730646305 ) 45.1280529948 + 8739 ( 3 0 2487.8108134233 2 2799.2445573201 1 4710.5552413278 ) 45.1249818571 + 8740 ( 3 0 2441.7879176925 2 2765.4713646635 1 4784.8839481171 ) 45.1159841138 + 8743 ( 3 0 2462.0887438795 2 2743.6941147538 1 4794.1115963840 ) 45.0330234211 + 8759 ( 3 0 2462.3136002207 2 2743.6052851221 1 4794.0775784423 ) 45.0321070688 + 8775 ( 3 0 2462.3185474349 2 2743.6003098574 1 4794.0805750106 ) 45.0320771528 + 8785 ( 3 0 2462.3197386852 2 2743.5989064226 1 4794.0810742815 ) 45.0320738114 + 8792 ( 3 0 2462.3211643858 2 2743.5976465736 1 4794.0809396072 ) 45.0320731778 + 8793 ( 3 0 2462.3254414876 2 2743.5938670266 1 4794.0805355845 ) 45.0320712769 + 8811 ( 3 0 2462.3255079460 2 2743.5937832827 1 4794.0805883207 ) 45.0320709008 + 8812 ( 3 0 2462.3257073210 2 2743.5935320511 1 4794.0807465293 ) 45.0320697728 + 8825 ( 3 0 2462.3257104845 2 2743.5935091129 1 4794.0807652912 ) 45.0320697624 + 8826 ( 3 0 2462.3257199749 2 2743.5934402983 1 4794.0808215770 ) 45.0320697313 + 8827 ( 3 0 2462.3257579368 2 2743.5931650398 1 4794.0810467200 ) 45.0320696068 + 8828 ( 3 0 2462.3259097844 2 2743.5920640060 1 4794.0819472921 ) 45.0320691088 + 8829 ( 3 0 2462.3265171749 2 2743.5876598710 1 4794.0855495803 ) 45.0320671166 + 8830 ( 3 0 2462.3289467365 2 2743.5700433307 1 4794.0999587333 ) 45.0320591485 + 8831 ( 3 0 2462.3386649831 2 2743.4995771695 1 4794.1575953453 ) 45.0320272796 + 8832 ( 3 0 2462.3775379695 2 2743.2177125248 1 4794.3881417933 ) 45.0318998663 + 8833 ( 3 0 2462.5330299152 2 2742.0902539461 1 4795.3103275852 ) 45.0313912035 + 8834 ( 3 0 2463.1549976977 2 2737.5804196312 1 4798.9990707529 ) 45.0293724005 + 8835 ( 3 0 2465.6428688278 2 2719.5410823714 1 4813.7540434236 ) 45.0215504519 + 8836 ( 3 0 2475.5943533484 2 2647.3837333325 1 4872.7739341066 ) 44.9942951687 + 8837 ( 3 0 2515.4002914308 2 2358.7543371766 1 5108.8534968384 ) 44.9485005040 + 8839 ( 3 0 2515.2855315668 2 2358.6893426326 1 5109.0589561943 ) 44.9480836817 + 8840 ( 3 0 2514.9412519750 2 2358.4943590004 1 5109.6753342622 ) 44.9468335445 + 8841 ( 3 0 2513.5641336077 2 2357.7144244716 1 5112.1408465335 ) 44.9418379464 + 8842 ( 3 0 2508.0556601384 2 2354.5946863564 1 5122.0028956186 ) 44.9219348254 + 8843 ( 3 0 2486.0217662612 2 2342.1157338955 1 5161.4510919593 ) 44.8435947921 + 8844 ( 3 0 2483.0458496952 2 2338.7707113988 1 5167.8643075048 ) 44.8377804120 + 8845 ( 3 0 2474.1180999970 2 2328.7356439086 1 5187.1039541411 ) 44.8205099552 + 8846 ( 3 0 2438.4071012044 2 2288.5953739479 1 5264.0625406864 ) 44.7540328039 + 8847 ( 3 0 2295.5631060339 2 2128.0342941051 1 5571.8968868678 ) 44.5306991822 + 8854 ( 3 0 2246.8411231851 2 2159.0391922817 1 5594.0432427082 ) 44.4908538729 + 8880 ( 3 0 2246.8591149590 2 2159.0973578929 1 5594.0389538567 ) 44.4902351182 + 8889 ( 3 0 2246.8486392353 2 2159.1084209401 1 5594.0397904890 ) 44.4902262093 + 8902 ( 3 0 2246.8540260785 2 2159.1053127856 1 5594.0375595191 ) 44.4902251751 + 8903 ( 3 0 2246.8701866083 2 2159.0959883223 1 5594.0308666095 ) 44.4902220731 + 8904 ( 3 0 2246.9348287276 2 2159.0586904689 1 5594.0040949708 ) 44.4902096777 + 8905 ( 3 0 2247.1933972044 2 2158.9094990553 1 5593.8970084161 ) 44.4901602933 + 8926 ( 3 0 2247.1934312789 2 2158.9093352501 1 5593.8971782696 ) 44.4901598382 + 8932 ( 3 0 2247.1936064494 2 2158.9091736740 1 5593.8971710678 ) 44.4901597251 + 8933 ( 3 0 2247.1941319611 2 2158.9086889458 1 5593.8971494625 ) 44.4901593859 + 8943 ( 3 0 2247.1941525712 2 2158.9086089656 1 5593.8972354233 ) 44.4901591006 + 8960 ( 3 0 2247.1941592110 2 2158.9086060982 1 5593.8972336338 ) 44.4901590823 + 8968 ( 3 0 2247.1941622393 2 2158.9086061446 1 5593.8972314647 ) 44.4901590747 + 8978 ( 3 0 2247.1941629850 2 2158.9086060136 1 5593.8972309224 ) 44.4901590742 + 8987 ( 3 0 2247.1941631028 2 2158.9086062984 1 5593.8972305733 ) 44.4901590739 + 8997 ( 3 0 2247.1941631943 2 2158.9086062904 1 5593.8972305018 ) 44.4901590738 + 9010 ( 3 0 2247.1941631861 2 2158.9086062987 1 5593.8972305106 ) 44.4901590737 + 9020 ( 3 0 2247.1941631897 2 2158.9086062984 1 5593.8972305098 ) 44.4901590737 + 9026 ( 3 0 2247.1941631931 2 2158.9086062979 1 5593.8972305086 ) 44.4901590737 + 9036 ( 3 0 2247.1941631947 2 2158.9086062989 1 5593.8972305060 ) 44.4901590737 + 9046 ( 3 0 2247.1941631950 2 2158.9086062987 1 5593.8972305061 ) 44.4901590737 + 9055 ( 3 0 2247.1941631952 2 2158.9086062985 1 5593.8972305062 ) 44.4901590737 + 9064 ( 3 0 2247.1941631953 2 2158.9086062986 1 5593.8972305060 ) 44.4901590737 + 9073 ( 3 0 2247.1941631953 2 2158.9086062986 1 5593.8972305061 ) 44.4901590737 + 9090 ( 3 0 2247.1941631953 2 2158.9086062986 1 5593.8972305061 ) 44.4901590737 } end of run (mesh index limits) -blackbox evaluations : 9091 +blackbox evaluations : 9090 best feasible solution : ( 3 0 2247.194163 2 2158.908606 1 5593.897231 ) h=0 f=44.49015907 diff --git a/examples/advanced/multi_start/best_x.txt b/examples/advanced/multi_start/best_x.txt index 821eea67409cb1cc7edaf3d706d1960974d69f33..719c96c736b8e6c28e3fe02cee11cade273d9536 100644 --- a/examples/advanced/multi_start/best_x.txt +++ b/examples/advanced/multi_start/best_x.txt @@ -1 +1 @@ -0.9999740474925636890546343238384 3.9134074383641649674033663464101e-05 0.99997595080463674843684884763206 0.99999589110497688615453171223635 0.99999324108060483329296630472527 \ No newline at end of file +0.99997404758823804638012688883464 3.9134551244589541117279568593901e-05 0.99997595072021128181916083121905 0.99999589126391608129296173501643 0.99999324126388144939880930905929 \ No newline at end of file diff --git a/examples/advanced/multi_start/makefile b/examples/advanced/multi_start/makefile index 841008f34fe4a91382215906f2ece97cb01a4d0a..f60f005b17b8812da6bb9f70c99891137bbeb90f 100644 --- a/examples/advanced/multi_start/makefile +++ b/examples/advanced/multi_start/makefile @@ -15,7 +15,7 @@ endif LDLIBS = -lm -lnomad -INCLUDE = -I$(NOMAD_HOME)/src -I. +INCLUDE = -I$(NOMAD_HOME)/src -I$(NOMAD_HOME)/ext/sgtelib/src -I. COMPILE = $(COMPILATOR) $(COMPILATOR_OPTIONS) $(INCLUDE) -c OBJS = multi.o diff --git a/examples/advanced/multi_start/param.txt b/examples/advanced/multi_start/param.txt index 09df94229bef78206defdabb33a7244c132000ac..0e2931d356f058227efdcf2c13dd8433ec060911 100644 --- a/examples/advanced/multi_start/param.txt +++ b/examples/advanced/multi_start/param.txt @@ -1,13 +1,13 @@ - -MAX_CACHE_MEMORY 750 - -initial_mesh_size r0.1 - -opportunistic_eval no - -DIRECTION_TYPE ortho 2n -DIRECTION_TYPE Lt -DIRECTION_TYPE Gps -DIRECTION_TYPE Gps n+1 rand - -MAX_BB_EVAL 1000 + +MAX_CACHE_MEMORY 750 + +initial_mesh_size r0.1 + +opportunistic_eval no + +DIRECTION_TYPE ortho 2n +DIRECTION_TYPE Lt +DIRECTION_TYPE Gps +DIRECTION_TYPE Gps n+1 rand + +MAX_BB_EVAL 1000 diff --git a/examples/advanced/multi_start/runExample.log b/examples/advanced/multi_start/runExample.log index ffc68d1aca8f4199467ba8ffdf5059cbaabc8f8d..64ab9497713efe5c960dbb45c6c4fedaff13d767 100644 --- a/examples/advanced/multi_start/runExample.log +++ b/examples/advanced/multi_start/runExample.log @@ -1,21 +1,26 @@ -starting point # 0: ( 0.5802249825 1.631108467 1.028915701 1.041199968 0.8987064366 1.883811294 1.475481573 ) -starting point # 1: ( 4.046907118 0.2179386209 0.3995457903 2.86002185 2.869872299 1.805805862 0.9241232544 ) -starting point # 2: ( 2.730496038 4.019688198 2.015450408 3.887235003 1.919237215 0.004176816764 2.788539635 ) -starting point # 3: ( 1.986593711 1.814325217 1.166098379 0.9517739273 0.4086947283 3.9836116 2.239536416 ) -starting point # 4: ( 1.072412482 2.713920967 3.075009451 0.3310437183 1.032300187 3.079123794 3.985637823 ) + ./multi.exe param.txt 4 5 +>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> + + + +starting point # 0: ( 0.9999740476 3.913455159e-05 0.9999759507 0.9999958913 0.9999932413 ) +starting point # 1: ( 4.046907118 0.2179386209 0.3995457903 2.86002185 2.869872299 ) +starting point # 2: ( 2.730496038 4.019688198 2.015450408 3.887235003 1.919237215 ) +starting point # 3: ( 1.986593711 1.814325217 1.166098379 0.9517739273 0.4086947283 ) +starting point # 4: ( 1.072412482 2.713920967 3.075009451 0.3310437183 1.032300187 ) Warning: { Anisotropic mesh is disabled for direction types other than OrthoMads. } -run # 0: f=1.933149587 -run # 1: f=1.998299291 -run # 2: f=2.185446803 -run # 3: f=1.978020317 -run # 4: f=2.037153616 +run # 0: f=1.414178206 +run # 1: f=2.002107118 +run # 2: f=1.544496378 +run # 3: f=2.000045217 +run # 4: f=1.45209327 bb eval : 5000 -best : 1.933149587 -worst : 2.185446803 -solution: x = ( 0.6020877754 1.616716377 1.043857108 1.033179949 0.9025516515 1.899521743 1.402861944 ) f(x) = 1.933149587 +best : 1.414178206 +worst : 2.002107118 +solution: x = ( 0.9999740476 3.913455124e-05 0.9999759507 0.9999958913 0.9999932413 ) f(x) = 1.414178206 diff --git a/examples/advanced/plot/problems/02/param.txt b/examples/advanced/plot/problems/02/param.txt index a6d3a844dc8038d6828b42f653cb56d93c72142d..67ae450ebd31c799ca1334baa86347b15c2d54d8 100644 --- a/examples/advanced/plot/problems/02/param.txt +++ b/examples/advanced/plot/problems/02/param.txt @@ -1,34 +1,34 @@ -###################################### -# Deb, Discontinuous, alpha=2, q=4 # -###################################### - -DIMENSION 2 - -display_degree 4 - -TMP_DIR /tmp -BB_EXE bb.exe -BB_OUTPUT_TYPE OBJ OBJ - -x0 ( 0.51 0.51 ) - -#vns_search yes - -#initial_mesh_size r0.01 - -lower_bound * 0.0 -upper_bound * 1.0 - -DIRECTION_TYPE ORTHO - -#MAX_BB_EVAL 5 -MULTI_OVERALL_BB_EVAL 500 -#MULTI_NB_MADS_RUNS 0 -#MULTI_USE_DELTA_CRIT yes - -# f1_min f1_max f2_min f2_max -MULTI_F_BOUNDS 0.0 2.0 -1.0 10.0 - -ADD_SEED_TO_FILE_NAMES no -STATS_FILE front.txt OBJ, -#HISTORY_FILE history.txt +###################################### +# Deb, Discontinuous, alpha=2, q=4 # +###################################### + +DIMENSION 2 + +display_degree 4 + +TMP_DIR /tmp +BB_EXE bb.exe +BB_OUTPUT_TYPE OBJ OBJ + +x0 ( 0.51 0.51 ) + +#vns_search yes + +#initial_mesh_size r0.01 + +lower_bound * 0.0 +upper_bound * 1.0 + +DIRECTION_TYPE ORTHO + +#MAX_BB_EVAL 5 +MULTI_OVERALL_BB_EVAL 500 +#MULTI_NB_MADS_RUNS 0 +#MULTI_USE_DELTA_CRIT yes + +# f1_min f1_max f2_min f2_max +MULTI_F_BOUNDS 0.0 2.0 -1.0 10.0 + +ADD_SEED_TO_FILE_NAMES no +STATS_FILE front.txt OBJ, +#HISTORY_FILE history.txt diff --git a/examples/advanced/plot/readme.txt b/examples/advanced/plot/readme.txt index 78c1ab8939d3dfd16186ad90629f6b6d97bbaa1b..fe7ef8566da0de104cf63857199b95bf73f9cc1b 100644 --- a/examples/advanced/plot/readme.txt +++ b/examples/advanced/plot/readme.txt @@ -1,12 +1,12 @@ -This example illustrates an application of the NOMAD library in order to graphically represent the outputs of an execution. It must not be considered as a graphical user interface of the code, as it is very simple and incomplete for such a purpose. The objective of this example is simply to illustrate a library usage of NOMAD and some links that can be made with another language such as JAVA. - -The example has been developed by Quentin Reynaud from ISIMA. It has been tested on a MAC with the C++ and JAVA compilers included in the XCODE package. - -The example is composed of two programs: The first is a JAVA application that runs in background and periodically checks NOMAD outputs in order to draw them. The other program uses the NOMAD library in order to optimize single or bi-objective problems and to communicate outputs to the JAVA application. - -Open a console, and from the plot directory, go to GUI/src. Compile the JAVA code with the command 'javac *.java'. This generates .class files that you have to move in plot/GUI/bin. Go to this last directory, and execute the JAVA application in the background with the command 'java Prog'. - -To execute the NOMAD code associated with the JAVA graphical interface, go to the plot directory and compile with 'make' (NOMAD must be installed and the $NOMAD_HOME environment variable must be defined). -This generates the executable file 'nomad_plot.exe', and you can run it on the two test problems located in the plot/problems directory. - +This example illustrates an application of the NOMAD library in order to graphically represent the outputs of an execution. It must not be considered as a graphical user interface of the code, as it is very simple and incomplete for such a purpose. The objective of this example is simply to illustrate a library usage of NOMAD and some links that can be made with another language such as JAVA. + +The example has been developed by Quentin Reynaud from ISIMA. It has been tested on a MAC with the C++ and JAVA compilers included in the XCODE package. + +The example is composed of two programs: The first is a JAVA application that runs in background and periodically checks NOMAD outputs in order to draw them. The other program uses the NOMAD library in order to optimize single or bi-objective problems and to communicate outputs to the JAVA application. + +Open a console, and from the plot directory, go to GUI/src. Compile the JAVA code with the command 'javac *.java'. This generates .class files that you have to move in plot/GUI/bin. Go to this last directory, and execute the JAVA application in the background with the command 'java Prog'. + +To execute the NOMAD code associated with the JAVA graphical interface, go to the plot directory and compile with 'make' (NOMAD must be installed and the $NOMAD_HOME environment variable must be defined). +This generates the executable file 'nomad_plot.exe', and you can run it on the two test problems located in the plot/problems directory. + For examples, type './nomad_plot.exe ./problems/01/param_single_obj.txt' to execute on a single-objective problem. Try also the bi-objective version of the same problem with the parameters file param_bi_obj, or 02 instead of 01 for another bi-objective execution. Black-box executables must have been compiled beforehand with command 'g++ -o bb.exe bb.cpp'. \ No newline at end of file diff --git a/examples/advanced/restart/makefile b/examples/advanced/restart/makefile index a4770d4a8100ea4032c1d573c29c84610e7a0088..6c04997ac8230859f89a30beb4ae787939f813e8 100644 --- a/examples/advanced/restart/makefile +++ b/examples/advanced/restart/makefile @@ -24,7 +24,7 @@ CXXFLAGS_MPI = $(CXXFLAGS) -DUSE_MPI LDLIBS = -lm -lnomad LDLIBS_MPI = -lm -lmpi -lnomad.MPI -INCLUDE = -I$(NOMAD_HOME)/src -I. +INCLUDE = -I$(NOMAD_HOME)/src -I$(NOMAD_HOME)/ext/sgtelib/src -I. COMPILE = $(COMPILATOR) $(COMPILATOR_OPTIONS) $(INCLUDE) -c COMPILE_MPI = $(COMPILATOR_MPI) $(COMPILATOR_OPTIONS_MPI) $(INCLUDE) -c OBJS = restart.o diff --git a/examples/advanced/restart/restart.cpp b/examples/advanced/restart/restart.cpp index 9c5c7b559bbbd9ee2ec36109169c76a47ea09b07..522eb66c1d9ab6f63692dc26927a78f89167c3d2 100644 --- a/examples/advanced/restart/restart.cpp +++ b/examples/advanced/restart/restart.cpp @@ -70,7 +70,7 @@ void My_Evaluator::update_iteration ( success_type success , bool & stop ) { - if ( success == UNSUCCESSFUL ) + if ( success == UNSUCCESSFUL && stats.get_bb_eval() > 10 ) stop = true; } @@ -169,7 +169,7 @@ int main ( int argc , char ** argv ) p.check(); // reset the Mads object: - mads.reset ( false , false ); + mads.reset ( ); } diff --git a/examples/advanced/restart/runExample.log b/examples/advanced/restart/runExample.log index e0e3dcf66b2bfe235fa2fb5acb905702e32b6daf..827c768e276e09da12d6e39187b02445699dcd83 100644 --- a/examples/advanced/restart/runExample.log +++ b/examples/advanced/restart/runExample.log @@ -5,15 +5,18 @@ MADS run { BBE ( SOL ) OBJ - 2 ( 0.0000000000 0.5366563146 0.5813776741 -0.2683281573 0.2683281573 ) 288.7937255854 (PhaseOne) - 3 ( 0.0000000000 2.1466252584 2.3255106966 -1.0733126292 1.0733126292 ) 0.0000000000 (PhaseOne) - 3 ( 0.0000000000 2.1466252584 2.3255106966 -1.0733126292 1.0733126292 ) 1.0733126292 - 9 ( 0.0000000000 2.1466252584 2.3255106966 -1.0733126292 1.0733126292 ) 1.0733126292 + 2 ( 0.0000000000 1.0000000000 1.0000000000 -1.0000000000 1.0000000000 ) 144.0000000000 (PhaseOne) + 4 ( 0.0000000000 3.0000000000 2.0000000000 -2.0000000000 1.0000000000 ) 0.0000000000 (PhaseOne) + 4 ( 0.0000000000 3.0000000000 2.0000000000 -2.0000000000 1.0000000000 ) 1.0000000000 + 12 ( 0.5000000000 3.0300000000 2.0600000000 -2.0100000000 0.9400000000 ) 0.9400000000 + 13 ( 2.0000000000 3.1200000000 2.2400000000 -2.0400000000 0.7600000000 ) 0.7600000000 + 16 ( 2.0000000000 3.1200000000 0.2400000000 -1.0400000000 -1.2400000000 ) -1.2400000000 + 23 ( 2.0000000000 3.1200000000 0.2400000000 -1.0400000000 -1.2400000000 ) -1.2400000000 } end of run (terminated by the user inside Evaluator::update_iteration()) -blackbox evaluations : 9 -best feasible solution : ( 0 2.146625258 2.325510697 -1.073312629 1.073312629 ) h=0 f=1.073312629 +blackbox evaluations : 23 +best feasible solution : ( 2 3.12 0.24 -1.04 -1.24 ) h=0 f=-1.24 } MADS run #1 { @@ -22,18 +25,13 @@ MADS run { BBE ( SOL ) OBJ - 9 ( -0.4919349550 2.6832815730 2.9068883707 -0.5366563146 1.0733126292 ) 1.0733126292 - 11 ( -0.4919349550 3.0857738089 2.9068883707 -0.5366563146 0.8720665112 ) 0.8720665112 - 12 ( -0.4919349550 4.2932505168 2.9068883707 -0.5366563146 0.2683281573 ) 0.2683281573 - 20 ( 0.0000000000 3.6224301235 2.6161995337 -0.0670820393 -1.0733126292 ) -1.0733126292 - 27 ( -0.2459674775 4.1590864381 2.9068883707 -0.6037383539 -1.4087228258 ) -1.4087228258 - 29 ( 2.4596747752 1.4758048651 0.7267220927 -0.6708203932 -3.4211840056 ) -3.4211840056 - 36 ( 2.4596747752 1.4758048651 0.7267220927 -0.6708203932 -3.4211840056 ) -3.4211840056 + 4 ( 1.0000000000 3.1200000000 1.2400000000 -1.0400000000 -2.2400000000 ) -2.2400000000 + 11 ( 1.0000000000 3.1200000000 1.2400000000 -1.0400000000 -2.2400000000 ) -2.2400000000 } end of run (terminated by the user inside Evaluator::update_iteration()) -blackbox evaluations : 36 -best feasible solution : ( 2.459674775 1.475804865 0.7267220927 -0.6708203932 -3.421184006 ) h=0 f=-3.421184006 +blackbox evaluations : 11 +best feasible solution : ( 1 3.12 1.24 -1.04 -2.24 ) h=0 f=-2.24 } MADS run #2 { @@ -42,13 +40,13 @@ MADS run { BBE ( SOL ) OBJ - 36 ( 2.4596747752 1.4758048651 0.7267220927 -0.6708203932 -3.4211840056 ) -3.4211840056 - 42 ( 2.4596747752 1.4758048651 0.7267220927 -0.6708203932 -3.4211840056 ) -3.4211840056 + 11 ( 1.3100000000 2.6200000000 0.2400000000 -0.8000000000 -3.2400000000 ) -3.2400000000 + 18 ( 1.3100000000 2.6200000000 0.2400000000 -0.8000000000 -3.2400000000 ) -3.2400000000 } end of run (terminated by the user inside Evaluator::update_iteration()) -blackbox evaluations : 42 -best feasible solution : ( 2.459674775 1.475804865 0.7267220927 -0.6708203932 -3.421184006 ) h=0 f=-3.421184006 +blackbox evaluations : 18 +best feasible solution : ( 1.31 2.62 0.24 -0.8 -3.24 ) h=0 f=-3.24 } MADS run #3 { @@ -57,13 +55,13 @@ MADS run { BBE ( SOL ) OBJ - 42 ( 2.4596747752 1.4758048651 0.7267220927 -0.6708203932 -3.4211840056 ) -3.4211840056 - 48 ( 2.4596747752 1.4758048651 0.7267220927 -0.6708203932 -3.4211840056 ) -3.4211840056 + 7 ( 1.8100000000 2.3200000000 0.3500000000 -0.6900000000 -3.3200000000 ) -3.3200000000 + 15 ( 1.8100000000 2.3200000000 0.3500000000 -0.6900000000 -3.3200000000 ) -3.3200000000 } end of run (terminated by the user inside Evaluator::update_iteration()) -blackbox evaluations : 48 -best feasible solution : ( 2.459674775 1.475804865 0.7267220927 -0.6708203932 -3.421184006 ) h=0 f=-3.421184006 +blackbox evaluations : 15 +best feasible solution : ( 1.81 2.32 0.35 -0.69 -3.32 ) h=0 f=-3.32 } MADS run #4 { @@ -72,13 +70,25 @@ MADS run { BBE ( SOL ) OBJ - 48 ( 2.4596747752 1.4758048651 0.7267220927 -0.6708203932 -3.4211840056 ) -3.4211840056 - 52 ( 2.4750477426 1.4674196102 0.8902345635 0.5282710597 -3.4505323978 ) -3.4505323978 - 54 ( 0.9915563938 0.9978453350 1.0174109298 1.0230010997 -3.9997665948 ) -3.9997665948 - 61 ( 0.9915563938 0.9978453350 1.0174109298 1.0230010997 -3.9997665948 ) -3.9997665948 + 7 ( 1.3100000000 2.4200000000 0.8500000000 -0.1900000000 -3.6100000000 ) -3.6100000000 + 15 ( 1.3100000000 2.4200000000 0.8500000000 -0.1900000000 -3.6100000000 ) -3.6100000000 } end of run (terminated by the user inside Evaluator::update_iteration()) -blackbox evaluations : 61 -best feasible solution : ( 0.9915563938 0.997845335 1.01741093 1.0230011 -3.999766595 ) h=0 f=-3.999766595 +blackbox evaluations : 15 +best feasible solution : ( 1.31 2.42 0.85 -0.19 -3.61 ) h=0 f=-3.61 +} + +MADS run #5 { + +MADS run { + + BBE ( SOL ) OBJ + + 12 ( 1.3100000000 2.4200000000 0.8500000000 -0.1900000000 -3.6100000000 ) -3.6100000000 + +} end of run (terminated by the user inside Evaluator::update_iteration()) + +blackbox evaluations : 12 +best feasible solution : ( 1.31 2.42 0.85 -0.19 -3.61 ) h=0 f=-3.61 } diff --git a/examples/advanced/user_search/makefile b/examples/advanced/user_search/makefile index 4632e595909d675b1d47d4a73491caf6d57853b6..25975390fdd5d8ff2dd6bb0b926f363d94107bd1 100644 --- a/examples/advanced/user_search/makefile +++ b/examples/advanced/user_search/makefile @@ -24,7 +24,7 @@ CXXFLAGS_MPI = $(CXXFLAGS) -DUSE_MPI LDLIBS = -lm -lnomad LDLIBS_MPI = -lm -lmpi -lnomad.MPI -INCLUDE = -I$(NOMAD_HOME)/src -I. +INCLUDE = -I$(NOMAD_HOME)/src -I$(NOMAD_HOME)/ext/sgtelib/src -I. COMPILE = $(COMPILATOR) $(COMPILATOR_OPTIONS) $(INCLUDE) -c COMPILE_MPI = $(COMPILATOR_MPI) $(COMPILATOR_OPTIONS_MPI) $(INCLUDE) -c diff --git a/examples/advanced/user_search/runExample.log b/examples/advanced/user_search/runExample.log index 60c785b24c7db1d2a4a8d55e442ca7d9b2a43da1..5e5bfa0abf3aa88428ff1f37a10d8ce0173d665b 100644 --- a/examples/advanced/user_search/runExample.log +++ b/examples/advanced/user_search/runExample.log @@ -9,8 +9,9 @@ MADS search { submitted evaluation 1/1 { point #1 ( 0.132741232 ) - mesh indices: ( 0 ) + mesh indices : ( 0 ) + not in cache } evaluation 1/1 { @@ -42,8 +43,9 @@ MADS search { submitted evaluation 1/1 { point #2 ( 0.061929856 ) - mesh indices: ( 0 ) + mesh indices : ( 1 ) + not in cache } evaluation 1/1 { @@ -75,8 +77,9 @@ MADS search { submitted evaluation 1/1 { point #3 ( 0.052807552 ) - mesh indices: ( 0 ) + mesh indices : ( 2 ) + not in cache } evaluation 1/1 { @@ -108,8 +111,9 @@ MADS search { submitted evaluation 1/1 { point #4 ( 0.003343488002 ) - mesh indices: ( 0 ) + mesh indices : ( 3 ) + not in cache } evaluation 1/1 { @@ -141,8 +145,9 @@ MADS search { submitted evaluation 1/1 { point #5 ( 0.003046400592 ) - mesh indices: ( 0 ) + mesh indices : ( 4 ) + not in cache } evaluation 1/1 { @@ -174,8 +179,9 @@ MADS search { submitted evaluation 1/1 { point #6 ( 0.002265794838 ) - mesh indices: ( 0 ) + mesh indices : ( 5 ) + not in cache } evaluation 1/1 { @@ -207,8 +213,9 @@ MADS search { submitted evaluation 1/1 { point #7 ( 0.001481318181 ) - mesh indices: ( 0 ) + mesh indices : ( 6 ) + not in cache } evaluation 1/1 { @@ -240,8 +247,9 @@ MADS search { submitted evaluation 1/1 { point #8 ( 0.001371090082 ) - mesh indices: ( 0 ) + mesh indices : ( 7 ) + not in cache } evaluation 1/1 { @@ -273,8 +281,9 @@ MADS search { submitted evaluation 1/1 { point #9 ( 0.0008957599348 ) - mesh indices: ( 0 ) + mesh indices : ( 8 ) + not in cache } evaluation 1/1 { diff --git a/examples/advanced/user_search/user_search.cpp b/examples/advanced/user_search/user_search.cpp index 8c4870c60930e59b2ead8e2e20a805ca1adc2908..931e56eff7cf8a7e0d48d47366aefcc40ea8df69 100755 --- a/examples/advanced/user_search/user_search.cpp +++ b/examples/advanced/user_search/user_search.cpp @@ -180,8 +180,6 @@ int main ( int argc , char ** argv ) { p.set_SPECULATIVE_SEARCH ( false ); p.set_INITIAL_MESH_SIZE ( 1.0 ); - p.set_MESH_UPDATE_BASIS ( 2.0 ); - p.set_MESH_COARSENING_EXPONENT ( 0 ); p.set_DISPLAY_DEGREE ( "0300" ); // display only the search step diff --git a/examples/basic/batch/bi_obj/param.txt b/examples/basic/batch/bi_obj/param.txt index cc0d85408e063e969ef884ce700498f06815aa21..3bd5a8023cac84841302f14df3457a022ab452b4 100644 --- a/examples/basic/batch/bi_obj/param.txt +++ b/examples/basic/batch/bi_obj/param.txt @@ -1,29 +1,29 @@ -###################################### -# Deb, Discontinuous, alpha=2, q=4 # -###################################### - -DIMENSION 2 - -DISPLAY_DEGREE 2 - -BB_EXE bb.exe -BB_OUTPUT_TYPE OBJ OBJ - -x0 ( 0.51 0.51 ) - -lower_bound * 0.0 -upper_bound * 1.0 - -MULTI_OVERALL_BB_EVAL 500 - -# ADD_SEED_TO_FILE_NAMES no -STATS_FILE front.txt OBJ -# HISTORY_FILE history.txt -DISPLAY_STATS BBE ( SOL ) OBJ - -# TMP_DIR /tmp # indicates a repertory where - # temporary files are put - # (increases performance by ~100% - # if you're working on a network - # account and if TMP_DIR is on a - # local disk) +###################################### +# Deb, Discontinuous, alpha=2, q=4 # +###################################### + +DIMENSION 2 + +DISPLAY_DEGREE 2 + +BB_EXE bb.exe +BB_OUTPUT_TYPE OBJ OBJ + +x0 ( 0.51 0.51 ) + +lower_bound * 0.0 +upper_bound * 1.0 + +MULTI_OVERALL_BB_EVAL 500 + +# ADD_SEED_TO_FILE_NAMES no +STATS_FILE front.txt OBJ +# HISTORY_FILE history.txt +DISPLAY_STATS BBE ( SOL ) OBJ + +# TMP_DIR /tmp # indicates a repertory where + # temporary files are put + # (increases performance by ~100% + # if you're working on a network + # account and if TMP_DIR is on a + # local disk) diff --git a/examples/basic/batch/bi_obj/runExample.log b/examples/basic/batch/bi_obj/runExample.log index f85624fafb6ad544805df93beb204fb306fd18cd..a7e9a15aefd5d629745c98129d017d46670bd336 100644 --- a/examples/basic/batch/bi_obj/runExample.log +++ b/examples/basic/batch/bi_obj/runExample.log @@ -1,19 +1,20 @@ -NOMAD - version 3.7.3 has been created by { +NOMAD - version 3.8.1 has been created by { Charles Audet - Ecole Polytechnique de Montreal Sebastien Le Digabel - Ecole Polytechnique de Montreal Christophe Tribes - Ecole Polytechnique de Montreal } -The copyright of NOMAD - version 3.7.3 is owned by { +The copyright of NOMAD - version 3.8.1 is owned by { Sebastien Le Digabel - Ecole Polytechnique de Montreal Christophe Tribes - Ecole Polytechnique de Montreal } -NOMAD version 3 is a new version of Nomad v1 and v2, it has been funded by AFOSR and Exxon Mobil. -Nomad v1 and v2 were created and developed by Mark A. Abramson from The Boeing Company, Charles Audet and Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from Rice University, and were funded by AFOSR and Exxon Mobil. +NOMAD v3 has been funded by AFOSR and Exxon Mobil. +NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created +and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. +Dennis Jr., and were funded by AFOSR and Exxon Mobil. -Download : www.gerad.ca/nomad License : '$NOMAD_HOME/src/lgpl.txt' User guide: '$NOMAD_HOME/doc/user_guide.pdf' Examples : '$NOMAD_HOME/examples' @@ -21,23 +22,25 @@ Tools : '$NOMAD_HOME/tools' Please report bugs to nomad@gerad.ca +Seed: 0 + multi-MADS run { - MADS run 1 ...... OK [bb eval= 64] [overall bb eval= 64] [# dominant pts= 6] [# new pts= 6] [f1=0 f2=6.231313115] - MADS run 2 ...... OK [bb eval= 32] [overall bb eval= 96] [# dominant pts= 10] [# new pts= 4] [f1=0.8147632732 f2=-0.4772846994] - MADS run 3 ...... OK [bb eval= 32] [overall bb eval= 128] [# dominant pts= 14] [# new pts= 4] [f1=0 f2=1] - MADS run 4 ...... OK [bb eval= 32] [overall bb eval= 160] [# dominant pts= 23] [# new pts= 9] [f1=0.3158760328 f2=0.5854826675] - MADS run 5 ...... OK [bb eval= 32] [overall bb eval= 192] [# dominant pts= 31] [# new pts= 8] [f1=0.563132696 f2=0.1198200644] - MADS run 6 ...... OK [bb eval= 32] [overall bb eval= 224] [# dominant pts= 48] [# new pts= 17] [f1=0.5283988375 f2=0.3748699372] - MADS run 7 ...... OK [bb eval= 32] [overall bb eval= 256] [# dominant pts= 66] [# new pts= 18] [f1=0.7870555978 f2=-0.2509912401] - MADS run 8 ...... OK [bb eval= 32] [overall bb eval= 288] [# dominant pts= 80] [# new pts= 14] [f1=0.268022029 f2=0.8108740924] - MADS run 9 ...... OK [bb eval= 32] [overall bb eval= 320] [# dominant pts= 91] [# new pts= 11] [f1=0.5153477455 f2=0.5405240953] - MADS run 10 ...... OK [bb eval= 32] [overall bb eval= 352] [# dominant pts= 95] [# new pts= 4] [f1=0.7680831771 f2=0.07286356753] - MADS run 11 ...... OK [bb eval= 32] [overall bb eval= 384] [# dominant pts= 102] [# new pts= 7] [f1=0.5137077274 f2=0.5626056928] - MADS run 12 ...... OK [bb eval= 32] [overall bb eval= 416] [# dominant pts= 108] [# new pts= 6] [f1=0.567828327 f2=0.1148265921] - MADS run 13 ...... OK [bb eval= 32] [overall bb eval= 448] [# dominant pts= 115] [# new pts= 7] [f1=0.5682426473 f2=0.1147658278] - MADS run 14 ...... OK [bb eval= 32] [overall bb eval= 480] [# dominant pts= 121] [# new pts= 6] [f1=0.5685361243 f2=0.1147602185] - MADS run 15 ...... OK [bb eval= 20] [overall bb eval= 500] [# dominant pts= 125] [# new pts= 4] [f1=0.5685361243 f2=0.1147602185] + MADS run 1 ...... OK [bb eval= 64] [overall bb eval= 64] [# dominant pts= 3] [# new pts= 3] [f1=0 f2=6.231313115] + MADS run 2 ...... OK [bb eval= 32] [overall bb eval= 96] [# dominant pts= 17] [# new pts= 14] [f1=0.8172467689 f2=-0.479330283] + MADS run 3 ...... OK [bb eval= 32] [overall bb eval= 128] [# dominant pts= 21] [# new pts= 4] [f1=0.3102467689 f2=0.5939975123] + MADS run 4 ...... OK [bb eval= 32] [overall bb eval= 160] [# dominant pts= 31] [# new pts= 10] [f1=0.7552467689 f2=0.3302995589] + MADS run 5 ...... OK [bb eval= 32] [overall bb eval= 192] [# dominant pts= 36] [# new pts= 5] [f1=0.3204267689 f2=0.5832376512] + MADS run 6 ...... OK [bb eval= 32] [overall bb eval= 224] [# dominant pts= 43] [# new pts= 7] [f1=0.3205292689 f2=0.5832359376] + MADS run 7 ...... OK [bb eval= 32] [overall bb eval= 256] [# dominant pts= 49] [# new pts= 6] [f1=0.3205292689 f2=0.5832359376] + MADS run 8 ...... OK [bb eval= 32] [overall bb eval= 288] [# dominant pts= 57] [# new pts= 8] [f1=0.07542676891 f2=0.9228298043] + MADS run 9 ...... OK [bb eval= 32] [overall bb eval= 320] [# dominant pts= 70] [# new pts= 13] [f1=0.7465567689 f2=0.5071777921] + MADS run 10 ...... OK [bb eval= 32] [overall bb eval= 352] [# dominant pts= 79] [# new pts= 9] [f1=0.7438996689 f2=0.5626312951] + MADS run 11 ...... OK [bb eval= 32] [overall bb eval= 384] [# dominant pts= 86] [# new pts= 7] [f1=0.7428996689 f2=0.579968616] + MADS run 12 ...... OK [bb eval= 32] [overall bb eval= 416] [# dominant pts= 95] [# new pts= 9] [f1=0.7428544689 f2=0.5809403909] + MADS run 13 ...... OK [bb eval= 32] [overall bb eval= 448] [# dominant pts= 101] [# new pts= 6] [f1=0.7427444689 f2=0.583021772] + MADS run 14 ...... OK [bb eval= 32] [overall bb eval= 480] [# dominant pts= 110] [# new pts= 9] [f1=0.7428111689 f2=0.5817100236] + MADS run 15 ...... OK [bb eval= 20] [overall bb eval= 500] [# dominant pts= 114] [# new pts= 4] [f1=0.7427444689 f2=0.583021772] } end of run (max number of bb evaluations) @@ -48,130 +51,119 @@ number of MADS runs : 15 Pareto front { BBE ( 0.0000000000 0.0000000000 ) 0.0000000000 1.0000000000 - BBE ( 0.0088388348 0.0000000000 ) 0.0088388348 0.9979744889 - BBE ( 0.0154679608 0.0000000000 ) 0.0154679608 0.9938978580 - BBE ( 0.0176776695 0.0000000000 ) 0.0176776695 0.9920893658 - BBE ( 0.0211561362 0.0000000000 ) 0.0211561362 0.9888260567 - BBE ( 0.0530330086 0.0000000000 ) 0.0530330086 0.9456485587 - BBE ( 0.0707106781 0.0000000000 ) 0.0707106781 0.9257895286 - BBE ( 0.2562138982 0.0000000000 ) 0.2562138982 0.8945033812 - BBE ( 0.2608404757 0.0000000000 ) 0.2608404758 0.8617719752 - BBE ( 0.2619453301 0.0000000000 ) 0.2619453301 0.8539197314 - BBE ( 0.2622905971 0.0000000000 ) 0.2622905971 0.8514653467 - BBE ( 0.2651217863 0.0003064244 ) 0.2651217863 0.8346375232 - BBE ( 0.2655361067 0.0000000000 ) 0.2655361067 0.8284226452 - BBE ( 0.2680220290 0.0000000000 ) 0.2680220290 0.8108740924 - BBE ( 0.2686435096 0.0000000000 ) 0.2686435096 0.8065101303 - BBE ( 0.2691268833 0.0000000000 ) 0.2691268833 0.8031238337 - BBE ( 0.2696793105 0.0000000000 ) 0.2696793105 0.7992629776 - BBE ( 0.2710603784 0.0003193720 ) 0.2710603784 0.7930864044 - BBE ( 0.2727867134 0.0000000000 ) 0.2727867134 0.7777651163 - BBE ( 0.2741677813 0.0000000000 ) 0.2741677813 0.7683544484 - BBE ( 0.2749964221 0.0002762136 ) 0.2749964221 0.7657285747 - BBE ( 0.2754797958 0.0000000000 ) 0.2754797958 0.7595122877 - BBE ( 0.2819017617 0.0000000000 ) 0.2819017617 0.7179584250 - BBE ( 0.2995794312 0.0000000000 ) 0.2995794312 0.6263296155 - BBE ( 0.3039988486 0.0000000000 ) 0.3039988486 0.6104981808 - BBE ( 0.3059323437 0.0000000000 ) 0.3059323437 0.6046312984 - BBE ( 0.3062085573 0.0000000000 ) 0.3062085573 0.6038477544 - BBE ( 0.3117328290 0.0000000000 ) 0.3117328290 0.5911477575 - BBE ( 0.3158760328 0.0000000000 ) 0.3158760328 0.5854826675 - BBE ( 0.3172571008 0.0000000000 ) 0.3172571008 0.5843556236 - BBE ( 0.3202954502 0.0000000000 ) 0.3202954502 0.5832430145 - BBE ( 0.5134487771 0.0000000000 ) 0.5134487771 0.5661080224 - BBE ( 0.5137077274 0.0000000000 ) 0.5137077274 0.5626056928 - BBE ( 0.5137940441 0.0000000000 ) 0.5137940441 0.5614391407 - BBE ( 0.5150715320 0.0000000000 ) 0.5150715320 0.5442301804 - BBE ( 0.5152786921 0.0000000000 ) 0.5152786921 0.5414500948 - BBE ( 0.5153477455 0.0000000000 ) 0.5153477455 0.5405240953 - BBE ( 0.5158224876 0.0003107403 ) 0.5158224876 0.5380991695 - BBE ( 0.5160987012 0.0005481113 ) 0.5160987012 0.5374102768 - BBE ( 0.5162799664 0.0000000000 ) 0.5162799664 0.5280587044 - BBE ( 0.5168841836 0.0000000000 ) 0.5168841836 0.5200167511 - BBE ( 0.5181098814 0.0000000000 ) 0.5181098814 0.5038021282 - BBE ( 0.5186623086 0.0000000000 ) 0.5186623086 0.4965407236 - BBE ( 0.5192147358 0.0000000000 ) 0.5192147358 0.4893102188 - BBE ( 0.5193183158 0.0000000000 ) 0.5193183158 0.4879580513 - BBE ( 0.5217006580 0.0000000000 ) 0.5217006580 0.4571922658 - BBE ( 0.5220804517 0.0000000000 ) 0.5220804517 0.4523508179 - BBE ( 0.5228055124 0.0000000000 ) 0.5228055124 0.4431601076 - BBE ( 0.5250152211 0.0000000000 ) 0.5250152211 0.4156003506 - BBE ( 0.5252914347 0.0000000000 ) 0.5252914347 0.4122059478 - BBE ( 0.5263962890 0.0000000000 ) 0.5263962890 0.3987478889 - BBE ( 0.5283988375 0.0000000000 ) 0.5283988375 0.3748699372 - BBE ( 0.5302632792 0.0000000000 ) 0.5302632792 0.3532808843 - BBE ( 0.5303323326 0.0000000000 ) 0.5303323326 0.3524938416 - BBE ( 0.5313681336 0.0007595874 ) 0.5313681336 0.3505244083 - BBE ( 0.5317134005 0.0002373711 ) 0.5317134005 0.3399926818 - BBE ( 0.5319205607 0.0000000000 ) 0.5319205607 0.3346507552 - BBE ( 0.5328873083 0.0000000000 ) 0.5328873083 0.3240405720 - BBE ( 0.5335087888 0.0002287394 ) 0.5335087888 0.3202607108 - BBE ( 0.5338540558 0.0000000000 ) 0.5338540558 0.3136280970 - BBE ( 0.5357875509 0.0000000000 ) 0.5357875509 0.2934217157 - BBE ( 0.5363399781 0.0000000000 ) 0.5363399781 0.2878054090 - BBE ( 0.5403105484 0.0000000000 ) 0.5403105484 0.2496195163 - BBE ( 0.5407593955 0.0000000000 ) 0.5407593955 0.2455543650 - BBE ( 0.5413118227 0.0000000000 ) 0.5413118227 0.2406240954 - BBE ( 0.5418642498 0.0000000000 ) 0.5418642498 0.2357753238 - BBE ( 0.5420196200 0.0000000000 ) 0.5420196200 0.2344264287 - BBE ( 0.5440739585 0.0005524272 ) 0.5440739585 0.2243656329 - BBE ( 0.5457312400 0.0000000000 ) 0.5457312400 0.2041983052 - BBE ( 0.5461455604 0.0000000000 ) 0.5461455604 0.2010684705 - BBE ( 0.5473885216 0.0000000000 ) 0.5473885216 0.1919834017 - BBE ( 0.5479409487 0.0000000000 ) 0.5479409487 0.1880940310 - BBE ( 0.5490458031 0.0000000000 ) 0.5490458031 0.1805936986 - BBE ( 0.5491493832 0.0000000000 ) 0.5491493832 0.1799097506 - BBE ( 0.5495982303 0.0000000000 ) 0.5495982303 0.1769843488 - BBE ( 0.5501506574 0.0000000000 ) 0.5501506574 0.1734699226 - BBE ( 0.5508584547 0.0000000000 ) 0.5508584547 0.1691070049 - BBE ( 0.5540176476 0.0000000000 ) 0.5540176476 0.1515886169 - BBE ( 0.5545700748 0.0000000000 ) 0.5545700748 0.1488595298 - BBE ( 0.5549843952 0.0000000000 ) 0.5549843952 0.1468790527 - BBE ( 0.5551225020 0.0000000000 ) 0.5551225020 0.1462315798 - BBE ( 0.5573322107 0.0000000000 ) 0.5573322107 0.1367428101 - BBE ( 0.5584370650 0.0000000000 ) 0.5584370650 0.1326198627 - BBE ( 0.5600943465 0.0000000000 ) 0.5600943465 0.1272233749 - BBE ( 0.5611992009 0.0000000000 ) 0.5611992009 0.1241561368 - BBE ( 0.5627183756 0.0000000000 ) 0.5627183756 0.1206381293 - BBE ( 0.5631326960 0.0000000000 ) 0.5631326960 0.1198200644 - BBE ( 0.5641167069 0.0000000000 ) 0.5641167069 0.1181212433 - BBE ( 0.5645137639 0.0000000000 ) 0.5645137639 0.1175332972 - BBE ( 0.5649453477 0.0000000000 ) 0.5649453477 0.1169580043 - BBE ( 0.5650661911 0.0000000000 ) 0.5650661911 0.1168088425 - BBE ( 0.5658948319 0.0000000000 ) 0.5658948319 0.1159267436 - BBE ( 0.5667234726 0.0000000000 ) 0.5667234726 0.1152907523 - BBE ( 0.5668615794 0.0000000000 ) 0.5668615794 0.1152087235 - BBE ( 0.5674140066 0.0000000000 ) 0.5674140066 0.1149491832 - BBE ( 0.5678283270 0.0000000000 ) 0.5678283270 0.1148265921 - BBE ( 0.5682426473 0.0000000000 ) 0.5682426473 0.1147658278 - BBE ( 0.5685361243 0.0000000000 ) 0.5685361243 0.1147602185 - BBE ( 0.7661496820 0.0000000000 ) 0.7661496820 0.1105136967 - BBE ( 0.7680831771 0.0000000000 ) 0.7680831771 0.0728635675 - BBE ( 0.7689118179 0.0000000000 ) 0.7689118179 0.0569125770 - BBE ( 0.7691880314 0.0000000000 ) 0.7691880314 0.0516220389 - BBE ( 0.7699476188 0.0003841095 ) 0.7699476188 0.0432535935 - BBE ( 0.7705690994 0.0000000000 ) 0.7705690994 0.0253788803 - BBE ( 0.7716739537 0.0000000000 ) 0.7716739537 0.0046504791 - BBE ( 0.7741598760 0.0002589502 ) 0.7741598760 -0.0369011145 - BBE ( 0.7783030798 0.0000000000 ) 0.7783030798 -0.1138668264 - BBE ( 0.7834820845 0.0000000000 ) 0.7834820845 -0.1980406893 - BBE ( 0.7841553552 0.0000000000 ) 0.7841553552 -0.2083556587 - BBE ( 0.7854673697 0.0005437955 ) 0.7854673697 -0.2192363858 - BBE ( 0.7858126367 0.0007250607 ) 0.7858126367 -0.2213881058 - BBE ( 0.7863650638 0.0007034815 ) 0.7863650638 -0.2297569563 - BBE ( 0.7864772756 0.0004822948 ) 0.7864772756 -0.2349368931 - BBE ( 0.7867103308 0.0000000000 ) 0.7867103308 -0.2460730547 - BBE ( 0.7870555978 0.0000000000 ) 0.7870555978 -0.2509912401 - BBE ( 0.7875864458 0.0002859242 ) 0.7875864458 -0.2538397470 + BBE ( 0.0204267689 0.0000000000 ) 0.0204267689 0.9895506515 + BBE ( 0.0604267689 0.0000000000 ) 0.0604267689 0.9360038485 + BBE ( 0.0704267689 0.0000000000 ) 0.0704267689 0.9260062753 + BBE ( 0.0706467689 0.0000000000 ) 0.0706467689 0.9258379549 + BBE ( 0.0744267689 0.0000000000 ) 0.0744267689 0.9233526042 + BBE ( 0.0754267689 0.0000000000 ) 0.0754267689 0.9228298043 + BBE ( 0.0804267689 0.0000900000 ) 0.0804267689 0.9220365113 + BBE ( 0.0844267689 0.0000000000 ) 0.0844267689 0.9209439225 + BBE ( 0.2704267689 0.0000000000 ) 0.2704267689 0.7940560330 + BBE ( 0.2742467689 0.0000000000 ) 0.2742467689 0.7678193102 + BBE ( 0.2772467689 0.0000000000 ) 0.2772467689 0.7477736335 + BBE ( 0.2845292689 0.0000000000 ) 0.2845292689 0.7019705135 + BBE ( 0.3002467689 0.0000000000 ) 0.3002467689 0.6237302992 + BBE ( 0.3004267689 0.0000000000 ) 0.3004267689 0.6230416170 + BBE ( 0.3005292689 0.0000000000 ) 0.3005292689 0.6226518252 + BBE ( 0.3102467689 0.0000000000 ) 0.3102467689 0.5939975123 + BBE ( 0.3104267689 0.0000000000 ) 0.3104267689 0.5936297664 + BBE ( 0.3155292689 0.0000000000 ) 0.3155292689 0.5858260306 + BBE ( 0.3165667689 0.0000000000 ) 0.3165667689 0.5848708104 + BBE ( 0.3172467689 0.0000000000 ) 0.3172467689 0.5843626222 + BBE ( 0.3186792689 0.0000000000 ) 0.3186792689 0.5835996017 + BBE ( 0.3188267689 0.0000000000 ) 0.3188267689 0.5835448256 + BBE ( 0.3189967689 0.0000000000 ) 0.3189967689 0.5834872213 + BBE ( 0.3195967689 0.0000000000 ) 0.3195967689 0.5833312978 + BBE ( 0.3197667689 0.0000000000 ) 0.3197667689 0.5833005661 + BBE ( 0.3200292689 0.0000000000 ) 0.3200292689 0.5832647940 + BBE ( 0.3202392689 0.0000000000 ) 0.3202392689 0.5832463953 + BBE ( 0.3203067689 0.0000000000 ) 0.3203067689 0.5832424121 + BBE ( 0.3204267689 0.0000000000 ) 0.3204267689 0.5832376512 + BBE ( 0.3205092689 0.0000000000 ) 0.3205092689 0.5832361017 + BBE ( 0.3205292689 0.0000000000 ) 0.3205292689 0.5832359376 + BBE ( 0.7427444689 0.0000000000 ) 0.7427444689 0.5830217720 + BBE ( 0.7428111689 0.0000000000 ) 0.7428111689 0.5817100236 + BBE ( 0.7428352689 0.0000164000 ) 0.7428352689 0.5814903959 + BBE ( 0.7428445689 0.0000250000 ) 0.7428445689 0.5814408590 + BBE ( 0.7428544689 0.0000053000 ) 0.7428544689 0.5809403909 + BBE ( 0.7428608689 0.0000016000 ) 0.7428608689 0.5807570403 + BBE ( 0.7428899689 0.0000004000 ) 0.7428899689 0.5801657414 + BBE ( 0.7428996689 0.0000000000 ) 0.7428996689 0.5799686160 + BBE ( 0.7429252689 0.0000000000 ) 0.7429252689 0.5794646897 + BBE ( 0.7429388689 0.0000000000 ) 0.7429388689 0.5791969430 + BBE ( 0.7429567689 0.0000000000 ) 0.7429567689 0.5788445031 + BBE ( 0.7429929689 0.0000000000 ) 0.7429929689 0.5781316165 + BBE ( 0.7430112689 0.0000000000 ) 0.7430112689 0.5777711679 + BBE ( 0.7431479689 0.0000000000 ) 0.7431479689 0.5750772266 + BBE ( 0.7431584689 0.0000054000 ) 0.7431584689 0.5749540229 + BBE ( 0.7432367689 0.0000200000 ) 0.7432367689 0.5736363837 + BBE ( 0.7432467689 0.0000000000 ) 0.7432467689 0.5731286422 + BBE ( 0.7433120689 0.0000000000 ) 0.7433120689 0.5718400603 + BBE ( 0.7433633689 0.0000000000 ) 0.7433633689 0.5708273548 + BBE ( 0.7434744689 0.0000000000 ) 0.7434744689 0.5686329801 + BBE ( 0.7436544689 0.0000000000 ) 0.7436544689 0.5650743840 + BBE ( 0.7438896689 0.0000000000 ) 0.7438896689 0.5604183320 + BBE ( 0.7439096689 0.0000000000 ) 0.7439096689 0.5600220919 + BBE ( 0.7439544689 0.0000000000 ) 0.7439544689 0.5591343350 + BBE ( 0.7442467689 0.0000000000 ) 0.7442467689 0.5533361137 + BBE ( 0.7444344689 0.0000000000 ) 0.7444344689 0.5496073945 + BBE ( 0.7445044689 0.0000000000 ) 0.7445044689 0.5482157603 + BBE ( 0.7445567689 0.0000000000 ) 0.7445567689 0.5471756378 + BBE ( 0.7445967689 0.0000000000 ) 0.7445967689 0.5463799189 + BBE ( 0.7447444689 0.0000000000 ) 0.7447444689 0.5434401320 + BBE ( 0.7447544689 0.0000000000 ) 0.7447544689 0.5432410042 + BBE ( 0.7447696689 0.0000000000 ) 0.7447696689 0.5429383081 + BBE ( 0.7448996689 0.0000000000 ) 0.7448996689 0.5403483930 + BBE ( 0.7450867689 0.0000000000 ) 0.7450867689 0.5366175915 + BBE ( 0.7455596689 0.0000000000 ) 0.7455596689 0.5271709244 + BBE ( 0.7462367689 0.0000400000 ) 0.7462367689 0.5142274707 + BBE ( 0.7462467689 0.0000000000 ) 0.7462467689 0.5134041153 + BBE ( 0.7465567689 0.0000000000 ) 0.7465567689 0.5071777921 + BBE ( 0.7467444689 0.0000000000 ) 0.7467444689 0.5034034955 + BBE ( 0.7471896689 0.0000000000 ) 0.7471896689 0.4944387248 + BBE ( 0.7473244689 0.0000000000 ) 0.7473244689 0.4917209367 + BBE ( 0.7474867689 0.0000000000 ) 0.7474867689 0.4884466843 + BBE ( 0.7477644689 0.0000000000 ) 0.7477644689 0.4828393633 + BBE ( 0.7482267689 0.0000000000 ) 0.7482267689 0.4734912578 + BBE ( 0.7482467689 0.0000000000 ) 0.7482467689 0.4730864787 + BBE ( 0.7492467689 0.0000000000 ) 0.7492467689 0.4528122445 + BBE ( 0.7498267689 0.0000000000 ) 0.7498267689 0.4410243813 + BBE ( 0.7502467689 0.0000000000 ) 0.7502467689 0.4324768008 + BBE ( 0.7522467689 0.0000000000 ) 0.7522467689 0.3916699033 + BBE ( 0.7527444689 0.0000000000 ) 0.7527444689 0.3814956030 + BBE ( 0.7537444689 0.0000000000 ) 0.7537444689 0.3610399698 + BBE ( 0.7538996689 0.0000000000 ) 0.7538996689 0.3578642958 + BBE ( 0.7542467689 0.0000000000 ) 0.7542467689 0.3507615937 + BBE ( 0.7547444689 0.0000000000 ) 0.7547444689 0.3405770361 + BBE ( 0.7552467689 0.0000000000 ) 0.7552467689 0.3302995589 + BBE ( 0.7562467689 0.0000000000 ) 0.7562467689 0.3098484220 + BBE ( 0.7567444689 0.0000000000 ) 0.7567444689 0.2996777206 + BBE ( 0.7568996689 0.0000000000 ) 0.7568996689 0.2965075493 + BBE ( 0.7592467689 0.0000000000 ) 0.7592467689 0.2486819136 + BBE ( 0.7622467689 0.0000000000 ) 0.7622467689 0.1880511976 + BBE ( 0.7628996689 0.0000000000 ) 0.7628996689 0.1749590540 + BBE ( 0.7632467689 0.0000000000 ) 0.7632467689 0.1680167135 + BBE ( 0.7637444689 0.0000000000 ) 0.7637444689 0.1580850684 + BBE ( 0.7692467689 0.0000000000 ) 0.7692467689 0.0504987441 + BBE ( 0.7742467689 0.0050000000 ) 0.7742467689 0.0359353939 + BBE ( 0.7752467689 0.0050000000 ) 0.7752467689 0.0180522199 + BBE ( 0.7762467689 0.0000000000 ) 0.7762467689 -0.0782763564 + BBE ( 0.7782467689 0.0000000000 ) 0.7782467689 -0.1129075949 + BBE ( 0.7802467689 0.0000000000 ) 0.7802467689 -0.1464179263 BBE ( 0.7882467689 0.0000000000 ) 0.7882467689 -0.2676209257 - BBE ( 0.7882985590 0.0000000000 ) 0.7882985590 -0.2683319140 - BBE ( 0.7895587834 0.0000000000 ) 0.7895587834 -0.2853173321 - BBE ( 0.7904564776 0.0000000000 ) 0.7904564776 -0.2970410590 - BBE ( 0.7926661863 0.0000000000 ) 0.7926661863 -0.3245272558 - BBE ( 0.7981904580 0.0000000000 ) 0.7981904580 -0.3842336561 - BBE ( 0.8059244384 0.0000000000 ) 0.8059244384 -0.4444581650 - BBE ( 0.8147632732 0.0000000000 ) 0.8147632732 -0.4772846994 - BBE ( 0.8191826906 0.0000000000 ) 0.8191826906 -0.4787160837 + BBE ( 0.7912467689 0.0000000000 ) 0.7912467689 -0.3070980868 + BBE ( 0.7922467689 0.0000000000 ) 0.7922467689 -0.3194629514 + BBE ( 0.7927444689 0.0000000000 ) 0.7927444689 -0.3254644458 + BBE ( 0.7928996689 0.0000000000 ) 0.7928996689 -0.3273149708 + BBE ( 0.7932467689 0.0000000000 ) 0.7932467689 -0.3314173481 + BBE ( 0.7962467689 0.0000000000 ) 0.7962467689 -0.3647423903 + BBE ( 0.7982467689 0.0000000000 ) 0.7982467689 -0.3847731001 + BBE ( 0.8062467689 0.0000000000 ) 0.8062467689 -0.4463441409 + BBE ( 0.8082467689 0.0000000000 ) 0.8082467689 -0.4568962406 + BBE ( 0.8092467689 0.0000000000 ) 0.8092467689 -0.4614236505 + BBE ( 0.8122467689 0.0000000000 ) 0.8122467689 -0.4719751323 + BBE ( 0.8172467689 0.0000000000 ) 0.8172467689 -0.4793302830 } -number of Pareto points: 125 +number of Pareto points: 114 diff --git a/examples/basic/batch/single_obj/param.txt b/examples/basic/batch/single_obj/param.txt index 0f559cba8c4a1b0df981a791e874e841916307f8..afafeb65ec801a3dee8c11c96c0c9e5fb5cec406 100644 --- a/examples/basic/batch/single_obj/param.txt +++ b/examples/basic/batch/single_obj/param.txt @@ -1,44 +1,44 @@ -DIMENSION 5 # number of variables - -BB_EXE bb.exe # 'bb.exe' is a program that -BB_OUTPUT_TYPE OBJ PB EB # takes in argument the name of - # a text file containing 5 - # values, and that displays 3 - # values that correspond to the - # objective function value (OBJ), - # and two constraints values g1 - # and g2 with g1 <= 0 and - # g2 <= 0; 'PB' and 'EB' - # correspond to constraints that - # are treated by the Progressive - # and Extreme Barrier approaches - # (all constraint-handling - # options are described in the - # detailed parameters list) - -X0 ( 0 0 0 0 0 ) # starting point - -LOWER_BOUND * -6 # all variables are >= -6 -UPPER_BOUND ( 5 6 7 - - ) # x_1 <= 5, x_2 <= 6, x_3 <= 7 - # x_4 and x_5 have no bounds - -MAX_BB_EVAL 100 # the algorithm terminates when - # 100 black-box evaluations have - # been made - -# TMP_DIR /tmp # indicates a directory where - # temporary files are put - # (increases performance by ~100% - # if you're working on a network - # account and if TMP_DIR is on a - # local disk) - - -DISPLAY_DEGREE 2 -# DISPLAY_ALL_EVAL yes - - -DISPLAY_STATS BBE ( SOL ) OBJ # Display the number of evaluation (BBE), - # the current solution ( SOL ) and the objective - -# STATS_FILE test.txt BBE ( SOL ) OBJ +DIMENSION 5 # number of variables + +BB_EXE bb.exe # 'bb.exe' is a program that +BB_OUTPUT_TYPE OBJ PB EB # takes in argument the name of + # a text file containing 5 + # values, and that displays 3 + # values that correspond to the + # objective function value (OBJ), + # and two constraints values g1 + # and g2 with g1 <= 0 and + # g2 <= 0; 'PB' and 'EB' + # correspond to constraints that + # are treated by the Progressive + # and Extreme Barrier approaches + # (all constraint-handling + # options are described in the + # detailed parameters list) + +X0 ( 0 0 0 0 0 ) # starting point + +LOWER_BOUND * -6 # all variables are >= -6 +UPPER_BOUND ( 5 6 7 - - ) # x_1 <= 5, x_2 <= 6, x_3 <= 7 + # x_4 and x_5 have no bounds + +MAX_BB_EVAL 100 # the algorithm terminates when + # 100 black-box evaluations have + # been made + +# TMP_DIR /tmp # indicates a directory where + # temporary files are put + # (increases performance by ~100% + # if you're working on a network + # account and if TMP_DIR is on a + # local disk) + + +DISPLAY_DEGREE 2 +# DISPLAY_ALL_EVAL yes + + +DISPLAY_STATS BBE ( SOL ) OBJ # Display the number of evaluation (BBE), + # the current solution ( SOL ) and the objective + +# STATS_FILE test.txt BBE ( SOL ) OBJ diff --git a/examples/basic/batch/single_obj/runExample.log b/examples/basic/batch/single_obj/runExample.log index 9311a4b97851af8276bca6ae400109436ebcecfa..0e0e48604520e3998ba095a2834edec424aa2bfc 100644 --- a/examples/basic/batch/single_obj/runExample.log +++ b/examples/basic/batch/single_obj/runExample.log @@ -1,19 +1,20 @@ -NOMAD - version 3.7.3 has been created by { +NOMAD - version 3.8.1 has been created by { Charles Audet - Ecole Polytechnique de Montreal Sebastien Le Digabel - Ecole Polytechnique de Montreal Christophe Tribes - Ecole Polytechnique de Montreal } -The copyright of NOMAD - version 3.7.3 is owned by { +The copyright of NOMAD - version 3.8.1 is owned by { Sebastien Le Digabel - Ecole Polytechnique de Montreal Christophe Tribes - Ecole Polytechnique de Montreal } -NOMAD version 3 is a new version of Nomad v1 and v2, it has been funded by AFOSR and Exxon Mobil. -Nomad v1 and v2 were created and developed by Mark A. Abramson from The Boeing Company, Charles Audet and Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from Rice University, and were funded by AFOSR and Exxon Mobil. +NOMAD v3 has been funded by AFOSR and Exxon Mobil. +NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created +and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. +Dennis Jr., and were funded by AFOSR and Exxon Mobil. -Download : www.gerad.ca/nomad License : '$NOMAD_HOME/src/lgpl.txt' User guide: '$NOMAD_HOME/doc/user_guide.pdf' Examples : '$NOMAD_HOME/examples' @@ -21,21 +22,21 @@ Tools : '$NOMAD_HOME/tools' Please report bugs to nomad@gerad.ca +Seed: 0 + MADS run { BBE ( SOL ) OBJ - 2 ( 0.0000000000 0.5366563146 0.5813776741 -0.2683281573 0.2683281573 ) 288.7926372100 (PhaseOne) - 3 ( 0.0000000000 2.1466252584 2.3255106966 -1.0733126292 1.0733126292 ) 0.0000000000 (PhaseOne) - 3 ( 0.0000000000 2.1466252584 2.3255106966 -1.0733126292 1.0733126292 ) 1.0733100000 - 10 ( 0.4919349550 2.8174456516 2.1801662781 -0.8720665112 1.0062305899 ) 1.0062300000 - 11 ( 1.9677398202 4.8299068314 1.7441330224 -0.2683281573 0.8049844719 ) 0.8049840000 - 19 ( 0.9838699101 1.0733126292 1.7441330224 1.0733126292 -3.4882660449 ) -3.4882700000 - 31 ( 1.9677398202 0.5366563146 1.7441330224 0.2683281573 -3.7565942022 ) -3.7565900000 - 100 ( 1.9677398202 0.5366563146 1.7441330224 0.2683281573 -3.7565942022 ) -3.7565900000 + 2 ( 0.0000000000 1.0000000000 1.0000000000 -1.0000000000 1.0000000000 ) 144.0000000000 (PhaseOne) + 4 ( 0.0000000000 3.0000000000 2.0000000000 -2.0000000000 1.0000000000 ) 0.0000000000 (PhaseOne) + 4 ( 0.0000000000 3.0000000000 2.0000000000 -2.0000000000 1.0000000000 ) 1.0000000000 + 20 ( 2.0000000000 1.0000000000 3.0000000000 -1.0000000000 -3.0000000000 ) -3.0000000000 + 57 ( 1.0000000000 1.0000000000 1.0000000000 1.0000000000 -4.0000000000 ) -4.0000000000 + 100 ( 1.0000000000 1.0000000000 1.0000000000 1.0000000000 -4.0000000000 ) -4.0000000000 } end of run (max number of blackbox evaluations) blackbox evaluations : 100 -best infeasible solution (min. violation): ( 0.9838699101 1.073312629 1.162755348 1.073312629 -4.024922359 ) h=0.287344 f=-4.02492 -best feasible solution : ( 1.96773982 0.5366563146 1.744133022 0.2683281573 -3.756594202 ) h=0 f=-3.75659 +best infeasible solution (min. violation): ( 0.98 1 1 1.2 -4 ) h=0.0404 f=-4 +best feasible solution : ( 1 1 1 1 -4 ) h=0 f=-4 diff --git a/examples/basic/batch/single_obj/x.txt b/examples/basic/batch/single_obj/x.txt index aacb59525ae5e32096372e24707fe291c5a4dae4..88b14b24dad3c4eeacd577e1317468b16718ae5d 100644 --- a/examples/basic/batch/single_obj/x.txt +++ b/examples/basic/batch/single_obj/x.txt @@ -1 +1 @@ -1 2 3 4 5 +0 0 0 0 0 diff --git a/examples/basic/batch/single_obj_parallel/parallel_BBWrapper.pl b/examples/basic/batch/single_obj_parallel/parallel_BBWrapper.pl index 1de81320e898b538e21e86b622af308645f0a0d9..817212b83718d4d21017ff226b9c59c367ef36ff 100755 --- a/examples/basic/batch/single_obj_parallel/parallel_BBWrapper.pl +++ b/examples/basic/batch/single_obj_parallel/parallel_BBWrapper.pl @@ -7,14 +7,22 @@ use Data::Dumper; use threads; use threads::shared; use Thread::Semaphore; +use Config; -# quelques variables partagées -my $BBdotEXE:shared="./bb.exe"; ## The blackbox executable - my $numberParallelJobs:shared=4; my $semaphoreBBEval = Thread::Semaphore->new($numberParallelJobs); +## The blackbox executable +my $OSname:shared = "$Config{osname}"; +my $BBdotEXE:shared="./bb.exe"; +if ( $OSname eq "MSWin32" ) { + $BBdotEXE="bb.exe"; +} + + + + if ( ! exists $ARGV[0]) { $nameInputFile = ""; diff --git a/examples/basic/batch/single_obj_parallel/param.txt b/examples/basic/batch/single_obj_parallel/param.txt index 237325e893c937ea040427cb0a0ee8130185f7ea..20d565d2bc5530e962ed08930956f50e7631828c 100644 --- a/examples/basic/batch/single_obj_parallel/param.txt +++ b/examples/basic/batch/single_obj_parallel/param.txt @@ -1,21 +1,21 @@ -DIMENSION 5 # number of variables - -BB_EXE "$perl parallel_BBWrapper.pl" -# BB_EXE bb_parallel.exe - -BB_MAX_BLOCK_SIZE 2 - -BB_OUTPUT_TYPE OBJ PB EB - -X0 ( 0 0 0 0 0 ) # starting point - -LOWER_BOUND * -6.0 # all variables are >= -6 -UPPER_BOUND ( 5 6 7 - - ) # x_1 <= 5, x_2 <= 6, x_3 <= 7 - # x_4 and x_5 have no bounds - -MAX_BB_EVAL 100 # the algorithm terminates when - # 100 black-box evaluations have - # been made - -TMP_DIR /tmp -DISPLAY_DEGREE 2 +DIMENSION 5 # number of variables + +BB_EXE "$perl parallel_BBWrapper.pl" +# BB_EXE bb_parallel.exe + +BB_MAX_BLOCK_SIZE 2 + +BB_OUTPUT_TYPE OBJ PB EB + +X0 ( 0 0 0 0 0 ) # starting point + +LOWER_BOUND * -6.0 # all variables are >= -6 +UPPER_BOUND ( 5 6 7 - - ) # x_1 <= 5, x_2 <= 6, x_3 <= 7 + # x_4 and x_5 have no bounds + +MAX_BB_EVAL 100 # the algorithm terminates when + # 100 black-box evaluations have + # been made + +# TMP_DIR /tmp +DISPLAY_DEGREE 2 diff --git a/examples/basic/batch/single_obj_parallel/runExample.log b/examples/basic/batch/single_obj_parallel/runExample.log index fb033a1e7be0a7303acc1c15782b6f249a673229..cb4f2aea48929f87642337bd948af3db0cd2e8d6 100644 --- a/examples/basic/batch/single_obj_parallel/runExample.log +++ b/examples/basic/batch/single_obj_parallel/runExample.log @@ -2,21 +2,22 @@ Warning: { The maximum number of evaluations may be exceeded when BB_MAX_BLOCK_SIZE>1. } -NOMAD - version 3.7.3 has been created by { +NOMAD - version 3.8.1 has been created by { Charles Audet - Ecole Polytechnique de Montreal Sebastien Le Digabel - Ecole Polytechnique de Montreal Christophe Tribes - Ecole Polytechnique de Montreal } -The copyright of NOMAD - version 3.7.3 is owned by { +The copyright of NOMAD - version 3.8.1 is owned by { Sebastien Le Digabel - Ecole Polytechnique de Montreal Christophe Tribes - Ecole Polytechnique de Montreal } -NOMAD version 3 is a new version of Nomad v1 and v2, it has been funded by AFOSR and Exxon Mobil. -Nomad v1 and v2 were created and developed by Mark A. Abramson from The Boeing Company, Charles Audet and Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from Rice University, and were funded by AFOSR and Exxon Mobil. +NOMAD v3 has been funded by AFOSR and Exxon Mobil. +NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created +and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. +Dennis Jr., and were funded by AFOSR and Exxon Mobil. -Download : www.gerad.ca/nomad License : '$NOMAD_HOME/src/lgpl.txt' User guide: '$NOMAD_HOME/doc/user_guide.pdf' Examples : '$NOMAD_HOME/examples' @@ -24,22 +25,21 @@ Tools : '$NOMAD_HOME/tools' Please report bugs to nomad@gerad.ca +Seed: 0 + MADS run { BBE OBJ - 2 288.7926372100 (PhaseOne) - 3 254.0899760400 (PhaseOne) - 4 0.0000000000 (PhaseOne) - 4 -1.0733100000 - 10 -1.6099700000 - 15 -3.4882700000 - 45 -3.7565900000 - 79 -3.9578400000 - 100 -3.9578400000 + 2 144.0000000000 (PhaseOne) + 5 0.0000000000 (PhaseOne) + 6 1.0000000000 + 22 -3.0000000000 + 65 -4.0000000000 + 100 -4.0000000000 } end of run (max number of blackbox evaluations) blackbox evaluations : 100 -best infeasible solution (min. violation): ( 0.9838699101 1.609968944 1.01741093 0.5366563146 -3.95784032 ) h=0.167493 f=-3.95784 -best feasible solution : ( 0.9531239754 1.475804865 0.9447387205 0.6037383539 -3.95784032 ) h=0 f=-3.95784 +best infeasible solution (min. violation): ( 1.01 1 1 1 -4 ) h=0.0001 f=-4 +best feasible solution : ( 1 1 1 1 -4 ) h=0 f=-4 diff --git a/examples/basic/library/bi_obj/makefile b/examples/basic/library/bi_obj/makefile index 8a2cbcb18287149a640371395be865a0b0f0360e..76ff3c99a4d9e1b7757aca67b856b6e69df19662 100644 --- a/examples/basic/library/bi_obj/makefile +++ b/examples/basic/library/bi_obj/makefile @@ -25,7 +25,7 @@ CXXFLAGS_MPI = $(CXXFLAGS) -DUSE_MPI LDLIBS = -lm -lnomad LDLIBS_MPI = -lm -lmpi -lnomad.MPI -INCLUDE = -I$(NOMAD_HOME)/src -I. +INCLUDE = -I$(NOMAD_HOME)/src -I$(NOMAD_HOME)/ext/sgtelib/src -I. COMPILE = $(COMPILATOR) $(COMPILATOR_OPTIONS) $(INCLUDE) -c COMPILE_MPI = $(COMPILATOR_MPI) $(COMPILATOR_OPTIONS_MPI) $(INCLUDE) -c diff --git a/examples/basic/library/bi_obj/runExample.log b/examples/basic/library/bi_obj/runExample.log index a35b120072c645caea25843416d24fe0b0bd37bb..904053368ac934020c402cbe6ef103292924f104 100644 --- a/examples/basic/library/bi_obj/runExample.log +++ b/examples/basic/library/bi_obj/runExample.log @@ -1,10 +1,10 @@ multi-MADS run { - MADS run 1 ...... OK [bb eval= 46] [overall bb eval= 46] [# dominant pts= 3] [# new pts= 3] [f1=-6 f2=152.5555363] - MADS run 2 ...... OK [bb eval= 23] [overall bb eval= 69] [# dominant pts= 5] [# new pts= 2] [f1=-0.5603796086 f2=-9.723737785] - MADS run 3 ...... OK [bb eval= 23] [overall bb eval= 92] [# dominant pts= 8] [# new pts= 3] [f1=-5.121958283 f2=23.04985828] - MADS run 4 ...... OK [bb eval= 8] [overall bb eval= 100] [# dominant pts= 10] [# new pts= 2] [f1=-3.780317496 f2=7.348181107] + MADS run 1 ...... OK [bb eval= 46] [overall bb eval= 46] [# dominant pts= 3] [# new pts= 3] [f1=-6 f2=213.2002993] + MADS run 2 ...... OK [bb eval= 23] [overall bb eval= 69] [# dominant pts= 4] [# new pts= 1] [f1=0 f2=-11.47996457] + MADS run 3 ...... OK [bb eval= 23] [overall bb eval= 92] [# dominant pts= 6] [# new pts= 2] [f1=-4 f2=6.56986661] + MADS run 4 ...... OK [bb eval= 8] [overall bb eval= 100] [# dominant pts= 6] [# new pts= 0] [f1=-5 f2=20.26298095] } end of run (max number of bb evaluations) @@ -14,16 +14,12 @@ number of MADS runs : 4 Pareto front { - -6.0000000000 43.0227873016 - -5.9269427546 35.4890842852 - -5.3902864400 34.8873088235 - -5.1219582827 23.0498582755 - -4.5853019681 22.3745620084 - -3.7803174962 7.3481811074 - -2.7070048670 -2.5579608209 - -2.4386767097 -3.2681325630 - -0.8287077659 -4.2758679628 - -0.5603796086 -9.7237377852 + -6.0000000000 30.7676839388 + -5.0000000000 20.2629809527 + -4.0000000000 5.0153324458 + -3.0000000000 3.4022181034 + -2.0000000000 -9.2323160612 + 0.0000000000 -19.1788338820 } -number of Pareto points: 10 +number of Pareto points: 6 diff --git a/examples/basic/library/single_obj/basic_lib.cpp b/examples/basic/library/single_obj/basic_lib.cpp index 94b28b38ba083edfe646b1cf9fcbd15e867c703f..7cbcc6a5c343f8dc26199448eb84fe103b14a181 100644 --- a/examples/basic/library/single_obj/basic_lib.cpp +++ b/examples/basic/library/single_obj/basic_lib.cpp @@ -32,9 +32,6 @@ public: count_eval = true; // count a black-box evaluation - //if ( c1-25 < 0 && 25-c2 < 0 && x[4] < -3.2 ) - // NOMAD::Evaluator::force_quit(); - return true; // the evaluation succeeded } @@ -78,8 +75,7 @@ int main ( int argc , char ** argv ) { ub[2] = 7.0; // x_3 <= 7 p.set_UPPER_BOUND ( ub ); - p.set_LIMIT_MESH_INDEX( -1 ); - //p.set_MAX_BB_EVAL (10000); // the algorithm terminates after + p.set_MAX_BB_EVAL (100); // the algorithm terminates after // 100 black-box evaluations p.set_DISPLAY_DEGREE(2); p.set_SOLUTION_FILE("sol.txt"); diff --git a/examples/basic/library/single_obj/makefile b/examples/basic/library/single_obj/makefile index 8a2cbcb18287149a640371395be865a0b0f0360e..76ff3c99a4d9e1b7757aca67b856b6e69df19662 100644 --- a/examples/basic/library/single_obj/makefile +++ b/examples/basic/library/single_obj/makefile @@ -25,7 +25,7 @@ CXXFLAGS_MPI = $(CXXFLAGS) -DUSE_MPI LDLIBS = -lm -lnomad LDLIBS_MPI = -lm -lmpi -lnomad.MPI -INCLUDE = -I$(NOMAD_HOME)/src -I. +INCLUDE = -I$(NOMAD_HOME)/src -I$(NOMAD_HOME)/ext/sgtelib/src -I. COMPILE = $(COMPILATOR) $(COMPILATOR_OPTIONS) $(INCLUDE) -c COMPILE_MPI = $(COMPILATOR_MPI) $(COMPILATOR_OPTIONS_MPI) $(INCLUDE) -c diff --git a/examples/basic/library/single_obj/runExample.log b/examples/basic/library/single_obj/runExample.log index e10eb493b8917c9a46e5a28ac815427a8a823116..b99f4c9ea5019a9bc736b8ea7c503aa9330cd607 100644 --- a/examples/basic/library/single_obj/runExample.log +++ b/examples/basic/library/single_obj/runExample.log @@ -3,18 +3,15 @@ MADS run { BBE ( SOL ) OBJ - 2 ( 0.0000000000 0.5366563146 0.5813776741 -0.2683281573 0.2683281573 ) 288.7937255854 (PhaseOne) - 3 ( 0.0000000000 2.1466252584 2.3255106966 -1.0733126292 1.0733126292 ) 0.0000000000 (PhaseOne) - 3 ( 0.0000000000 2.1466252584 2.3255106966 -1.0733126292 1.0733126292 ) 1.0733126292 - 10 ( -0.1229837388 2.0124611797 2.9068883707 -1.1403946685 1.0062305899 ) 1.0062305899 - 11 ( -0.4919349550 1.6099689438 4.6510213932 -1.3416407865 0.8049844719 ) 0.8049844719 - 13 ( 0.0000000000 0.5366563146 5.2323990673 -0.5366563146 0.5366563146 ) 0.5366563146 - 28 ( 2.9516097303 2.6832815730 4.6510213932 0.5366563146 -1.0733126292 ) -1.0733126292 - 32 ( 0.4919349550 2.1466252584 1.1627553483 0.2683281573 -3.7565942022 ) -3.7565942022 - 100 ( 0.4919349550 2.1466252584 1.1627553483 0.2683281573 -3.7565942022 ) -3.7565942022 + 2 ( 0.0000000000 1.0000000000 1.0000000000 -1.0000000000 1.0000000000 ) 144.0000000000 (PhaseOne) + 4 ( 0.0000000000 3.0000000000 2.0000000000 -2.0000000000 1.0000000000 ) 0.0000000000 (PhaseOne) + 4 ( 0.0000000000 3.0000000000 2.0000000000 -2.0000000000 1.0000000000 ) 1.0000000000 + 20 ( 2.0000000000 1.0000000000 3.0000000000 -1.0000000000 -3.0000000000 ) -3.0000000000 + 57 ( 1.0000000000 1.0000000000 1.0000000000 1.0000000000 -4.0000000000 ) -4.0000000000 + 100 ( 1.0000000000 1.0000000000 1.0000000000 1.0000000000 -4.0000000000 ) -4.0000000000 } end of run (max number of blackbox evaluations) blackbox evaluations : 100 -best infeasible solution (min. violation): ( 2.459674775 0.5366563146 1.162755348 1.073312629 -3.756594202 ) h=0.0023902697 f=-3.756594202 -best feasible solution : ( 0.491934955 2.146625258 1.162755348 0.2683281573 -3.756594202 ) h=0 f=-3.756594202 +best infeasible solution (min. violation): ( 1.24 1.12 1.03 0.92 -4 ) h=0.0793 f=-4 +best feasible solution : ( 1 1 1 1 -4 ) h=0 f=-4 diff --git a/examples/basic/library/single_obj_parallel/basic_lib.cpp b/examples/basic/library/single_obj_parallel/basic_lib.cpp index e67457ea60d426a62f24cfcf8525da195f892fa5..f4f105433afe5cb3aed34ec283352f4bb85f857c 100644 --- a/examples/basic/library/single_obj_parallel/basic_lib.cpp +++ b/examples/basic/library/single_obj_parallel/basic_lib.cpp @@ -9,7 +9,7 @@ using namespace std; // using namespace NOMAD; avoids putting NOMAD:: everywhere // Number of threads to be used in parallel -#define NUM_THREADS 4 +#define NUM_THREADS 8 // A semaphore to manage the number of threads to be run concurrently sem_t mySemaphore; @@ -23,16 +23,22 @@ typedef struct Arg_Eval_tag { } Arg_Eval_t; -/*----------------------------------------*/ -/* The problem evaluatiom */ -/*----------------------------------------*/ -// Provide the objective and constraints here -bool eval_x ( NOMAD::Eval_Point & x , - const NOMAD::Double & h_max , - bool & count_eval ) +// Wrapper of eval_x used for parallel evaluation (pthreads). +static void * wrapper_eval_x ( void * dummy_eval_arg ) { + Arg_Eval_t * eval_arg = static_cast<Arg_Eval_t *>(dummy_eval_arg); + + NOMAD::Eval_Point & x=*(eval_arg->x); + bool & count_eval = *(eval_arg->count_eval); + const NOMAD::Double & h_max = (eval_arg->h_max); + + + + + NOMAD::Double c1 = 0.0 , c2 = 0.0; + for ( int i = 0 ; i < 5 ; i++ ) { c1 += (x[i]-1).pow2(); @@ -44,21 +50,6 @@ bool eval_x ( NOMAD::Eval_Point & x , count_eval = true; // count a black-box evaluation - return true; // the evaluation succeeded -} - -// Wrapper of eval_x used for parallel evaluation (pthreads). -static void * wrapper_eval_x ( void * dummy_eval_arg ) -{ - - Arg_Eval_t * eval_arg = static_cast<Arg_Eval_t *>(dummy_eval_arg); - - NOMAD::Eval_Point & x=*(eval_arg->x); - bool & count_eval = *(eval_arg->count_eval); - const NOMAD::Double & h_max = (eval_arg->h_max); - - eval_x(x,h_max,count_eval); - pthread_exit(NULL); // The semaphore is incremented. Another thread can be started @@ -67,14 +58,67 @@ static void * wrapper_eval_x ( void * dummy_eval_arg ) } + class My_Evaluator : public NOMAD::Evaluator { + public: My_Evaluator ( const NOMAD::Parameters & p ) : NOMAD::Evaluator ( p ) {} ~My_Evaluator ( void ) {} + + + + bool eval_x ( NOMAD::Eval_Point & x , + const NOMAD::Double & h_max , + bool & count_eval ) + { + + pthread_t threads[1]; + + // Arguments passed to the evaluation wrapper + Arg_Eval_t * eval_arg=new Arg_Eval_t[1]; + + eval_arg[0].x=&x; + eval_arg[0].h_max=h_max.value(); + eval_arg[0].count_eval=&count_eval; + + + // The semaphore will allow to run one thread + sem_init(&mySemaphore,0,1); + + try + { + + int rc=pthread_create(&threads[0], NULL, wrapper_eval_x,&eval_arg[0]); + if (rc) + { + cout << "Error:unable to create thread," << rc << endl; + return false; + } + + int ret=pthread_join(threads[0],0); + if (ret!=0) + { + perror("pthread join has failed"); + return false; + } + + + // wait until value of semaphore is 1 --> thread is finished + sem_wait(&mySemaphore); + } + catch( exception & e ) + { + + cerr << "\nEval_x wrapper returned exeption (" << e.what() << ")\n\n"; + return false; + } + + return true; // the evaluation succeeded + } // Implementation bool eval_x ( std::list<NOMAD::Eval_Point *> &list_x , diff --git a/examples/basic/library/single_obj_parallel/makefile b/examples/basic/library/single_obj_parallel/makefile index 1675b5e0e1528b4f6bddad6b5485c101d6ce3292..d3953fe0005ad26916785a39af12f89b567d4914 100644 --- a/examples/basic/library/single_obj_parallel/makefile +++ b/examples/basic/library/single_obj_parallel/makefile @@ -19,7 +19,7 @@ endif LDLIBS = -lm -lnomad -lpthread -INCLUDE = -I$(NOMAD_HOME)/src -I. +INCLUDE = -I$(NOMAD_HOME)/src -I$(NOMAD_HOME)/ext/sgtelib/src -I. COMPILE = $(COMPILATOR) $(COMPILATOR_OPTIONS) $(INCLUDE) -c diff --git a/examples/basic/library/single_obj_parallel/runExample.log b/examples/basic/library/single_obj_parallel/runExample.log index 69e53dea871dd9c99743dd0cf542596918dc5f55..8bd3323070a7327f1ba1661ab501e1d667ff4849 100644 --- a/examples/basic/library/single_obj_parallel/runExample.log +++ b/examples/basic/library/single_obj_parallel/runExample.log @@ -6,21 +6,17 @@ MADS run { BBE ( SOL ) OBJ - 2 ( 0.0000000000 0.5366563146 0.5813776741 -0.2683281573 0.2683281573 ) 288.7937255854 (PhaseOne) - 3 ( 0.4919349550 1.0733126292 0.0000000000 0.0000000000 -0.2683281573 ) 254.0887373636 (PhaseOne) - 4 ( 0.4919349550 0.0000000000 1.1627553483 0.2683281573 -0.2683281573 ) 223.5808267209 (PhaseOne) - 6 ( 1.9677398202 0.0000000000 4.6510213932 1.0733126292 -1.0733126292 ) 0.0000000000 (PhaseOne) - 6 ( 1.9677398202 0.0000000000 4.6510213932 1.0733126292 -1.0733126292 ) -1.0733126292 - 12 ( 1.4758048651 -0.5366563146 4.0696437190 0.8049844719 -1.6099689438 ) -1.6099689438 - 14 ( 0.4919349550 0.5366563146 4.0696437190 0.2683281573 -2.4149534157 ) -2.4149534157 - 30 ( 1.9677398202 0.0000000000 2.9068883707 0.2683281573 -2.9516097303 ) -2.9516097303 - 44 ( 2.4596747752 2.1466252584 1.1627553483 0.2683281573 -3.4882660449 ) -3.4882660449 - 76 ( 1.9677398202 1.6099689438 1.7441330224 0.4024922359 -3.7565942022 ) -3.7565942022 - 88 ( 1.4758048651 0.9391485505 1.8894774410 0.6708203932 -3.8236762415 ) -3.8236762415 - 100 ( 1.4758048651 0.9391485505 1.8894774410 0.6708203932 -3.8236762415 ) -3.8236762415 + 2 ( 0.0000000000 1.0000000000 1.0000000000 -1.0000000000 1.0000000000 ) 144.0000000000 (PhaseOne) + 8 ( 1.0000000000 3.0000000000 3.0000000000 0.0000000000 3.0000000000 ) 0.0000000000 (PhaseOne) + 10 ( 1.0000000000 3.0000000000 3.0000000000 -2.0000000000 3.0000000000 ) 3.0000000000 + 19 ( 0.0000000000 1.0000000000 5.0000000000 1.0000000000 2.0000000000 ) 2.0000000000 + 38 ( -1.0000000000 1.0000000000 4.0000000000 4.0000000000 0.0000000000 ) 0.0000000000 + 46 ( 0.0000000000 3.0000000000 2.0000000000 1.0000000000 -3.0000000000 ) -3.0000000000 + 70 ( 1.0000000000 1.0000000000 1.0000000000 1.0000000000 -4.0000000000 ) -4.0000000000 + 100 ( 1.0000000000 1.0000000000 1.0000000000 1.0000000000 -4.0000000000 ) -4.0000000000 } end of run (max number of blackbox evaluations) blackbox evaluations : 100 -best infeasible solution (min. violation): ( 1.96773982 1.744133022 1.598788604 0.2683281573 -3.756594202 ) h=0.009334196675 f=-3.756594202 -best feasible solution : ( 1.475804865 0.9391485505 1.889477441 0.6708203932 -3.823676242 ) h=0 f=-3.823676242 +best infeasible solution (min. violation): ( 0.95 1.5 1.29 1.15 -3.98 ) h=0.1595 f=-3.98 +best feasible solution : ( 1 1 1 1 -4 ) h=0 f=-4 diff --git a/examples/interfaces/AMPL/param.txt b/examples/interfaces/AMPL/param.txt index 8a9b875bcf33ce1afb4ded77a28826b391f5aead..aef7b14c4da55cd1b0a9745bb0a009810b8f418c 100755 --- a/examples/interfaces/AMPL/param.txt +++ b/examples/interfaces/AMPL/param.txt @@ -1,10 +1,10 @@ -DIMENSION 8 -BB_EXE bb.exe -BB_OUTPUT_TYPE OBJ PB PB PB -x0 points/x0.txt -lower_bound points/lb.txt -upper_bound points/ub.txt -#tmp_dir /tmp -max_bb_eval 1000 -h_min 0.05 -#display_degree 2 +DIMENSION 8 +BB_EXE bb.exe +BB_OUTPUT_TYPE OBJ PB PB PB +x0 points/x0.txt +lower_bound points/lb.txt +upper_bound points/ub.txt +#tmp_dir /tmp +max_bb_eval 1000 +h_min 0.05 +#display_degree 2 diff --git a/examples/interfaces/AMPL/readme.txt b/examples/interfaces/AMPL/readme.txt index d42d5e8338cf844a985ee3babd492e6027ade48d..626e1ed9bc8a4e70e8eb6121689367f9396527ff 100644 --- a/examples/interfaces/AMPL/readme.txt +++ b/examples/interfaces/AMPL/readme.txt @@ -1,45 +1,44 @@ -Instructions to use AMPL models with NOMAD: - -1. Install the AMPL interface library. - - This interface can be downloaded at - ftp://www.netlib.org/ampl/solvers.tar.gz - or at http://www.gerad.ca/~orban/LibAmpl/ - (for a simple installation and the generation of dynamic libraries). - - The example given in the NOMAD package uses the dynamic library version. - - Complete instructions on the AMPL interface are available at: - http://ampl.com/REFS/HOOKING/index.html - -2. Put the AMPL files in directory MODELDIR; - Suppose that the name of your model is MODELDIR/modelname. - -3. Create a .nl file from your model: - - Open AMPL, load your model with the command 'model modelname;' - (and possibly your data file), and create the nl file with the - command 'write gmodelname;' - (use the 'g' character to generate an ascii nl file). - -4. Create x0 and bound files from the AMPL model. - - Warning: check the variable indexing that is not necessarily - the same than in the model file. - -5. Edit the file 'bb.c' and define the appropriate string for MODEL_NAME. - -6. Compile bb.c with the command 'make'; this creates 'bb.exe' - (be sure that your makefile uses the right path for your AMPL interface - library). - - You can test the bb.exe program by defining DISPLAY in bb.c - -7. Write your NOMAD parameters file; pay attention to - the number of variables, the constraints, starting point - and the bounds. - -8. Run NOMAD. - - -Many thanks to Dominique Orban, Quentin Reynaud, and Anthony Guillou. \ No newline at end of file +Instructions to use AMPL models with NOMAD: + +1. Install the AMPL interface library. + + This interface can be downloaded at + http://www.netlib.org/ampl/solvers + (for a simple installation and the generation of dynamic libraries). + + The example given in the NOMAD package uses the dynamic library version. + + Complete instructions on the AMPL interface are available at: + http://ampl.com/REFS/HOOKING/index.html + +2. Put the AMPL files in directory MODELDIR; + Suppose that the name of your model is MODELDIR/modelname. + +3. Create a .nl file from your model: + + Open AMPL, load your model with the command 'model modelname;' + (and possibly your data file), and create the nl file with the + command 'write gmodelname;' + (use the 'g' character to generate an ascii nl file). + +4. Create x0 and bound files from the AMPL model. + + Warning: check the variable indexing that is not necessarily + the same than in the model file. + +5. Edit the file 'bb.c' and define the appropriate string for MODEL_NAME. + +6. Compile bb.c with the command 'make'; this creates 'bb.exe' + (be sure that your makefile uses the right path for your AMPL interface + library). + + You can test the bb.exe program by defining DISPLAY in bb.c + +7. Write your NOMAD parameters file; pay attention to + the number of variables, the constraints, starting point + and the bounds. + +8. Run NOMAD. + + +Many thanks to Dominique Orban, Quentin Reynaud, and Anthony Guillou. diff --git a/examples/interfaces/AMPL/runExample.log b/examples/interfaces/AMPL/runExample.log deleted file mode 100644 index 4e5a25f286c6a2c883d09ef4ec2dc31774b49dcb..0000000000000000000000000000000000000000 --- a/examples/interfaces/AMPL/runExample.log +++ /dev/null @@ -1,80 +0,0 @@ - -NOMAD - version 3.7.1 - www.gerad.ca/nomad - -Copyright (C) 2001-2015 { - Mark A. Abramson - The Boeing Company - Charles Audet - Ecole Polytechnique de Montreal - Gilles Couture - Ecole Polytechnique de Montreal - John E. Dennis, Jr. - Rice University - Sebastien Le Digabel - Ecole Polytechnique de Montreal - Christophe Tribes - Ecole Polytechnique de Montreal -} - -Funded in part by AFOSR and Exxon Mobil. - -License : '$NOMAD_HOME/src/lgpl.txt' -User guide: '$NOMAD_HOME/doc/user_guide.pdf' -Examples : '$NOMAD_HOME/examples' -Tools : '$NOMAD_HOME/tools' - -Please report bugs to nomad@gerad.ca - -MADS run { - - BBE OBJ - - 1 0.0008855723 - 13 0.0008629415 - 73 0.0007682919 - 158 0.0007674024 - 160 0.0007590596 - 176 0.0007580561 - 223 0.0007473508 - 238 0.0007418250 - 253 0.0007372242 - 313 0.0007347847 - 315 0.0007332118 - 317 0.0007326378 - 319 0.0007305500 - 349 0.0007267455 - 364 0.0007266172 - 387 0.0007257315 - 394 0.0007248895 - 435 0.0007231991 - 437 0.0007231585 - 439 0.0007228901 - 445 0.0007225342 - 475 0.0007215812 - 490 0.0007212792 - 505 0.0007211745 - 511 0.0007211392 - 532 0.0007207825 - 547 0.0007206714 - 606 0.0007200196 - 635 0.0007200045 - 653 0.0007198430 - 657 0.0007198134 - 684 0.0007197965 - 711 0.0007197807 - 712 0.0007197631 - 767 0.0007197518 - 783 0.0007197518 - 811 0.0007197377 - 825 0.0007197358 - 840 0.0007197336 - 841 0.0007197273 - 902 0.0007197266 - 904 0.0007197250 - 919 0.0007197244 - 920 0.0007197231 - 935 0.0007197211 - 963 0.0007197196 - 965 0.0007197191 - 993 0.0007197174 - 1000 0.0007197174 - -} end of run (max number of blackbox evaluations) - -blackbox evaluations : 1000 -best infeasible solution (min. violation): ( 0.8485876659 1.323962574e-06 2.55409902e-06 1.18495206e-06 4.478102654e-06 0.07926348224 0.03138097659 0.01128972406 ) h=0.05000000006 f=0.0007197247301 -best feasible solution : ( 0.8485431024 1.006379485e-06 7.250492715e-07 1.072192777e-06 2.36219915e-06 0.07937295341 0.03130849192 0.01130402409 ) h=0 f=0.0007197173872 diff --git a/examples/interfaces/CUTEr/.SIF b/examples/interfaces/CUTEr/.SIF deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/examples/interfaces/CUTEr/param.txt b/examples/interfaces/CUTEr/param.txt index 05b0dfb619b0071309fc37e1c6af2ca23692039c..a203759b8f6260facd66a611329716341ec5e487 100644 --- a/examples/interfaces/CUTEr/param.txt +++ b/examples/interfaces/CUTEr/param.txt @@ -1,17 +1,17 @@ -DIMENSION 6 -DISPLAY_DEGREE 1 -DISPLAY_STATS BBE OBJ -#TMP_DIR /tmp -x0 x0.txt - -initial_mesh_size 1.0 - -BB_EXE bb.exe -BB_OUTPUT_TYPE OBJ -MAX_BB_EVAL 100 - -DIRECTION_TYPE ortho 2n - -#stats_file ortho.stats TIME BBE OBJ -#solution_file ortho.sol -#history_file ortho.history +DIMENSION 6 +DISPLAY_DEGREE 1 +DISPLAY_STATS BBE OBJ +#TMP_DIR /tmp +x0 x0.txt + +initial_mesh_size 1.0 + +BB_EXE bb.exe +BB_OUTPUT_TYPE OBJ +MAX_BB_EVAL 100 + +DIRECTION_TYPE ortho 2n + +#stats_file ortho.stats TIME BBE OBJ +#solution_file ortho.sol +#history_file ortho.history diff --git a/examples/interfaces/CUTEr/readme.txt b/examples/interfaces/CUTEr/readme.txt index 4e889806f7bcde57df1e8f4bdfcacaed8fb5eb68..30df58cfc3b54d9ebe336d02da8ee29b9b604e8b 100644 --- a/examples/interfaces/CUTEr/readme.txt +++ b/examples/interfaces/CUTEr/readme.txt @@ -1,26 +1,26 @@ - -This example illustrates how to use NOMAD with a CUTEr test problem, -given in a SIF files. - -You need to have CUTEr installed, including a SIF decoder. -Everything is available at http://hsl.rl.ac.uk/cuter-www/. - -Once the CUTEr installation is complete, define these environment variables: - -(bash) -export CUTER=/home/user_name/CUTEr -export MYCUTER=$CUTER/CUTEr.***** (depends on specified options during install) -export SIFDEC=/home/user_name/sifdec -export MYSIFDEC=$SIFDEC/SifDec.**** (depends on specified options during install) - -Then use the sifdecode program on the problem file: -$MYSIFDEC/bin/sifdecode PROBLEM.SIF - - -Compile with the C wrapper 'bb.c' by running the script 'compile' -(it uses gfortran and gcc, but you can use other C and Fortran compilers). - -The black-box executable 'bb.exe' should be created. - -You can test it with the command 'bb.exe x0.txt', and run nomad with the command -'nomad.exe param.txt'. + +This example illustrates how to use NOMAD with a CUTEr test problem, +given in a SIF files. + +You need to have CUTEr installed, including a SIF decoder. +Everything is available at http://hsl.rl.ac.uk/cuter-www/. + +Once the CUTEr installation is complete, define these environment variables: + +(bash) +export CUTER=/home/user_name/CUTEr +export MYCUTER=$CUTER/CUTEr.***** (depends on specified options during install) +export SIFDEC=/home/user_name/sifdec +export MYSIFDEC=$SIFDEC/SifDec.**** (depends on specified options during install) + +Then use the sifdecode program on the problem file: +$MYSIFDEC/bin/sifdecode PROBLEM.SIF + + +Compile with the C wrapper 'bb.c' by running the script 'compile' +(it uses gfortran and gcc, but you can use other C and Fortran compilers). + +The black-box executable 'bb.exe' should be created. + +You can test it with the command 'bb.exe x0.txt', and run nomad with the command +'nomad.exe param.txt'. diff --git a/examples/interfaces/CUTEr/runExample.log b/examples/interfaces/CUTEr/runExample.log deleted file mode 100644 index 30c346df379d1f5eea97bebd75963d9a56616468..0000000000000000000000000000000000000000 --- a/examples/interfaces/CUTEr/runExample.log +++ /dev/null @@ -1,8 +0,0 @@ - 1 0.7790700745 - 3 0.7162723833 - 13 0.5256708208 - 27 0.3791633061 - 32 0.1064077292 - 60 0.0907346567 - 64 0.0598216531 - 75 0.0520664153 diff --git a/examples/interfaces/DLL/bi_obj/nomad_for_DLL.cpp b/examples/interfaces/DLL/bi_obj/nomad_for_DLL.cpp index 316e94b2d4c1ff02bd76f7f22dcfa0675c34a8ef..f5635682298eba8cb2a985612abbc8380524b848 100755 --- a/examples/interfaces/DLL/bi_obj/nomad_for_DLL.cpp +++ b/examples/interfaces/DLL/bi_obj/nomad_for_DLL.cpp @@ -1,212 +1,212 @@ -/*---------------------------------------------------------------*/ -/* NOMAD for a DLL-black-box */ -/*---------------------------------------------------------------*/ -#include "nomad.hpp" -#include <windows.h> -using namespace std; -using namespace NOMAD; - -// black-box outputs (m): -// ---------------------- -// . the first one is the objective function -// . all the others (1 to m-1) are PB constraints with format g(x) <= 0 - - -/*------------------------------------------*/ -/* DLL functions */ -/*------------------------------------------*/ -typedef int (_stdcall *GET_NM)( void ); -typedef void (_stdcall *EVAL_X)( double * , double * , bool * ); -typedef void (_stdcall *INIT )( void ); - -GET_NM get_n_dll; -GET_NM get_m_dll; -EVAL_X eval_x_dll; -//INIT init_dll; -//INIT clear_dll; - -// simulate the DLL functions (for tests): -/* -void init ( void ) {} -void clear ( void ) {} -int get_n_dll ( void ) { return 5; } -int get_m_dll ( void ) { return 3; } -void eval_x_dll ( double * x , double * fx , bool & cnt_eval ) { - double c1 = 0.0 , c2 = 0.0; - for ( int i = 0 ; i < 5 ; ++i ) { - c1 += pow ( x[i]-1 , 2 ); - c2 += pow ( x[i]+1 , 2 ); - } - fx[0] = x[4]; - fx[1] = c1 - 25; - fx[2] = 25 - c2; - cnt_eval = true; -} -*/ - -/*--------------------------------------*/ -/* custom evaluator */ -/*--------------------------------------*/ -class My_Evaluator : public Multi_Obj_Evaluator { - -private: - - int _n; - int _m; - double * _px; - double * _fx; - -public: - - // ctor: - My_Evaluator ( const Parameters & p , int n , int m ) - : Multi_Obj_Evaluator ( p ) , - _n ( n ) , - _m ( m ) , - _px ( new double [_n] ) , - _fx ( new double [_m] ) {} - - // dtor: - ~My_Evaluator ( void ) { delete [] _px; delete [] _fx; } - - // eval_x: - bool eval_x ( Eval_Point & x , - const NOMAD::Double & h_max , - bool & cnt_eval ) const; -}; - -// eval_x: -bool My_Evaluator::eval_x ( Eval_Point & x , - const NOMAD::Double & h_max , - bool & cnt_eval ) const { - int i; - for ( i = 0 ; i < _n ; ++i ) - _px[i] = x[i].value(); - eval_x_dll ( _px , _fx , &cnt_eval ); - for ( i = 0 ; i < _m ; ++i ) - x.set_bb_output ( i , _fx[i] ); - return true; -} - -/*------------------------------------------*/ -/* NOMAD main function */ -/*------------------------------------------*/ -int main ( int argc , char ** argv ) { - - // use: - if ( argc != 2 ) { - cerr << "\nuse: nomad_for_DLL.exe param.txt\n\n"; - return 1; - } - - // NOMAD initializations: - begin ( argc , argv ); - - // display: - NOMAD::Display out ( std::cout ); - out.precision ( NOMAD::DISPLAY_PRECISION_STD ); - - // random seed: - unsigned seed = 0; - srand(seed); - - // define DLL functions: - // get handle to dll: - HINSTANCE hdll = LoadLibrary ( TEXT("bb.dll") ); - if ( !hdll ) { - cerr << "ERROR: unable to open bb.dll" << endl; - FreeLibrary ( hdll ); - return 1; - } - - // get function pointers: - get_n_dll = (GET_NM)GetProcAddress(hdll, "GET_N"); - if ( !get_n_dll ) { - cerr << "ERROR: unable to find GET_N function in dll" << endl; - FreeLibrary ( hdll ); - return 1; - } - - get_m_dll = (GET_NM)GetProcAddress(hdll, "GET_M"); - if ( !get_m_dll ) { - cerr << "ERROR: unable to find GET_M function in dll" << endl; - FreeLibrary ( hdll ); - return 1; - } - - eval_x_dll = (EVAL_X)GetProcAddress(hdll, "EVAL_X"); - if ( !eval_x_dll ) { - cerr << "ERROR: unable to find EVAL_X function in dll" << endl; - FreeLibrary ( hdll ); - return 1; - } - - /* init_dll = (INIT)GetProcAddress(hdll, "INIT"); - if ( !init_dll ) { - cerr << "ERROR: unable to find INIT function in dll" << endl; - FreeLibrary ( hdll ); - return 1; - } - - clear_dll = (INIT)GetProcAddress(hdll, "CLEAR"); - if ( !clear_dll ) { - cerr << "ERROR: unable to find CLEAR function in dll" << endl; - FreeLibrary ( hdll ); - return 1; - }*/ - - // MADS: - try { - - /* init_dll(); */ - - int n = get_n_dll(); - int m = get_m_dll(); - - // parameters creation: - // -------------------- - Parameters p ( out ); - - // dimension: - p.set_DIMENSION ( n ); - - // definition of output types: - vector<bb_output_type> bbot (m); - bbot[0] = bbot[1] = OBJ; - for ( int i = 2 ; i < m ; ++i ) - bbot[i] = PB; - p.set_BB_OUTPUT_TYPE ( bbot ); - - // read parameters file: - p.read ( argv[1] ); - - // parameters check: - p.check(); - - // display parameters: - // out << p << endl; - - // custom evaluator creation: - My_Evaluator ev ( p , n , m ); - - // algorithm creation and execution: - Mads mads ( p , &ev ); - mads.multi_run(); - - // algorithm display: - // out << mads << endl; - - /* clear_dll(); */ - } - catch ( exception & e ) { - cerr << "\nNOMAD has been interrupted (" << e.what() << ")\n\n"; - } - - // Release the Dll: - FreeLibrary ( hdll ); - - NOMAD::Slave::stop_slaves ( out ); - NOMAD::end(); - - return EXIT_SUCCESS; -} +/*---------------------------------------------------------------*/ +/* NOMAD for a DLL-black-box */ +/*---------------------------------------------------------------*/ +#include "nomad.hpp" +#include <windows.h> +using namespace std; +using namespace NOMAD; + +// black-box outputs (m): +// ---------------------- +// . the first one is the objective function +// . all the others (1 to m-1) are PB constraints with format g(x) <= 0 + + +/*------------------------------------------*/ +/* DLL functions */ +/*------------------------------------------*/ +typedef int (_stdcall *GET_NM)( void ); +typedef void (_stdcall *EVAL_X)( double * , double * , bool * ); +typedef void (_stdcall *INIT )( void ); + +GET_NM get_n_dll; +GET_NM get_m_dll; +EVAL_X eval_x_dll; +//INIT init_dll; +//INIT clear_dll; + +// simulate the DLL functions (for tests): +/* +void init ( void ) {} +void clear ( void ) {} +int get_n_dll ( void ) { return 5; } +int get_m_dll ( void ) { return 3; } +void eval_x_dll ( double * x , double * fx , bool & cnt_eval ) { + double c1 = 0.0 , c2 = 0.0; + for ( int i = 0 ; i < 5 ; ++i ) { + c1 += pow ( x[i]-1 , 2 ); + c2 += pow ( x[i]+1 , 2 ); + } + fx[0] = x[4]; + fx[1] = c1 - 25; + fx[2] = 25 - c2; + cnt_eval = true; +} +*/ + +/*--------------------------------------*/ +/* custom evaluator */ +/*--------------------------------------*/ +class My_Evaluator : public Multi_Obj_Evaluator { + +private: + + int _n; + int _m; + double * _px; + double * _fx; + +public: + + // ctor: + My_Evaluator ( const Parameters & p , int n , int m ) + : Multi_Obj_Evaluator ( p ) , + _n ( n ) , + _m ( m ) , + _px ( new double [_n] ) , + _fx ( new double [_m] ) {} + + // dtor: + ~My_Evaluator ( void ) { delete [] _px; delete [] _fx; } + + // eval_x: + bool eval_x ( Eval_Point & x , + const NOMAD::Double & h_max , + bool & cnt_eval ) const; +}; + +// eval_x: +bool My_Evaluator::eval_x ( Eval_Point & x , + const NOMAD::Double & h_max , + bool & cnt_eval ) const { + int i; + for ( i = 0 ; i < _n ; ++i ) + _px[i] = x[i].value(); + eval_x_dll ( _px , _fx , &cnt_eval ); + for ( i = 0 ; i < _m ; ++i ) + x.set_bb_output ( i , _fx[i] ); + return true; +} + +/*------------------------------------------*/ +/* NOMAD main function */ +/*------------------------------------------*/ +int main ( int argc , char ** argv ) { + + // use: + if ( argc != 2 ) { + cerr << "\nuse: nomad_for_DLL.exe param.txt\n\n"; + return 1; + } + + // NOMAD initializations: + begin ( argc , argv ); + + // display: + NOMAD::Display out ( std::cout ); + out.precision ( NOMAD::DISPLAY_PRECISION_STD ); + + // random seed: + unsigned seed = 0; + srand(seed); + + // define DLL functions: + // get handle to dll: + HINSTANCE hdll = LoadLibrary ( TEXT("bb.dll") ); + if ( !hdll ) { + cerr << "ERROR: unable to open bb.dll" << endl; + FreeLibrary ( hdll ); + return 1; + } + + // get function pointers: + get_n_dll = (GET_NM)GetProcAddress(hdll, "GET_N"); + if ( !get_n_dll ) { + cerr << "ERROR: unable to find GET_N function in dll" << endl; + FreeLibrary ( hdll ); + return 1; + } + + get_m_dll = (GET_NM)GetProcAddress(hdll, "GET_M"); + if ( !get_m_dll ) { + cerr << "ERROR: unable to find GET_M function in dll" << endl; + FreeLibrary ( hdll ); + return 1; + } + + eval_x_dll = (EVAL_X)GetProcAddress(hdll, "EVAL_X"); + if ( !eval_x_dll ) { + cerr << "ERROR: unable to find EVAL_X function in dll" << endl; + FreeLibrary ( hdll ); + return 1; + } + + /* init_dll = (INIT)GetProcAddress(hdll, "INIT"); + if ( !init_dll ) { + cerr << "ERROR: unable to find INIT function in dll" << endl; + FreeLibrary ( hdll ); + return 1; + } + + clear_dll = (INIT)GetProcAddress(hdll, "CLEAR"); + if ( !clear_dll ) { + cerr << "ERROR: unable to find CLEAR function in dll" << endl; + FreeLibrary ( hdll ); + return 1; + }*/ + + // MADS: + try { + + /* init_dll(); */ + + int n = get_n_dll(); + int m = get_m_dll(); + + // parameters creation: + // -------------------- + Parameters p ( out ); + + // dimension: + p.set_DIMENSION ( n ); + + // definition of output types: + vector<bb_output_type> bbot (m); + bbot[0] = bbot[1] = OBJ; + for ( int i = 2 ; i < m ; ++i ) + bbot[i] = PB; + p.set_BB_OUTPUT_TYPE ( bbot ); + + // read parameters file: + p.read ( argv[1] ); + + // parameters check: + p.check(); + + // display parameters: + // out << p << endl; + + // custom evaluator creation: + My_Evaluator ev ( p , n , m ); + + // algorithm creation and execution: + Mads mads ( p , &ev ); + mads.multi_run(); + + // algorithm display: + // out << mads << endl; + + /* clear_dll(); */ + } + catch ( exception & e ) { + cerr << "\nNOMAD has been interrupted (" << e.what() << ")\n\n"; + } + + // Release the Dll: + FreeLibrary ( hdll ); + + NOMAD::Slave::stop_slaves ( out ); + NOMAD::end(); + + return EXIT_SUCCESS; +} diff --git a/examples/interfaces/DLL/bi_obj/param.txt b/examples/interfaces/DLL/bi_obj/param.txt index fea33eff08041ea0badd4c9fbe3af20959c45d8b..7b6d6bb07dfbe5b6006ca390a31169ed7d2959c5 100755 --- a/examples/interfaces/DLL/bi_obj/param.txt +++ b/examples/interfaces/DLL/bi_obj/param.txt @@ -1,28 +1,28 @@ -#seed 100 - -initial_mesh_size r0.1 - -direction_type ortho 2n - - -multi_overall_bb_eval 1000 - -lower_bound * -10.0 - -upper_bound * 10.0 - - -x0 ( 2 3 4 5 6 ) - -display_degree 3 - - -add_seed_to_file_names no - -#stats_file toto.txt bbe obj -#solution_file "sol.txt" - -#LH_SEARCH 100 0 - -#OPPORTUNISTIC_LH no - +#seed 100 + +initial_mesh_size r0.1 + +direction_type ortho 2n + + +multi_overall_bb_eval 1000 + +lower_bound * -10.0 + +upper_bound * 10.0 + + +x0 ( 2 3 4 5 6 ) + +display_degree 3 + + +add_seed_to_file_names no + +#stats_file toto.txt bbe obj +#solution_file "sol.txt" + +#LH_SEARCH 100 0 + +#OPPORTUNISTIC_LH no + diff --git a/examples/interfaces/DLL/bi_obj/readme.txt b/examples/interfaces/DLL/bi_obj/readme.txt index 8889d3d20527bdcb3526d71a661f767b543d722c..a37fa9ce3daa29a495dedbeba3f3be4a78828c27 100755 --- a/examples/interfaces/DLL/bi_obj/readme.txt +++ b/examples/interfaces/DLL/bi_obj/readme.txt @@ -1,54 +1,54 @@ - -This example illustrates how to use NOMAD with a black-box -problem that is coded inside a DLL file. - -The problem has two objective values to minimize. - -The example runs on windows with visual C++ and minGW. - - -DLL characteristics: - -/*----------*/ - -/* bb.dll */ - -/*----------*/ - - - -// init/clear: - -// ----------- - -void init_dll ( void ); - -void clear_dll ( void ); - -// problem characteristics: - -// ------------------------ - - -int get_n_dll ( void ); // number of variables - -int get_m _dll( void ); // number of outputs: output #0 and #1: objective values to minimize - - // output #2..m-1: PB constraints with format g(x) <= 0 - - - -// evaluation: f(x): - -// ----------------- - - -void eval_x_dll ( double * x , double * fx , bool & count_eval ); - - - -// x: input , double array of size n - -// fx: output, double array of size m - -// count_eval: output, set to true if the evaluation has to be counted, false else + +This example illustrates how to use NOMAD with a black-box +problem that is coded inside a DLL file. + +The problem has two objective values to minimize. + +The example runs on windows with visual C++ and minGW. + + +DLL characteristics: + +/*----------*/ + +/* bb.dll */ + +/*----------*/ + + + +// init/clear: + +// ----------- + +void init_dll ( void ); + +void clear_dll ( void ); + +// problem characteristics: + +// ------------------------ + + +int get_n_dll ( void ); // number of variables + +int get_m _dll( void ); // number of outputs: output #0 and #1: objective values to minimize + + // output #2..m-1: PB constraints with format g(x) <= 0 + + + +// evaluation: f(x): + +// ----------------- + + +void eval_x_dll ( double * x , double * fx , bool & count_eval ); + + + +// x: input , double array of size n + +// fx: output, double array of size m + +// count_eval: output, set to true if the evaluation has to be counted, false else diff --git a/examples/interfaces/DLL/single_obj/nomad_for_DLL.cpp b/examples/interfaces/DLL/single_obj/nomad_for_DLL.cpp index 43f4dcf71045b68012a898e7e986eed4925995ab..968a4d7f2e031c39af4da8c3a9bfe451a37bc296 100755 --- a/examples/interfaces/DLL/single_obj/nomad_for_DLL.cpp +++ b/examples/interfaces/DLL/single_obj/nomad_for_DLL.cpp @@ -1,212 +1,212 @@ -/*---------------------------------------------------------------*/ -/* NOMAD for a DLL-black-box */ -/*---------------------------------------------------------------*/ -#include "nomad.hpp" -#include <windows.h> -using namespace std; -using namespace NOMAD; - -// black-box outputs (m): -// ---------------------- -// . the first one is the objective function -// . all the others (1 to m-1) are PB constraints with format g(x) <= 0 - - -/*------------------------------------------*/ -/* DLL functions */ -/*------------------------------------------*/ -typedef int (_stdcall *GET_NM)( void ); -typedef void (_stdcall *EVAL_X)( double * , double * , bool * ); -typedef void (_stdcall *INIT )( void ); - -GET_NM get_n_dll; -GET_NM get_m_dll; -EVAL_X eval_x_dll; -//INIT init_dll; -//INIT clear_dll; - -// simulate the DLL functions (for tests): -/* -void init ( void ) {} -void clear ( void ) {} -int get_n_dll ( void ) { return 5; } -int get_m_dll ( void ) { return 3; } -void eval_x_dll ( double * x , double * fx , bool & cnt_eval ) { - double c1 = 0.0 , c2 = 0.0; - for ( int i = 0 ; i < 5 ; ++i ) { - c1 += pow ( x[i]-1 , 2 ); - c2 += pow ( x[i]+1 , 2 ); - } - fx[0] = x[4]; - fx[1] = c1 - 25; - fx[2] = 25 - c2; - cnt_eval = true; -} -*/ - -/*--------------------------------------*/ -/* custom evaluator */ -/*--------------------------------------*/ -class My_Evaluator : public Evaluator { - -private: - - int _n; - int _m; - double * _px; - double * _fx; - -public: - - // ctor: - My_Evaluator ( const Parameters & p , int n , int m ) - : Evaluator ( p ) , - _n ( n ) , - _m ( m ) , - _px ( new double [_n] ) , - _fx ( new double [_m] ) {} - - // dtor: - ~My_Evaluator ( void ) { delete [] _px; delete [] _fx; } - - // eval_x: - bool eval_x ( Eval_Point & x , - const Double & h_max , - bool & cnt_eval ) const; -}; - -// eval_x: -bool My_Evaluator::eval_x ( Eval_Point & x , - const Double & h_max , - bool & cnt_eval ) const { - int i; - for ( i = 0 ; i < _n ; ++i ) - _px[i] = x[i].value(); - eval_x_dll ( _px , _fx , &cnt_eval ); - for ( i = 0 ; i < _m ; ++i ) - x.set_bb_output ( i , _fx[i] ); - return true; -} - -/*------------------------------------------*/ -/* NOMAD main function */ -/*------------------------------------------*/ -int main ( int argc , char ** argv ) { - - // use: - if ( argc != 2 ) { - cerr << "\nuse: nomad_for_DLL.exe param.txt\n\n"; - return 1; - } - - // NOMAD initializations: - begin ( argc , argv ); - - // display: - NOMAD::Display out ( std::cout ); - out.precision ( NOMAD::DISPLAY_PRECISION_STD ); - - // random seed: - unsigned seed = 0; - srand(seed); - - // define DLL functions: - // get handle to dll: - HINSTANCE hdll = LoadLibrary ( TEXT("bb.dll") ); - if ( !hdll ) { - cerr << "ERROR: unable to open bb.dll" << endl; - FreeLibrary ( hdll ); - return 1; - } - - // get function pointers: - get_n_dll = (GET_NM)GetProcAddress(hdll, "GET_N"); - if ( !get_n_dll ) { - cerr << "ERROR: unable to find GET_N function in dll" << endl; - FreeLibrary ( hdll ); - return 1; - } - - get_m_dll = (GET_NM)GetProcAddress(hdll, "GET_M"); - if ( !get_m_dll ) { - cerr << "ERROR: unable to find GET_M function in dll" << endl; - FreeLibrary ( hdll ); - return 1; - } - - eval_x_dll = (EVAL_X)GetProcAddress(hdll, "EVAL_X"); - if ( !eval_x_dll ) { - cerr << "ERROR: unable to find EVAL_X function in dll" << endl; - FreeLibrary ( hdll ); - return 1; - } - - /* init_dll = (INIT)GetProcAddress(hdll, "INIT"); - if ( !init_dll ) { - cerr << "ERROR: unable to find INIT function in dll" << endl; - FreeLibrary ( hdll ); - return 1; - } - - clear_dll = (INIT)GetProcAddress(hdll, "CLEAR"); - if ( !clear_dll ) { - cerr << "ERROR: unable to find CLEAR function in dll" << endl; - FreeLibrary ( hdll ); - return 1; - }*/ - - // MADS: - try { - - /* init_dll(); */ - - int n = get_n_dll(); - int m = get_m_dll(); - - // parameters creation: - // -------------------- - Parameters p ( out ); - - // dimension: - p.set_DIMENSION ( n ); - - // definition of output types: - vector<bb_output_type> bbot (m); - bbot[0] = OBJ; - for ( int i = 1 ; i < m ; ++i ) - bbot[i] = PB; - p.set_BB_OUTPUT_TYPE ( bbot ); - - // read parameters file: - p.read ( argv[1] ); - - // parameters check: - p.check(); - - // display parameters: - // out << p << endl; - - // custom evaluator creation: - My_Evaluator ev ( p , n , m ); - - // algorithm creation and execution: - Mads mads ( p , &ev ); - mads.run(); - - // algorithm display: - // out << mads << endl; - - /* clear_dll(); */ - } - catch ( exception & e ) { - cerr << "\nNOMAD has been interrupted (" << e.what() << ")\n\n"; - } - - // Release the Dll: - FreeLibrary ( hdll ); - - NOMAD::Slave::stop_slaves ( out ); - NOMAD::end(); - - return EXIT_SUCCESS; -} +/*---------------------------------------------------------------*/ +/* NOMAD for a DLL-black-box */ +/*---------------------------------------------------------------*/ +#include "nomad.hpp" +#include <windows.h> +using namespace std; +using namespace NOMAD; + +// black-box outputs (m): +// ---------------------- +// . the first one is the objective function +// . all the others (1 to m-1) are PB constraints with format g(x) <= 0 + + +/*------------------------------------------*/ +/* DLL functions */ +/*------------------------------------------*/ +typedef int (_stdcall *GET_NM)( void ); +typedef void (_stdcall *EVAL_X)( double * , double * , bool * ); +typedef void (_stdcall *INIT )( void ); + +GET_NM get_n_dll; +GET_NM get_m_dll; +EVAL_X eval_x_dll; +//INIT init_dll; +//INIT clear_dll; + +// simulate the DLL functions (for tests): +/* +void init ( void ) {} +void clear ( void ) {} +int get_n_dll ( void ) { return 5; } +int get_m_dll ( void ) { return 3; } +void eval_x_dll ( double * x , double * fx , bool & cnt_eval ) { + double c1 = 0.0 , c2 = 0.0; + for ( int i = 0 ; i < 5 ; ++i ) { + c1 += pow ( x[i]-1 , 2 ); + c2 += pow ( x[i]+1 , 2 ); + } + fx[0] = x[4]; + fx[1] = c1 - 25; + fx[2] = 25 - c2; + cnt_eval = true; +} +*/ + +/*--------------------------------------*/ +/* custom evaluator */ +/*--------------------------------------*/ +class My_Evaluator : public Evaluator { + +private: + + int _n; + int _m; + double * _px; + double * _fx; + +public: + + // ctor: + My_Evaluator ( const Parameters & p , int n , int m ) + : Evaluator ( p ) , + _n ( n ) , + _m ( m ) , + _px ( new double [_n] ) , + _fx ( new double [_m] ) {} + + // dtor: + ~My_Evaluator ( void ) { delete [] _px; delete [] _fx; } + + // eval_x: + bool eval_x ( Eval_Point & x , + const Double & h_max , + bool & cnt_eval ) const; +}; + +// eval_x: +bool My_Evaluator::eval_x ( Eval_Point & x , + const Double & h_max , + bool & cnt_eval ) const { + int i; + for ( i = 0 ; i < _n ; ++i ) + _px[i] = x[i].value(); + eval_x_dll ( _px , _fx , &cnt_eval ); + for ( i = 0 ; i < _m ; ++i ) + x.set_bb_output ( i , _fx[i] ); + return true; +} + +/*------------------------------------------*/ +/* NOMAD main function */ +/*------------------------------------------*/ +int main ( int argc , char ** argv ) { + + // use: + if ( argc != 2 ) { + cerr << "\nuse: nomad_for_DLL.exe param.txt\n\n"; + return 1; + } + + // NOMAD initializations: + begin ( argc , argv ); + + // display: + NOMAD::Display out ( std::cout ); + out.precision ( NOMAD::DISPLAY_PRECISION_STD ); + + // random seed: + unsigned seed = 0; + srand(seed); + + // define DLL functions: + // get handle to dll: + HINSTANCE hdll = LoadLibrary ( TEXT("bb.dll") ); + if ( !hdll ) { + cerr << "ERROR: unable to open bb.dll" << endl; + FreeLibrary ( hdll ); + return 1; + } + + // get function pointers: + get_n_dll = (GET_NM)GetProcAddress(hdll, "GET_N"); + if ( !get_n_dll ) { + cerr << "ERROR: unable to find GET_N function in dll" << endl; + FreeLibrary ( hdll ); + return 1; + } + + get_m_dll = (GET_NM)GetProcAddress(hdll, "GET_M"); + if ( !get_m_dll ) { + cerr << "ERROR: unable to find GET_M function in dll" << endl; + FreeLibrary ( hdll ); + return 1; + } + + eval_x_dll = (EVAL_X)GetProcAddress(hdll, "EVAL_X"); + if ( !eval_x_dll ) { + cerr << "ERROR: unable to find EVAL_X function in dll" << endl; + FreeLibrary ( hdll ); + return 1; + } + + /* init_dll = (INIT)GetProcAddress(hdll, "INIT"); + if ( !init_dll ) { + cerr << "ERROR: unable to find INIT function in dll" << endl; + FreeLibrary ( hdll ); + return 1; + } + + clear_dll = (INIT)GetProcAddress(hdll, "CLEAR"); + if ( !clear_dll ) { + cerr << "ERROR: unable to find CLEAR function in dll" << endl; + FreeLibrary ( hdll ); + return 1; + }*/ + + // MADS: + try { + + /* init_dll(); */ + + int n = get_n_dll(); + int m = get_m_dll(); + + // parameters creation: + // -------------------- + Parameters p ( out ); + + // dimension: + p.set_DIMENSION ( n ); + + // definition of output types: + vector<bb_output_type> bbot (m); + bbot[0] = OBJ; + for ( int i = 1 ; i < m ; ++i ) + bbot[i] = PB; + p.set_BB_OUTPUT_TYPE ( bbot ); + + // read parameters file: + p.read ( argv[1] ); + + // parameters check: + p.check(); + + // display parameters: + // out << p << endl; + + // custom evaluator creation: + My_Evaluator ev ( p , n , m ); + + // algorithm creation and execution: + Mads mads ( p , &ev ); + mads.run(); + + // algorithm display: + // out << mads << endl; + + /* clear_dll(); */ + } + catch ( exception & e ) { + cerr << "\nNOMAD has been interrupted (" << e.what() << ")\n\n"; + } + + // Release the Dll: + FreeLibrary ( hdll ); + + NOMAD::Slave::stop_slaves ( out ); + NOMAD::end(); + + return EXIT_SUCCESS; +} diff --git a/examples/interfaces/DLL/single_obj/param.txt b/examples/interfaces/DLL/single_obj/param.txt index ddbb51136f2cde23be9a7e425f27e43467ca3212..42f7a6f39e4b373dfed15ceaaded67886883dcfd 100755 --- a/examples/interfaces/DLL/single_obj/param.txt +++ b/examples/interfaces/DLL/single_obj/param.txt @@ -1,27 +1,27 @@ -#seed 100 - -initial_mesh_size r0.1 - -direction_type ortho 2n - -max_bb_eval 1000 - -lower_bound * -10.0 - -upper_bound * 10.0 - - -x0 ( 2 3 4 5 6 ) - -display_degree 1 - -display_stats bbe ( sol ) obj - -add_seed_to_file_names no - -#stats_file toto.txt bbe obj -#solution_file "sol.txt" - -#LH_SEARCH 100 0 - -#OPPORTUNISTIC_LH no +#seed 100 + +initial_mesh_size r0.1 + +direction_type ortho 2n + +max_bb_eval 1000 + +lower_bound * -10.0 + +upper_bound * 10.0 + + +x0 ( 2 3 4 5 6 ) + +display_degree 1 + +display_stats bbe ( sol ) obj + +add_seed_to_file_names no + +#stats_file toto.txt bbe obj +#solution_file "sol.txt" + +#LH_SEARCH 100 0 + +#OPPORTUNISTIC_LH no diff --git a/examples/interfaces/DLL/single_obj/readme.txt b/examples/interfaces/DLL/single_obj/readme.txt index 970c9be4a48c4892f02971a617270e3bd19faa34..7c139cb507eac426a6d206cbdd5be6005e25881c 100755 --- a/examples/interfaces/DLL/single_obj/readme.txt +++ b/examples/interfaces/DLL/single_obj/readme.txt @@ -1,52 +1,52 @@ - -This example illustrates how to use NOMAD with a black-box -problem that is coded inside a DLL file. - -The example runs on windows with visual C++ and minGW. - - -DLL characteristics: - -/*----------*/ - -/* bb.dll */ - -/*----------*/ - - - -// init/clear: - -// ----------- - -void init_dll ( void ); - -void clear_dll ( void ); - -// problem characteristics: - -// ------------------------ - - -int get_n_dll ( void ); // number of variables - -int get_m _dll( void ); // number of outputs: output #0 : objective value to minimize - - // output #1..m-1: PB constraints with format g(x) <= 0 - - - -// evaluation: f(x): - -// ----------------- - - -void eval_x_dll ( double * x , double * fx , bool & count_eval ); - - - -// x: input , double array of size n - -// fx: output, double array of size m - -// count_eval: output, set to true if the evaluation has to be counted, false else + +This example illustrates how to use NOMAD with a black-box +problem that is coded inside a DLL file. + +The example runs on windows with visual C++ and minGW. + + +DLL characteristics: + +/*----------*/ + +/* bb.dll */ + +/*----------*/ + + + +// init/clear: + +// ----------- + +void init_dll ( void ); + +void clear_dll ( void ); + +// problem characteristics: + +// ------------------------ + + +int get_n_dll ( void ); // number of variables + +int get_m _dll( void ); // number of outputs: output #0 : objective value to minimize + + // output #1..m-1: PB constraints with format g(x) <= 0 + + + +// evaluation: f(x): + +// ----------------- + + +void eval_x_dll ( double * x , double * fx , bool & count_eval ); + + + +// x: input , double array of size n + +// fx: output, double array of size m + +// count_eval: output, set to true if the evaluation has to be counted, false else diff --git a/examples/interfaces/FORTRAN/example1/makefile b/examples/interfaces/FORTRAN/example1/makefile index 0b315b473e4266607c5ec9e68ad93e29b625a413..fe4e382196223efe2280e47005a3dc874a4a3779 100644 --- a/examples/interfaces/FORTRAN/example1/makefile +++ b/examples/interfaces/FORTRAN/example1/makefile @@ -17,7 +17,7 @@ endif LDLIBS = -lm -lnomad -INCLUDE = -I$(NOMAD_HOME)/src -I. +INCLUDE = -I$(NOMAD_HOME)/src -I$(NOMAD_HOME)/ext/sgtelib/src -I. COMPILE = $(COMPILATOR) $(COMPILATOR_OPTIONS) $(INCLUDE) -c FCOMPILE = $(FCOMPILATOR) -O3 -c OBJS = test.o bb.o diff --git a/examples/interfaces/FORTRAN/example1/readme.txt b/examples/interfaces/FORTRAN/example1/readme.txt index a2a2cf807cae3597666efc69090a023f9c446515..818e738175e2a168cd52dbd8b94ffa236f344d3e 100644 --- a/examples/interfaces/FORTRAN/example1/readme.txt +++ b/examples/interfaces/FORTRAN/example1/readme.txt @@ -1,5 +1,5 @@ -Run the NOMAD library with a FORTRAN black-box routine. - -This examples works on a X system with g++ and gfortran. - +Run the NOMAD library with a FORTRAN black-box routine. + +This examples works on a X system with g++ and gfortran. + Type 'make' and then './test.exe'. \ No newline at end of file diff --git a/examples/interfaces/FORTRAN/example1/runExample.log b/examples/interfaces/FORTRAN/example1/runExample.log index e14c513126688f5e41d1cf125231741e5ba659dd..ccf265cb154155e9e0bc3bee3dc5589385afbdb4 100644 --- a/examples/interfaces/FORTRAN/example1/runExample.log +++ b/examples/interfaces/FORTRAN/example1/runExample.log @@ -3,18 +3,15 @@ MADS run { BBE OBJ - 2 288.7937255854 (PhaseOne) - 3 0.0000000000 (PhaseOne) - 3 1.0733126292 - 10 1.0062305899 - 11 0.8049844719 - 13 0.5366563146 - 28 -1.0733126292 - 32 -3.7565942022 - 100 -3.7565942022 + 2 144.0000000000 (PhaseOne) + 4 0.0000000000 (PhaseOne) + 4 1.0000000000 + 20 -3.0000000000 + 57 -4.0000000000 + 100 -4.0000000000 } end of run (max number of blackbox evaluations) blackbox evaluations : 100 -best infeasible solution (min. violation): ( 2.459674775 0.5366563146 1.162755348 1.073312629 -3.756594202 ) h=0.0023902697 f=-3.756594202 -best feasible solution : ( 0.491934955 2.146625258 1.162755348 0.2683281573 -3.756594202 ) h=0 f=-3.756594202 +best infeasible solution (min. violation): ( 1.24 1.12 1.03 0.92 -4 ) h=0.0793 f=-4 +best feasible solution : ( 1 1 1 1 -4 ) h=0 f=-4 diff --git a/examples/interfaces/FORTRAN/example2/makefile b/examples/interfaces/FORTRAN/example2/makefile index 887570087356cbb52605f76291aca621c42d1a3d..96de42392cbab8a58254abfe4fc5f94d5ced9ff8 100644 --- a/examples/interfaces/FORTRAN/example2/makefile +++ b/examples/interfaces/FORTRAN/example2/makefile @@ -17,7 +17,7 @@ endif LDLIBS = -lm -lnomad -lstdc++ -INCLUDE = -I$(NOMAD_HOME)/src -I. +INCLUDE = -I$(NOMAD_HOME)/src -I$(NOMAD_HOME)/ext/sgtelib/src -I. COMPILE = $(COMPILATOR) $(COMPILATOR_OPTIONS) $(INCLUDE) -c FCOMPILE = $(FCOMPILATOR) -O3 -c diff --git a/examples/interfaces/FORTRAN/example2/readme.txt b/examples/interfaces/FORTRAN/example2/readme.txt index 72e583c128a4e4f189b1780c549da28ed23e5146..d0c4a488858aae27678e31a4542b4c7481ccf4fe 100644 --- a/examples/interfaces/FORTRAN/example2/readme.txt +++ b/examples/interfaces/FORTRAN/example2/readme.txt @@ -1,6 +1,6 @@ -This example shows how to write a FORTRAN program calling NOMAD, -with a black-box routine written in FORTRAN. - -It has been tested on a X system with g++ and gfortran. - -Type 'make' to compile and './test.exe' to execute. +This example shows how to write a FORTRAN program calling NOMAD, +with a black-box routine written in FORTRAN. + +It has been tested on a X system with g++ and gfortran. + +Type 'make' to compile and './test.exe' to execute. diff --git a/examples/interfaces/FORTRAN/example2/runExample.log b/examples/interfaces/FORTRAN/example2/runExample.log deleted file mode 100644 index 5d79a3fa51527e72e300853aca40e6bc960ad9dd..0000000000000000000000000000000000000000 --- a/examples/interfaces/FORTRAN/example2/runExample.log +++ /dev/null @@ -1,6 +0,0 @@ - solution: - 1.0873279049623568 - 1.0106964832583694 - 1.0142392972319982 - 1.0195849194381255 - -3.9991672402116962 diff --git a/examples/interfaces/GAMS/bb.gms b/examples/interfaces/GAMS/bb.gms index 7659730934efac3d55c21914ce54fdfcd276f3ec..a68edb863bd70b2234b378f573dc87c7ac52f88c 100644 --- a/examples/interfaces/GAMS/bb.gms +++ b/examples/interfaces/GAMS/bb.gms @@ -1,321 +1,321 @@ - -Set t time periods -/ -2005, 2015, 2025, 2035, 2045, 2055, 2065, 2075, 2085, 2095, -2105, 2115, 2125, 2135, 2145, 2155, 2165, 2175, 2185, 2195, -2205, 2215, 2225, 2235, 2245, 2255, 2265, 2275, 2285, 2295, -2305, 2315, 2325, 2335, 2345, 2355, 2365, 2375, 2385, 2395, -2405 -/ - -subtGDP(t) indice sommation GDP -/ -2005, 2015, 2025, 2035, 2045, 2055, 2065, 2075, 2085, 2095 -/ - -subtem(t) indice sommation emissions -/ -2005, 2015, 2025, 2035, 2045, 2055, 2065, 2075, 2085 -/ -; - -Set ts(t) time periods -/ -2005, 2015, 2025, 2035, 2045, 2055, 2065, 2075, 2085, 2095, -2105, 2115, 2125, 2135, 2145, 2155, 2165, 2175, 2185, 2195, -2205, 2215, 2225, 2235, 2245, 2255, 2265, 2275, 2285, 2295, -2305, 2315, 2325, 2335, 2345, 2355, 2365, 2375, 2385, 2395, -2405 -/; - -Set tfirst(t) first time period; -tfirst(t) = YES$(ord(t) eq 1); - -Set tlast(t) last time period; -tlast(t) = YES$(ord(t) eq card(t)); - -Parameter nbp(t) number of periods since 2005 -/ - 2005 0, 2015 1, 2025 2, 2035 3, 2045 4, 2055 5, 2065 6, 2075 7, 2085 8, - 2095 9, 2105 10, 2115 11, 2125 12, 2135 13, 2145 14, 2155 15, 2165 16, - 2175 17, 2185 18, 2195 19, 2205 20, 2215 21, 2225 22, 2235 23, 2245 24, - 2255 25, 2265 26, 2275 27, 2285 28, 2295 29, 2305 30, 2315 31, 2325 32, - 2335 33, 2345 34, 2355 35, 2365 36, 2375 37, 2385 38, 2395 39, 2405 40 -/; - -Parameter nby(t) number of years since 2005 -/ - 2005 0, 2015 10, 2025 20, 2035 30, 2045 40, 2055 50, 2065 60, 2075 70, 2085 80, - 2095 90, 2105 100, 2115 110, 2125 120, 2135 130, 2145 140, 2155 150, 2165 160, - 2175 170, 2185 180, 2195 190, 2205 200, 2215 210, 2225 220, 2235 230, 2245 240, - 2255 250, 2265 260, 2275 270, 2285 280, 2295 290, 2305 300, 2315 310, 2325 320, - 2335 330, 2345 340, 2355 350, 2365 360, 2375 370, 2385 380, 2395 390, 2405 400 -/; - -Parameter xi(t) indicator for the clean economy -/ - 2005 1, 2015 1, 2025 1, 2035 1, 2045 1, 2055 1, 2065 1, 2075 1, 2085 1, - 2095 1, 2105 1, 2115 1, 2125 1, 2135 1, 2145 1, 2155 1, 2165 1, 2175 1, - 2185 1, 2195 1, 2205 1, 2215 1, 2225 1, 2235 1, 2245 1, 2255 1, 2265 1, - 2275 1, 2285 1, 2295 1, 2305 1, 2315 1, 2325 1, 2335 1, 2345 1, 2355 1, - 2365 1, 2375 1, 2385 1, 2395 1, 2405 1 -/; -$ontext -/ - 2005 0, 2015 0, 2025 0, 2035 0, 2045 0, 2055 0, 2065 0, 2075 0, 2085 0, - 2095 0, 2105 0, 2115 0, 2125 0, 2135 0, 2145 0, 2155 0, 2165 0, 2175 0, - 2185 0, 2195 0, 2205 0, 2215 0, 2225 0, 2235 0, 2245 0, 2255 0, 2265 0, - 2275 0, 2285 0, 2295 0, 2305 0, 2315 0, 2325 0, 2335 0, 2345 0, 2355 0, - 2365 0, 2375 0, 2385 0, 2395 0, 2405 0 -/; -$offtext - -Parameter GDP(t) GDP donne par le scenario B2MESSAGE par moyenne simple -/ - 2005 49.84, 2015 66.53, 2025 86.94, 2035 112.9, 2045 145.3, 2055 182.0, 2065 220.7, 2075 259.1, 2085 295.5, - 2095 331.7, 2105 0, 2115 0, 2125 0, 2135 0, 2145 0, 2155 0, 2165 0, 2175 0, - 2185 0, 2195 0, 2205 0, 2215 0, 2225 0, 2235 0, 2245 0, 2255 0, 2265 0, - 2275 0, 2285 0, 2295 0, 2305 0, 2315 0, 2325 0, 2335 0, 2345 0, 2355 0, - 2365 0, 2375 0, 2385 0, 2395 0, 2405 0 -/; - -Parameter emissionB2(t) emission CO2 par decennie donne par le scenario B2MESSAGE par moyenne simple -/ - 2005 8.65, 2015 9.19, 2025 9.88, 2035 10.57, 2045 11.05, 2055 11.40, 2065 11.72, 2075 12.18, 2085 12.76, - 2095 0, 2105 0, 2115 0, 2125 0, 2135 0, 2145 0, 2155 0, 2165 0, 2175 0, - 2185 0, 2195 0, 2205 0, 2215 0, 2225 0, 2235 0, 2245 0, 2255 0, 2265 0, - 2275 0, 2285 0, 2295 0, 2305 0, 2315 0, 2325 0, 2335 0, 2345 0, 2355 0, - 2365 0, 2375 0, 2385 0, 2395 0, 2405 0 -/; - -Scalars - borneinf borne inferieure de DICE /0.9/ - bornesup borne superieure de DICE /1.1/ - deltaalpha ecart entre modeles DICE et GERAD /0/ - deltaGDP ecart DICE GERAD pour le GDP /0/ - deltaem idem /0/ - moyenneGDP moyenne GDP B2-message /175.05/ - moyenneem idem /10.82/ - - vb slope w.r.t K2(t) of the probability rate of discovery /0.0019/ - wb initial probability rate of discovery /0.05/ - beta marginal atmospheric retention rate /0.64/ - catM catastrophic carbon concentration /2059.0/ - delta_M carbon removal rate per decade /0.036/ -* mtargM target for carbon concentration /1025.00/ - mtargM target for carbon concentration /5000.00/ - piE1 initial energy price in dirty economy /0.35/ - piE2 initial energy price in clean economy /0.60/ - rhop discount rate /0.025/ - - prstp initial rate of social time preference per year /0.015/ - dr decline rate of social time preference per year /0.000001/ - rho discount rate /0.03/ - - L0 2005 world population (millions) /6409/ - gL0 initial value for growth rate of population /0.08/ - dgL rate of decrease for growth rate of population /0.3/ - - scale1 scaling coefficient in objective function /300/ - scale2 scaling coefficient in objective function /1.00E+07/ - -*Scalaires calibres -$include "input.txt"; - -; - -*Initialisation des parametres -Parameter L(t) labor - world population (millions); -L(t) = L0 * exp( (gl0/dgL)*(1-exp( -dgL*nbp(t) )) ); - -Parameter r(t) instantaeous rate of social time preference; -r(t)=prstp*EXP(-dr*10*(ord(t)-1)); - -Parameter rr(t) average utility social discount rate; -rr(tfirst)=1; -loop(t, rr(t+1) = rr(t) / ((1+r(t))**10) ); - -Parameter A(t) total factor productivity; -A(tfirst) = 1.38734*A0; -*loop(t, A(t+1) = A(t) / (1-gA0*exp(-dgA*10*nbp(t))) ); -A(t) = 1.38734*A0 * exp( (gA0/dgA)*(1-exp( -dgA*nbp(t) )) ); - -Parameter phid(t) energy efficiency in the dirty economy; -phid(t) = (phid0 * exp( (-gphid0/dgphid)*exp(-dgphid*(nbp(t)+1)) ) ) / - exp(-gphid0/dgphid); - -Parameter phic(t) energy efficiency in the clean economy; -phic(t) = (phic0 * exp( (-gphic0/dgphic)*exp(-dgphic*(nbp(t)+1)) ) ) / - exp(-gphic0/dgphic); - -Parameter thetad(t) dirty energy elasticity in production function; -thetad(t) = (thetad0 * exp( (gthetad0/dgthetad)*exp(-dgthetad*(nbp(t)+1)) ) ) / - exp(gthetad0/dgthetad); - -Parameter thetac(t) clean energy elasticity in production function; -thetac(t) = (thetac0 * exp( (gthetac0/dgthetac)*exp(-dgthetac*(nbp(t)+1)) ) ) / - exp(gthetac0/dgthetac); - -Parameter EM(t) total emissions (over 10 years); -EM(t) = 0; - -Parameter TK(t) total capital; -TK(t) = 0; - -Parameter deltaalphaGDP(t) ecart courant entre GDP de DICE et GERAD; -deltaalphaGDP(t) = 0; - -*Definition du modele -Positive variables - C(t) total consumption (trillion dollars) - ELF(t) economic loss factor (%) - E1(t) carbon emissions from the dirty economy (GtC) - E2(t) carbon emissions from the clean economy (GtC) - I1(t) investment in dirty capital K1 (trillion dollars) - I2(t) investment in clean capital K2 (trillion dollars) - K1(t) physical stock of dirty capital (trillion dollars) - K2(t) physical stock of clean capital (trillion dollars) - L1(t) labor for the dirty economy (millions) - L2(t) labor for the clean economy (millions) - M(t) atmospheric carbon concentration - Y(t) economic output (trillion dollars); - -Variables - PW(t) welfare of current period - W2 total discounted welfare after the last jump (V_2-1-l); - -Equations - ALOCLABOR(t) compute allocation of total labor - CARBDYNAM(t) compute evolution of carbon concentrations - E1FIRST(t) initial value for carbon emissions from dirty capital - E2FIRST(t) initial value for carbon emissions from clean capital - ELFCOMP(t) compute economic loss factor - I2MAX(t) bound for investment on clean capital - K1ACCUMUL(t) compute dirty capital accumulation - K1FIRST(t) initial value for dirty capital - K1LAST(t) final value for dirty capital - K2ACCUMUL(t) compute clean capital accumulation - K2FIRST(t) initial value for clean capital - K2LAST(t) final value for clean capital - MFIRST(t) initial value for carbon concentration - TARGETM(t) impose cap on atmospheric carbon concentrations - TOTALCONS(t) compute total consumption - TOTALPROD(t) compute total production - PWEQ(t) compute welfare of current period - WELFARE2 compute total welfare after the last jump; - -ALOCLABOR(t).. - L1(t) + L2(t) =l= L(t); - -CARBDYNAM(t+1).. - M(t+1) =e= beta*10*(E1(t)+E2(t)) + M(t)*(1-delta_M) + delta_M*590; - -MFIRST(tfirst).. -* 2005 value around 385 ppmv = 808.8 GtC - M(tfirst) =e= 808.8; - -ELFCOMP(t).. - ELF(t) =e= 1; - -E1FIRST(tfirst).. -* DICE-2007 value - E1(tfirst) =e= 6.7; - -E2FIRST(tfirst).. -* 0.0001 of DICE-2007 value - E2(tfirst) =e= 0.00067; - -I2MAX(t).. - I2(t) =l= 0.97*Y(t); - -K1FIRST(tfirst).. - K1(tfirst) =e= 137.0; - -K1ACCUMUL(t).. - K1(t+1) =l= K1(t)*(1-dk)**10 + 10*I1(t); - -K1LAST(tlast).. - 0.02*K1(tlast) =l= I1(tlast); - -K2FIRST(tfirst).. - K2(tfirst) =e= 0.0137; - -K2ACCUMUL(t).. - K2(t+1) =l= K2(t)*(1-dk)**10 + 10*I2(t); - -K2LAST(tlast).. - 0.02*K2(tlast) =l= I2(tlast); - -TARGETM(t).. -* Constraint is always active - M(t) =l= mtargM; - -TOTALPROD(t).. - Y(t) =e= A(t) * ( - K1(t)**alphad * (phid(t)*E1(t))**thetad(t) * L1(t)**(1-alphad-thetad(t)) + - xi(t)*K2(t)**alphac * (phic(t)*E2(t))**thetac(t) * L2(t)**(1-alphac-thetac(t)) - ); - -TOTALCONS(t).. - C(t) =e= Y(t) - I1(t) - I2(t) - piE1*phid(t)*E1(t) - piE2*phic(t)*E2(t); - -PWEQ(t).. - PW(t) =e= ( (ELF(t)*C(t)/L(t))**(1-elasmu) -1) / (1-elasmu); - -WELFARE2.. - W2 =e= sum(t, 10*exp(-rho*nby(t))*L(t)*(PW(t))/scale1) + scale2 ; - -Model ECM /all/ ; -ECM.OPTFILE =1; - -C.lo(t) = 1; -C.up(t) = 1000; -E1.lo(t) = 0.0000001; -E1.up(t) = 500; -E2.lo(t) = 0.0000001; -E2.up(t) = 100; -ELF.lo(t) = 0.5; -ELF.up(t) = 1.0; -I1.lo(t) = 0.000000001; -I1.up(t) = 1000; -I2.lo(t) = 0.000000001; -I2.up(t) = 1000; -K1.lo(t) = 0.01; -K1.up(t) = 3000; -K2.lo(t) = 0.000000001; -K2.up(t) = 3000; -L1.lo(t) = 0.1; -L1.up(t) = 10000; -L2.lo(t) = 0.000000001; -L2.up(t) = 10000; -M.lo(t) = 300; -M.up(t) = 4000; -Y.lo(t) = 50; -Y.up(t) = 1000; - -option iterlim = 99900; -option reslim = 99999; -option solprint = off; -option limrow = 0; -option limcol = 0; - -Solve ECM using nlp maximising W2; - -EM(t) = E1.L(t)+E2.L(t); -TK(t) = K1.L(t)+K2.L(t); - -deltaalphaGDP(t) = Y.L(t)-GDP(t); -deltaGDP = sum ( subtGDP(t) , sqr(deltaalphaGDP(t)) ); -deltaem = sum ( subtem(t) , sqr(EM(t)-emissionB2(t)) ); -deltaalpha = deltaGDP / moyenneGDP + deltaem / moyenneem ; - -file FOUT / output.txt /; -put FOUT; -put deltaalpha:13:6; -putclose; - - - - - - + +Set t time periods +/ +2005, 2015, 2025, 2035, 2045, 2055, 2065, 2075, 2085, 2095, +2105, 2115, 2125, 2135, 2145, 2155, 2165, 2175, 2185, 2195, +2205, 2215, 2225, 2235, 2245, 2255, 2265, 2275, 2285, 2295, +2305, 2315, 2325, 2335, 2345, 2355, 2365, 2375, 2385, 2395, +2405 +/ + +subtGDP(t) indice sommation GDP +/ +2005, 2015, 2025, 2035, 2045, 2055, 2065, 2075, 2085, 2095 +/ + +subtem(t) indice sommation emissions +/ +2005, 2015, 2025, 2035, 2045, 2055, 2065, 2075, 2085 +/ +; + +Set ts(t) time periods +/ +2005, 2015, 2025, 2035, 2045, 2055, 2065, 2075, 2085, 2095, +2105, 2115, 2125, 2135, 2145, 2155, 2165, 2175, 2185, 2195, +2205, 2215, 2225, 2235, 2245, 2255, 2265, 2275, 2285, 2295, +2305, 2315, 2325, 2335, 2345, 2355, 2365, 2375, 2385, 2395, +2405 +/; + +Set tfirst(t) first time period; +tfirst(t) = YES$(ord(t) eq 1); + +Set tlast(t) last time period; +tlast(t) = YES$(ord(t) eq card(t)); + +Parameter nbp(t) number of periods since 2005 +/ + 2005 0, 2015 1, 2025 2, 2035 3, 2045 4, 2055 5, 2065 6, 2075 7, 2085 8, + 2095 9, 2105 10, 2115 11, 2125 12, 2135 13, 2145 14, 2155 15, 2165 16, + 2175 17, 2185 18, 2195 19, 2205 20, 2215 21, 2225 22, 2235 23, 2245 24, + 2255 25, 2265 26, 2275 27, 2285 28, 2295 29, 2305 30, 2315 31, 2325 32, + 2335 33, 2345 34, 2355 35, 2365 36, 2375 37, 2385 38, 2395 39, 2405 40 +/; + +Parameter nby(t) number of years since 2005 +/ + 2005 0, 2015 10, 2025 20, 2035 30, 2045 40, 2055 50, 2065 60, 2075 70, 2085 80, + 2095 90, 2105 100, 2115 110, 2125 120, 2135 130, 2145 140, 2155 150, 2165 160, + 2175 170, 2185 180, 2195 190, 2205 200, 2215 210, 2225 220, 2235 230, 2245 240, + 2255 250, 2265 260, 2275 270, 2285 280, 2295 290, 2305 300, 2315 310, 2325 320, + 2335 330, 2345 340, 2355 350, 2365 360, 2375 370, 2385 380, 2395 390, 2405 400 +/; + +Parameter xi(t) indicator for the clean economy +/ + 2005 1, 2015 1, 2025 1, 2035 1, 2045 1, 2055 1, 2065 1, 2075 1, 2085 1, + 2095 1, 2105 1, 2115 1, 2125 1, 2135 1, 2145 1, 2155 1, 2165 1, 2175 1, + 2185 1, 2195 1, 2205 1, 2215 1, 2225 1, 2235 1, 2245 1, 2255 1, 2265 1, + 2275 1, 2285 1, 2295 1, 2305 1, 2315 1, 2325 1, 2335 1, 2345 1, 2355 1, + 2365 1, 2375 1, 2385 1, 2395 1, 2405 1 +/; +$ontext +/ + 2005 0, 2015 0, 2025 0, 2035 0, 2045 0, 2055 0, 2065 0, 2075 0, 2085 0, + 2095 0, 2105 0, 2115 0, 2125 0, 2135 0, 2145 0, 2155 0, 2165 0, 2175 0, + 2185 0, 2195 0, 2205 0, 2215 0, 2225 0, 2235 0, 2245 0, 2255 0, 2265 0, + 2275 0, 2285 0, 2295 0, 2305 0, 2315 0, 2325 0, 2335 0, 2345 0, 2355 0, + 2365 0, 2375 0, 2385 0, 2395 0, 2405 0 +/; +$offtext + +Parameter GDP(t) GDP donne par le scenario B2MESSAGE par moyenne simple +/ + 2005 49.84, 2015 66.53, 2025 86.94, 2035 112.9, 2045 145.3, 2055 182.0, 2065 220.7, 2075 259.1, 2085 295.5, + 2095 331.7, 2105 0, 2115 0, 2125 0, 2135 0, 2145 0, 2155 0, 2165 0, 2175 0, + 2185 0, 2195 0, 2205 0, 2215 0, 2225 0, 2235 0, 2245 0, 2255 0, 2265 0, + 2275 0, 2285 0, 2295 0, 2305 0, 2315 0, 2325 0, 2335 0, 2345 0, 2355 0, + 2365 0, 2375 0, 2385 0, 2395 0, 2405 0 +/; + +Parameter emissionB2(t) emission CO2 par decennie donne par le scenario B2MESSAGE par moyenne simple +/ + 2005 8.65, 2015 9.19, 2025 9.88, 2035 10.57, 2045 11.05, 2055 11.40, 2065 11.72, 2075 12.18, 2085 12.76, + 2095 0, 2105 0, 2115 0, 2125 0, 2135 0, 2145 0, 2155 0, 2165 0, 2175 0, + 2185 0, 2195 0, 2205 0, 2215 0, 2225 0, 2235 0, 2245 0, 2255 0, 2265 0, + 2275 0, 2285 0, 2295 0, 2305 0, 2315 0, 2325 0, 2335 0, 2345 0, 2355 0, + 2365 0, 2375 0, 2385 0, 2395 0, 2405 0 +/; + +Scalars + borneinf borne inferieure de DICE /0.9/ + bornesup borne superieure de DICE /1.1/ + deltaalpha ecart entre modeles DICE et GERAD /0/ + deltaGDP ecart DICE GERAD pour le GDP /0/ + deltaem idem /0/ + moyenneGDP moyenne GDP B2-message /175.05/ + moyenneem idem /10.82/ + + vb slope w.r.t K2(t) of the probability rate of discovery /0.0019/ + wb initial probability rate of discovery /0.05/ + beta marginal atmospheric retention rate /0.64/ + catM catastrophic carbon concentration /2059.0/ + delta_M carbon removal rate per decade /0.036/ +* mtargM target for carbon concentration /1025.00/ + mtargM target for carbon concentration /5000.00/ + piE1 initial energy price in dirty economy /0.35/ + piE2 initial energy price in clean economy /0.60/ + rhop discount rate /0.025/ + + prstp initial rate of social time preference per year /0.015/ + dr decline rate of social time preference per year /0.000001/ + rho discount rate /0.03/ + + L0 2005 world population (millions) /6409/ + gL0 initial value for growth rate of population /0.08/ + dgL rate of decrease for growth rate of population /0.3/ + + scale1 scaling coefficient in objective function /300/ + scale2 scaling coefficient in objective function /1.00E+07/ + +*Scalaires calibres +$include "input.txt"; + +; + +*Initialisation des parametres +Parameter L(t) labor - world population (millions); +L(t) = L0 * exp( (gl0/dgL)*(1-exp( -dgL*nbp(t) )) ); + +Parameter r(t) instantaeous rate of social time preference; +r(t)=prstp*EXP(-dr*10*(ord(t)-1)); + +Parameter rr(t) average utility social discount rate; +rr(tfirst)=1; +loop(t, rr(t+1) = rr(t) / ((1+r(t))**10) ); + +Parameter A(t) total factor productivity; +A(tfirst) = 1.38734*A0; +*loop(t, A(t+1) = A(t) / (1-gA0*exp(-dgA*10*nbp(t))) ); +A(t) = 1.38734*A0 * exp( (gA0/dgA)*(1-exp( -dgA*nbp(t) )) ); + +Parameter phid(t) energy efficiency in the dirty economy; +phid(t) = (phid0 * exp( (-gphid0/dgphid)*exp(-dgphid*(nbp(t)+1)) ) ) / + exp(-gphid0/dgphid); + +Parameter phic(t) energy efficiency in the clean economy; +phic(t) = (phic0 * exp( (-gphic0/dgphic)*exp(-dgphic*(nbp(t)+1)) ) ) / + exp(-gphic0/dgphic); + +Parameter thetad(t) dirty energy elasticity in production function; +thetad(t) = (thetad0 * exp( (gthetad0/dgthetad)*exp(-dgthetad*(nbp(t)+1)) ) ) / + exp(gthetad0/dgthetad); + +Parameter thetac(t) clean energy elasticity in production function; +thetac(t) = (thetac0 * exp( (gthetac0/dgthetac)*exp(-dgthetac*(nbp(t)+1)) ) ) / + exp(gthetac0/dgthetac); + +Parameter EM(t) total emissions (over 10 years); +EM(t) = 0; + +Parameter TK(t) total capital; +TK(t) = 0; + +Parameter deltaalphaGDP(t) ecart courant entre GDP de DICE et GERAD; +deltaalphaGDP(t) = 0; + +*Definition du modele +Positive variables + C(t) total consumption (trillion dollars) + ELF(t) economic loss factor (%) + E1(t) carbon emissions from the dirty economy (GtC) + E2(t) carbon emissions from the clean economy (GtC) + I1(t) investment in dirty capital K1 (trillion dollars) + I2(t) investment in clean capital K2 (trillion dollars) + K1(t) physical stock of dirty capital (trillion dollars) + K2(t) physical stock of clean capital (trillion dollars) + L1(t) labor for the dirty economy (millions) + L2(t) labor for the clean economy (millions) + M(t) atmospheric carbon concentration + Y(t) economic output (trillion dollars); + +Variables + PW(t) welfare of current period + W2 total discounted welfare after the last jump (V_2-1-l); + +Equations + ALOCLABOR(t) compute allocation of total labor + CARBDYNAM(t) compute evolution of carbon concentrations + E1FIRST(t) initial value for carbon emissions from dirty capital + E2FIRST(t) initial value for carbon emissions from clean capital + ELFCOMP(t) compute economic loss factor + I2MAX(t) bound for investment on clean capital + K1ACCUMUL(t) compute dirty capital accumulation + K1FIRST(t) initial value for dirty capital + K1LAST(t) final value for dirty capital + K2ACCUMUL(t) compute clean capital accumulation + K2FIRST(t) initial value for clean capital + K2LAST(t) final value for clean capital + MFIRST(t) initial value for carbon concentration + TARGETM(t) impose cap on atmospheric carbon concentrations + TOTALCONS(t) compute total consumption + TOTALPROD(t) compute total production + PWEQ(t) compute welfare of current period + WELFARE2 compute total welfare after the last jump; + +ALOCLABOR(t).. + L1(t) + L2(t) =l= L(t); + +CARBDYNAM(t+1).. + M(t+1) =e= beta*10*(E1(t)+E2(t)) + M(t)*(1-delta_M) + delta_M*590; + +MFIRST(tfirst).. +* 2005 value around 385 ppmv = 808.8 GtC + M(tfirst) =e= 808.8; + +ELFCOMP(t).. + ELF(t) =e= 1; + +E1FIRST(tfirst).. +* DICE-2007 value + E1(tfirst) =e= 6.7; + +E2FIRST(tfirst).. +* 0.0001 of DICE-2007 value + E2(tfirst) =e= 0.00067; + +I2MAX(t).. + I2(t) =l= 0.97*Y(t); + +K1FIRST(tfirst).. + K1(tfirst) =e= 137.0; + +K1ACCUMUL(t).. + K1(t+1) =l= K1(t)*(1-dk)**10 + 10*I1(t); + +K1LAST(tlast).. + 0.02*K1(tlast) =l= I1(tlast); + +K2FIRST(tfirst).. + K2(tfirst) =e= 0.0137; + +K2ACCUMUL(t).. + K2(t+1) =l= K2(t)*(1-dk)**10 + 10*I2(t); + +K2LAST(tlast).. + 0.02*K2(tlast) =l= I2(tlast); + +TARGETM(t).. +* Constraint is always active + M(t) =l= mtargM; + +TOTALPROD(t).. + Y(t) =e= A(t) * ( + K1(t)**alphad * (phid(t)*E1(t))**thetad(t) * L1(t)**(1-alphad-thetad(t)) + + xi(t)*K2(t)**alphac * (phic(t)*E2(t))**thetac(t) * L2(t)**(1-alphac-thetac(t)) + ); + +TOTALCONS(t).. + C(t) =e= Y(t) - I1(t) - I2(t) - piE1*phid(t)*E1(t) - piE2*phic(t)*E2(t); + +PWEQ(t).. + PW(t) =e= ( (ELF(t)*C(t)/L(t))**(1-elasmu) -1) / (1-elasmu); + +WELFARE2.. + W2 =e= sum(t, 10*exp(-rho*nby(t))*L(t)*(PW(t))/scale1) + scale2 ; + +Model ECM /all/ ; +ECM.OPTFILE =1; + +C.lo(t) = 1; +C.up(t) = 1000; +E1.lo(t) = 0.0000001; +E1.up(t) = 500; +E2.lo(t) = 0.0000001; +E2.up(t) = 100; +ELF.lo(t) = 0.5; +ELF.up(t) = 1.0; +I1.lo(t) = 0.000000001; +I1.up(t) = 1000; +I2.lo(t) = 0.000000001; +I2.up(t) = 1000; +K1.lo(t) = 0.01; +K1.up(t) = 3000; +K2.lo(t) = 0.000000001; +K2.up(t) = 3000; +L1.lo(t) = 0.1; +L1.up(t) = 10000; +L2.lo(t) = 0.000000001; +L2.up(t) = 10000; +M.lo(t) = 300; +M.up(t) = 4000; +Y.lo(t) = 50; +Y.up(t) = 1000; + +option iterlim = 99900; +option reslim = 99999; +option solprint = off; +option limrow = 0; +option limcol = 0; + +Solve ECM using nlp maximising W2; + +EM(t) = E1.L(t)+E2.L(t); +TK(t) = K1.L(t)+K2.L(t); + +deltaalphaGDP(t) = Y.L(t)-GDP(t); +deltaGDP = sum ( subtGDP(t) , sqr(deltaalphaGDP(t)) ); +deltaem = sum ( subtem(t) , sqr(EM(t)-emissionB2(t)) ); +deltaalpha = deltaGDP / moyenneGDP + deltaem / moyenneem ; + +file FOUT / output.txt /; +put FOUT; +put deltaalpha:13:6; +putclose; + + + + + + diff --git a/examples/interfaces/GAMS/ed.hup b/examples/interfaces/GAMS/ed.hup index 4cce1c4b0d1d384570ec7a81ccad22e6b6f4342d..85bca40488933e73f8614918ade854de303c9f6c 100644 --- a/examples/interfaces/GAMS/ed.hup +++ b/examples/interfaces/GAMS/ed.hup @@ -1,13 +1,13 @@ - -This example illustrates how to use NOMAD with a GAMS black-box problem. - -The example runs on windows. - -The GAMS program is located in file bb.gms. - -The source code is in bb.cpp: it is a C++ wrapper that calls GAMS. -It can be compiled with visual C++ or minGW. - -The wrapper can be tested with the command 'bb.exe .\points\x0.txt'. - + +This example illustrates how to use NOMAD with a GAMS black-box problem. + +The example runs on windows. + +The GAMS program is located in file bb.gms. + +The source code is in bb.cpp: it is a C++ wrapper that calls GAMS. +It can be compiled with visual C++ or minGW. + +The wrapper can be tested with the command 'bb.exe .\points\x0.txt'. + Once the wrapper is compiled, use nomad with the parameters file parameters.txt. diff --git a/examples/interfaces/GAMS/lb.txt b/examples/interfaces/GAMS/lb.txt index 542b27db608f1312c27447e2a16a06d64772038b..a45ca61fa42c48388f5b15c92a96c752d2a95fb5 100644 --- a/examples/interfaces/GAMS/lb.txt +++ b/examples/interfaces/GAMS/lb.txt @@ -1,19 +1,19 @@ -2.25 -0.027 -0.09 -0.18 -0.27 -0.27 -0.09 -0.9 -0.13 -0.27 -4.5 -0.13 -0.27 -0.045 -0 -0.007 -0.045 -0 +2.25 +0.027 +0.09 +0.18 +0.27 +0.27 +0.09 +0.9 +0.13 +0.27 +4.5 +0.13 +0.27 +0.045 +0 +0.007 +0.045 +0 0.007 \ No newline at end of file diff --git a/examples/interfaces/GAMS/param.txt b/examples/interfaces/GAMS/param.txt index 0c41dfa48c59e878e289c77051a276a345c7efac..aca6428cafe143168de69bf93cc8da599576299d 100644 --- a/examples/interfaces/GAMS/param.txt +++ b/examples/interfaces/GAMS/param.txt @@ -1,32 +1,32 @@ -##### -# NOMAD PARAMETERS # -#### - - - -SEED NONE - -DIMENSION 19 -DISPLAY_DEGREE 1 -DISPLAY_STATS BBE OBJ - -BB_EXE bb.exe - -BB_OUTPUT_TYPE OBJ - -BB_INPUT_INCLUDE_SEED yes - -BB_INPUT_INCLUDE_TAG yes - - - - -x0 x0.txt -lower_bound lb.txt - -upper_bound ub.txt - - - - +##### +# NOMAD PARAMETERS # +#### + + + +SEED NONE + +DIMENSION 19 +DISPLAY_DEGREE 1 +DISPLAY_STATS BBE OBJ + +BB_EXE bb.exe + +BB_OUTPUT_TYPE OBJ + +BB_INPUT_INCLUDE_SEED yes + +BB_INPUT_INCLUDE_TAG yes + + + + +x0 x0.txt +lower_bound lb.txt + +upper_bound ub.txt + + + + MAX_BB_EVAL 10 \ No newline at end of file diff --git a/examples/interfaces/GAMS/points/x0.txt b/examples/interfaces/GAMS/points/x0.txt index d99f74ea0c3ddc86b453f7f4e8e4ee289dabbd87..d7b79a8906c82f586a2f24738a26d8b662fc9eca 100644 --- a/examples/interfaces/GAMS/points/x0.txt +++ b/examples/interfaces/GAMS/points/x0.txt @@ -1,22 +1,22 @@ -0 0 +0 0 2.5 - + 0.0302 - -0.1 -0.2 -0.3 -0.3 -0.1 -1.0 -0.15 -0.3 -5.0 -0.15 -0.3 -0.05 -0 -0.008 -0.05 -0 + +0.1 +0.2 +0.3 +0.3 +0.1 +1.0 +0.15 +0.3 +5.0 +0.15 +0.3 +0.05 +0 +0.008 +0.05 +0 0.008 \ No newline at end of file diff --git a/examples/interfaces/GAMS/points/x1.txt b/examples/interfaces/GAMS/points/x1.txt index 1e6f158f2db1bdba38142513cda9865553033467..d1a6bea77617e99533557a9a7c3e957f70a8cde1 100644 --- a/examples/interfaces/GAMS/points/x1.txt +++ b/examples/interfaces/GAMS/points/x1.txt @@ -1,20 +1,20 @@ -0 0 -2.25 -0.027 -0.09 -0.18 -0.27 -0.27 -0.09 -0.9 -0.13 -0.27 -4.5 -0.13 -0.27 -0.045 -0 -0.007 -0.045 -0 +0 0 +2.25 +0.027 +0.09 +0.18 +0.27 +0.27 +0.09 +0.9 +0.13 +0.27 +4.5 +0.13 +0.27 +0.045 +0 +0.007 +0.045 +0 0.007 \ No newline at end of file diff --git a/examples/interfaces/GAMS/points/x2.txt b/examples/interfaces/GAMS/points/x2.txt index 3242adc86ece9d1a0014d01212ad4afb33d5e29d..bdf4951e594d278de2d68bf5096d69f917bd4b1d 100644 --- a/examples/interfaces/GAMS/points/x2.txt +++ b/examples/interfaces/GAMS/points/x2.txt @@ -1,25 +1,25 @@ -0 0 +0 0 2.75 - -0.033 + +0.033 0.11 - + 0.22 - + 0.33 - + 0.33 - -0.11 -1.1 -0.17 -0.33 -5.5 -0.17 -0.33 -0.055 -0.5 -0.009 -0.055 -0.5 + +0.11 +1.1 +0.17 +0.33 +5.5 +0.17 +0.33 +0.055 +0.5 +0.009 +0.055 +0.5 0.009 \ No newline at end of file diff --git a/examples/interfaces/GAMS/readme.txt b/examples/interfaces/GAMS/readme.txt index 4cce1c4b0d1d384570ec7a81ccad22e6b6f4342d..390c172f45a629bcf57d17debf701ca75187935c 100644 --- a/examples/interfaces/GAMS/readme.txt +++ b/examples/interfaces/GAMS/readme.txt @@ -1,13 +1,13 @@ - -This example illustrates how to use NOMAD with a GAMS black-box problem. - -The example runs on windows. - -The GAMS program is located in file bb.gms. - -The source code is in bb.cpp: it is a C++ wrapper that calls GAMS. -It can be compiled with visual C++ or minGW. - -The wrapper can be tested with the command 'bb.exe .\points\x0.txt'. - -Once the wrapper is compiled, use nomad with the parameters file parameters.txt. + +This example illustrates how to use NOMAD with a GAMS black-box problem. + +The example runs on windows. + +The GAMS program is located in file bb.gms. + +The source code is in bb.cpp: it is a C++ wrapper that calls GAMS. +It can be compiled with visual C++ or minGW. + +The wrapper can be tested with the command 'bb.exe .\points\x0.txt'. + +Once the wrapper is compiled, use nomad with the parameters file parameters.txt. diff --git a/examples/interfaces/GAMS/ub.txt b/examples/interfaces/GAMS/ub.txt index 025836ad2c955c6d33d60b8353a1ea07d4c653c1..b54338208aed9fe01c3b0611cd99c515ac9e7003 100644 --- a/examples/interfaces/GAMS/ub.txt +++ b/examples/interfaces/GAMS/ub.txt @@ -1,24 +1,24 @@ 2.75 - -0.033 + +0.033 0.11 - + 0.22 - + 0.33 - + 0.33 - -0.11 -1.1 -0.17 -0.33 -5.5 -0.17 -0.33 -0.055 -0.5 -0.009 -0.055 -0.5 + +0.11 +1.1 +0.17 +0.33 +5.5 +0.17 +0.33 +0.055 +0.5 +0.009 +0.055 +0.5 0.009 \ No newline at end of file diff --git a/examples/interfaces/GAMS/x0.txt b/examples/interfaces/GAMS/x0.txt index e82d42d29d8c35d9663f0985db9548c959213dad..b6b39746c3362f21fb359f7f16f17c1f0edb6c82 100644 --- a/examples/interfaces/GAMS/x0.txt +++ b/examples/interfaces/GAMS/x0.txt @@ -1,21 +1,21 @@ 2.5 - + 0.0302 - -0.1 -0.2 -0.3 -0.3 -0.1 -1.0 -0.15 -0.3 -5.0 -0.15 -0.3 -0.05 -0 -0.008 -0.05 -0 + +0.1 +0.2 +0.3 +0.3 +0.1 +1.0 +0.15 +0.3 +5.0 +0.15 +0.3 +0.05 +0 +0.008 +0.05 +0 0.008 \ No newline at end of file diff --git a/examples/interfaces/Matlab_MEX/Functions/nomad.m b/examples/interfaces/Matlab_MEX/Functions/nomad.m index e2365b3278ac4ea171433b52709d929e13131c04..47e84f95b41bd64e1ca4fb1b818d8335d86b8e9a 100644 --- a/examples/interfaces/Matlab_MEX/Functions/nomad.m +++ b/examples/interfaces/Matlab_MEX/Functions/nomad.m @@ -1,38 +1,38 @@ -% NOMAD Solve a Global MINLP/NLP using NOMAD, a Blackbox Optimization Library -% -% min f(x) subject to: nlcon(x) <= 0 -% x lb <= x <= ub -% x in R -% -%%%%%%%%%%%%% GERAD VERSION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% [x,fval,exitflag,iter,nfval] = nomad(fun,x0,lb,ub,opts,param) -% -% Input arguments: -% fun - nonlinear function handle (f and nlcon) -% x0 - initial solution guess -% lb - decision variable lower bounds -% ub - decision variable upper bounds -% opts - solver options (see nomadset) -% param - extra parameter passed to the blackbox function -% -% Return arguments: -% x - solution vector -% fval - objective value at the solution (paretor front if bi-obj) -% exitflag - exit status (see below) -% iter - number of iterations taken by the solver -% nfval - number of function evaluations taken by the solver -% -% Return Status: -% 1 - converged / target reached -% 0 - maximum iterations / function evaluations exceeded -% -1 - infeasible / mesh limit reached -% -2 - initialization error -% -3 - nomad error -% -5 - user exit -% -% -% NOMAD is released under the Lesser GNU Public License (LGPL). -% Type nomad('-info') to see license and author details. -% -% MEX Interface Copyright (C) 2012 Jonathan Currie (I2C2) +% NOMAD Solve a Global MINLP/NLP using NOMAD, a Blackbox Optimization Library +% +% min f(x) subject to: nlcon(x) <= 0 +% x lb <= x <= ub +% x in R +% +%%%%%%%%%%%%% GERAD VERSION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% [x,fval,exitflag,iter,nfval] = nomad(fun,x0,lb,ub,opts,param) +% +% Input arguments: +% fun - nonlinear function handle (f and nlcon) +% x0 - initial solution guess +% lb - decision variable lower bounds +% ub - decision variable upper bounds +% opts - solver options (see nomadset) +% param - extra parameter passed to the blackbox function +% +% Return arguments: +% x - solution vector +% fval - objective value at the solution (paretor front if bi-obj) +% exitflag - exit status (see below) +% iter - number of iterations taken by the solver +% nfval - number of function evaluations taken by the solver +% +% Return Status: +% 1 - converged / target reached +% 0 - maximum iterations / function evaluations exceeded +% -1 - infeasible / mesh limit reached +% -2 - initialization error +% -3 - nomad error +% -5 - user exit +% +% +% NOMAD is released under the Lesser GNU Public License (LGPL). +% Type nomad('-info') to see license and author details. +% +% MEX Interface Copyright (C) 2012 Jonathan Currie (I2C2) % Modified for GERAD version by C.Tribes \ No newline at end of file diff --git a/examples/interfaces/Matlab_MEX/Functions/nomadset.m b/examples/interfaces/Matlab_MEX/Functions/nomadset.m index 19b7aa00eba29391e31ac925fa1958e9c43ff7e5..a7a91c12f910e8e51a50b7e634b1242c382a5a14 100755 --- a/examples/interfaces/Matlab_MEX/Functions/nomadset.m +++ b/examples/interfaces/Matlab_MEX/Functions/nomadset.m @@ -1,343 +1,343 @@ -function options = nomadset(varargin) -%NOMADSET Create or alter the options for Optimization with NOMAD -% -% options = nomadset('param1',value1,'param2',value2,...) creates an -% NOMAD options structure with the parameters 'param' set to their -% corresponding values in 'value'. Parameters not specified will be set to -% the NOMAD default. -% -% options = nomadset(oldopts,'param1',value1,...) creates a copy of the old -% options 'oldopts' and then fills in (or writes over) the parameters -% specified by 'param' and 'value'. -% -% options = nomadset() creates an options structure with all fields set to -% NOMADSET defaults. -% -% nomadset() prints a list of all possible fields and their function. - -% Copyright (C) 2012 Jonathan Currie (I2C2) -% modif CT june 12, 2014 --->�version 1.22_ct -%Valid direction types -global dirtypes -dirtypes = {'ortho 1','ortho 2','ortho n+1','ortho n+1 quad','ortho n+1 neg','ortho','ortho 2n','lt 1','lt 2','lt 2n','lt n+1','gps binary','gps 2n static',... - 'gps 2n rand','gps n+1 static uniform','gps n+1 static','gps n+1 rand uniform','gps n+1 rand'}; - -% Print out possible values of properties. -if (nargin == 0) && (nargout == 0) - printfields(); - return -end - -%Names and Defaults -Names = {'bb_input_type','bb_output_type','direction_type','f_target','initial_mesh_size','lh_search','max_bb_eval','bb_max_block_size',... - 'max_time','model_eval_sort','model_search','multi_nb_mads_runs','multi_overall_bb_eval','opportunistic_eval','opportunistic_lh','seed','vns_search',... - 'cache_search','h_max_0','h_min','h_norm','initial_mesh_index','l_curve_target','max_cache_memory','max_consecutive_failed_iterations',... - 'max_eval','max_iterations','max_mesh_index','max_sim_bb_eval','mesh_coarsening_exponent','mesh_refining_exponent','mesh_update_basis',... - 'min_mesh_size','min_poll_size','model_eval_sort_cautious','model_search_max_trial_pts','model_search_optimistic','model_search_proj_to_mesh',... - 'model_quad_max_y_size','model_quad_min_y_size','model_quad_radius_factor','model_quad_use_wp','multi_f_bounds','multi_formulation','multi_use_delta_crit',... - 'neighbors_mat','opportunistic_cache_search','opportunistic_lucky_eval','opportunistic_min_eval','opportunistic_min_f_imprvmt','opportunistic_min_nb_success','rho','scaling','sec_poll_dir_type',... - 'snap_to_bounds','speculative_search','stat_sum_target','stop_if_feasible','add_seed_to_file_names','cache_file','cache_save_period','display_degree','display_all_eval',... - 'history_file','solution_file','stats_file','param_file','iterfun','disable','epsilon','opt_only_sgte','sgte_cost','sgte_eval_sort','has_sgte',... - 'sgte_cache_file','max_sgte_eval','anisotropic_mesh','fixed_variable'}'; -Defaults = {[],[],[],[],[],[],[],1,...%bb_max_block_size - [],1,1,[],[],1,1,[],0,... %vns_search - 0,1e20,[],'L2',[],[],2000,[],...%max_consecutive_failed_iterations - [],[],[],[],1,-1,4,... %mesh_update_basis - [],[],1,4,1,1,... %model_search_proj_to_mesh - [],500,2,0,[],'product',0,...%multi_use_delta_crit - [],0,0,[],[],[],0.1,[],[],...%sec_poll_dir_type - 1,1,[],0,1,[],25,0,0,... %display_all_eval - [],[],[],[],[],[],1e-13,0,[],1,0,...%has_sgte - [],[],1,''}'; - -%Collect Sizes and lowercase matches -m = size(Names,1); numberargs = nargin; -%Create structure with all names and default values -st = [Names,Defaults]'; options = struct(st{:}); - -% Check we have char or structure input. If structure, insert arguments -i = 1; -while i <= numberargs - arg = varargin{i}; - if ischar(arg) - break; - end - if ~isempty(arg) - if ~isa(arg,'struct') - error('An argument was supplied that wasn''t a string or struct!'); - end - for j = 1:m - if any(strcmp(fieldnames(arg),Names{j,:})) - val = arg.(Names{j,:}); - else - val = []; - end - if(~isempty(val)) - checkfield(Names{j,:},val); - options.(Names{j,:}) = val; - end - end - end - i = i + 1; -end - -%Check we have even number of args left -if rem(numberargs-i+1,2) ~= 0 - error('You do not have a value specified for each field!'); -end - -%Go through each argument pair and assign to correct field -expectval = 0; %first arg is a name -while i <= numberargs - arg = varargin{i}; - - switch(expectval) - case 0 %field - if ~ischar(arg) - error('Expected field name to be a string! - Argument %d',i); - end - j = find(strcmp(arg,Names) == 1); - if isempty(j) % if no matches - error('Unrecognised parameter %s',arg); - elseif(length(j) > 1) - error('Ambiguous parameter %s',arg); - end - expectval = 1; %next arg is a value - case 1 - if(~isempty(arg)) - if(iscell(arg)) - checkfield(Names{j,:},arg); - options.(Names{j,:}) = arg; - else - if(ischar(arg)), arg = lower(arg); end - checkfield(Names{j,:},arg); - options.(Names{j,:}) = arg; - end - end - expectval = 0; - end - i = i + 1; -end - -if expectval %fallen off end somehow - error('Missing value for %s',arg); -end -%Ensure we have absolute path -if(~isempty(options.param_file)) - options = checkParamFile(options); -end - - -function checkfield(field,value) -%Check a field contains correct data type -global dirtypes -err = []; - -switch lower(field) - %Scalar double - case {'f_target','max_bb_eval','bb_max_block_size','max_time','model_eval_sort',... - 'model_search','multi_nb_mads_runs','multi_overall_bb_eval','opportunistic_eval','opportunistic_lh','seed','vns_search',... - 'cache_search','h_max_0','h_min','initial_mesh_index','l_curve_target','max_cache_memory','max_consecutive_failed_iterations',... - 'max_eval','max_iterations','max_mesh_index','max_sim_bb_eval','mesh_coarsening_exponent','mesh_refining_exponent','mesh_update_basis',... - 'model_eval_sort_cautious','model_search_max_trial_pts','model_search_optimistic','model_search_proj_to_mesh',... - 'model_quad_max_y_size','model_quad_min_y_size','model_quad_radius_factor','model_quad_use_wp','multi_use_delta_crit',... - 'opportunistic_cache_search','opportunistic_lucky_eval','opportunistic_min_f_imprvmnt','opportunistic_min_nb_success','rho',... - 'snap_to_bounds','speculative_search','stat_sum_target','stop_if_feasible','add_seed_to_file_names','cache_save_period','display_degree',... - 'display_all_eval','has_sgte','sgte_cost','sgte_eval_sort','opt_only_sgte','epsilon','max_sgte_eval','anisotropic_mesh'} - if(~isscalar(value) || ~isnumeric(value) || ~isreal(value) || ~isa(value,'double')) - err = MException('NOMAD:SetFieldError','Parameter ''%s'' should be a real scalar double',field); - end - - %Direction Type - case {'direction_type','sec_poll_dir_type'} - if(~ischar(value) || ~any(strcmp(value,dirtypes))) - err = MException('NOMAD:SetFieldError','Parameter ''%s'' should match one of those displayed by nomadset()',field); - end - - %Disable - case 'disable' - if(~ischar(value) || ~any(strcmp(value,{'models'}))) - err = MException('NOMAD:SetFieldError','Parameter ''%s'' should be one of {''models''}',field); - end - - %String - case {'cache_file','history_file','solution_file','stats_file','param_file','multi_formulation','h_norm',... - 'lh_search','multi_f_bounds','sgte_cache_file'} - if(~ischar(value)) - err = MException('NOMAD:SetFieldError','Parameter ''%s'' should be a char array (string)',field); - end - - %string or cell of strings - case {'bb_output_type','bb_input_type','initial_mesh_size','min_mesh_size','min_poll_size','scaling','fixed_variable'} - if(~ischar(value) && ~iscell(value)) - err = MException('NOMAD:SetFieldError','Parameter ''%s'' should be a string or cell array of strings',field); - elseif(iscell(value)) - for i = 1:numel(value) - if(~ischar(value{i})) - err = MException('NOMAD:SetFieldError','Parameter ''%s'' cell(%d) should be a string',field,i); - break; - end - end - end - - %function_handle - case {'iterfun','neighbors_mat'} - if(~isa(value,'function_handle')) % C.Tribes june 12, 2014 ~isa instead of isa - err = MException('NOMAD:SetFieldError','Parameter ''%s'' should be a function handle',field); - end - - otherwise - err = MException('OPTI:SetFieldError','Unrecognized parameter name ''%s''.', field); -end -if(~isempty(err)), throw(err); end - - -function opts = checkParamFile(opts) -%Check parameter file exists and collect absolute path -filename = opts.param_file; -%See if we got an absolute path -switch(computer) - case {'PCWIN','PCWIN64'} - if(~isempty(strfind(filename,':'))) - p = filename; - %Check it exists - if(exist(filename,'file') ~= 2) - error('Cannot locate absolute file %s!',filename); - end - else - p = which(filename); - %Check it exists - if(isempty(p)) - error('Cannot locate file %s!',filename); - end - end - otherwise %Linux / Mac - if(filename(1) == '/') %absolute path (I think) - p = filename; - %Check it exists - if(exist(filename,'file') ~= 2) - error('Cannot locate absolute file %s!',filename); - end - else - p = which(filename); - %Check it exists - if(isempty(p)) - error('Cannot locate file %s!',filename); - end - end -end -%Save full path -opts.param_file = p; - - -function printfields() -%Print out fields with defaults - -global dirtypes - -fprintf('\nBASIC PROBLEM PARAMETERS:\n'); -fprintf(' bb_input_type: [ Blackbox input types, specified as a cell array of strings, overwrites xtype {[]} ] \n'); -fprintf(' bb_output_type: [ Blackbox output types, specified as a cell array of strings (see below) ] \n'); - -fprintf('\nBASIC ALGORITHMIC PARAMETERS:\n'); -fprintf(' direction_type: [ Type of directions for the poll (see below) {''ortho n+1 quad''} ] \n'); -fprintf(' f_target: [ Stop if f(x) < ftarget {[]} ] \n'); -fprintf(' initial_mesh_size: [ Initial Mesh Size (del_0^m) {[]} ]\n'); -fprintf(' lh_search: [ Latin-Hypercube Search (po and pi) {[]} ]\n'); -fprintf(' max_bb_eval: [ Maximum number of blackbox evaluations {[]} ] \n'); -fprintf(' max_time: [ Maximum execution time {[]} ] \n'); - -fprintf('\nADVANCED ALGORITHMIC PARAMETERS:\n'); -fprintf(' anisotropic_mesh: [ Use anisotropic mesh: No (0), Yes (1) = Default ] \n'); -fprintf(' bb_max_block_size: [ Maximum size of a block of evaluations given to the blackbox function {1} \n'); -fprintf(' cache_search: [ Use Cache search: Off {0}, On (1) ] \n'); -fprintf(' disable: [ Forcefully disable NOMAD features {[]} ] \n'); -fprintf(' fixed_variable: [ Fixed variable provided as ( 0.0 - 0.0 ) -> variables 0 and 2 are fixed; or as 1-10 0.0 -> variable 1 to 10 are fixed to 0.0 {[]} \n'); -fprintf(' h_max_0: [ Initial value of hmax {1e20} ] \n'); -fprintf(' h_min: [ x is feasible if h(x) >= v {0.0} ] \n'); -fprintf(' h_norm: [ Norm used to compute h: ''L1'', {''L2''}, ''Linf'' ] \n'); -fprintf(' has_sgte: [ Indicates if the problem has a surrogate function: No {0}, Yes {1} ] \n'); -fprintf(' initial_mesh_index: [ Initial Mesh Index {0} ] \n'); -fprintf(' l_curve_target: [ NOMAD terminates if objective may not reach this value {[]} ] \n'); -fprintf(' max_cache_memory: [ Maximum cache memory {2000} MB ] \n'); -fprintf(' max_consecutive_failed_iterations: [ Maximum number of failed MADS iterations {[]} ] \n'); -fprintf(' max_eval: [ Maximum number of evaluations (includes cache and bb) {[]} ] \n'); -fprintf(' max_iterations: [ Maximum number of iterations {[]} ] \n'); -fprintf(' max_mesh_index: [ Maximum Mesh Index {[]} ] \n'); -fprintf(' max_sgte_eval: [ Maximum Number of Surrogate Evaluations {[]} ] \n'); -fprintf(' max_sim_bb_eval: [ Maximum Simulated BB evaluations {[]} ] \n'); -fprintf(' mesh_coarsening_exponent: [ Mesh Coarsening Exponent {1} ] \n'); -fprintf(' mesh_refining_exponent: [ Mesh Refining Exponent {-1} ] \n'); -fprintf(' mesh_update_basis: [ Mesh Update Basis {4} ] \n'); -fprintf(' min_mesh_size: [ Minimum Mesh Size (del_min^m) {[]} ] \n'); -fprintf(' min_poll_size: [ Minimum Poll Size (del_min^p) {[]} ] \n'); -fprintf(' model_eval_sort: [ Use Quadratic Model to order points: Off (0), On {1} ] \n'); -fprintf(' model_search: [ Use Quadratic Model searches: Off (0), On {1} ] \n'); -fprintf(' model_search_optimistic: [ If the model search is optimistic : No (0), Yes {1} ] \n'); -fprintf(' multi_f_bounds: [ Vector of [f1min, f1max, f2min, f2max] for biobjective surf calculation {[]} ] \n'); -fprintf(' multi_nb_mads_runs: [ Number of MADS runs in Biobjective Optimization {[]} ] \n'); -fprintf(' multi_overall_bb_eval: [ Maximum number of BB evals for all MADS runs {[]} ] \n'); -fprintf(' neighbors_mat: [ Matlab function handle to obtain the neighboring points (use with categorical variables) {[]} ] \n'); -fprintf(' opportunistic_cache_search: [ Opportunistic cache search: Off {0}, On (1) ] \n'); -fprintf(' opportunistic_eval: [ Opportunistic strategy: Off (0), On {1} ] \n'); -fprintf(' opportunistic_lh: [ Opportunistic strategy for LH search: Off {0}, On (1)] \n'); -fprintf(' opportunistic_min_eval: [ Do not terminate below i evaluations {[]} ] \n'); -fprintf(' rho: [ Parameter of the progressive barrier {0.1} ] \n'); -fprintf(' scaling: [ Scaling on the variables (vector of scaling values for each variable) {[]} ] \n'); -fprintf(' seed: [ Random Seed: {[]} ] \n'); -fprintf(' sgte_cost: [ The cost of c surrogate evaluations is equivalent to one blackbox evaluation: {[]} ] \n'); -fprintf(' sgte_eval_sort: [ If surrogates are used to sort list of trial points: Off (0), On {1} ] \n'); -fprintf(' snap_to_bounds: [ Snap to boundary trial points that are generated outside of bounds: No (0), Yes {1} ] \n'); -fprintf(' speculative_search: [ MADS speculative search: No (0), Yes {1} ] \n'); -fprintf(' stat_sum_target: [ Terminates if stat_sum reaches this value {[]} ] \n'); -fprintf(' stop_if_feasible: [ Stop on first feasible solution: Off {0}, On (1) ] \n'); -fprintf(' vns_search: [ Variable Neighbourhood Search (Multiple Minima Problems): Off {0.0}, Max Searches (1.0) ] \n'); - - -fprintf('\nDEVELOPER PARAMETERS:\n'); -fprintf(' epsilon: [ Precision on real numbers {1e-13} ]\n'); -fprintf(' model_eval_sort_cautious: [ If the model ordering strategy is cautious: No (0), Yes {1} ] \n'); -fprintf(' model_search_max_trial_pts: [ Maximum trial points for one model search {4} ] \n'); -fprintf(' model_search_proj_to_mesh: [ If model search trial points are projected to mesh: No (0), Yes {1} ] \n'); -fprintf(' model_quad_max_y_size: [ Upper limit on the size of interpolation sets for quadratic models {500} ] \n'); -fprintf(' model_quad_min_y_size: [ Inf limit on the size of interpolation sets for quadratic models {[]} ] \n'); -fprintf(' model_quad_radius_factor: [ Quadratic Model search radius factor {2.0} ] \n'); -fprintf(' model_quad_use_wp: [ Enable strategy to maintain well-poised quadratic models: Off {0}, On (1) ] \n'); -fprintf(' multi_formulation: [ Single objective reformulation: ''normalized'', {''product''}, ''dist_l1'', ''dist_l2'', ''dist_linf'' ] \n'); -fprintf(' multi_use_delta_crit: [ Use stopping criterion based on the delta criterion: Off {0}, On (1) ] \n'); -fprintf(' opportunistic_lucky_eval: [ Perform an additional BB eval after an improvement: Off {0}, On (1) ] \n'); -fprintf(' opportunistic_min_f_imprvmt: [ Terminate only if f is reduced by r%% {[]} ] \n'); -fprintf('opportunistic_min_nb_success: [ Do not terminate before i successes {[]} ] \n'); -fprintf(' opt_only_sgte: [ Minimize only with surrogates: No {0}, Yes (1) ]\n'); -fprintf(' sec_poll_dir_type: [ Type of directions for the secondary poll (see below) {[]} ] \n'); - -fprintf('\nOUTPUT PARAMETERS:\n'); -fprintf(' add_seed_to_file_names: [ If the seed is added to the output file names: Off (0), On {1} ]\n'); -fprintf(' cache_file: [ Cache file: Off {[]}, On ''filename'' ]\n'); -fprintf(' cache_save_period: [ Cache files are saved every i iterations: {25} ]\n'); -fprintf(' display_degree: [ Display level: None {0}, Increasing (>0) ] \n'); -fprintf(' display_all_eval: [ Display all Points: Off {0}, On (1) ] \n'); -fprintf(' history_file: [ File containing all trial points: Off {[]}, On ''filename'' ]\n'); -fprintf(' solution_file: [ File to save the current best feasible point: Off {[]}, On ''filename'' ]\n'); -fprintf(' stats_file: [ File for screen dump: Off {[]}, On ''filename'' ]\n'); -fprintf(' sgte_cache_file: [ Surrogate cache file: Off {[]}, On ''filename'' ]\n'); - -fprintf('\nMEX INTERFACE PARAMETERS:\n'); -fprintf(' param_file: [ Read NOMAD options from a parameters file (overwrites these options): Off {[]}, On ''filename'' ]\n'); -fprintf(' iterfun: [ Callback function run every function evaluation: Off {[]}, On function_handle ]\n'); - - -fprintf('\n\nValid Direction Types (string):\n'); -for i = 1:length(dirtypes) - fprintf('''%s''\n',dirtypes{i}); -end -fprintf('\nValid BB_OUTPUT_TYPE types (cell array of strings):\n'); -fprintf('OBJ: Objective\n'); -fprintf(' PB: Progressive Barrier (default constraint type)\n'); -fprintf(' EB: Extreme Barrier\n'); -fprintf('PEB: Hybrid Constraint (PB/EB)\n'); -fprintf(' F: Filter\n'); - - - - +function options = nomadset(varargin) +%NOMADSET Create or alter the options for Optimization with NOMAD +% +% options = nomadset('param1',value1,'param2',value2,...) creates an +% NOMAD options structure with the parameters 'param' set to their +% corresponding values in 'value'. Parameters not specified will be set to +% the NOMAD default. +% +% options = nomadset(oldopts,'param1',value1,...) creates a copy of the old +% options 'oldopts' and then fills in (or writes over) the parameters +% specified by 'param' and 'value'. +% +% options = nomadset() creates an options structure with all fields set to +% NOMADSET defaults. +% +% nomadset() prints a list of all possible fields and their function. + +% Copyright (C) 2012 Jonathan Currie (I2C2) +% modif CT june 12, 2014 --->�version 1.22_ct +%Valid direction types +global dirtypes +dirtypes = {'ortho 1','ortho 2','ortho n+1','ortho n+1 quad','ortho n+1 neg','ortho','ortho 2n','lt 1','lt 2','lt 2n','lt n+1','gps binary','gps 2n static',... + 'gps 2n rand','gps n+1 static uniform','gps n+1 static','gps n+1 rand uniform','gps n+1 rand'}; + +% Print out possible values of properties. +if (nargin == 0) && (nargout == 0) + printfields(); + return +end + +%Names and Defaults +Names = {'bb_input_type','bb_output_type','direction_type','f_target','initial_mesh_size','lh_search','max_bb_eval','bb_max_block_size',... + 'max_time','model_eval_sort','model_search','multi_nb_mads_runs','multi_overall_bb_eval','opportunistic_eval','opportunistic_lh','seed','vns_search',... + 'cache_search','h_max_0','h_min','h_norm','initial_mesh_index','l_curve_target','max_cache_memory','max_consecutive_failed_iterations',... + 'max_eval','max_iterations','max_mesh_index','max_sim_bb_eval','mesh_coarsening_exponent','mesh_refining_exponent','mesh_update_basis',... + 'min_mesh_size','min_poll_size','model_eval_sort_cautious','model_search_max_trial_pts','model_search_optimistic','model_search_proj_to_mesh',... + 'model_quad_max_y_size','model_quad_min_y_size','model_quad_radius_factor','model_quad_use_wp','multi_f_bounds','multi_formulation','multi_use_delta_crit',... + 'neighbors_mat','opportunistic_cache_search','opportunistic_lucky_eval','opportunistic_min_eval','opportunistic_min_f_imprvmt','opportunistic_min_nb_success','rho','scaling','sec_poll_dir_type',... + 'snap_to_bounds','speculative_search','stat_sum_target','stop_if_feasible','add_seed_to_file_names','cache_file','cache_save_period','display_degree','display_all_eval',... + 'history_file','solution_file','stats_file','param_file','iterfun','disable','epsilon','opt_only_sgte','sgte_cost','sgte_eval_sort','has_sgte',... + 'sgte_cache_file','max_sgte_eval','anisotropic_mesh','fixed_variable'}'; +Defaults = {[],[],[],[],[],[],[],1,...%bb_max_block_size + [],1,1,[],[],1,1,0,0,... %vns_search + 0,1e20,[],'L2',[],[],2000,[],...%max_consecutive_failed_iterations + [],[],[],[],1,-1,4,... %mesh_update_basis + [],[],0,10,1,1,... %model_search_proj_to_mesh + [],[],2,0,[],'product',0,...%multi_use_delta_crit + [],0,0,[],[],-1,0.1,[],[],...%sec_poll_dir_type + 1,1,[],0,1,[],25,2,0,... %display_all_eval + [],[],[],[],[],[],1e-13,0,[],1,0,...%has_sgte + [],[],1,''}'; + +%Collect Sizes and lowercase matches +m = size(Names,1); numberargs = nargin; +%Create structure with all names and default values +st = [Names,Defaults]'; options = struct(st{:}); + +% Check we have char or structure input. If structure, insert arguments +i = 1; +while i <= numberargs + arg = varargin{i}; + if ischar(arg) + break; + end + if ~isempty(arg) + if ~isa(arg,'struct') + error('An argument was supplied that wasn''t a string or struct!'); + end + for j = 1:m + if any(strcmp(fieldnames(arg),Names{j,:})) + val = arg.(Names{j,:}); + else + val = []; + end + if(~isempty(val)) + checkfield(Names{j,:},val); + options.(Names{j,:}) = val; + end + end + end + i = i + 1; +end + +%Check we have even number of args left +if rem(numberargs-i+1,2) ~= 0 + error('You do not have a value specified for each field!'); +end + +%Go through each argument pair and assign to correct field +expectval = 0; %first arg is a name +while i <= numberargs + arg = varargin{i}; + + switch(expectval) + case 0 %field + if ~ischar(arg) + error('Expected field name to be a string! - Argument %d',i); + end + j = find(strcmp(arg,Names) == 1); + if isempty(j) % if no matches + error('Unrecognised parameter %s',arg); + elseif(length(j) > 1) + error('Ambiguous parameter %s',arg); + end + expectval = 1; %next arg is a value + case 1 + if(~isempty(arg)) + if(iscell(arg)) + checkfield(Names{j,:},arg); + options.(Names{j,:}) = arg; + else + if(ischar(arg)), arg = lower(arg); end + checkfield(Names{j,:},arg); + options.(Names{j,:}) = arg; + end + end + expectval = 0; + end + i = i + 1; +end + +if expectval %fallen off end somehow + error('Missing value for %s',arg); +end +%Ensure we have absolute path +if(~isempty(options.param_file)) + options = checkParamFile(options); +end + + +function checkfield(field,value) +%Check a field contains correct data type +global dirtypes +err = []; + +switch lower(field) + %Scalar double + case {'f_target','max_bb_eval','bb_max_block_size','max_time','model_eval_sort',... + 'model_search','multi_nb_mads_runs','multi_overall_bb_eval','opportunistic_eval','opportunistic_lh','seed','vns_search',... + 'cache_search','h_max_0','h_min','initial_mesh_index','l_curve_target','max_cache_memory','max_consecutive_failed_iterations',... + 'max_eval','max_iterations','max_mesh_index','max_sim_bb_eval','mesh_coarsening_exponent','mesh_refining_exponent','mesh_update_basis',... + 'model_eval_sort_cautious','model_search_max_trial_pts','model_search_optimistic','model_search_proj_to_mesh',... + 'model_quad_max_y_size','model_quad_min_y_size','model_quad_radius_factor','model_quad_use_wp','multi_use_delta_crit',... + 'opportunistic_cache_search','opportunistic_lucky_eval','opportunistic_min_f_imprvmnt','opportunistic_min_nb_success','rho',... + 'snap_to_bounds','speculative_search','stat_sum_target','stop_if_feasible','add_seed_to_file_names','cache_save_period','display_degree',... + 'display_all_eval','has_sgte','sgte_cost','sgte_eval_sort','opt_only_sgte','epsilon','max_sgte_eval','anisotropic_mesh'} + if(~isscalar(value) || ~isnumeric(value) || ~isreal(value) || ~isa(value,'double')) + err = MException('NOMAD:SetFieldError','Parameter ''%s'' should be a real scalar double',field); + end + + %Direction Type + case {'direction_type','sec_poll_dir_type'} + if(~ischar(value) || ~any(strcmp(value,dirtypes))) + err = MException('NOMAD:SetFieldError','Parameter ''%s'' should match one of those displayed by nomadset()',field); + end + + %Disable + case 'disable' + if(~ischar(value) || ~any(strcmp(value,{'models'}))) + err = MException('NOMAD:SetFieldError','Parameter ''%s'' should be one of {''models''}',field); + end + + %String + case {'cache_file','history_file','solution_file','stats_file','param_file','multi_formulation','h_norm',... + 'lh_search','multi_f_bounds','sgte_cache_file'} + if(~ischar(value)) + err = MException('NOMAD:SetFieldError','Parameter ''%s'' should be a char array (string)',field); + end + + %string or cell of strings + case {'bb_output_type','bb_input_type','initial_mesh_size','min_mesh_size','min_poll_size','scaling','fixed_variable'} + if(~ischar(value) && ~iscell(value)) + err = MException('NOMAD:SetFieldError','Parameter ''%s'' should be a string or cell array of strings',field); + elseif(iscell(value)) + for i = 1:numel(value) + if(~ischar(value{i})) + err = MException('NOMAD:SetFieldError','Parameter ''%s'' cell(%d) should be a string',field,i); + break; + end + end + end + + %function_handle + case {'iterfun','neighbors_mat'} + if(~isa(value,'function_handle')) % C.Tribes june 12, 2014 ~isa instead of isa + err = MException('NOMAD:SetFieldError','Parameter ''%s'' should be a function handle',field); + end + + otherwise + err = MException('OPTI:SetFieldError','Unrecognized parameter name ''%s''.', field); +end +if(~isempty(err)), throw(err); end + + +function opts = checkParamFile(opts) +%Check parameter file exists and collect absolute path +filename = opts.param_file; +%See if we got an absolute path +switch(computer) + case {'PCWIN','PCWIN64'} + if(~isempty(strfind(filename,':'))) + p = filename; + %Check it exists + if(exist(filename,'file') ~= 2) + error('Cannot locate absolute file %s!',filename); + end + else + p = which(filename); + %Check it exists + if(isempty(p)) + error('Cannot locate file %s!',filename); + end + end + otherwise %Linux / Mac + if(filename(1) == '/') %absolute path (I think) + p = filename; + %Check it exists + if(exist(filename,'file') ~= 2) + error('Cannot locate absolute file %s!',filename); + end + else + p = which(filename); + %Check it exists + if(isempty(p)) + error('Cannot locate file %s!',filename); + end + end +end +%Save full path +opts.param_file = p; + + +function printfields() +%Print out fields with defaults + +global dirtypes + +fprintf('\nBASIC PROBLEM PARAMETERS:\n'); +fprintf(' bb_input_type: [ Blackbox input types, specified as a cell array of strings, overwrites xtype {[]} ] \n'); +fprintf(' bb_output_type: [ Blackbox output types, specified as a cell array of strings (see below) ] \n'); + +fprintf('\nBASIC ALGORITHMIC PARAMETERS:\n'); +fprintf(' direction_type: [ Type of directions for the poll (see below) {''ortho n+1 quad''} ] \n'); +fprintf(' f_target: [ Stop if f(x) < ftarget {[]} ] \n'); +fprintf(' initial_mesh_size: [ Initial Mesh Size (del_0^m) {[]} ]\n'); +fprintf(' lh_search: [ Latin-Hypercube Search (po and pi) {[]} ]\n'); +fprintf(' max_bb_eval: [ Maximum number of blackbox evaluations {[]} ] \n'); +fprintf(' max_time: [ Maximum execution time {[]} ] \n'); + +fprintf('\nADVANCED ALGORITHMIC PARAMETERS:\n'); +fprintf(' anisotropic_mesh: [ Use anisotropic mesh: No (0), Yes (1) = Default ] \n'); +fprintf(' bb_max_block_size: [ Maximum size of a block of evaluations given to the blackbox function {1} \n'); +fprintf(' cache_search: [ Use Cache search: Off {0}, On (1) ] \n'); +fprintf(' disable: [ Forcefully disable NOMAD features {[]} ] \n'); +fprintf(' fixed_variable: [ Fixed variable provided as ( 0.0 - 0.0 ) -> variables 0 and 2 are fixed; or as 1-10 0.0 -> variable 1 to 10 are fixed to 0.0 {[]} \n'); +fprintf(' h_max_0: [ Initial value of hmax {1e20} ] \n'); +fprintf(' h_min: [ x is feasible if h(x) >= v {0.0} ] \n'); +fprintf(' h_norm: [ Norm used to compute h: ''L1'', {''L2''}, ''Linf'' ] \n'); +fprintf(' has_sgte: [ Indicates if the problem has a surrogate function: No {0}, Yes {1} ] \n'); +fprintf(' initial_mesh_index: [ Initial Mesh Index {0} ] \n'); +fprintf(' l_curve_target: [ NOMAD terminates if objective may not reach this value {[]} ] \n'); +fprintf(' max_cache_memory: [ Maximum cache memory {2000} MB ] \n'); +fprintf(' max_consecutive_failed_iterations: [ Maximum number of failed MADS iterations {[]} ] \n'); +fprintf(' max_eval: [ Maximum number of evaluations (includes cache and bb) {[]} ] \n'); +fprintf(' max_iterations: [ Maximum number of iterations {[]} ] \n'); +fprintf(' max_mesh_index: [ Maximum Mesh Index {[]} ] \n'); +fprintf(' max_sgte_eval: [ Maximum Number of Surrogate Evaluations {[]} ] \n'); +fprintf(' max_sim_bb_eval: [ Maximum Simulated BB evaluations {[]} ] \n'); +fprintf(' mesh_coarsening_exponent: [ Mesh Coarsening Exponent {1} ] \n'); +fprintf(' mesh_refining_exponent: [ Mesh Refining Exponent {-1} ] \n'); +fprintf(' mesh_update_basis: [ Mesh Update Basis {4} ] \n'); +fprintf(' min_mesh_size: [ Minimum Mesh Size (del_min^m) {[]} ] \n'); +fprintf(' min_poll_size: [ Minimum Poll Size (del_min^p) {[]} ] \n'); +fprintf(' model_eval_sort: [ Use Quadratic Model to order points: Off (0), On {1} ] \n'); +fprintf(' model_search: [ Use Quadratic Model searches: Off (0), On {1} ] \n'); +fprintf(' model_search_optimistic: [ If the model search is optimistic : No (0), Yes {1} ] \n'); +fprintf(' multi_f_bounds: [ Vector of [f1min, f1max, f2min, f2max] for biobjective surf calculation {[]} ] \n'); +fprintf(' multi_nb_mads_runs: [ Number of MADS runs in Biobjective Optimization {[]} ] \n'); +fprintf(' multi_overall_bb_eval: [ Maximum number of BB evals for all MADS runs {[]} ] \n'); +fprintf(' neighbors_mat: [ Matlab function handle to obtain the neighboring points (use with categorical variables) {[]} ] \n'); +fprintf(' opportunistic_cache_search: [ Opportunistic cache search: Off {0}, On (1) ] \n'); +fprintf(' opportunistic_eval: [ Opportunistic strategy: Off (0), On {1} ] \n'); +fprintf(' opportunistic_lh: [ Opportunistic strategy for LH search: Off {0}, On (1)] \n'); +fprintf(' opportunistic_min_eval: [ Do not terminate below i evaluations {[]} ] \n'); +fprintf(' rho: [ Parameter of the progressive barrier {0.1} ] \n'); +fprintf(' scaling: [ Scaling on the variables (vector of scaling values for each variable) {[]} ] \n'); +fprintf(' seed: [ Random Seed: {[]} ] \n'); +fprintf(' sgte_cost: [ The cost of c surrogate evaluations is equivalent to one blackbox evaluation: {[]} ] \n'); +fprintf(' sgte_eval_sort: [ If surrogates are used to sort list of trial points: Off (0), On {1} ] \n'); +fprintf(' snap_to_bounds: [ Snap to boundary trial points that are generated outside of bounds: No (0), Yes {1} ] \n'); +fprintf(' speculative_search: [ MADS speculative search: No (0), Yes {1} ] \n'); +fprintf(' stat_sum_target: [ Terminates if stat_sum reaches this value {[]} ] \n'); +fprintf(' stop_if_feasible: [ Stop on first feasible solution: Off {0}, On (1) ] \n'); +fprintf(' vns_search: [ Variable Neighbourhood Search (Multiple Minima Problems): Off {0.0}, Max Searches (1.0) ] \n'); + + +fprintf('\nDEVELOPER PARAMETERS:\n'); +fprintf(' epsilon: [ Precision on real numbers {1e-13} ]\n'); +fprintf(' model_eval_sort_cautious: [ If the model ordering strategy is cautious: No {0}, Yes (1) ] \n'); +fprintf(' model_search_max_trial_pts: [ Maximum trial points for one model search {4} ] \n'); +fprintf(' model_search_proj_to_mesh: [ If model search trial points are projected to mesh: No (0), Yes {1} ] \n'); +fprintf(' model_quad_max_y_size: [ Upper limit on the size of interpolation sets for quadratic models {500} ] \n'); +fprintf(' model_quad_min_y_size: [ Inf limit on the size of interpolation sets for quadratic models {[]} ] \n'); +fprintf(' model_quad_radius_factor: [ Quadratic Model search radius factor {2.0} ] \n'); +fprintf(' model_quad_use_wp: [ Enable strategy to maintain well-poised quadratic models: Off {0}, On (1) ] \n'); +fprintf(' multi_formulation: [ Single objective reformulation: ''normalized'', {''product''}, ''dist_l1'', ''dist_l2'', ''dist_linf'' ] \n'); +fprintf(' multi_use_delta_crit: [ Use stopping criterion based on the delta criterion: Off {0}, On (1) ] \n'); +fprintf(' opportunistic_lucky_eval: [ Perform an additional BB eval after an improvement: Off {0}, On (1) ] \n'); +fprintf(' opportunistic_min_f_imprvmt: [ Terminate only if f is reduced by r%% {[]} ] \n'); +fprintf('opportunistic_min_nb_success: [ Do not terminate before i successes {[]} ] \n'); +fprintf(' opt_only_sgte: [ Minimize only with surrogates: No {0}, Yes (1) ]\n'); +fprintf(' sec_poll_dir_type: [ Type of directions for the secondary poll (see below) {[]} ] \n'); + +fprintf('\nOUTPUT PARAMETERS:\n'); +fprintf(' add_seed_to_file_names: [ If the seed is added to the output file names: Off (0), On {1} ]\n'); +fprintf(' cache_file: [ Cache file: Off {[]}, On ''filename'' ]\n'); +fprintf(' cache_save_period: [ Cache files are saved every i iterations: {25} ]\n'); +fprintf(' display_degree: [ Display level: None {0}, Increasing (>0) ] \n'); +fprintf(' display_all_eval: [ Display all Points: Off {0}, On (1) ] \n'); +fprintf(' history_file: [ File containing all trial points: Off {[]}, On ''filename'' ]\n'); +fprintf(' solution_file: [ File to save the current best feasible point: Off {[]}, On ''filename'' ]\n'); +fprintf(' stats_file: [ File for screen dump: Off {[]}, On ''filename'' ]\n'); +fprintf(' sgte_cache_file: [ Surrogate cache file: Off {[]}, On ''filename'' ]\n'); + +fprintf('\nMEX INTERFACE PARAMETERS:\n'); +fprintf(' param_file: [ Read NOMAD options from a parameters file (overwrites these options): Off {[]}, On ''filename'' ]\n'); +fprintf(' iterfun: [ Callback function run every function evaluation: Off {[]}, On function_handle ]\n'); + + +fprintf('\n\nValid Direction Types (string):\n'); +for i = 1:length(dirtypes) + fprintf('''%s''\n',dirtypes{i}); +end +fprintf('\nValid BB_OUTPUT_TYPE types (cell array of strings):\n'); +fprintf('OBJ: Objective\n'); +fprintf(' PB: Progressive Barrier (default constraint type)\n'); +fprintf(' EB: Extreme Barrier\n'); +fprintf('PEB: Hybrid Constraint (PB/EB)\n'); +fprintf(' F: Filter\n'); + + + + diff --git a/examples/interfaces/Matlab_MEX/GERAD_NOMAD_build.m b/examples/interfaces/Matlab_MEX/GERAD_NOMAD_build.m index f827e8e624b565c3822654631b60ac0eb4f67bf6..2f30425ede0833659164f41fd043f375d51fa1f4 100644 --- a/examples/interfaces/Matlab_MEX/GERAD_NOMAD_build.m +++ b/examples/interfaces/Matlab_MEX/GERAD_NOMAD_build.m @@ -1,167 +1,175 @@ -%% GERAD NOMAD Build for Matlab - -% This file will help you compile NOMAD for use with MATLAB. - -% To recompile you will need to get / do the following: - -% 1) Get NOMAD -% NOMAD is available from https://www.gerad.ca/nomad -% Complete the download form then download the latest version. Define the -% $NOMAD_HOME environment variable. - -% 2) Start Matlab and go into $NOMAD_HOME/examples/interfaces/Matlab_Mex -% The NOMAD MEX Interface is a simple MEX interface written to use NOMAD. - -% 3) Compile the MEX File by executing this file in Matlab -% -% -% The code below will build the NOMAD MEX file and set the Matlab path. - -clear nomad - -% Current directory -cdir = cd; - -% Check and set nomad_home and create variables for path -clear nomad_home nomad_src; - -% Default values -nameLibNomad = ''; -updateLDFLAGS= ''; -install_name_tool=''; - -if ( strcmp(computer,'PCWIN64') == 1 || strcmp(computer,'PCWIN32') == 1 ) - - nomad_home = getenv('NOMAD_EXAMPLES'); - - if ( length(nomad_home) > 1) - nomad_home = [ nomad_home '\VisualStudio' ]; - warning('The nomad_home variable for Matlab is set to %s (that is NOMAD_EXAMPLES\\VisualStudio).The default can be replaced by using the command setenv(''NOMAD_EXAMPLES'',ARG1)! before running the GERAD_NOMAD_build command.',nomad_home); - if ( ~isempty( find(isspace(nomad_home),1) ) ) - error('The compilation of Nomad for Matlab must be performed in the NOMAD_EXAMPLES directory. The NOMAD_EXAMPLES directory should not contain empty space. Please consider moving the NOMAD_EXAMPLES directory and reset the NOMAD_EXAMPLES environment variable accordingly.'); - end - - else - cd .. - cd .. - cd .. - cd 'VisualStudio'; - nomad_home = cd; - - if ( ~ exist(nomad_home,'dir') ) - error('The default NOMAD_EXAMPLES\VisualStudio directory does not exist. Please make sure that a VisualStudio directory exists.'); - end - - cd(cdir); - end - - nomad_src=[nomad_home filesep 'src' filesep]; - nomad_bin=[nomad_home filesep 'bin' filesep]; - nomad_lib=''; - - %Compile & Move (Windows) ---> recompile Nomad - post = [' -I. -I' nomad_src ' -lut -output ' nomad_bin filesep 'nomad.' mexext]; - pre = ['mex -v -largeArrayDims nomadmex.cpp ' nomad_src 'Parameters.cpp ' nomad_src 'Barrier.cpp ' nomad_src 'Cache.cpp '... - nomad_src 'Cache_File_Point.cpp ' nomad_src 'Cache_Point.cpp ' nomad_src 'Cache_Search.cpp ' nomad_src 'Clock.cpp '... - nomad_src 'Direction.cpp ' nomad_src 'Directions.cpp ' nomad_src 'Display.cpp '... - nomad_src 'Double.cpp ' nomad_src 'Eval_Point.cpp ' nomad_src 'Evaluator.cpp ' nomad_src 'Evaluator_Control.cpp ' nomad_src 'Exception.cpp '... - nomad_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 '... - nomad_src 'Model_Stats.cpp ' nomad_src 'Multi_Obj_Evaluator.cpp ' nomad_src 'Parameter_Entries.cpp '... - nomad_src 'Parameter_Entry.cpp ' nomad_src 'Pareto_Front.cpp ' nomad_src 'Pareto_Point.cpp ' nomad_src 'Phase_One_Evaluator.cpp '... - nomad_src 'Phase_One_Search.cpp ' nomad_src 'Point.cpp ' nomad_src 'Priority_Eval_Point.cpp ' nomad_src 'Quad_Model.cpp '... - nomad_src 'Quad_Model_Evaluator.cpp ' nomad_src 'Quad_Model_Search.cpp ' nomad_src 'Random_Pickup.cpp ' nomad_src 'RNG.cpp '... - nomad_src 'Signature.cpp ' nomad_src 'Slave.cpp ' nomad_src 'SMesh.cpp ' nomad_src 'Speculative_Search.cpp ' nomad_src 'Stats.cpp ' nomad_src 'utils.cpp '... - nomad_src 'Variable_Group.cpp ' nomad_src 'VNS_Search.cpp ' nomad_src 'XMesh.cpp']; - - -else - %%%%%%%%%%%%%%%%%%%%%%% - % LINUX AND OSX - %%%%%%%%%%%%%%%%%%%%%%% - - % Default library names - nameLibNomad = 'libnomad.so'; - - % Default update LDFLAGS (linux only) - updateLDFLAGS= ''; - % Post compilation tool for path to library (osx only) - install_name_tool=''; - - nomad_home = getenv('NOMAD_HOME'); - - if ( length(nomad_home) < 1 ) - % Get a default directory for NOMAD_HOME - cd .. - cd .. - cd .. - nomad_home = cd; - if ( ~ exist(nomad_home,'dir') ) - error('The default NOMAD_HOME directory does not exist. Please provide a correct value for the NOMAD_HOME variables with the command setenv(''NOMAD_HOME'',ARG1)'); - end - warning('The NOMAD_HOME variable for Matlab is set with its default value %s. The default can be replaced by using the command setenv(''NOMAD_HOME'',ARG1)! before running the GERAD_NOMAD_build command.',nomad_home); - cd(cdir); - else - if ( ~isempty( find(isspace(nomad_home),1) ) ) - error('The compilation of Nomad for Matlab uses the sources located in the NOMAD_HOME directory. The NOMAD_HOME directory should not contain empty space. Please consider moving the NOMAD_HOME directory and reset the NOMAD_HOME environment variable accordingly.'); - end - end - - nomad_src=[nomad_home filesep 'src' filesep]; - nomad_lib=[nomad_home filesep 'lib' filesep]; - nomad_bin=[nomad_home filesep 'bin' filesep]; - - switch(computer) - case 'GLNX86' - updateLDFLAGS = 'LDFLAGS=''$LDFLAGS -Wl,-rpath,''''$ORIGIN/../lib/'''' '' '; - case 'GLNXA64' - updateLDFLAGS = 'LDFLAGS=''$LDFLAGS -Wl,-rpath,''''$ORIGIN/../lib/'''' '' '; - case 'MACI64' - install_name_tool=['install_name_tool -change ' nameLibNomad ' @loader_path/../lib/' nameLibNomad ' ' nomad_bin filesep 'nomad.' mexext]; - end - - %Compile & Move (Default) --> use shared object library - post = [' -I. -I' nomad_src ' -lut -lnomad -L' nomad_lib ' -output ' nomad_bin filesep 'nomad.' mexext ]; - pre =[ 'mex -v -largeArrayDims nomadmex.cpp ' updateLDFLAGS ]; - - if ( ~ exist([nomad_lib filesep nameLibNomad],'file') ) - error('The Nomad library file %s is not available. Please perform Nomad project compilation before proceeding.',nameLibNomad); - end - -end - - -fprintf('\n------------------------------------------------\n'); -fprintf('NOMAD MEX FILE BUILD --- GERAD VERSION \n\n'); - -%CD to Source Directory -cd 'Source'; - -try - - if ( ~ exist([nomad_lib filesep nameLibNomad],'file') ) - error('The Nomad library file %s is not available. Please perform Nomad project compilation before proceeding.',nameLibNomad); - end - - eval([pre post]) - - if ( strcmp(computer,'MACI64') == 1 ) - system(install_name_tool); - end - - cd(cdir); - fprintf('Compilation done!\n'); - fprintf('\n----------------------------------------------------------------------------------------------\n'); - fprintf(' To be able to use the nomad functions, you may need to modify the Matlab path \n'); - qstring = 'To be able to use the nomad functions, you may need to modify the Matlab path. Do you want to update the Matlab path?'; - choice = questdlg(qstring,'Set path','Yes','No','Yes'); - if ( strcmp(choice,'Yes') ) - addpath([ cdir filesep 'Functions']); - addpath(nomad_bin); - fprintf(' ---> The Matlab path has been modified but not saved.\n'); - end - clear nomad_home nomad_lib nomad_bin nomad_src cdir post pre updateLDFLAGS qstring choice install_name_tool nameLibNomad; -catch ME - cd(cdir); - clear nomad_home nomad_lib noamd_bin nomad_src cdir post pre updateLDFLAGS qstring choice install_name_tool nameLibNomad; - error('Error Compiling NOMAD!\n%s',ME.message); -end +%% GERAD NOMAD Build for Matlab + +% This file will help you compile NOMAD for use with MATLAB. + +% To recompile you will need to get / do the following: + +% 1) Get NOMAD +% NOMAD is available from https://www.gerad.ca/nomad +% Complete the download form then download the latest version. Define the +% $NOMAD_HOME environment variable. + +% 2) Start Matlab and go into $NOMAD_HOME/examples/interfaces/Matlab_Mex +% The NOMAD MEX Interface is a simple MEX interface written to use NOMAD. + +% 3) Compile the MEX File by executing this file in Matlab +% +% +% The code below will build the NOMAD MEX file and set the Matlab path. + +clear nomad + +% Current directory +cdir = cd; + +% Check and set nomad_home and create variables for path +clear nomad_home nomad_src nomad_src_sgtelib; + +% Default values +nameLibNomad = ''; +updateLDFLAGS= ''; +install_name_tool=''; + +if ( strcmp(computer,'PCWIN64') == 1 || strcmp(computer,'PCWIN32') == 1 ) + + nomad_home = getenv('NOMAD_EXAMPLES'); + + if ( length(nomad_home) > 1) + nomad_home = [ nomad_home '\VisualStudio' ]; + warning('The nomad_home variable for Matlab is set to %s (that is NOMAD_EXAMPLES\\VisualStudio).The default can be replaced by using the command setenv(''NOMAD_EXAMPLES'',ARG1)! before running the GERAD_NOMAD_build command.',nomad_home); + if ( ~isempty( find(isspace(nomad_home),1) ) ) + error('The compilation of Nomad for Matlab must be performed in the NOMAD_EXAMPLES directory. The NOMAD_EXAMPLES directory should not contain empty space. Please consider moving the NOMAD_EXAMPLES directory and reset the NOMAD_EXAMPLES environment variable accordingly.'); + end + + else + cd .. + cd .. + cd .. + cd 'VisualStudio'; + nomad_home = cd; + + if ( ~ exist(nomad_home,'dir') ) + error('The default NOMAD_EXAMPLES\VisualStudio directory does not exist. Please make sure that a VisualStudio directory exists.'); + end + + cd(cdir); + end + + nomad_src=[nomad_home filesep 'src' filesep]; + nomad_src_sgtelib=[nomad_home filesep 'src_sgtelib' filesep]; + nomad_bin=[nomad_home filesep 'bin' filesep]; + nomad_lib=''; + + %Compile & Move (Windows) ---> recompile Nomad and sgtelib + post = [' -I. -I' nomad_src ' -I' nomad_src_sgtelib ' -lut -output ' nomad_bin filesep 'nomad.' mexext]; + pre = ['mex -v -largeArrayDims nomadmex.cpp ' nomad_src 'Parameters.cpp ' nomad_src 'Barrier.cpp ' nomad_src 'Cache.cpp '... + nomad_src 'Cache_File_Point.cpp ' nomad_src 'Cache_Point.cpp ' nomad_src 'Cache_Search.cpp ' nomad_src 'Clock.cpp '... + nomad_src 'Direction.cpp ' nomad_src 'Directions.cpp ' nomad_src 'Display.cpp '... + nomad_src 'Double.cpp ' nomad_src 'Eval_Point.cpp ' nomad_src 'Evaluator.cpp ' nomad_src 'Evaluator_Control.cpp ' nomad_src 'Exception.cpp '... + nomad_src 'Extended_Poll.cpp ' nomad_src 'GMesh.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 '... + nomad_src 'Model_Stats.cpp ' nomad_src 'Multi_Obj_Evaluator.cpp ' nomad_src 'Parameter_Entries.cpp '... + nomad_src 'Parameter_Entry.cpp ' nomad_src 'Pareto_Front.cpp ' nomad_src 'Pareto_Point.cpp ' nomad_src 'Phase_One_Evaluator.cpp '... + nomad_src 'Phase_One_Search.cpp ' nomad_src 'Point.cpp ' nomad_src 'Priority_Eval_Point.cpp ' nomad_src 'Quad_Model.cpp '... + nomad_src 'Sgtelib_Model_Evaluator.cpp ' nomad_src 'Sgtelib_Model_Search.cpp ' nomad_src 'Sgtelib_Model_Manager.cpp ' ... + nomad_src 'Quad_Model_Evaluator.cpp ' nomad_src 'Quad_Model_Search.cpp ' nomad_src 'Random_Pickup.cpp ' nomad_src 'RNG.cpp '... + nomad_src 'Signature.cpp ' nomad_src 'Slave.cpp ' nomad_src 'SMesh.cpp ' nomad_src 'Speculative_Search.cpp ' nomad_src 'Stats.cpp ' nomad_src 'utils.cpp '... + nomad_src 'Variable_Group.cpp ' nomad_src 'VNS_Search.cpp ' nomad_src 'XMesh.cpp ' ... + nomad_src_sgtelib 'Kernel.cpp ' nomad_src_sgtelib 'Surrogate_Ensemble.cpp ' nomad_src_sgtelib 'Surrogate_LOWESS.cpp '... + nomad_src_sgtelib 'Surrogate_Parameters.cpp ' nomad_src_sgtelib 'TrainingSet.cpp ' nomad_src_sgtelib 'Matrix.cpp '... + nomad_src_sgtelib 'Surrogate_Factory.cpp ' nomad_src_sgtelib 'Surrogate_PRS.cpp ' nomad_src_sgtelib 'Surrogate_RBF.cpp '... + nomad_src_sgtelib 'sgtelib.cpp ' nomad_src_sgtelib 'Surrogate.cpp ' nomad_src_sgtelib 'Surrogate_KS.cpp ' nomad_src_sgtelib 'Surrogate_PRS_CAT.cpp '... + nomad_src_sgtelib 'Surrogate_Utils.cpp ' nomad_src_sgtelib 'sgtelib_help.cpp ' nomad_src_sgtelib 'Surrogate_CN.cpp ' ... + nomad_src_sgtelib 'Surrogate_Kriging.cpp ' nomad_src_sgtelib 'Surrogate_PRS_EDGE.cpp ' nomad_src_sgtelib 'Tests.cpp ' ]; + +else + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + % LINUX AND OSX ---> use dynamic libraries + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + % Default library names + nameLibNomad = 'libnomad.so'; + + % Default update LDFLAGS (linux only) + updateLDFLAGS= ''; + % Post compilation tool for path to library (osx only) + install_name_tool=''; + + nomad_home = getenv('NOMAD_HOME'); + + if ( length(nomad_home) < 1 ) + % Get a default directory for NOMAD_HOME + cd .. + cd .. + cd .. + nomad_home = cd; + if ( ~ exist(nomad_home,'dir') ) + error('The default NOMAD_HOME directory does not exist. Please provide a correct value for the NOMAD_HOME variables with the command setenv(''NOMAD_HOME'',ARG1)'); + end + warning('The NOMAD_HOME variable for Matlab is set with its default value %s. The default can be replaced by using the command setenv(''NOMAD_HOME'',ARG1)! before running the GERAD_NOMAD_build command.',nomad_home); + cd(cdir); + else + if ( ~isempty( find(isspace(nomad_home),1) ) ) + error('The compilation of Nomad for Matlab uses the sources located in the NOMAD_HOME directory. The NOMAD_HOME directory should not contain empty space. Please consider moving the NOMAD_HOME directory and reset the NOMAD_HOME environment variable accordingly.'); + end + end + + nomad_src=[nomad_home filesep 'src' filesep]; + sgtelib_src=[nomad_home filesep 'ext' filesep 'sgtelib' filesep 'src']; + nomad_lib=[nomad_home filesep 'lib' filesep]; + nomad_bin=[nomad_home filesep 'bin' filesep]; + + switch(computer) + case 'GLNX86' + updateLDFLAGS = 'LDFLAGS=''$LDFLAGS -Wl,-rpath,''''$ORIGIN/../lib/'''' -Wl,-rpath-link,''''../lib/'''' '' '; + case 'GLNXA64' + updateLDFLAGS = 'LDFLAGS=''$LDFLAGS -Wl,-rpath,''''$ORIGIN/../lib/'''' -Wl,-rpath-link,''''../lib/'''' '' '; + case 'MACI64' + install_name_tool=['install_name_tool -change ' nameLibNomad ' @loader_path/../lib/' nameLibNomad ' ' nomad_bin filesep 'nomad.' mexext]; + end + + %Compile & Move (Default) --> use shared object library + post = [' -I. -I' nomad_src ' -I' sgtelib_src ' -lut -lnomad -L' nomad_lib ' -output ' nomad_bin filesep 'nomad.' mexext ]; + pre =[ 'mex -v -largeArrayDims nomadmex.cpp ' updateLDFLAGS ]; + + if ( ~ exist([nomad_lib filesep nameLibNomad],'file') ) + error('The Nomad library file %s is not available. Please perform Nomad project compilation before proceeding.',nameLibNomad); + end + +end + + +fprintf('\n------------------------------------------------\n'); +fprintf('NOMAD MEX FILE BUILD --- GERAD VERSION \n\n'); + +%CD to Source Directory +cd 'Source'; + +try + + if ( ~ exist([nomad_lib filesep nameLibNomad],'file') ) + error('The Nomad library file %s is not available. Please perform Nomad project compilation before proceeding.',nameLibNomad); + end + + eval([pre post]) + + if ( strcmp(computer,'MACI64') == 1 ) + system(install_name_tool); + end + + cd(cdir); + fprintf('Compilation done!\n'); + fprintf('\n----------------------------------------------------------------------------------------------\n'); + fprintf(' To be able to use the nomad functions, you may need to modify the Matlab path \n'); + qstring = 'To be able to use the nomad functions, you may need to modify the Matlab path. Do you want to update the Matlab path?'; + choice = questdlg(qstring,'Set path','Yes','No','Yes'); + if ( strcmp(choice,'Yes') ) + addpath([ cdir filesep 'Functions']); + addpath(nomad_bin); + fprintf(' ---> The Matlab path has been modified but not saved.\n'); + end + clear nomad_home nomad_lib nomad_bin nomad_src cdir post pre updateLDFLAGS qstring choice install_name_tool nameLibNomad; +catch ME + cd(cdir); + clear nomad_home nomad_lib nomad_bin nomad_src cdir post pre updateLDFLAGS qstring choice install_name_tool nameLibNomad; + error('Error Compiling NOMAD!\n%s',ME.message); +end diff --git a/examples/interfaces/Matlab_MEX/Source/nomadmex.cpp b/examples/interfaces/Matlab_MEX/Source/nomadmex.cpp index e96f29e494f12c03130954a5a5227c2ca2d32b05..cfeeafaa18f0e2601b888a7c2ab85a28c75d3a5b 100755 --- a/examples/interfaces/Matlab_MEX/Source/nomadmex.cpp +++ b/examples/interfaces/Matlab_MEX/Source/nomadmex.cpp @@ -1,1754 +1,1762 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* MEX Interface Author: Jonathan Currie 2012 (I2C2) + modifs C. Tribes */ -/* */ -/* MEX Interface Contact information: */ -/* jocurrie@aut.ac.nz */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ - -#define NOMADMEX_VERSION "1.25_ct [Sept 3rd, 2015]" -//NOTE from Version 1.15 on this MEX file contains a dual interface: - -// 1) The default (GERAD) interface is: -// [x,fval,exitflag,iter] = nomad(fun,x0,lb,ub,opts) - -// 2) Otherwise if OPTI_VERSION is defined it will compile the OPTI Toolbox interface: -// [x,fval,exitflag,iter] = nomad(fun,x0,lb,ub,nlcon,nlrhs,xtype,opts) - -// Both contain near identical functionality, except the GERAD version includes nonlinear -// constraints with the objective (blackbox) function. The OPTI version separates them, -// and allows a user specified rhs. The OPTI version also rounds x0 for integer constraints. - -#include "mex.h" -#include "nomad.hpp" -#include "defines.hpp" -#include <stdio.h> -#include <string.h> - -using namespace std; - - -//Function handle structure -#define FLEN 128 /* max length of user function name */ -#define MAXRHS 4 /* max nrhs for user function */ -typedef struct { - char f[FLEN]; - mxArray *plhs[1]; - mxArray *prhs[MAXRHS]; - int xrhs, nrhs; - double *nlrhs; -} usrFcn; - -typedef struct { - char f[FLEN]; - mxArray *plhs[1]; - mxArray *prhs[2]; - bool enabled; -} neighborsFcn; - - -//Iteration callback structure -typedef struct { - char f[FLEN]; - mxArray *plhs[1]; - mxArray *prhs[4]; - bool enabled; -} iter_fun_data; - -//Ctrl-C Detection -#ifdef __cplusplus -extern "C" bool utIsInterruptPending(); -extern "C" void utSetInterruptPending(bool); -#else -extern bool utIsInterruptPending(); -extern void utSetInterruptPending(bool); -#endif - -//Argument Enums (in expected order of arguments) -#ifdef OPTI_VERSION -enum {eFUN, eX0, eLB, eUB, eNLCON, eNLRHS, eXTYPE, eOPTS, ePARAM}; -#else //GERAD VERSION -enum {eFUN, eX0, eLB, eUB, eOPTS, ePARAM}; -enum {eNLCON, eNLRHS, eXTYPE}; //placeholders -#endif -//PRHS Defines -#define pFUN prhs[eFUN] -#define pX0 prhs[eX0] -#define pLB prhs[eLB] -#define pUB prhs[eUB] -#define pNLCON prhs[eNLCON] -#define pNLRHS prhs[eNLRHS] -#define pXTYPE prhs[eXTYPE] -#define pOPTS prhs[eOPTS] -#define pParam prhs[ePARAM] - -//Function Prototypes -void printSolverInfo(); -int checkInputs(const mxArray *prhs[], int nrhs, mxArray *plhs[], int nlhs); -vector<NOMAD::bb_input_type> detInTypes(char *xtype, size_t n); -vector<NOMAD::bb_output_type> detRetTypes(usrFcn *fun, mxArray *out_types, int *nobj, usrFcn *con, int *ncon, double *x0, size_t n); -void setNOMADopts(NOMAD::Parameters &p, const mxArray *opts); -bool isNMDOption(const char *field); -NOMAD::bb_output_type getOutEnum(char *str); -void lower(char *str); -double getStatus(int stat); - - -// Matlab Extended_Poll Class -/*--------------------------------------------------*/ -/* Class to define categorical neighborhoods */ -/*--------------------------------------------------*/ -class Matlab_Extended_Poll : public NOMAD::Extended_Poll -{ - -private: - - // signatures for 1 asset: - NOMAD::Signature * _s1; - - neighborsFcn * _neighbors; - - -public: - - Matlab_Extended_Poll ( NOMAD::Parameters & p , neighborsFcn * neighbors ); - - virtual ~Matlab_Extended_Poll ( void ){} - - // construct the extended poll points: - virtual void construct_extended_points ( const NOMAD::Eval_Point & ); - -}; - -/*-----------------------------------------*/ -/* constructor: creates the 3 signatures */ -/*-----------------------------------------*/ -Matlab_Extended_Poll::Matlab_Extended_Poll ( NOMAD::Parameters & p , neighborsFcn * neighbors) -: Extended_Poll ( p ) , -_s1 ( NULL ), -_neighbors ( neighbors ) -{ - _s1 = p.get_signature(); - -} - -/*--------------------------------------*/ -/* construct the extended poll points */ -/* (categorical neighborhoods) */ -/*--------------------------------------*/ -void Matlab_Extended_Poll::construct_extended_points ( const NOMAD::Eval_Point & x ) -{ - double *xm; - char errstr[1024]; - - if ( !x.is_complete() ) - { - mexWarnMsgTxt("construct_extended_points: bad extended poll center\n%sExiting NOMAD...\n\n"); - //Force exit - raise(SIGINT); - } - - - xm = mxGetPr( _neighbors->prhs[1] ); - int n=_s1->get_n(); - - for(int i=0;i<n;i++) - xm[i] = x[i].value(); - - //Call MATLAB neighbors - try - { - mexCallMATLAB(1, _neighbors->plhs, 2, _neighbors->prhs, _neighbors->f); - } - //Note if these errors occur it is due to errors in MATLAB code, no way to recover? - catch(exception &e) - { - sprintf(errstr,"Unrecoverable Error from neighbors callback:\n%sExiting NOMAD...\n\n",e.what()); - mexWarnMsgTxt(errstr); - //Force exit - raise(SIGINT); - } - catch(...) - { - mexWarnMsgTxt("Unrecoverable Error from neighbors callback, Exiting NOMAD...\n\n"); - //Force exit - raise(SIGINT); - } - - - int nbNPoints=static_cast<int>(mxGetNumberOfElements(_neighbors->plhs[0])/n); - double *xr=mxGetPr(_neighbors->plhs[0]); - - for(int i=0;i<nbNPoints;i++) - { - NOMAD::Point nPoint(n); - - for(int j=0;j<n;j++) - nPoint[j]=xr[i+j*nbNPoints]; - - add_extended_poll_point(nPoint , *_s1 ); - } - -} - - -//MATLAB Evaluator Class -class matlabEval : public NOMAD::Evaluator -{ -private: - usrFcn *fun; - bool hasSur; - // bool hasAdditionalParam; - int nobj; - usrFcn *con; - int ncon; - iter_fun_data *iterF; - int citer; - -public: - //Constructor - matlabEval(const NOMAD::Parameters &p, usrFcn *_obj, int _nobj, usrFcn *_con, int _ncon, iter_fun_data *_iterF) : NOMAD::Evaluator(p) - { - fun = _obj; - hasSur = p.has_sgte(); - nobj = _nobj; - con = _con; - ncon = _ncon; - iterF = _iterF; - citer = 0; - -#ifdef OPTI_VERSION - if(hasSur) - mexWarnMsgTxt("Optimization using surrogates is not available in OPTI version of NOMAD\n"); -#endif - } - //Destructor - ~matlabEval(void) {} - - - bool eval_x(std::list<NOMAD::Eval_Point *> &x, const NOMAD::Double &h_max, std::list<bool> & list_count_eval ) - { - -#ifdef OPTI_VERSION - mexPrintf("Optimization using block of points evaluation is not available in OPTI version of NOMAD\n"); - //Force exit - raise(SIGINT); - return false; -#endif - - - char errstr[1024]; - bool stop = false; - int i, j, m, n; - double *fvals; - mxLogical *sur; - - m=static_cast<int>(x.size()); - n=(*(x.begin()))->size(); - - if ( m !=list_count_eval.size()) - { - mexPrintf("NomadMex Evaluator: inconsistent size of list" ); - //Force exit - raise(SIGINT); - return false; - } - - - //Check for Ctrl-C - if ( utIsInterruptPending() ) - { - utSetInterruptPending(false); /* clear Ctrl-C status */ - mexPrintf("\nCtrl-C Detected. Exiting NOMAD...\n\n"); - list_count_eval.assign(m,false); - raise(SIGINT); - return false; - } - - - fun->prhs[fun->xrhs] = mxCreateDoubleMatrix(m, n, mxREAL); //x - double *List_x = mxGetPr(fun->prhs[fun->xrhs]); - std::list<NOMAD::Eval_Point *>::iterator it_x=x.begin(); - j=0; - for (it_x=x.begin();it_x!=x.end();++it_x,++j) - for(i=0;i<n;i++) - List_x[i*m+j] = (*(*it_x))[i].value(); - - - //Add Surrogate if present and requested - if( hasSur ) - { - sur=mxGetLogicals(fun->prhs[fun->xrhs+1]); - ( x.front()->get_eval_type()==NOMAD::SGTE )? *sur=true:*sur=false; // all evaluations in a list have the same eval_type - } - - - // Count eval for bbox - // The case where the evaluation is rejected by user (and should not be counted) is not managed in the matlab version - list_count_eval.assign(m,true); - - - //Call MATLAB Objective - try - { - mexCallMATLAB(1, fun->plhs, fun->nrhs, fun->prhs, fun->f); - } - - //Note if these errors occur it is due to errors in MATLAB code, no way to recover? - catch(exception &e) - { - sprintf(errstr,"Unrecoverable Error from Objective / Blackbox Callback:\n%sExiting NOMAD...\n\n",e.what()); - mexPrintf(errstr); - //Force exit - raise(SIGINT); - return false; - } - catch(...) - { - mexPrintf("Unrecoverable Error from Objective / Blackbox Callback, Exiting NOMAD...\n\n"); - //Force exit - raise(SIGINT); - return false; - } - - //Check we got the correct number of elements back - if(mxGetNumberOfElements(fun->plhs[0]) > (nobj+ncon)*m) - mexPrintf("Black box returns more elements than required. Please provide a BB_OUTPUT_TYPE consistent with your black box function or correct the black box function."); - else if(mxGetNumberOfElements(fun->plhs[0]) < (nobj+ncon)*m) - { - mexPrintf("Insufficient outputs provided by the black box function. Exiting NOMAD...\n\n"); - raise(SIGINT); - return false; - } - else if(mxGetM(fun->plhs[0]) != m ) - { - mexPrintf("Insufficient number of rows in the output of the black box function. The number of rows should be equal to the size of the block of evaluations. Exiting NOMAD...\n\n"); - raise(SIGINT); - return false; - } - else if(mxGetN(fun->plhs[0]) != (nobj+ncon) ) - { - mexPrintf("Insufficient number of columns in the output of the black box function. The number of columns should be the number of objectives plus the number of constraints. Exiting NOMAD...\n\n"); - raise(SIGINT); - return false; - } - - - - //Assign bb output - fvals = mxGetPr(fun->plhs[0]); - j=0; - for (it_x=x.begin();it_x!=x.end();++it_x,++j) - for(i=0;i<(nobj+ncon);i++) - (*it_x)->set_bb_output(i,fvals[m*i+j]); - - //Iteration Callback - if(iterF->enabled) - { - iterF->plhs[0] = NULL; - memcpy(mxGetData(iterF->prhs[1]), &citer, sizeof(int)); - memcpy(mxGetPr(iterF->prhs[2]), fvals, m*(nobj+ncon)*sizeof(double)); - memcpy(mxGetPr(iterF->prhs[3]), List_x, n * m * sizeof(double)); - try { - mexCallMATLAB(1, iterF->plhs, 4, iterF->prhs, iterF->f); - } - catch (...) - { - mexPrintf("Unrecoverable Error from Iteration Callback, Exiting NOMAD...\n\n"); - //Force exit - raise(SIGINT); - return false; - } - - //Collect return argument - stop = *(bool*)mxGetData(iterF->plhs[0]); - //Clean up Ptr - mxDestroyArray(iterF->plhs[0]); - - } - - //Add Function Eval Counter - citer++; - - // Clean up LHS Fun Ptr - mxDestroyArray(fun->plhs[0]); - - //Check for iterfun stop - if(stop) - { - mexPrintf("\nIterFun Called Stop. Exiting NOMAD...\n\n"); - raise(SIGINT); - return false; - } - else - return true; - } - - - - //Function + Constraint Evaluation - bool eval_x(NOMAD::Eval_Point &x, const NOMAD::Double &h_max, bool &count_eval) - { - char errstr[1024]; - bool stop = false; - int i, n = static_cast<int>(x.size()); - double *xm, *fvals; - mxLogical *sur; - count_eval = true; //mexErrMsgTxt will kill MEX - - //Check for Ctrl-C - if ( utIsInterruptPending() ) - { - utSetInterruptPending(false); /* clear Ctrl-C status */ - mexPrintf("\nCtrl-C Detected. Exiting NOMAD...\n\n"); - count_eval = false; - raise(SIGINT); - return false; - } - - //Blackbox / Objective Evaluation - xm = mxGetPr(fun->prhs[fun->xrhs]); - for(i=0;i<n;i++) - xm[i] = x[i].value(); - - //Add Surrogate if present and requested - if( hasSur ) - { - sur=mxGetLogicals(fun->prhs[fun->xrhs+1]); - (x.get_eval_type()==NOMAD::SGTE)? *sur=true:*sur=false; - } - - //Call MATLAB Objective - try - { - mexCallMATLAB(1, fun->plhs, fun->nrhs, fun->prhs, fun->f); - } - //Note if these errors occur it is due to errors in MATLAB code, no way to recover? - catch(exception &e) - { - sprintf(errstr,"Unrecoverable Error from Objective / Blackbox Callback:\n%sExiting NOMAD...\n\n",e.what()); - mexWarnMsgTxt(errstr); - //Force exit - raise(SIGINT); - return false; - } - catch(...) - { - mexPrintf("Unrecoverable Error from Objective / Blackbox Callback, Exiting NOMAD...\n\n"); - //Force exit - raise(SIGINT); - return false; - } - -#ifdef OPTI_VERSION - //Check we got the correct number back - if( mxGetM(fun->plhs[0]) != nobj ) - mexErrMsgTxt("Incorrect number of elements returned from the objective function"); - - //Set Objective (Or multi-objective) - fvals = mxGetPr(fun->plhs[0]); - for( i=0 ; i<nobj ; i++ ) - x.set_bb_output( i,fvals[i] ); - - //Constraint Evaluation - if( ncon ) - { - con->plhs[0] = NULL; - xm = mxGetPr(con->prhs[con->xrhs]); - for(i=0;i<n;i++) - xm[i] = x[i].value(); - //Call MATLAB Constraint - try - { - mexCallMATLAB(1, con->plhs, con->nrhs, con->prhs, con->f); - } - catch(...) - { - mexWarnMsgTxt("Unrecoverable Error from Constraint Callback, Exiting NOMAD...\n\n"); - //Force exit - raise(SIGINT); - return false; - } - //Check we got the correct number back - if(mxGetM(con->plhs[0]) != ncon) - mexErrMsgTxt("Incorrect number of elements returned from nonlinear constraint function"); - - //Set Constraints - double *cons = mxGetPr(con->plhs[0]); - for(i=0,j=nobj;i<ncon;i++,j++) - x.set_bb_output(j,cons[i] - con->nlrhs[i]); //subtract nlrhs - - // Clean up LHS Ptr - mxDestroyArray(con->plhs[0]); - } -#else //GERAD VERSION - //Check we got the correct number of elements back - if( mxGetNumberOfElements(fun->plhs[0]) > nobj+ncon ) - mexWarnMsgTxt("Black box returns more elements than required. Please provide a BB_OUTPUT_TYPE consistent with your black box function"); - else if( mxGetNumberOfElements(fun->plhs[0]) < nobj+ncon ) - { - mexPrintf("Insufficient outputs provided by the black box function. Exiting NOMAD...\n\n"); - raise(SIGINT); - return false; - } - //Assign bb output - fvals = mxGetPr(fun->plhs[0]); - for(i=0;i<(nobj+ncon);i++) - x.set_bb_output(i,fvals[i]); - -#endif - - //Iteration Callback - if(iterF->enabled) - { - iterF->plhs[0] = NULL; - memcpy(mxGetData(iterF->prhs[1]), &citer, sizeof(int)); - memcpy(mxGetPr(iterF->prhs[2]), fvals, sizeof(double)); - memcpy(mxGetPr(iterF->prhs[3]), xm, n * sizeof(double)); - try { - mexCallMATLAB(1, iterF->plhs, 4, iterF->prhs, iterF->f); - } - catch (...) - { - mexPrintf("Unrecoverable Error from Iteration Callback, Exiting NOMAD...\n\n"); - //Force exit - raise(SIGINT); - return false; - } - - //Collect return argument - stop = *(bool*)mxGetData(iterF->plhs[0]); - //Clean up Ptr - mxDestroyArray(iterF->plhs[0]); - } - - //Add Function Eval Counter - citer++; - - // Clean up LHS Fun Ptr - mxDestroyArray(fun->plhs[0]); - - //Check for iterfun stop - if(stop) - { - mexPrintf("\nIterFun Called Stop. Exiting NOMAD...\n\n"); - count_eval = false; - raise(SIGINT); - return false; - } - else - return true; - } -}; - -//MATLAB MultiObj Evaluator Class -class matlabMEval : public NOMAD::Multi_Obj_Evaluator { -private: - matlabEval *mEval; -public: - //Constructor - matlabMEval(const NOMAD::Parameters &p, usrFcn *_obj, int _nobj, usrFcn *_con, int _ncon, iter_fun_data *_iterF) : NOMAD::Multi_Obj_Evaluator(p) - { - mEval = new matlabEval(p,_obj,_nobj,_con,_ncon,_iterF); - } - //Destructor - ~matlabMEval(void) - { - delete mEval; - } - //Function + Constraint Information - bool eval_x(NOMAD::Eval_Point &x, const NOMAD::Double &h_max, bool &count_eval) - { - return mEval->eval_x(x,h_max,count_eval); - } - //Function + Constraint Information - bool eval_x(std::list<NOMAD::Eval_Point *> &x, const NOMAD::Double &h_max, std::list<bool> & list_count_eval ) - { - return mEval->eval_x(x,h_max,list_count_eval); - } -}; - -//cout Redirection -struct printfbuf : std::streambuf { -public: - //Constructor - printfbuf() - { - setp(m_buffer, m_buffer + s_size - 2); - } -private: - enum { s_size = 1024 }; //not sure on this size - char m_buffer[s_size]; - int_type overflow(int_type c) - { - if (!traits_type::eq_int_type(c, traits_type::eof())) - { - *pptr() = traits_type::to_char_type(c); - pbump(1); - } - return sync() != -1 ? traits_type::not_eof(c) : traits_type::eof(); - } - - int sync() - { - *pptr() = 0; - mexPrintf(pbase()); - mexEvalString("drawnow;"); - setp(m_buffer, m_buffer + s_size - 2); - return 0; - } -}; - - -static printfbuf buf; - -// Main Entry Function -// ----------------------------------------------------------------- -void mexFunction (int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) -{ - //Input Args - usrFcn fun, con; - double *x0, *lb = NULL, *ub = NULL; - char *xtype = NULL; - - //Outputs Args - double *exitflag, *iter, *nfval; - - //Internal Vars - size_t ndec; - int i, nobj = 1, ncon = 0; - char errstr[1024]; //used for returning error info - iter_fun_data iterF; - neighborsFcn neighborsF; - - //Check user inputs - if( !checkInputs(prhs,nrhs,plhs,nlhs) ) - return; - - //Redirect cout - std::cout.rdbuf(&buf); //redirect buffer - - //NOMAD Vars - NOMAD::Mads *mads; - NOMAD::Display out(std::cout); - NOMAD::Parameters p(out); - NOMAD::Point px0; - NOMAD::Double *nx0; - NOMAD::stop_type stopflag; - - //Evaluator Vars - matlabEval *mSEval = NULL; - matlabMEval *mBEval = NULL; - - - // Extended Poll Vars - Matlab_Extended_Poll *mEP = NULL; - - //Set Option Defaults - int printLevel = 0; - char *paramfile = NULL; - mxArray *bb_out_type = NULL; - iterF.enabled = false; - neighborsF.enabled=false; - - //Get Size - ndec = mxGetNumberOfElements(pX0); - - //Get Blackbox / Objective Function Handle - if ( mxIsChar(pFUN) ) - { - if( mxGetString(pFUN, fun.f, FLEN) != 0 ) - mexErrMsgTxt("error reading objective name string"); - fun.nrhs = 1; - fun.xrhs = 0; - } - else - { - fun.prhs[0] = (mxArray*)pFUN; - strcpy(fun.f, "feval"); - fun.nrhs = 2; - fun.xrhs = 1; - } - fun.prhs[fun.xrhs] = mxCreateDoubleMatrix( ndec, 1, mxREAL ); //x - - //Get x0 - x0 = mxGetPr(pX0); - - //Get xtype - if( nrhs > eXTYPE && !mxIsEmpty(pXTYPE) ) - xtype = mxArrayToString(pXTYPE); - - //Get MEX Options if specified - if( nrhs > eOPTS && !mxIsEmpty(pOPTS) ) - { - if( mxGetField(pOPTS,0,"display_degree") && !mxIsEmpty(mxGetField(pOPTS,0,"display_degree")) ) - printLevel = (int)*mxGetPr(mxGetField(pOPTS,0,"display_degree")); - if( mxGetField(pOPTS,0,"param_file") && !mxIsEmpty(mxGetField(pOPTS,0,"param_file")) ) - paramfile = mxArrayToString(mxGetField(pOPTS,0,"param_file")); - if( mxGetField(pOPTS,0,"bb_output_type") && !mxIsEmpty(mxGetField(pOPTS,0,"bb_output_type")) ) - bb_out_type = mxGetField(pOPTS,0,"bb_output_type"); - if( mxGetField(pOPTS,0,"iterfun") && !mxIsEmpty(mxGetField(pOPTS,0,"iterfun")) ) - { - iterF.prhs[0] = (mxArray*)mxGetField(pOPTS,0,"iterfun"); - strcpy(iterF.f, "feval"); - iterF.enabled = true; - iterF.prhs[1] = mxCreateNumericMatrix(1,1,mxINT32_CLASS,mxREAL); - iterF.prhs[2] = mxCreateDoubleMatrix(1,1,mxREAL); - iterF.prhs[3] = mxCreateDoubleMatrix(ndec,1,mxREAL); - } - - if(mxGetField(pOPTS,0,"neighbors_mat") && !mxIsEmpty(mxGetField(pOPTS,0,"neighbors_mat"))) - { - strcpy(neighborsF.f, "feval"); - neighborsF.enabled = true; - neighborsF.prhs[0] = (mxArray*)mxGetField(pOPTS,0,"neighbors_mat"); - neighborsF.prhs[1] = mxCreateDoubleMatrix(ndec,1,mxREAL); - } - - } - - - //Setup ndec - p.set_DIMENSION((int)ndec); - - //Warn if >1000 - if(ndec > 1000 && printLevel) - { - sprintf(errstr,"Warning: NOMAD is designed for problems with less than 1000 variables. Your model has %d.\nWhile unlikely, it is possible that NOMAD may not perform as intended on this problem.",static_cast<int>(ndec)); - mexWarnMsgTxt(errstr); - } - - //Setup Lower Bounds - if( nrhs > eLB && !mxIsEmpty(pLB) ) - { - NOMAD::Point ptLB; - NOMAD::Double *dLB = new NOMAD::Double[ndec]; - lb = mxGetPr(pLB); - - for(i=0;i<ndec;i++) - { - if(!mxIsInf(lb[i])) //if not initialized will not be used - dLB[i] = lb[i]; - } - ptLB.set((int)ndec,dLB); - p.set_LOWER_BOUND(ptLB); - delete [] dLB; - } - - //Setup Upper Bounds - if( nrhs > eUB && !mxIsEmpty(pUB) ) - { - NOMAD::Point ptUB; - NOMAD::Double *dUB = new NOMAD::Double[ndec]; - ub = mxGetPr(pUB); - for(i=0;i<ndec;i++) - { - if(!mxIsInf(ub[i])) //if not initialized will not be used - dUB[i] = ub[i]; - } - ptUB.set((int)ndec,dUB); - p.set_UPPER_BOUND(ptUB); - delete [] dUB; - } - - //Setup x0 - nx0 = new NOMAD::Double[ndec]; - -#ifdef OPTI_VERSION - double xl, xu; - //If integer variables declared, need to ensure x0[i] is an integer - if( xtype ) - { - for(i=0;i<ndec;i++) - { - switch(tolower(xtype[i])) - { - case 'c': - //Ensure within bounds - if(lb && x0[i] < lb[i]) - nx0[i] = lb[i]; - else if(ub && x0[i] > ub[i]) - nx0[i] = ub[i]; - else - nx0[i] = x0[i]; //no rounding - break; - case 'i': - case 'b': - xl = floor(x0[i]); //First round is a floor - - //If lower bounds exist - if( lb ) - { - //if lower bound broken - if( xl < lb[i] ) - { - xu = ceil(x0[i]); - //If upper bounds exist, check bound directions - if( ub && xu > ub[i] ) - { //if broken, no integer x0 exists - sprintf(errstr,"x0[%d] cannot be rounded to an integer value between lb: %g, ub %g",i,lb[i],ub[i]); - mexErrMsgTxt(errstr); - } - if( xu != x0[i] ) - { //If we changed something, warn user - sprintf(errstr,"x0[%d] was rounded up to %g to suit NOMAD interface",i,xu); - mexWarnMsgTxt(errstr); - } - //Save ceil value - nx0[i] = xu; - } - //Floor value did not break lower bounds, value OK - else - { - if( xl != x0[i] ) - { //If we changed something, warn user - sprintf(errstr,"x0[%d] was rounded down to %g to suit NOMAD interface",i,xl); - mexWarnMsgTxt(errstr); - } - //Save floor value - nx0[i] = xl; - } - } - //No lower bounds, floor value assumed OK - else { - if( xl != x0[i] ) - { //If we changed something, warn user - sprintf(errstr,"x0[%d] was rounded down to %g to suit NOMAD interface",i,xl); - mexWarnMsgTxt(errstr); - } - //Save floor value - nx0[i] = xl; - } - break; - case 'r': - mexErrMsgTxt("Please specify continuous (real) variables using 'c' (as opposed to 'r') when using the OPTI version"); - break; - default: - sprintf(errstr,"Unknown xtype[%d] character: %c\n\nValid options are 'C', 'I', or 'B'\n",i,xtype[i]); - mexErrMsgTxt(errstr); - } - } - } - //Else user start position within bounds - else - { - for(i=0;i<ndec;i++) - { - if( lb && x0[i] < lb[i] ) - nx0[i] = lb[i]; - else if(ub && x0[i] > ub[i]) - nx0[i] = ub[i]; - else - nx0[i] = x0[i]; - } - } - -#else //GERAD VERSION - no x0 checking - for(i=0;i<ndec;i++) - nx0[i] = x0[i]; -#endif - px0.set((int)ndec,nx0); - p.set_X0(px0); - delete [] nx0; - -#ifdef OPTI_VERSION - //Setup Nonlinear Constraints - if( nrhs > eNLCON && !mxIsEmpty(pNLCON) ) - { - if ( mxIsChar(pNLCON) ) - { - if(mxGetString(pNLCON, con.f, FLEN) != 0) - mexErrMsgTxt("error reading constraint name string"); - con.nrhs = 1; - con.xrhs = 0; - } - else - { - con.prhs[0] = (mxArray*)pNLCON; - strcpy(con.f, "feval"); - con.nrhs = 2; - con.xrhs = 1; - } - con.prhs[con.xrhs] = mxCreateDoubleMatrix(ndec, 1, mxREAL); //x - if(nrhs < eNLRHS+1 || mxIsEmpty(pNLRHS)) - {//we will default to <= 0 - ncon = -1; - con.nlrhs = NULL; - } - else - { - ncon = (int)mxGetNumberOfElements(pNLRHS); - con.nlrhs = mxGetPr(pNLRHS); - } - } - //Setup Input Variable Types - if(xtype) - p.set_BB_INPUT_TYPE(detInTypes(xtype,ndec)); - - //Setup Evaluation Return Types + #'s of Obj + Con - p.set_BB_OUTPUT_TYPE(detRetTypes(&fun,bb_out_type,&nobj,&con,&ncon,x0,ndec)); - - //Set All Normal NOMAD Options - p.set_DISPLAY_DEGREE(0); //default - -#endif //GERAD Version does not have a separate constraint handler and handles input and output types using options - - // Make sure that evaluation numbers are reset - NOMAD::Eval_Point::reset_tags_and_bbes(); - - // The seed will always be to its default value - NOMAD::RNG::reset_seed_to_default(); - - //Set User Options - if( nrhs > eOPTS && !mxIsEmpty(pOPTS) ) - setNOMADopts(p,pOPTS); - else - setNOMADopts(p,NULL); - - //If the user has specified a parameter file to read, see if it exists, and if so, read and parse it. - if( paramfile ) - { - FILE *pFile = fopen(paramfile,"r"); - if(pFile==NULL) - { - sprintf(errstr,"Cannot open parameter file: %s\n\nEnsure it exists!",paramfile); - mexErrMsgTxt(errstr); - } - else - { - fclose(pFile); //close file pointer (we don't need it) - try - { - p.read(paramfile); - } - catch(exception &e) - { - sprintf(errstr,"NOMAD Parameter File Read Error:\n\n%s",e.what()); - mexErrMsgTxt(errstr); - } - } - } - - //Check NOMAD parameters - try - { - p.check(); - } - catch(exception &e) - { - sprintf(errstr,"NOMAD Parameter Error:\n\n%s",e.what()); - mexErrMsgTxt(errstr); - } - - //If GERAD version, obtain number of objectives and constraints from parameters -#ifndef OPTI_VERSION - nobj=p.get_nb_obj(); - ncon=(int)p.get_bb_output_type().size()-nobj; - if ( p.has_sgte() ) - { - fun.prhs[fun.xrhs+1] = mxCreateLogicalMatrix(1,1); //extra logical indicating surrogate or not - fun.nrhs++; - } -#endif - - - // Get additional bb param if specified - if ( nrhs > ePARAM && ! mxIsEmpty(pParam) ) - { - fun.nrhs++; - - if ( p.has_sgte() ) - fun.prhs[fun.xrhs+2]=mxDuplicateArray(pParam); - else - fun.prhs[fun.xrhs+1]=mxDuplicateArray(pParam); - } - - - //Print Header - if(printLevel) - { - mexPrintf("\n------------------------------------------------------------------\n"); - mexPrintf(" This is NOMAD v%s\n",NOMAD::VERSION.c_str()); - mexPrintf(" Authors: C. Audet, S. Le Digabel and C. Tribes\n"); -#ifdef OPTI_VERSION - mexPrintf(" MEX Interface (OPTI) J. Currie 2012\n\n"); -#else - mexPrintf(" MEX Interface (GERAD) J. Currie 2012 and C. Tribes 2016 \n\n"); -#endif - mexPrintf(" Problem Properties:\n"); - mexPrintf(" # Decision Variables: %4d\n",ndec); - mexPrintf(" # Number of Objectives: %4d\n",nobj); - mexPrintf(" # Number of Nonlinear Constraints: %4d\n",ncon); - - mexPrintf("------------------------------------------------------------------\n"); - mexEvalString("drawnow;"); //flush draw buffer - } - - //Create evaluator and run mads based on number of objectives - try - { - if( nobj > 1 ) - { - mBEval = new matlabMEval(p,&fun,nobj,&con,ncon,&iterF); //Bi-Objective Evaluator - - if ( p.get_signature()->has_categorical() ) - { - mEP = new Matlab_Extended_Poll ( p , &neighborsF); - mads = new NOMAD::Mads(p, mBEval , mEP , NULL , NULL); //Run NOMAD - - } - else - mads = new NOMAD::Mads(p, mBEval); //Run NOM - - stopflag = mads->multi_run(); - } - else - { - mSEval = new matlabEval(p,&fun,nobj,&con,ncon,&iterF); //Single Objective Evaluator - - if ( p.get_signature()->has_categorical() ) - { - mEP = new Matlab_Extended_Poll ( p, &neighborsF); - mads = new NOMAD::Mads(p, mSEval , mEP , NULL , NULL); //Run NOMAD - - } - else - mads = new NOMAD::Mads(p, mSEval); //Run NOMAD - - stopflag = mads->run(); - - } - } - catch(exception &e) - { - - //Free Memory - if(mSEval) - delete mSEval; - mSEval = NULL; - if(mBEval) - delete mBEval; - mBEval = NULL; - delete mads; - if(xtype) - mxFree(xtype); - xtype = NULL; - - sprintf(errstr,"NOMAD Run Error:\n\n%s",e.what()); - mexErrMsgTxt(errstr); - } - - if(printLevel) - mexPrintf("------------------------------------------------------------------\n"); - - - //Create Outputs - plhs[2] = mxCreateDoubleMatrix(1,1, mxREAL); - plhs[3] = mxCreateDoubleMatrix(1,1, mxREAL); - plhs[4] = mxCreateDoubleMatrix(1,1, mxREAL); - plhs[5] = mxCreateDoubleMatrix(ndec,1, mxREAL); - plhs[6] = mxCreateDoubleMatrix(ndec,1, mxREAL); - - exitflag = mxGetPr(plhs[2]); - iter = mxGetPr(plhs[3]); - nfval = mxGetPr(plhs[4]); - - double *mesh_size=mxGetPr(plhs[5]); - - //Save mesh size - NOMAD::Point ms( static_cast<int>(ndec) ); - p.get_signature()->get_mesh()->get_delta(ms); - for(i=0;i<ndec;i++) - mesh_size[i] = ms[i].value(); - - double *poll_size=mxGetPr(plhs[6]); - //Save poll size - NOMAD::Point ps( static_cast<int>(ndec) ); - p.get_signature()->get_mesh()->get_Delta(ps); - for(i=0;i<ndec;i++) - poll_size[i] = ps[i].value(); - - if (nobj>1) - { - - NOMAD::Pareto_Front * pareto_front=mads->get_pareto_front(); - - if ( pareto_front ) - { - - int nb_pareto_pts = pareto_front->size(); - plhs[0] = mxCreateDoubleMatrix(ndec,nb_pareto_pts, mxREAL); - plhs[1] = mxCreateDoubleMatrix(nobj,nb_pareto_pts, mxREAL); - double *x = mxGetPr(plhs[0]); - double *fval = mxGetPr(plhs[1]); - - const NOMAD::Eval_Point * cur = pareto_front->begin(); - int i=0; - while ( cur ) - { - - if ( cur->is_eval_ok() && cur->is_feasible ( p.get_h_min() ) ) - { - const std::list<int> & index_obj = p.get_index_obj(); - std::list<int>::const_iterator it , end = index_obj.end(); - const NOMAD::Point & bbo = cur->get_bb_outputs(); - int j = 0; - NOMAD::Point multi_obj ( static_cast<int>(index_obj.size()) ); - - for ( it = index_obj.begin() ; it != end ; ++it,j++ ) - fval[nobj*i+j] = bbo[*it].value(); - - for(j=0;j<ndec;j++) - x[ndec*i+j] = (*cur)[j].value(); - } - cur = pareto_front->next(); - i++; - } - *exitflag = getStatus(stopflag); - - } - else - { - stopflag = (NOMAD::stop_type)10; - *exitflag = -1; //No solution - } - //Save Status & Iterations - - *iter = mads->get_stats().get_iterations(); - *nfval = mads->get_stats().get_bb_eval(); - - } - else - { - - plhs[0] = mxCreateDoubleMatrix(ndec,1, mxREAL); - plhs[1] = mxCreateDoubleMatrix(1,1, mxREAL); - double *x = mxGetPr(plhs[0]); - double *fval = mxGetPr(plhs[1]); - - - const NOMAD::Eval_Point *bestSol = mads->get_best_feasible(); - if(bestSol == NULL) - { - bestSol = mads->get_best_infeasible(); - //manually set as infeasible (no infeasible stop flag) - stopflag = (NOMAD::stop_type)10; - } - if(bestSol == NULL) - *exitflag = -1; //No solution - - //If we have a solution, save it - if(*exitflag != -1) - { - //Save x - NOMAD::Point pt(*bestSol); - for(i=0;i<ndec;i++) - x[i] = pt[i].value(); - //Save fval - *fval = bestSol->get_f().value(); - - //Save Status & Iterations - *exitflag = getStatus(stopflag); - *iter = mads->get_stats().get_iterations(); - *nfval = mads->get_stats().get_bb_eval(); - - } - } - - - //Return error control to default - mexSetTrapFlag(0); - - - //Free Memory - if(mSEval) - delete mSEval; - mSEval = NULL; - if(mBEval) - delete mBEval; - mBEval = NULL; - - // Clean up of fun - mxDestroyArray(fun.prhs[fun.xrhs]); - - delete mads; - - if(xtype) - mxFree(xtype); - xtype = NULL; -} - -//Determine Variable Return Types + # Objectives + #NL Constraints (only OPTI Version) -vector<NOMAD::bb_output_type> detRetTypes(usrFcn *fun, mxArray *out_types, int *nobj, usrFcn *con, int *ncon, double *x0, size_t n) -{ - int i, j, stat; - - //Test Blackbox / Objective Evaluation - fun->plhs[0] = NULL; - memcpy(mxGetPr(fun->prhs[fun->xrhs]), x0, n * sizeof(double)); - - //Call MATLAB Objective - stat = mexCallMATLAB(1, fun->plhs, fun->nrhs, fun->prhs, fun->f); - if(stat) - mexErrMsgTxt("Error calling Objective Function!"); - //Ensure we have a real column - if( mxGetN(fun->plhs[0]) > mxGetM(fun->plhs[0]) ) - mexErrMsgTxt("The objective function must return a scalar or column vector"); - if( mxIsSparse(fun->plhs[0]) || mxIsComplex(fun->plhs[0]) ) - mexErrMsgTxt("The objective function must return a real, dense, vector"); - - //Ensure 1 or 2 rows (max of bi-objective) - *nobj = (int)mxGetNumberOfElements(fun->plhs[0]); - if( *nobj < 1 || *nobj > 2 ) - mexErrMsgTxt("The objective function must return a scalar or 2x1 vector (bi-objective)"); - - // Clean up LHS Ptr - mxDestroyArray(fun->plhs[0]); - - //Test Constraint Evaluation - if( *ncon ) - { - con->plhs[0] = NULL; - memcpy(mxGetPr(con->prhs[con->xrhs]), x0, n * sizeof(double)); - //Call MATLAB Objective - stat = mexCallMATLAB(1, con->plhs, con->nrhs, con->prhs, con->f); - if( stat ) - mexErrMsgTxt("Error calling Constraint Function!"); - //Ensure we have a real column - if( mxGetN(con->plhs[0]) > mxGetM(con->plhs[0]) ) - mexErrMsgTxt("The constraint function must return a scalar or column vector"); - if( mxIsSparse(con->plhs[0]) || mxIsComplex(con->plhs[0]) ) - mexErrMsgTxt("The constraint function must return a real, dense, vector"); - - //If we have nlrhs, check against returned vector - if(*ncon > 0) - { - if(mxGetM(con->plhs[0]) != *ncon) - mexErrMsgTxt("The vector returned from nlcon is not the same length as nlrhs!"); - } - else - { - *ncon = (int)mxGetM(con->plhs[0]); - con->nlrhs = mxGetPr(mxCreateDoubleMatrix(*ncon,1, mxREAL)); //create dummy rhs - } - // Clean up LHS Ptr - mxDestroyArray(con->plhs[0]); - } - - //Create Return Vector - vector<NOMAD::bb_output_type> varType(*nobj+*ncon); - //Fill Objective Information - for(i=0;i<*nobj;i++) - varType[i] = NOMAD::OBJ; - //If the user has set bb_output_type use it to set constraint types - if( out_types ) - { - if( !mxIsCell(out_types) ) - mexErrMsgTxt("Parameter bb_output_type must be a cell array of strings."); - if( mxGetNumberOfElements(out_types) != *ncon ) - mexErrMsgTxt("You must specify a bb_output_type for each element returned by the constraint function (not objective)."); - //Process each element in the array - for(i=0,j=*nobj;i<*ncon;i++,j++) - { - mxArray *ctype = mxGetCell(out_types,i); - if(!mxIsChar(ctype)) - mexErrMsgTxt("An element in the bb_output_type paramter is not a string"); - //Get the string - char *str = mxArrayToString(ctype); - //Set varType based on string - varType[j] = getOutEnum(str); - //Free local memory at each iteration - mxFree(str); - } - } - //Or Fill Constraint Information as Default all PB - else { - for(i=0,j=*nobj;i<*ncon;i++,j++) - varType[j] = NOMAD::PB; - } - - return varType; -} - -//Convert user string to NOMAD bb_output_type enum -NOMAD::bb_output_type getOutEnum(char *str) -{ - char errstr[1024]; - lower(str); //convert to lowercase - - if(!strcmp(str,"obj")) -#ifdef OPTI_VERSION - mexErrMsgTxt("The OPTI Version of NOMAD uses bb_output_type to describe CONSTRAINTS ONLY. Please remove any OBJ terms from the cell array."); -#else - return NOMAD::OBJ; -#endif - else if(!strcmp(str,"pb")) - return NOMAD::PB; - else if(!strcmp(str,"eb")) - return NOMAD::EB; - else if(!strcmp(str,"peb")) - return NOMAD::PEB_P; - else if(!strcmp(str,"f")) - return NOMAD::FILTER; - else if(!strcmp(str,"nothing") || !strcmp(str,"-")) - return NOMAD::UNDEFINED_BBO; - else { - sprintf(errstr,"Unknown BB_OUTPUT_TYPE %s",str); - mexErrMsgTxt(errstr); - } - //Default - return NOMAD::UNDEFINED_BBO; -} - -//Convert input string to lowercase -void lower(char *str) -{ - int i = 0; - while(str[i]) - { - str[i] = tolower(str[i]); - i++; - } -} - -//Determine input variable types (only OPTI version) -vector<NOMAD::bb_input_type> detInTypes(char *xtype, size_t n) -{ - int i; - char msgbuf[1024]; - vector<NOMAD::bb_input_type> varType(n); - for(i=0;i<n;i++) - { - switch(tolower(xtype[i])) - { - case 'c': - varType[i] = NOMAD::CATEGORICAL; break; - case 'r': - varType[i] = NOMAD::CONTINUOUS; break; - mexErrMsgTxt("Please specify continuous (real) variables using 'c' when using the OPTI version"); // C-> categorical (not implemented in Matlab version) R-> continuous/real ! - case 'i': - varType[i] = NOMAD::INTEGER; break; - case 'b': - varType[i] = NOMAD::BINARY; break; - default: - sprintf(msgbuf,"Unknown xtype[%d] character: %c\n\nValid options are 'C', 'I', or 'B'\n",i,xtype[i]); - mexErrMsgTxt(msgbuf); - } - } - return varType; -} - -//User Input Checking + Version / Info / Help -int checkInputs(const mxArray *prhs[], int nrhs, mxArray *plhs[], int nlhs) -{ - size_t ndec; - char *str = NULL; - - //MEX Display Version (OPTI compatibility) - if (nrhs < 1) - { - if(nlhs < 1) - printSolverInfo(); - else - plhs[0] = mxCreateString(NOMAD::VERSION.c_str()); - return 0; - } - - //Redirect cout - std::streambuf *cout_sbuf = std::cout.rdbuf(); //keep existing buffer - std::cout.rdbuf(&buf); //redirect buffer - - //NOMAD Display - NOMAD::Display out (std::cout); - - //Check for display on options passed as structure - if(nrhs == 1 && mxIsStruct(prhs[0])) - { - int i, no = mxGetNumberOfFields(prhs[0]); - const char *field; - std::list<std::string> ls; - //For all fields, display nomad help - for(i=0;i<no;i++) - { - field = mxGetFieldNameByNumber(prhs[0],i); - string st(field); - ls.push_back ( st ); - } - if(no>0) - { - //NOMAD Display - NOMAD::Parameters p ( out ); - p.help(ls); - } - std::cout.rdbuf(cout_sbuf); //Return cout to initial buffer - return 0; - } - - //Check for Version / Information / Help Request - if(nrhs == 1 && mxIsChar(prhs[0])) - { - str = mxArrayToString(prhs[0]); - //Check for Info Request - if(!strcmp(str,"-I") || !strcmp(str,"-INFO") || !strcmp(str,"-i") || !strcmp(str,"-info")) - { - //Information to Print - mexPrintf("\nNOMAD Blackbox Optimization Software, v%s\n\n",NOMAD::VERSION.c_str()); - mexPrintf("NOMAD - version %s has been created by {\n",NOMAD::VERSION.c_str()); - mexPrintf(" Charles Audet - Ecole Polytechnique de Montreal\n"); - mexPrintf(" Sebastien Le Digabel - Ecole Polytechnique de Montreal\n"); - mexPrintf(" Christophe Tribes - Ecole Polytechnique de Montreal\n}\n\n"); - mexPrintf("The copyright of NOMAD - version %s is owned by {\n",NOMAD::VERSION.c_str()); - mexPrintf(" Sebastien Le Digabel - Ecole Polytechnique de Montreal\n"); - mexPrintf(" Christophe Tribes - Ecole Polytechnique de Montreal\n}\n\n"); - mexPrintf("NOMAD version 3 is a new version of Nomad v1 and v2, it has been funded by AFOSR and Exxon Mobil.\n"); - mexPrintf("Nomad v1 and v2 were created and developed by Mark A. Abramson from The Boeing Company, Charles Audet and Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from Rice University, and were funded by AFOSR and Exxon Mobil.\n\n"); - mexPrintf("Web : www.gerad.ca/nomad\n"); - mexPrintf("License : \'%s\'\n",NOMAD::LGPL_FILE.c_str()); - mexPrintf("User guide: \'%s\'\n",NOMAD::USER_GUIDE_FILE.c_str()); - mexPrintf("Examples : \'%s\'\n",NOMAD::EXAMPLES_DIR.c_str()); - mexPrintf("Tools : \'%s\'\n\n",NOMAD::TOOLS_DIR.c_str()); - mexPrintf("Please report bugs to nomad@gerad.ca\n\n"); - - std::cout.rdbuf(cout_sbuf); //Return cout to initial buffer - return 0; - } - //Check for Ver Request - if(!strcmp(str,"-V") || !strcmp(str,"-v") || !strcmp(str,"-version")) - { - mexPrintf("NOMAD - version %s - www.gerad.ca/nomad\n\n",NOMAD::VERSION.c_str()); -#ifdef OPTI_VERSION - mexPrintf("MEX Interface (OPTI) v%s\n",NOMADMEX_VERSION); -#else - mexPrintf("MEX Interface (GERAD) v%s\n",NOMADMEX_VERSION); -#endif - - std::cout.rdbuf(cout_sbuf); //Return cout to initial buffer - return 0; - } - //Check for Help Request - if (strcmp(str,"-H")<0 || strcmp(str,"-HELP")<0 || strcmp(str,"-h")<0 || strcmp(str,"-help")<0 ) - { - NOMAD::Parameters p ( out ); - std::list<std::string> helpS; - const char * toks=" "; - char *w = strtok(str,toks) ; - for ( w = strtok(NULL,toks) ; w != NULL ; w = strtok(NULL,toks) ) - { - helpS.push_back(w); - } - p.help (helpS ); - - std::cout.rdbuf(cout_sbuf); //Return cout to initial buffer - return 0; - } - } - - //Otherwise assume we have a normal problem - if(nrhs < 2) - mexErrMsgTxt("You must supply at least 2 arguments to nomad!\n\nnomad(fun,x0)\n"); - - //Check Types - if(!mxIsFunctionHandle(pFUN) && !mxIsChar(pFUN)) - mexErrMsgTxt("fun must be a function handle or function name!"); - - if(!mxIsDouble(pX0) || mxIsComplex(pX0) || mxIsEmpty(pX0)) - mexErrMsgTxt("x0 must be a real double column vector!"); - - //Get ndec - ndec = mxGetNumberOfElements(prhs[1]); - - //Check Bounds - if(nrhs > 2) - { - if(!mxIsDouble(pLB) || mxIsComplex(pLB)) - mexErrMsgTxt("lb must be a real double column vector!"); - if(nrhs > 3 && (!mxIsDouble(pUB) || mxIsComplex(pUB))) - mexErrMsgTxt("ub must be a real double column vector!"); - //Check Sizes - if(!mxIsEmpty(pLB) && (ndec != mxGetNumberOfElements(pLB))) - mexErrMsgTxt("lb is not the same length as x0! Ensure they are both Column Vectors"); - if(nrhs > 3 && !mxIsEmpty(pUB) && (ndec != mxGetNumberOfElements(pUB))) - mexErrMsgTxt("ub is not the same length as x0! Ensure they are both Column Vectors"); - } - -#ifdef OPTI_VERSION - //Version check - if(nrhs > eNLRHS && mxIsStruct(pNLRHS)) - mexErrMsgTxt("It appears you may be calling NOMAD using the GERAD NOMAD Syntax - nomad(bb,x0,lb,ub,opts). This is the OPTI NOMAD version and requires nomad(fun,x0,lb,ub,nlcon,nlrhs,xtype,opts)."); - - //Check Nonlinear Constraint Handle - if(nrhs > eNLCON && !mxIsEmpty(pNLCON)) - { - if(!mxIsFunctionHandle(pNLCON) && !mxIsChar(pNLCON)) - mexErrMsgTxt("nlcon must be a function handle or function name!"); - if(nrhs > eNLRHS && (!mxIsDouble(pNLRHS) || mxIsComplex(pNLRHS))) - mexErrMsgTxt("nlrhs must be a real double column vector!"); - } - //Check for xtype - if(nrhs > eXTYPE && !mxIsEmpty(pXTYPE)) - { - if(!mxIsChar(pXTYPE)) - mexErrMsgTxt("The xtype vector must be a char array!"); - if(ndec != mxGetNumberOfElements(pXTYPE)) - mexErrMsgTxt("xtype is not same length as x0! Ensure they are both Column Vectors"); - } -#else - //Version check - if(nrhs > 6) - mexErrMsgTxt("It appears you may be calling NOMAD using the OPTI NOMAD Syntax - nomad(fun,x0,lb,ub,nlcon,nlrhs,xtype,opts). This is the GERAD NOMAD version and requires nomad(bb,x0,lb,ub,opts)."); -#endif - - //Check Options - if(nrhs > eOPTS && !mxIsEmpty(pOPTS)) - { - //Version check - if(mxIsDouble(pOPTS)) - mexErrMsgTxt("It appears you may be calling NOMAD using the OPTI NOMAD Syntax - nomad(fun,x0,lb,ub,nlcon,nlrhs,xtype,opts). This is the GERAD NOMAD version and requires nomad(bb,x0,lb,ub,opts)."); - - if(!mxIsStruct(pOPTS)) - mexErrMsgTxt("The specified options must be a structure!"); - } - - //Return Continue - return 1; - -} - -void setNOMADopts(NOMAD::Parameters &p, const mxArray *opts) -{ - char strbuf[1024]; - int i, no = 0; - NOMAD::Parameter_Entries entries; - const char *field; - mxArray *value; - bool doAdd = false; - size_t m; - double val; - bool has_BB_OUTPUT_TYPE = false; - bool has_categorical =false; - - if(opts) - no = mxGetNumberOfFields(opts); - - //For each field, check if it's empty, if not, set it within NOMAD - for(i=0;i<no;i++) - { - field = mxGetFieldNameByNumber(opts,i); - value = mxGetFieldByNumber(opts,0,i); - - //Check we don't have an empty or MEX option - if( !mxIsEmpty(value) && isNMDOption(field) ) - { - //Switch on data type - switch( mxGetClassID(value) ) - { - - case mxDOUBLE_CLASS: - m = mxGetNumberOfElements(value); - //This interface doesn't write vectors as options - if(m > 1) - { - sprintf(strbuf,"This interface does not support vector options for parameter %s. Please provide it as a string",field); - mexErrMsgTxt(strbuf); - } - val = *mxGetPr(value); - //Check if we have an integer parameter (I assume this check is ok!) - if(floor(val) == val) - { - sprintf(strbuf,"%s %.0f",field,val); doAdd = true; //write with no decimal points and no exponent - } - else - {//write as double (exponent ok) - sprintf(strbuf,"%s %g",field,val); doAdd = true; - } - break; - case mxFUNCTION_CLASS: - if ( strcmp(field,"NEIGHBORS_MAT") == 0 || strcmp(field,"neighbors_mat") == 0 ) - { - // sprintf(strbuf,"%s %s",field,mxArrayToString(value)); - has_categorical = true; - } - break; - case mxCHAR_CLASS: - sprintf(strbuf,"%s %s",field,mxArrayToString(value)); - doAdd = true; - //GERAD check for BB_OUTPUT_TYPE - if ( strcmp(field,"BB_OUTPUT_TYPE") == 0 || strcmp(field,"bb_output_type") == 0 ) - has_BB_OUTPUT_TYPE = true; - break; - - case mxCELL_CLASS: -#ifdef OPTI_VERSION - //Add each string for the specified field - m = mxGetNumberOfElements(value); - for(j=0;j<m;j++) - { - mxArray *cellopt = mxGetCell(value,j); - if( !mxIsChar(cellopt) ) - { - sprintf(strbuf,"Element %d in the cell array of paramter %s is not a string",j+1,field); - mexErrMsgTxt(strbuf); - } - //Get the string and create the required option string - char *str = mxArrayToString(cellopt); - sprintf(strbuf,"%s %s",field,str); - - //Add to our set of parameter entries - NOMAD::Parameter_Entry *pe = new NOMAD::Parameter_Entry(strbuf); // pe will be deleted by ~Parameter_Entries() - if( pe->is_ok() ) - entries.insert(pe); - else - { - sprintf(strbuf,"Parameter %s has an error",field); - mexErrMsgTxt(strbuf); - } - - //Free local memory at each iteration - mxFree(str); - } -#else - sprintf(strbuf,"Parameter %s NOT SET!\nThe GERAD version of the NOMAD interface does not support cell arrays. Please specify them as strings, with spaces between arguments.",field); - mexWarnMsgTxt(strbuf); -#endif - break; - - default: - sprintf(strbuf,"Parameter %s NOT SET, CLASSID = %d which is not supported",field,mxGetClassID(value)); - mexWarnMsgTxt(strbuf); - } - - //If we have a valid parameter, add it to our set of entries - if( doAdd ) { - //mexPrintf("NOMAD Option set as: %s\n",strbuf); //enable for debug - NOMAD::Parameter_Entry *pe = new NOMAD::Parameter_Entry(strbuf); - if( pe->is_ok() ) - entries.insert(pe); // pe will be deleted by ~Parameter_Entries() - else - { - sprintf(strbuf,"Parameter %s has an error",field); - mexErrMsgTxt(strbuf); - } - - doAdd = false; - } - } - } - //GERAD default bb_output_type if not specified -#ifndef OPTI_VERSION - if( ! has_BB_OUTPUT_TYPE ) - { - NOMAD::Parameter_Entry *pe = new NOMAD::Parameter_Entry("BB_OUTPUT_TYPE OBJ"); - entries.insert(pe); // pe will be deleted by ~Parameter_Entries() - } -#endif - - try - { - p.read(entries); - } - catch(exception &e) - { - sprintf(strbuf,"NOMAD Parameter Read Error:\n\n%s",e.what()); - mexErrMsgTxt(strbuf); - } -} - -//Separates MEX interface options from NOMAD ones -bool isNMDOption(const char *field) -{ - if(!strcmp(field,"param_file")) - return false; - else if(!strcmp(field,"iterfun")) - return false; -#ifdef OPTI_VERSION - else if(!strcmp(field,"bb_output_type")) - return false; -#endif - else - return true; -} - -double getStatus(int stat) -{ - switch((int)stat) - { - case 5: //mesh minimum - case 8: //min mesh size - case 9: //min poll size - case 20: //ftarget reached - case 19: //feas reached - return 1; - break; - case 12: //max time - case 13: //max bb eval - case 14: //max sur eval - case 15: //max evals - case 16: //max sim bb evals - case 17: //max iter - case 23: //max multi bb evals - case 24: //max mads runs - return 0; - break; - case 10: //max mesh index - case 11: //mesh index limits - case 18: //max consec fails - case 25: //stagnation - case 26: //no pareto - case 27: //max cache memory - return -1; - case 6: //x0 fail - case 7: //p1_fail - return -2; - case 2: //Unknown stop reason - return -3; - case 3: //Ctrl-C - case 4: //User-stopped - return -5; - default: //Not assigned flag - return -3; - } -} - -//Print Solver Information -void printSolverInfo() -{ - mexPrintf("\n-----------------------------------------------------------\n"); - mexPrintf(" NOMAD: Nonlinear Optimization using the MADS Algorithm [v%s]\n",NOMAD::VERSION.c_str()); - mexPrintf(" - Released under the GNU Lesser General Public License: http://www.gnu.org/copyleft/lesser.html\n"); - mexPrintf(" - Source available from: https://www.gerad.ca/nomad/\n"); - - mexPrintf("\n MEX Interface J.Currie 2013 (www.i2c2.aut.ac.nz) and C. Tribes 2015 \n"); - mexPrintf("-----------------------------------------------------------\n"); -} +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + +#define NOMADMEX_VERSION "1.26_ct [Feb. 10th, 2017]" +//NOTE from Version 1.15 on this MEX file contains a dual interface: + +// 1) The default (GERAD) interface is: +// [x,fval,exitflag,iter] = nomad(fun,x0,lb,ub,opts) + +// 2) Otherwise if OPTI_VERSION is defined it will compile the OPTI Toolbox interface: +// [x,fval,exitflag,iter] = nomad(fun,x0,lb,ub,nlcon,nlrhs,xtype,opts) + +// Both contain near identical functionality, except the GERAD version includes nonlinear +// constraints with the objective (blackbox) function. The OPTI version separates them, +// and allows a user specified rhs. The OPTI version also rounds x0 for integer constraints. + +#include "mex.h" +#include "nomad.hpp" +#include "defines.hpp" +#include <stdio.h> +#include <string.h> + +using namespace std; + + +//Function handle structure +#define FLEN 128 /* max length of user function name */ +#define MAXRHS 4 /* max nrhs for user function */ +typedef struct { + char f[FLEN]; + mxArray *plhs[1]; + mxArray *prhs[MAXRHS]; + int xrhs, nrhs; + double *nlrhs; +} usrFcn; + +typedef struct { + char f[FLEN]; + mxArray *plhs[1]; + mxArray *prhs[2]; + bool enabled; +} neighborsFcn; + + +//Iteration callback structure +typedef struct { + char f[FLEN]; + mxArray *plhs[1]; + mxArray *prhs[4]; + bool enabled; +} iter_fun_data; + +//Ctrl-C Detection +#ifdef __cplusplus +extern "C" bool utIsInterruptPending(); +extern "C" void utSetInterruptPending(bool); +#else +extern bool utIsInterruptPending(); +extern void utSetInterruptPending(bool); +#endif + +//Argument Enums (in expected order of arguments) +#ifdef OPTI_VERSION +enum {eFUN, eX0, eLB, eUB, eNLCON, eNLRHS, eXTYPE, eOPTS, ePARAM}; +#else //GERAD VERSION +enum {eFUN, eX0, eLB, eUB, eOPTS, ePARAM}; +enum {eNLCON, eNLRHS, eXTYPE}; //placeholders +#endif +//PRHS Defines +#define pFUN prhs[eFUN] +#define pX0 prhs[eX0] +#define pLB prhs[eLB] +#define pUB prhs[eUB] +#define pNLCON prhs[eNLCON] +#define pNLRHS prhs[eNLRHS] +#define pXTYPE prhs[eXTYPE] +#define pOPTS prhs[eOPTS] +#define pParam prhs[ePARAM] + +//Function Prototypes +void printSolverInfo(); +int checkInputs(const mxArray *prhs[], int nrhs, mxArray *plhs[], int nlhs); +vector<NOMAD::bb_input_type> detInTypes(char *xtype, size_t n); +vector<NOMAD::bb_output_type> detRetTypes(usrFcn *fun, mxArray *out_types, int *nobj, usrFcn *con, int *ncon, double *x0, size_t n); +void setNOMADopts(NOMAD::Parameters &p, const mxArray *opts); +bool isNMDOption(const char *field); +NOMAD::bb_output_type getOutEnum(char *str); +void lower(char *str); +double getStatus(int stat); + + +// Matlab Extended_Poll Class +/*--------------------------------------------------*/ +/* Class to define categorical neighborhoods */ +/*--------------------------------------------------*/ +class Matlab_Extended_Poll : public NOMAD::Extended_Poll +{ + +private: + + // signatures for 1 asset: + NOMAD::Signature * _s1; + + neighborsFcn * _neighbors; + + +public: + + Matlab_Extended_Poll ( NOMAD::Parameters & p , neighborsFcn * neighbors ); + + virtual ~Matlab_Extended_Poll ( void ){} + + // construct the extended poll points: + virtual void construct_extended_points ( const NOMAD::Eval_Point & ); + +}; + +/*-----------------------------------------*/ +/* constructor: creates the 3 signatures */ +/*-----------------------------------------*/ +Matlab_Extended_Poll::Matlab_Extended_Poll ( NOMAD::Parameters & p , neighborsFcn * neighbors) +: Extended_Poll ( p ) , +_s1 ( NULL ), +_neighbors ( neighbors ) +{ + _s1 = p.get_signature(); + +} + +/*--------------------------------------*/ +/* construct the extended poll points */ +/* (categorical neighborhoods) */ +/*--------------------------------------*/ +void Matlab_Extended_Poll::construct_extended_points ( const NOMAD::Eval_Point & x ) +{ + double *xm; + char errstr[1024]; + + if ( !x.is_complete() ) + { + mexWarnMsgTxt("construct_extended_points: bad extended poll center\n%sExiting NOMAD...\n\n"); + //Force exit + raise(SIGINT); + } + + + xm = mxGetPr( _neighbors->prhs[1] ); + int n=_s1->get_n(); + + for(int i=0;i<n;i++) + xm[i] = x[i].value(); + + //Call MATLAB neighbors + try + { + mexCallMATLAB(1, _neighbors->plhs, 2, _neighbors->prhs, _neighbors->f); + } + //Note if these errors occur it is due to errors in MATLAB code, no way to recover? + catch(exception &e) + { + sprintf(errstr,"Unrecoverable Error from neighbors callback:\n%sExiting NOMAD...\n\n",e.what()); + mexWarnMsgTxt(errstr); + //Force exit + raise(SIGINT); + } + catch(...) + { + mexWarnMsgTxt("Unrecoverable Error from neighbors callback, Exiting NOMAD...\n\n"); + //Force exit + raise(SIGINT); + } + + + int nbNPoints=static_cast<int>(mxGetNumberOfElements(_neighbors->plhs[0])/n); + double *xr=mxGetPr(_neighbors->plhs[0]); + + for(int i=0;i<nbNPoints;i++) + { + NOMAD::Point nPoint(n); + + for(int j=0;j<n;j++) + nPoint[j]=xr[i+j*nbNPoints]; + + add_extended_poll_point(nPoint , *_s1 ); + } + +} + + +//MATLAB Evaluator Class +class matlabEval : public NOMAD::Evaluator +{ +private: + usrFcn *fun; + bool hasSur; + // bool hasAdditionalParam; + int nobj; + usrFcn *con; + int ncon; + iter_fun_data *iterF; + int citer; + +public: + //Constructor + matlabEval(const NOMAD::Parameters &p, usrFcn *_obj, int _nobj, usrFcn *_con, int _ncon, iter_fun_data *_iterF) : NOMAD::Evaluator(p) + { + fun = _obj; + hasSur = p.has_sgte(); + nobj = _nobj; + con = _con; + ncon = _ncon; + iterF = _iterF; + citer = 0; + +#ifdef OPTI_VERSION + if(hasSur) + mexWarnMsgTxt("Optimization using surrogates is not available in OPTI version of NOMAD\n"); +#endif + } + //Destructor + ~matlabEval(void) {} + + + bool eval_x(std::list<NOMAD::Eval_Point *> &x, const NOMAD::Double &h_max, std::list<bool> & list_count_eval ) + { + +#ifdef OPTI_VERSION + mexPrintf("Optimization using block of points evaluation is not available in OPTI version of NOMAD\n"); + //Force exit + raise(SIGINT); + return false; +#endif + + + char errstr[1024]; + bool stop = false; + int i, j, m, n; + double *fvals; + mxLogical *sur; + + m=static_cast<int>(x.size()); + n=(*(x.begin()))->size(); + + if ( m !=list_count_eval.size()) + { + mexPrintf("NomadMex Evaluator: inconsistent size of list" ); + //Force exit + raise(SIGINT); + return false; + } + + + //Check for Ctrl-C + if ( utIsInterruptPending() ) + { + utSetInterruptPending(false); /* clear Ctrl-C status */ + mexPrintf("\nCtrl-C Detected. Exiting NOMAD...\n\n"); + list_count_eval.assign(m,false); + raise(SIGINT); + return false; + } + + + fun->prhs[fun->xrhs] = mxCreateDoubleMatrix(m, n, mxREAL); //x + double *List_x = mxGetPr(fun->prhs[fun->xrhs]); + std::list<NOMAD::Eval_Point *>::iterator it_x=x.begin(); + j=0; + for (it_x=x.begin();it_x!=x.end();++it_x,++j) + for(i=0;i<n;i++) + List_x[i*m+j] = (*(*it_x))[i].value(); + + + //Add Surrogate if present and requested + if( hasSur ) + { + sur=mxGetLogicals(fun->prhs[fun->xrhs+1]); + ( x.front()->get_eval_type()==NOMAD::SGTE )? *sur=true:*sur=false; // all evaluations in a list have the same eval_type + } + + + // Count eval for bbox + // The case where the evaluation is rejected by user (and should not be counted) is not managed in the matlab version + list_count_eval.assign(m,true); + + + //Call MATLAB Objective + try + { + mexCallMATLAB(1, fun->plhs, fun->nrhs, fun->prhs, fun->f); + } + + //Note if these errors occur it is due to errors in MATLAB code, no way to recover? + catch(exception &e) + { + sprintf(errstr,"Unrecoverable Error from Objective / Blackbox Callback:\n%sExiting NOMAD...\n\n",e.what()); + mexPrintf(errstr); + //Force exit + raise(SIGINT); + return false; + } + catch(...) + { + mexPrintf("Unrecoverable Error from Objective / Blackbox Callback, Exiting NOMAD...\n\n"); + //Force exit + raise(SIGINT); + return false; + } + + //Check we got the correct number of elements back + if(mxGetNumberOfElements(fun->plhs[0]) > (nobj+ncon)*m) + mexPrintf("Black box returns more elements than required. Please provide a BB_OUTPUT_TYPE consistent with your black box function or correct the black box function."); + else if(mxGetNumberOfElements(fun->plhs[0]) < (nobj+ncon)*m) + { + mexPrintf("Insufficient outputs provided by the black box function. Exiting NOMAD...\n\n"); + raise(SIGINT); + return false; + } + else if(mxGetM(fun->plhs[0]) != m ) + { + mexPrintf("Insufficient number of rows in the output of the black box function. The number of rows should be equal to the size of the block of evaluations. Exiting NOMAD...\n\n"); + raise(SIGINT); + return false; + } + else if(mxGetN(fun->plhs[0]) != (nobj+ncon) ) + { + mexPrintf("Insufficient number of columns in the output of the black box function. The number of columns should be the number of objectives plus the number of constraints. Exiting NOMAD...\n\n"); + raise(SIGINT); + return false; + } + + + + //Assign bb output + fvals = mxGetPr(fun->plhs[0]); + j=0; + for (it_x=x.begin();it_x!=x.end();++it_x,++j) + for(i=0;i<(nobj+ncon);i++) + (*it_x)->set_bb_output(i,fvals[m*i+j]); + + //Iteration Callback + if(iterF->enabled) + { + iterF->plhs[0] = NULL; + memcpy(mxGetData(iterF->prhs[1]), &citer, sizeof(int)); + memcpy(mxGetPr(iterF->prhs[2]), fvals, m*(nobj+ncon)*sizeof(double)); + memcpy(mxGetPr(iterF->prhs[3]), List_x, n * m * sizeof(double)); + try { + mexCallMATLAB(1, iterF->plhs, 4, iterF->prhs, iterF->f); + } + catch (...) + { + mexPrintf("Unrecoverable Error from Iteration Callback, Exiting NOMAD...\n\n"); + //Force exit + raise(SIGINT); + return false; + } + + //Collect return argument + stop = *(bool*)mxGetData(iterF->plhs[0]); + //Clean up Ptr + mxDestroyArray(iterF->plhs[0]); + + } + + //Add Function Eval Counter + citer++; + + // Clean up LHS Fun Ptr + mxDestroyArray(fun->plhs[0]); + + //Check for iterfun stop + if(stop) + { + mexPrintf("\nIterFun Called Stop. Exiting NOMAD...\n\n"); + raise(SIGINT); + return false; + } + else + return true; + } + + + + //Function + Constraint Evaluation + bool eval_x(NOMAD::Eval_Point &x, const NOMAD::Double &h_max, bool &count_eval) + { + char errstr[1024]; + bool stop = false; + int i, n = static_cast<int>(x.size()); + double *xm, *fvals; + mxLogical *sur; + count_eval = true; //mexErrMsgTxt will kill MEX + + //Check for Ctrl-C + if ( utIsInterruptPending() ) + { + utSetInterruptPending(false); /* clear Ctrl-C status */ + mexPrintf("\nCtrl-C Detected. Exiting NOMAD...\n\n"); + count_eval = false; + raise(SIGINT); + return false; + } + + //Blackbox / Objective Evaluation + xm = mxGetPr(fun->prhs[fun->xrhs]); + for(i=0;i<n;i++) + xm[i] = x[i].value(); + + //Add Surrogate if present and requested + if( hasSur ) + { + sur=mxGetLogicals(fun->prhs[fun->xrhs+1]); + (x.get_eval_type()==NOMAD::SGTE)? *sur=true:*sur=false; + } + + //Call MATLAB Objective + try + { + mexCallMATLAB(1, fun->plhs, fun->nrhs, fun->prhs, fun->f); + } + //Note if these errors occur it is due to errors in MATLAB code, no way to recover? + catch(exception &e) + { + sprintf(errstr,"Unrecoverable Error from Objective / Blackbox Callback:\n%sExiting NOMAD...\n\n",e.what()); + mexWarnMsgTxt(errstr); + //Force exit + raise(SIGINT); + return false; + } + catch(...) + { + mexPrintf("Unrecoverable Error from Objective / Blackbox Callback, Exiting NOMAD...\n\n"); + //Force exit + raise(SIGINT); + return false; + } + +#ifdef OPTI_VERSION + //Check we got the correct number back + if( mxGetM(fun->plhs[0]) != nobj ) + mexErrMsgTxt("Incorrect number of elements returned from the objective function"); + + //Set Objective (Or multi-objective) + fvals = mxGetPr(fun->plhs[0]); + for( i=0 ; i<nobj ; i++ ) + x.set_bb_output( i,fvals[i] ); + + //Constraint Evaluation + if( ncon ) + { + con->plhs[0] = NULL; + xm = mxGetPr(con->prhs[con->xrhs]); + for(i=0;i<n;i++) + xm[i] = x[i].value(); + //Call MATLAB Constraint + try + { + mexCallMATLAB(1, con->plhs, con->nrhs, con->prhs, con->f); + } + catch(...) + { + mexWarnMsgTxt("Unrecoverable Error from Constraint Callback, Exiting NOMAD...\n\n"); + //Force exit + raise(SIGINT); + return false; + } + //Check we got the correct number back + if(mxGetM(con->plhs[0]) != ncon) + mexErrMsgTxt("Incorrect number of elements returned from nonlinear constraint function"); + + //Set Constraints + double *cons = mxGetPr(con->plhs[0]); + for(i=0,j=nobj;i<ncon;i++,j++) + x.set_bb_output(j,cons[i] - con->nlrhs[i]); //subtract nlrhs + + // Clean up LHS Ptr + mxDestroyArray(con->plhs[0]); + } +#else //GERAD VERSION + //Check we got the correct number of elements back + if( mxGetNumberOfElements(fun->plhs[0]) > nobj+ncon ) + mexWarnMsgTxt("Black box returns more elements than required. Please provide a BB_OUTPUT_TYPE consistent with your black box function"); + else if( mxGetNumberOfElements(fun->plhs[0]) < nobj+ncon ) + { + mexPrintf("Insufficient outputs provided by the black box function. Exiting NOMAD...\n\n"); + raise(SIGINT); + return false; + } + //Assign bb output + fvals = mxGetPr(fun->plhs[0]); + for(i=0;i<(nobj+ncon);i++) + x.set_bb_output(i,fvals[i]); + +#endif + + //Iteration Callback + if(iterF->enabled) + { + iterF->plhs[0] = NULL; + memcpy(mxGetData(iterF->prhs[1]), &citer, sizeof(int)); + memcpy(mxGetPr(iterF->prhs[2]), fvals, sizeof(double)); + memcpy(mxGetPr(iterF->prhs[3]), xm, n * sizeof(double)); + try { + mexCallMATLAB(1, iterF->plhs, 4, iterF->prhs, iterF->f); + } + catch (...) + { + mexPrintf("Unrecoverable Error from Iteration Callback, Exiting NOMAD...\n\n"); + //Force exit + raise(SIGINT); + return false; + } + + //Collect return argument + stop = *(bool*)mxGetData(iterF->plhs[0]); + //Clean up Ptr + mxDestroyArray(iterF->plhs[0]); + } + + //Add Function Eval Counter + citer++; + + // Clean up LHS Fun Ptr + mxDestroyArray(fun->plhs[0]); + + //Check for iterfun stop + if(stop) + { + mexPrintf("\nIterFun Called Stop. Exiting NOMAD...\n\n"); + count_eval = false; + raise(SIGINT); + return false; + } + else + return true; + } +}; + +//MATLAB MultiObj Evaluator Class +class matlabMEval : public NOMAD::Multi_Obj_Evaluator { +private: + matlabEval *mEval; +public: + //Constructor + matlabMEval(const NOMAD::Parameters &p, usrFcn *_obj, int _nobj, usrFcn *_con, int _ncon, iter_fun_data *_iterF) : NOMAD::Multi_Obj_Evaluator(p) + { + mEval = new matlabEval(p,_obj,_nobj,_con,_ncon,_iterF); + } + //Destructor + ~matlabMEval(void) + { + delete mEval; + } + //Function + Constraint Information + bool eval_x(NOMAD::Eval_Point &x, const NOMAD::Double &h_max, bool &count_eval) + { + return mEval->eval_x(x,h_max,count_eval); + } + //Function + Constraint Information + bool eval_x(std::list<NOMAD::Eval_Point *> &x, const NOMAD::Double &h_max, std::list<bool> & list_count_eval ) + { + return mEval->eval_x(x,h_max,list_count_eval); + } +}; + +//cout Redirection +struct printfbuf : std::streambuf { +public: + //Constructor + printfbuf() + { + setp(m_buffer, m_buffer + s_size - 2); + } +private: + enum { s_size = 1024 }; //not sure on this size + char m_buffer[s_size]; + int_type overflow(int_type c) + { + if (!traits_type::eq_int_type(c, traits_type::eof())) + { + *pptr() = traits_type::to_char_type(c); + pbump(1); + } + return sync() != -1 ? traits_type::not_eof(c) : traits_type::eof(); + } + + int sync() + { + *pptr() = 0; + mexPrintf(pbase()); + mexEvalString("drawnow;"); + setp(m_buffer, m_buffer + s_size - 2); + return 0; + } +}; + + +static printfbuf buf; + +// Main Entry Function +// ----------------------------------------------------------------- +void mexFunction (int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) +{ + //Input Args + usrFcn fun, con; + double *x0, *lb = NULL, *ub = NULL; + char *xtype = NULL; + + //Outputs Args + double *exitflag, *iter, *nfval; + + //Internal Vars + size_t ndec; + int i, nobj = 1, ncon = 0; + char errstr[1024]; //used for returning error info + iter_fun_data iterF; + neighborsFcn neighborsF; + + //Check user inputs + if( !checkInputs(prhs,nrhs,plhs,nlhs) ) + return; + + //Redirect cout + std::cout.rdbuf(&buf); //redirect buffer + + //NOMAD Vars + NOMAD::Mads *mads; + NOMAD::Display out(std::cout); + NOMAD::Parameters p(out); + NOMAD::Point px0; + NOMAD::Double *nx0; + NOMAD::stop_type stopflag; + + //Evaluator Vars + matlabEval *mSEval = NULL; + matlabMEval *mBEval = NULL; + + + // Extended Poll Vars + Matlab_Extended_Poll *mEP = NULL; + + //Set Option Defaults + int printLevel = 0; + char *paramfile = NULL; + mxArray *bb_out_type = NULL; + iterF.enabled = false; + neighborsF.enabled=false; + + //Get Size + ndec = mxGetNumberOfElements(pX0); + + //Get Blackbox / Objective Function Handle + if ( mxIsChar(pFUN) ) + { + if( mxGetString(pFUN, fun.f, FLEN) != 0 ) + mexErrMsgTxt("error reading objective name string"); + fun.nrhs = 1; + fun.xrhs = 0; + } + else + { + fun.prhs[0] = (mxArray*)pFUN; + strcpy(fun.f, "feval"); + fun.nrhs = 2; + fun.xrhs = 1; + } + fun.prhs[fun.xrhs] = mxCreateDoubleMatrix( ndec, 1, mxREAL ); //x + + //Get x0 + x0 = mxGetPr(pX0); + + //Get xtype + if( nrhs > eXTYPE && !mxIsEmpty(pXTYPE) ) + xtype = mxArrayToString(pXTYPE); + + //Get MEX Options if specified + if( nrhs > eOPTS && !mxIsEmpty(pOPTS) ) + { + if( mxGetField(pOPTS,0,"display_degree") && !mxIsEmpty(mxGetField(pOPTS,0,"display_degree")) ) + printLevel = (int)*mxGetPr(mxGetField(pOPTS,0,"display_degree")); + if( mxGetField(pOPTS,0,"param_file") && !mxIsEmpty(mxGetField(pOPTS,0,"param_file")) ) + paramfile = mxArrayToString(mxGetField(pOPTS,0,"param_file")); + if( mxGetField(pOPTS,0,"bb_output_type") && !mxIsEmpty(mxGetField(pOPTS,0,"bb_output_type")) ) + bb_out_type = mxGetField(pOPTS,0,"bb_output_type"); + if( mxGetField(pOPTS,0,"iterfun") && !mxIsEmpty(mxGetField(pOPTS,0,"iterfun")) ) + { + iterF.prhs[0] = (mxArray*)mxGetField(pOPTS,0,"iterfun"); + strcpy(iterF.f, "feval"); + iterF.enabled = true; + iterF.prhs[1] = mxCreateNumericMatrix(1,1,mxINT32_CLASS,mxREAL); + iterF.prhs[2] = mxCreateDoubleMatrix(1,1,mxREAL); + iterF.prhs[3] = mxCreateDoubleMatrix(ndec,1,mxREAL); + } + + if(mxGetField(pOPTS,0,"neighbors_mat") && !mxIsEmpty(mxGetField(pOPTS,0,"neighbors_mat"))) + { + strcpy(neighborsF.f, "feval"); + neighborsF.enabled = true; + neighborsF.prhs[0] = (mxArray*)mxGetField(pOPTS,0,"neighbors_mat"); + neighborsF.prhs[1] = mxCreateDoubleMatrix(ndec,1,mxREAL); + } + + } + + + //Setup ndec + p.set_DIMENSION((int)ndec); + + //Warn if >1000 + if(ndec > 1000 && printLevel) + { + sprintf(errstr,"Warning: NOMAD is designed for problems with less than 1000 variables. Your model has %d.\nWhile unlikely, it is possible that NOMAD may not perform as intended on this problem.",static_cast<int>(ndec)); + mexWarnMsgTxt(errstr); + } + + //Setup Lower Bounds + if( nrhs > eLB && !mxIsEmpty(pLB) ) + { + NOMAD::Point ptLB; + NOMAD::Double *dLB = new NOMAD::Double[ndec]; + lb = mxGetPr(pLB); + + for(i=0;i<ndec;i++) + { + if(!mxIsInf(lb[i])) //if not initialized will not be used + dLB[i] = lb[i]; + } + ptLB.set((int)ndec,dLB); + p.set_LOWER_BOUND(ptLB); + delete [] dLB; + } + + //Setup Upper Bounds + if( nrhs > eUB && !mxIsEmpty(pUB) ) + { + NOMAD::Point ptUB; + NOMAD::Double *dUB = new NOMAD::Double[ndec]; + ub = mxGetPr(pUB); + for(i=0;i<ndec;i++) + { + if(!mxIsInf(ub[i])) //if not initialized will not be used + dUB[i] = ub[i]; + } + ptUB.set((int)ndec,dUB); + p.set_UPPER_BOUND(ptUB); + delete [] dUB; + } + + //Setup x0 + nx0 = new NOMAD::Double[ndec]; + +#ifdef OPTI_VERSION + double xl, xu; + //If integer variables declared, need to ensure x0[i] is an integer + if( xtype ) + { + for(i=0;i<ndec;i++) + { + switch(tolower(xtype[i])) + { + case 'c': + //Ensure within bounds + if(lb && x0[i] < lb[i]) + nx0[i] = lb[i]; + else if(ub && x0[i] > ub[i]) + nx0[i] = ub[i]; + else + nx0[i] = x0[i]; //no rounding + break; + case 'i': + case 'b': + xl = floor(x0[i]); //First round is a floor + + //If lower bounds exist + if( lb ) + { + //if lower bound broken + if( xl < lb[i] ) + { + xu = ceil(x0[i]); + //If upper bounds exist, check bound directions + if( ub && xu > ub[i] ) + { //if broken, no integer x0 exists + sprintf(errstr,"x0[%d] cannot be rounded to an integer value between lb: %g, ub %g",i,lb[i],ub[i]); + mexErrMsgTxt(errstr); + } + if( xu != x0[i] ) + { //If we changed something, warn user + sprintf(errstr,"x0[%d] was rounded up to %g to suit NOMAD interface",i,xu); + mexWarnMsgTxt(errstr); + } + //Save ceil value + nx0[i] = xu; + } + //Floor value did not break lower bounds, value OK + else + { + if( xl != x0[i] ) + { //If we changed something, warn user + sprintf(errstr,"x0[%d] was rounded down to %g to suit NOMAD interface",i,xl); + mexWarnMsgTxt(errstr); + } + //Save floor value + nx0[i] = xl; + } + } + //No lower bounds, floor value assumed OK + else { + if( xl != x0[i] ) + { //If we changed something, warn user + sprintf(errstr,"x0[%d] was rounded down to %g to suit NOMAD interface",i,xl); + mexWarnMsgTxt(errstr); + } + //Save floor value + nx0[i] = xl; + } + break; + case 'r': + mexErrMsgTxt("Please specify continuous (real) variables using 'c' (as opposed to 'r') when using the OPTI version"); + break; + default: + sprintf(errstr,"Unknown xtype[%d] character: %c\n\nValid options are 'C', 'I', or 'B'\n",i,xtype[i]); + mexErrMsgTxt(errstr); + } + } + } + //Else user start position within bounds + else + { + for(i=0;i<ndec;i++) + { + if( lb && x0[i] < lb[i] ) + nx0[i] = lb[i]; + else if(ub && x0[i] > ub[i]) + nx0[i] = ub[i]; + else + nx0[i] = x0[i]; + } + } + +#else //GERAD VERSION - no x0 checking + for(i=0;i<ndec;i++) + nx0[i] = x0[i]; +#endif + px0.set((int)ndec,nx0); + p.set_X0(px0); + delete [] nx0; + +#ifdef OPTI_VERSION + //Setup Nonlinear Constraints + if( nrhs > eNLCON && !mxIsEmpty(pNLCON) ) + { + if ( mxIsChar(pNLCON) ) + { + if(mxGetString(pNLCON, con.f, FLEN) != 0) + mexErrMsgTxt("error reading constraint name string"); + con.nrhs = 1; + con.xrhs = 0; + } + else + { + con.prhs[0] = (mxArray*)pNLCON; + strcpy(con.f, "feval"); + con.nrhs = 2; + con.xrhs = 1; + } + con.prhs[con.xrhs] = mxCreateDoubleMatrix(ndec, 1, mxREAL); //x + if(nrhs < eNLRHS+1 || mxIsEmpty(pNLRHS)) + {//we will default to <= 0 + ncon = -1; + con.nlrhs = NULL; + } + else + { + ncon = (int)mxGetNumberOfElements(pNLRHS); + con.nlrhs = mxGetPr(pNLRHS); + } + } + //Setup Input Variable Types + if(xtype) + p.set_BB_INPUT_TYPE(detInTypes(xtype,ndec)); + + //Setup Evaluation Return Types + #'s of Obj + Con + p.set_BB_OUTPUT_TYPE(detRetTypes(&fun,bb_out_type,&nobj,&con,&ncon,x0,ndec)); + + //Set All Normal NOMAD Options + p.set_DISPLAY_DEGREE(0); //default + +#endif //GERAD Version does not have a separate constraint handler and handles input and output types using options + + // Make sure that evaluation numbers are reset + NOMAD::Eval_Point::reset_tags_and_bbes(); + + // The seed will always be to its default value + NOMAD::RNG::reset_private_seed_to_default(); + + // The warning display parameter should be reset every run + NOMAD::Parameters::reset_display_warning ( ); + + //Set User Options + if( nrhs > eOPTS && !mxIsEmpty(pOPTS) ) + setNOMADopts(p,pOPTS); + else + setNOMADopts(p,NULL); + + //If the user has specified a parameter file to read, see if it exists, and if so, read and parse it. + if( paramfile ) + { + FILE *pFile = fopen(paramfile,"r"); + if(pFile==NULL) + { + sprintf(errstr,"Cannot open parameter file: %s\n\nEnsure it exists!",paramfile); + mexErrMsgTxt(errstr); + } + else + { + fclose(pFile); //close file pointer (we don't need it) + try + { + p.read(paramfile); + } + catch(exception &e) + { + sprintf(errstr,"NOMAD Parameter File Read Error:\n\n%s",e.what()); + mexErrMsgTxt(errstr); + } + } + } + + //Check NOMAD parameters + try + { + p.check(); + } + catch(exception &e) + { + sprintf(errstr,"NOMAD Parameter Error:\n\n%s",e.what()); + mexErrMsgTxt(errstr); + } + + //If GERAD version, obtain number of objectives and constraints from parameters +#ifndef OPTI_VERSION + nobj=p.get_nb_obj(); + ncon=(int)p.get_bb_output_type().size()-nobj; + if ( p.has_sgte() ) + { + fun.prhs[fun.xrhs+1] = mxCreateLogicalMatrix(1,1); //extra logical indicating surrogate or not + fun.nrhs++; + } +#endif + + + // Get additional bb param if specified + if ( nrhs > ePARAM && ! mxIsEmpty(pParam) ) + { + fun.nrhs++; + + if ( p.has_sgte() ) + fun.prhs[fun.xrhs+2]=mxDuplicateArray(pParam); + else + fun.prhs[fun.xrhs+1]=mxDuplicateArray(pParam); + } + + + //Print Header + if(printLevel) + { + mexPrintf("\n------------------------------------------------------------------\n"); + mexPrintf(" This is NOMAD v%s\n",NOMAD::VERSION.c_str()); + mexPrintf(" Authors: C. Audet, S. Le Digabel and C. Tribes\n"); +#ifdef OPTI_VERSION + mexPrintf(" MEX Interface (OPTI) J. Currie 2012\n\n"); +#else + mexPrintf(" MEX Interface (GERAD) J. Currie 2012 and C. Tribes 2017 \n\n"); +#endif + mexPrintf(" Problem Properties:\n"); + mexPrintf(" # Decision Variables: %4d\n",ndec); + mexPrintf(" # Number of Objectives: %4d\n",nobj); + mexPrintf(" # Number of Nonlinear Constraints: %4d\n",ncon); + + mexPrintf("------------------------------------------------------------------\n"); + mexEvalString("drawnow;"); //flush draw buffer + } + + //Create evaluator and run mads based on number of objectives + try + { + if( nobj > 1 ) + { + mBEval = new matlabMEval(p,&fun,nobj,&con,ncon,&iterF); //Bi-Objective Evaluator + + if ( p.get_signature()->has_categorical() ) + { + mEP = new Matlab_Extended_Poll ( p , &neighborsF); + mads = new NOMAD::Mads(p, mBEval , mEP , NULL , NULL); //Run NOMAD + + } + else + mads = new NOMAD::Mads(p, mBEval); //Run NOM + + stopflag = mads->multi_run(); + } + else + { + mSEval = new matlabEval(p,&fun,nobj,&con,ncon,&iterF); //Single Objective Evaluator + + if ( p.get_signature()->has_categorical() ) + { + mEP = new Matlab_Extended_Poll ( p, &neighborsF); + mads = new NOMAD::Mads(p, mSEval , mEP , NULL , NULL); //Run NOMAD + + } + else + mads = new NOMAD::Mads(p, mSEval); //Run NOMAD + + stopflag = mads->run(); + + } + } + catch(exception &e) + { + + //Free Memory + if(mSEval) + delete mSEval; + mSEval = NULL; + if(mBEval) + delete mBEval; + mBEval = NULL; + delete mads; + if(xtype) + mxFree(xtype); + xtype = NULL; + + sprintf(errstr,"NOMAD Run Error:\n\n%s",e.what()); + mexErrMsgTxt(errstr); + } + + if(printLevel) + mexPrintf("------------------------------------------------------------------\n"); + + + //Create Outputs + plhs[2] = mxCreateDoubleMatrix(1,1, mxREAL); + plhs[3] = mxCreateDoubleMatrix(1,1, mxREAL); + plhs[4] = mxCreateDoubleMatrix(1,1, mxREAL); + plhs[5] = mxCreateDoubleMatrix(ndec,1, mxREAL); + plhs[6] = mxCreateDoubleMatrix(ndec,1, mxREAL); + + exitflag = mxGetPr(plhs[2]); + iter = mxGetPr(plhs[3]); + nfval = mxGetPr(plhs[4]); + + double *mesh_size=mxGetPr(plhs[5]); + + //Save mesh size + NOMAD::Point ms( static_cast<int>(ndec) ); + p.get_signature()->get_mesh()->get_delta(ms); + for(i=0;i<ndec;i++) + mesh_size[i] = ms[i].value(); + + double *poll_size=mxGetPr(plhs[6]); + //Save poll size + NOMAD::Point ps( static_cast<int>(ndec) ); + p.get_signature()->get_mesh()->get_Delta(ps); + for(i=0;i<ndec;i++) + poll_size[i] = ps[i].value(); + + if (nobj>1) + { + + NOMAD::Pareto_Front * pareto_front=mads->get_pareto_front(); + + if ( pareto_front ) + { + + int nb_pareto_pts = pareto_front->size(); + plhs[0] = mxCreateDoubleMatrix(ndec,nb_pareto_pts, mxREAL); + plhs[1] = mxCreateDoubleMatrix(nobj,nb_pareto_pts, mxREAL); + double *x = mxGetPr(plhs[0]); + double *fval = mxGetPr(plhs[1]); + + const NOMAD::Eval_Point * cur = pareto_front->begin(); + int i=0; + while ( cur ) + { + + if ( cur->is_eval_ok() && cur->is_feasible ( p.get_h_min() ) ) + { + const std::list<int> & index_obj = p.get_index_obj(); + std::list<int>::const_iterator it , end = index_obj.end(); + const NOMAD::Point & bbo = cur->get_bb_outputs(); + int j = 0; + NOMAD::Point multi_obj ( static_cast<int>(index_obj.size()) ); + + for ( it = index_obj.begin() ; it != end ; ++it,j++ ) + fval[nobj*i+j] = bbo[*it].value(); + + for(j=0;j<ndec;j++) + x[ndec*i+j] = (*cur)[j].value(); + } + cur = pareto_front->next(); + i++; + } + *exitflag = getStatus(stopflag); + + } + else + { + stopflag = (NOMAD::stop_type)10; + *exitflag = -1; //No solution + } + //Save Status & Iterations + + *iter = mads->get_stats().get_iterations(); + *nfval = mads->get_stats().get_bb_eval(); + + } + else + { + + plhs[0] = mxCreateDoubleMatrix(ndec,1, mxREAL); + plhs[1] = mxCreateDoubleMatrix(1,1, mxREAL); + double *x = mxGetPr(plhs[0]); + double *fval = mxGetPr(plhs[1]); + + + const NOMAD::Eval_Point *bestSol = mads->get_best_feasible(); + if(bestSol == NULL) + { + bestSol = mads->get_best_infeasible(); + //manually set as infeasible (no infeasible stop flag) + stopflag = (NOMAD::stop_type)10; + } + if(bestSol == NULL) + *exitflag = -1; //No solution + + //If we have a solution, save it + if(*exitflag != -1) + { + //Save x + NOMAD::Point pt(*bestSol); + for(i=0;i<ndec;i++) + x[i] = pt[i].value(); + //Save fval + *fval = bestSol->get_f().value(); + + //Save Status & Iterations + *exitflag = getStatus(stopflag); + *iter = mads->get_stats().get_iterations(); + *nfval = mads->get_stats().get_bb_eval(); + + } + } + + + //Return error control to default + mexSetTrapFlag(0); + + + //Free Memory + if(mSEval) + delete mSEval; + mSEval = NULL; + if(mBEval) + delete mBEval; + mBEval = NULL; + + // Clean up of fun + mxDestroyArray(fun.prhs[fun.xrhs]); + + delete mads; + + if(xtype) + mxFree(xtype); + xtype = NULL; +} + +//Determine Variable Return Types + # Objectives + #NL Constraints (only OPTI Version) +vector<NOMAD::bb_output_type> detRetTypes(usrFcn *fun, mxArray *out_types, int *nobj, usrFcn *con, int *ncon, double *x0, size_t n) +{ + int i, j, stat; + + //Test Blackbox / Objective Evaluation + fun->plhs[0] = NULL; + memcpy(mxGetPr(fun->prhs[fun->xrhs]), x0, n * sizeof(double)); + + //Call MATLAB Objective + stat = mexCallMATLAB(1, fun->plhs, fun->nrhs, fun->prhs, fun->f); + if(stat) + mexErrMsgTxt("Error calling Objective Function!"); + //Ensure we have a real column + if( mxGetN(fun->plhs[0]) > mxGetM(fun->plhs[0]) ) + mexErrMsgTxt("The objective function must return a scalar or column vector"); + if( mxIsSparse(fun->plhs[0]) || mxIsComplex(fun->plhs[0]) ) + mexErrMsgTxt("The objective function must return a real, dense, vector"); + + //Ensure 1 or 2 rows (max of bi-objective) + *nobj = (int)mxGetNumberOfElements(fun->plhs[0]); + if( *nobj < 1 || *nobj > 2 ) + mexErrMsgTxt("The objective function must return a scalar or 2x1 vector (bi-objective)"); + + // Clean up LHS Ptr + mxDestroyArray(fun->plhs[0]); + + //Test Constraint Evaluation + if( *ncon ) + { + con->plhs[0] = NULL; + memcpy(mxGetPr(con->prhs[con->xrhs]), x0, n * sizeof(double)); + //Call MATLAB Objective + stat = mexCallMATLAB(1, con->plhs, con->nrhs, con->prhs, con->f); + if( stat ) + mexErrMsgTxt("Error calling Constraint Function!"); + //Ensure we have a real column + if( mxGetN(con->plhs[0]) > mxGetM(con->plhs[0]) ) + mexErrMsgTxt("The constraint function must return a scalar or column vector"); + if( mxIsSparse(con->plhs[0]) || mxIsComplex(con->plhs[0]) ) + mexErrMsgTxt("The constraint function must return a real, dense, vector"); + + //If we have nlrhs, check against returned vector + if(*ncon > 0) + { + if(mxGetM(con->plhs[0]) != *ncon) + mexErrMsgTxt("The vector returned from nlcon is not the same length as nlrhs!"); + } + else + { + *ncon = (int)mxGetM(con->plhs[0]); + con->nlrhs = mxGetPr(mxCreateDoubleMatrix(*ncon,1, mxREAL)); //create dummy rhs + } + // Clean up LHS Ptr + mxDestroyArray(con->plhs[0]); + } + + //Create Return Vector + vector<NOMAD::bb_output_type> varType(*nobj+*ncon); + //Fill Objective Information + for(i=0;i<*nobj;i++) + varType[i] = NOMAD::OBJ; + //If the user has set bb_output_type use it to set constraint types + if( out_types ) + { + if( !mxIsCell(out_types) ) + mexErrMsgTxt("Parameter bb_output_type must be a cell array of strings."); + if( mxGetNumberOfElements(out_types) != *ncon ) + mexErrMsgTxt("You must specify a bb_output_type for each element returned by the constraint function (not objective)."); + //Process each element in the array + for(i=0,j=*nobj;i<*ncon;i++,j++) + { + mxArray *ctype = mxGetCell(out_types,i); + if(!mxIsChar(ctype)) + mexErrMsgTxt("An element in the bb_output_type paramter is not a string"); + //Get the string + char *str = mxArrayToString(ctype); + //Set varType based on string + varType[j] = getOutEnum(str); + //Free local memory at each iteration + mxFree(str); + } + } + //Or Fill Constraint Information as Default all PB + else { + for(i=0,j=*nobj;i<*ncon;i++,j++) + varType[j] = NOMAD::PB; + } + + return varType; +} + +//Convert user string to NOMAD bb_output_type enum +NOMAD::bb_output_type getOutEnum(char *str) +{ + char errstr[1024]; + lower(str); //convert to lowercase + + if(!strcmp(str,"obj")) +#ifdef OPTI_VERSION + mexErrMsgTxt("The OPTI Version of NOMAD uses bb_output_type to describe CONSTRAINTS ONLY. Please remove any OBJ terms from the cell array."); +#else + return NOMAD::OBJ; +#endif + else if(!strcmp(str,"pb")) + return NOMAD::PB; + else if(!strcmp(str,"eb")) + return NOMAD::EB; + else if(!strcmp(str,"peb")) + return NOMAD::PEB_P; + else if(!strcmp(str,"f")) + return NOMAD::FILTER; + else if(!strcmp(str,"nothing") || !strcmp(str,"-")) + return NOMAD::UNDEFINED_BBO; + else { + sprintf(errstr,"Unknown BB_OUTPUT_TYPE %s",str); + mexErrMsgTxt(errstr); + } + //Default + return NOMAD::UNDEFINED_BBO; +} + +//Convert input string to lowercase +void lower(char *str) +{ + int i = 0; + while(str[i]) + { + str[i] = tolower(str[i]); + i++; + } +} + +//Determine input variable types (only OPTI version) +vector<NOMAD::bb_input_type> detInTypes(char *xtype, size_t n) +{ + int i; + char msgbuf[1024]; + vector<NOMAD::bb_input_type> varType(n); + for(i=0;i<n;i++) + { + switch(tolower(xtype[i])) + { + case 'c': + varType[i] = NOMAD::CATEGORICAL; break; + case 'r': + varType[i] = NOMAD::CONTINUOUS; break; + mexErrMsgTxt("Please specify continuous (real) variables using 'c' when using the OPTI version"); // C-> categorical (not implemented in Matlab version) R-> continuous/real ! + case 'i': + varType[i] = NOMAD::INTEGER; break; + case 'b': + varType[i] = NOMAD::BINARY; break; + default: + sprintf(msgbuf,"Unknown xtype[%d] character: %c\n\nValid options are 'C', 'I', or 'B'\n",i,xtype[i]); + mexErrMsgTxt(msgbuf); + } + } + return varType; +} + +//User Input Checking + Version / Info / Help +int checkInputs(const mxArray *prhs[], int nrhs, mxArray *plhs[], int nlhs) +{ + size_t ndec; + char *str = NULL; + + //MEX Display Version (OPTI compatibility) + if (nrhs < 1) + { + if(nlhs < 1) + printSolverInfo(); + else + plhs[0] = mxCreateString(NOMAD::VERSION.c_str()); + return 0; + } + + //Redirect cout + std::streambuf *cout_sbuf = std::cout.rdbuf(); //keep existing buffer + std::cout.rdbuf(&buf); //redirect buffer + + //NOMAD Display + NOMAD::Display out (std::cout); + + //Check for display on options passed as structure + if(nrhs == 1 && mxIsStruct(prhs[0])) + { + int i, no = mxGetNumberOfFields(prhs[0]); + const char *field; + std::list<std::string> ls; + //For all fields, display nomad help + for(i=0;i<no;i++) + { + field = mxGetFieldNameByNumber(prhs[0],i); + string st(field); + ls.push_back ( st ); + } + if(no>0) + { + //NOMAD Display + NOMAD::Parameters p ( out ); + p.help(ls); + } + std::cout.rdbuf(cout_sbuf); //Return cout to initial buffer + return 0; + } + + //Check for Version / Information / Help Request + if(nrhs == 1 && mxIsChar(prhs[0])) + { + str = mxArrayToString(prhs[0]); + //Check for Info Request + if(!strcmp(str,"-I") || !strcmp(str,"-INFO") || !strcmp(str,"-i") || !strcmp(str,"-info")) + { + //Information to Print + mexPrintf("\nNOMAD Blackbox Optimization Software, v%s\n\n",NOMAD::VERSION.c_str()); + mexPrintf("NOMAD - version %s has been created by {\n",NOMAD::VERSION.c_str()); + mexPrintf(" Charles Audet - Ecole Polytechnique de Montreal\n"); + mexPrintf(" Sebastien Le Digabel - Ecole Polytechnique de Montreal\n"); + mexPrintf(" Christophe Tribes - Ecole Polytechnique de Montreal\n}\n\n"); + mexPrintf("The copyright of NOMAD - version %s is owned by {\n",NOMAD::VERSION.c_str()); + mexPrintf(" Sebastien Le Digabel - Ecole Polytechnique de Montreal\n"); + mexPrintf(" Christophe Tribes - Ecole Polytechnique de Montreal\n}\n\n"); + mexPrintf("NOMAD version 3 is a new version of Nomad v1 and v2, it has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto and \n IVADO."); + mexPrintf("Nomad v1 and v2 were created and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. Dennis Jr.,\n"); + mexPrintf(" and were funded by AFOSR and Exxon Mobil.\n\n"); + mexPrintf("Web : www.gerad.ca/nomad\n"); + mexPrintf("License : \'%s\'\n",NOMAD::LGPL_FILE.c_str()); + mexPrintf("User guide: \'%s\'\n",NOMAD::USER_GUIDE_FILE.c_str()); + mexPrintf("Examples : \'%s\'\n",NOMAD::EXAMPLES_DIR.c_str()); + mexPrintf("Tools : \'%s\'\n\n",NOMAD::TOOLS_DIR.c_str()); + mexPrintf("Please report bugs to nomad@gerad.ca\n\n"); + + std::cout.rdbuf(cout_sbuf); //Return cout to initial buffer + return 0; + } + //Check for Ver Request + if(!strcmp(str,"-V") || !strcmp(str,"-v") || !strcmp(str,"-version")) + { + mexPrintf("NOMAD - version %s - www.gerad.ca/nomad\n\n",NOMAD::VERSION.c_str()); +#ifdef OPTI_VERSION + mexPrintf("MEX Interface (OPTI) v%s\n",NOMADMEX_VERSION); +#else + mexPrintf("MEX Interface (GERAD) v%s\n",NOMADMEX_VERSION); +#endif + + std::cout.rdbuf(cout_sbuf); //Return cout to initial buffer + return 0; + } + //Check for Help Request + if (strcmp(str,"-H")<0 || strcmp(str,"-HELP")<0 || strcmp(str,"-h")<0 || strcmp(str,"-help")<0 ) + { + NOMAD::Parameters p ( out ); + std::list<std::string> helpS; + const char * toks=" "; + char *w = strtok(str,toks) ; + for ( w = strtok(NULL,toks) ; w != NULL ; w = strtok(NULL,toks) ) + { + helpS.push_back(w); + } + p.help (helpS ); + + std::cout.rdbuf(cout_sbuf); //Return cout to initial buffer + return 0; + } + } + + //Otherwise assume we have a normal problem + if(nrhs < 2) + mexErrMsgTxt("You must supply at least 2 arguments to nomad!\n\nnomad(fun,x0)\n"); + + //Check Types + if(!mxIsFunctionHandle(pFUN) && !mxIsChar(pFUN)) + mexErrMsgTxt("fun must be a function handle or function name!"); + + if(!mxIsDouble(pX0) || mxIsComplex(pX0) || mxIsEmpty(pX0)) + mexErrMsgTxt("x0 must be a real double column vector!"); + + //Get ndec + ndec = mxGetNumberOfElements(prhs[1]); + + //Check Bounds + if(nrhs > 2) + { + if(!mxIsDouble(pLB) || mxIsComplex(pLB)) + mexErrMsgTxt("lb must be a real double column vector!"); + if(nrhs > 3 && (!mxIsDouble(pUB) || mxIsComplex(pUB))) + mexErrMsgTxt("ub must be a real double column vector!"); + //Check Sizes + if(!mxIsEmpty(pLB) && (ndec != mxGetNumberOfElements(pLB))) + mexErrMsgTxt("lb is not the same length as x0! Ensure they are both Column Vectors"); + if(nrhs > 3 && !mxIsEmpty(pUB) && (ndec != mxGetNumberOfElements(pUB))) + mexErrMsgTxt("ub is not the same length as x0! Ensure they are both Column Vectors"); + } + +#ifdef OPTI_VERSION + //Version check + if(nrhs > eNLRHS && mxIsStruct(pNLRHS)) + mexErrMsgTxt("It appears you may be calling NOMAD using the GERAD NOMAD Syntax - nomad(bb,x0,lb,ub,opts). This is the OPTI NOMAD version and requires nomad(fun,x0,lb,ub,nlcon,nlrhs,xtype,opts)."); + + //Check Nonlinear Constraint Handle + if(nrhs > eNLCON && !mxIsEmpty(pNLCON)) + { + if(!mxIsFunctionHandle(pNLCON) && !mxIsChar(pNLCON)) + mexErrMsgTxt("nlcon must be a function handle or function name!"); + if(nrhs > eNLRHS && (!mxIsDouble(pNLRHS) || mxIsComplex(pNLRHS))) + mexErrMsgTxt("nlrhs must be a real double column vector!"); + } + //Check for xtype + if(nrhs > eXTYPE && !mxIsEmpty(pXTYPE)) + { + if(!mxIsChar(pXTYPE)) + mexErrMsgTxt("The xtype vector must be a char array!"); + if(ndec != mxGetNumberOfElements(pXTYPE)) + mexErrMsgTxt("xtype is not same length as x0! Ensure they are both Column Vectors"); + } +#else + //Version check + if(nrhs > 6) + mexErrMsgTxt("It appears you may be calling NOMAD using the OPTI NOMAD Syntax - nomad(fun,x0,lb,ub,nlcon,nlrhs,xtype,opts). This is the GERAD NOMAD version and requires nomad(bb,x0,lb,ub,opts)."); +#endif + + //Check Options + if(nrhs > eOPTS && !mxIsEmpty(pOPTS)) + { + //Version check + if(mxIsDouble(pOPTS)) + mexErrMsgTxt("It appears you may be calling NOMAD using the OPTI NOMAD Syntax - nomad(fun,x0,lb,ub,nlcon,nlrhs,xtype,opts). This is the GERAD NOMAD version and requires nomad(bb,x0,lb,ub,opts)."); + + if(!mxIsStruct(pOPTS)) + mexErrMsgTxt("The specified options must be a structure!"); + } + + //Return Continue + return 1; + +} + +void setNOMADopts(NOMAD::Parameters &p, const mxArray *opts) +{ + char strbuf[1024]; + int i, no = 0; + NOMAD::Parameter_Entries entries; + const char *field; + mxArray *value; + bool doAdd = false; + size_t m; + double val; + bool has_BB_OUTPUT_TYPE = false; + bool has_categorical =false; + + if(opts) + no = mxGetNumberOfFields(opts); + + //For each field, check if it's empty, if not, set it within NOMAD + for(i=0;i<no;i++) + { + field = mxGetFieldNameByNumber(opts,i); + value = mxGetFieldByNumber(opts,0,i); + + //Check we don't have an empty or MEX option + if( !mxIsEmpty(value) && isNMDOption(field) ) + { + //Switch on data type + switch( mxGetClassID(value) ) + { + + case mxDOUBLE_CLASS: + m = mxGetNumberOfElements(value); + //This interface doesn't write vectors as options + if(m > 1) + { + sprintf(strbuf,"This interface does not support vector options for parameter %s. Please provide it as a string",field); + mexErrMsgTxt(strbuf); + } + val = *mxGetPr(value); + //Check if we have an integer parameter (I assume this check is ok!) + if(floor(val) == val) + { + sprintf(strbuf,"%s %.0f",field,val); doAdd = true; //write with no decimal points and no exponent + } + else + {//write as double (exponent ok) + sprintf(strbuf,"%s %g",field,val); doAdd = true; + } + break; + case mxFUNCTION_CLASS: + if ( strcmp(field,"NEIGHBORS_MAT") == 0 || strcmp(field,"neighbors_mat") == 0 ) + { + // sprintf(strbuf,"%s %s",field,mxArrayToString(value)); + has_categorical = true; + } + break; + case mxCHAR_CLASS: + sprintf(strbuf,"%s %s",field,mxArrayToString(value)); + doAdd = true; + //GERAD check for BB_OUTPUT_TYPE + if ( strcmp(field,"BB_OUTPUT_TYPE") == 0 || strcmp(field,"bb_output_type") == 0 ) + has_BB_OUTPUT_TYPE = true; + break; + + case mxCELL_CLASS: +#ifdef OPTI_VERSION + //Add each string for the specified field + m = mxGetNumberOfElements(value); + for(j=0;j<m;j++) + { + mxArray *cellopt = mxGetCell(value,j); + if( !mxIsChar(cellopt) ) + { + sprintf(strbuf,"Element %d in the cell array of paramter %s is not a string",j+1,field); + mexErrMsgTxt(strbuf); + } + //Get the string and create the required option string + char *str = mxArrayToString(cellopt); + sprintf(strbuf,"%s %s",field,str); + + //Add to our set of parameter entries + NOMAD::Parameter_Entry *pe = new NOMAD::Parameter_Entry(strbuf); // pe will be deleted by ~Parameter_Entries() + if( pe->is_ok() ) + entries.insert(pe); + else + { + sprintf(strbuf,"Parameter %s has an error",field); + mexErrMsgTxt(strbuf); + } + + //Free local memory at each iteration + mxFree(str); + } +#else + sprintf(strbuf,"Parameter %s NOT SET!\nThe GERAD version of the NOMAD interface does not support cell arrays. Please specify them as strings, with spaces between arguments.",field); + mexWarnMsgTxt(strbuf); +#endif + break; + + default: + sprintf(strbuf,"Parameter %s NOT SET, CLASSID = %d which is not supported",field,mxGetClassID(value)); + mexWarnMsgTxt(strbuf); + } + + //If we have a valid parameter, add it to our set of entries + if( doAdd ) { + //mexPrintf("NOMAD Option set as: %s\n",strbuf); //enable for debug + NOMAD::Parameter_Entry *pe = new NOMAD::Parameter_Entry(strbuf); + if( pe->is_ok() ) + entries.insert(pe); // pe will be deleted by ~Parameter_Entries() + else + { + sprintf(strbuf,"Parameter %s has an error",field); + mexErrMsgTxt(strbuf); + } + + doAdd = false; + } + } + } + //GERAD default bb_output_type if not specified +#ifndef OPTI_VERSION + if( ! has_BB_OUTPUT_TYPE ) + { + NOMAD::Parameter_Entry *pe = new NOMAD::Parameter_Entry("BB_OUTPUT_TYPE OBJ"); + entries.insert(pe); // pe will be deleted by ~Parameter_Entries() + } +#endif + + try + { + p.read(entries); + } + catch(exception &e) + { + sprintf(strbuf,"NOMAD Parameter Read Error:\n\n%s",e.what()); + mexErrMsgTxt(strbuf); + } +} + +//Separates MEX interface options from NOMAD ones +bool isNMDOption(const char *field) +{ + if(!strcmp(field,"param_file")) + return false; + else if(!strcmp(field,"iterfun")) + return false; +#ifdef OPTI_VERSION + else if(!strcmp(field,"bb_output_type")) + return false; +#endif + else + return true; +} + +double getStatus(int stat) +{ + switch((int)stat) + { + case 5: //mesh minimum + case 8: //min mesh size + case 9: //min poll size + case 20: //ftarget reached + case 19: //feas reached + return 1; + break; + case 12: //max time + case 13: //max bb eval + case 14: //max sur eval + case 15: //max evals + case 16: //max sim bb evals + case 17: //max iter + case 23: //max multi bb evals + case 24: //max mads runs + return 0; + break; + case 10: //max mesh index + case 11: //mesh index limits + case 18: //max consec fails + case 25: //stagnation + case 26: //no pareto + case 27: //max cache memory + return -1; + case 6: //x0 fail + case 7: //p1_fail + return -2; + case 2: //Unknown stop reason + return -3; + case 3: //Ctrl-C + case 4: //User-stopped + return -5; + default: //Not assigned flag + return -3; + } +} + +//Print Solver Information +void printSolverInfo() +{ + mexPrintf("\n-----------------------------------------------------------\n"); + mexPrintf(" NOMAD: Nonlinear Optimization using the MADS Algorithm [v%s]\n",NOMAD::VERSION.c_str()); + mexPrintf(" - Released under the GNU Lesser General Public License: http://www.gnu.org/copyleft/lesser.html\n"); + mexPrintf(" - Source available from: https://www.gerad.ca/nomad/\n"); + + mexPrintf("\n MEX Interface J. Currie 2013 (www.i2c2.aut.ac.nz) and C. Tribes 2017 \n"); + mexPrintf("-----------------------------------------------------------\n"); +} diff --git a/examples/interfaces/Matlab_MEX/example_group_variables/param.txt b/examples/interfaces/Matlab_MEX/example_group_variables/param.txt index 91163e0b60621ce7282b6670cedddad0c70fac91..393c36d399c19a59cf3cf1797853a7f695d93888 100644 --- a/examples/interfaces/Matlab_MEX/example_group_variables/param.txt +++ b/examples/interfaces/Matlab_MEX/example_group_variables/param.txt @@ -1,2 +1,2 @@ -VARIABLE_GROUP 0 1 +VARIABLE_GROUP 0 1 VARIABLE_GROUP 2 3 \ No newline at end of file diff --git a/examples/interfaces/Matlab_MEX/example_group_variables/test.m b/examples/interfaces/Matlab_MEX/example_group_variables/test.m index 585abc01523e3561ced64582d068561344cc2bfe..ed2cc6eea3abff6b3b965368b025d0807fec9587 100644 --- a/examples/interfaces/Matlab_MEX/example_group_variables/test.m +++ b/examples/interfaces/Matlab_MEX/example_group_variables/test.m @@ -10,10 +10,10 @@ lb = [0;0;0;0]; x0 = [0;0;0;0]; opts = []; %not no nomadset just to keep user options -opts.display_degree = 3; +opts.display_degree = 2; opts.bb_output_type = 'OBJ PB PB PB'; opts.model_search = 'false'; opts.param_file='param.txt'; -opts.max_bb_eval = 20; +opts.max_bb_eval = 50; [xr,fval,ef,iter] = nomad(fun,x0,lb,ub,opts) \ No newline at end of file diff --git a/examples/interfaces/Matlab_MEX/example_int_variables/param.txt b/examples/interfaces/Matlab_MEX/example_int_variables/param.txt index 2e03401c8d1bd63d764d4a29bc8bfec7173505c4..be379bd9699202d9fb491972e0753777d1a6944b 100644 --- a/examples/interfaces/Matlab_MEX/example_int_variables/param.txt +++ b/examples/interfaces/Matlab_MEX/example_int_variables/param.txt @@ -1,3 +1,3 @@ -GRANULARITY 0-0 1 -GRANULARITY 3-3 1 +GRANULARITY 0-0 1 +GRANULARITY 3-3 1 INITIAL_MESH_SIZE 5 \ No newline at end of file diff --git a/examples/interfaces/Matlab_MEX/example_int_variables/run2.m b/examples/interfaces/Matlab_MEX/example_int_variables/run2.m deleted file mode 100644 index 934c0ca00d7bbed0f94928c3c4f62a30b4f80f62..0000000000000000000000000000000000000000 --- a/examples/interfaces/Matlab_MEX/example_int_variables/run2.m +++ /dev/null @@ -1,23 +0,0 @@ -%% PROBLEM 4 [fval = -2.5] -clc -fun = @(x) [-x(1) - x(2) - x(3); - (x(2) - 1./2.)*(x(2) - 1./2.) + (x(3) - 1./2.)*(x(3) - 1./2.) - 1/4; - x(1) - x(2); - x(1) + x(3) + x(4) - 2]; -ub = [1;10;10;5]; -lb = [0;0;0;0]; -x0 = [0;0;0;0]; - -opts = []; %just to keep user options -opts.display_degree = 2; -opts.bb_output_type = 'OBJ PB PB PB'; -opts.model_search = 'false'; -opts.model_eval_sort = 'false'; -opts.max_eval = 500; -opts.direction_type = 'ortho 2n'; -opts.param_file = 'param.txt'; -opts.anisotropic_mesh = 0; - -[xr,fval,ef,iter] = nomad(fun,x0,lb,ub,opts) - - diff --git a/examples/interfaces/Matlab_MEX/test_nomad_gerad.m b/examples/interfaces/Matlab_MEX/test_nomad_gerad.m index 47d8c88ede6ed621c61d5900723a6b39a9f407b0..d56a52b113ddfbdf6754cdf9a9623d42c365a1dd 100755 --- a/examples/interfaces/Matlab_MEX/test_nomad_gerad.m +++ b/examples/interfaces/Matlab_MEX/test_nomad_gerad.m @@ -1,151 +1,152 @@ -% GERAD VERSION TESTING - - -%% PROBLEM 1 -fun = @(x) (1-x(1))^2 + 100 *(x(2)-x(1)^2)^2; -x0 = [-2 1]'; -lb = [-Inf;-1.5]; -ub = [100;100]; -opts = nomadset('display_degree',2,'min_mesh_size','1e-004','initial_mesh_size','10'); - -% Start optimization -[x,fval] = nomad(fun,x0,lb,ub,opts); - - -%Uncomment the following problems for further testing - - -% %% PROBLEM 2 -% % Blackbox Function -% %clc -% bb = @(x) [29.4*x(1) + 18*x(2); -% -(x(1) - 0.2458*x(1)^2/x(2)) + 6]; -% % Bounds -% lb = [0;1e-5]; -% ub = [115.8;30]; -% % Starting Guess -% x0 = [0;1e-5]; -% % Options -% opts = nomadset('display_degree',2,'bb_output_type','OBJ EB','max_bb_eval',50); -% -% [x,fval,ef,iter] = nomad(bb,x0,lb,ub,opts); -% -% -% -% -% %% PROBLEM 3 -% %clc -% % Blackbox Function -% bb = @(x) (1-x(1))^2 + 100 *(x(2)-x(1)^2)^2; -% % Starting Guess -% x0 = [0 0]'; -% opts = []; %not no nomadset just to keep user options -% opts.display_degree = 2; -% opts.direction_type = 'ortho n+1'; -% opts.max_bb_eval = 2; -% % Solve -% [x,fval,ef,iter] = nomad(bb,x0,[],[],opts) -% -% %% PROBLEM 4 [fval = -2.5] -% %clc -% fun = @(x) [-x(1) - x(2) - x(3); -% (x(2) - 1./2.)*(x(2) - 1./2.) + (x(3) - 1./2.)*(x(3) - 1./2.) - 1/4; -% x(1) - x(2); -% x(1) + x(3) + x(4) - 2]; -% ub = [1;10;10;5]; -% lb = [0;0;0;0]; -% x0 = [0;0;0;0]; -% -% opts = []; %not no nomadset just to keep user options -% opts.display_degree = 2; -% opts.bb_output_type = 'OBJ PB PB PB'; -% opts.bb_input_type = '[B R R I]'; -% opts.model_search = 'false'; -% opts.model_eval_sort = 'false'; -% -% [xr,fval,ef,iter] = nomad(fun,x0,lb,ub,opts) -% -% -% %% Rosenbrock [x = 1,1, fval = 0] -% % Blackbox Function -% %clc -% bb = @(x) (1-x(1))^2 + 100 *(x(2)-x(1)^2)^2; -% % Starting Guess -% x0 = [0 0]'; -% % Solve -% [x,fval,ef,iter] = nomad(bb,x0) -% -% %% St_e01 [x = 6,0.6667, fval = -6.6667] -% % Blackbox Function -% %clc -% bb = @(x) [-x(1) - x(2); -% x(1)*x(2) - 4]; -% % Bounds -% lb = [0;0]; -% ub = [6;4]; -% % Starting Guess -% x0 = [1,1]'; -% % Options -% opts = nomadset('display_degree',2,'bb_output_type','OBJ PB'); -% % Solve -% [x,fval,ef,iter] = nomad(bb,x0,lb,ub,opts) -% -% %% St_e08 [x = 0.1294, 0.4830, fval = 0.7418] -% %clc -% % Blackbox Function -% bb = @(x) [2*x(1)+x(2); -% -16*x(1)*x(2) + 1; -% (-4*x(1)^2) - 4*x(2)^2 + 1]; -% % Bounds -% lb = [0;0]; -% ub = [1;1]; -% % Starting Guess -% x0 = [0;0]; -% % Options -% opts = nomadset('display_degree',2,'bb_output_type','OBJ PB PB'); -% -% [x,fval,ef,iter] = nomad(bb,x0,lb,ub,opts) -% -% %% Wolfram problem (multiple global minima fval = 0) -% %clc -% % Fitting Function -% obj = @(x) [x(1) - sin(2*x(1) + 3*x(2)) - cos(3*x(1) - 5*x(2)); -% x(2) - sin(x(1) - 2*x(2)) + cos(x(1) + 3*x(2))]; -% % Blackbox Function -% bb = @(x) norm(obj(x)); -% -% % Bounds -% lb = [-4;-4]; -% ub = [4;4]; -% % Starting Guess -% x0 = [0;-3]; -% % Options -% opts = nomadset('display_degree',2,'vns_search',0.9,'f_target',1e-6); -% -% [x,fval,ef,iter] = nomad(bb,x0,lb,ub,opts) -% -% %% MINLP 1 [fval = -5] -% %clc -% fun = @(x) [ (x(1) - 5)^2 + x(2)^2 - 25; -% x(1)^2 - x(2) + 0.5 ]; -% x0 = [0;0]; -% opts = nomadset('display_degree',2,'bb_input_type','[I I]','bb_output_type','OBJ PB'); -% [xr,fval,ef,iter] = nomad(fun,x0,[],[],opts) -% -% %% Bi-Objective (NOMAD Example) -% %clc -% % Blackbox Function -% bb = @(x) [x(5); -% sum((x-1).^2)-25; -% 25-sum((x+1).^2)]; -% % Bounds -% lb = [-6;-6;-6;-6;-6]; -% ub = [5;6;7;Inf;Inf]; -% % Starting Guess -% x0 = [0;0;0;0;0]; -% % Options -% % note the setting of bb_output_type in order to specify two objectives -% opts = nomadset('display_degree',2,'multi_overall_bb_eval',100,'bb_output_type','obj obj eb'); -% -% [xr,fval,ef,iter] = nomad(bb,x0,lb,ub,opts) -% +% GERAD VERSION TESTING + + +%% PROBLEM 1 +fun = @(x) (1-x(1))^2 + 100 *(x(2)-x(1)^2)^2; +x0 = [-2 1]'; +lb = [-Inf;-1.5]; +ub = [100;100]; +opts = nomadset('min_mesh_size','1e-004','initial_mesh_size','10'); + +% Start optimization +[x,fval] = nomad(fun,x0,lb,ub,opts); + + +%Uncomment the following problems for further testing + + +% %% PROBLEM 2 +% % Blackbox Function +% %clc +% bb = @(x) [29.4*x(1) + 18*x(2); +% -(x(1) - 0.2458*x(1)^2/x(2)) + 6]; +% % Bounds +% lb = [0;1e-5]; +% ub = [115.8;30]; +% % Starting Guess +% x0 = [0;1e-5]; +% % Options +% opts = nomadset('display_degree',2,'bb_output_type','OBJ EB','max_bb_eval',50); +% +% [x,fval,ef,iter] = nomad(bb,x0,lb,ub,opts); +% +% +% +% +%% PROBLEM 3 +% %clc +% % Blackbox Function +% bb = @(x) (1-x(1))^2 + 100 *(x(2)-x(1)^2)^2; +% % Starting Guess +% x0 = [0 0]'; +% opts = []; %not no nomadset just to keep user options +% opts.display_degree = 2; +% opts.direction_type = 'ortho n+1'; +% opts.max_bb_eval = 200; +% % Solve +% [x,fval,ef,iter] = nomad(bb,x0,[],[],opts) +% +%% PROBLEM 4 [fval = -2.5] +% %clc +% fun = @(x) [-x(1) - x(2) - x(3); +% (x(2) - 1./2.)*(x(2) - 1./2.) + (x(3) - 1./2.)*(x(3) - 1./2.) - 1/4; +% x(1) - x(2); +% x(1) + x(3) + x(4) - 2]; +% ub = [1;10;10;5]; +% lb = [0;0;0;0]; +% x0 = [0;0;0;0]; +% +% opts = []; %not no nomadset just to keep user options +% opts.display_degree = 2; +% opts.bb_output_type = 'OBJ PB PB PB'; +% opts.bb_input_type = '[B R R I]'; +% opts.model_search = 'false'; +% opts.max_bb_eval=50; +% opts.model_eval_sort = 'false'; +% +% [xr,fval,ef,iter] = nomad(fun,x0,lb,ub,opts) +% +% +% %% Rosenbrock [x = 1,1, fval = 0] +% % Blackbox Function +% %clc +% bb = @(x) (1-x(1))^2 + 100 *(x(2)-x(1)^2)^2; +% % Starting Guess +% x0 = [0 0]'; +% % Solve +% [x,fval,ef,iter] = nomad(bb,x0) +% +% %% St_e01 [x = 6,0.6667, fval = -6.6667] +% % Blackbox Function +% %clc +% bb = @(x) [-x(1) - x(2); +% x(1)*x(2) - 4]; +% % Bounds +% lb = [0;0]; +% ub = [6;4]; +% % Starting Guess +% x0 = [1,1]'; +% % Options +% opts = nomadset('display_degree',2,'bb_output_type','OBJ PB'); +% % Solve +% [x,fval,ef,iter] = nomad(bb,x0,lb,ub,opts) +% +% %% St_e08 [x = 0.1294, 0.4830, fval = 0.7418] +% %clc +% % Blackbox Function +% bb = @(x) [2*x(1)+x(2); +% -16*x(1)*x(2) + 1; +% (-4*x(1)^2) - 4*x(2)^2 + 1]; +% % Bounds +% lb = [0;0]; +% ub = [1;1]; +% % Starting Guess +% x0 = [0;0]; +% % Options +% opts = nomadset('display_degree',2,'bb_output_type','OBJ PB PB'); +% +% [x,fval,ef,iter] = nomad(bb,x0,lb,ub,opts) +% +% %% Wolfram problem (multiple global minima fval = 0) +% %clc +% % Fitting Function +% obj = @(x) [x(1) - sin(2*x(1) + 3*x(2)) - cos(3*x(1) - 5*x(2)); +% x(2) - sin(x(1) - 2*x(2)) + cos(x(1) + 3*x(2))]; +% % Blackbox Function +% bb = @(x) norm(obj(x)); +% +% % Bounds +% lb = [-4;-4]; +% ub = [4;4]; +% % Starting Guess +% x0 = [0;-3]; +% % Options +% opts = nomadset('display_degree',2,'vns_search',0.9,'f_target',1e-6); +% +% [x,fval,ef,iter] = nomad(bb,x0,lb,ub,opts) +% +% %% MINLP 1 [fval = -5] +%clc +% fun = @(x) [ (x(1) - 5)^2 + x(2)^2 - 25; +% x(1)^2 - x(2) + 0.5 ]; +% x0 = [0;0]; +% opts = nomadset('display_degree',2,'bb_input_type','[I I]','bb_output_type','OBJ PB','max_bb_eval',20); +% [xr,fval,ef,iter] = nomad(fun,x0,[],[],opts) +% +% %% Bi-Objective (NOMAD Example) +% %clc +% % Blackbox Function +% bb = @(x) [x(5); +% sum((x-1).^2)-25; +% 25-sum((x+1).^2)]; +% % Bounds +% lb = [-6;-6;-6;-6;-6]; +% ub = [5;6;7;Inf;Inf]; +% % Starting Guess +% x0 = [0;0;0;0;0]; +% % Options +% % note the setting of bb_output_type in order to specify two objectives +% opts = nomadset('display_degree',2,'multi_overall_bb_eval',100,'bb_output_type','obj obj eb'); +% +% [xr,fval,ef,iter] = nomad(bb,x0,lb,ub,opts) +% diff --git a/examples/interfaces/NOMAD2/param.txt b/examples/interfaces/NOMAD2/param.txt index 5d43a205422afb1c61644fe638de0910c76d16bc..68b663cee85df6c0159e4ddeee02e7dcbb78c53c 100644 --- a/examples/interfaces/NOMAD2/param.txt +++ b/examples/interfaces/NOMAD2/param.txt @@ -1,41 +1,41 @@ -DIMENSION 2 - -BB_OUTPUT_TYPE OBJ CSTR CSTR CSTR -# Output type, see the documentation for details - -BB_EXE bb.exe #'bb.exe' is a C++ executable used for run NOMAD with NOMAD v3. - -X0 ( 3 1.2 ) # Starting point - -LOWER_BOUND ( -50 -50 ) - -UPPER_BOUND ( 50 50 ) - -SOLUTION_FILE HS23/results.txt - -MESH_UPDATE_BASIS 2 - -MESH_COARSENING_EXPONENT 1 - -MESH_REFINING_EXPONENT -1 - -SEED 1 - -OPPORTUNISTIC_EVAL yes - -DIRECTION_TYPE GPS 2N - -OPPORTUNISTIC_LH yes - -SPECULATIVE_SEARCH yes - -MAX_BB_EVAL 50 - -H_MAX_0 5 - -H_MIN 0.0001 - -H_NORM L2 - -RHO 0.1 - +DIMENSION 2 + +BB_OUTPUT_TYPE OBJ CSTR CSTR CSTR +# Output type, see the documentation for details + +BB_EXE bb.exe #'bb.exe' is a C++ executable used for run NOMAD with NOMAD v3. + +X0 ( 3 1.2 ) # Starting point + +LOWER_BOUND ( -50 -50 ) + +UPPER_BOUND ( 50 50 ) + +SOLUTION_FILE HS23/results.txt + +MESH_UPDATE_BASIS 2 + +MESH_COARSENING_EXPONENT 1 + +MESH_REFINING_EXPONENT -1 + +SEED 1 + +OPPORTUNISTIC_EVAL yes + +DIRECTION_TYPE GPS 2N + +OPPORTUNISTIC_LH yes + +SPECULATIVE_SEARCH yes + +MAX_BB_EVAL 50 + +H_MAX_0 5 + +H_MIN 0.0001 + +H_NORM L2 + +RHO 0.1 + diff --git a/examples/interfaces/NOMAD2/reader.cpp b/examples/interfaces/NOMAD2/reader.cpp index 9f140b6970d5581cac1d28ba97edb57b43593129..d70a613d715b45307287e7f0a90764cc585e2fa0 100644 --- a/examples/interfaces/NOMAD2/reader.cpp +++ b/examples/interfaces/NOMAD2/reader.cpp @@ -1,37 +1,4 @@ /*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonsmooth Optimization by Mesh Adaptive Direct search - version 3.2 */ -/* */ -/* Copyright (C) 2001-2008 Mark Abramson - the Boeing Company, Seattle */ -/* Charles Audet - Ecole Polytechnique, Montreal */ -/* Gilles Couture - Ecole Polytechnique, Montreal */ -/* John Dennis - Rice University, Houston */ -/* Sebastien Le Digabel - Ecole Polytechnique, Montreal */ -/* */ -/* funded in part by AFOSR and Exxon Mobil */ -/* */ -/* Author: Quentin Reynaud */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU General Public License along with this */ -/* program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ /* This program read informations files from NOMAD version 2 and create the */ /* parameters files used by NOMAD version 3 */ /*-------------------------------------------------------------------------------------*/ @@ -553,6 +520,7 @@ int main(int argc, char** argv) } if (isSurrogate) + { if (surrogate != "") { fic << "SGTE_EXE\t\t" ; @@ -562,7 +530,7 @@ int main(int argc, char** argv) { cout<< "Warning : you are using surrogate, but no surrogate function is given."<<endl; } - + } // Parameters from parameters file if (isParam[0]) { diff --git a/examples/interfaces/NOMAD2/readme.txt b/examples/interfaces/NOMAD2/readme.txt index 6651edffae5e5fd16a9d4423508ad165d2c76a23..23e8cfc46d7c445ae75bedcaf395e3a2dc112a0f 100644 --- a/examples/interfaces/NOMAD2/readme.txt +++ b/examples/interfaces/NOMAD2/readme.txt @@ -1,50 +1,50 @@ -The reader.cpp file is a program which can help you to use NOMAD version 3 -with problems for the version 2. - -In this part, we assume that the directory in which this readme.txt file is located is: - - $nomad2_interface - -"./HS23" is an example of input directory. - -We also assume that the NOMAD v2 black-box executables are compiled. -In the example directory, a 'compile' script in given. - - HOW TO USE READER.CPP: - -First, you have to compile it. For example, use the following command: - - cd $nomad2_interface - g++ -o reader.exe reader.cpp - -Then, you can run the executable with one or two argument(s), -like this: - - ./reader.exe $dir/description_file ($dir/parameter_file) - -description_file and parameter_file are two files used by NOMAD (version 2) to solve a problem. -You have to put all the required files in the same directory ("dir" in our example) : -the description_file and the parameter file, -the executables files (for constraints and objective function), the input... - -Somes files are created when the reader is executed: - -* bb.cpp: This is the Black Box used by NOMAD. -You have to compile it with: - - g++ -o bb.exe bb.cpp - -Warning: The name of this executable must be "bb.exe", -or you have to change this name in the param.txt file (after "BB_EXE"). - -* param.txt: This file contains all the parameters used by NOMAD. - - - HOW TO USE NOMAD: - -You just have to call: - - $NOMAD_HOME/bin/nomad.exe $nomad2_interface/param.txt - - -WARNING: this program works under LINUX; with WINDOWS, you may have to manually change the executable paths directly into the created source file bb.cpp. +The reader.cpp file is a program which can help you to use NOMAD version 3 +with problems for the version 2. + +In this part, we assume that the directory in which this readme.txt file is located is: + + $nomad2_interface + +"./HS23" is an example of input directory. + +We also assume that the NOMAD v2 black-box executables are compiled. +In the example directory, a 'compile' script in given. + + HOW TO USE READER.CPP: + +First, you have to compile it. For example, use the following command: + + cd $nomad2_interface + g++ -o reader.exe reader.cpp + +Then, you can run the executable with one or two argument(s), +like this: + + ./reader.exe $dir/description_file ($dir/parameter_file) + +description_file and parameter_file are two files used by NOMAD (version 2) to solve a problem. +You have to put all the required files in the same directory ("dir" in our example) : +the description_file and the parameter file, +the executables files (for constraints and objective function), the input... + +Somes files are created when the reader is executed: + +* bb.cpp: This is the Black Box used by NOMAD. +You have to compile it with: + + g++ -o bb.exe bb.cpp + +Warning: The name of this executable must be "bb.exe", +or you have to change this name in the param.txt file (after "BB_EXE"). + +* param.txt: This file contains all the parameters used by NOMAD. + + + HOW TO USE NOMAD: + +You just have to call: + + $NOMAD_HOME/bin/nomad.exe $nomad2_interface/param.txt + + +WARNING: this program works under LINUX; with WINDOWS, you may have to manually change the executable paths directly into the created source file bb.cpp. diff --git a/examples/interfaces/NOMAD2/runExample.log b/examples/interfaces/NOMAD2/runExample.log deleted file mode 100644 index b0f95b8ea38bb997cf1c57e326f844274f5813cc..0000000000000000000000000000000000000000 --- a/examples/interfaces/NOMAD2/runExample.log +++ /dev/null @@ -1,36 +0,0 @@ - -NOMAD - version 3.6.1 - www.gerad.ca/nomad - -Copyright (C) 2001-2013 { - Mark A. Abramson - The Boeing Company - Charles Audet - Ecole Polytechnique de Montreal - Gilles Couture - Ecole Polytechnique de Montreal - John E. Dennis, Jr. - Rice University - Sebastien Le Digabel - Ecole Polytechnique de Montreal - Christophe Tribes - Ecole Polytechnique de Montreal -} - -Funded in part by AFOSR and Exxon Mobil. - -License : '$NOMAD_HOME/src/lgpl.txt' -User guide: '$NOMAD_HOME/doc/user_guide.pdf' -Examples : '$NOMAD_HOME/examples' -Tools : '$NOMAD_HOME/tools' - -Please report bugs to nomad@gerad.ca - -MADS run { - - BBE OBJ - - 8 77.4106000000 - 13 14.6999000000 - 32 12.2638000000 - 41 2.6618100000 - 50 2.6618100000 - -} end of run (max number of blackbox evaluations) - -blackbox evaluations : 50 -best infeasible solution: ( 3 -1.728932188 ) h=0.0107935 f=11.9892 -best feasible solution : ( 1.125 1.181601718 ) h=0 f=2.66181 diff --git a/examples/interfaces/pyNomad_Beta/PyNomad.cpp b/examples/interfaces/pyNomad_Beta/PyNomad.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d0d023fa5aaf5e38df837769746cde69c6acd9ce --- /dev/null +++ b/examples/interfaces/pyNomad_Beta/PyNomad.cpp @@ -0,0 +1,6057 @@ +/* Generated by Cython 0.24.1 */ + +/* BEGIN: Cython Metadata +{ + "distutils": { + "depends": [ + "/Users/christophe/Development/NOMAD/NOMAD_Release/src/Double.hpp", + "/Users/christophe/Development/NOMAD/NOMAD_Release/src/Eval_Point.hpp", + "nomadCySimpleInterface.cpp" + ], + "extra_compile_args": [ + "-w" + ], + "extra_link_args": [ + "-headerpad_max_install_names" + ], + "include_dirs": [ + "/Users/christophe/Development/NOMAD/NOMAD_Release/src", + "/Users/christophe/Development/NOMAD/NOMAD_Release/ext/sgtelib/src", + "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/core/include" + ], + "language": "c++", + "libraries": [ + "nomad" + ], + "library_dirs": [ + "/Users/christophe/Development/NOMAD/NOMAD_Release/lib" + ] + }, + "module_name": "PyNomad" +} +END: Cython Metadata */ + +#define PY_SSIZE_T_CLEAN +#include "Python.h" +#ifndef Py_PYTHON_H + #error Python headers needed to compile C extensions, please install development version of Python. +#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000) + #error Cython requires Python 2.6+ or Python 3.2+. +#else +#define CYTHON_ABI "0_24_1" +#include <stddef.h> +#ifndef offsetof + #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) +#endif +#if !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#endif +#ifndef DL_IMPORT + #define DL_IMPORT(t) t +#endif +#ifndef DL_EXPORT + #define DL_EXPORT(t) t +#endif +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif +#ifndef Py_HUGE_VAL + #define Py_HUGE_VAL HUGE_VAL +#endif +#ifdef PYPY_VERSION + #define CYTHON_COMPILING_IN_PYPY 1 + #define CYTHON_COMPILING_IN_CPYTHON 0 +#else + #define CYTHON_COMPILING_IN_PYPY 0 + #define CYTHON_COMPILING_IN_CPYTHON 1 +#endif +#if !defined(CYTHON_USE_PYLONG_INTERNALS) && CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x02070000 + #define CYTHON_USE_PYLONG_INTERNALS 1 +#endif +#if CYTHON_USE_PYLONG_INTERNALS + #include "longintrepr.h" + #undef SHIFT + #undef BASE + #undef MASK +#endif +#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) + #define Py_OptimizeFlag 0 +#endif +#define __PYX_BUILD_PY_SSIZE_T "n" +#define CYTHON_FORMAT_SSIZE_T "z" +#if PY_MAJOR_VERSION < 3 + #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) + #define __Pyx_DefaultClassType PyClass_Type +#else + #define __Pyx_BUILTIN_MODULE_NAME "builtins" + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) + #define __Pyx_DefaultClassType PyType_Type +#endif +#ifndef Py_TPFLAGS_CHECKTYPES + #define Py_TPFLAGS_CHECKTYPES 0 +#endif +#ifndef Py_TPFLAGS_HAVE_INDEX + #define Py_TPFLAGS_HAVE_INDEX 0 +#endif +#ifndef Py_TPFLAGS_HAVE_NEWBUFFER + #define Py_TPFLAGS_HAVE_NEWBUFFER 0 +#endif +#ifndef Py_TPFLAGS_HAVE_FINALIZE + #define Py_TPFLAGS_HAVE_FINALIZE 0 +#endif +#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) + #define CYTHON_PEP393_ENABLED 1 + #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ + 0 : _PyUnicode_Ready((PyObject *)(op))) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) + #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u) + #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) + #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) +#else + #define CYTHON_PEP393_ENABLED 0 + #define __Pyx_PyUnicode_READY(op) (0) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) + #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE)) + #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) + #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u)) +#endif +#if CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b) + #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b) +#else + #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b) + #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ + PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) +#endif +#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains) + #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) +#endif +#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check) + #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) +#endif +#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format) + #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) +#endif +#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) + #define PyObject_Malloc(s) PyMem_Malloc(s) + #define PyObject_Free(p) PyMem_Free(p) + #define PyObject_Realloc(p) PyMem_Realloc(p) +#endif +#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) +#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b) +#else + #define __Pyx_PyString_Format(a, b) PyString_Format(a, b) +#endif +#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII) + #define PyObject_ASCII(o) PyObject_Repr(o) +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyBaseString_Type PyUnicode_Type + #define PyStringObject PyUnicodeObject + #define PyString_Type PyUnicode_Type + #define PyString_Check PyUnicode_Check + #define PyString_CheckExact PyUnicode_CheckExact +#endif +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) + #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj) +#else + #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj)) + #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) +#endif +#ifndef PySet_CheckExact + #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) +#endif +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) +#if PY_MAJOR_VERSION >= 3 + #define PyIntObject PyLongObject + #define PyInt_Type PyLong_Type + #define PyInt_Check(op) PyLong_Check(op) + #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define PyInt_FromString PyLong_FromString + #define PyInt_FromUnicode PyLong_FromUnicode + #define PyInt_FromLong PyLong_FromLong + #define PyInt_FromSize_t PyLong_FromSize_t + #define PyInt_FromSsize_t PyLong_FromSsize_t + #define PyInt_AsLong PyLong_AsLong + #define PyInt_AS_LONG PyLong_AS_LONG + #define PyInt_AsSsize_t PyLong_AsSsize_t + #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask + #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask + #define PyNumber_Int PyNumber_Long +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyBoolObject PyLongObject +#endif +#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY + #ifndef PyUnicode_InternFromString + #define PyUnicode_InternFromString(s) PyUnicode_FromString(s) + #endif +#endif +#if PY_VERSION_HEX < 0x030200A4 + typedef long Py_hash_t; + #define __Pyx_PyInt_FromHash_t PyInt_FromLong + #define __Pyx_PyInt_AsHash_t PyInt_AsLong +#else + #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t + #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t +#endif +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) +#else + #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass) +#endif +#if PY_VERSION_HEX >= 0x030500B1 +#define __Pyx_PyAsyncMethodsStruct PyAsyncMethods +#define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async) +#elif CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +typedef struct { + unaryfunc am_await; + unaryfunc am_aiter; + unaryfunc am_anext; +} __Pyx_PyAsyncMethodsStruct; +#define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved)) +#else +#define __Pyx_PyType_AsAsync(obj) NULL +#endif +#ifndef CYTHON_RESTRICT + #if defined(__GNUC__) + #define CYTHON_RESTRICT __restrict__ + #elif defined(_MSC_VER) && _MSC_VER >= 1400 + #define CYTHON_RESTRICT __restrict + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_RESTRICT restrict + #else + #define CYTHON_RESTRICT + #endif +#endif +#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) + +#ifndef __cplusplus + #error "Cython files generated with the C++ option must be compiled with a C++ compiler." +#endif +#ifndef CYTHON_INLINE + #define CYTHON_INLINE inline +#endif +template<typename T> +void __Pyx_call_destructor(T& x) { + x.~T(); +} +template<typename T> +class __Pyx_FakeReference { + public: + __Pyx_FakeReference() : ptr(NULL) { } + __Pyx_FakeReference(const T& ref) : ptr(const_cast<T*>(&ref)) { } + T *operator->() { return ptr; } + operator T&() { return *ptr; } + private: + T *ptr; +}; + +#if defined(WIN32) || defined(MS_WINDOWS) + #define _USE_MATH_DEFINES +#endif +#include <math.h> +#ifdef NAN +#define __PYX_NAN() ((float) NAN) +#else +static CYTHON_INLINE float __PYX_NAN() { + float value; + memset(&value, 0xFF, sizeof(value)); + return value; +} +#endif +#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL) +#define __Pyx_truncl trunc +#else +#define __Pyx_truncl truncl +#endif + + +#define __PYX_ERR(f_index, lineno, Ln_error) \ +{ \ + __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \ +} + +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif + +#ifndef __PYX_EXTERN_C + #ifdef __cplusplus + #define __PYX_EXTERN_C extern "C" + #else + #define __PYX_EXTERN_C extern + #endif +#endif + +#define __PYX_HAVE__PyNomad +#define __PYX_HAVE_API__PyNomad +#include <vector> +#include "ios" +#include "new" +#include "stdexcept" +#include "typeinfo" +#include "string.h" +#include <string> +#include <list> +#include "Double.hpp" +#include "Eval_Point.hpp" +#include "nomadCySimpleInterface.cpp" +#ifdef _OPENMP +#include <omp.h> +#endif /* _OPENMP */ + +#ifdef PYREX_WITHOUT_ASSERTIONS +#define CYTHON_WITHOUT_ASSERTIONS +#endif + +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +#endif +#ifndef CYTHON_NCP_UNUSED +# if CYTHON_COMPILING_IN_CPYTHON +# define CYTHON_NCP_UNUSED +# else +# define CYTHON_NCP_UNUSED CYTHON_UNUSED +# endif +#endif +typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding; + const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; + +#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 +#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0 +#define __PYX_DEFAULT_STRING_ENCODING "" +#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString +#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize +#define __Pyx_uchar_cast(c) ((unsigned char)c) +#define __Pyx_long_cast(x) ((long)x) +#define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\ + (sizeof(type) < sizeof(Py_ssize_t)) ||\ + (sizeof(type) > sizeof(Py_ssize_t) &&\ + likely(v < (type)PY_SSIZE_T_MAX ||\ + v == (type)PY_SSIZE_T_MAX) &&\ + (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\ + v == (type)PY_SSIZE_T_MIN))) ||\ + (sizeof(type) == sizeof(Py_ssize_t) &&\ + (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\ + v == (type)PY_SSIZE_T_MAX))) ) +#if defined (__cplusplus) && __cplusplus >= 201103L + #include <cstdlib> + #define __Pyx_sst_abs(value) std::abs(value) +#elif SIZEOF_INT >= SIZEOF_SIZE_T + #define __Pyx_sst_abs(value) abs(value) +#elif SIZEOF_LONG >= SIZEOF_SIZE_T + #define __Pyx_sst_abs(value) labs(value) +#elif defined (_MSC_VER) && defined (_M_X64) + #define __Pyx_sst_abs(value) _abs64(value) +#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define __Pyx_sst_abs(value) llabs(value) +#elif defined (__GNUC__) + #define __Pyx_sst_abs(value) __builtin_llabs(value) +#else + #define __Pyx_sst_abs(value) ((value<0) ? -value : value) +#endif +static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*); +static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); +#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s)) +#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l) +#define __Pyx_PyBytes_FromString PyBytes_FromString +#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); +#if PY_MAJOR_VERSION < 3 + #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString + #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize +#else + #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString + #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize +#endif +#define __Pyx_PyObject_AsSString(s) ((signed char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) +#define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s) +#define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) +#define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s) +#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) +#if PY_MAJOR_VERSION < 3 +static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) +{ + const Py_UNICODE *u_end = u; + while (*u_end++) ; + return (size_t)(u_end - u - 1); +} +#else +#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen +#endif +#define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) +#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode +#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode +#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj) +#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None) +#define __Pyx_PyBool_FromLong(b) ((b) ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False)) +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +#if CYTHON_COMPILING_IN_CPYTHON +#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) +#else +#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) +#endif +#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) +#if PY_MAJOR_VERSION >= 3 +#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x)) +#else +#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x)) +#endif +#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x)) +#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII +static int __Pyx_sys_getdefaultencoding_not_ascii; +static int __Pyx_init_sys_getdefaultencoding_params(void) { + PyObject* sys; + PyObject* default_encoding = NULL; + PyObject* ascii_chars_u = NULL; + PyObject* ascii_chars_b = NULL; + const char* default_encoding_c; + sys = PyImport_ImportModule("sys"); + if (!sys) goto bad; + default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL); + Py_DECREF(sys); + if (!default_encoding) goto bad; + default_encoding_c = PyBytes_AsString(default_encoding); + if (!default_encoding_c) goto bad; + if (strcmp(default_encoding_c, "ascii") == 0) { + __Pyx_sys_getdefaultencoding_not_ascii = 0; + } else { + char ascii_chars[128]; + int c; + for (c = 0; c < 128; c++) { + ascii_chars[c] = c; + } + __Pyx_sys_getdefaultencoding_not_ascii = 1; + ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); + if (!ascii_chars_u) goto bad; + ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL); + if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) { + PyErr_Format( + PyExc_ValueError, + "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.", + default_encoding_c); + goto bad; + } + Py_DECREF(ascii_chars_u); + Py_DECREF(ascii_chars_b); + } + Py_DECREF(default_encoding); + return 0; +bad: + Py_XDECREF(default_encoding); + Py_XDECREF(ascii_chars_u); + Py_XDECREF(ascii_chars_b); + return -1; +} +#endif +#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3 +#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) +#else +#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) +#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT +static char* __PYX_DEFAULT_STRING_ENCODING; +static int __Pyx_init_sys_getdefaultencoding_params(void) { + PyObject* sys; + PyObject* default_encoding = NULL; + char* default_encoding_c; + sys = PyImport_ImportModule("sys"); + if (!sys) goto bad; + default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); + Py_DECREF(sys); + if (!default_encoding) goto bad; + default_encoding_c = PyBytes_AsString(default_encoding); + if (!default_encoding_c) goto bad; + __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c)); + if (!__PYX_DEFAULT_STRING_ENCODING) goto bad; + strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c); + Py_DECREF(default_encoding); + return 0; +bad: + Py_XDECREF(default_encoding); + return -1; +} +#endif +#endif + + +/* Test for GCC > 2.95 */ +#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))) + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) +#else /* !__GNUC__ or GCC < 2.95 */ + #define likely(x) (x) + #define unlikely(x) (x) +#endif /* __GNUC__ */ + +static PyObject *__pyx_m; +static PyObject *__pyx_d; +static PyObject *__pyx_b; +static PyObject *__pyx_empty_tuple; +static PyObject *__pyx_empty_bytes; +static PyObject *__pyx_empty_unicode; +static int __pyx_lineno; +static int __pyx_clineno = 0; +static const char * __pyx_cfilenm= __FILE__; +static const char *__pyx_filename; + + +static const char *__pyx_f[] = { + "PyNomad.pyx", + "stringsource", +}; + +/*--- Type declarations ---*/ +struct __pyx_obj_7PyNomad_PyNomadDouble; +struct __pyx_obj_7PyNomad_PyNomadEval_Point; + +/* "PyNomad.pyx":63 + * bool is_defined() + * + * cdef class PyNomadDouble: # <<<<<<<<<<<<<< + * cdef Double c_d + * def value(self): + */ +struct __pyx_obj_7PyNomad_PyNomadDouble { + PyObject_HEAD + NOMAD::Double c_d; +}; + + +/* "PyNomad.pyx":79 + * int get_m() + * + * cdef class PyNomadEval_Point: # <<<<<<<<<<<<<< + * cdef Eval_Point *c_ep + * def get_coord(self, int i): + */ +struct __pyx_obj_7PyNomad_PyNomadEval_Point { + PyObject_HEAD + NOMAD::Eval_Point *c_ep; +}; + + +/* --- Runtime support code (head) --- */ +/* Refnanny.proto */ +#ifndef CYTHON_REFNANNY + #define CYTHON_REFNANNY 0 +#endif +#if CYTHON_REFNANNY + typedef struct { + void (*INCREF)(void*, PyObject*, int); + void (*DECREF)(void*, PyObject*, int); + void (*GOTREF)(void*, PyObject*, int); + void (*GIVEREF)(void*, PyObject*, int); + void* (*SetupContext)(const char*, int, const char*); + void (*FinishContext)(void**); + } __Pyx_RefNannyAPIStruct; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); + #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; +#ifdef WITH_THREAD + #define __Pyx_RefNannySetupContext(name, acquire_gil)\ + if (acquire_gil) {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ + PyGILState_Release(__pyx_gilstate_save);\ + } else {\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ + } +#else + #define __Pyx_RefNannySetupContext(name, acquire_gil)\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) +#endif + #define __Pyx_RefNannyFinishContext()\ + __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) +#else + #define __Pyx_RefNannyDeclarations + #define __Pyx_RefNannySetupContext(name, acquire_gil) + #define __Pyx_RefNannyFinishContext() + #define __Pyx_INCREF(r) Py_INCREF(r) + #define __Pyx_DECREF(r) Py_DECREF(r) + #define __Pyx_GOTREF(r) + #define __Pyx_GIVEREF(r) + #define __Pyx_XINCREF(r) Py_XINCREF(r) + #define __Pyx_XDECREF(r) Py_XDECREF(r) + #define __Pyx_XGOTREF(r) + #define __Pyx_XGIVEREF(r) +#endif +#define __Pyx_XDECREF_SET(r, v) do {\ + PyObject *tmp = (PyObject *) r;\ + r = v; __Pyx_XDECREF(tmp);\ + } while (0) +#define __Pyx_DECREF_SET(r, v) do {\ + PyObject *tmp = (PyObject *) r;\ + r = v; __Pyx_DECREF(tmp);\ + } while (0) +#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) +#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) + +/* PyObjectGetAttrStr.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro)) + return tp->tp_getattro(obj, attr_name); +#if PY_MAJOR_VERSION < 3 + if (likely(tp->tp_getattr)) + return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); +#endif + return PyObject_GetAttr(obj, attr_name); +} +#else +#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) +#endif + +/* GetBuiltinName.proto */ +static PyObject *__Pyx_GetBuiltinName(PyObject *name); + +/* RaiseDoubleKeywords.proto */ +static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); + +/* ParseKeywords.proto */ +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\ + PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\ + const char* function_name); + +/* RaiseArgTupleInvalid.proto */ +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); + +/* GetModuleGlobalName.proto */ +static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); + +/* PyObjectCall.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); +#else +#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) +#endif + +/* PyObjectCallMethO.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); +#endif + +/* PyObjectCallOneArg.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); + +/* PyObjectCallNoArg.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); +#else +#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL) +#endif + +/* ListAppend.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { + PyListObject* L = (PyListObject*) list; + Py_ssize_t len = Py_SIZE(list); + if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) { + Py_INCREF(x); + PyList_SET_ITEM(list, len, x); + Py_SIZE(list) = len+1; + return 0; + } + return PyList_Append(list, x); +} +#else +#define __Pyx_PyList_Append(L,x) PyList_Append(L,x) +#endif + +/* pyobject_as_double.proto */ +static double __Pyx__PyObject_AsDouble(PyObject* obj); +#if CYTHON_COMPILING_IN_PYPY +#define __Pyx_PyObject_AsDouble(obj)\ +(likely(PyFloat_CheckExact(obj)) ? PyFloat_AS_DOUBLE(obj) :\ + likely(PyInt_CheckExact(obj)) ?\ + PyFloat_AsDouble(obj) : __Pyx__PyObject_AsDouble(obj)) +#else +#define __Pyx_PyObject_AsDouble(obj)\ +((likely(PyFloat_CheckExact(obj))) ?\ + PyFloat_AS_DOUBLE(obj) : __Pyx__PyObject_AsDouble(obj)) +#endif + +/* PyThreadStateGet.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; +#define __Pyx_PyThreadState_assign __pyx_tstate = PyThreadState_GET(); +#else +#define __Pyx_PyThreadState_declare +#define __Pyx_PyThreadState_assign +#endif + +/* PyErrFetchRestore.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) +#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) +#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) +#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#else +#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) +#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) +#endif + +/* WriteUnraisableException.proto */ +static void __Pyx_WriteUnraisable(const char *name, int clineno, + int lineno, const char *filename, + int full_traceback, int nogil); + +/* None.proto */ +static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname); + +/* GetItemInt.proto */ +#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\ + (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\ + __Pyx_GetItemInt_Generic(o, to_py_func(i)))) +#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\ + (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL)) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck); +#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\ + (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL)) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck); +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, + int is_list, int wraparound, int boundscheck); + +/* Import.proto */ +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); + +/* ImportFrom.proto */ +static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); + +/* CodeObjectCache.proto */ +typedef struct { + PyCodeObject* code_object; + int code_line; +} __Pyx_CodeObjectCacheEntry; +struct __Pyx_CodeObjectCache { + int count; + int max_count; + __Pyx_CodeObjectCacheEntry* entries; +}; +static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); +static PyCodeObject *__pyx_find_code_object(int code_line); +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); + +/* AddTraceback.proto */ +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename); + +/* None.proto */ +#include <new> + +/* CppExceptionConversion.proto */ +#ifndef __Pyx_CppExn2PyErr +#include <new> +#include <typeinfo> +#include <stdexcept> +#include <ios> +static void __Pyx_CppExn2PyErr() { + try { + if (PyErr_Occurred()) + ; // let the latest Python exn pass through and ignore the current one + else + throw; + } catch (const std::bad_alloc& exn) { + PyErr_SetString(PyExc_MemoryError, exn.what()); + } catch (const std::bad_cast& exn) { + PyErr_SetString(PyExc_TypeError, exn.what()); + } catch (const std::domain_error& exn) { + PyErr_SetString(PyExc_ValueError, exn.what()); + } catch (const std::invalid_argument& exn) { + PyErr_SetString(PyExc_ValueError, exn.what()); + } catch (const std::ios_base::failure& exn) { + PyErr_SetString(PyExc_IOError, exn.what()); + } catch (const std::out_of_range& exn) { + PyErr_SetString(PyExc_IndexError, exn.what()); + } catch (const std::overflow_error& exn) { + PyErr_SetString(PyExc_OverflowError, exn.what()); + } catch (const std::range_error& exn) { + PyErr_SetString(PyExc_ArithmeticError, exn.what()); + } catch (const std::underflow_error& exn) { + PyErr_SetString(PyExc_ArithmeticError, exn.what()); + } catch (const std::exception& exn) { + PyErr_SetString(PyExc_RuntimeError, exn.what()); + } + catch (...) + { + PyErr_SetString(PyExc_RuntimeError, "Unknown exception"); + } +} +#endif + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value); + +/* CIntFromPy.proto */ +static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); + +/* CIntFromPy.proto */ +static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); + +/* CIntFromPy.proto */ +static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); + +/* CheckBinaryVersion.proto */ +static int __Pyx_check_binary_version(void); + +/* InitStrings.proto */ +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); + + +/* Module declarations from 'libcpp.vector' */ + +/* Module declarations from 'libc.string' */ + +/* Module declarations from 'libcpp.string' */ + +/* Module declarations from 'libcpp.list' */ + +/* Module declarations from 'libcpp' */ + +/* Module declarations from 'PyNomad' */ +static PyTypeObject *__pyx_ptype_7PyNomad_PyNomadDouble = 0; +static PyTypeObject *__pyx_ptype_7PyNomad_PyNomadEval_Point = 0; +static int __pyx_f_7PyNomad_cb(void *, NOMAD::Eval_Point &); /*proto*/ +static int __pyx_f_7PyNomad_cbL(void *, std::list<NOMAD::Eval_Point *> &); /*proto*/ +static std::string __pyx_convert_string_from_py_std__in_string(PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_convert_PyObject_string_to_py_std__in_string(std::string const &); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_convert_PyUnicode_string_to_py_std__in_string(std::string const &); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_convert_PyStr_string_to_py_std__in_string(std::string const &); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_convert_PyBytes_string_to_py_std__in_string(std::string const &); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_convert_PyByteArray_string_to_py_std__in_string(std::string const &); /*proto*/ +static std::vector<double> __pyx_convert_vector_from_py_double(PyObject *); /*proto*/ +static std::vector<std::string> __pyx_convert_vector_from_py_std_3a__3a_string(PyObject *); /*proto*/ +#define __Pyx_MODULE_NAME "PyNomad" +int __pyx_module_is_main_PyNomad = 0; + +/* Implementation of 'PyNomad' */ +static PyObject *__pyx_builtin_xrange; +static const char __pyx_k_[] = ""; +static const char __pyx_k_f[] = "f"; +static const char __pyx_k_i[] = "i"; +static const char __pyx_k_v[] = "v"; +static const char __pyx_k_doc[] = "__doc__"; +static const char __pyx_k_get[] = "get"; +static const char __pyx_k_inf[] = "inf"; +static const char __pyx_k_pLB[] = "pLB"; +static const char __pyx_k_pUB[] = "pUB"; +static const char __pyx_k_pX0[] = "pX0"; +static const char __pyx_k_args[] = "args"; +static const char __pyx_k_help[] = "help"; +static const char __pyx_k_info[] = "info"; +static const char __pyx_k_join[] = "join"; +static const char __pyx_k_main[] = "__main__"; +static const char __pyx_k_test[] = "__test__"; +static const char __pyx_k_Queue[] = "Queue"; +static const char __pyx_k_about[] = "about"; +static const char __pyx_k_get_f[] = "get_f"; +static const char __pyx_k_get_h[] = "get_h"; +static const char __pyx_k_get_n[] = "get_n"; +static const char __pyx_k_range[] = "range"; +static const char __pyx_k_start[] = "start"; +static const char __pyx_k_usage[] = "usage"; +static const char __pyx_k_value[] = "value"; +static const char __pyx_k_import[] = "__import__"; +static const char __pyx_k_params[] = "params"; +static const char __pyx_k_target[] = "target"; +static const char __pyx_k_u_feas[] = "u_feas"; +static const char __pyx_k_xrange[] = "xrange"; +static const char __pyx_k_Process[] = "Process"; +static const char __pyx_k_PyNomad[] = "PyNomad"; +static const char __pyx_k_version[] = "version"; +static const char __pyx_k_f_return[] = "f_return"; +static const char __pyx_k_h_return[] = "h_return"; +static const char __pyx_k_nb_evals[] = "nb_evals"; +static const char __pyx_k_nb_iters[] = "nb_iters"; +static const char __pyx_k_optimize[] = "optimize"; +static const char __pyx_k_u_infeas[] = "u_infeas"; +static const char __pyx_k_x_return[] = "x_return"; +static const char __pyx_k_get_coord[] = "get_coord"; +static const char __pyx_k_is_defined[] = "is_defined"; +static const char __pyx_k_run_status[] = "run_status"; +static const char __pyx_k_multiprocessing[] = "multiprocessing"; +static const char __pyx_k_Users_christophe_Development_NO[] = "/Users/christophe/Development/NOMAD/NOMAD_Release/examples/interfaces/pyNomad_Beta/PyNomad.pyx"; +static PyObject *__pyx_kp_s_; +static PyObject *__pyx_n_s_Process; +static PyObject *__pyx_n_s_PyNomad; +static PyObject *__pyx_n_s_Queue; +static PyObject *__pyx_kp_s_Users_christophe_Development_NO; +static PyObject *__pyx_n_s_about; +static PyObject *__pyx_n_s_args; +static PyObject *__pyx_n_s_doc; +static PyObject *__pyx_n_s_f; +static PyObject *__pyx_n_s_f_return; +static PyObject *__pyx_n_s_get; +static PyObject *__pyx_n_s_get_coord; +static PyObject *__pyx_n_s_get_f; +static PyObject *__pyx_n_s_get_h; +static PyObject *__pyx_n_s_get_n; +static PyObject *__pyx_n_s_h_return; +static PyObject *__pyx_n_s_help; +static PyObject *__pyx_n_s_i; +static PyObject *__pyx_n_s_import; +static PyObject *__pyx_n_s_inf; +static PyObject *__pyx_n_s_info; +static PyObject *__pyx_n_s_is_defined; +static PyObject *__pyx_n_s_join; +static PyObject *__pyx_n_s_main; +static PyObject *__pyx_n_s_multiprocessing; +static PyObject *__pyx_n_s_nb_evals; +static PyObject *__pyx_n_s_nb_iters; +static PyObject *__pyx_n_s_optimize; +static PyObject *__pyx_n_s_pLB; +static PyObject *__pyx_n_s_pUB; +static PyObject *__pyx_n_s_pX0; +static PyObject *__pyx_n_s_params; +static PyObject *__pyx_n_s_range; +static PyObject *__pyx_n_s_run_status; +static PyObject *__pyx_n_s_start; +static PyObject *__pyx_n_s_target; +static PyObject *__pyx_n_s_test; +static PyObject *__pyx_n_s_u_feas; +static PyObject *__pyx_n_s_u_infeas; +static PyObject *__pyx_n_s_usage; +static PyObject *__pyx_n_s_v; +static PyObject *__pyx_n_s_value; +static PyObject *__pyx_n_s_version; +static PyObject *__pyx_n_s_x_return; +static PyObject *__pyx_n_s_xrange; +static PyObject *__pyx_pf_7PyNomad_version(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_7PyNomad_2usage(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_7PyNomad_4info(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_7PyNomad_6help(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_about); /* proto */ +static PyObject *__pyx_pf_7PyNomad_8__doc__(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_7PyNomad_10optimize(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_f, PyObject *__pyx_v_pX0, PyObject *__pyx_v_pLB, PyObject *__pyx_v_pUB, PyObject *__pyx_v_params); /* proto */ +static PyObject *__pyx_pf_7PyNomad_13PyNomadDouble_value(struct __pyx_obj_7PyNomad_PyNomadDouble *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7PyNomad_13PyNomadDouble_2is_defined(struct __pyx_obj_7PyNomad_PyNomadDouble *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7PyNomad_17PyNomadEval_Point_get_coord(struct __pyx_obj_7PyNomad_PyNomadEval_Point *__pyx_v_self, int __pyx_v_i); /* proto */ +static PyObject *__pyx_pf_7PyNomad_17PyNomadEval_Point_2set_bb_output(struct __pyx_obj_7PyNomad_PyNomadEval_Point *__pyx_v_self, int __pyx_v_i, double __pyx_v_v); /* proto */ +static PyObject *__pyx_pf_7PyNomad_17PyNomadEval_Point_4get_f(struct __pyx_obj_7PyNomad_PyNomadEval_Point *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7PyNomad_17PyNomadEval_Point_6get_h(struct __pyx_obj_7PyNomad_PyNomadEval_Point *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7PyNomad_17PyNomadEval_Point_8get_n(struct __pyx_obj_7PyNomad_PyNomadEval_Point *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7PyNomad_17PyNomadEval_Point_10get_m(struct __pyx_obj_7PyNomad_PyNomadEval_Point *__pyx_v_self); /* proto */ +static PyObject *__pyx_tp_new_7PyNomad_PyNomadDouble(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_7PyNomad_PyNomadEval_Point(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tuple__5; +static PyObject *__pyx_tuple__7; +static PyObject *__pyx_tuple__9; +static PyObject *__pyx_codeobj__2; +static PyObject *__pyx_codeobj__3; +static PyObject *__pyx_codeobj__4; +static PyObject *__pyx_codeobj__6; +static PyObject *__pyx_codeobj__8; +static PyObject *__pyx_codeobj__10; + +/* "PyNomad.pyx":12 + * from multiprocessing import Process, Queue + * + * def version(): # <<<<<<<<<<<<<< + * printPyNomadVersion() + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_7PyNomad_1version(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyMethodDef __pyx_mdef_7PyNomad_1version = {"version", (PyCFunction)__pyx_pw_7PyNomad_1version, METH_NOARGS, 0}; +static PyObject *__pyx_pw_7PyNomad_1version(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("version (wrapper)", 0); + __pyx_r = __pyx_pf_7PyNomad_version(__pyx_self); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_7PyNomad_version(CYTHON_UNUSED PyObject *__pyx_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("version", 0); + + /* "PyNomad.pyx":13 + * + * def version(): + * printPyNomadVersion() # <<<<<<<<<<<<<< + * + * # Define the interface function to display nomad general information + */ + printPyNomadVersion(); + + /* "PyNomad.pyx":12 + * from multiprocessing import Process, Queue + * + * def version(): # <<<<<<<<<<<<<< + * printPyNomadVersion() + * + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "PyNomad.pyx":16 + * + * # Define the interface function to display nomad general information + * def usage(): # <<<<<<<<<<<<<< + * printPyNomadUsage() + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_7PyNomad_3usage(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyMethodDef __pyx_mdef_7PyNomad_3usage = {"usage", (PyCFunction)__pyx_pw_7PyNomad_3usage, METH_NOARGS, 0}; +static PyObject *__pyx_pw_7PyNomad_3usage(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("usage (wrapper)", 0); + __pyx_r = __pyx_pf_7PyNomad_2usage(__pyx_self); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_7PyNomad_2usage(CYTHON_UNUSED PyObject *__pyx_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("usage", 0); + + /* "PyNomad.pyx":17 + * # Define the interface function to display nomad general information + * def usage(): + * printPyNomadUsage() # <<<<<<<<<<<<<< + * + * # Define the interface function to display nomad general information + */ + printPyNomadUsage(); + + /* "PyNomad.pyx":16 + * + * # Define the interface function to display nomad general information + * def usage(): # <<<<<<<<<<<<<< + * printPyNomadUsage() + * + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "PyNomad.pyx":20 + * + * # Define the interface function to display nomad general information + * def info(): # <<<<<<<<<<<<<< + * printPyNomadUsage() + * printPyNomadInfo() + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_7PyNomad_5info(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyMethodDef __pyx_mdef_7PyNomad_5info = {"info", (PyCFunction)__pyx_pw_7PyNomad_5info, METH_NOARGS, 0}; +static PyObject *__pyx_pw_7PyNomad_5info(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("info (wrapper)", 0); + __pyx_r = __pyx_pf_7PyNomad_4info(__pyx_self); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_7PyNomad_4info(CYTHON_UNUSED PyObject *__pyx_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("info", 0); + + /* "PyNomad.pyx":21 + * # Define the interface function to display nomad general information + * def info(): + * printPyNomadUsage() # <<<<<<<<<<<<<< + * printPyNomadInfo() + * + */ + printPyNomadUsage(); + + /* "PyNomad.pyx":22 + * def info(): + * printPyNomadUsage() + * printPyNomadInfo() # <<<<<<<<<<<<<< + * + * # Define the interface function to get nomad help + */ + printPyNomadInfo(); + + /* "PyNomad.pyx":20 + * + * # Define the interface function to display nomad general information + * def info(): # <<<<<<<<<<<<<< + * printPyNomadUsage() + * printPyNomadInfo() + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "PyNomad.pyx":25 + * + * # Define the interface function to get nomad help + * def help(about=''): # <<<<<<<<<<<<<< + * printNomadHelp(about) + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_7PyNomad_7help(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_7PyNomad_7help = {"help", (PyCFunction)__pyx_pw_7PyNomad_7help, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_7PyNomad_7help(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_about = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("help (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_about,0}; + PyObject* values[1] = {0}; + values[0] = ((PyObject *)__pyx_kp_s_); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_about); + if (value) { values[0] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "help") < 0)) __PYX_ERR(0, 25, __pyx_L3_error) + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_about = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("help", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 25, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("PyNomad.help", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7PyNomad_6help(__pyx_self, __pyx_v_about); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_7PyNomad_6help(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_about) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + std::string __pyx_t_1; + __Pyx_RefNannySetupContext("help", 0); + + /* "PyNomad.pyx":26 + * # Define the interface function to get nomad help + * def help(about=''): + * printNomadHelp(about) # <<<<<<<<<<<<<< + * + * def __doc__(): + */ + __pyx_t_1 = __pyx_convert_string_from_py_std__in_string(__pyx_v_about); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 26, __pyx_L1_error) + printNomadHelp(__pyx_t_1); + + /* "PyNomad.pyx":25 + * + * # Define the interface function to get nomad help + * def help(about=''): # <<<<<<<<<<<<<< + * printNomadHelp(about) + * + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("PyNomad.help", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "PyNomad.pyx":28 + * printNomadHelp(about) + * + * def __doc__(): # <<<<<<<<<<<<<< + * cdef string about; + * printPyNomadUsage() + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_7PyNomad_9__doc__(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyMethodDef __pyx_mdef_7PyNomad_9__doc__ = {"__doc__", (PyCFunction)__pyx_pw_7PyNomad_9__doc__, METH_NOARGS, 0}; +static PyObject *__pyx_pw_7PyNomad_9__doc__(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__doc__ (wrapper)", 0); + __pyx_r = __pyx_pf_7PyNomad_8__doc__(__pyx_self); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_7PyNomad_8__doc__(CYTHON_UNUSED PyObject *__pyx_self) { + std::string __pyx_v_about; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + __Pyx_RefNannySetupContext("__doc__", 0); + + /* "PyNomad.pyx":30 + * def __doc__(): + * cdef string about; + * printPyNomadUsage() # <<<<<<<<<<<<<< + * help(about) + * + */ + printPyNomadUsage(); + + /* "PyNomad.pyx":31 + * cdef string about; + * printPyNomadUsage() + * help(about) # <<<<<<<<<<<<<< + * + * # Define the interface function to perform optimization + */ + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_help); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 31, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_about); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 31, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (!__pyx_t_4) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 31, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else { + __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 31, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL; + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 31, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "PyNomad.pyx":28 + * printNomadHelp(about) + * + * def __doc__(): # <<<<<<<<<<<<<< + * cdef string about; + * printPyNomadUsage() + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("PyNomad.__doc__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "PyNomad.pyx":34 + * + * # Define the interface function to perform optimization + * def optimize(f , pX0, pLB,pUB ,params): # <<<<<<<<<<<<<< + * cdef PyNomadEval_Point u_feas = PyNomadEval_Point() + * cdef PyNomadEval_Point u_infeas = PyNomadEval_Point() + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_7PyNomad_11optimize(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_7PyNomad_11optimize = {"optimize", (PyCFunction)__pyx_pw_7PyNomad_11optimize, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_7PyNomad_11optimize(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_f = 0; + PyObject *__pyx_v_pX0 = 0; + PyObject *__pyx_v_pLB = 0; + PyObject *__pyx_v_pUB = 0; + PyObject *__pyx_v_params = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("optimize (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_f,&__pyx_n_s_pX0,&__pyx_n_s_pLB,&__pyx_n_s_pUB,&__pyx_n_s_params,0}; + PyObject* values[5] = {0,0,0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_f)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pX0)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("optimize", 1, 5, 5, 1); __PYX_ERR(0, 34, __pyx_L3_error) + } + case 2: + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pLB)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("optimize", 1, 5, 5, 2); __PYX_ERR(0, 34, __pyx_L3_error) + } + case 3: + if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pUB)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("optimize", 1, 5, 5, 3); __PYX_ERR(0, 34, __pyx_L3_error) + } + case 4: + if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_params)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("optimize", 1, 5, 5, 4); __PYX_ERR(0, 34, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "optimize") < 0)) __PYX_ERR(0, 34, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + } + __pyx_v_f = values[0]; + __pyx_v_pX0 = values[1]; + __pyx_v_pLB = values[2]; + __pyx_v_pUB = values[3]; + __pyx_v_params = values[4]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("optimize", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 34, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("PyNomad.optimize", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7PyNomad_10optimize(__pyx_self, __pyx_v_f, __pyx_v_pX0, __pyx_v_pLB, __pyx_v_pUB, __pyx_v_params); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_7PyNomad_10optimize(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_f, PyObject *__pyx_v_pX0, PyObject *__pyx_v_pLB, PyObject *__pyx_v_pUB, PyObject *__pyx_v_params) { + struct __pyx_obj_7PyNomad_PyNomadEval_Point *__pyx_v_u_feas = 0; + struct __pyx_obj_7PyNomad_PyNomadEval_Point *__pyx_v_u_infeas = 0; + int __pyx_v_run_status; + int __pyx_v_nb_evals; + int __pyx_v_nb_iters; + double __pyx_v_f_return; + double __pyx_v_h_return; + PyObject *__pyx_v_x_return = NULL; + PyObject *__pyx_v_i = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + std::vector<double> __pyx_t_2; + std::vector<double> __pyx_t_3; + std::vector<double> __pyx_t_4; + std::vector<std::string> __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + double __pyx_t_10; + Py_ssize_t __pyx_t_11; + PyObject *(*__pyx_t_12)(PyObject *); + PyObject *__pyx_t_13 = NULL; + PyObject *__pyx_t_14 = NULL; + int __pyx_t_15; + PyObject *__pyx_t_16 = NULL; + __Pyx_RefNannySetupContext("optimize", 0); + + /* "PyNomad.pyx":35 + * # Define the interface function to perform optimization + * def optimize(f , pX0, pLB,pUB ,params): + * cdef PyNomadEval_Point u_feas = PyNomadEval_Point() # <<<<<<<<<<<<<< + * cdef PyNomadEval_Point u_infeas = PyNomadEval_Point() + * cdef int run_status + */ + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_7PyNomad_PyNomadEval_Point), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 35, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_u_feas = ((struct __pyx_obj_7PyNomad_PyNomadEval_Point *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "PyNomad.pyx":36 + * def optimize(f , pX0, pLB,pUB ,params): + * cdef PyNomadEval_Point u_feas = PyNomadEval_Point() + * cdef PyNomadEval_Point u_infeas = PyNomadEval_Point() # <<<<<<<<<<<<<< + * cdef int run_status + * cdef int nb_evals = 0 + */ + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_7PyNomad_PyNomadEval_Point), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_u_infeas = ((struct __pyx_obj_7PyNomad_PyNomadEval_Point *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "PyNomad.pyx":38 + * cdef PyNomadEval_Point u_infeas = PyNomadEval_Point() + * cdef int run_status + * cdef int nb_evals = 0 # <<<<<<<<<<<<<< + * cdef int nb_iters = 0 + * cdef double f_return + */ + __pyx_v_nb_evals = 0; + + /* "PyNomad.pyx":39 + * cdef int run_status + * cdef int nb_evals = 0 + * cdef int nb_iters = 0 # <<<<<<<<<<<<<< + * cdef double f_return + * cdef double h_return + */ + __pyx_v_nb_iters = 0; + + /* "PyNomad.pyx":42 + * cdef double f_return + * cdef double h_return + * x_return=[] # <<<<<<<<<<<<<< + * run_status = runNomad(cb, cbL, <void*> f, <vector[double]&> pX0, <vector[double]&> pLB, <vector[double]&> pUB , <vector[string]&> params , u_feas.c_ep ,u_infeas.c_ep , nb_evals, nb_iters) + * if u_feas.c_ep != NULL: + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 42, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_x_return = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "PyNomad.pyx":43 + * cdef double h_return + * x_return=[] + * run_status = runNomad(cb, cbL, <void*> f, <vector[double]&> pX0, <vector[double]&> pLB, <vector[double]&> pUB , <vector[string]&> params , u_feas.c_ep ,u_infeas.c_ep , nb_evals, nb_iters) # <<<<<<<<<<<<<< + * if u_feas.c_ep != NULL: + * f_return = u_feas.get_f() + */ + __pyx_t_2 = __pyx_convert_vector_from_py_double(__pyx_v_pX0); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 43, __pyx_L1_error) + __pyx_t_3 = __pyx_convert_vector_from_py_double(__pyx_v_pLB); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 43, __pyx_L1_error) + __pyx_t_4 = __pyx_convert_vector_from_py_double(__pyx_v_pUB); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 43, __pyx_L1_error) + __pyx_t_5 = __pyx_convert_vector_from_py_std_3a__3a_string(__pyx_v_params); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 43, __pyx_L1_error) + try { + __pyx_t_6 = runNomad(__pyx_f_7PyNomad_cb, __pyx_f_7PyNomad_cbL, ((void *)__pyx_v_f), ((std::vector<double> &)__pyx_t_2), ((std::vector<double> &)__pyx_t_3), ((std::vector<double> &)__pyx_t_4), ((std::vector<std::string> &)__pyx_t_5), __pyx_v_u_feas->c_ep, __pyx_v_u_infeas->c_ep, __pyx_v_nb_evals, __pyx_v_nb_iters); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 43, __pyx_L1_error) + } + __pyx_v_run_status = __pyx_t_6; + + /* "PyNomad.pyx":44 + * x_return=[] + * run_status = runNomad(cb, cbL, <void*> f, <vector[double]&> pX0, <vector[double]&> pLB, <vector[double]&> pUB , <vector[string]&> params , u_feas.c_ep ,u_infeas.c_ep , nb_evals, nb_iters) + * if u_feas.c_ep != NULL: # <<<<<<<<<<<<<< + * f_return = u_feas.get_f() + * h_return = 0 + */ + __pyx_t_7 = ((__pyx_v_u_feas->c_ep != NULL) != 0); + if (__pyx_t_7) { + + /* "PyNomad.pyx":45 + * run_status = runNomad(cb, cbL, <void*> f, <vector[double]&> pX0, <vector[double]&> pLB, <vector[double]&> pUB , <vector[string]&> params , u_feas.c_ep ,u_infeas.c_ep , nb_evals, nb_iters) + * if u_feas.c_ep != NULL: + * f_return = u_feas.get_f() # <<<<<<<<<<<<<< + * h_return = 0 + * for i in xrange(u_feas.get_n()): + */ + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_u_feas), __pyx_n_s_get_f); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 45, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_8))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8); + if (likely(__pyx_t_9)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_8, function); + } + } + if (__pyx_t_9) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } else { + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error) + } + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_10 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 45, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_f_return = __pyx_t_10; + + /* "PyNomad.pyx":46 + * if u_feas.c_ep != NULL: + * f_return = u_feas.get_f() + * h_return = 0 # <<<<<<<<<<<<<< + * for i in xrange(u_feas.get_n()): + * x_return.append(u_feas.get_coord(i)) + */ + __pyx_v_h_return = 0.0; + + /* "PyNomad.pyx":47 + * f_return = u_feas.get_f() + * h_return = 0 + * for i in xrange(u_feas.get_n()): # <<<<<<<<<<<<<< + * x_return.append(u_feas.get_coord(i)) + * del u_feas.c_ep + */ + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_u_feas), __pyx_n_s_get_n); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 47, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_8))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8); + if (likely(__pyx_t_9)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_8, function); + } + } + if (__pyx_t_9) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 47, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } else { + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 47, __pyx_L1_error) + } + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 47, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_xrange, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 47, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_8 = __pyx_t_1; __Pyx_INCREF(__pyx_t_8); __pyx_t_11 = 0; + __pyx_t_12 = NULL; + } else { + __pyx_t_11 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 47, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_12 = Py_TYPE(__pyx_t_8)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 47, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + if (likely(!__pyx_t_12)) { + if (likely(PyList_CheckExact(__pyx_t_8))) { + if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_8)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_11); __Pyx_INCREF(__pyx_t_1); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 47, __pyx_L1_error) + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_8, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 47, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + #endif + } else { + if (__pyx_t_11 >= PyTuple_GET_SIZE(__pyx_t_8)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_11); __Pyx_INCREF(__pyx_t_1); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 47, __pyx_L1_error) + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_8, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 47, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + #endif + } + } else { + __pyx_t_1 = __pyx_t_12(__pyx_t_8); + if (unlikely(!__pyx_t_1)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 47, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1); + __pyx_t_1 = 0; + + /* "PyNomad.pyx":48 + * h_return = 0 + * for i in xrange(u_feas.get_n()): + * x_return.append(u_feas.get_coord(i)) # <<<<<<<<<<<<<< + * del u_feas.c_ep + * if u_infeas.c_ep != NULL: + */ + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_u_feas), __pyx_n_s_get_coord); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 48, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_13 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_9))) { + __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_9); + if (likely(__pyx_t_13)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); + __Pyx_INCREF(__pyx_t_13); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_9, function); + } + } + if (!__pyx_t_13) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 48, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } else { + __pyx_t_14 = PyTuple_New(1+1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 48, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_13); __pyx_t_13 = NULL; + __Pyx_INCREF(__pyx_v_i); + __Pyx_GIVEREF(__pyx_v_i); + PyTuple_SET_ITEM(__pyx_t_14, 0+1, __pyx_v_i); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_14, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 48, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + } + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_15 = __Pyx_PyList_Append(__pyx_v_x_return, __pyx_t_1); if (unlikely(__pyx_t_15 == -1)) __PYX_ERR(0, 48, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "PyNomad.pyx":47 + * f_return = u_feas.get_f() + * h_return = 0 + * for i in xrange(u_feas.get_n()): # <<<<<<<<<<<<<< + * x_return.append(u_feas.get_coord(i)) + * del u_feas.c_ep + */ + } + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + + /* "PyNomad.pyx":49 + * for i in xrange(u_feas.get_n()): + * x_return.append(u_feas.get_coord(i)) + * del u_feas.c_ep # <<<<<<<<<<<<<< + * if u_infeas.c_ep != NULL: + * f_return = u_infeas.get_f() + */ + delete __pyx_v_u_feas->c_ep; + + /* "PyNomad.pyx":44 + * x_return=[] + * run_status = runNomad(cb, cbL, <void*> f, <vector[double]&> pX0, <vector[double]&> pLB, <vector[double]&> pUB , <vector[string]&> params , u_feas.c_ep ,u_infeas.c_ep , nb_evals, nb_iters) + * if u_feas.c_ep != NULL: # <<<<<<<<<<<<<< + * f_return = u_feas.get_f() + * h_return = 0 + */ + } + + /* "PyNomad.pyx":50 + * x_return.append(u_feas.get_coord(i)) + * del u_feas.c_ep + * if u_infeas.c_ep != NULL: # <<<<<<<<<<<<<< + * f_return = u_infeas.get_f() + * h_return = u_infeas.get_h() + */ + __pyx_t_7 = ((__pyx_v_u_infeas->c_ep != NULL) != 0); + if (__pyx_t_7) { + + /* "PyNomad.pyx":51 + * del u_feas.c_ep + * if u_infeas.c_ep != NULL: + * f_return = u_infeas.get_f() # <<<<<<<<<<<<<< + * h_return = u_infeas.get_h() + * for i in xrange(u_infeas.get_n()): + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_u_infeas), __pyx_n_s_get_f); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 51, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_9 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_9)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_1, function); + } + } + if (__pyx_t_9) { + __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 51, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } else { + __pyx_t_8 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 51, __pyx_L1_error) + } + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_t_8); if (unlikely((__pyx_t_10 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 51, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_f_return = __pyx_t_10; + + /* "PyNomad.pyx":52 + * if u_infeas.c_ep != NULL: + * f_return = u_infeas.get_f() + * h_return = u_infeas.get_h() # <<<<<<<<<<<<<< + * for i in xrange(u_infeas.get_n()): + * x_return.append(u_infeas.get_coord(i)) + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_u_infeas), __pyx_n_s_get_h); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 52, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_9 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_9)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_1, function); + } + } + if (__pyx_t_9) { + __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 52, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } else { + __pyx_t_8 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 52, __pyx_L1_error) + } + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_t_8); if (unlikely((__pyx_t_10 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 52, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_h_return = __pyx_t_10; + + /* "PyNomad.pyx":53 + * f_return = u_infeas.get_f() + * h_return = u_infeas.get_h() + * for i in xrange(u_infeas.get_n()): # <<<<<<<<<<<<<< + * x_return.append(u_infeas.get_coord(i)) + * del u_infeas.c_ep + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_u_infeas), __pyx_n_s_get_n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 53, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_9 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_9)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_1, function); + } + } + if (__pyx_t_9) { + __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 53, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } else { + __pyx_t_8 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 53, __pyx_L1_error) + } + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 53, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_8); + __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_xrange, __pyx_t_1, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 53, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (likely(PyList_CheckExact(__pyx_t_8)) || PyTuple_CheckExact(__pyx_t_8)) { + __pyx_t_1 = __pyx_t_8; __Pyx_INCREF(__pyx_t_1); __pyx_t_11 = 0; + __pyx_t_12 = NULL; + } else { + __pyx_t_11 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 53, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_12 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 53, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + for (;;) { + if (likely(!__pyx_t_12)) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_8 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_11); __Pyx_INCREF(__pyx_t_8); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 53, __pyx_L1_error) + #else + __pyx_t_8 = PySequence_ITEM(__pyx_t_1, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 53, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + #endif + } else { + if (__pyx_t_11 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_11); __Pyx_INCREF(__pyx_t_8); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 53, __pyx_L1_error) + #else + __pyx_t_8 = PySequence_ITEM(__pyx_t_1, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 53, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + #endif + } + } else { + __pyx_t_8 = __pyx_t_12(__pyx_t_1); + if (unlikely(!__pyx_t_8)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 53, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_8); + } + __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_8); + __pyx_t_8 = 0; + + /* "PyNomad.pyx":54 + * h_return = u_infeas.get_h() + * for i in xrange(u_infeas.get_n()): + * x_return.append(u_infeas.get_coord(i)) # <<<<<<<<<<<<<< + * del u_infeas.c_ep + * return [ x_return , f_return, h_return, nb_evals , nb_iters , run_status ] + */ + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_u_infeas), __pyx_n_s_get_coord); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 54, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_14 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_9))) { + __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_9); + if (likely(__pyx_t_14)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); + __Pyx_INCREF(__pyx_t_14); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_9, function); + } + } + if (!__pyx_t_14) { + __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_v_i); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 54, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + } else { + __pyx_t_13 = PyTuple_New(1+1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 54, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_14); __pyx_t_14 = NULL; + __Pyx_INCREF(__pyx_v_i); + __Pyx_GIVEREF(__pyx_v_i); + PyTuple_SET_ITEM(__pyx_t_13, 0+1, __pyx_v_i); + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_13, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 54, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + } + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_15 = __Pyx_PyList_Append(__pyx_v_x_return, __pyx_t_8); if (unlikely(__pyx_t_15 == -1)) __PYX_ERR(0, 54, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + + /* "PyNomad.pyx":53 + * f_return = u_infeas.get_f() + * h_return = u_infeas.get_h() + * for i in xrange(u_infeas.get_n()): # <<<<<<<<<<<<<< + * x_return.append(u_infeas.get_coord(i)) + * del u_infeas.c_ep + */ + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "PyNomad.pyx":55 + * for i in xrange(u_infeas.get_n()): + * x_return.append(u_infeas.get_coord(i)) + * del u_infeas.c_ep # <<<<<<<<<<<<<< + * return [ x_return , f_return, h_return, nb_evals , nb_iters , run_status ] + * + */ + delete __pyx_v_u_infeas->c_ep; + + /* "PyNomad.pyx":50 + * x_return.append(u_feas.get_coord(i)) + * del u_feas.c_ep + * if u_infeas.c_ep != NULL: # <<<<<<<<<<<<<< + * f_return = u_infeas.get_f() + * h_return = u_infeas.get_h() + */ + } + + /* "PyNomad.pyx":56 + * x_return.append(u_infeas.get_coord(i)) + * del u_infeas.c_ep + * return [ x_return , f_return, h_return, nb_evals , nb_iters , run_status ] # <<<<<<<<<<<<<< + * + * cdef extern from "Double.hpp" namespace "NOMAD": + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_f_return); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_8 = PyFloat_FromDouble(__pyx_v_h_return); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_nb_evals); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_13 = __Pyx_PyInt_From_int(__pyx_v_nb_iters); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_run_status); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_16 = PyList_New(6); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + __Pyx_INCREF(__pyx_v_x_return); + __Pyx_GIVEREF(__pyx_v_x_return); + PyList_SET_ITEM(__pyx_t_16, 0, __pyx_v_x_return); + __Pyx_GIVEREF(__pyx_t_1); + PyList_SET_ITEM(__pyx_t_16, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_8); + PyList_SET_ITEM(__pyx_t_16, 2, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_9); + PyList_SET_ITEM(__pyx_t_16, 3, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_13); + PyList_SET_ITEM(__pyx_t_16, 4, __pyx_t_13); + __Pyx_GIVEREF(__pyx_t_14); + PyList_SET_ITEM(__pyx_t_16, 5, __pyx_t_14); + __pyx_t_1 = 0; + __pyx_t_8 = 0; + __pyx_t_9 = 0; + __pyx_t_13 = 0; + __pyx_t_14 = 0; + __pyx_r = __pyx_t_16; + __pyx_t_16 = 0; + goto __pyx_L0; + + /* "PyNomad.pyx":34 + * + * # Define the interface function to perform optimization + * def optimize(f , pX0, pLB,pUB ,params): # <<<<<<<<<<<<<< + * cdef PyNomadEval_Point u_feas = PyNomadEval_Point() + * cdef PyNomadEval_Point u_infeas = PyNomadEval_Point() + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_13); + __Pyx_XDECREF(__pyx_t_14); + __Pyx_XDECREF(__pyx_t_16); + __Pyx_AddTraceback("PyNomad.optimize", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_u_feas); + __Pyx_XDECREF((PyObject *)__pyx_v_u_infeas); + __Pyx_XDECREF(__pyx_v_x_return); + __Pyx_XDECREF(__pyx_v_i); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "PyNomad.pyx":65 + * cdef class PyNomadDouble: + * cdef Double c_d + * def value(self): # <<<<<<<<<<<<<< + * return self.c_d.value() + * def is_defined(self): + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_7PyNomad_13PyNomadDouble_1value(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7PyNomad_13PyNomadDouble_1value(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("value (wrapper)", 0); + __pyx_r = __pyx_pf_7PyNomad_13PyNomadDouble_value(((struct __pyx_obj_7PyNomad_PyNomadDouble *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_7PyNomad_13PyNomadDouble_value(struct __pyx_obj_7PyNomad_PyNomadDouble *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("value", 0); + + /* "PyNomad.pyx":66 + * cdef Double c_d + * def value(self): + * return self.c_d.value() # <<<<<<<<<<<<<< + * def is_defined(self): + * return self.c_d.is_defined() + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->c_d.value()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 66, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "PyNomad.pyx":65 + * cdef class PyNomadDouble: + * cdef Double c_d + * def value(self): # <<<<<<<<<<<<<< + * return self.c_d.value() + * def is_defined(self): + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("PyNomad.PyNomadDouble.value", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "PyNomad.pyx":67 + * def value(self): + * return self.c_d.value() + * def is_defined(self): # <<<<<<<<<<<<<< + * return self.c_d.is_defined() + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_7PyNomad_13PyNomadDouble_3is_defined(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7PyNomad_13PyNomadDouble_3is_defined(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("is_defined (wrapper)", 0); + __pyx_r = __pyx_pf_7PyNomad_13PyNomadDouble_2is_defined(((struct __pyx_obj_7PyNomad_PyNomadDouble *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_7PyNomad_13PyNomadDouble_2is_defined(struct __pyx_obj_7PyNomad_PyNomadDouble *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("is_defined", 0); + + /* "PyNomad.pyx":68 + * return self.c_d.value() + * def is_defined(self): + * return self.c_d.is_defined() # <<<<<<<<<<<<<< + * + * cdef extern from "Eval_Point.hpp" namespace "NOMAD": + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->c_d.is_defined()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 68, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "PyNomad.pyx":67 + * def value(self): + * return self.c_d.value() + * def is_defined(self): # <<<<<<<<<<<<<< + * return self.c_d.is_defined() + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("PyNomad.PyNomadDouble.is_defined", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "PyNomad.pyx":81 + * cdef class PyNomadEval_Point: + * cdef Eval_Point *c_ep + * def get_coord(self, int i): # <<<<<<<<<<<<<< + * return self.c_ep.value(i) + * def set_bb_output(self,int i, double v): + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_7PyNomad_17PyNomadEval_Point_1get_coord(PyObject *__pyx_v_self, PyObject *__pyx_arg_i); /*proto*/ +static PyObject *__pyx_pw_7PyNomad_17PyNomadEval_Point_1get_coord(PyObject *__pyx_v_self, PyObject *__pyx_arg_i) { + int __pyx_v_i; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_coord (wrapper)", 0); + assert(__pyx_arg_i); { + __pyx_v_i = __Pyx_PyInt_As_int(__pyx_arg_i); if (unlikely((__pyx_v_i == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 81, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("PyNomad.PyNomadEval_Point.get_coord", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7PyNomad_17PyNomadEval_Point_get_coord(((struct __pyx_obj_7PyNomad_PyNomadEval_Point *)__pyx_v_self), ((int)__pyx_v_i)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_7PyNomad_17PyNomadEval_Point_get_coord(struct __pyx_obj_7PyNomad_PyNomadEval_Point *__pyx_v_self, int __pyx_v_i) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("get_coord", 0); + + /* "PyNomad.pyx":82 + * cdef Eval_Point *c_ep + * def get_coord(self, int i): + * return self.c_ep.value(i) # <<<<<<<<<<<<<< + * def set_bb_output(self,int i, double v): + * self.c_ep.set_bb_output(i,v) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->c_ep->value(__pyx_v_i)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 82, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "PyNomad.pyx":81 + * cdef class PyNomadEval_Point: + * cdef Eval_Point *c_ep + * def get_coord(self, int i): # <<<<<<<<<<<<<< + * return self.c_ep.value(i) + * def set_bb_output(self,int i, double v): + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("PyNomad.PyNomadEval_Point.get_coord", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "PyNomad.pyx":83 + * def get_coord(self, int i): + * return self.c_ep.value(i) + * def set_bb_output(self,int i, double v): # <<<<<<<<<<<<<< + * self.c_ep.set_bb_output(i,v) + * def get_f(self): + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_7PyNomad_17PyNomadEval_Point_3set_bb_output(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7PyNomad_17PyNomadEval_Point_3set_bb_output(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_v_i; + double __pyx_v_v; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("set_bb_output (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_i,&__pyx_n_s_v,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_i)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("set_bb_output", 1, 2, 2, 1); __PYX_ERR(0, 83, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_bb_output") < 0)) __PYX_ERR(0, 83, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_i = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_i == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 83, __pyx_L3_error) + __pyx_v_v = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_v == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 83, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("set_bb_output", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 83, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("PyNomad.PyNomadEval_Point.set_bb_output", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7PyNomad_17PyNomadEval_Point_2set_bb_output(((struct __pyx_obj_7PyNomad_PyNomadEval_Point *)__pyx_v_self), __pyx_v_i, __pyx_v_v); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_7PyNomad_17PyNomadEval_Point_2set_bb_output(struct __pyx_obj_7PyNomad_PyNomadEval_Point *__pyx_v_self, int __pyx_v_i, double __pyx_v_v) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("set_bb_output", 0); + + /* "PyNomad.pyx":84 + * return self.c_ep.value(i) + * def set_bb_output(self,int i, double v): + * self.c_ep.set_bb_output(i,v) # <<<<<<<<<<<<<< + * def get_f(self): + * cdef PyNomadDouble f = PyNomadDouble() + */ + __pyx_v_self->c_ep->set_bb_output(__pyx_v_i, __pyx_v_v); + + /* "PyNomad.pyx":83 + * def get_coord(self, int i): + * return self.c_ep.value(i) + * def set_bb_output(self,int i, double v): # <<<<<<<<<<<<<< + * self.c_ep.set_bb_output(i,v) + * def get_f(self): + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "PyNomad.pyx":85 + * def set_bb_output(self,int i, double v): + * self.c_ep.set_bb_output(i,v) + * def get_f(self): # <<<<<<<<<<<<<< + * cdef PyNomadDouble f = PyNomadDouble() + * f.c_d=self.c_ep.get_f() + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_7PyNomad_17PyNomadEval_Point_5get_f(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7PyNomad_17PyNomadEval_Point_5get_f(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_f (wrapper)", 0); + __pyx_r = __pyx_pf_7PyNomad_17PyNomadEval_Point_4get_f(((struct __pyx_obj_7PyNomad_PyNomadEval_Point *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_7PyNomad_17PyNomadEval_Point_4get_f(struct __pyx_obj_7PyNomad_PyNomadEval_Point *__pyx_v_self) { + struct __pyx_obj_7PyNomad_PyNomadDouble *__pyx_v_f = 0; + double __pyx_v_f_d; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + double __pyx_t_5; + __Pyx_RefNannySetupContext("get_f", 0); + + /* "PyNomad.pyx":86 + * self.c_ep.set_bb_output(i,v) + * def get_f(self): + * cdef PyNomadDouble f = PyNomadDouble() # <<<<<<<<<<<<<< + * f.c_d=self.c_ep.get_f() + * cdef double f_d + */ + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_7PyNomad_PyNomadDouble), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_f = ((struct __pyx_obj_7PyNomad_PyNomadDouble *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "PyNomad.pyx":87 + * def get_f(self): + * cdef PyNomadDouble f = PyNomadDouble() + * f.c_d=self.c_ep.get_f() # <<<<<<<<<<<<<< + * cdef double f_d + * if ( f.is_defined() ): + */ + __pyx_v_f->c_d = __pyx_v_self->c_ep->get_f(); + + /* "PyNomad.pyx":89 + * f.c_d=self.c_ep.get_f() + * cdef double f_d + * if ( f.is_defined() ): # <<<<<<<<<<<<<< + * f_d = f.value() + * else: + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_f), __pyx_n_s_is_defined); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 89, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 89, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 89, __pyx_L1_error) + } + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 89, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_4) { + + /* "PyNomad.pyx":90 + * cdef double f_d + * if ( f.is_defined() ): + * f_d = f.value() # <<<<<<<<<<<<<< + * else: + * f_d = float('inf') + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_f), __pyx_n_s_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 90, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 90, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 90, __pyx_L1_error) + } + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 90, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_f_d = __pyx_t_5; + + /* "PyNomad.pyx":89 + * f.c_d=self.c_ep.get_f() + * cdef double f_d + * if ( f.is_defined() ): # <<<<<<<<<<<<<< + * f_d = f.value() + * else: + */ + goto __pyx_L3; + } + + /* "PyNomad.pyx":92 + * f_d = f.value() + * else: + * f_d = float('inf') # <<<<<<<<<<<<<< + * return f_d + * def get_h(self): + */ + /*else*/ { + __pyx_t_5 = __Pyx_PyObject_AsDouble(__pyx_n_s_inf); if (unlikely(__pyx_t_5 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 92, __pyx_L1_error) + __pyx_v_f_d = __pyx_t_5; + } + __pyx_L3:; + + /* "PyNomad.pyx":93 + * else: + * f_d = float('inf') + * return f_d # <<<<<<<<<<<<<< + * def get_h(self): + * cdef PyNomadDouble h = PyNomadDouble() + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_f_d); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 93, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "PyNomad.pyx":85 + * def set_bb_output(self,int i, double v): + * self.c_ep.set_bb_output(i,v) + * def get_f(self): # <<<<<<<<<<<<<< + * cdef PyNomadDouble f = PyNomadDouble() + * f.c_d=self.c_ep.get_f() + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("PyNomad.PyNomadEval_Point.get_f", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_f); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "PyNomad.pyx":94 + * f_d = float('inf') + * return f_d + * def get_h(self): # <<<<<<<<<<<<<< + * cdef PyNomadDouble h = PyNomadDouble() + * h.c_d=self.c_ep.get_h() + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_7PyNomad_17PyNomadEval_Point_7get_h(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7PyNomad_17PyNomadEval_Point_7get_h(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_h (wrapper)", 0); + __pyx_r = __pyx_pf_7PyNomad_17PyNomadEval_Point_6get_h(((struct __pyx_obj_7PyNomad_PyNomadEval_Point *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_7PyNomad_17PyNomadEval_Point_6get_h(struct __pyx_obj_7PyNomad_PyNomadEval_Point *__pyx_v_self) { + struct __pyx_obj_7PyNomad_PyNomadDouble *__pyx_v_h = 0; + double __pyx_v_h_d; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + double __pyx_t_5; + __Pyx_RefNannySetupContext("get_h", 0); + + /* "PyNomad.pyx":95 + * return f_d + * def get_h(self): + * cdef PyNomadDouble h = PyNomadDouble() # <<<<<<<<<<<<<< + * h.c_d=self.c_ep.get_h() + * cdef double h_d + */ + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_7PyNomad_PyNomadDouble), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 95, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_h = ((struct __pyx_obj_7PyNomad_PyNomadDouble *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "PyNomad.pyx":96 + * def get_h(self): + * cdef PyNomadDouble h = PyNomadDouble() + * h.c_d=self.c_ep.get_h() # <<<<<<<<<<<<<< + * cdef double h_d + * if ( h.is_defined() ): + */ + __pyx_v_h->c_d = __pyx_v_self->c_ep->get_h(); + + /* "PyNomad.pyx":98 + * h.c_d=self.c_ep.get_h() + * cdef double h_d + * if ( h.is_defined() ): # <<<<<<<<<<<<<< + * h_d = h.value() + * else: + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_h), __pyx_n_s_is_defined); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 98, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 98, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 98, __pyx_L1_error) + } + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 98, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_4) { + + /* "PyNomad.pyx":99 + * cdef double h_d + * if ( h.is_defined() ): + * h_d = h.value() # <<<<<<<<<<<<<< + * else: + * h_d = 0 + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_h), __pyx_n_s_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 99, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 99, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 99, __pyx_L1_error) + } + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 99, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_h_d = __pyx_t_5; + + /* "PyNomad.pyx":98 + * h.c_d=self.c_ep.get_h() + * cdef double h_d + * if ( h.is_defined() ): # <<<<<<<<<<<<<< + * h_d = h.value() + * else: + */ + goto __pyx_L3; + } + + /* "PyNomad.pyx":101 + * h_d = h.value() + * else: + * h_d = 0 # <<<<<<<<<<<<<< + * return h_d + * + */ + /*else*/ { + __pyx_v_h_d = 0.0; + } + __pyx_L3:; + + /* "PyNomad.pyx":102 + * else: + * h_d = 0 + * return h_d # <<<<<<<<<<<<<< + * + * def get_n(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_h_d); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 102, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "PyNomad.pyx":94 + * f_d = float('inf') + * return f_d + * def get_h(self): # <<<<<<<<<<<<<< + * cdef PyNomadDouble h = PyNomadDouble() + * h.c_d=self.c_ep.get_h() + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("PyNomad.PyNomadEval_Point.get_h", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_h); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "PyNomad.pyx":104 + * return h_d + * + * def get_n(self): # <<<<<<<<<<<<<< + * cdef int n + * n = self.c_ep.get_n() + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_7PyNomad_17PyNomadEval_Point_9get_n(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7PyNomad_17PyNomadEval_Point_9get_n(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_n (wrapper)", 0); + __pyx_r = __pyx_pf_7PyNomad_17PyNomadEval_Point_8get_n(((struct __pyx_obj_7PyNomad_PyNomadEval_Point *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_7PyNomad_17PyNomadEval_Point_8get_n(struct __pyx_obj_7PyNomad_PyNomadEval_Point *__pyx_v_self) { + int __pyx_v_n; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("get_n", 0); + + /* "PyNomad.pyx":106 + * def get_n(self): + * cdef int n + * n = self.c_ep.get_n() # <<<<<<<<<<<<<< + * return n + * def get_m(self): + */ + __pyx_v_n = __pyx_v_self->c_ep->get_n(); + + /* "PyNomad.pyx":107 + * cdef int n + * n = self.c_ep.get_n() + * return n # <<<<<<<<<<<<<< + * def get_m(self): + * cdef int m + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 107, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "PyNomad.pyx":104 + * return h_d + * + * def get_n(self): # <<<<<<<<<<<<<< + * cdef int n + * n = self.c_ep.get_n() + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("PyNomad.PyNomadEval_Point.get_n", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "PyNomad.pyx":108 + * n = self.c_ep.get_n() + * return n + * def get_m(self): # <<<<<<<<<<<<<< + * cdef int m + * m = self.c_ep.get_m() + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_7PyNomad_17PyNomadEval_Point_11get_m(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7PyNomad_17PyNomadEval_Point_11get_m(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_m (wrapper)", 0); + __pyx_r = __pyx_pf_7PyNomad_17PyNomadEval_Point_10get_m(((struct __pyx_obj_7PyNomad_PyNomadEval_Point *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_7PyNomad_17PyNomadEval_Point_10get_m(struct __pyx_obj_7PyNomad_PyNomadEval_Point *__pyx_v_self) { + int __pyx_v_m; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("get_m", 0); + + /* "PyNomad.pyx":110 + * def get_m(self): + * cdef int m + * m = self.c_ep.get_m() # <<<<<<<<<<<<<< + * return m + * + */ + __pyx_v_m = __pyx_v_self->c_ep->get_m(); + + /* "PyNomad.pyx":111 + * cdef int m + * m = self.c_ep.get_m() + * return m # <<<<<<<<<<<<<< + * + * cdef extern from "nomadCySimpleInterface.cpp": + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_m); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 111, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "PyNomad.pyx":108 + * n = self.c_ep.get_n() + * return n + * def get_m(self): # <<<<<<<<<<<<<< + * cdef int m + * m = self.c_ep.get_m() + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("PyNomad.PyNomadEval_Point.get_m", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "PyNomad.pyx":123 + * + * # Define callback function for a single Eval_Point ---> link with Python + * cdef int cb(void *f, Eval_Point & x): # <<<<<<<<<<<<<< + * cdef PyNomadEval_Point u = PyNomadEval_Point() + * u.c_ep = &x + */ + +static int __pyx_f_7PyNomad_cb(void *__pyx_v_f, NOMAD::Eval_Point &__pyx_v_x) { + struct __pyx_obj_7PyNomad_PyNomadEval_Point *__pyx_v_u = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + __Pyx_RefNannySetupContext("cb", 0); + + /* "PyNomad.pyx":124 + * # Define callback function for a single Eval_Point ---> link with Python + * cdef int cb(void *f, Eval_Point & x): + * cdef PyNomadEval_Point u = PyNomadEval_Point() # <<<<<<<<<<<<<< + * u.c_ep = &x + * return (<object>f)(u) + */ + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_7PyNomad_PyNomadEval_Point), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 124, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_u = ((struct __pyx_obj_7PyNomad_PyNomadEval_Point *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "PyNomad.pyx":125 + * cdef int cb(void *f, Eval_Point & x): + * cdef PyNomadEval_Point u = PyNomadEval_Point() + * u.c_ep = &x # <<<<<<<<<<<<<< + * return (<object>f)(u) + * + */ + __pyx_v_u->c_ep = (&__pyx_v_x); + + /* "PyNomad.pyx":126 + * cdef PyNomadEval_Point u = PyNomadEval_Point() + * u.c_ep = &x + * return (<object>f)(u) # <<<<<<<<<<<<<< + * + * # Define callback function for block evaluation of a list of Eval_Points ---> link with Python + */ + __Pyx_INCREF(((PyObject *)__pyx_v_f)); + __pyx_t_2 = ((PyObject *)__pyx_v_f); __pyx_t_3 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (!__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, ((PyObject *)__pyx_v_u)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 126, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } else { + __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 126, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL; + __Pyx_INCREF(((PyObject *)__pyx_v_u)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_u)); + PyTuple_SET_ITEM(__pyx_t_4, 0+1, ((PyObject *)__pyx_v_u)); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 126, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 126, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_5; + goto __pyx_L0; + + /* "PyNomad.pyx":123 + * + * # Define callback function for a single Eval_Point ---> link with Python + * cdef int cb(void *f, Eval_Point & x): # <<<<<<<<<<<<<< + * cdef PyNomadEval_Point u = PyNomadEval_Point() + * u.c_ep = &x + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_WriteUnraisable("PyNomad.cb", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_u); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "PyNomad.pyx":129 + * + * # Define callback function for block evaluation of a list of Eval_Points ---> link with Python + * cdef int cbL(void *f, list[Eval_Point *] & x): # <<<<<<<<<<<<<< + * cdef size_t size = x.size() + * cdef PyNomadEval_Point u + */ + +static int __pyx_f_7PyNomad_cbL(void *__pyx_v_f, std::list<NOMAD::Eval_Point *> &__pyx_v_x) { + size_t __pyx_v_size; + struct __pyx_obj_7PyNomad_PyNomadEval_Point *__pyx_v_u = 0; + std::list<NOMAD::Eval_Point *> ::iterator __pyx_v_it; + NOMAD::Eval_Point *__pyx_v_c_ep; + PyObject *__pyx_v_out = NULL; + CYTHON_UNUSED size_t __pyx_v_i; + PyObject *__pyx_v_proc = NULL; + PyObject *__pyx_v_p = NULL; + PyObject *__pyx_v_bb_out = NULL; + Py_ssize_t __pyx_v_j; + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + size_t __pyx_t_4; + size_t __pyx_t_5; + int __pyx_t_6; + Py_ssize_t __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + int __pyx_t_9; + int __pyx_t_10; + Py_ssize_t __pyx_t_11; + double __pyx_t_12; + __Pyx_RefNannySetupContext("cbL", 0); + + /* "PyNomad.pyx":130 + * # Define callback function for block evaluation of a list of Eval_Points ---> link with Python + * cdef int cbL(void *f, list[Eval_Point *] & x): + * cdef size_t size = x.size() # <<<<<<<<<<<<<< + * cdef PyNomadEval_Point u + * cdef list[Eval_Point *].iterator it = x.begin() + */ + __pyx_v_size = __pyx_v_x.size(); + + /* "PyNomad.pyx":132 + * cdef size_t size = x.size() + * cdef PyNomadEval_Point u + * cdef list[Eval_Point *].iterator it = x.begin() # <<<<<<<<<<<<<< + * cdef Eval_Point *c_ep + * + */ + __pyx_v_it = __pyx_v_x.begin(); + + /* "PyNomad.pyx":136 + * + * # Start the process for each Eval_Point of the list + * out = Queue() # <<<<<<<<<<<<<< + * for i in xrange(size): + * u = PyNomadEval_Point() + */ + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_Queue); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 136, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 136, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 136, __pyx_L1_error) + } + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_out = __pyx_t_1; + __pyx_t_1 = 0; + + /* "PyNomad.pyx":137 + * # Start the process for each Eval_Point of the list + * out = Queue() + * for i in xrange(size): # <<<<<<<<<<<<<< + * u = PyNomadEval_Point() + * c_ep = deref(it) + */ + __pyx_t_4 = __pyx_v_size; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; + + /* "PyNomad.pyx":138 + * out = Queue() + * for i in xrange(size): + * u = PyNomadEval_Point() # <<<<<<<<<<<<<< + * c_ep = deref(it) + * u.c_ep = c_ep + */ + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_7PyNomad_PyNomadEval_Point), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 138, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_XDECREF_SET(__pyx_v_u, ((struct __pyx_obj_7PyNomad_PyNomadEval_Point *)__pyx_t_1)); + __pyx_t_1 = 0; + + /* "PyNomad.pyx":139 + * for i in xrange(size): + * u = PyNomadEval_Point() + * c_ep = deref(it) # <<<<<<<<<<<<<< + * u.c_ep = c_ep + * proc = [] + */ + __pyx_v_c_ep = (*__pyx_v_it); + + /* "PyNomad.pyx":140 + * u = PyNomadEval_Point() + * c_ep = deref(it) + * u.c_ep = c_ep # <<<<<<<<<<<<<< + * proc = [] + * p = Process(target=<object>f, args=(u,out,)) # u is copied + */ + __pyx_v_u->c_ep = __pyx_v_c_ep; + + /* "PyNomad.pyx":141 + * c_ep = deref(it) + * u.c_ep = c_ep + * proc = [] # <<<<<<<<<<<<<< + * p = Process(target=<object>f, args=(u,out,)) # u is copied + * p.start() + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 141, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_XDECREF_SET(__pyx_v_proc, ((PyObject*)__pyx_t_1)); + __pyx_t_1 = 0; + + /* "PyNomad.pyx":142 + * u.c_ep = c_ep + * proc = [] + * p = Process(target=<object>f, args=(u,out,)) # u is copied # <<<<<<<<<<<<<< + * p.start() + * proc.append(p) + */ + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_Process); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 142, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 142, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_target, ((PyObject *)__pyx_v_f)) < 0) __PYX_ERR(0, 142, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 142, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_v_u)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_u)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_u)); + __Pyx_INCREF(__pyx_v_out); + __Pyx_GIVEREF(__pyx_v_out); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_out); + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_args, __pyx_t_3) < 0) __PYX_ERR(0, 142, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 142, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF_SET(__pyx_v_p, __pyx_t_3); + __pyx_t_3 = 0; + + /* "PyNomad.pyx":143 + * proc = [] + * p = Process(target=<object>f, args=(u,out,)) # u is copied + * p.start() # <<<<<<<<<<<<<< + * proc.append(p) + * inc(it) + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_p, __pyx_n_s_start); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 143, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_1)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_1); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (__pyx_t_1) { + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 143, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else { + __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 143, __pyx_L1_error) + } + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "PyNomad.pyx":144 + * p = Process(target=<object>f, args=(u,out,)) # u is copied + * p.start() + * proc.append(p) # <<<<<<<<<<<<<< + * inc(it) + * + */ + __pyx_t_6 = __Pyx_PyList_Append(__pyx_v_proc, __pyx_v_p); if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(0, 144, __pyx_L1_error) + + /* "PyNomad.pyx":145 + * p.start() + * proc.append(p) + * inc(it) # <<<<<<<<<<<<<< + * + * # Wait for all the processes to end + */ + (++__pyx_v_it); + } + + /* "PyNomad.pyx":148 + * + * # Wait for all the processes to end + * for p in proc: # <<<<<<<<<<<<<< + * p.join() + * + */ + if (unlikely(!__pyx_v_proc)) { __Pyx_RaiseUnboundLocalError("proc"); __PYX_ERR(0, 148, __pyx_L1_error) } + __pyx_t_3 = __pyx_v_proc; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0; + for (;;) { + if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 148, __pyx_L1_error) + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 148, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #endif + __Pyx_XDECREF_SET(__pyx_v_p, __pyx_t_2); + __pyx_t_2 = 0; + + /* "PyNomad.pyx":149 + * # Wait for all the processes to end + * for p in proc: + * p.join() # <<<<<<<<<<<<<< + * + * # Update the Eval_Points bb_output from the out Queue + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_p, __pyx_n_s_join); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 149, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_8 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_8)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_1, function); + } + } + if (__pyx_t_8) { + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 149, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } else { + __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 149, __pyx_L1_error) + } + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "PyNomad.pyx":148 + * + * # Wait for all the processes to end + * for p in proc: # <<<<<<<<<<<<<< + * p.join() + * + */ + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "PyNomad.pyx":152 + * + * # Update the Eval_Points bb_output from the out Queue + * it = x.begin() # <<<<<<<<<<<<<< + * for i in xrange(size): + * c_ep = deref(it) + */ + __pyx_v_it = __pyx_v_x.begin(); + + /* "PyNomad.pyx":153 + * # Update the Eval_Points bb_output from the out Queue + * it = x.begin() + * for i in xrange(size): # <<<<<<<<<<<<<< + * c_ep = deref(it) + * bb_out = out.get() + */ + __pyx_t_4 = __pyx_v_size; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; + + /* "PyNomad.pyx":154 + * it = x.begin() + * for i in xrange(size): + * c_ep = deref(it) # <<<<<<<<<<<<<< + * bb_out = out.get() + * if type(bb_out) != type(float) or type(bb_out) != type(int): + */ + __pyx_v_c_ep = (*__pyx_v_it); + + /* "PyNomad.pyx":155 + * for i in xrange(size): + * c_ep = deref(it) + * bb_out = out.get() # <<<<<<<<<<<<<< + * if type(bb_out) != type(float) or type(bb_out) != type(int): + * for j in xrange(len(bb_out)): + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_out, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 155, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_1)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_1); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (__pyx_t_1) { + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 155, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else { + __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 155, __pyx_L1_error) + } + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF_SET(__pyx_v_bb_out, __pyx_t_3); + __pyx_t_3 = 0; + + /* "PyNomad.pyx":156 + * c_ep = deref(it) + * bb_out = out.get() + * if type(bb_out) != type(float) or type(bb_out) != type(int): # <<<<<<<<<<<<<< + * for j in xrange(len(bb_out)): + * c_ep.set_bb_output(j,bb_out[j]) + */ + __pyx_t_3 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_bb_out)), ((PyObject *)Py_TYPE(((PyObject *)(&PyFloat_Type)))), Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 156, __pyx_L1_error) + __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 156, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!__pyx_t_10) { + } else { + __pyx_t_9 = __pyx_t_10; + goto __pyx_L10_bool_binop_done; + } + __pyx_t_3 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_bb_out)), ((PyObject *)Py_TYPE(((PyObject *)(&PyInt_Type)))), Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 156, __pyx_L1_error) + __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 156, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_9 = __pyx_t_10; + __pyx_L10_bool_binop_done:; + if (__pyx_t_9) { + + /* "PyNomad.pyx":157 + * bb_out = out.get() + * if type(bb_out) != type(float) or type(bb_out) != type(int): + * for j in xrange(len(bb_out)): # <<<<<<<<<<<<<< + * c_ep.set_bb_output(j,bb_out[j]) + * else: + */ + __pyx_t_7 = PyObject_Length(__pyx_v_bb_out); if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(0, 157, __pyx_L1_error) + for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_7; __pyx_t_11+=1) { + __pyx_v_j = __pyx_t_11; + + /* "PyNomad.pyx":158 + * if type(bb_out) != type(float) or type(bb_out) != type(int): + * for j in xrange(len(bb_out)): + * c_ep.set_bb_output(j,bb_out[j]) # <<<<<<<<<<<<<< + * else: + * c_ep.set_bb_output(0,bb_out) + */ + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_bb_out, __pyx_v_j, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 158, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 158, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_c_ep->set_bb_output(__pyx_v_j, __pyx_t_12); + } + + /* "PyNomad.pyx":156 + * c_ep = deref(it) + * bb_out = out.get() + * if type(bb_out) != type(float) or type(bb_out) != type(int): # <<<<<<<<<<<<<< + * for j in xrange(len(bb_out)): + * c_ep.set_bb_output(j,bb_out[j]) + */ + goto __pyx_L9; + } + + /* "PyNomad.pyx":160 + * c_ep.set_bb_output(j,bb_out[j]) + * else: + * c_ep.set_bb_output(0,bb_out) # <<<<<<<<<<<<<< + * + * inc(it) + */ + /*else*/ { + __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_v_bb_out); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 160, __pyx_L1_error) + __pyx_v_c_ep->set_bb_output(0, __pyx_t_12); + } + __pyx_L9:; + + /* "PyNomad.pyx":162 + * c_ep.set_bb_output(0,bb_out) + * + * inc(it) # <<<<<<<<<<<<<< + * + * return 1 # 1 is success + */ + (++__pyx_v_it); + } + + /* "PyNomad.pyx":164 + * inc(it) + * + * return 1 # 1 is success # <<<<<<<<<<<<<< + * + */ + __pyx_r = 1; + goto __pyx_L0; + + /* "PyNomad.pyx":129 + * + * # Define callback function for block evaluation of a list of Eval_Points ---> link with Python + * cdef int cbL(void *f, list[Eval_Point *] & x): # <<<<<<<<<<<<<< + * cdef size_t size = x.size() + * cdef PyNomadEval_Point u + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_WriteUnraisable("PyNomad.cbL", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_u); + __Pyx_XDECREF(__pyx_v_out); + __Pyx_XDECREF(__pyx_v_proc); + __Pyx_XDECREF(__pyx_v_p); + __Pyx_XDECREF(__pyx_v_bb_out); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "string.from_py":13 + * + * @cname("__pyx_convert_string_from_py_std__in_string") + * cdef string __pyx_convert_string_from_py_std__in_string(object o) except *: # <<<<<<<<<<<<<< + * cdef Py_ssize_t length + * cdef char* data = __Pyx_PyObject_AsStringAndSize(o, &length) + */ + +static std::string __pyx_convert_string_from_py_std__in_string(PyObject *__pyx_v_o) { + Py_ssize_t __pyx_v_length; + char *__pyx_v_data; + std::string __pyx_r; + __Pyx_RefNannyDeclarations + char *__pyx_t_1; + __Pyx_RefNannySetupContext("__pyx_convert_string_from_py_std__in_string", 0); + + /* "string.from_py":15 + * cdef string __pyx_convert_string_from_py_std__in_string(object o) except *: + * cdef Py_ssize_t length + * cdef char* data = __Pyx_PyObject_AsStringAndSize(o, &length) # <<<<<<<<<<<<<< + * return string(data, length) + * + */ + __pyx_t_1 = __Pyx_PyObject_AsStringAndSize(__pyx_v_o, (&__pyx_v_length)); if (unlikely(__pyx_t_1 == NULL)) __PYX_ERR(1, 15, __pyx_L1_error) + __pyx_v_data = __pyx_t_1; + + /* "string.from_py":16 + * cdef Py_ssize_t length + * cdef char* data = __Pyx_PyObject_AsStringAndSize(o, &length) + * return string(data, length) # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = std::string(__pyx_v_data, __pyx_v_length); + goto __pyx_L0; + + /* "string.from_py":13 + * + * @cname("__pyx_convert_string_from_py_std__in_string") + * cdef string __pyx_convert_string_from_py_std__in_string(object o) except *: # <<<<<<<<<<<<<< + * cdef Py_ssize_t length + * cdef char* data = __Pyx_PyObject_AsStringAndSize(o, &length) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("string.from_py.__pyx_convert_string_from_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "string.to_py":31 + * + * @cname("__pyx_convert_PyObject_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyObject_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< + * return __Pyx_PyObject_FromStringAndSize(s.data(), s.size()) + * cdef extern from *: + */ + +static CYTHON_INLINE PyObject *__pyx_convert_PyObject_string_to_py_std__in_string(std::string const &__pyx_v_s) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__pyx_convert_PyObject_string_to_py_std__in_string", 0); + + /* "string.to_py":32 + * @cname("__pyx_convert_PyObject_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyObject_string_to_py_std__in_string(const string& s): + * return __Pyx_PyObject_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<< + * cdef extern from *: + * cdef object __Pyx_PyUnicode_FromStringAndSize(char*, size_t) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 32, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "string.to_py":31 + * + * @cname("__pyx_convert_PyObject_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyObject_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< + * return __Pyx_PyObject_FromStringAndSize(s.data(), s.size()) + * cdef extern from *: + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("string.to_py.__pyx_convert_PyObject_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "string.to_py":37 + * + * @cname("__pyx_convert_PyUnicode_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyUnicode_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< + * return __Pyx_PyUnicode_FromStringAndSize(s.data(), s.size()) + * cdef extern from *: + */ + +static CYTHON_INLINE PyObject *__pyx_convert_PyUnicode_string_to_py_std__in_string(std::string const &__pyx_v_s) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__pyx_convert_PyUnicode_string_to_py_std__in_string", 0); + + /* "string.to_py":38 + * @cname("__pyx_convert_PyUnicode_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyUnicode_string_to_py_std__in_string(const string& s): + * return __Pyx_PyUnicode_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<< + * cdef extern from *: + * cdef object __Pyx_PyStr_FromStringAndSize(char*, size_t) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyUnicode_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 38, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "string.to_py":37 + * + * @cname("__pyx_convert_PyUnicode_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyUnicode_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< + * return __Pyx_PyUnicode_FromStringAndSize(s.data(), s.size()) + * cdef extern from *: + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("string.to_py.__pyx_convert_PyUnicode_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "string.to_py":43 + * + * @cname("__pyx_convert_PyStr_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyStr_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< + * return __Pyx_PyStr_FromStringAndSize(s.data(), s.size()) + * cdef extern from *: + */ + +static CYTHON_INLINE PyObject *__pyx_convert_PyStr_string_to_py_std__in_string(std::string const &__pyx_v_s) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__pyx_convert_PyStr_string_to_py_std__in_string", 0); + + /* "string.to_py":44 + * @cname("__pyx_convert_PyStr_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyStr_string_to_py_std__in_string(const string& s): + * return __Pyx_PyStr_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<< + * cdef extern from *: + * cdef object __Pyx_PyBytes_FromStringAndSize(char*, size_t) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyStr_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 44, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "string.to_py":43 + * + * @cname("__pyx_convert_PyStr_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyStr_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< + * return __Pyx_PyStr_FromStringAndSize(s.data(), s.size()) + * cdef extern from *: + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("string.to_py.__pyx_convert_PyStr_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "string.to_py":49 + * + * @cname("__pyx_convert_PyBytes_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyBytes_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< + * return __Pyx_PyBytes_FromStringAndSize(s.data(), s.size()) + * cdef extern from *: + */ + +static CYTHON_INLINE PyObject *__pyx_convert_PyBytes_string_to_py_std__in_string(std::string const &__pyx_v_s) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__pyx_convert_PyBytes_string_to_py_std__in_string", 0); + + /* "string.to_py":50 + * @cname("__pyx_convert_PyBytes_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyBytes_string_to_py_std__in_string(const string& s): + * return __Pyx_PyBytes_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<< + * cdef extern from *: + * cdef object __Pyx_PyByteArray_FromStringAndSize(char*, size_t) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 50, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "string.to_py":49 + * + * @cname("__pyx_convert_PyBytes_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyBytes_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< + * return __Pyx_PyBytes_FromStringAndSize(s.data(), s.size()) + * cdef extern from *: + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("string.to_py.__pyx_convert_PyBytes_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "string.to_py":55 + * + * @cname("__pyx_convert_PyByteArray_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyByteArray_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< + * return __Pyx_PyByteArray_FromStringAndSize(s.data(), s.size()) + * + */ + +static CYTHON_INLINE PyObject *__pyx_convert_PyByteArray_string_to_py_std__in_string(std::string const &__pyx_v_s) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__pyx_convert_PyByteArray_string_to_py_std__in_string", 0); + + /* "string.to_py":56 + * @cname("__pyx_convert_PyByteArray_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyByteArray_string_to_py_std__in_string(const string& s): + * return __Pyx_PyByteArray_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<< + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyByteArray_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "string.to_py":55 + * + * @cname("__pyx_convert_PyByteArray_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyByteArray_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< + * return __Pyx_PyByteArray_FromStringAndSize(s.data(), s.size()) + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("string.to_py.__pyx_convert_PyByteArray_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "vector.from_py":49 + * + * @cname("__pyx_convert_vector_from_py_double") + * cdef vector[X] __pyx_convert_vector_from_py_double(object o) except *: # <<<<<<<<<<<<<< + * cdef vector[X] v + * for item in o: + */ + +static std::vector<double> __pyx_convert_vector_from_py_double(PyObject *__pyx_v_o) { + std::vector<double> __pyx_v_v; + PyObject *__pyx_v_item = NULL; + std::vector<double> __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *(*__pyx_t_3)(PyObject *); + PyObject *__pyx_t_4 = NULL; + double __pyx_t_5; + __Pyx_RefNannySetupContext("__pyx_convert_vector_from_py_double", 0); + + /* "vector.from_py":51 + * cdef vector[X] __pyx_convert_vector_from_py_double(object o) except *: + * cdef vector[X] v + * for item in o: # <<<<<<<<<<<<<< + * v.push_back(X_from_py(item)) + * return v + */ + if (likely(PyList_CheckExact(__pyx_v_o)) || PyTuple_CheckExact(__pyx_v_o)) { + __pyx_t_1 = __pyx_v_o; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; + __pyx_t_3 = NULL; + } else { + __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_o); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 51, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 51, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_3)) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(1, 51, __pyx_L1_error) + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 51, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #endif + } else { + if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(1, 51, __pyx_L1_error) + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 51, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #endif + } + } else { + __pyx_t_4 = __pyx_t_3(__pyx_t_1); + if (unlikely(!__pyx_t_4)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(1, 51, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_4); + __pyx_t_4 = 0; + + /* "vector.from_py":52 + * cdef vector[X] v + * for item in o: + * v.push_back(X_from_py(item)) # <<<<<<<<<<<<<< + * return v + * + */ + __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_v_item); if (unlikely(__pyx_t_5 == -1.0 && PyErr_Occurred())) __PYX_ERR(1, 52, __pyx_L1_error) + __pyx_v_v.push_back(__pyx_t_5); + + /* "vector.from_py":51 + * cdef vector[X] __pyx_convert_vector_from_py_double(object o) except *: + * cdef vector[X] v + * for item in o: # <<<<<<<<<<<<<< + * v.push_back(X_from_py(item)) + * return v + */ + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "vector.from_py":53 + * for item in o: + * v.push_back(X_from_py(item)) + * return v # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = __pyx_v_v; + goto __pyx_L0; + + /* "vector.from_py":49 + * + * @cname("__pyx_convert_vector_from_py_double") + * cdef vector[X] __pyx_convert_vector_from_py_double(object o) except *: # <<<<<<<<<<<<<< + * cdef vector[X] v + * for item in o: + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("vector.from_py.__pyx_convert_vector_from_py_double", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_item); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "vector.from_py":50 + * + * @cname("__pyx_convert_vector_from_py_std_3a__3a_string") + * cdef vector[X] __pyx_convert_vector_from_py_std_3a__3a_string(object o) except *: # <<<<<<<<<<<<<< + * cdef vector[X] v + * for item in o: + */ + +static std::vector<std::string> __pyx_convert_vector_from_py_std_3a__3a_string(PyObject *__pyx_v_o) { + std::vector<std::string> __pyx_v_v; + PyObject *__pyx_v_item = NULL; + std::vector<std::string> __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *(*__pyx_t_3)(PyObject *); + PyObject *__pyx_t_4 = NULL; + std::string __pyx_t_5; + __Pyx_RefNannySetupContext("__pyx_convert_vector_from_py_std_3a__3a_string", 0); + + /* "vector.from_py":52 + * cdef vector[X] __pyx_convert_vector_from_py_std_3a__3a_string(object o) except *: + * cdef vector[X] v + * for item in o: # <<<<<<<<<<<<<< + * v.push_back(X_from_py(item)) + * return v + */ + if (likely(PyList_CheckExact(__pyx_v_o)) || PyTuple_CheckExact(__pyx_v_o)) { + __pyx_t_1 = __pyx_v_o; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; + __pyx_t_3 = NULL; + } else { + __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_o); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 52, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 52, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_3)) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(1, 52, __pyx_L1_error) + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 52, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #endif + } else { + if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(1, 52, __pyx_L1_error) + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 52, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #endif + } + } else { + __pyx_t_4 = __pyx_t_3(__pyx_t_1); + if (unlikely(!__pyx_t_4)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(1, 52, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_4); + __pyx_t_4 = 0; + + /* "vector.from_py":53 + * cdef vector[X] v + * for item in o: + * v.push_back(X_from_py(item)) # <<<<<<<<<<<<<< + * return v + * + */ + __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_v_item); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 53, __pyx_L1_error) + __pyx_v_v.push_back(__pyx_t_5); + + /* "vector.from_py":52 + * cdef vector[X] __pyx_convert_vector_from_py_std_3a__3a_string(object o) except *: + * cdef vector[X] v + * for item in o: # <<<<<<<<<<<<<< + * v.push_back(X_from_py(item)) + * return v + */ + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "vector.from_py":54 + * for item in o: + * v.push_back(X_from_py(item)) + * return v # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = __pyx_v_v; + goto __pyx_L0; + + /* "vector.from_py":50 + * + * @cname("__pyx_convert_vector_from_py_std_3a__3a_string") + * cdef vector[X] __pyx_convert_vector_from_py_std_3a__3a_string(object o) except *: # <<<<<<<<<<<<<< + * cdef vector[X] v + * for item in o: + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("vector.from_py.__pyx_convert_vector_from_py_std_3a__3a_string", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_item); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_tp_new_7PyNomad_PyNomadDouble(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_7PyNomad_PyNomadDouble *p; + PyObject *o; + if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_7PyNomad_PyNomadDouble *)o); + new((void*)&(p->c_d)) NOMAD::Double(); + return o; +} + +static void __pyx_tp_dealloc_7PyNomad_PyNomadDouble(PyObject *o) { + struct __pyx_obj_7PyNomad_PyNomadDouble *p = (struct __pyx_obj_7PyNomad_PyNomadDouble *)o; + #if PY_VERSION_HEX >= 0x030400a1 + if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif + __Pyx_call_destructor(p->c_d); + (*Py_TYPE(o)->tp_free)(o); +} + +static PyMethodDef __pyx_methods_7PyNomad_PyNomadDouble[] = { + {"value", (PyCFunction)__pyx_pw_7PyNomad_13PyNomadDouble_1value, METH_NOARGS, 0}, + {"is_defined", (PyCFunction)__pyx_pw_7PyNomad_13PyNomadDouble_3is_defined, METH_NOARGS, 0}, + {0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_7PyNomad_PyNomadDouble = { + PyVarObject_HEAD_INIT(0, 0) + "PyNomad.PyNomadDouble", /*tp_name*/ + sizeof(struct __pyx_obj_7PyNomad_PyNomadDouble), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_7PyNomad_PyNomadDouble, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + 0, /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_7PyNomad_PyNomadDouble, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_7PyNomad_PyNomadDouble, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif +}; + +static PyObject *__pyx_tp_new_7PyNomad_PyNomadEval_Point(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + PyObject *o; + if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } + if (unlikely(!o)) return 0; + return o; +} + +static void __pyx_tp_dealloc_7PyNomad_PyNomadEval_Point(PyObject *o) { + #if PY_VERSION_HEX >= 0x030400a1 + if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif + (*Py_TYPE(o)->tp_free)(o); +} + +static PyMethodDef __pyx_methods_7PyNomad_PyNomadEval_Point[] = { + {"get_coord", (PyCFunction)__pyx_pw_7PyNomad_17PyNomadEval_Point_1get_coord, METH_O, 0}, + {"set_bb_output", (PyCFunction)__pyx_pw_7PyNomad_17PyNomadEval_Point_3set_bb_output, METH_VARARGS|METH_KEYWORDS, 0}, + {"get_f", (PyCFunction)__pyx_pw_7PyNomad_17PyNomadEval_Point_5get_f, METH_NOARGS, 0}, + {"get_h", (PyCFunction)__pyx_pw_7PyNomad_17PyNomadEval_Point_7get_h, METH_NOARGS, 0}, + {"get_n", (PyCFunction)__pyx_pw_7PyNomad_17PyNomadEval_Point_9get_n, METH_NOARGS, 0}, + {"get_m", (PyCFunction)__pyx_pw_7PyNomad_17PyNomadEval_Point_11get_m, METH_NOARGS, 0}, + {0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_7PyNomad_PyNomadEval_Point = { + PyVarObject_HEAD_INIT(0, 0) + "PyNomad.PyNomadEval_Point", /*tp_name*/ + sizeof(struct __pyx_obj_7PyNomad_PyNomadEval_Point), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_7PyNomad_PyNomadEval_Point, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + 0, /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_7PyNomad_PyNomadEval_Point, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_7PyNomad_PyNomadEval_Point, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif +}; + +static PyMethodDef __pyx_methods[] = { + {0, 0, 0, 0} +}; + +#if PY_MAJOR_VERSION >= 3 +static struct PyModuleDef __pyx_moduledef = { + #if PY_VERSION_HEX < 0x03020000 + { PyObject_HEAD_INIT(NULL) NULL, 0, NULL }, + #else + PyModuleDef_HEAD_INIT, + #endif + "PyNomad", + 0, /* m_doc */ + -1, /* m_size */ + __pyx_methods /* m_methods */, + NULL, /* m_reload */ + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ +}; +#endif + +static __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_kp_s_, __pyx_k_, sizeof(__pyx_k_), 0, 0, 1, 0}, + {&__pyx_n_s_Process, __pyx_k_Process, sizeof(__pyx_k_Process), 0, 0, 1, 1}, + {&__pyx_n_s_PyNomad, __pyx_k_PyNomad, sizeof(__pyx_k_PyNomad), 0, 0, 1, 1}, + {&__pyx_n_s_Queue, __pyx_k_Queue, sizeof(__pyx_k_Queue), 0, 0, 1, 1}, + {&__pyx_kp_s_Users_christophe_Development_NO, __pyx_k_Users_christophe_Development_NO, sizeof(__pyx_k_Users_christophe_Development_NO), 0, 0, 1, 0}, + {&__pyx_n_s_about, __pyx_k_about, sizeof(__pyx_k_about), 0, 0, 1, 1}, + {&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1}, + {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1}, + {&__pyx_n_s_f, __pyx_k_f, sizeof(__pyx_k_f), 0, 0, 1, 1}, + {&__pyx_n_s_f_return, __pyx_k_f_return, sizeof(__pyx_k_f_return), 0, 0, 1, 1}, + {&__pyx_n_s_get, __pyx_k_get, sizeof(__pyx_k_get), 0, 0, 1, 1}, + {&__pyx_n_s_get_coord, __pyx_k_get_coord, sizeof(__pyx_k_get_coord), 0, 0, 1, 1}, + {&__pyx_n_s_get_f, __pyx_k_get_f, sizeof(__pyx_k_get_f), 0, 0, 1, 1}, + {&__pyx_n_s_get_h, __pyx_k_get_h, sizeof(__pyx_k_get_h), 0, 0, 1, 1}, + {&__pyx_n_s_get_n, __pyx_k_get_n, sizeof(__pyx_k_get_n), 0, 0, 1, 1}, + {&__pyx_n_s_h_return, __pyx_k_h_return, sizeof(__pyx_k_h_return), 0, 0, 1, 1}, + {&__pyx_n_s_help, __pyx_k_help, sizeof(__pyx_k_help), 0, 0, 1, 1}, + {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1}, + {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, + {&__pyx_n_s_inf, __pyx_k_inf, sizeof(__pyx_k_inf), 0, 0, 1, 1}, + {&__pyx_n_s_info, __pyx_k_info, sizeof(__pyx_k_info), 0, 0, 1, 1}, + {&__pyx_n_s_is_defined, __pyx_k_is_defined, sizeof(__pyx_k_is_defined), 0, 0, 1, 1}, + {&__pyx_n_s_join, __pyx_k_join, sizeof(__pyx_k_join), 0, 0, 1, 1}, + {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, + {&__pyx_n_s_multiprocessing, __pyx_k_multiprocessing, sizeof(__pyx_k_multiprocessing), 0, 0, 1, 1}, + {&__pyx_n_s_nb_evals, __pyx_k_nb_evals, sizeof(__pyx_k_nb_evals), 0, 0, 1, 1}, + {&__pyx_n_s_nb_iters, __pyx_k_nb_iters, sizeof(__pyx_k_nb_iters), 0, 0, 1, 1}, + {&__pyx_n_s_optimize, __pyx_k_optimize, sizeof(__pyx_k_optimize), 0, 0, 1, 1}, + {&__pyx_n_s_pLB, __pyx_k_pLB, sizeof(__pyx_k_pLB), 0, 0, 1, 1}, + {&__pyx_n_s_pUB, __pyx_k_pUB, sizeof(__pyx_k_pUB), 0, 0, 1, 1}, + {&__pyx_n_s_pX0, __pyx_k_pX0, sizeof(__pyx_k_pX0), 0, 0, 1, 1}, + {&__pyx_n_s_params, __pyx_k_params, sizeof(__pyx_k_params), 0, 0, 1, 1}, + {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1}, + {&__pyx_n_s_run_status, __pyx_k_run_status, sizeof(__pyx_k_run_status), 0, 0, 1, 1}, + {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1}, + {&__pyx_n_s_target, __pyx_k_target, sizeof(__pyx_k_target), 0, 0, 1, 1}, + {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, + {&__pyx_n_s_u_feas, __pyx_k_u_feas, sizeof(__pyx_k_u_feas), 0, 0, 1, 1}, + {&__pyx_n_s_u_infeas, __pyx_k_u_infeas, sizeof(__pyx_k_u_infeas), 0, 0, 1, 1}, + {&__pyx_n_s_usage, __pyx_k_usage, sizeof(__pyx_k_usage), 0, 0, 1, 1}, + {&__pyx_n_s_v, __pyx_k_v, sizeof(__pyx_k_v), 0, 0, 1, 1}, + {&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1}, + {&__pyx_n_s_version, __pyx_k_version, sizeof(__pyx_k_version), 0, 0, 1, 1}, + {&__pyx_n_s_x_return, __pyx_k_x_return, sizeof(__pyx_k_x_return), 0, 0, 1, 1}, + {&__pyx_n_s_xrange, __pyx_k_xrange, sizeof(__pyx_k_xrange), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} +}; +static int __Pyx_InitCachedBuiltins(void) { + #if PY_MAJOR_VERSION >= 3 + __pyx_builtin_xrange = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_xrange) __PYX_ERR(0, 47, __pyx_L1_error) + #else + __pyx_builtin_xrange = __Pyx_GetBuiltinName(__pyx_n_s_xrange); if (!__pyx_builtin_xrange) __PYX_ERR(0, 47, __pyx_L1_error) + #endif + return 0; + __pyx_L1_error:; + return -1; +} + +static int __Pyx_InitCachedConstants(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); + + /* "PyNomad.pyx":12 + * from multiprocessing import Process, Queue + * + * def version(): # <<<<<<<<<<<<<< + * printPyNomadVersion() + * + */ + __pyx_codeobj__2 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_christophe_Development_NO, __pyx_n_s_version, 12, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__2)) __PYX_ERR(0, 12, __pyx_L1_error) + + /* "PyNomad.pyx":16 + * + * # Define the interface function to display nomad general information + * def usage(): # <<<<<<<<<<<<<< + * printPyNomadUsage() + * + */ + __pyx_codeobj__3 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_christophe_Development_NO, __pyx_n_s_usage, 16, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__3)) __PYX_ERR(0, 16, __pyx_L1_error) + + /* "PyNomad.pyx":20 + * + * # Define the interface function to display nomad general information + * def info(): # <<<<<<<<<<<<<< + * printPyNomadUsage() + * printPyNomadInfo() + */ + __pyx_codeobj__4 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_christophe_Development_NO, __pyx_n_s_info, 20, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__4)) __PYX_ERR(0, 20, __pyx_L1_error) + + /* "PyNomad.pyx":25 + * + * # Define the interface function to get nomad help + * def help(about=''): # <<<<<<<<<<<<<< + * printNomadHelp(about) + * + */ + __pyx_tuple__5 = PyTuple_Pack(1, __pyx_n_s_about); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 25, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__5); + __Pyx_GIVEREF(__pyx_tuple__5); + __pyx_codeobj__6 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__5, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_christophe_Development_NO, __pyx_n_s_help, 25, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__6)) __PYX_ERR(0, 25, __pyx_L1_error) + + /* "PyNomad.pyx":28 + * printNomadHelp(about) + * + * def __doc__(): # <<<<<<<<<<<<<< + * cdef string about; + * printPyNomadUsage() + */ + __pyx_tuple__7 = PyTuple_Pack(1, __pyx_n_s_about); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 28, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__7); + __Pyx_GIVEREF(__pyx_tuple__7); + __pyx_codeobj__8 = (PyObject*)__Pyx_PyCode_New(0, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__7, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_christophe_Development_NO, __pyx_n_s_doc, 28, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__8)) __PYX_ERR(0, 28, __pyx_L1_error) + + /* "PyNomad.pyx":34 + * + * # Define the interface function to perform optimization + * def optimize(f , pX0, pLB,pUB ,params): # <<<<<<<<<<<<<< + * cdef PyNomadEval_Point u_feas = PyNomadEval_Point() + * cdef PyNomadEval_Point u_infeas = PyNomadEval_Point() + */ + __pyx_tuple__9 = PyTuple_Pack(14, __pyx_n_s_f, __pyx_n_s_pX0, __pyx_n_s_pLB, __pyx_n_s_pUB, __pyx_n_s_params, __pyx_n_s_u_feas, __pyx_n_s_u_infeas, __pyx_n_s_run_status, __pyx_n_s_nb_evals, __pyx_n_s_nb_iters, __pyx_n_s_f_return, __pyx_n_s_h_return, __pyx_n_s_x_return, __pyx_n_s_i); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 34, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__9); + __Pyx_GIVEREF(__pyx_tuple__9); + __pyx_codeobj__10 = (PyObject*)__Pyx_PyCode_New(5, 0, 14, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__9, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_christophe_Development_NO, __pyx_n_s_optimize, 34, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__10)) __PYX_ERR(0, 34, __pyx_L1_error) + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_InitGlobals(void) { + if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + return 0; + __pyx_L1_error:; + return -1; +} + +#if PY_MAJOR_VERSION < 3 +PyMODINIT_FUNC initPyNomad(void); /*proto*/ +PyMODINIT_FUNC initPyNomad(void) +#else +PyMODINIT_FUNC PyInit_PyNomad(void); /*proto*/ +PyMODINIT_FUNC PyInit_PyNomad(void) +#endif +{ + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannyDeclarations + #if CYTHON_REFNANNY + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); + if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); + } + #endif + __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_PyNomad(void)", 0); + if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) + #ifdef __Pyx_CyFunction_USED + if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_FusedFunction_USED + if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_Coroutine_USED + if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_Generator_USED + if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_StopAsyncIteration_USED + if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + /*--- Library function declarations ---*/ + /*--- Threads initialization code ---*/ + #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS + #ifdef WITH_THREAD /* Python build with threading support? */ + PyEval_InitThreads(); + #endif + #endif + /*--- Module creation code ---*/ + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4("PyNomad", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + #endif + if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) + Py_INCREF(__pyx_d); + __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) + #if CYTHON_COMPILING_IN_PYPY + Py_INCREF(__pyx_b); + #endif + if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + /*--- Initialize various global constants etc. ---*/ + if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) + if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + if (__pyx_module_is_main_PyNomad) { + if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + } + #if PY_MAJOR_VERSION >= 3 + { + PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) + if (!PyDict_GetItemString(modules, "PyNomad")) { + if (unlikely(PyDict_SetItemString(modules, "PyNomad", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error) + } + } + #endif + /*--- Builtin init code ---*/ + if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Constants init code ---*/ + if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Global init code ---*/ + /*--- Variable export code ---*/ + /*--- Function export code ---*/ + /*--- Type init code ---*/ + if (PyType_Ready(&__pyx_type_7PyNomad_PyNomadDouble) < 0) __PYX_ERR(0, 63, __pyx_L1_error) + __pyx_type_7PyNomad_PyNomadDouble.tp_print = 0; + if (PyObject_SetAttrString(__pyx_m, "PyNomadDouble", (PyObject *)&__pyx_type_7PyNomad_PyNomadDouble) < 0) __PYX_ERR(0, 63, __pyx_L1_error) + __pyx_ptype_7PyNomad_PyNomadDouble = &__pyx_type_7PyNomad_PyNomadDouble; + if (PyType_Ready(&__pyx_type_7PyNomad_PyNomadEval_Point) < 0) __PYX_ERR(0, 79, __pyx_L1_error) + __pyx_type_7PyNomad_PyNomadEval_Point.tp_print = 0; + if (PyObject_SetAttrString(__pyx_m, "PyNomadEval_Point", (PyObject *)&__pyx_type_7PyNomad_PyNomadEval_Point) < 0) __PYX_ERR(0, 79, __pyx_L1_error) + __pyx_ptype_7PyNomad_PyNomadEval_Point = &__pyx_type_7PyNomad_PyNomadEval_Point; + /*--- Type import code ---*/ + /*--- Variable import code ---*/ + /*--- Function import code ---*/ + /*--- Execution code ---*/ + #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) + if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + + /* "PyNomad.pyx":10 + * + * from cython.operator cimport dereference as deref, preincrement as inc + * from multiprocessing import Process, Queue # <<<<<<<<<<<<<< + * + * def version(): + */ + __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 10, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_n_s_Process); + __Pyx_GIVEREF(__pyx_n_s_Process); + PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_Process); + __Pyx_INCREF(__pyx_n_s_Queue); + __Pyx_GIVEREF(__pyx_n_s_Queue); + PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_Queue); + __pyx_t_2 = __Pyx_Import(__pyx_n_s_multiprocessing, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 10, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Process); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 10, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_Process, __pyx_t_1) < 0) __PYX_ERR(0, 10, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Queue); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 10, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_Queue, __pyx_t_1) < 0) __PYX_ERR(0, 10, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "PyNomad.pyx":12 + * from multiprocessing import Process, Queue + * + * def version(): # <<<<<<<<<<<<<< + * printPyNomadVersion() + * + */ + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7PyNomad_1version, NULL, __pyx_n_s_PyNomad); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_version, __pyx_t_2) < 0) __PYX_ERR(0, 12, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "PyNomad.pyx":16 + * + * # Define the interface function to display nomad general information + * def usage(): # <<<<<<<<<<<<<< + * printPyNomadUsage() + * + */ + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7PyNomad_3usage, NULL, __pyx_n_s_PyNomad); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 16, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_usage, __pyx_t_2) < 0) __PYX_ERR(0, 16, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "PyNomad.pyx":20 + * + * # Define the interface function to display nomad general information + * def info(): # <<<<<<<<<<<<<< + * printPyNomadUsage() + * printPyNomadInfo() + */ + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7PyNomad_5info, NULL, __pyx_n_s_PyNomad); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_info, __pyx_t_2) < 0) __PYX_ERR(0, 20, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "PyNomad.pyx":25 + * + * # Define the interface function to get nomad help + * def help(about=''): # <<<<<<<<<<<<<< + * printNomadHelp(about) + * + */ + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7PyNomad_7help, NULL, __pyx_n_s_PyNomad); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 25, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_help, __pyx_t_2) < 0) __PYX_ERR(0, 25, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "PyNomad.pyx":28 + * printNomadHelp(about) + * + * def __doc__(): # <<<<<<<<<<<<<< + * cdef string about; + * printPyNomadUsage() + */ + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7PyNomad_9__doc__, NULL, __pyx_n_s_PyNomad); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 28, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_doc, __pyx_t_2) < 0) __PYX_ERR(0, 28, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "PyNomad.pyx":34 + * + * # Define the interface function to perform optimization + * def optimize(f , pX0, pLB,pUB ,params): # <<<<<<<<<<<<<< + * cdef PyNomadEval_Point u_feas = PyNomadEval_Point() + * cdef PyNomadEval_Point u_infeas = PyNomadEval_Point() + */ + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7PyNomad_11optimize, NULL, __pyx_n_s_PyNomad); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 34, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_optimize, __pyx_t_2) < 0) __PYX_ERR(0, 34, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "PyNomad.pyx":1 + * # C.Tribes sept. 6th, 2016 --- PyNomad: Beta integration of Nomad in Python # <<<<<<<<<<<<<< + * # PyNomad 1.0 + * + */ + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "vector.from_py":50 + * + * @cname("__pyx_convert_vector_from_py_std_3a__3a_string") + * cdef vector[X] __pyx_convert_vector_from_py_std_3a__3a_string(object o) except *: # <<<<<<<<<<<<<< + * cdef vector[X] v + * for item in o: + */ + + /*--- Wrapped vars code ---*/ + + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + if (__pyx_m) { + if (__pyx_d) { + __Pyx_AddTraceback("init PyNomad", __pyx_clineno, __pyx_lineno, __pyx_filename); + } + Py_DECREF(__pyx_m); __pyx_m = 0; + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init PyNomad"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + #if PY_MAJOR_VERSION < 3 + return; + #else + return __pyx_m; + #endif +} + +/* --- Runtime support code --- */ +/* Refnanny */ +#if CYTHON_REFNANNY +static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule((char *)modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); +end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; +} +#endif + +/* GetBuiltinName */ +static PyObject *__Pyx_GetBuiltinName(PyObject *name) { + PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); + if (unlikely(!result)) { + PyErr_Format(PyExc_NameError, +#if PY_MAJOR_VERSION >= 3 + "name '%U' is not defined", name); +#else + "name '%.200s' is not defined", PyString_AS_STRING(name)); +#endif + } + return result; +} + +/* RaiseDoubleKeywords */ +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION >= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); + #else + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AsString(kw_name)); + #endif +} + +/* ParseKeywords */ +static int __Pyx_ParseOptionalKeywords( + PyObject *kwds, + PyObject **argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject *key = 0, *value = 0; + Py_ssize_t pos = 0; + PyObject*** name; + PyObject*** first_kw_arg = argnames + num_pos_args; + while (PyDict_Next(kwds, &pos, &key, &value)) { + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; + continue; + } + name = first_kw_arg; + #if PY_MAJOR_VERSION < 3 + if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { + while (*name) { + if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) + && _PyString_Eq(**name, key)) { + values[name-argnames] = value; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + if ((**argname == key) || ( + (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) + && _PyString_Eq(**argname, key))) { + goto arg_passed_twice; + } + argname++; + } + } + } else + #endif + if (likely(PyUnicode_Check(key))) { + while (*name) { + int cmp = (**name == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**name, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) { + values[name-argnames] = value; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + int cmp = (**argname == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**argname, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) goto arg_passed_twice; + argname++; + } + } + } else + goto invalid_keyword_type; + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; + } + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, key); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%.200s() keywords must be strings", function_name); + goto bad; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%.200s() got an unexpected keyword argument '%.200s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif +bad: + return -1; +} + +/* RaiseArgTupleInvalid */ +static void __Pyx_RaiseArgtupleInvalid( + const char* func_name, + int exact, + Py_ssize_t num_min, + Py_ssize_t num_max, + Py_ssize_t num_found) +{ + Py_ssize_t num_expected; + const char *more_or_less; + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + PyErr_Format(PyExc_TypeError, + "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +/* GetModuleGlobalName */ +static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) { + PyObject *result; +#if CYTHON_COMPILING_IN_CPYTHON + result = PyDict_GetItem(__pyx_d, name); + if (likely(result)) { + Py_INCREF(result); + } else { +#else + result = PyObject_GetItem(__pyx_d, name); + if (!result) { + PyErr_Clear(); +#endif + result = __Pyx_GetBuiltinName(name); + } + return result; +} + +/* PyObjectCall */ + #if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { + PyObject *result; + ternaryfunc call = func->ob_type->tp_call; + if (unlikely(!call)) + return PyObject_Call(func, arg, kw); + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) + return NULL; + result = (*call)(func, arg, kw); + Py_LeaveRecursiveCall(); + if (unlikely(!result) && unlikely(!PyErr_Occurred())) { + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); + } + return result; +} +#endif + +/* PyObjectCallMethO */ + #if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { + PyObject *self, *result; + PyCFunction cfunc; + cfunc = PyCFunction_GET_FUNCTION(func); + self = PyCFunction_GET_SELF(func); + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) + return NULL; + result = cfunc(self, arg); + Py_LeaveRecursiveCall(); + if (unlikely(!result) && unlikely(!PyErr_Occurred())) { + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); + } + return result; +} +#endif + +/* PyObjectCallOneArg */ + #if CYTHON_COMPILING_IN_CPYTHON +static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { + PyObject *result; + PyObject *args = PyTuple_New(1); + if (unlikely(!args)) return NULL; + Py_INCREF(arg); + PyTuple_SET_ITEM(args, 0, arg); + result = __Pyx_PyObject_Call(func, args, NULL); + Py_DECREF(args); + return result; +} +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { +#ifdef __Pyx_CyFunction_USED + if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) { +#else + if (likely(PyCFunction_Check(func))) { +#endif + if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { + return __Pyx_PyObject_CallMethO(func, arg); + } + } + return __Pyx__PyObject_CallOneArg(func, arg); +} +#else +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { + PyObject *result; + PyObject *args = PyTuple_Pack(1, arg); + if (unlikely(!args)) return NULL; + result = __Pyx_PyObject_Call(func, args, NULL); + Py_DECREF(args); + return result; +} +#endif + +/* PyObjectCallNoArg */ + #if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { +#ifdef __Pyx_CyFunction_USED + if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) { +#else + if (likely(PyCFunction_Check(func))) { +#endif + if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) { + return __Pyx_PyObject_CallMethO(func, NULL); + } + } + return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL); +} +#endif + +/* pyobject_as_double */ + static double __Pyx__PyObject_AsDouble(PyObject* obj) { + PyObject* float_value; +#if CYTHON_COMPILING_IN_PYPY + float_value = PyNumber_Float(obj); if (0) goto bad; +#else + PyNumberMethods *nb = Py_TYPE(obj)->tp_as_number; + if (likely(nb) && likely(nb->nb_float)) { + float_value = nb->nb_float(obj); + if (likely(float_value) && unlikely(!PyFloat_Check(float_value))) { + PyErr_Format(PyExc_TypeError, + "__float__ returned non-float (type %.200s)", + Py_TYPE(float_value)->tp_name); + Py_DECREF(float_value); + goto bad; + } + } else if (PyUnicode_CheckExact(obj) || PyBytes_CheckExact(obj)) { +#if PY_MAJOR_VERSION >= 3 + float_value = PyFloat_FromString(obj); +#else + float_value = PyFloat_FromString(obj, 0); +#endif + } else { + PyObject* args = PyTuple_New(1); + if (unlikely(!args)) goto bad; + PyTuple_SET_ITEM(args, 0, obj); + float_value = PyObject_Call((PyObject*)&PyFloat_Type, args, 0); + PyTuple_SET_ITEM(args, 0, 0); + Py_DECREF(args); + } +#endif + if (likely(float_value)) { + double value = PyFloat_AS_DOUBLE(float_value); + Py_DECREF(float_value); + return value; + } +bad: + return (double)-1; +} + +/* PyErrFetchRestore */ + #if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +} +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +} +#endif + +/* WriteUnraisableException */ + static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno, + CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename, + int full_traceback, CYTHON_UNUSED int nogil) { + PyObject *old_exc, *old_val, *old_tb; + PyObject *ctx; + __Pyx_PyThreadState_declare +#ifdef WITH_THREAD + PyGILState_STATE state; + if (nogil) + state = PyGILState_Ensure(); +#ifdef _MSC_VER + else state = (PyGILState_STATE)-1; +#endif +#endif + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); + if (full_traceback) { + Py_XINCREF(old_exc); + Py_XINCREF(old_val); + Py_XINCREF(old_tb); + __Pyx_ErrRestore(old_exc, old_val, old_tb); + PyErr_PrintEx(1); + } + #if PY_MAJOR_VERSION < 3 + ctx = PyString_FromString(name); + #else + ctx = PyUnicode_FromString(name); + #endif + __Pyx_ErrRestore(old_exc, old_val, old_tb); + if (!ctx) { + PyErr_WriteUnraisable(Py_None); + } else { + PyErr_WriteUnraisable(ctx); + Py_DECREF(ctx); + } +#ifdef WITH_THREAD + if (nogil) + PyGILState_Release(state); +#endif +} + +/* None */ + static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) { + PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname); +} + +/* GetItemInt */ + static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { + PyObject *r; + if (!j) return NULL; + r = PyObject_GetItem(o, j); + Py_DECREF(j); + return r; +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + CYTHON_NCP_UNUSED int wraparound, + CYTHON_NCP_UNUSED int boundscheck) { +#if CYTHON_COMPILING_IN_CPYTHON + if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o); + if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + CYTHON_NCP_UNUSED int wraparound, + CYTHON_NCP_UNUSED int boundscheck) { +#if CYTHON_COMPILING_IN_CPYTHON + if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o); + if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, + CYTHON_NCP_UNUSED int wraparound, + CYTHON_NCP_UNUSED int boundscheck) { +#if CYTHON_COMPILING_IN_CPYTHON + if (is_list || PyList_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); + if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) { + PyObject *r = PyList_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } + } + else if (PyTuple_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); + if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } + } else { + PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; + if (likely(m && m->sq_item)) { + if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { + Py_ssize_t l = m->sq_length(o); + if (likely(l >= 0)) { + i += l; + } else { + if (!PyErr_ExceptionMatches(PyExc_OverflowError)) + return NULL; + PyErr_Clear(); + } + } + return m->sq_item(o, i); + } + } +#else + if (is_list || PySequence_Check(o)) { + return PySequence_GetItem(o, i); + } +#endif + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +} + +/* Import */ + static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { + PyObject *empty_list = 0; + PyObject *module = 0; + PyObject *global_dict = 0; + PyObject *empty_dict = 0; + PyObject *list; + #if PY_VERSION_HEX < 0x03030000 + PyObject *py_import; + py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); + if (!py_import) + goto bad; + #endif + if (from_list) + list = from_list; + else { + empty_list = PyList_New(0); + if (!empty_list) + goto bad; + list = empty_list; + } + global_dict = PyModule_GetDict(__pyx_m); + if (!global_dict) + goto bad; + empty_dict = PyDict_New(); + if (!empty_dict) + goto bad; + { + #if PY_MAJOR_VERSION >= 3 + if (level == -1) { + if (strchr(__Pyx_MODULE_NAME, '.')) { + #if PY_VERSION_HEX < 0x03030000 + PyObject *py_level = PyInt_FromLong(1); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + #else + module = PyImport_ImportModuleLevelObject( + name, global_dict, empty_dict, list, 1); + #endif + if (!module) { + if (!PyErr_ExceptionMatches(PyExc_ImportError)) + goto bad; + PyErr_Clear(); + } + } + level = 0; + } + #endif + if (!module) { + #if PY_VERSION_HEX < 0x03030000 + PyObject *py_level = PyInt_FromLong(level); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + #else + module = PyImport_ImportModuleLevelObject( + name, global_dict, empty_dict, list, level); + #endif + } + } +bad: + #if PY_VERSION_HEX < 0x03030000 + Py_XDECREF(py_import); + #endif + Py_XDECREF(empty_list); + Py_XDECREF(empty_dict); + return module; +} + +/* ImportFrom */ + static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { + PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); + if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { + PyErr_Format(PyExc_ImportError, + #if PY_MAJOR_VERSION < 3 + "cannot import name %.230s", PyString_AS_STRING(name)); + #else + "cannot import name %S", name); + #endif + } + return value; +} + +/* CodeObjectCache */ + static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + int start = 0, mid = 0, end = count - 1; + if (end >= 0 && code_line > entries[end].code_line) { + return count; + } + while (start < end) { + mid = start + (end - start) / 2; + if (code_line < entries[mid].code_line) { + end = mid; + } else if (code_line > entries[mid].code_line) { + start = mid + 1; + } else { + return mid; + } + } + if (code_line <= entries[mid].code_line) { + return mid; + } else { + return mid + 1; + } +} +static PyCodeObject *__pyx_find_code_object(int code_line) { + PyCodeObject* code_object; + int pos; + if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { + return NULL; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { + return NULL; + } + code_object = __pyx_code_cache.entries[pos].code_object; + Py_INCREF(code_object); + return code_object; +} +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { + int pos, i; + __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; + if (unlikely(!code_line)) { + return; + } + if (unlikely(!entries)) { + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); + if (likely(entries)) { + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = 64; + __pyx_code_cache.count = 1; + entries[0].code_line = code_line; + entries[0].code_object = code_object; + Py_INCREF(code_object); + } + return; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { + PyCodeObject* tmp = entries[pos].code_object; + entries[pos].code_object = code_object; + Py_DECREF(tmp); + return; + } + if (__pyx_code_cache.count == __pyx_code_cache.max_count) { + int new_max = __pyx_code_cache.max_count + 64; + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( + __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry)); + if (unlikely(!entries)) { + return; + } + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = new_max; + } + for (i=__pyx_code_cache.count; i>pos; i--) { + entries[i] = entries[i-1]; + } + entries[pos].code_line = code_line; + entries[pos].code_object = code_object; + __pyx_code_cache.count++; + Py_INCREF(code_object); +} + +/* AddTraceback */ + #include "compile.h" +#include "frameobject.h" +#include "traceback.h" +static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( + const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyObject *py_srcfile = 0; + PyObject *py_funcname = 0; + #if PY_MAJOR_VERSION < 3 + py_srcfile = PyString_FromString(filename); + #else + py_srcfile = PyUnicode_FromString(filename); + #endif + if (!py_srcfile) goto bad; + if (c_line) { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + #else + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + #endif + } + else { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromString(funcname); + #else + py_funcname = PyUnicode_FromString(funcname); + #endif + } + if (!py_funcname) goto bad; + py_code = __Pyx_PyCode_New( + 0, + 0, + 0, + 0, + 0, + __pyx_empty_bytes, /*PyObject *code,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ + py_srcfile, /*PyObject *filename,*/ + py_funcname, /*PyObject *name,*/ + py_line, + __pyx_empty_bytes /*PyObject *lnotab*/ + ); + Py_DECREF(py_srcfile); + Py_DECREF(py_funcname); + return py_code; +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + return NULL; +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyFrameObject *py_frame = 0; + py_code = __pyx_find_code_object(c_line ? c_line : py_line); + if (!py_code) { + py_code = __Pyx_CreateCodeObjectForTraceback( + funcname, c_line, py_line, filename); + if (!py_code) goto bad; + __pyx_insert_code_object(c_line ? c_line : py_line, py_code); + } + py_frame = PyFrame_New( + PyThreadState_GET(), /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + __pyx_d, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (!py_frame) goto bad; + py_frame->f_lineno = py_line; + PyTraceBack_Here(py_frame); +bad: + Py_XDECREF(py_code); + Py_XDECREF(py_frame); +} + +/* CIntFromPyVerify */ + #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ + __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) +#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ + __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) +#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\ + {\ + func_type value = func_value;\ + if (sizeof(target_type) < sizeof(func_type)) {\ + if (unlikely(value != (func_type) (target_type) value)) {\ + func_type zero = 0;\ + if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\ + return (target_type) -1;\ + if (is_unsigned && unlikely(value < zero))\ + goto raise_neg_overflow;\ + else\ + goto raise_overflow;\ + }\ + }\ + return (target_type) value;\ + } + +/* CIntToPy */ + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { + const int neg_one = (int) -1, const_zero = (int) 0; + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(int) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(int) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); + } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); + } + } else { + if (sizeof(int) <= sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); + } + } + { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&value; + return _PyLong_FromByteArray(bytes, sizeof(int), + little, !is_unsigned); + } +} + +/* CIntFromPy */ + static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { + const int neg_one = (int) -1, const_zero = (int) 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + if (sizeof(int) < sizeof(long)) { + __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) + } else { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + goto raise_neg_overflow; + } + return (int) val; + } + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_USE_PYLONG_INTERNALS + const digit* digits = ((PyLongObject*)x)->ob_digit; + switch (Py_SIZE(x)) { + case 0: return (int) 0; + case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0]) + case 2: + if (8 * sizeof(int) > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) { + return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } + } + break; + case 3: + if (8 * sizeof(int) > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) { + return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } + } + break; + case 4: + if (8 * sizeof(int) > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) { + return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } + } + break; + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON + if (unlikely(Py_SIZE(x) < 0)) { + goto raise_neg_overflow; + } +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (int) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if (sizeof(int) <= sizeof(unsigned long)) { + __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) + } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + const digit* digits = ((PyLongObject*)x)->ob_digit; + switch (Py_SIZE(x)) { + case 0: return (int) 0; + case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0])) + case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0]) + case -2: + if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { + return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case 2: + if (8 * sizeof(int) > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { + return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case -3: + if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { + return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case 3: + if (8 * sizeof(int) > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { + return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case -4: + if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { + return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case 4: + if (8 * sizeof(int) > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { + return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + } +#endif + if (sizeof(int) <= sizeof(long)) { + __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) + } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) + } + } + { +#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) + PyErr_SetString(PyExc_RuntimeError, + "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); +#else + int val; + PyObject *v = __Pyx_PyNumber_IntOrLong(x); + #if PY_MAJOR_VERSION < 3 + if (likely(v) && !PyLong_Check(v)) { + PyObject *tmp = v; + v = PyNumber_Long(tmp); + Py_DECREF(tmp); + } + #endif + if (likely(v)) { + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + int ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); + Py_DECREF(v); + if (likely(!ret)) + return val; + } +#endif + return (int) -1; + } + } else { + int val; + PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); + if (!tmp) return (int) -1; + val = __Pyx_PyInt_As_int(tmp); + Py_DECREF(tmp); + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to int"); + return (int) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to int"); + return (int) -1; +} + +/* CIntFromPy */ + static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) { + const size_t neg_one = (size_t) -1, const_zero = (size_t) 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + if (sizeof(size_t) < sizeof(long)) { + __PYX_VERIFY_RETURN_INT(size_t, long, PyInt_AS_LONG(x)) + } else { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + goto raise_neg_overflow; + } + return (size_t) val; + } + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_USE_PYLONG_INTERNALS + const digit* digits = ((PyLongObject*)x)->ob_digit; + switch (Py_SIZE(x)) { + case 0: return (size_t) 0; + case 1: __PYX_VERIFY_RETURN_INT(size_t, digit, digits[0]) + case 2: + if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(size_t) >= 2 * PyLong_SHIFT) { + return (size_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + } + break; + case 3: + if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(size_t) >= 3 * PyLong_SHIFT) { + return (size_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + } + break; + case 4: + if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(size_t) >= 4 * PyLong_SHIFT) { + return (size_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + } + break; + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON + if (unlikely(Py_SIZE(x) < 0)) { + goto raise_neg_overflow; + } +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (size_t) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if (sizeof(size_t) <= sizeof(unsigned long)) { + __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned long, PyLong_AsUnsignedLong(x)) + } else if (sizeof(size_t) <= sizeof(unsigned PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + const digit* digits = ((PyLongObject*)x)->ob_digit; + switch (Py_SIZE(x)) { + case 0: return (size_t) 0; + case -1: __PYX_VERIFY_RETURN_INT(size_t, sdigit, (sdigit) (-(sdigit)digits[0])) + case 1: __PYX_VERIFY_RETURN_INT(size_t, digit, +digits[0]) + case -2: + if (8 * sizeof(size_t) - 1 > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) { + return (size_t) (((size_t)-1)*(((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case 2: + if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) { + return (size_t) ((((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case -3: + if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) { + return (size_t) (((size_t)-1)*(((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case 3: + if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) { + return (size_t) ((((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case -4: + if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) { + return (size_t) (((size_t)-1)*(((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case 4: + if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) { + return (size_t) ((((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + } +#endif + if (sizeof(size_t) <= sizeof(long)) { + __PYX_VERIFY_RETURN_INT_EXC(size_t, long, PyLong_AsLong(x)) + } else if (sizeof(size_t) <= sizeof(PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(size_t, PY_LONG_LONG, PyLong_AsLongLong(x)) + } + } + { +#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) + PyErr_SetString(PyExc_RuntimeError, + "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); +#else + size_t val; + PyObject *v = __Pyx_PyNumber_IntOrLong(x); + #if PY_MAJOR_VERSION < 3 + if (likely(v) && !PyLong_Check(v)) { + PyObject *tmp = v; + v = PyNumber_Long(tmp); + Py_DECREF(tmp); + } + #endif + if (likely(v)) { + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + int ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); + Py_DECREF(v); + if (likely(!ret)) + return val; + } +#endif + return (size_t) -1; + } + } else { + size_t val; + PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); + if (!tmp) return (size_t) -1; + val = __Pyx_PyInt_As_size_t(tmp); + Py_DECREF(tmp); + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to size_t"); + return (size_t) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to size_t"); + return (size_t) -1; +} + +/* CIntToPy */ + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { + const long neg_one = (long) -1, const_zero = (long) 0; + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(long) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(long) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); + } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); + } + } else { + if (sizeof(long) <= sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); + } + } + { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&value; + return _PyLong_FromByteArray(bytes, sizeof(long), + little, !is_unsigned); + } +} + +/* CIntFromPy */ + static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { + const long neg_one = (long) -1, const_zero = (long) 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + if (sizeof(long) < sizeof(long)) { + __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) + } else { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + goto raise_neg_overflow; + } + return (long) val; + } + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_USE_PYLONG_INTERNALS + const digit* digits = ((PyLongObject*)x)->ob_digit; + switch (Py_SIZE(x)) { + case 0: return (long) 0; + case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0]) + case 2: + if (8 * sizeof(long) > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) { + return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } + } + break; + case 3: + if (8 * sizeof(long) > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) { + return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } + } + break; + case 4: + if (8 * sizeof(long) > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) { + return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } + } + break; + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON + if (unlikely(Py_SIZE(x) < 0)) { + goto raise_neg_overflow; + } +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (long) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if (sizeof(long) <= sizeof(unsigned long)) { + __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) + } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + const digit* digits = ((PyLongObject*)x)->ob_digit; + switch (Py_SIZE(x)) { + case 0: return (long) 0; + case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0])) + case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0]) + case -2: + if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { + return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case 2: + if (8 * sizeof(long) > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { + return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case -3: + if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { + return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case 3: + if (8 * sizeof(long) > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { + return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case -4: + if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { + return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case 4: + if (8 * sizeof(long) > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { + return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + } +#endif + if (sizeof(long) <= sizeof(long)) { + __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) + } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) + } + } + { +#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) + PyErr_SetString(PyExc_RuntimeError, + "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); +#else + long val; + PyObject *v = __Pyx_PyNumber_IntOrLong(x); + #if PY_MAJOR_VERSION < 3 + if (likely(v) && !PyLong_Check(v)) { + PyObject *tmp = v; + v = PyNumber_Long(tmp); + Py_DECREF(tmp); + } + #endif + if (likely(v)) { + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + int ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); + Py_DECREF(v); + if (likely(!ret)) + return val; + } +#endif + return (long) -1; + } + } else { + long val; + PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); + if (!tmp) return (long) -1; + val = __Pyx_PyInt_As_long(tmp); + Py_DECREF(tmp); + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to long"); + return (long) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long) -1; +} + +/* CheckBinaryVersion */ + static int __Pyx_check_binary_version(void) { + char ctversion[4], rtversion[4]; + PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); + PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); + if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { + char message[200]; + PyOS_snprintf(message, sizeof(message), + "compiletime version %s of module '%.100s' " + "does not match runtime version %s", + ctversion, __Pyx_MODULE_NAME, rtversion); + return PyErr_WarnEx(NULL, message, 1); + } + return 0; +} + +/* InitStrings */ + static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { + while (t->p) { + #if PY_MAJOR_VERSION < 3 + if (t->is_unicode) { + *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); + } else if (t->intern) { + *t->p = PyString_InternFromString(t->s); + } else { + *t->p = PyString_FromStringAndSize(t->s, t->n - 1); + } + #else + if (t->is_unicode | t->is_str) { + if (t->intern) { + *t->p = PyUnicode_InternFromString(t->s); + } else if (t->encoding) { + *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); + } else { + *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + } + } else { + *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); + } + #endif + if (!*t->p) + return -1; + ++t; + } + return 0; +} + +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) { + return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str)); +} +static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) { + Py_ssize_t ignore; + return __Pyx_PyObject_AsStringAndSize(o, &ignore); +} +static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { +#if CYTHON_COMPILING_IN_CPYTHON && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) + if ( +#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + __Pyx_sys_getdefaultencoding_not_ascii && +#endif + PyUnicode_Check(o)) { +#if PY_VERSION_HEX < 0x03030000 + char* defenc_c; + PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL); + if (!defenc) return NULL; + defenc_c = PyBytes_AS_STRING(defenc); +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + { + char* end = defenc_c + PyBytes_GET_SIZE(defenc); + char* c; + for (c = defenc_c; c < end; c++) { + if ((unsigned char) (*c) >= 128) { + PyUnicode_AsASCIIString(o); + return NULL; + } + } + } +#endif + *length = PyBytes_GET_SIZE(defenc); + return defenc_c; +#else + if (__Pyx_PyUnicode_READY(o) == -1) return NULL; +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + if (PyUnicode_IS_ASCII(o)) { + *length = PyUnicode_GET_LENGTH(o); + return PyUnicode_AsUTF8(o); + } else { + PyUnicode_AsASCIIString(o); + return NULL; + } +#else + return PyUnicode_AsUTF8AndSize(o, length); +#endif +#endif + } else +#endif +#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) + if (PyByteArray_Check(o)) { + *length = PyByteArray_GET_SIZE(o); + return PyByteArray_AS_STRING(o); + } else +#endif + { + char* result; + int r = PyBytes_AsStringAndSize(o, &result, length); + if (unlikely(r < 0)) { + return NULL; + } else { + return result; + } + } +} +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { + int is_true = x == Py_True; + if (is_true | (x == Py_False) | (x == Py_None)) return is_true; + else return PyObject_IsTrue(x); +} +static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) { + PyNumberMethods *m; + const char *name = NULL; + PyObject *res = NULL; +#if PY_MAJOR_VERSION < 3 + if (PyInt_Check(x) || PyLong_Check(x)) +#else + if (PyLong_Check(x)) +#endif + return __Pyx_NewRef(x); + m = Py_TYPE(x)->tp_as_number; +#if PY_MAJOR_VERSION < 3 + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Int(x); + } + else if (m && m->nb_long) { + name = "long"; + res = PyNumber_Long(x); + } +#else + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Long(x); + } +#endif + if (res) { +#if PY_MAJOR_VERSION < 3 + if (!PyInt_Check(res) && !PyLong_Check(res)) { +#else + if (!PyLong_Check(res)) { +#endif + PyErr_Format(PyExc_TypeError, + "__%.4s__ returned non-%.4s (type %.200s)", + name, name, Py_TYPE(res)->tp_name); + Py_DECREF(res); + return NULL; + } + } + else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "an integer is required"); + } + return res; +} +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { + Py_ssize_t ival; + PyObject *x; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_CheckExact(b))) { + if (sizeof(Py_ssize_t) >= sizeof(long)) + return PyInt_AS_LONG(b); + else + return PyInt_AsSsize_t(x); + } +#endif + if (likely(PyLong_CheckExact(b))) { + #if CYTHON_USE_PYLONG_INTERNALS + const digit* digits = ((PyLongObject*)b)->ob_digit; + const Py_ssize_t size = Py_SIZE(b); + if (likely(__Pyx_sst_abs(size) <= 1)) { + ival = likely(size) ? digits[0] : 0; + if (size == -1) ival = -ival; + return ival; + } else { + switch (size) { + case 2: + if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { + return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case -2: + if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { + return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case 3: + if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { + return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case -3: + if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { + return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case 4: + if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { + return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case -4: + if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { + return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + } + } + #endif + return PyLong_AsSsize_t(b); + } + x = PyNumber_Index(b); + if (!x) return -1; + ival = PyInt_AsSsize_t(x); + Py_DECREF(x); + return ival; +} +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { + return PyInt_FromSize_t(ival); +} + + +#endif /* Py_PYTHON_H */ diff --git a/examples/interfaces/pyNomad_Beta/PyNomad.pyx b/examples/interfaces/pyNomad_Beta/PyNomad.pyx new file mode 100644 index 0000000000000000000000000000000000000000..52728efb8d375ceaa82b5d3f2e1770df3defca06 --- /dev/null +++ b/examples/interfaces/pyNomad_Beta/PyNomad.pyx @@ -0,0 +1,165 @@ +# C.Tribes sept. 6th, 2016 --- PyNomad: Beta integration of Nomad in Python +# PyNomad 1.0 + +from libcpp.vector cimport vector +from libcpp.string cimport string +from libcpp.list cimport list +from libcpp cimport bool + +from cython.operator cimport dereference as deref, preincrement as inc +from multiprocessing import Process, Queue + +def version(): + printPyNomadVersion() + +# Define the interface function to display nomad general information +def usage(): + printPyNomadUsage() + +# Define the interface function to display nomad general information +def info(): + printPyNomadUsage() + printPyNomadInfo() + +# Define the interface function to get nomad help +def help(about=''): + printNomadHelp(about) + +def __doc__(): + cdef string about; + printPyNomadUsage() + help(about) + +# Define the interface function to perform optimization +def optimize(f , pX0, pLB,pUB ,params): + cdef PyNomadEval_Point u_feas = PyNomadEval_Point() + cdef PyNomadEval_Point u_infeas = PyNomadEval_Point() + cdef int run_status + cdef int nb_evals = 0 + cdef int nb_iters = 0 + cdef double f_return + cdef double h_return + x_return=[] + run_status = runNomad(cb, cbL, <void*> f, <vector[double]&> pX0, <vector[double]&> pLB, <vector[double]&> pUB , <vector[string]&> params , u_feas.c_ep ,u_infeas.c_ep , nb_evals, nb_iters) + if u_feas.c_ep != NULL: + f_return = u_feas.get_f() + h_return = 0 + for i in xrange(u_feas.get_n()): + x_return.append(u_feas.get_coord(i)) + del u_feas.c_ep + if u_infeas.c_ep != NULL: + f_return = u_infeas.get_f() + h_return = u_infeas.get_h() + for i in xrange(u_infeas.get_n()): + x_return.append(u_infeas.get_coord(i)) + del u_infeas.c_ep + return [ x_return , f_return, h_return, nb_evals , nb_iters , run_status ] + +cdef extern from "Double.hpp" namespace "NOMAD": + cdef cppclass Double: + const double & value() + bool is_defined() + +cdef class PyNomadDouble: + cdef Double c_d + def value(self): + return self.c_d.value() + def is_defined(self): + return self.c_d.is_defined() + +cdef extern from "Eval_Point.hpp" namespace "NOMAD": + cdef cppclass Eval_Point: + const double & value(int i) + const Double & get_f() + const Double & get_h() + void set_bb_output(int i, double & v) + int get_n() + int get_m() + +cdef class PyNomadEval_Point: + cdef Eval_Point *c_ep + def get_coord(self, int i): + return self.c_ep.value(i) + def set_bb_output(self,int i, double v): + self.c_ep.set_bb_output(i,v) + def get_f(self): + cdef PyNomadDouble f = PyNomadDouble() + f.c_d=self.c_ep.get_f() + cdef double f_d + if ( f.is_defined() ): + f_d = f.value() + else: + f_d = float('inf') + return f_d + def get_h(self): + cdef PyNomadDouble h = PyNomadDouble() + h.c_d=self.c_ep.get_h() + cdef double h_d + if ( h.is_defined() ): + h_d = h.value() + else: + h_d = 0 + return h_d + + def get_n(self): + cdef int n + n = self.c_ep.get_n() + return n + def get_m(self): + cdef int m + m = self.c_ep.get_m() + return m + +cdef extern from "nomadCySimpleInterface.cpp": + ctypedef int (*Callback)(void * apply, Eval_Point& x) + ctypedef int (*CallbackL)(void * apply, list[Eval_Point *] & x) + void printPyNomadInfo() + void printPyNomadUsage() + void printNomadHelp( string about) + void printPyNomadVersion() + int runNomad(Callback cb, CallbackL cbL, void* apply, vector[double] &X0, vector[double] &LB, vector[double] &UB , vector[string] & params , Eval_Point *& best_feas_sol ,Eval_Point *& best_infeas_sol , int & nb_evals, int & nb_iters) except+ + +# Define callback function for a single Eval_Point ---> link with Python +cdef int cb(void *f, Eval_Point & x): + cdef PyNomadEval_Point u = PyNomadEval_Point() + u.c_ep = &x + return (<object>f)(u) + +# Define callback function for block evaluation of a list of Eval_Points ---> link with Python +cdef int cbL(void *f, list[Eval_Point *] & x): + cdef size_t size = x.size() + cdef PyNomadEval_Point u + cdef list[Eval_Point *].iterator it = x.begin() + cdef Eval_Point *c_ep + + # Start the process for each Eval_Point of the list + out = Queue() + for i in xrange(size): + u = PyNomadEval_Point() + c_ep = deref(it) + u.c_ep = c_ep + proc = [] + p = Process(target=<object>f, args=(u,out,)) # u is copied + p.start() + proc.append(p) + inc(it) + + # Wait for all the processes to end + for p in proc: + p.join() + + # Update the Eval_Points bb_output from the out Queue + it = x.begin() + for i in xrange(size): + c_ep = deref(it) + bb_out = out.get() + if type(bb_out) != type(float) or type(bb_out) != type(int): + for j in xrange(len(bb_out)): + c_ep.set_bb_output(j,bb_out[j]) + else: + c_ep.set_bb_output(0,bb_out) + + inc(it) + + return 1 # 1 is success + diff --git a/examples/interfaces/pyNomad_Beta/nomadCySimpleInterface.cpp b/examples/interfaces/pyNomad_Beta/nomadCySimpleInterface.cpp new file mode 100755 index 0000000000000000000000000000000000000000..c4f5cd725649a7d8083415b584a178a9ece7d0b1 --- /dev/null +++ b/examples/interfaces/pyNomad_Beta/nomadCySimpleInterface.cpp @@ -0,0 +1,383 @@ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + +#define NOMAD_PYTHON_VERSION "1.0 (beta) [Feb, 3rd, 2017]" + +#include "nomad.hpp" +#include "defines.hpp" +#include <stdio.h> +#include <string.h> + +using namespace std; + +typedef int (*Callback)(void * apply, NOMAD::Eval_Point &sv); +typedef int (*CallbackL)(void * apply, std::list<NOMAD::Eval_Point *> &sv); + +//Print Nomad general Information +//Print Nomad general Information +static void printPyNomadVersion() +{ + printf("-----------------------------------------------------------\n"); + printf("\n Python Interface version %s: C. Tribes \n",NOMAD_PYTHON_VERSION); + printf("-----------------------------------------------------------\n"); +} + + +static void printPyNomadInfo() +{ + printf("\n-----------------------------------------------------------\n"); + printf(" NOMAD: Nonlinear Optimization using the MADS Algorithm [v%s]\n",NOMAD::VERSION.c_str()); + printf(" - Released under the GNU Lesser General Public License: http://www.gnu.org/copyleft/lesser.html\n"); + printf(" - Source available from: https://www.gerad.ca/nomad/\n"); + + printPyNomadVersion(); + + printf(" % NOMAD solves a Global MINLP/NLP in the form \n"); + printf(" min f(x) \n"); + printf(" subject to: \n"); + printf(" nlcon(x) <= 0 \n"); + printf(" lb <= x <= ub \n"); + printf(" x in R \n"); + printf("\n-----------------------------------------------------------\n"); + +} + +//Print Nomad usage +static void printPyNomadUsage() +{ + printf("\n----------------------------------------------------------------------------------------------------------------------\n"); + printf(" PyNomad interface usage:\n"); + printf("------------------------------------------------------------------------------------------------------------------------\n"); + printf(" Info : PyNomad.info()\n"); + printf(" Version : PyNomad.version()\n"); + printf(" Help : PyNomad.help( 'keywords' or 'all' or empty ) \n"); + printf(" Usage : PyNomad.usage() \n"); + printf("------------------------------------------------------------------------------------------------------------------------\n"); + printf(" Run NOMAD : [x_best,f_best,h_best,nb_evals,nb_iters,exit_status] = PyNomad.optimize(bb,x0,lb,ub,param) \n\n"); + printf(" Input parameters: \n"); + printf(" bb ---> name of the blackbox function (see below for details) {not optional} \n"); + printf(" x0 ---> list of values for initial point (e.g. x0=[0,0,0,0,0]) {[]} \n"); + printf(" lb ---> list of values for initial point (e.g. lb=[-1,-2,-3,-4,-5]) {[]} \n"); + printf(" ub ---> list of values for initial point (e.g. ub=[1,2,3,4,5]) {[]} \n"); + printf(" params ---> list of Nomad parameters (e.g. param =['DIMENSION 5','BB_OUTPUT_TYPE OBJ']) {not optional}\n"); + printf(" Consult Nomad documentation or type PyNomad.help() to see all parameters \n\n"); + printf(" Output parameters: \n"); + printf(" x_best ---> list of values for the best feasible or infeasible point at the end of Nomad optimization\n"); + printf(" f_best ---> Objective function value for the best point obtained \n"); + printf(" h_best ---> Infeasibility measure value for best point obtained ( 0 if feasible) \n"); + printf(" nb_evals ---> Number of blackbox evaluations \n"); + printf(" nb_iters ---> Number of iterations of the Mads algorithm \n"); + printf(" exit_status ---> Exit status for Nomad termination criterion (see stop_type in $NOMAD_HOME/src/defines.hpp)\n\n"); + printf(" Blackbox evaluation (example for form 1): a single point is passed to blackbox function at a time \n"); + printf(" def bb(x): \n"); + printf(" f = sum([x.get_coord(i)**2 for i in {0,1,2}]) # the coordinate of the point are accessed \n"); + printf(" # with the get_coord function \n"); + printf(" x.set_bb_output(0, f ) # The first output is set. The outputs are given in same order \n"); + printf(" # as defined with the BB_OUTPUT_TYPE parameters \n"); + printf(" return 1 # 1 ->success, 0 -> failed \n\n"); + printf(" Blackbox evaluation for multiprocess (example for form 2): several bb can be called in parallel \n"); + printf(" def bb(x,bb_out): # blackbox function requires 2 arguments \n"); + printf(" # First argument is similar to form 1 \n"); + printf(" # Second argument is a list of the blackbox outputs \n"); + printf(" bb_out.put(sum([x.get_coord(i)**2 for i in {0,1,2}])) # bb_out is a queue to work in multiprocess \n"); + printf(" # The put function is thread safe \n"); + printf("------------------------------------------------------------------------------------------------------------------------ \n"); +} + +//Print Nomad usage +static void printNomadHelp( string about ) +{ + NOMAD::Parameters p ( cout ); + p.help ( about ); +} + + +//Python Evaluator Class +class pyEval : public NOMAD::Evaluator +{ +private: + Callback cb; + CallbackL cbL; + void * apply; + + +public: + //Constructor + pyEval(const NOMAD::Parameters &p, Callback _cb, CallbackL _cbL, void * _apply) : cb(_cb),cbL(_cbL),apply(_apply),NOMAD::Evaluator(p){} + + //Destructor + ~pyEval(void) {} + + bool eval_x(NOMAD::Eval_Point &x, const NOMAD::Double &h_max, bool &count_eval) + { + int success=0; + + //Call Python blackbox function on a single Eval_Point + try + { + count_eval = true; + success = cb(apply,x); + if ( success == -1 ) + { + printf("Unrecoverable Error from Objective / Blackbox Callback, Exiting NOMAD...\n\n"); + //Force exit + raise(SIGINT); + return false; + } + } + //Note if these errors occur it is due to errors in python code + catch(...) + { + printf("Unrecoverable Error from Objective / Blackbox Callback, Exiting NOMAD...\n\n"); + //Force exit + raise(SIGINT); + return false; + } + if ( success == 1 ) + return true; + else + return false; + } + + bool eval_x ( std::list<NOMAD::Eval_Point *> &list_x , + const NOMAD::Double & h_max, + std::list<bool> & list_count_eval ) const + { + + int success=0; + + //Call Python blackbox function on a list of Eval_Points + try + { + success = cbL(apply,list_x); + if ( success == -1 ) + { + printf("Unrecoverable Error from Objective / Blackbox Callback, Exiting NOMAD...\n\n"); + //Force exit + raise(SIGINT); + return false; + } + + std::list<bool>::iterator it_count; + for (it_count=list_count_eval.begin(); it_count!=list_count_eval.end(); ++it_count) + (*it_count)=true; + + } + //Note if these errors occur it is due to errors in python code + catch(...) + { + printf("Unrecoverable Error from Objective / Blackbox Callback, Exiting NOMAD...\n\n"); + //Force exit + raise(SIGINT); + return false; + } + if ( success == 1 ) + return true; + else + return false; + } + + + + +}; + + +static int runNomad(Callback cb, CallbackL cbL, void * apply, std::vector<double> X0 , std::vector<double> LB, std::vector<double> UB , const std::vector<std::string> & param , NOMAD::Eval_Point *& best_feas_sol , NOMAD::Eval_Point *& best_infeas_sol , int & nb_evals, int & nb_iters ) +{ + + NOMAD::Display out(std::cout); + NOMAD::Parameters p(out); + + size_t nobj; + int dimension; + bool dimension_is_defined = false; + + try + { + size_t ndec = X0.size(); + if ( ndec != 0 ) + { + NOMAD::Point px0(ndec); + + dimension = (int)ndec; + dimension_is_defined = true; + + for(int i=0 ; i < ndec ; i++) + px0[i] = X0[i]; + + p.set_X0(px0); + } + + size_t nlb = LB.size(); + if ( nlb != 0 ) + { + NOMAD::Point plb( (int)nlb ); + + if ( ! dimension_is_defined ) + { + dimension = (int)nlb; + dimension_is_defined = true; + } + + if ( ndec != 0 && nlb !=ndec ) + throw NOMAD::Exception("",0,"The lower bound size is inconsistent with X0 size"); + + for(int i=0 ; i < nlb ; i++) + plb[i] = LB[i]; + + p.set_LOWER_BOUND( plb ); + } + + size_t nub = UB.size(); + if ( nub != 0 ) + { + NOMAD::Point pub( (int)nub ); + + if ( ! dimension_is_defined ) + { + dimension = (int)nub; + dimension_is_defined = true; + } + + if ( nlb != 0 && nub != nlb ) + throw NOMAD::Exception("",0,"The upper bound size is inconsistent with lower bound size"); + + if ( ndec != 0 && nub != ndec ) + throw NOMAD::Exception("",0,"The upper bound size is inconsistent with X0 size"); + + for(int i=0 ; i < nub ; i++) + pub[i] = UB[i]; + + p.set_UPPER_BOUND( pub ); + + } + + if ( dimension_is_defined ) + p.set_DIMENSION( dimension ); + + // Make sure that evaluation numbers are reset + NOMAD::Eval_Point::reset_tags_and_bbes(); + + // The seed will always be to its default value + NOMAD::RNG::reset_private_seed_to_default(); + + NOMAD::Parameter_Entries entries; + NOMAD::Parameter_Entry * pe; + + // Interpret parameters given in vector + if ( param.size() > 0 ) + { + for (int i=0; i < param.size() ; i++ ) + { + pe = new NOMAD::Parameter_Entry ( param[i] ); + entries.insert( pe ); + } + p.read( entries ); + } + + p.check(); + + nobj = p.get_nb_obj(); + + if ( nobj != 1 ) + throw NOMAD::Exception ( "" , 0 ,"The python interface for BiMads (biobjective) is not yet implemented"); + + int noutput = p.get_bb_output_type().size(); + + // Create the best solutions (delete in Cython interface + best_feas_sol =new NOMAD::Eval_Point(p.get_dimension(),static_cast<int>(noutput)); + best_infeas_sol =new NOMAD::Eval_Point(p.get_dimension(),static_cast<int>(noutput)); + + + } + catch(exception &e) + { + printf("NOMAD Parameter Error:\n%s\n",e.what()); + return -1; + } + + + try + { + pyEval *mSEval = new pyEval(p,cb,cbL,apply); + + NOMAD::Mads mads (p, mSEval); + + NOMAD::stop_type stopflag = mads.run(); + + nb_evals = mads.get_stats().get_bb_eval(); + nb_iters = mads.get_stats().get_iterations(); + + // Set the best feasible solution or the best infeasible solution. + // One of the pointer is set to null to identify the type of solution + const NOMAD::Eval_Point * bf = mads.get_best_feasible(); + const NOMAD::Eval_Point *bimv = mads.get_best_infeasible_min_viol(); + if ( bimv ) + { + best_infeas_sol->set_f( bimv->get_f()); + best_infeas_sol->set_h( bimv->get_h()); + best_infeas_sol->set( *bimv ,static_cast<int>(nobj)); + if ( !bf ) + { + delete best_feas_sol; + best_feas_sol = NULL; + } + } + if ( bf ) + { + best_feas_sol->set_f(bf->get_f()); + best_feas_sol->set( *bf ,static_cast<int>(nobj)); + delete best_infeas_sol; + best_infeas_sol = NULL; + } + return stopflag; + + } + catch(exception &e) + { + printf("NOMAD exception (report to developper):\n%s\n",e.what()); + } + return -1; + +} diff --git a/examples/interfaces/pyNomad_Beta/readme b/examples/interfaces/pyNomad_Beta/readme new file mode 100644 index 0000000000000000000000000000000000000000..446abf8b70ba76eb6c2c5272c6c1da868b4bfc9b --- /dev/null +++ b/examples/interfaces/pyNomad_Beta/readme @@ -0,0 +1,17 @@ +Creating the Python Interface to Nomad (PyNomad) is based on Cython 0.24 (or above) and Python 2.7 +A simple way to have Cython and Python is to install the Anaconda package. + +Please note that not all functionalities of Nomad are available in PyNomad (beta version). + +To build the PyNomad interface library: + - Make sure to have the NOMAD_HOME environment variables set correctly + - run the following in a command line: python setup_PyNomad.py build_ext --inplace + +To install the PyNomad interface library for the current user + - run the following in a command line: python setup_PyNomad.py install --user + +Several tests are proposed in the directory to check that everything is up and running: + - python runTestInfoHelp.py + - python runTest.py + - python runTest_2.py + - python runTest_BlockEval.py diff --git a/examples/interfaces/pyNomad_Beta/runTest.py b/examples/interfaces/pyNomad_Beta/runTest.py new file mode 100644 index 0000000000000000000000000000000000000000..4cd4cbe377260917315baf4c18f649117a0beee5 --- /dev/null +++ b/examples/interfaces/pyNomad_Beta/runTest.py @@ -0,0 +1,18 @@ +import PyNomad + +# This example of blackbox function is for a single process +# The blackbox output must be put in the Eval_Point passed as argument +def bb(x): + dim = x.get_n() + f = sum([x.get_coord(i)**2 for i in xrange(dim)]) + x.set_bb_output(0, f ) + return 1 # 1: success 0: failed evaluation + +x0 = [0.71,0.51,0.51] +lb = [-1,-1,-1] +ub=[] + +params = ['BB_OUTPUT_TYPE OBJ','MAX_BB_EVAL 100','UPPER_BOUND * 1'] + +[ x_return , f_return , h_return, nb_evals , nb_iters , stopflag ] = PyNomad.optimize(bb,x0,lb,ub,params) +print ('\n NOMAD outputs \n X_sol={} \n F_sol={} \n H_sol={} \n NB_evals={} \n NB_iters={} \n'.format(x_return,f_return,h_return,nb_evals,nb_iters)) diff --git a/examples/interfaces/pyNomad_Beta/runTestInfoHelp.py b/examples/interfaces/pyNomad_Beta/runTestInfoHelp.py new file mode 100644 index 0000000000000000000000000000000000000000..e25a4fea9397ffe34c65b3c3a162de06dc9ba210 --- /dev/null +++ b/examples/interfaces/pyNomad_Beta/runTestInfoHelp.py @@ -0,0 +1,5 @@ +import PyNomad + +PyNomad.info() + +PyNomad.help("BB_OUTPUT") diff --git a/examples/interfaces/pyNomad_Beta/runTest_2.py b/examples/interfaces/pyNomad_Beta/runTest_2.py new file mode 100644 index 0000000000000000000000000000000000000000..e2aef60f94433ec5883007ac8c5003d5b71a94d3 --- /dev/null +++ b/examples/interfaces/pyNomad_Beta/runTest_2.py @@ -0,0 +1,23 @@ +import PyNomad +import sys + +def bb(x): + try: + dim = x.get_n() + f = x.get_coord(4) + x.set_bb_output(0,f) + g1 = sum([(x.get_coord(i)-1)**2 for i in xrange(dim)])-25 + x.set_bb_output(1,g1) + g2 = 25-sum([(x.get_coord(i)+1)**2 for i in xrange(dim)]) + x.set_bb_output(2,g2) + # test = 1* (1/0) # ---> uncomment to trigger an exception + except: + print "Unexpected error:", sys.exc_info()[0] + return -1 + return 1 + +ub = [ 5,6,7,10,10] + +params = ['BB_OUTPUT_TYPE OBJ PB EB','MAX_BB_EVAL 100','X0 * 0' , 'LOWER_BOUND * -6' ] +[ x_return , f_return , h_return, nb_evals , nb_iters , stopflag ] = PyNomad.optimize(bb,[],[],ub,params) +print ('\n NOMAD outputs \n X_sol={} \n F_sol={} \n H_sol={} \n NB_evals={} \n NB_iters={} \n'.format(x_return,f_return,h_return,nb_evals,nb_iters)) diff --git a/examples/interfaces/pyNomad_Beta/runTest_BlockEval.py b/examples/interfaces/pyNomad_Beta/runTest_BlockEval.py new file mode 100644 index 0000000000000000000000000000000000000000..a9d5bc7b0a432d93f448950a14d3ba05c840181c --- /dev/null +++ b/examples/interfaces/pyNomad_Beta/runTest_BlockEval.py @@ -0,0 +1,28 @@ +import PyNomad +import sys + +# This example of blackbox function is for multiprocess: several bb are called in parallel +# Multiprocess blackbox evaluations request to provide the BB_MAX_BLOCK_SIZE in NOMAD params +# +# In this case blackbox function requires 2 arguments +# The first argument x is similar to a NOMAD::Eval_Point --> access the coordinates with get_coord() function +# The blackbox output must be put in the second argument bb_out and the bb outputs must be put in the same order as defined in params +# bb_out is a queue to work in a multiprocess. +def bb(x,bb_out): + try: + dim = x.get_n() + f = x.get_coord(4) + g1 = sum([(x.get_coord(i)-1)**2 for i in xrange(dim)])-25 + g2 = 25-sum([(x.get_coord(i)+1)**2 for i in xrange(dim)]) + bb_out.put([f,g1,g2]) + except: + print "Unexpected error:", sys.exc_info()[0] + sys.exit(0) + +x0 = [0,0,0.71,0.51,0.51] +lb = [-6,-6,-6,-6,-6] +ub = [ 5,6,7,10,10] + +params = ['BB_OUTPUT_TYPE OBJ PB EB','MAX_BB_EVAL 100' , 'BB_MAX_BLOCK_SIZE 8','DISPLAY_STATS BBE BLK_EVA OBJ'] +[ x_return , f_return , h_return, nb_evals , nb_iters , stopflag ] = PyNomad.optimize(bb,x0,lb,ub,params) +print ('\n NOMAD outputs \n X_sol={} \n F_sol={} \n H_sol={} \n NB_evals={} \n NB_iters={} \n'.format(x_return,f_return,h_return,nb_evals,nb_iters)) diff --git a/examples/interfaces/pyNomad_Beta/setup_PyNomad.py b/examples/interfaces/pyNomad_Beta/setup_PyNomad.py new file mode 100644 index 0000000000000000000000000000000000000000..bd429b678109cf1052ee18fe9c7b18af3c75d788 --- /dev/null +++ b/examples/interfaces/pyNomad_Beta/setup_PyNomad.py @@ -0,0 +1,38 @@ +from distutils.core import setup, Extension +from Cython.Build import cythonize + +import numpy as np +import os +import sys + + +if ( str(os.environ.get('NOMAD_HOME')) == '' or str(os.environ.get('NOMAD_HOME')) == 'None'): + print "A NOMAD_HOME environment variable is needed for building Nomad for Python (PyNomad) \n" + exit() + +compile_args = ['-w'] +link_args = [] + + +# Look for librairies in Nomad distribution +if sys.platform.startswith('linux'): + link_args.append('-Wl,-rpath,'+str(os.environ.get('NOMAD_HOME'))+'/lib') + +# Prevent error message when changing the location of libnomad.so (OSX) +if sys.platform == 'darwin': + link_args.append('-headerpad_max_install_names') + +setup( + ext_modules = cythonize(Extension( + "PyNomad", # the extesion name + sources=["PyNomad.pyx", "nomadCySimpleInterface.cpp"], # the Cython source and + include_dirs = [str(os.environ.get('NOMAD_HOME'))+'/src',str(os.environ.get('NOMAD_HOME'))+'/ext/sgtelib/src', np.get_include()], + extra_compile_args=compile_args, + extra_link_args=link_args, + language = 'c++', + libraries = ['nomad'], + library_dirs = [ str(os.environ.get('NOMAD_HOME')) + '/lib'],)) +) + +if sys.platform == 'darwin': + os.system('install_name_tool -change libnomad.so '+os.environ.get('NOMAD_HOME')+'/lib/libnomad.so PyNomad.so') diff --git a/ext/sgtelib/example/X.txt b/ext/sgtelib/example/X.txt new file mode 100644 index 0000000000000000000000000000000000000000..0552ec4bdceba98df5fbc3fdfe9b8d346f72656e --- /dev/null +++ b/ext/sgtelib/example/X.txt @@ -0,0 +1,48 @@ +X = [ 0 25 ; + 0 50 ; + 0 55 ; + 0 57 ; + 0 83 ; + 0 92 ; + 1 47 ; + 1 48 ; + 1 66 ; + 1 75 ; + 1 93 ; + 1 96 ; + 2 5 ; + 2 8 ; + 2 13 ; + 2 25 ; + 2 55 ; + 2 57 ; + 2 70 ; + 2 75 ; + 3 12 ; + 3 34 ; + 3 47 ; + 3 62 ; + 3 76 ; + 3 84 ; + 3 93 ; + 4 1 ; + 4 15 ; + 4 20 ; + 4 28 ; + 4 29 ; + 4 34 ; + 4 35 ; + 4 53 ; + 4 78 ; + 4 81 ; + 4 89 ; + 5 14 ; + 5 16 ; + 5 22 ; + 5 24 ; + 5 26 ; + 5 38 ; + 5 51 ; + 5 59 ; + 5 68 ; +] diff --git a/ext/sgtelib/example/XX.txt b/ext/sgtelib/example/XX.txt new file mode 100644 index 0000000000000000000000000000000000000000..a13c2a8d19bdd1090eaa7494960fdc41d04f0271 --- /dev/null +++ b/ext/sgtelib/example/XX.txt @@ -0,0 +1,7 @@ +XX = [ + 1 2.2 ; + 2 1.5 ; + 2 1.2 ; + 4 3.4 ; +]; + diff --git a/ext/sgtelib/example/Z.txt b/ext/sgtelib/example/Z.txt new file mode 100644 index 0000000000000000000000000000000000000000..713ccaae8b3bfd3931b7cb6b3aedf020e5d1ceac --- /dev/null +++ b/ext/sgtelib/example/Z.txt @@ -0,0 +1,49 @@ +Z = [ 0 ; + 0 ; + 0 ; + 0 ; + 0 ; + 0 ; + 2209 ; + 3481 ; + 4356 ; + 5625 ; + 8649 ; + 9216 ; + -50 ; + -128 ; + -338 ; + -1250 ; + -6050 ; + -6498 ; + -9800 ; + -11250 ; + 432 ; + 3468 ; + 6627 ; + 11532 ; + 17328 ; + 21168 ; + 25947 ; + -4 ; + -900 ; + -1600 ; + -3136 ; + -3364 ; + -4624 ; + -4900 ; + -11236 ; + -24336 ; + -26244 ; + -31684 ; + 980 ; + 1280 ; + 2420 ; + 2880 ; + 3380 ; + 7220 ; + 13005 ; + 17405 ; + 23120 ; +]; + diff --git a/ext/sgtelib/example/ZZ.txt b/ext/sgtelib/example/ZZ.txt new file mode 100644 index 0000000000000000000000000000000000000000..3faee720ce0b4dff5720f83bb6834196aede1e83 --- /dev/null +++ b/ext/sgtelib/example/ZZ.txt @@ -0,0 +1,7 @@ + +ZZ=[ + 2.5 ; + 3.4 ; + 3.5 ; + 5.5 ; +]; diff --git a/ext/sgtelib/example/comparison/main_metrics_comparison.m b/ext/sgtelib/example/comparison/main_metrics_comparison.m new file mode 100644 index 0000000000000000000000000000000000000000..7a136813d65b5960384ca69ecf5535c8dd13f543 --- /dev/null +++ b/ext/sgtelib/example/comparison/main_metrics_comparison.m @@ -0,0 +1,33 @@ +close all +clear all +clc + + +output_dir = '.'; + + + +input_file = 'output_hartman3.txt'; +output_file = [output_dir 'metric_comparison_hartman3.pdf']; +plot_metrics_comparison(input_file,output_file); +close all; + +input_file = 'output_hartman6.txt'; +output_file = [output_dir 'metric_comparison_hartman6.pdf']; +plot_metrics_comparison(input_file,output_file); +close all; + +input_file = 'output_braninhoo.txt'; +output_file = [output_dir 'metric_comparison_braninhoo.pdf']; +plot_metrics_comparison(input_file,output_file); +close all; + +input_file = 'output_camelback.txt'; +output_file = [output_dir 'metric_comparison_camelback.pdf']; +plot_metrics_comparison(input_file,output_file); +close all; + +input_file = 'output_rosenbrock.txt'; +output_file = [output_dir 'metric_comparison_rosenbrock.pdf']; +plot_metrics_comparison(input_file,output_file); +close all; diff --git a/ext/sgtelib/example/comparison/plot_metrics_comparison.m b/ext/sgtelib/example/comparison/plot_metrics_comparison.m new file mode 100644 index 0000000000000000000000000000000000000000..300440a61505ad38b7265cae60462b529e5f024c --- /dev/null +++ b/ext/sgtelib/example/comparison/plot_metrics_comparison.m @@ -0,0 +1,259 @@ +function plot_metrics_comparison(input_file,output_file) +% output_dir = '/home/bastien/Bureau/MUSU/MUSU_2015_01_01_WorkingPaper/figs/'; +% input_file = 'output_hartman6.txt'; +% output_dir = '/home/bastien/Bureau/MUSU/PAPER_OrderErrorForEnsembles/figs/'; +% output_file = [output_dir 'metric_comparison_hartman6.pdf']; +%close all + + + +texOptions = {'fontname','times','fontsize',14}; + + + + + +m_order = [1 2 3 4]; + + +model_list = cell(0); +metric_list = cell(0); +tab = []; + +fid = fopen(input_file); +line = fgetl(fid); +while ischar(line) + + if isempty(line) + line = fgetl(fid); + continue; + end + line = cleanSpaces(line); + + w = getWords(line); + if isempty(w{end}) + w(end)=[]; + end + + if strcmp(w{1},'metrics') + w(1) = []; + vs = zeros(1,length(w)); + for i = 1:length(w) + vs(1,i) = str2num(w{i}); + end + tab = [tab ; vs]; + % disregard data and delete last model + if max(vs)<-1 + model_list(end) = []; + tab(end,:) = []; + end + elseif strcmp(w{1},'list_metrics') + w(1) = []; + metric_list = w; + disp(metric_list); + elseif strcmp(w{1},'output') + % nothing + elseif strcmp(w{1},'TYPE') + disp('=================') + line + + line = cleanSpaces(line); + line + line = strrep(line,'TYPE',''); + line = strrep(line,'DEGREE',''); + line = strrep(line,'KERNEL_COEF -1','OPT'); + line = strrep(line,'KERNEL_COEF',''); + line = strrep(line,'KERNEL_',''); + line = strrep(line,'D1',''); + line = strrep(line,'WEIGHT',''); + line = strrep(line,'METRIC',''); + line = strrep(line,'ENSEMBLE','Ens.'); + line = strrep(line,'OPTIM','Optim.'); + line = strrep(line,'SELECT','Select'); + line = strrep(line,'RIDGE 0.001','Ridge 1e-3'); + line = strrep(line,'RIDGE 0',''); + line = cleanSpaces(line); + line = strrep(line,'RBFI I','RBFI PolyH. '); + line = strrep(line,'PRESET',' '); + line = cleanSpaces(line); + model_list{end+1} = line; + else + disp(line) + error('line not recognized'); + end + + line = fgetl(fid); +end + +fclose(fid); + + + +% Count +NM = length(metric_list); +NS = length(model_list); + +% Reorder +metric_list = metric_list(m_order); +tab = tab(:,m_order); + +% Build fancy names +metric_fancy_names = metric_list; +metric_fancy_names = strrep(metric_fancy_names,'LOO','RMSE'); +metric_fancy_names = strrep(metric_fancy_names,'RMSECV','PRESS'); +metric_fancy_names = strrep(metric_fancy_names,'OETP','OE'); + + +xmin = zeros(1,NM); +xmax = zeros(1,NM); +for nm=1:NM + e = tab(:,nm); + xmin(nm) = min(e(e>0)); + if any(e==0) + xmin(nm) = xmin(nm)/10; + end + xmax(nm) = max(e); +end + +xmin = 10.^floor(log10(xmin)); +xmax = 10.^ceil (log10(xmax)); + +% +% +% xmin(:) = 0.0; +% xmax(:) = 1; + + + + + +MODEL_TYPES = {'PRS','KS','RBFI','LOWESS','Ens.'}; + +%MODEL_TYPES = {'PRS','KS','RBFI','RBFI PolyH'}; + + +%figure('color','w','position',[959 19 932 945]); +%figure('color','w','position',[949 483 932 481]); +%figure('color','w','position',[793 14 648 770]); +%figure('color','w','position',[509 574 932 210]); +figure('color','w','position',[586 408 847 374]); +set(gcf,'units','normalized'); + +coladd = 2.5 +height = 0.85; +width = 0.7; +for nm=1:NM + + % ORder + t = tab(:,nm) + [t,t] = sort(t); + t(t) = (1:length(t)) + + pos = [ (nm+coladd-1)/(NM+coladd) (1-height)/2 width/(NM+coladd) height]; + subplot('position',pos); hold on; + for ns=1:NS + w = getWords(model_list{ns}); + c = -1; + for i=1:length(MODEL_TYPES) + if ~isempty(strfind(model_list{ns},MODEL_TYPES{i})) + c = i; + end + end + if c==-1 + w{1} + MODEL_TYPES + error('not recognised...'); + end + c = get_color(c+1,length(MODEL_TYPES)+1); + c = 1-0.7*(1-c); + fill([xmin(nm)*[1 1] tab(ns,nm)*[1 1]],ns+[-0.4 +0.4 +0.4 -0.4],c); + text(0.75,ns,num2str(t(ns))); + %text(0.75,ns, num2str(t(ns))); + end + + + set(gca,'units','normalized'); + title(metric_fancy_names{nm},texOptions{:}); + if nm==1 + disp('Modify ytick'); + set(gca,'ytick',(1:NS),'yticklabel',model_list,texOptions{:}); + else + set(gca,'ytick',[],'yticklabel',[],texOptions{:}); + end + %set(gca,'xscale','log'); + %xlim([xmin(nm) xmax(nm)]); + %set(gca,'xtick',[xmin(nm) xmax(nm)]); + set(gca,'ydir','reverse','xgrid','on','xminorgrid','off','box','on'); + ylim([0.5 NS+0.5]); + + + + +end + +export_fig([output_file],'-pdf'); + + + + + + + + + + + + + +output_file = strrep(output_file,'.pdf','_correlation.tex'); +fid = fopen(output_file,'w'); +newline = char(10); + +s = '\begin{tabular}{| c ||'; +for i=1:NM + s = [s ' c |']; +end +fwrite(fid,[s '}' newline]); +fwrite(fid,['\hline' newline]); +s = ''; +for i=1:NM + s = [s ' & ' metric_fancy_names{i} ]; +end +fwrite(fid,[s ' \\' newline]); +fwrite(fid,['\hline\hline' newline]); +for i=1:NM + mi = tab(:,i); + fwrite(fid,[metric_fancy_names{i} newline]); + for j=1:NM + if j>=i + mj = tab(:,j); + c = corr([mi mj]); + c = c(2,1); + c = 0.01*round(c*100); + s = num2str(c); + if abs(c)~=1 && c~=0 && 10*c==round(10*c) + s = [s '0']; + if isempty(find(s=='.')) + error('PROBLEM...'); + end + end + else + s = ' '; + end + if j==NM + s = [s ' \\']; + end + fwrite(fid,[ ' & ' s newline]); + end + fwrite(fid,['\hline' newline]); +end +fwrite(fid,'\end{tabular}'); +fclose(fid); +%edit(output_file); + + + + + + + diff --git a/ext/sgtelib/example/comparison/sgtelib_example_compare_models_1D.m b/ext/sgtelib/example/comparison/sgtelib_example_compare_models_1D.m new file mode 100644 index 0000000000000000000000000000000000000000..592c245b3477863be3b7d5e2ed69a162a289392f --- /dev/null +++ b/ext/sgtelib/example/comparison/sgtelib_example_compare_models_1D.m @@ -0,0 +1,101 @@ +close all +%clear all +clc +disp('=========== EXPLORER ============='); + +addpath('../Matlab_Server'); + +! make -j 4 + +model=cell(0,1); + + model{end+1} = 'TYPE LOWESS SHAPE_COEF -1 PRESET DEN ' + model{end+1} = 'TYPE LOWESS SHAPE_COEF -1 PRESET DGN ' + + + texOptions = {'fontname','times','fontsize',14}; + + + +disp('=========== START ============='); + + +% GOOD!! + + + +X = randn(50,1); +Z = sin(2*pi*X)+0.1*randn(size(X)); + +Z = cos(pi*X).*sign(X); + +%figure('color','w','position',[1466 527 455 437]); hold on; +figure('color','w','position',[198 95 933 639]); hold on; +pointer(1) = plot(X,Z,'ok','linewidth',2); + + +NN = 1000; +zoom = 1.0; +XX = sort([linspace(zoom*min(X),zoom*max(X),NN)' ; X ]); +%XX = 0.5; + +metric = inf*ones(length(model),2); + +for i=1:length(model) + disp('Model : '); + model{i} + disp('Init'); + sgtelib_server_start(model{i},true) + sgtelib_server_ping; + disp('Data'); + sgtelib_server_newdata(X,Z); + disp('Predict'); + [ZZ,std,ei,cdf] = sgtelib_server_predict(XX); + metric(i,1) = sgtelib_server_metric('RMSECV'); + metric(i,2) = sgtelib_server_metric('OECV'); + marker = '';%get_marker(i,length(model)); + pointer(i+1) = plot(XX,ZZ,['-' marker],'color',get_color(i+1,length(model)+1)); + sgtelib_server_stop; +end + + + + +legend_txt = {'Training points'}; +for i=1:length(model) + name = model{i}; + name = strrep(name,'TYPE ENSEMBLE WEIGHT SELECT METRIC','Select'); + name = strrep(name,'RMSECV','PRESS'); + name = strrep(name,'KERNEL_COEF ',' $\lambda$='); + name = strrep(name,'TYPE',' '); + name = strrep(name,'DEGREE','Degree'); + name = strrep(name,'RIDGE 0.001','Ridge 1e-3'); + name = strrep(name,'RIDGE 0.0',' '); + name = strrep(name,'SHAPE_COEF',' '); + name = strrep(name,'PRESET',' '); + name = strrep(name,'Degree 2',' '); + name = cleanSpaces(name); + legend_txt{i+1} = name; +end +legend(pointer,legend_txt,'location','best','interpreter','latex'); +%shift_legend_size([-0.15 0 +0.1 0]); +%axis([0 +1 -1.5 +1.5]) + +xlabel('x',texOptions{:}); +ylabel('y',texOptions{:}); + +set(gca,texOptions{:}); + + output_dir = './'; + output_file = [output_dir 'plot_function_2.pdf']; +export_fig([output_file],'-pdf'); + +for i=1:length(model) + disp(legend_txt{i+1}); + s = ' '; + s = [s num2str(metric(i,1),8)]; + s(20) = ' '; + s = [s num2str(metric(i,2),8)]; + disp(s); + +end \ No newline at end of file diff --git a/ext/sgtelib/example/sgtelib_example_SurrogateBasedOptim.m b/ext/sgtelib/example/sgtelib_example_SurrogateBasedOptim.m new file mode 100644 index 0000000000000000000000000000000000000000..2a55c5292634d7056508521cf5d10917735f1cca --- /dev/null +++ b/ext/sgtelib/example/sgtelib_example_SurrogateBasedOptim.m @@ -0,0 +1,114 @@ +close all +clear all +clc +disp('=========== EXPLORER ============='); + +addpath('../Matlab_Server'); + +WRITE = false; + +! make -j 4 +model = 'TYPE KRIGING' + +sgtelib_server_start(model) + + + +disp('=========== START ============='); +sgtelib_server_ping; + + +f = @(x) sin(5*x) + 1.5*x + x.^2; +xmin = -2; +xmax = +1.5; +zmin = -3; +zmax = +5; + +X = [ -2 ; -1 ; 0.5 ; 1.5 ]; +Z = f(X); + +XX = linspace(xmin,xmax,1000)'; + +ZZtrue = f(XX); + + + +figure('color','w'); hold on; +pointer = []; +leg_txt = cell(0); +k = 0; + +pointer(1) = plot(XX,ZZtrue,'--b'); +leg_txt{1} = 'True function f(x) (unknown)'; +legend(pointer,leg_txt,'location','northwest'); legend('boxoff'); +axis([xmin xmax zmin zmax]); +xlabel('x') +drawnow +if WRITE + export_fig(['SurrogateBasedOptim_A' sprintf('%02d',k) '.pdf'],'-pdf'); k=k+1; +end + +pointer(2) = plot(X,Z,'ok'); +leg_txt{2} = 'Observations'; +legend(pointer,leg_txt,'location','northwest'); legend('boxoff'); +axis([xmin xmax zmin zmax]); +drawnow +if WRITE + export_fig(['SurrogateBasedOptim_A' sprintf('%02d',k) '.pdf'],'-pdf'); k=k+1; +end +set(legend,'box','off') + + +sgtelib_server_newdata(X,Z); + +for ii=1:8 + + [ZZ,std,ei,cdf] = sgtelib_server_predict(XX); + pointer(3) = plot(XX,ZZ,'r'); + if ii==1 + leg_txt{3} = 'Surrogate model'; + else + leg_txt{3} = 'Updated surrogate model'; + end + legend(pointer,leg_txt,'location','northwest'); legend('boxoff'); + axis([xmin xmax zmin zmax]); + drawnow + if WRITE + export_fig(['SurrogateBasedOptim_A' sprintf('%02d',k) '.pdf'],'-pdf'); k=k+1; + end + + [ZZmin,imin] = min(ZZ); + XXmin = XX(imin); + + + + + pointer(4) = plot(XXmin,ZZmin,'or'); + leg_txt{4} = ['Candidate: x=' num2str(XXmin,3) ]; + legend(pointer,leg_txt,'location','northwest'); legend('boxoff'); + axis([xmin xmax zmin zmax]); + drawnow + if WRITE + export_fig(['SurrogateBasedOptim_A' sprintf('%02d',k) '.pdf'],'-pdf'); k=k+1; + end + + Xnew = XXmin; + Znew = f(Xnew); + pointer(5) = plot(Xnew,Znew,'ob'); + leg_txt{5} = ['True value of candidate: f(' num2str(XXmin,3) ') = ' num2str(Znew,3)]; + legend(pointer,leg_txt,'location','northwest'); legend('boxoff'); + axis([xmin xmax zmin zmax]); + drawnow + if WRITE + export_fig(['SurrogateBasedOptim_A' sprintf('%02d',k) '.pdf'],'-pdf'); k=k+1; + end + + delete(pointer(3:5)); + pointer(3:5) = []; + leg_txt(3:5) = []; + plot(Xnew,Znew,'ko'); + sgtelib_server_newdata(Xnew,Znew); + +end + +sgtelib_server_stop; diff --git a/ext/sgtelib/example/sgtelib_example_SurrogateBasedOptim_EI.m b/ext/sgtelib/example/sgtelib_example_SurrogateBasedOptim_EI.m new file mode 100644 index 0000000000000000000000000000000000000000..72b4e581ce449bdc940b59f80188b0f7df2aba54 --- /dev/null +++ b/ext/sgtelib/example/sgtelib_example_SurrogateBasedOptim_EI.m @@ -0,0 +1,140 @@ +close all +clear all +clc +disp('=========== EXPLORER ============='); + +addpath('../Matlab_Server'); + +WRITE = false; + +! make -j 4 +model = 'TYPE KRIGING' + + +sgtelib_server_start(model); + + +disp('=========== START ============='); +sgtelib_server_ping; + + +f = @(x) sin(8*x) + 1.5*x + x.^2 ; +xmin = -2; +xmax = +1.5; +zmin = -3; +zmax = +5; + +X = [ -2 ; -1.4 ; -0.6 ; 0.8; 1.5 ]; +Z = f(X); +Zmin = min(Z); + +XX = linspace(xmin,xmax,1000)'; + +ZZtrue = f(XX); + + + +figure('color','w'); hold on; +pointer = []; +leg_txt = cell(0); +k = 0; + +pointer(1) = plot(XX,ZZtrue,'--b'); +leg_txt{1} = 'True function f(x) (unknown)'; +legend(pointer,leg_txt,'location','northwest'); legend('boxoff'); +axis([xmin xmax zmin zmax]); +xlabel('x') +drawnow +if WRITE + export_fig(['SurrogateBasedOptim_B' sprintf('%02d',k) '.pdf'],'-pdf'); k=k+1; +end + + +pointer(2) = plot(X,Z,'ok'); +leg_txt{2} = 'Observations'; +legend(pointer,leg_txt,'location','northwest'); legend('boxoff'); +axis([xmin xmax zmin zmax]); +drawnow +if WRITE + export_fig(['SurrogateBasedOptim_B' sprintf('%02d',k) '.pdf'],'-pdf'); k=k+1; +end +set(legend,'box','off') + + +sgtelib_server_newdata(X,Z); + + +for ii=1:50 + +[ZZ,std,ei,cdf] = sgtelib_server_predict(XX); +pointer(3) = plot(XX,ZZ,'r'); +if ii==1 + leg_txt{3} = 'Surrogate model'; +else + leg_txt{3} = 'Updated surrogate model'; +end + +std = std/max(std); +pointer_sup(1) = plot(XX,ZZ+std,'--r'); +pointer_sup(2) = plot(XX,ZZ-std,'--r'); +drawnow + +u = (Zmin-ZZ)./std; +ei = std.*( u.*normcdf(u)+normpdf(u) ); +if max(ei)>0 + ei = ei/max(ei); +end + + +pointer(4) = plot(XX,ei,'k'); +leg_txt{4} = 'Expected Improvement'; + +legend(pointer,leg_txt,'location','northwest'); legend('boxoff'); +axis([xmin xmax zmin zmax]); +drawnow +if WRITE + export_fig(['SurrogateBasedOptim_B' sprintf('%02d',k) '.pdf'],'-pdf'); k=k+1; +end + +pause(0.3) + +if min(ei)==max(ei) + break; +end +[eimin,imin] = max(ei); +XXmin = XX(imin); +drawnow + +pointer(5) = plot(XXmin,eimin,'ok'); +leg_txt{5} = ['Candidate: x=' num2str(XXmin,3) ]; +legend(pointer,leg_txt,'location','northwest'); legend('boxoff'); +axis([xmin xmax zmin zmax]); +drawnow +if WRITE + export_fig(['SurrogateBasedOptim_B' sprintf('%02d',k) '.pdf'],'-pdf'); k=k+1; +end + + +Xnew = XXmin; +Znew = f(Xnew); +Zmin = min(Zmin,Znew); +pointer(6) = plot(Xnew,Znew,'ob'); +leg_txt{6} = ['True value of candidate: f(' num2str(XXmin,3) ') = ' num2str(Znew,3)]; +legend(pointer,leg_txt,'location','northwest'); legend('boxoff'); +axis([xmin xmax zmin zmax]); +drawnow +if WRITE + export_fig(['SurrogateBasedOptim_B' sprintf('%02d',k) '.pdf'],'-pdf'); k=k+1; +end + +delete(pointer(3:6)); +delete(pointer_sup); +pointer(3:6) = []; +leg_txt(3:6) = []; +plot(Xnew,Znew,'ko'); +sgtelib_server_newdata(Xnew,Znew); +drawnow +pause(0.3); +end + +sgtelib_server_stop; diff --git a/ext/sgtelib/example/sgtelib_example_plot1D.m b/ext/sgtelib/example/sgtelib_example_plot1D.m new file mode 100644 index 0000000000000000000000000000000000000000..fd752ab07e121a99c9327c731107c72a0744850f --- /dev/null +++ b/ext/sgtelib/example/sgtelib_example_plot1D.m @@ -0,0 +1,65 @@ +close all +clear all +clc + +model = 'TYPE ENSEMBLE WEIGHT OPTIM METRIC OECV'; +sgtelib_server_start(model,true) +sgtelib_server_ping; + + +P = 100; +X = sort(randn(P,1)); + + +Z(:,1) = X.^2-X-3; +Z(:,2) = sign(X).*cos(X) + 0.1*randn(size(X)); +Z(:,3) = mod(round(X),2)-0.5; +M = size(Z,2); +sgtelib_server_newdata(X,Z); + + + +PP = 1000; +XX = sort([linspace(min(X)-1,max(X)+1,PP)' ; X]); + + + +figure; +hold on; +for i=1:M + plot(X,Z(:,i),'o','color',get_color(i,M)); +end + + + +[ZZ,std,ei,cdf] = sgtelib_server_predict(XX); +disp('metrics...') +sgtelib_server_metric('RMSE') +sgtelib_server_metric('RMSECV') +sgtelib_server_metric('OECV') + +for i=1:M + plot(XX,ZZ(:,i),'-','color',get_color(i,M),'linewidth',2); + plot(XX,ZZ(:,i)+std(:,i),'--','color',get_color(i,M)); + plot(XX,ZZ(:,i)-std(:,i),'--','color',get_color(i,M)); +end + +% plot(xlim,[0 0],'--k'); +% disp('Get CV values'); +% [Zh,Sh,Zv,Sv] = sgtelib_server_cv; +% for i=1:M +% plot(X,Zv(:,i),'o','color',get_color(i,M)); +% for j=1:P +% plot(X(j)*[1 1],Zv(j,i)+Sv(j,i)*[-1 +1],'-','color',get_color(i,M)); +% end +% end + + +% disp('Plot EFI'); +% figure; +% efi = ei(:,1).*prod(cdf(:,2:end),2); +% efi = max(1e-16,efi); +% plot(XX,efi,'g'); +% set(gca,'yscale','log') + + diff --git a/ext/sgtelib/example/sgtelib_example_plot2D_cat.m b/ext/sgtelib/example/sgtelib_example_plot2D_cat.m new file mode 100644 index 0000000000000000000000000000000000000000..708f98282442e660b2b5543eb0ea43935c824fca --- /dev/null +++ b/ext/sgtelib/example/sgtelib_example_plot2D_cat.m @@ -0,0 +1,55 @@ +close all +%clear all +clc +disp('=========== EXPLORER ============='); + + +model = 'TYPE ENSEMBLE WEIGHT SELECT METRIC OECV DISTANCE OPTIM' + +model = 'TYPE KS DISTANCE OPTIM' +model = 'TYPE ENSEMBLE WEIGHT SELECT METRIC OECV DISTANCE OPTIM' + +%model = 'TYPE PRS_CAT DEGREE 3' +%model = 'TYPE RBF DISTANCE OPTIM' + +model = 'TYPE LOWESS DISTANCE OPTIM' + + +f = @(x) x(:,2).^2 .* x(:,1) .* ( 2*mod(x(:,1),2)-1 ) + +% f = @(x) 40*(x(:,1)==0)+... +% 35*(x(:,2)==0)+... +% 35*cos(x(:,1)/4)+... +% 30*sin(x(:,2)/9); + +% Data points +x1max = 5; +x2max = 100; + +p = 50; +X = [round(rand(p,1)*x1max) round(rand(p,1)*x2max) ]; +X = unique(X,'rows'); +Z = f(X); + + +sgtelib_server_start(model,true) +sgtelib_server_ping; +sgtelib_server_newdata(X,Z); + +% Prediction +[x1,x2] = meshgrid( (0:x1max) , (0:x2max) ); +XX = [x1(:) x2(:)]; +[ZZ,std,ei,cdf] = sgtelib_server_predict(XX); +ZZ = reshape(ZZ,x2max+1,x1max+1); + + +figure('color','w'); hold on; +surf(x1,x2,ZZ,'facealpha',0.5); +plot3(X(:,1),X(:,2),Z,'ko','linewidth',3,'markersize',5); +dv = max(Z)-min(Z); +zlim([min(Z)-dv/3,max(Z)+dv/3]); +set(gca,'view',[116 50]); +xlabel('x1'); +ylabel('x2'); + +sgtelib_server_stop; diff --git a/ext/sgtelib/example/sgtelib_example_plot2D_compare.m b/ext/sgtelib/example/sgtelib_example_plot2D_compare.m new file mode 100644 index 0000000000000000000000000000000000000000..5ff95309992ce1031d33f45aacf044a35b4f18bf --- /dev/null +++ b/ext/sgtelib/example/sgtelib_example_plot2D_compare.m @@ -0,0 +1,100 @@ +close all +clear all +clc +disp('=========== EXPLORER ============='); + +! make -j 4 +model = 'TYPE LOWESS DISTANCE OPTIM KERNEL_SHAPE OPTIM KERNEL_TYPE OPTIM RIDGE OPTIM METRIC OECV' + +model = 'TYPE KRIGING DISTANCE NORM2_IS0 METRIC OECV' + +% creation of model +sgtelib_server_start(model,true) +sgtelib_server_ping; + + + +% Test function +%f = @(x) cos(sqrt(0.5*x(:,1))).*cos(0.1*x(:,2)); + +f = @(x) 40*(x(:,1)==0)+... + 35*(x(:,2)==0)+... + 35*cos(x(:,1)/4)+... + 30*sin(x(:,2)/9); + + +% Dimension +N = 2; +% Number of sampling points along each dimension +PP1 = 25; +PP2 = 20; +% Bounds along each dimension +x1min = 0; +x1max = +30; +x2min = 0; +x2max = +30; + +% Create data +scale_x1 = linspace(x1min,x1max,PP1) +scale_x2 = linspace(x2min,x2max,PP2) +[x1,x2] = meshgrid( scale_x1 , scale_x2 ); +XX = [x1(:) x2(:)]; +PP = (PP1)*(PP2); +ZZ = f(XX); + + +% Selection of some training points +P = 30; +i = randperm(PP); +i = i(1:P); +X = XX(i,:); +Z = ZZ(i,:); + + +% Sending data +sgtelib_server_newdata(X,Z); + +% Prediction +[ZZ,std,ei,cdf] = sgtelib_server_predict(XX); + + + +figure +subplot(2,2,1);hold on; +plot3(X(:,1),X(:,2),Z,'k.'); +surf(x1,x2,reshape(f(XX),PP2,PP1)); +set(gca,'view',[-37.5000 30.0000]); +set(gca,'ydir','normal') +xlabel('Real Z'); +xlim([min(scale_x1) max(scale_x1)]); +ylim([min(scale_x2) max(scale_x2)]); +%zlim([-2 +2]); + + +subplot(2,2,2);hold on; +plot3(X(:,1),X(:,2),Z,'k.'); +surf(x1,x2,reshape(ZZ,PP2,PP1)); +set(gca,'view',[-37.5000 30.0000]); +xlabel('Zh'); +xlim([min(scale_x1) max(scale_x1)]); +ylim([min(scale_x2) max(scale_x2)]); +%zlim([-2 +2]); + +subplot(2,2,3);hold on; +imagesc(scale_x1,scale_x2,reshape(f(XX),PP2,PP1)); +set(gca,'ydir','normal'); +plot(X(:,1),X(:,2),'k.'); +axis([min(scale_x1) max(scale_x1) min(scale_x2) max(scale_x2)]) + +subplot(2,2,4);hold on; +imagesc(scale_x1,scale_x2,reshape(ZZ,PP2,PP1)); +set(gca,'ydir','normal'); +plot(X(:,1),X(:,2),'k.'); +axis([min(scale_x1) max(scale_x1) min(scale_x2) max(scale_x2)]) + + + +disp('metric:') +sgtelib_server_metric('AOECV') + +sgtelib_server_stop; diff --git a/ext/sgtelib/example/sgtelib_example_plot2D_edge.m b/ext/sgtelib/example/sgtelib_example_plot2D_edge.m new file mode 100644 index 0000000000000000000000000000000000000000..4171c0967b46ad4c4a142d6bf7158156dc825f70 --- /dev/null +++ b/ext/sgtelib/example/sgtelib_example_plot2D_edge.m @@ -0,0 +1,63 @@ +close all +clear all +clc +disp('=========== EXPLORER ============='); + +! make -j 4 + +%model = 'TYPE PRS' + +model = 'TYPE ENSEMBLE DISTANCE OPTIM WEIGHT SELECT ' + +model = 'TYPE KRIGING DISTANCE OPTIM METRIC OECV' + + +%model = 'TYPE ENSEMBLE WEIGHT SELECT METRIC OECV DISTANCE OPTIM PRESET SUPER1' +%model = 'TYPE LOWESS KERNEL_TYPE OPTIM DISTANCE OPTIM' +%model = 'TYPE KS DISTANCE IS0' +%model = 'TYPE ENSEMBLE WEIGHT SELECT METRIC OECV DISTANCE IS0 PRESET SUPER1' + + +f = @(x) 40*(x(:,1)==0)+... + 35*(x(:,2)==0)+... + 35*cos(x(:,1)/4)+... + 30*sin(x(:,2)/9); + + +% Data points +x1max = 30; +x2max = 35; + + +p1 = 5; +p2 = 12; +p = 10; +X = [ + zeros(p1,1) round(rand(p1,1)*x2max) ;... + round(rand(p2,1 )*x1max) zeros(p2,1) ;... + round(rand(p,1)*x1max) round(rand(p,1)*x2max) ]; +X = unique(X,'rows'); +Z = f(X); + + +sgtelib_server_start(model,true) +sgtelib_server_ping; +sgtelib_server_newdata(X,Z); + +% Prediction +[x1,x2] = meshgrid( (0:x1max) , (0:x2max) ); +XX = [x1(:) x2(:)]; +[ZZ,std,ei,cdf] = sgtelib_server_predict(XX); +ZZ = reshape(ZZ,x2max+1,x1max+1); + + +figure('color','w'); hold on; +surf(x1,x2,ZZ,'facealpha',0.5); +plot3(X(:,1),X(:,2),Z,'ko','linewidth',3,'markersize',5); +dv = max(Z)-min(Z); +zlim([min(Z)-dv/3,max(Z)+dv/3]); +set(gca,'view',[116 50]); +xlabel('x1'); +ylabel('x2'); + +sgtelib_server_stop; diff --git a/ext/sgtelib/example/sgtelib_example_plot2D_single.m b/ext/sgtelib/example/sgtelib_example_plot2D_single.m new file mode 100644 index 0000000000000000000000000000000000000000..92ffd5c9951cac67ecbd490ae84e2c0bc30920bc --- /dev/null +++ b/ext/sgtelib/example/sgtelib_example_plot2D_single.m @@ -0,0 +1,42 @@ +close all +clear all +clc +disp('=========== EXPLORER ============='); + +! make -j 4 + +model = 'TYPE ENSEMBLE PRESET SUPER1 WEIGHT SELECT METRIC RMSE ' + +f = @(x) cos(sqrt(4*x(:,1))).*cos(3*x(:,2))+(x(:,1)>0.5)+(x(:,2)>0.5); + + + +% Number of data points +P = 50; +% Data points +X = rand(P,2); +Z = f(X); + +% Create model +PP = 50; +[x1,x2] = meshgrid( linspace(0,1,PP) , linspace(0,1,PP) ); +XX = [x1(:) x2(:)]; + + +sgtelib_server_start(model,true) +sgtelib_server_ping; +sgtelib_server_newdata(X,Z); +[ZZ,std,ei,cdf] = sgtelib_server_predict(XX); + + + +figure('color','w'); hold on; +surf(x1,x2,reshape(ZZ,PP,PP)); +plot3(X(:,1),X(:,2),Z,'ko','linewidth',3,'markersize',5); + + +set(gca,'view',[-36 66]); + + + +sgtelib_server_stop; diff --git a/ext/sgtelib/example/sgtelib_example_plotND.m b/ext/sgtelib/example/sgtelib_example_plotND.m new file mode 100644 index 0000000000000000000000000000000000000000..8b8b29dde56b59d76d6df4e9f2a20013886078de --- /dev/null +++ b/ext/sgtelib/example/sgtelib_example_plotND.m @@ -0,0 +1,47 @@ +close all +clear all +clc +disp('=========== EXPLORER ============='); + +%rand('twister',3) + +! make -j 4 +model = 'TYPE PRS DEGREE 2 RIDGE 0.01' +%model = 'TYPE RBF DISTANCE_TYPE NORM2_IS0 KERNEL_COEF 2 KERNEL_TYPE D2' +%model = 'TYPE KS DISTANCE_TYPE NORM2_IS0 KERNEL_COEF 10 KERNEL_TYPE D2' +%model = 'TYPE ENSEMBLE WEIGHT SELECT METRIC RMSECV' +model = 'TYPE ENSEMBLE WEIGHT SELECT METRIC OECV' +% model = 'TYPE KS' +% model = 'TYPE LOWESS' + + +%f = @(x) sum(x.^2,2); + +N = 10; +P = 100; + + +M = 1; +X = randn(P,N); +Z = randn(P,M); + +toBeDelData; +M = size(Z,2); + +PP = 100; + +dx = 0.1; +XX = zeros(PP,N); +for i=2:PP + r = randn(1,N); + r = dx*r/norm(r); + XX(i,:) = XX(i-1,:)+r; +end + + +sgtelib_server_start(model,true) +sgtelib_server_ping; + +sgtelib_server_newdata(X,Z); +[ZZmodel,std,ei,cdf] = sgtelib_server_predict(XX); +m = sgtelib_server_metric('RMSECV') diff --git a/ext/sgtelib/matlab_server/sgtelib_server_cv.m b/ext/sgtelib/matlab_server/sgtelib_server_cv.m new file mode 100644 index 0000000000000000000000000000000000000000..e80778b4cb7abf865766190d07c945d91e0bb0c9 --- /dev/null +++ b/ext/sgtelib/matlab_server/sgtelib_server_cv.m @@ -0,0 +1,19 @@ +function [Zh,Sh,Zv,Sv] = sgtelib_server_cv + +% sgtelib_server_ping; + +% Remove flags +system('rm -f flag_cv_* 2>/dev/null'); + +% Create flag +system('touch flag_cv_transmit'); + +% Wait for reception flag +sgtelib_server_wait_file('flag_cv_finished'); + +% Read Output file +[Zh,Sh,Zv,Sv] = sgtelib_server_read_matrix('flag_cv_finished'); + +% Remove all flags +system('rm -f flag_cv_* 2>/dev/null'); + diff --git a/ext/sgtelib/matlab_server/sgtelib_server_example.m b/ext/sgtelib/matlab_server/sgtelib_server_example.m new file mode 100644 index 0000000000000000000000000000000000000000..b4633d11fd43e26d59a707ba846656c26d05a127 --- /dev/null +++ b/ext/sgtelib/matlab_server/sgtelib_server_example.m @@ -0,0 +1,35 @@ +close all +clear all + +% Start server +model = 'TYPE PRS DEGREE 2'; +model = 'TYPE ENSEMBLE METRIC LINV WEIGHTS OPTIM' +sgtelib_server_start('TYPE PRS DEGREE 2',true) + +% Test if server is ok and ready +sgtelib_server_ping; + +% Build data points +N = 2; +M = 1; +P = 100; +X = rand(P,N); +Z = rand(P,M); + +% Feed server +sgtelib_server_newdata(X,Z); + +% Prediction points +PXX = 1000; +XX = rand(PXX,N); + +%Prediction +[ZZ,std,ei,cdf] = sgtelib_server_predict(XX); + +% Plot +figure; hold on; +plot3(X(:,1),X(:,2),Z,'*k'); +plot3(XX(:,1),XX(:,2),ZZ,'or') + +% Stop server +sgtelib_server_stop; \ No newline at end of file diff --git a/ext/sgtelib/matlab_server/sgtelib_server_info.m b/ext/sgtelib/matlab_server/sgtelib_server_info.m new file mode 100644 index 0000000000000000000000000000000000000000..322265e7f0eee40deb622f086b3831a77728c301 --- /dev/null +++ b/ext/sgtelib/matlab_server/sgtelib_server_info.m @@ -0,0 +1,12 @@ +function M = sgtelib_server_info + +% sgtelib_server_ping; + +% Remove flags +system('rm -f flag_info_* 2>/dev/null'); + +% Write infoion point +system('touch flag_info_transmit'); + +% Wait for reception flag +sgtelib_server_wait_file('flag_info_finished'); diff --git a/ext/sgtelib/matlab_server/sgtelib_server_metric.m b/ext/sgtelib/matlab_server/sgtelib_server_metric.m new file mode 100644 index 0000000000000000000000000000000000000000..a418a2808a760a19155280e685776c467a0a343f --- /dev/null +++ b/ext/sgtelib/matlab_server/sgtelib_server_metric.m @@ -0,0 +1,21 @@ +function M = sgtelib_server_metric(metric_str) + +% sgtelib_server_ping; + +% Remove flags +system('rm -f flag_metric_* 2>/dev/null'); + +% Write metricion point +system(['echo ' metric_str ' >> flag_metric_create']); + +% Create flag +system('mv flag_metric_create flag_metric_transmit'); + +% Wait for reception flag +sgtelib_server_wait_file('flag_metric_finished'); + +% Read Output file +M = importdata('flag_metric_finished'); + +% Remove all flags +system('rm -f flag_metric_* 2>/dev/null'); diff --git a/ext/sgtelib/matlab_server/sgtelib_server_newdata.m b/ext/sgtelib/matlab_server/sgtelib_server_newdata.m new file mode 100644 index 0000000000000000000000000000000000000000..c8d9b259ada25e0488c1760c49b21ae4120f5a6f --- /dev/null +++ b/ext/sgtelib/matlab_server/sgtelib_server_newdata.m @@ -0,0 +1,20 @@ +function sgtelib_server_newdata(X,Z) + +% sgtelib_server_ping; + +% Remove all flags +system('rm -f flag_new_data_* 2>/dev/null'); + +% Write matrices +sgtelib_server_write_matrix(X,'X','new_data_x.txt'); + +sgtelib_server_write_matrix(Z,'Z','new_data_z.txt'); + +% Create flag +system('touch flag_new_data_transmit'); + +% Wait for reception flag +sgtelib_server_wait_file('flag_new_data_received'); + +% Remove all flags +system('rm -f flag_new_data_* 2>/dev/null'); diff --git a/ext/sgtelib/matlab_server/sgtelib_server_ping.m b/ext/sgtelib/matlab_server/sgtelib_server_ping.m new file mode 100644 index 0000000000000000000000000000000000000000..dd7d433608cabd208d93dfabc123e5e7235eb31b --- /dev/null +++ b/ext/sgtelib/matlab_server/sgtelib_server_ping.m @@ -0,0 +1,24 @@ +function ready = sgtelib_server_ping + +system('touch flag_ping'); + +% Wait for reception flag + +i = sgtelib_server_wait_file('flag_pong',0.1); +if i==0 + disp('Retry ping...'); + system('touch flag_ping'); + i = sgtelib_server_wait_file('flag_pong',0.5); +end + +if i + ready = importdata('flag_pong'); + system('rm -f flag_pong'); + %disp('ping ok!'); +else + disp('=====================SGTELIB_SERVER ERROR=========================='); + disp('sgtelib_server not responding'); + error('We tried to "ping" sgtelib (server), but it is off or not responding'); +end + + diff --git a/ext/sgtelib/matlab_server/sgtelib_server_predict.m b/ext/sgtelib/matlab_server/sgtelib_server_predict.m new file mode 100644 index 0000000000000000000000000000000000000000..ab3999f86a7e594e9be748839fbfbbfc60a2772f --- /dev/null +++ b/ext/sgtelib/matlab_server/sgtelib_server_predict.m @@ -0,0 +1,22 @@ +function [Z,std,ei,cdf] = sgtelib_server_predict(X) + +% sgtelib_server_ping; + +% Remove flags +system('rm -f flag_predict_* 2>/dev/null'); + +% Write prediction point +sgtelib_server_write_matrix(X,'X','flag_predict_create'); + +% Create flag +system('mv flag_predict_create flag_predict_transmit'); + +% Wait for reception flag +sgtelib_server_wait_file('flag_predict_finished'); + +% Read Output file +[Z,std,ei,cdf] = sgtelib_server_read_matrix('flag_predict_finished'); + +% Remove all flags +system('rm -f flag_predict_* 2>/dev/null'); + diff --git a/ext/sgtelib/matlab_server/sgtelib_server_read_matrix.m b/ext/sgtelib/matlab_server/sgtelib_server_read_matrix.m new file mode 100644 index 0000000000000000000000000000000000000000..30179350263fad8a45a69835ee8818a5fc5370c1 --- /dev/null +++ b/ext/sgtelib/matlab_server/sgtelib_server_read_matrix.m @@ -0,0 +1,43 @@ +function [varargout] = sgtelib_server_read_matrix(file) + + +% Get matrices names from the file +NAMES = cell(0,0); +fid = fopen(file); +line = fgetl(fid); +while ischar(line) + if ~isempty(line) + if any(line=='=') + i = find(line=='='); + line = line(1:i-1); + line=strrep(line,' ',''); + NAMES{end+1} = line; + end + end + line = fgetl(fid); +end + +N = length(NAMES); + +% Check that the number of output is smaller than the number +% of matrices in the file +if N<nargout + disp(['File name: ' file]); + disp(['Nb of matrices in the file: ' num2str(N)]); + disp(['Nb of matrices required in output: ' num2str(nargout)]); + error('The file does not contain enough matrices'); +end + +% Convert the file in .m file and evaluate it. +mfile = ['matlab_' file num2str(rand,12)]; +mfile = strrep(mfile,'.',''); +mfile = strrep(mfile,'-',''); +copyfile(file,[mfile '.m']); +eval(mfile); +delete([mfile '.m']); + +% Affect the matrices in varargout +for i=1:N + varargout{i} = eval(NAMES{i}); +end + diff --git a/ext/sgtelib/matlab_server/sgtelib_server_ready.m b/ext/sgtelib/matlab_server/sgtelib_server_ready.m new file mode 100644 index 0000000000000000000000000000000000000000..06a595c8db2b6fe1c78c950aad052b406e76b5f9 --- /dev/null +++ b/ext/sgtelib/matlab_server/sgtelib_server_ready.m @@ -0,0 +1,3 @@ +function ready = sgtelib_server_ready + +ready = sgtelib_server_ping; diff --git a/ext/sgtelib/matlab_server/sgtelib_server_reset.m b/ext/sgtelib/matlab_server/sgtelib_server_reset.m new file mode 100644 index 0000000000000000000000000000000000000000..eb425b53c026cc5601ebb68e8b34bfa8b6752d85 --- /dev/null +++ b/ext/sgtelib/matlab_server/sgtelib_server_reset.m @@ -0,0 +1,16 @@ +function sgtelib_server_reset + +% sgtelib_server_ping; + +% Remove flags +system('rm -f flag_reset_* 2>/dev/null'); + +% Create flag +system(['touch flag_reset_transmit']); + +% Wait for reception flag +sgtelib_server_wait_file('flag_reset_finished'); + +% Remove all flags +system('rm -f flag_reset_* 2>/dev/null'); + diff --git a/ext/sgtelib/matlab_server/sgtelib_server_start.m b/ext/sgtelib/matlab_server/sgtelib_server_start.m new file mode 100644 index 0000000000000000000000000000000000000000..07d748f48f2ec797dc84f22ef46d28444de778b5 --- /dev/null +++ b/ext/sgtelib/matlab_server/sgtelib_server_start.m @@ -0,0 +1,89 @@ +function sgtelib_server_start(model,keepopen) + +sgtelib_server_stop; +if nargin==1 + keepopen=false; +end + +disp('Start sgtelib.exe in server mode.'); + + +% Selection of the terminal software +TERMINAL_SOFTWARE_LIST = { 'gnome-terminal' 'lxterm' 'uxterm' 'xterm' 'konsole'}; +for i=1:length(TERMINAL_SOFTWARE_LIST) + termprog = TERMINAL_SOFTWARE_LIST{i}; + if ~system(['which ' termprog]); + break; + else + disp(['Could not find terminal software: ' termprog]); + termprog = 'bg'; + end +end + +termprog = 'bg' + +disp(['Selected terminal software: ' termprog]); + + +% Option to start sgtelib in gdb +gdboption = ' '; +% Verbose option of sgtelib. +verboseoption = ' '; +% Option of keep open +if keepopen + if ~system('which gdb') + gdboption = ' gdb -q -ex run --args '; + end + verboseoption = ' -verbose '; +end +% command to start sgtelib. +sgtelibcmd = [' ./sgtelib.exe -server -model ' model verboseoption]; + + +% Reset ld_library_path +old_ld_library_path = getenv('LD_LIBRARY_PATH'); +setenv('LD_LIBRARY_PATH','.'); + +switch termprog + case 'gnome-terminal' + termoption = ' -t sgtelib_server --hide-menubar -e '; + % Command to run after the end of sgtelib + if keepopen + endoption = ' ; exec /bin/bash -i '; + else + endoption = ' '; + end + command = [termprog termoption '"/bin/bash -c '' ' gdboption sgtelibcmd endoption '''" &']; + case {'xterm','lxterm','uxterm'} + if keepopen + termoption = ' -hold -e '; + else + termoption = ' -e '; + end + command = [termprog termoption gdboption sgtelibcmd ' &']; + case 'konsole' + if keepopen + termoption = ' --hold -e '; + else + termoption = ' -e '; + end + command = [termprog termoption gdboption sgtelibcmd ' &']; + case 'bg' + command = [sgtelibcmd ' &']; +end + +disp(command) +[status,response] = system(command); +if keepopen + pause(1); +end +if status || ~isempty(response) + disp(command); + disp(status) + disp(response) +end +pause(1); + +% Old LD_LIBRARY_PATH +setenv('LD_LIBRARY_PATH',old_ld_library_path); + diff --git a/ext/sgtelib/matlab_server/sgtelib_server_stop.m b/ext/sgtelib/matlab_server/sgtelib_server_stop.m new file mode 100644 index 0000000000000000000000000000000000000000..2bb574c2870af49d590dc15285d424deea16fdb8 --- /dev/null +++ b/ext/sgtelib/matlab_server/sgtelib_server_stop.m @@ -0,0 +1,4 @@ +function sgtelib_server_stop +disp('Kill sgtelib.exe'); +!touch flag_quit +%!killName sgtelib.exe diff --git a/ext/sgtelib/matlab_server/sgtelib_server_wait_file.m b/ext/sgtelib/matlab_server/sgtelib_server_wait_file.m new file mode 100644 index 0000000000000000000000000000000000000000..053a9cec71fa107a6c5d89d5011a613bcd7fc3c1 --- /dev/null +++ b/ext/sgtelib/matlab_server/sgtelib_server_wait_file.m @@ -0,0 +1,30 @@ +function i = sgtelib_server_wait_file(name,wait_tmax) + +if ~iscell(name) + name = {name}; +end + +if nargin==1 + wait_tmax = 1000; +end +wait_dt = 0.001; +wait_t = 0; + +while wait_t < wait_tmax + pause(wait_dt); + wait_t = wait_t+wait_dt; + + % Check if there is a new input file + for i=1:length(name) + if exist(name{i},'file') + return; + end + end +end + +i = 0; +if length(name)==1 + disp(['sgtelib_server_wait_file: file "' name{1} '" not found within time limit']); +else + disp(['sgtelib_server_wait_file: file not found within time limit']); +end diff --git a/ext/sgtelib/matlab_server/sgtelib_server_write_matrix.m b/ext/sgtelib/matlab_server/sgtelib_server_write_matrix.m new file mode 100644 index 0000000000000000000000000000000000000000..40876e8ec71ce4cce4ec2bc770c7648fdaeebcb6 --- /dev/null +++ b/ext/sgtelib/matlab_server/sgtelib_server_write_matrix.m @@ -0,0 +1,26 @@ +function sgtelib_server_write_matrix(M,name,file) + +% fid = fopen(file,'w'); +% +% newline = char(10); +% fwrite(fid,[name '=[' newline]); +% +% for i=1:size(M,1) +% Mi = num2str(M(i,:),12); +% s = [' ' Mi ' ; ' newline]; +% fwrite(fid,s); +% end +% fwrite(fid,'];'); +% fclose(fid); + + +fid = fopen(file,'w'); +fprintf(fid,'%s=[\n',name); + +for i=1:size(M,1) + fprintf(fid,'%12.12f ',M(i,:)); + fprintf(fid,';\n'); +end + +fwrite(fid,'];'); +fclose(fid); \ No newline at end of file diff --git a/ext/sgtelib/src/Defines.hpp b/ext/sgtelib/src/Defines.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f35301c8aa9fab9a6382dff789060ec89ee2b895 --- /dev/null +++ b/ext/sgtelib/src/Defines.hpp @@ -0,0 +1,98 @@ +/*-------------------------------------------------------------------------------------*/ +/* sgtelib - A surrogate model library for derivative-free optimization */ +/* Version 2.0.1 */ +/* */ +/* Copyright (C) 2012-2017 Sebastien Le Digabel - Ecole Polytechnique, Montreal */ +/* Bastien Talgorn - McGill University, Montreal */ +/* */ +/* Author: Bastien Talgorn */ +/* email: bastientalgorn@fastmail.com */ +/* */ +/* This program is free software: you can redistribute it and/or modify it under the */ +/* terms of the GNU Lesser General Public License as published by the Free Software */ +/* Foundation, either version 3 of the License, or (at your option) any later */ +/* version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ +/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ +/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License along */ +/* with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on sgtelib at https://github.com/bastientalgorn/sgtelib */ +/*-------------------------------------------------------------------------------------*/ + +#ifndef __SGTELIB_DEFINES__ +#define __SGTELIB_DEFINES__ + +#include <iostream> +#include <iomanip> +#include <cmath> +#include <sstream> +#include <string.h> + +#include <limits> +#include <limits.h> + +// debug flag: +//#define SGTELIB_DEBUG +//#define ENSEMBLE_DEBUG + +namespace SGTELIB { + + const double EPSILON = 1E-13; + const double PI = 3.141592654; + const double INF = std::numeric_limits<double>::max(); ///< Infinity + const double NaN = std::numeric_limits<double>::quiet_NaN(); + + const bool APPROX_CDF = true; + // If true, then the lower bound of standard deviation is EPSILON. + // This allows to avoid flat EI and P functions. + + enum scaling_t { + SCALING_NONE , + SCALING_MEANSTD , + SCALING_BOUNDS + }; + + const scaling_t scaling_method = SCALING_MEANSTD; + //const scaling_t scaling_method = SCALING_NONE; + + + // model output type: + enum model_output_t { + NORMAL_OUTPUT , + FIXED_OUTPUT , + BINARY_OUTPUT + }; + + // model output type: + enum bbo_t { + BBO_OBJ , // Objective + BBO_CON , // Constraint + BBO_DUM // Dummy + }; + + enum param_domain_t { + PARAM_DOMAIN_CONTINUOUS, + PARAM_DOMAIN_INTEGER, + PARAM_DOMAIN_BOOL, + PARAM_DOMAIN_CAT, + PARAM_DOMAIN_MISC + }; + + // FIXED => Parameter is set once and for all + // OPTIM => Parameter is optimized so as to minimize a metric + // MODEL_DEFINED => The surrogate model is able to define/chose the parameter + enum param_status_t { + STATUS_FIXED, + STATUS_OPTIM, + STATUS_MODEL_DEFINED + }; + + + +} + +#endif diff --git a/ext/sgtelib/src/Exception.hpp b/ext/sgtelib/src/Exception.hpp new file mode 100644 index 0000000000000000000000000000000000000000..c3a64c034c9fb3b04080587ed2c939d588bfa120 --- /dev/null +++ b/ext/sgtelib/src/Exception.hpp @@ -0,0 +1,65 @@ +/*-------------------------------------------------------------------------------------*/ +/* sgtelib - A surrogate model library for derivative-free optimization */ +/* Version 2.0.1 */ +/* */ +/* Copyright (C) 2012-2017 Sebastien Le Digabel - Ecole Polytechnique, Montreal */ +/* Bastien Talgorn - McGill University, Montreal */ +/* */ +/* Author: Bastien Talgorn */ +/* email: bastientalgorn@fastmail.com */ +/* */ +/* This program is free software: you can redistribute it and/or modify it under the */ +/* terms of the GNU Lesser General Public License as published by the Free Software */ +/* Foundation, either version 3 of the License, or (at your option) any later */ +/* version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ +/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ +/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License along */ +/* with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on sgtelib at https://github.com/bastientalgorn/sgtelib */ +/*-------------------------------------------------------------------------------------*/ + +#ifndef __SGTELIB_EXCEPTION__ +#define __SGTELIB_EXCEPTION__ + +#include <iostream> +#include <sstream> +#include <cstdlib> + +namespace SGTELIB { + + class Exception : public std::exception { + + private: + + std::string _file; + int _line; + std::string _err_msg; + + mutable std::string _tmp; + + public: + + virtual const char * what ( void ) const throw() { + std::ostringstream oss; + oss << _file << ":" << _line << " (" << _err_msg << ")"; + _tmp = oss.str(); + return _tmp.c_str(); + } + + Exception ( const std::string & file , + int line , + const std::string & err_msg ) + : _file(file) , _line(line) , _err_msg(err_msg) {} + + virtual ~Exception ( void ) throw() {} + }; +} + +// usage: throw SGTELIB::Exception ( "file.cpp" , __LINE__ , "error message" ); + +#endif diff --git a/ext/sgtelib/src/Kernel.cpp b/ext/sgtelib/src/Kernel.cpp new file mode 100644 index 0000000000000000000000000000000000000000..dc6665e4e8b677ece82d9ba88058cd187df941a8 --- /dev/null +++ b/ext/sgtelib/src/Kernel.cpp @@ -0,0 +1,322 @@ +/*-------------------------------------------------------------------------------------*/ +/* sgtelib - A surrogate model library for derivative-free optimization */ +/* Version 2.0.1 */ +/* */ +/* Copyright (C) 2012-2017 Sebastien Le Digabel - Ecole Polytechnique, Montreal */ +/* Bastien Talgorn - McGill University, Montreal */ +/* */ +/* Author: Bastien Talgorn */ +/* email: bastientalgorn@fastmail.com */ +/* */ +/* This program is free software: you can redistribute it and/or modify it under the */ +/* terms of the GNU Lesser General Public License as published by the Free Software */ +/* Foundation, either version 3 of the License, or (at your option) any later */ +/* version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ +/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ +/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License along */ +/* with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on sgtelib at https://github.com/bastientalgorn/sgtelib */ +/*-------------------------------------------------------------------------------------*/ + +#include "Kernel.hpp" + + + + +/*----------------------------------------------------------*/ +std::string SGTELIB::kernel_type_to_str ( SGTELIB::kernel_t kt ) { +/*----------------------------------------------------------*/ + switch ( kt ) { + case SGTELIB::KERNEL_D1: return "D1"; //Gaussian + case SGTELIB::KERNEL_D2: return "D2"; //Inverse Quadratic + case SGTELIB::KERNEL_D3: return "D3"; //Inverse Multiquadratic + case SGTELIB::KERNEL_D4: return "D4"; //Bi-quadratic + case SGTELIB::KERNEL_D5: return "D5"; //Tri-Cubique + case SGTELIB::KERNEL_D6: return "D6"; //Exp(-sqrt) + case SGTELIB::KERNEL_D7: return "D7"; //Epanechnikov + case SGTELIB::KERNEL_I0: return "I0"; //Multiquadratic + case SGTELIB::KERNEL_I1: return "I1"; //Polyharmonic Spline, k=1 + case SGTELIB::KERNEL_I2: return "I2"; //Polyharmonic Spline, k=2 + case SGTELIB::KERNEL_I3: return "I3"; //Polyharmonic Spline, k=3 + case SGTELIB::KERNEL_I4: return "I4"; //Polyharmonic Spline, k=4 + default : + throw SGTELIB::Exception ( __FILE__ , __LINE__ , + "kernel_type_to_str: undefined kernel type" ); + return "undefined"; + } +} + + + + +/*----------------------------------------------------------*/ +bool SGTELIB::kernel_is_decreasing ( const SGTELIB::kernel_t kt ) { +/*----------------------------------------------------------*/ + // nb: "D" stands for decreasing, meaning that phi(r) tends toward 0 + // when r tends toward +infinity. + switch ( kt ) { + case SGTELIB::KERNEL_D1: + case SGTELIB::KERNEL_D2: + case SGTELIB::KERNEL_D3: + case SGTELIB::KERNEL_D4: + case SGTELIB::KERNEL_D5: + case SGTELIB::KERNEL_D6: + case SGTELIB::KERNEL_D7: + return true; + case SGTELIB::KERNEL_I0: + case SGTELIB::KERNEL_I1: + case SGTELIB::KERNEL_I2: + case SGTELIB::KERNEL_I3: + case SGTELIB::KERNEL_I4: + return false; + default : + throw SGTELIB::Exception ( __FILE__ , __LINE__ , + "kernel_is_decreasing: undefined kernel type" ); + return false; + } +}// + +/*----------------------------------------------------------*/ +bool SGTELIB::kernel_has_parameter ( const SGTELIB::kernel_t kt ) { +/*----------------------------------------------------------*/ + switch ( kt ) { + case SGTELIB::KERNEL_D1: + case SGTELIB::KERNEL_D2: + case SGTELIB::KERNEL_D3: + case SGTELIB::KERNEL_D4: + case SGTELIB::KERNEL_D5: + case SGTELIB::KERNEL_D6: + case SGTELIB::KERNEL_D7: + case SGTELIB::KERNEL_I0: + return true; + case SGTELIB::KERNEL_I2: + case SGTELIB::KERNEL_I1: + case SGTELIB::KERNEL_I3: + case SGTELIB::KERNEL_I4: + return false; + default: + throw SGTELIB::Exception ( __FILE__ , __LINE__ , + "kernel_has_parameter: undefined kernel type" ); + return false; + } +}// + +/*----------------------------------------------------------*/ +int SGTELIB::kernel_dmin ( const SGTELIB::kernel_t kt ) { +/*----------------------------------------------------------*/ + switch ( kt ) { + case SGTELIB::KERNEL_D1: + case SGTELIB::KERNEL_D2: + case SGTELIB::KERNEL_D3: + case SGTELIB::KERNEL_D4: + case SGTELIB::KERNEL_D5: + case SGTELIB::KERNEL_D6: + case SGTELIB::KERNEL_D7: + return -1; + case SGTELIB::KERNEL_I0: + case SGTELIB::KERNEL_I1: + return 0; + case SGTELIB::KERNEL_I2: + case SGTELIB::KERNEL_I3: + case SGTELIB::KERNEL_I4: + return 1; + default: + throw SGTELIB::Exception ( __FILE__ , __LINE__ , + "kernel_dmin: undefined kernel type" ); + return false; + } +}// + + +/*----------------------------------------------------------*/ +SGTELIB::kernel_t SGTELIB::str_to_kernel_type ( const std::string & s ) { +/*----------------------------------------------------------*/ + if ( s=="D1" ){ return SGTELIB::KERNEL_D1; } + if ( s=="GAUSSIAN" ){ return SGTELIB::KERNEL_D1; } + + if ( s=="D2" ){ return SGTELIB::KERNEL_D2; } + if ( s=="INVERSE_QUAD" ){ return SGTELIB::KERNEL_D2; } + if ( s=="INVERSEQUAD" ){ return SGTELIB::KERNEL_D2; } + + if ( s=="D3" ){ return SGTELIB::KERNEL_D3; } + if ( s=="INVERSE_MULTI_QUAD" ){ return SGTELIB::KERNEL_D3; } + if ( s=="INVERSEMULTIQUAD" ){ return SGTELIB::KERNEL_D3; } + + if ( s=="D4" ){ return SGTELIB::KERNEL_D4; } + if ( s=="BIQUADRATIC" ){ return SGTELIB::KERNEL_D4; } + if ( s=="BI_QUADRATIC" ){ return SGTELIB::KERNEL_D4; } + if ( s=="BI-QUADRATIC" ){ return SGTELIB::KERNEL_D4; } + if ( s=="BIQUAD" ){ return SGTELIB::KERNEL_D4; } + + if ( s=="D5" ){ return SGTELIB::KERNEL_D5; } + if ( s=="TRICUBIC" ){ return SGTELIB::KERNEL_D5; } + if ( s=="TRI_CUBIC" ){ return SGTELIB::KERNEL_D5; } + if ( s=="TRI-CUBIC" ){ return SGTELIB::KERNEL_D5; } + if ( s=="TRICUB" ){ return SGTELIB::KERNEL_D5; } + + if ( s=="D6" ){ return SGTELIB::KERNEL_D6; } + if ( s=="EXPSQRT" ){ return SGTELIB::KERNEL_D6; } + + if ( s=="D7" ){ return SGTELIB::KERNEL_D7; } + if ( s=="EPANECHNIKOV" ){ return SGTELIB::KERNEL_D7; } + if ( s=="EPA" ){ return SGTELIB::KERNEL_D7; } + + if ( s=="I0" ){ return SGTELIB::KERNEL_I0; } + if ( s=="MULTIQUADRATIC" ){ return SGTELIB::KERNEL_I0; } + if ( s=="MULTI-QUADRATIC" ){ return SGTELIB::KERNEL_I0; } + if ( s=="MULTI_QUADRATIC" ){ return SGTELIB::KERNEL_I0; } + if ( s=="MULTIQUAD" ){ return SGTELIB::KERNEL_I0; } + + if ( s=="I1" ){ return SGTELIB::KERNEL_I1; } + if ( s=="POLY1" ){ return SGTELIB::KERNEL_I1; } + if ( s=="SPLINE1" ){ return SGTELIB::KERNEL_I1; } + if ( s=="PHS1" ){ return SGTELIB::KERNEL_I1; } + + if ( s=="I2" ){ return SGTELIB::KERNEL_I2; } + if ( s=="POLY2" ){ return SGTELIB::KERNEL_I2; } + if ( s=="SPLINE2" ){ return SGTELIB::KERNEL_I2; } + if ( s=="PHS2" ){ return SGTELIB::KERNEL_I2; } + + if ( s=="I3" ){ return SGTELIB::KERNEL_I3; } + if ( s=="POLY3" ){ return SGTELIB::KERNEL_I3; } + if ( s=="SPLINE3" ){ return SGTELIB::KERNEL_I3; } + if ( s=="PHS3" ){ return SGTELIB::KERNEL_I3; } + + if ( s=="I4" ){ return SGTELIB::KERNEL_I4; } + if ( s=="POLY4" ){ return SGTELIB::KERNEL_I4; } + if ( s=="SPLINE4" ){ return SGTELIB::KERNEL_I4; } + if ( s=="PHS4" ){ return SGTELIB::KERNEL_I4; } + + throw SGTELIB::Exception ( __FILE__ , __LINE__ , + "str_to_kernel_type: unrecognised string \""+s+"\"" ); +}// + +/*----------------------------------------------------------*/ +SGTELIB::kernel_t SGTELIB::int_to_kernel_type ( const int i ) { +/*----------------------------------------------------------*/ + if ( (i<0) || (i>=SGTELIB::NB_KERNEL_TYPES) ){ + throw SGTELIB::Exception ( __FILE__ , __LINE__ , + "int_to_kernel_type: invalid integer "+itos(i) ); + } + switch ( i ){ + case 0: return SGTELIB::KERNEL_D1; + case 1: return SGTELIB::KERNEL_D2; + case 2: return SGTELIB::KERNEL_D3; + case 3: return SGTELIB::KERNEL_D4; + case 4: return SGTELIB::KERNEL_D5; + case 5: return SGTELIB::KERNEL_D6; + case 6: return SGTELIB::KERNEL_D7; + case 7: return SGTELIB::KERNEL_I0; + case 8: return SGTELIB::KERNEL_I1; + case 9: return SGTELIB::KERNEL_I2; + case 10: return SGTELIB::KERNEL_I3; + case 11: return SGTELIB::KERNEL_I4; + default: + throw SGTELIB::Exception ( __FILE__ , __LINE__ , + "int_to_kernel_type: invalid integer "+itos(i) ); + } +}// + +/*----------------------------------------------*/ +/* Compute the value of the kernel */ +/*----------------------------------------------*/ +double SGTELIB::kernel ( const SGTELIB::kernel_t kt , + const double ks , + const double r ){ + // kt : kernel type + // ks : kernel shape + // r : radius + + switch (kt){ + case SGTELIB::KERNEL_D1: + // Gaussian + return exp(-PI*ks*ks*r*r); + case SGTELIB::KERNEL_D2: + // Inverse Quadratic + return 1.0/(1.0+ks*ks*r*r); + case SGTELIB::KERNEL_D3: + // Inverse Multiquadratic + return 1.0/sqrt(1.0+ks*ks*r*r); + case SGTELIB::KERNEL_D4: + // Bi-quadratic + { + double ksr = fabs(ks*r)*16.0/15.0; + if (ksr<=1){ + double d = (1-ksr*ksr); + return d*d; + } + } + return 0.0; + case SGTELIB::KERNEL_D5: + // Tri-cubic + { + double ksr = fabs(ks*r)*162.0/140.0; + if (ksr<=1.0){ + double d = (1-ksr*ksr*ksr); + return d*d*d; + } + } + return 0.0; + case SGTELIB::KERNEL_D6: + // Exp-Root + return exp(-sqrt(ks*r)); + case SGTELIB::KERNEL_D7: + // Epa + { + double ksr = fabs(ks*r); + if (ksr<=1.0) return 0.75*(1-ksr*ksr); + } + return 0.0; + case SGTELIB::KERNEL_I0: + // Multiquadratic + return sqrt(1.0+ks*ks*r*r); + case SGTELIB::KERNEL_I1: + // Polyharmonique spline (k=1) + return r; + case SGTELIB::KERNEL_I2: + // Polyharmonique spline (k=2) (Thin Plate Splin) + if (r==0.0) return 0.0; + return log(r)*r*r; + case SGTELIB::KERNEL_I3: + // Polyharmonique spline (k=3) + return r*r*r; + case SGTELIB::KERNEL_I4: + // Polyharmonique spline (k=4) + if (r==0.0) return 0.0; + { + double r2 = r*r; + return r2*r2*log(r); + } + default: + throw SGTELIB::Exception ( __FILE__ , __LINE__ , + "kernel: undefined kernel type" ); + return 0.0; + } // end switch +}// + +/*----------------------------------------------*/ +/* Compute the value of the kernel */ +/*----------------------------------------------*/ +SGTELIB::Matrix SGTELIB::kernel ( const SGTELIB::kernel_t kt , + const double ks , + SGTELIB::Matrix R ){ + + const int nbRows = R.get_nb_rows(); + const int nbCols = R.get_nb_cols(); + int i,j; + for (i=0 ; i<nbRows ; i++){ + for (j=0 ; j<nbCols ; j++){ + R.set(i,j,kernel(kt,ks,R.get(i,j))); + } + } + return R; +}// + + + + diff --git a/ext/sgtelib/src/Kernel.hpp b/ext/sgtelib/src/Kernel.hpp new file mode 100644 index 0000000000000000000000000000000000000000..de86ea99e5318efb285e3f51ac889f20fddb8d6a --- /dev/null +++ b/ext/sgtelib/src/Kernel.hpp @@ -0,0 +1,69 @@ +/*-------------------------------------------------------------------------------------*/ +/* sgtelib - A surrogate model library for derivative-free optimization */ +/* Version 2.0.1 */ +/* */ +/* Copyright (C) 2012-2017 Sebastien Le Digabel - Ecole Polytechnique, Montreal */ +/* Bastien Talgorn - McGill University, Montreal */ +/* */ +/* Author: Bastien Talgorn */ +/* email: bastientalgorn@fastmail.com */ +/* */ +/* This program is free software: you can redistribute it and/or modify it under the */ +/* terms of the GNU Lesser General Public License as published by the Free Software */ +/* Foundation, either version 3 of the License, or (at your option) any later */ +/* version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ +/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ +/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License along */ +/* with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on sgtelib at https://github.com/bastientalgorn/sgtelib */ +/*-------------------------------------------------------------------------------------*/ + +#ifndef __KERNEL__ +#define __KERNEL__ + +#include "Defines.hpp" +#include "Exception.hpp" +#include "Matrix.hpp" +namespace SGTELIB { + + // kernel type: + enum kernel_t { + KERNEL_D1 , + KERNEL_D2 , + KERNEL_D3 , + KERNEL_D4 , + KERNEL_D5 , + KERNEL_D6 , + KERNEL_D7 , + KERNEL_I0 , + KERNEL_I1 , + KERNEL_I2 , + KERNEL_I3 , + KERNEL_I4 + }; + const int NB_KERNEL_TYPES = 11; + const int NB_DECREASING_KERNEL_TYPES = 6; + + // kernel + double kernel ( const SGTELIB::kernel_t kt , const double ks ,const double r ); + SGTELIB::Matrix kernel ( const SGTELIB::kernel_t kt , const double ks , SGTELIB::Matrix R ); + // kernel is decreasing ? + bool kernel_is_decreasing ( const SGTELIB::kernel_t kt ); + // kernel has a shape parameter ? + bool kernel_has_parameter ( const SGTELIB::kernel_t kt ); + // kernel has a shape parameter ? + int kernel_dmin ( const SGTELIB::kernel_t kt ); + // Kernel to str + std::string kernel_type_to_str ( SGTELIB::kernel_t ); + // string to kernel type + SGTELIB::kernel_t str_to_kernel_type ( const std::string & s ); + SGTELIB::kernel_t int_to_kernel_type ( const int i ); +} + +#endif + diff --git a/ext/sgtelib/src/Matrix.cpp b/ext/sgtelib/src/Matrix.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a729103f1ff18aa61987a0dd0255b76cd3994ef2 --- /dev/null +++ b/ext/sgtelib/src/Matrix.cpp @@ -0,0 +1,2969 @@ +/*-------------------------------------------------------------------------------------*/ +/* sgtelib - A surrogate model library for derivative-free optimization */ +/* Version 2.0.1 */ +/* */ +/* Copyright (C) 2012-2017 Sebastien Le Digabel - Ecole Polytechnique, Montreal */ +/* Bastien Talgorn - McGill University, Montreal */ +/* */ +/* Author: Bastien Talgorn */ +/* email: bastientalgorn@fastmail.com */ +/* */ +/* This program is free software: you can redistribute it and/or modify it under the */ +/* terms of the GNU Lesser General Public License as published by the Free Software */ +/* Foundation, either version 3 of the License, or (at your option) any later */ +/* version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ +/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ +/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License along */ +/* with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on sgtelib at https://github.com/bastientalgorn/sgtelib */ +/*-------------------------------------------------------------------------------------*/ + +#include "Matrix.hpp" + +/*---------------------------*/ +/* constructor 1 */ +/*---------------------------*/ +SGTELIB::Matrix::Matrix ( const std::string & name , + int nbRows , + int nbCols ) : + _name ( name ) , + _nbRows ( nbRows ) , + _nbCols ( nbCols ) { +#ifdef SGTELIB_DEBUG + if ( _nbRows < 0 || _nbCols < 0 ) + throw SGTELIB::Exception ( __FILE__ , __LINE__ , + "Matrix::constructor 1: bad dimensions" ); +#endif + + int i , j; + + _X = new double * [_nbRows]; + for ( i = 0 ; i < _nbRows ; ++i ) { + _X[i] = new double [_nbCols]; + for ( j = 0 ; j < _nbCols ; ++j ) + _X[i][j] = 0.0; + } +}// + +/*---------------------------*/ +/* constructor 2 */ +/*---------------------------*/ +SGTELIB::Matrix::Matrix ( const std::string & name , + int nbRows , + int nbCols , + double ** A ) : + _name ( name ) , + _nbRows ( nbRows ) , + _nbCols ( nbCols ) { +#ifdef SGTELIB_DEBUG + if ( _nbRows < 0 || _nbCols < 0 ) + throw SGTELIB::Exception ( __FILE__ , __LINE__ , + "Matrix::constructor 2: bad dimensions" ); +#endif + + int i , j; + + _X = new double * [_nbRows]; + for ( i = 0 ; i < _nbRows ; ++i ) { + _X[i] = new double [_nbCols]; + for ( j = 0 ; j < _nbCols ; ++j ) + _X[i][j] = A[i][j]; + } +}// + +/*---------------------------*/ +/* constructor 3 */ +/*---------------------------*/ +SGTELIB::Matrix::Matrix ( const std::string & file_name ) : + _name ( "no_name" ) , + _nbRows ( 0 ) , + _nbCols ( 0 ) , + _X ( NULL ) { + *this = import_data(file_name); +}// + + +/*---------------------------*/ +/* constructor 4 */ +/*---------------------------*/ +SGTELIB::Matrix::Matrix (void) : + _name ( "" ) , + _nbRows ( 0 ) , + _nbCols ( 0 ) { + _X = new double * [0]; +}// + +/*---------------------------*/ +/* copy constructor */ +/*---------------------------*/ +SGTELIB::Matrix::Matrix ( const SGTELIB::Matrix & A ) : + _name ( A._name ) , + _nbRows ( A._nbRows ) , + _nbCols ( A._nbCols ) { + int i , j; + _X = new double * [_nbRows]; + for ( i = 0 ; i < _nbRows ; ++i ) { + _X[i] = new double [_nbCols]; + for ( j = 0 ; j < _nbCols ; ++j ) + _X[i][j] = A._X[i][j]; + } +}// + + + + +/*---------------------------*/ +/* affectation operator */ +/*---------------------------*/ +SGTELIB::Matrix & SGTELIB::Matrix::operator = ( const SGTELIB::Matrix & A ) { + + if ( this == &A ) + return *this; + + int i , j; + + if ( _nbRows != A._nbRows || _nbCols != A._nbCols ) { + + for ( i = 0 ; i < _nbRows ; ++i ) + delete [] _X[i]; + delete [] _X; + + _nbRows = A._nbRows; + _nbCols = A._nbCols; + + _X = new double * [_nbRows]; + for ( i = 0 ; i < _nbRows ; ++i ) { + _X[i] = new double [_nbCols]; + for ( j = 0 ; j < _nbCols ; ++j ) + _X[i][j] = A._X[i][j]; + } + } + else { + for ( i = 0 ; i < _nbRows ; ++i ) + for ( j = 0 ; j < _nbCols ; ++j ) + _X[i][j] = A._X[i][j]; + } + + _name = A._name; + + return *this; +}// + + + +/*---------------------------*/ +/* import data */ +/*---------------------------*/ +SGTELIB::Matrix SGTELIB::Matrix::import_data ( const std::string & file_name ){ + + std::ifstream in ( file_name.c_str() ); + + if ( in.fail() ) { + in.close(); + std::ostringstream oss; + oss << "SGTELIB::Matrix::import_data: cannot open file " << file_name; + throw SGTELIB::Exception ( __FILE__ , __LINE__ , oss.str() ); + } + + std::string s; + std::string line; + while (std::getline(in, line)) s += line+";"; + + return string_to_matrix(s); + +}// + + +/*---------------------------------------*/ +/* affectation operator from string */ +/*---------------------------------------*/ +SGTELIB::Matrix SGTELIB::Matrix::string_to_matrix ( std::string s ) { + + // Replace tabs, newline etc. + std::replace( s.begin(), s.end(), '\t', ' '); + std::replace( s.begin(), s.end(), '\n', ';'); + std::replace( s.begin(), s.end(), '\r', ';'); + std::replace( s.begin(), s.end(), ',' , ' '); + + // Remove extra spaces + s = SGTELIB::deblank(s); + size_t i; + std::string curline; + + // Find name + std::string name = "MAT"; // default name + i = std::min(s.find("="),s.find("[")); + if (i!=std::string::npos){ + curline = SGTELIB::deblank(s.substr(0,i)); + if (curline.size()){ + name = curline; + } + s = s.substr(i+1); + } + + // Replace closing brakets by semi-colon. + std::replace( s.begin(), s.end(), '=', ' '); + std::replace( s.begin(), s.end(), '[', ' '); + std::replace( s.begin(), s.end(), ']', ' '); + + // Read data + int nbCols=-1; + SGTELIB::Matrix M; + while (true){ + + i = s.find(";"); + if (i==std::string::npos) break; + curline = SGTELIB::deblank(s.substr(0,i)); + s = s.substr(i+1); + if (curline.size()){ + if (nbCols==-1){ + nbCols= SGTELIB::count_words(curline); + M = SGTELIB::Matrix(name,0,nbCols); + } + M.add_rows(SGTELIB::Matrix::string_to_row(curline,nbCols)); + } + + } + return M; + +}// + +/*------------------------------*/ +/* convert string to row vector */ +/*------------------------------*/ +SGTELIB::Matrix SGTELIB::Matrix::string_to_row ( const std::string & s , int nbCols ){ + if (nbCols<=0){ + nbCols = count_words(s); + } + SGTELIB::Matrix row("r",1,nbCols); + double v; + std::stringstream ss( s ); + int i=0; + while( ss >> v ) row._X[0][i++] = v; + if (i++!=nbCols){ + std::cout << "In line \"" << s << "\"\n"; + std::cout << "Found " << i << " components\n"; + std::cout << "Expected " << nbCols << " components\n"; + throw SGTELIB::Exception ( __FILE__ , __LINE__ , + "Matrix::string_to_row : cannot read line "+s ); + } + return row; +}// + +/*---------------------------*/ +/* operators */ +/*---------------------------*/ +SGTELIB::Matrix operator * (const SGTELIB::Matrix & A , const SGTELIB::Matrix & B) { + return SGTELIB::Matrix::product(A,B); +} +SGTELIB::Matrix operator * (const SGTELIB::Matrix & A , const double v) { + int nbCols = A.get_nb_rows(); + int nbRows = A.get_nb_cols(); + SGTELIB::Matrix B(SGTELIB::dtos(v)+"*"+A.get_name(),nbCols,nbRows); + int i,j; + for ( i = 0 ; i < nbCols ; ++i ) { + for ( j = 0 ; j < nbRows ; ++j ) { + B.set(i,j,v*A.get(i,j)); + } + } + return B; +} +SGTELIB::Matrix operator * (const double v , const SGTELIB::Matrix & A) { + return A*v; +} +SGTELIB::Matrix operator + (const SGTELIB::Matrix & A , const SGTELIB::Matrix & B) { + return SGTELIB::Matrix::add(A,B); +}// +SGTELIB::Matrix operator + (const SGTELIB::Matrix & A , const double v) { + const int nbCols = A.get_nb_rows(); + const int nbRows = A.get_nb_cols(); + SGTELIB::Matrix B(SGTELIB::dtos(v)+"+"+A.get_name(),nbCols,nbRows); + int i,j; + for ( i = 0 ; i < nbCols ; ++i ) { + for ( j = 0 ; j < nbRows ; ++j ) { + B.set(i,j,v+A.get(i,j)); + } + } + return B; +}// + +SGTELIB::Matrix operator + (const double v , const SGTELIB::Matrix & A) { + return A+v; +}// + +SGTELIB::Matrix operator - (const SGTELIB::Matrix & A , const SGTELIB::Matrix & B) { + return SGTELIB::Matrix::sub(A,B); +}// + +SGTELIB::Matrix operator - (const SGTELIB::Matrix & A) { + SGTELIB::Matrix M = A*(-1.0); + M.set_name("(-"+A.get_name()+")"); + return M; +}// + +SGTELIB::Matrix operator - (const double v , const SGTELIB::Matrix & A) { + return v+(-A); +}// + +SGTELIB::Matrix operator - (const SGTELIB::Matrix & A , const double v) { + return A+(-v); +}// + +SGTELIB::Matrix operator / (const SGTELIB::Matrix & A , const double v) { + if (v==0){ + throw SGTELIB::Exception ( __FILE__ , __LINE__ , + "Matrix::operator /: divide by 0" ); + } + return A * (1.0/v); +}// + +/*---------------------------*/ +/* destructor */ +/*---------------------------*/ +SGTELIB::Matrix::~Matrix ( void ) { + //std::cout << "Delete " << _name << "\n"; + std::cout.flush(); + for ( int i = 0 ; i < _nbRows ; ++i ) + delete [] _X[i]; + delete [] _X; +}// + +/*---------------------------*/ +/* add one row */ +/*---------------------------*/ +void SGTELIB::Matrix::add_row ( const double * row ) { + + double ** new_X = new double * [_nbRows+1]; + + for ( int i = 0 ; i < _nbRows ; ++i ) + new_X[i] = _X[i]; + + new_X[_nbRows] = new double [_nbCols]; + for ( int j = 0 ; j < _nbCols ; ++j ) + new_X[_nbRows][j] = row[j]; + + delete [] _X; + _X = new_X; + ++_nbRows; +}// + +/*-------------------------------*/ +/* add rows */ +/*---------------------------*/ +void SGTELIB::Matrix::add_rows ( const Matrix & A ) { + + if ( A._nbCols != _nbCols ) + throw SGTELIB::Exception ( __FILE__ , __LINE__ , + "Matrix::add_rows(): bad dimensions" ); + + int i , j; + int new_nbRows = _nbRows + A._nbRows; + + double ** new_X = new double * [new_nbRows]; + + for ( i = 0 ; i < _nbRows ; ++i ) + new_X[i] = _X[i]; + + for ( i = _nbRows ; i < new_nbRows ; ++i ) { + new_X[i] = new double [_nbCols]; + for ( j = 0 ; j < _nbCols ; ++j ) + new_X[i][j] = A._X[i-_nbRows][j]; + } + + delete [] _X; + _X = new_X; + _nbRows = new_nbRows; +}// + +/*---------------------------*/ +/* add rows */ +/*---------------------------*/ +void SGTELIB::Matrix::add_cols ( const Matrix & A ) { + + if ( A._nbRows != _nbRows ) + throw SGTELIB::Exception ( __FILE__ , __LINE__ , + "Matrix::add_cols(): bad dimensions" ); + + int i , j; + int new_nbCols = _nbCols + A._nbCols; + double * x; + + for ( i = 0 ; i < _nbRows ; ++i ) { + // Complete line + x = new double [new_nbCols]; + // Original columns + for ( j = 0 ; j < _nbCols ; ++j ) + x[j] = _X[i][j]; + // Additional columns + for ( j = _nbCols ; j < new_nbCols ; ++j ) + x[j] = A._X[i][j-_nbCols]; + // Remove original line + delete [] _X[i]; + // Put new line + _X[i] = x; + } + + _nbCols = new_nbCols; +}// + +/*---------------------------------*/ +/* add empty rows */ +/*---------------------------------*/ +void SGTELIB::Matrix::add_rows ( const int p ) { + + int i , j; + int new_nbRows = _nbRows + p; + + double ** new_X = new double * [new_nbRows]; + + for ( i = 0 ; i < _nbRows ; ++i ) + new_X[i] = _X[i]; + + for ( i = _nbRows ; i < new_nbRows ; ++i ) { + new_X[i] = new double [_nbCols]; + for ( j = 0 ; j < _nbCols ; ++j ) + new_X[i][j] = 0.0; + } + + delete [] _X; + + _X = new_X; + _nbRows = new_nbRows; +}// + +/*---------------------------------*/ +/* remove last rows */ +/*---------------------------------*/ +void SGTELIB::Matrix::remove_rows ( const int p ) { + + int i; + int new_nbRows = _nbRows - p; + + double ** new_X = new double * [new_nbRows]; + + for ( i = 0 ; i < new_nbRows ; ++i ) + new_X[i] = _X[i]; + + for ( i = new_nbRows ; i < _nbRows ; ++i ) + delete [] _X[i]; + + delete [] _X; + _X = new_X; + _nbRows = new_nbRows; +}// + +/*---------------------------------*/ +/* add empty cols */ +/*---------------------------------*/ +void SGTELIB::Matrix::add_cols ( const int p ) { + + int i , j; + int new_nbCols = _nbCols + p; + + double * x; + + for ( i = 0 ; i < _nbRows ; ++i ) { + x = new double [new_nbCols]; + for ( j = 0 ; j < _nbCols ; ++j ) + x[j] = _X[i][j]; + for ( j = _nbCols ; j < new_nbCols ; ++j ) + x[j] = 0.0; + delete [] _X[i]; + _X[i] = x; + } + + _nbCols = new_nbCols; +}// + +/*-----------------------------------------*/ +/* get the fix columns (fixed variables) */ +/*-----------------------------------------*/ +void SGTELIB::Matrix::get_fix_columns ( std::list<int> & fix_col ) const { + fix_col.clear(); + for ( int j = 0 ; j < _nbCols ; ++j ) + if ( get_nb_diff_values(j) == 1 ) + fix_col.push_back(j); +}// + + +/*-----------------------------------------*/ +/* is the matrix symmetric */ +/*-----------------------------------------*/ +bool SGTELIB::Matrix::is_sym ( void ) const { + if (_nbCols!=_nbRows) return false; + int i,j; + for ( i = 0 ; i < _nbRows ; ++i ) { + for ( j = i+1 ; j < _nbCols ; ++j ) { + if (_X[i][j]!=_X[j][i]){ + return false; + } + } + } + return true; +}// + + +/*-------------------------------*/ +/* set the matrix randomly */ +/*---------------------------*/ +void SGTELIB::Matrix::set_random ( double l , double u , bool round ) { + int i , j; + for ( i = 0 ; i < _nbRows ; ++i ){ + for ( j = 0 ; j < _nbCols ; ++j ){ + _X[i][j] = l + (u-l) * SGTELIB::uniform_rand(); + if ( round ) + _X[i][j] = SGTELIB::round ( _X[i][j] ); + } + } +}// + +/*---------------------------*/ +/* fill with value v */ +/*---------------------------*/ +void SGTELIB::Matrix::fill ( double v ) { + int i , j; + for ( i = 0 ; i < _nbRows ; ++i ){ + for ( j = 0 ; j < _nbCols ; ++j ){ + _X[i][j] = v; + } + } +}// + +/*---------------------------*/ +/* set element (i,j) */ +/*---------------------------*/ +void SGTELIB::Matrix::set ( const int i , const int j , const double d ) { + #ifdef SGTELIB_DEBUG + if ( i < 0 || i >= _nbRows || j < 0 || j >= _nbCols ){ + display(std::cout); + std::cout << "Error: try to set (" << i << "," << j << ") while dim is [" << _nbRows << "," << _nbCols << "]\n"; + std::cout.flush(); + throw SGTELIB::Exception ( __FILE__ , __LINE__ , "Matrix::set(i,j): bad index" ); + } + #endif + _X[i][j] = d; +}// + +void SGTELIB::Matrix::set_row (const SGTELIB::Matrix & T , const int i){ + #ifdef SGTELIB_DEBUG + if ( i < 0 || i >= _nbRows || T.get_nb_rows()!=1 || T.get_nb_cols()!=_nbCols ){ + throw SGTELIB::Exception ( __FILE__ , __LINE__ , "Matrix::set_row: bad index" ); + } + #endif + for (int j=0 ; j<_nbCols ; j++){ + _X[i][j] = T.get(0,j); + } +}// + +void SGTELIB::Matrix::set_col (const SGTELIB::Matrix & T , const int j){ + #ifdef SGTELIB_DEBUG + if ( j < 0 || j >= _nbCols || T.get_nb_rows()!=_nbRows || T.get_nb_cols()!=1 ){ + throw SGTELIB::Exception ( __FILE__ , __LINE__ , "Matrix::set_col: bad index" ); + } + #endif + for (int i=0 ; i<_nbRows ; i++){ + _X[i][j] = T.get(i,0); + } +}// + +void SGTELIB::Matrix::set_row (const double v , const int i){ + #ifdef SGTELIB_DEBUG + if ( i < 0 || i >= _nbRows ){ + throw SGTELIB::Exception ( __FILE__ , __LINE__ , "Matrix::set_row: bad index" ); + } + #endif + for (int j=0 ; j<_nbCols ; j++){ + _X[i][j] = v; + } +}// + +void SGTELIB::Matrix::set_col (const double v , const int j){ + #ifdef SGTELIB_DEBUG + if ( j < 0 || j >= _nbCols ){ + throw SGTELIB::Exception ( __FILE__ , __LINE__ , "Matrix::set_col: bad index" ); + } + #endif + for (int i=0 ; i<_nbRows ; i++){ + _X[i][j] = v; + } +}// + +void SGTELIB::Matrix::permute (const int i1 , const int j1 , const int i2 , const int j2 ){ + #ifdef SGTELIB_DEBUG + if ( i1 < 0 || i1 >= _nbRows || j1 < 0 || j1 >= _nbCols || i2 < 0 || i2 >= _nbRows || j2 < 0 || j2 >= _nbCols ){ + throw SGTELIB::Exception ( __FILE__ , __LINE__ , "Matrix::permut: bad index" ); + } + #endif + double buffer = _X[i1][j1]; + _X[i1][j1] = _X[i2][j2]; + _X[i2][j2] = buffer; +}// + +void SGTELIB::Matrix::multiply_row (const double v , const int i){ + #ifdef SGTELIB_DEBUG + if ( i < 0 || i >= _nbRows ){ + throw SGTELIB::Exception ( __FILE__ , __LINE__ , "Matrix::set_row: bad index" ); + } + #endif + for (int j=0 ; j<_nbCols ; j++){ + _X[i][j] *= v; + } +}// + +void SGTELIB::Matrix::multiply_col (const double v , const int j){ + #ifdef SGTELIB_DEBUG + if ( j < 0 || j >= _nbCols ){ + throw SGTELIB::Exception ( __FILE__ , __LINE__ , "Matrix::set_col: bad index" ); + } + #endif + for (int i=0 ; i<_nbRows ; i++){ + _X[i][j] *= v; + } +}// + +/*---------------------------*/ +/* access to element (k) */ +/*---------------------------*/ +double SGTELIB::Matrix::get ( const int k ) const { + return (*this)[k]; +}// + + +const double & SGTELIB::Matrix::operator [] ( int k ) const { + int i = 0 , j = 0; + if (_nbRows==1) j=k; + else if (_nbCols==1) i=k; + else throw SGTELIB::Exception ( __FILE__ , __LINE__ , "Matrix::[k]: the matrix is not a vector" ); + return _X[i][j]; +}// +double & SGTELIB::Matrix::operator [] ( int k ){ + int i = 0 , j = 0; + if (_nbRows==1) j=k; + else if (_nbCols==1) i=k; + else throw SGTELIB::Exception ( __FILE__ , __LINE__ , "Matrix::[k]: the matrix is not a vector" ); + return _X[i][j]; +}// + +/*---------------------------*/ +/* access to element (i,j) */ +/*---------------------------*/ +double SGTELIB::Matrix::get ( const int i , const int j ) const { + #ifdef SGTELIB_DEBUG + if ( i < 0 || i >= _nbRows || j < 0 || j >= _nbCols ){ + display(std::cout); + std::cout << "Error: try to access (" << i << "," << j << ") while dim is [" << _nbRows << "," << _nbCols << "]\n"; + throw SGTELIB::Exception ( __FILE__ , __LINE__ , "Matrix::get(i,j): bad index" ); + } + #endif + return _X[i][j]; +}// + +/*------------------------------------------*/ +/* get (access to a subpart of the matrix */ +/*------------------------------------------*/ +SGTELIB::Matrix SGTELIB::Matrix::get (const std::list<int> & list_cols , const std::list<int> & list_rows) const { + return get_rows(list_rows).get_cols(list_cols); +}// + +/*---------------------------*/ +/* get row */ +/*---------------------------*/ +SGTELIB::Matrix SGTELIB::Matrix::get_row (const int i) const { + #ifdef SGTELIB_DEBUG + if ( i < 0 || i >= _nbRows ) + throw SGTELIB::Exception ( __FILE__ , __LINE__ , "Matrix::get_row(i): bad index" ); + #endif + SGTELIB::Matrix A (_name+"(i,:)",1,_nbCols); + for (int j=0 ; j<_nbCols ; j++){ + A._X[0][j] = _X[i][j]; + } + return A; +}// + +/*---------------------------*/ +/* get col */ +/*---------------------------*/ +SGTELIB::Matrix SGTELIB::Matrix::get_col (const int j) const { + #ifdef SGTELIB_DEBUG + if ( j < 0 || j >= _nbCols ) + throw SGTELIB::Exception ( __FILE__ , __LINE__ , "Matrix::get_row(i): bad index" ); + #endif + SGTELIB::Matrix A (_name+"(:,j)",_nbRows,1); + for (int i=0 ; i<_nbRows ; i++){ + A._X[i][0] = _X[i][j]; + } + return A; +}// + +/*---------------------------*/ +/* get_rows */ +/* get rows from i1 to i2-1 */ +/*---------------------------*/ +SGTELIB::Matrix SGTELIB::Matrix::get_rows (const int i1, const int i2) const { + + if ( (i1<0) || (i1>_nbRows) || (i2<0) || (i2>_nbRows) || (i1>=i2) ){ + throw SGTELIB::Exception ( __FILE__ , __LINE__ , "Matrix::get_rows: bad index" ); + } + + // Otherwise, select the rows + const int nbRows = i2-i1; + const int nbCols = _nbCols; + SGTELIB::Matrix A (_name+"(i1:i2-1,:)",nbRows,nbCols); + + int i,k=0; + for ( i=i1 ; i<i2 ; i++ ) + A.set_row(get_row(i),k++); + return A; +}// + +/*---------------------------*/ +/* get_cols */ +/* get rows from i1 to i2-1 */ +/*---------------------------*/ +SGTELIB::Matrix SGTELIB::Matrix::get_cols (const int i1, const int i2) const { + + if ( (i1<0) || (i1>_nbCols) || (i2<0) || (i2>_nbCols) || (i1>=i2) ){ + throw SGTELIB::Exception ( __FILE__ , __LINE__ , "Matrix::get_cols: bad index" ); + } + + // Otherwise, select the rows + const int nbCols = i2-i1; + const int nbRows = _nbRows; + SGTELIB::Matrix A (_name+"(:,i1:i2-1)",nbRows,nbCols); + + int i,k=0; + for ( i=i1 ; i<i2 ; i++ ) + A.set_col(get_col(i),k++); + return A; +}// + +/*---------------------------*/ +/* get_rows */ +/*---------------------------*/ +SGTELIB::Matrix SGTELIB::Matrix::get_rows (const std::list<int> & list_rows) const { + + // If the list has only one element and this element is -1, then all rows are returned. + if ( (list_rows.size()==1) && (list_rows.front()==-1) ){ + return *this; + } + + // Otherwise, select the rows + const int nbRows = static_cast<int>(list_rows.size()); + const int nbCols = _nbCols; + SGTELIB::Matrix A (_name+"_get_rows",nbRows,nbCols); + + std::list<int>::const_iterator it; + + int k=0; + for ( it = list_rows.begin() ; it != list_rows.end() ; ++it ) { + if ( *it < 0 || *it >= _nbRows ) { + throw SGTELIB::Exception ( __FILE__ , __LINE__ , "Matrix::get_rows: bad index" ); + } + A.set_row(get_row(*it),k++); + } + return A; +}// + +/*---------------------------*/ +/* get_cols */ +/*---------------------------*/ +SGTELIB::Matrix SGTELIB::Matrix::get_cols (const std::list<int> & list_cols) const { + + // If the list has only one element and this element is -1, then all rows are returned. + if ( (list_cols.size()==1) && (list_cols.front()==-1) ){ + return *this; + } + + // Otherwise, select the rows + const int nbRows = _nbRows; + const int nbCols = static_cast<int>(list_cols.size()); + SGTELIB::Matrix A (_name+"_get_cols",nbRows,nbCols); + + std::list<int>::const_iterator it; + + int k=0; + for ( it = list_cols.begin() ; it != list_cols.end() ; ++it ) { + if ( *it < 0 || *it >= _nbCols ) { + throw SGTELIB::Exception ( __FILE__ , __LINE__ , "Matrix::get_rows: bad index" ); + } + A.set_col(get_col(*it),k++); + } + + return A; +}// + +/*----------------------------------------------------*/ +/* count the number of different values in column j */ +/*----------------------------------------------------*/ +int SGTELIB::Matrix::get_nb_diff_values ( int j ) const { + std::set<double> s; + for ( int i = 0 ; i < _nbRows ; ++i ){ + s.insert ( _X[i][j] ); + } + return static_cast<int> ( s.size() ); +}// + +/*---------------------------*/ +/* display */ +/*---------------------------*/ +void SGTELIB::Matrix::display ( std::ostream & out ) const { + int i , j; + out << std::endl << _name << "=[\n"; + for ( i = 0 ; i < _nbRows ; ++i ) { + for ( j = 0 ; j < _nbCols ; ++j ) + out << "\t" << std::setw(10) << _X[i][j] << " "; + out << ";" << std::endl; + } + out << "];" << std::endl; +}// + +/*---------------------------*/ +/* display */ +/*---------------------------*/ +void SGTELIB::Matrix::display_short ( std::ostream & out ) const { + if (get_numel()<5) display(out); + else{ + out << std::endl << _name << " ( " << _nbRows << " x " << _nbCols << " ) =\n["; + out << "\t" << std::setw(10) << _X[0][0] << " "; + if (_nbCols>2) out << "... "; + out << "\t" << std::setw(10) << _X[0][_nbCols] << "\n"; + if (_nbRows>2) out << "\t ..."; + if (_nbCols>2) out << " "; + if (_nbRows>2) out << "\t ...\n"; + out << "\t" << std::setw(10) << _X[_nbRows-1][0] << " "; + if (_nbCols>2) out << "... "; + out << "\t" << std::setw(10) << _X[_nbRows-1][_nbCols] << "]\n"; + } +}// + +/*---------------------------*/ +/* write */ +/*---------------------------*/ +void SGTELIB::Matrix::write ( const std::string & file_name ) const { + std::ofstream output_file; + output_file.open (file_name.c_str()); + display(output_file); + output_file.close(); +}// + +/*-------------------------------*/ +/* display_size */ +/*-------------------------------*/ +void SGTELIB::Matrix::display_size ( std::ostream & out ) const { + out << "Matrix " << _name << " : " << _nbRows << " , " << _nbCols << "\n"; +}// + +/*---------------------------*/ +/* double * to column vector */ +/*---------------------------*/ +SGTELIB::Matrix SGTELIB::Matrix::col_vector ( const double * v, + const int n ) { + if ( ! v){ + throw SGTELIB::Exception ( __FILE__ , __LINE__ , "Matrix::column_vector: v is null" ); + } + SGTELIB::Matrix V("V",n,1); + for (int i=0 ; i<n ; i++){ + V._X[i][0] = v[i]; + } + return V; +}// + +/*---------------------------*/ +/* double * to row vector */ +/*---------------------------*/ +SGTELIB::Matrix SGTELIB::Matrix::row_vector ( const double * v, + const int n ) { + if ( ! v){ + throw SGTELIB::Exception ( __FILE__ , __LINE__ , "Matrix::column_vector: v is null" ); + } + SGTELIB::Matrix V("V",1,n); + for (int i=0 ; i<n ; i++){ + V._X[0][i] = v[i]; + } + return V; +}// + +/*---------------------------*/ +/* product */ +/*---------------------------*/ +SGTELIB::Matrix SGTELIB::Matrix::product ( const SGTELIB::Matrix & A, + const SGTELIB::Matrix & B ) { + + if (A.get_nb_cols()!=B.get_nb_rows()){ + std::cout << "A (" << A.get_name() << ") : " << A.get_nb_rows() << " , " << A.get_nb_cols() << "\n"; + std::cout << "B (" << B.get_name() << ") : " << B.get_nb_rows() << " , " << B.get_nb_cols() << "\n"; + throw SGTELIB::Exception ( __FILE__ , __LINE__ , "Matrix::product(A,B): dimension error" ); + } + + // Init matrix + SGTELIB::Matrix C(A.get_name()+"*"+B.get_name(),A.get_nb_rows(),B.get_nb_cols()); + + // Compute + int i,j,k; + const int nb_rows = C.get_nb_rows(); + const int nb_cols = C.get_nb_cols(); + const int nb_inter= A.get_nb_cols(); + //double v; + for ( i = 0 ; i < nb_rows ; ++i ) { + for ( j = 0 ; j < nb_cols ; ++j ){ + C._X[i][j] = 0; + for ( k = 0 ; k < nb_inter; ++k ){ + C._X[i][j] += A._X[i][k]*B._X[k][j]; + } + } + } + return C; +}// + +/*---------------------------*/ +SGTELIB::Matrix SGTELIB::Matrix::product ( const SGTELIB::Matrix & A, + const SGTELIB::Matrix & B, + const SGTELIB::Matrix & C){ + return product(A,product(B,C)); +}// +/*---------------------------*/ +SGTELIB::Matrix SGTELIB::Matrix::product ( const SGTELIB::Matrix & A, + const SGTELIB::Matrix & B, + const SGTELIB::Matrix & C, + const SGTELIB::Matrix & D){ + return product(product(A,B),product(C,D)); +}// +/*---------------------------*/ + +/*---------------------------------------------------*/ +/* Subset product */ +/* multiply */ +/* the p first rows and q first columns of A */ +/* with the q first rows and r first columns of B. */ +/* Result is a matrix of size p/r. */ +/*---------------------------------------------------*/ +SGTELIB::Matrix SGTELIB::Matrix::subset_product (const SGTELIB::Matrix & A, + const SGTELIB::Matrix & B, + int p, + int q, + int r){ + + // Default p value + if (p==-1){ + p=A.get_nb_rows(); + } + // Otherwise, need to check the number of rows. + else if (A.get_nb_rows()<p){ + throw SGTELIB::Exception ( __FILE__ , __LINE__ , "Matrix::subset_product: dimension error" ); + } + + // Default q value + if ( (q==-1) & (A.get_nb_cols()==B.get_nb_rows()) ){ + q = A.get_nb_cols(); + } + else{ + // Check for q + if (A.get_nb_cols()<q){ + throw SGTELIB::Exception ( __FILE__ , __LINE__ , "Matrix::subset_product: dimension error" ); + } + if (B.get_nb_rows()<q){ + throw SGTELIB::Exception ( __FILE__ , __LINE__ , "Matrix::subset_product: dimension error" ); + } + } + + // Default r value + if (r==-1){ + r = B.get_nb_cols(); + } + else if (B.get_nb_cols()<r){ + // Check for r + throw SGTELIB::Exception ( __FILE__ , __LINE__ , "Matrix::subset_product: dimension error" ); + } + + SGTELIB::Matrix C("A*B",p,r); + for (int i=0 ; i<p ; i++){ + for (int j=0 ; j<r ; j++){ + for (int k=0 ; k<q ; k++){ + C._X[i][j] += A._X[i][k]*B._X[k][j]; + } + } + } + return C; + +}// + +/*---------------------------*/ +/* Hadamard product */ +/* (Term to term product) */ +/*---------------------------*/ +SGTELIB::Matrix SGTELIB::Matrix::hadamard_product ( const SGTELIB::Matrix & A, + const SGTELIB::Matrix & B ) { + const int nb_rows = A.get_nb_rows(); + const int nb_cols = A.get_nb_cols(); + + if (B.get_nb_rows()!=nb_rows){ + throw SGTELIB::Exception ( __FILE__ , __LINE__ , "Matrix::hadamard_product(A,B): dimension error" ); + } + if (B.get_nb_cols()!=nb_cols){ + throw SGTELIB::Exception ( __FILE__ , __LINE__ , "Matrix::hadamard_product(A,B): dimension error" ); + } + + // Init matrix + SGTELIB::Matrix C(A.get_name()+".*"+B.get_name(),nb_rows,nb_cols); + + // Compute + int i,j; + for ( i = 0 ; i < nb_rows ; ++i ) { + for ( j = 0 ; j < nb_cols ; ++j ){ + C.set(i,j,A.get(i,j)*B.get(i,j)); + } + } + return C; +}// + +/*---------------------------*/ +/* Hadamard square */ +/* (Term to term square) */ +/*---------------------------*/ +SGTELIB::Matrix SGTELIB::Matrix::hadamard_square ( const SGTELIB::Matrix & A ) { + const int nb_rows = A.get_nb_rows(); + const int nb_cols = A.get_nb_cols(); + + // Init matrix + SGTELIB::Matrix C("("+A.get_name()+").^2",nb_rows,nb_cols); + + // Compute + int i,j; + double a; + for ( i = 0 ; i < nb_rows ; ++i ) { + for ( j = 0 ; j < nb_cols ; ++j ){ + a = A._X[i][j]; + C._X[i][j] = a*a; + } + } + return C; +}// + +/*---------------------------*/ +/* Hadamard square */ +/* (Term to term square) */ +/*---------------------------*/ +void SGTELIB::Matrix::hadamard_square ( void ) { + // change name + _name = "("+_name+").^2"; + // Compute + int i,j; + for ( i = 0 ; i < _nbRows ; ++i ) { + for ( j = 0 ; j < _nbCols ; ++j ){ + _X[i][j] *= _X[i][j]; + } + } +}// + +/*---------------------------*/ +/* Hadamard inverse */ +/* (Term to term inverse) */ +/*---------------------------*/ +void SGTELIB::Matrix::hadamard_inverse ( void ) { + // change name + _name = "("+_name+").^-1"; + // Compute + int i,j; + for ( i = 0 ; i < _nbRows ; ++i ) { + for ( j = 0 ; j < _nbCols ; ++j ){ + _X[i][j] = 1/_X[i][j]; + } + } +}// + +/*---------------------------*/ +/* Hadamard sqrt */ +/* (Term to term sqrt) */ +/*---------------------------*/ +SGTELIB::Matrix SGTELIB::Matrix::hadamard_sqrt ( const SGTELIB::Matrix & A ) { + const int nb_rows = A.get_nb_rows(); + const int nb_cols = A.get_nb_cols(); + + // Init matrix + SGTELIB::Matrix C("sqrt("+A.get_name()+")",nb_rows,nb_cols); + + // Compute + int i,j; + for ( i = 0 ; i < nb_rows ; ++i ) { + for ( j = 0 ; j < nb_cols ; ++j ){ + C._X[i][j] = sqrt(fabs(A._X[i][j])); + } + } + return C; +}// + +/*---------------------------*/ +/* Hadamard power */ +/*---------------------------*/ +SGTELIB::Matrix SGTELIB::Matrix::hadamard_power ( const SGTELIB::Matrix & A , const double e ) { + + if (e==1.0) return A; + + const int nb_rows = A.get_nb_rows(); + const int nb_cols = A.get_nb_cols(); + + // Init matrix + SGTELIB::Matrix C("pow("+A.get_name()+","+dtos(e)+")",nb_rows,nb_cols); + + // Compute + int i,j; + for ( i = 0 ; i < nb_rows ; ++i ) { + for ( j = 0 ; j < nb_cols ; ++j ){ + C._X[i][j] = pow(A._X[i][j],e); + } + } + return C; +}// + +/*---------------------------*/ +/* Hadamard sqrt */ +/* (Term to term sqrt) */ +/*---------------------------*/ +void SGTELIB::Matrix::hadamard_sqrt ( void ) { + // change name + _name = "sqrt("+_name+")"; + // Compute + int i,j; + for ( i = 0 ; i < _nbRows ; ++i ) { + for ( j = 0 ; j < _nbCols ; ++j ){ + _X[i][j] = sqrt(fabs(_X[i][j])); + } + } +}// + +/*---------------------------------------*/ +/* diagA_product */ +/* Product A*B, considering */ +/* that A is diag (no verif on this) */ +/*---------------------------------------*/ +SGTELIB::Matrix SGTELIB::Matrix::diagA_product ( const SGTELIB::Matrix & A, + const SGTELIB::Matrix & B ) { + + // Init matrix + const int na = A.get_nb_rows(); + const int ma = A.get_nb_cols(); + const int n = B.get_nb_rows(); + const int m = B.get_nb_cols(); + SGTELIB::Matrix C(A.get_name()+"*"+B.get_name(),n,m); + + int i,j; + double Aii; + + if ( (na==ma) || (ma==n) ){ + // A is square, use the diag terms + for ( i = 0 ; i < n ; i++ ) { + Aii = A._X[i][i]; + for ( j = 0 ; j < m ; j++ ) { + C._X[i][j] = Aii*B._X[i][j]; + } + } + return C; + } + else if ( (na==1) && (ma==n) ){ + // A is a line vector + for ( i = 0 ; i < n ; i++ ) { + Aii = A._X[0][i]; + for ( j = 0 ; j < m ; j++ ) { + C._X[i][j] = Aii*B._X[i][j]; + } + } + return C; + } + else if ( (na==n) && (ma==1) ){ + // A is a col vector + for ( i = 0 ; i < n ; i++ ) { + Aii = A._X[i][0]; + for ( j = 0 ; j < m ; j++ ) { + C._X[i][j] = Aii*B._X[i][j]; + } + } + return C; + } + else { + std::cout << "A (" << A.get_name() << ") : " << A.get_nb_rows() << " , " << A.get_nb_cols() << "\n"; + std::cout << "B (" << B.get_name() << ") : " << B.get_nb_rows() << " , " << B.get_nb_cols() << "\n"; + throw SGTELIB::Exception ( __FILE__ , __LINE__ , "Matrix::diagA_product(A,B): dimension error" ); + } + +}// + +/*---------------------------------------*/ +/* diagB_product */ +/* Product A*B, considering */ +/* that B is diag (no verif on this) */ +/*---------------------------------------*/ +SGTELIB::Matrix SGTELIB::Matrix::diagB_product ( const SGTELIB::Matrix & A, + const SGTELIB::Matrix & B ) { + + // Init matrix + const int n = A.get_nb_rows(); + const int m = A.get_nb_cols(); + const int nb = B.get_nb_rows(); + const int mb = B.get_nb_cols(); + SGTELIB::Matrix C(A.get_name()+"*"+B.get_name(),n,m); + + int i,j; + double Bjj; + + if ( (nb==mb) && (mb==n) ){ + // B is square, use the diag terms + for ( j = 0 ; j < m ; j++ ) { + Bjj = B._X[j][j]; + for ( i = 0 ; i < n ; i++ ) { + C._X[i][j] = A._X[i][j]*Bjj; + } + } + return C; + } + else if ( (nb==1) && (mb==m) ){ + // B is a line vector + for ( j = 0 ; j < m ; j++ ) { + Bjj = B._X[0][j]; + for ( i = 0 ; i < n ; i++ ) { + C._X[i][j] = A._X[i][j]*Bjj; + } + } + return C; + } + else if ( (nb==m) && (mb==1) ){ + // B is a col vector + for ( j = 0 ; j < m ; j++ ) { + Bjj = B._X[j][0]; + for ( i = 0 ; i < n ; i++ ) { + C._X[i][j] = A._X[i][j]*Bjj; + } + } + return C; + } + else { + std::cout << "A (" << A.get_name() << ") : " << A.get_nb_rows() << " , " << A.get_nb_cols() << "\n"; + std::cout << "B (" << B.get_name() << ") : " << B.get_nb_rows() << " , " << B.get_nb_cols() << "\n"; + throw SGTELIB::Exception ( __FILE__ , __LINE__ , "Matrix::diagB_product(A,B): dimension error" ); + } +}// + + +/*-------------------------------------*/ +/* transposeA_product */ +/* Product A'*B */ +/*-------------------------------------*/ +SGTELIB::Matrix SGTELIB::Matrix::transposeA_product ( const SGTELIB::Matrix & A, + const SGTELIB::Matrix & B ) { + + if (A.get_nb_rows()!=B.get_nb_rows()){ + throw SGTELIB::Exception ( __FILE__ , __LINE__ , "Matrix::transposeA_product(A,B): dimension error" ); + } + + // Init matrix + SGTELIB::Matrix C(A.get_name()+"'*"+B.get_name(),A.get_nb_cols(),B.get_nb_cols()); + + // Compute + int i,j,k; + const int nb_rows = C.get_nb_rows(); + const int nb_cols = C.get_nb_cols(); + const int nb_inter= A.get_nb_rows(); + //double v; + for ( i = 0 ; i < nb_rows ; ++i ) { + for ( j = 0 ; j < nb_cols ; ++j ){ + C._X[i][j] = 0; + for ( k = 0 ; k < nb_inter; ++k ){ + C._X[i][j] += A._X[k][i]*B._X[k][j]; + } + } + } + return C; + +}// + + + +/*---------------------------*/ +/* get matrix P */ +/* P = I - H*Ai*H' */ +/*---------------------------*/ +SGTELIB::Matrix SGTELIB::Matrix::get_matrix_P ( const SGTELIB::Matrix & Ai, + const SGTELIB::Matrix & H ){ + const int p = H.get_nb_rows(); + std::cout << "Function get_matrix_P should be avoided !!\n"; + return identity(p) - (H * Ai * H.transpose()); +}// + +/*---------------------------*/ +/* compute P*Zs */ +/* where P = I - H*Ai*H' */ +/*---------------------------*/ +SGTELIB::Matrix SGTELIB::Matrix::get_matrix_PZs ( const SGTELIB::Matrix & Ai, + const SGTELIB::Matrix & H , + const SGTELIB::Matrix & Zs){ + //return Zs - H * Ai * H' * Zs; + return Zs - (H * Ai) * transposeA_product(H,Zs); +}// + +/*---------------------------*/ +/* get matrix dPi */ +/* dPi = diag(P)^-1 */ +/*---------------------------*/ +SGTELIB::Matrix SGTELIB::Matrix::get_matrix_dPi ( const SGTELIB::Matrix & Ai, + const SGTELIB::Matrix & H ){ + const int p = H.get_nb_rows(); + SGTELIB::Matrix dPi ("dPi",p,p); + SGTELIB::Matrix h; + double v; + + for ( int i = 0 ; i < p ; ++i ) { + h = H.get_row(i); + v = (h*Ai*h.transpose()).get(0,0); + v = 1.0/( 1.0 - v ); + dPi.set(i,i,v); + } + return dPi; +}// + +/*---------------------------*/ +/* compute dPi*P*Zs */ +/* where P = I - H*Ai*H' */ +/*---------------------------*/ +SGTELIB::Matrix SGTELIB::Matrix::get_matrix_dPiPZs ( const SGTELIB::Matrix & Ai, + const SGTELIB::Matrix & H , + const SGTELIB::Matrix & Zs){ + + const SGTELIB::Matrix HAi = H*Ai; + //SGTELIB::Matrix dPiPZs = Zs - HAi * (H.transpose()*Zs); + SGTELIB::Matrix dPiPZs = Zs - HAi * transposeA_product(H,Zs); + + // Take dPi into account + const int p = H.get_nb_rows(); + const int q = H.get_nb_cols(); + double v; + int i,j; + for ( i = 0 ; i < p ; i++ ) { + v = 0; + for ( j = 0 ; j < q ; j++) v += HAi._X[i][j]*H._X[i][j]; + v = 1.0/( 1.0 - v ); + dPiPZs.multiply_row ( v , i ); + } + + return dPiPZs; +}// + +/*---------------------------*/ +/* compute dPi*P*Zs */ +/* where P = I - H*Ai*H' */ +/*---------------------------*/ +SGTELIB::Matrix SGTELIB::Matrix::get_matrix_dPiPZs ( const SGTELIB::Matrix & Ai, + const SGTELIB::Matrix & H , + const SGTELIB::Matrix & Zs, + const SGTELIB::Matrix & ALPHA){ + + const SGTELIB::Matrix HAi = H*Ai; + //SGTELIB::Matrix dPiPZs = Zs - HAi * (H.transpose()*Zs); + SGTELIB::Matrix dPiPZs = Zs - H*ALPHA; + + // Take dPi into account + const int p = H.get_nb_rows(); + const int q = H.get_nb_cols(); + double v; + int i,j; + for ( i = 0 ; i < p ; i++ ) { + v = 0; + for ( j = 0 ; j < q ; j++) v += HAi._X[i][j]*H._X[i][j]; + v = 1.0/( 1.0 - v ); + dPiPZs.multiply_row ( v , i ); + } + + return dPiPZs; +}// + + + + +/*---------------------------*/ +/* get trace P */ +/*---------------------------*/ +double SGTELIB::Matrix::get_trace_P ( const SGTELIB::Matrix & Ai, + const SGTELIB::Matrix & H ){ + const int p = H.get_nb_rows(); + SGTELIB::Matrix h; + double v; + double trace = 0; + + for ( int i = 0 ; i < p ; ++i ) { + h = H.get_row(i); + v = (h*Ai*h.transpose()).get(0,0); + trace += v; + } + return trace; +}// + +/*---------------------------*/ +/* addition */ +/*---------------------------*/ +SGTELIB::Matrix SGTELIB::Matrix::add ( const SGTELIB::Matrix & A, + const SGTELIB::Matrix & B ) { + + if (A.get_nb_cols()!=B.get_nb_cols()){ + throw SGTELIB::Exception ( __FILE__ , __LINE__ , + "Matrix::add(A,B): dimension error" ); + } + if (A.get_nb_rows()!=B.get_nb_rows()){ + throw SGTELIB::Exception ( __FILE__ , __LINE__ , + "Matrix::add(A,B): dimension error" ); + } + + const int nb_rows = A.get_nb_rows(); + const int nb_cols = A.get_nb_cols(); + + // Init matrix + SGTELIB::Matrix C(A.get_name()+"+"+B.get_name(),nb_rows,nb_cols); + + // Compute + int i,j; + for ( i = 0 ; i < nb_rows ; ++i ) { + for ( j = 0 ; j < nb_cols ; ++j ){ + C._X[i][j] = A._X[i][j]+B._X[i][j]; + } + } + return C; +}// + +/*---------------------------*/ +/* addition */ +/*---------------------------*/ +void SGTELIB::Matrix::add ( const SGTELIB::Matrix & B ) { + + if ( _nbCols != B.get_nb_cols() ){ + throw SGTELIB::Exception ( __FILE__ , __LINE__ ,"Matrix::add(B): dimension error" ); + } + if ( _nbRows != B.get_nb_rows() ){ + throw SGTELIB::Exception ( __FILE__ , __LINE__ ,"Matrix::add(B): dimension error" ); + } + + // Compute + int i,j; + for ( i = 0 ; i < _nbRows ; ++i ) { + for ( j = 0 ; j < _nbCols ; ++j ){ + _X[i][j] += B.get(i,j); + } + } +}// + +/*---------------------------*/ +/* add and fill with 0 */ +/*---------------------------*/ +SGTELIB::Matrix SGTELIB::Matrix::add_fill ( const SGTELIB::Matrix & A, + const SGTELIB::Matrix & B ) { + + const int nb_rows = std::max(A.get_nb_rows(),B.get_nb_rows()); + const int nb_cols = std::max(A.get_nb_cols(),B.get_nb_cols()); + + // Init matrix + SGTELIB::Matrix C(A.get_name()+"+"+B.get_name(),nb_rows,nb_cols); + + // Compute + int i,j; + for ( i = 0 ; i < A.get_nb_rows() ; ++i ) { + for ( j = 0 ; j < A.get_nb_cols() ; ++j ){ + C._X[i][j] = A._X[i][j]; + } + } + for ( i = 0 ; i < B.get_nb_rows() ; ++i ) { + for ( j = 0 ; j < B.get_nb_cols() ; ++j ){ + C._X[i][j] += B._X[i][j]; + } + } + return C; +}// + +/*---------------------------*/ +/* substraction */ +/*---------------------------*/ +SGTELIB::Matrix SGTELIB::Matrix::sub ( const SGTELIB::Matrix & A, + const SGTELIB::Matrix & B ) { + + if (A.get_nb_cols()!=B.get_nb_cols()){ + throw SGTELIB::Exception ( __FILE__ , __LINE__ , + "Matrix::sub(A,B): dimension error" ); + } + if (A.get_nb_rows()!=B.get_nb_rows()){ + throw SGTELIB::Exception ( __FILE__ , __LINE__ , + "Matrix::sub(A,B): dimension error" ); + } + + int nb_rows = A.get_nb_rows(); + int nb_cols = A.get_nb_cols(); + + // Init matrix + SGTELIB::Matrix C(A.get_name()+"-"+B.get_name(),nb_rows,nb_cols); + + // Compute + int i,j; + for ( i = 0 ; i < nb_rows ; ++i ) { + for ( j = 0 ; j < nb_cols ; ++j ){ + C.set(i,j,A.get(i,j)-B.get(i,j)); + } + } + return C; +}// + +/*---------------------------*/ +/* substraction */ +/*---------------------------*/ +void SGTELIB::Matrix::sub ( const SGTELIB::Matrix & B ) { + + if ( _nbCols != B.get_nb_cols() ){ + throw SGTELIB::Exception ( __FILE__ , __LINE__ ,"Matrix::sub(B): dimension error" ); + } + if ( _nbRows != B.get_nb_rows() ){ + throw SGTELIB::Exception ( __FILE__ , __LINE__ ,"Matrix::sub(B): dimension error" ); + } + + // Compute + int i,j; + for ( i = 0 ; i < _nbRows ; ++i ) { + for ( j = 0 ; j < _nbCols ; ++j ){ + _X[i][j] -= B._X[i][j]; + } + } +}// + +/*---------------------------*/ +/* identity */ +/*---------------------------*/ +SGTELIB::Matrix SGTELIB::Matrix::identity ( const int n ) { + + // Init matrix + SGTELIB::Matrix I("I",n,n); + // Fill with 0.0 + I.fill(0.0); + // Put one on the diag + for ( int i = 0 ; i < n ; ++i ) { + I.set(i,i,1.0); + } + return I; +}// + +/*---------------------------*/ +/* ones */ +/*---------------------------*/ +SGTELIB::Matrix SGTELIB::Matrix::ones ( const int nbRows , const int nbCols ) { + // Init matrix + SGTELIB::Matrix matrixOnes("Ones",nbRows,nbCols); + // Fill with 1.0 + matrixOnes.fill(1.0); + return matrixOnes; +}// + +/*---------------------------*/ +/* random permutation matrix */ +/*---------------------------*/ +// Create a square matrix of size nbCols, with one 1.0 randomly +// placed in each col and in each row +SGTELIB::Matrix SGTELIB::Matrix::random_permutation_matrix ( const int n ) { + // Init matrix + SGTELIB::Matrix perm("perm",n,n); + + // Create random integer permutation + std::vector<int> v; + + // Create order vector + for (int i=0; i<n; ++i) v.push_back(i); // 1 2 3 4 5 6 7 8 9 + + // shuffle + std::random_shuffle ( v.begin(), v.end() ); + + // Fill matrix + for (int i=0; i<n; ++i) perm.set(i,v.at(i),1.0); + + return perm; +}// + +/*---------------------------*/ +/* rank */ +/*---------------------------*/ +SGTELIB::Matrix SGTELIB::Matrix::rank ( void ) const { + + // TODO: use faster method... + if ((_nbRows>1) && (_nbCols>1)) + throw SGTELIB::Exception ( __FILE__ , __LINE__ ,"Matrix::rank: dimension error" ); + + SGTELIB::Matrix R; + if (_nbRows>1){ + R = this->transpose().rank(); + R = R.transpose(); + } + else{ + const int m = _nbCols; + SGTELIB::Matrix D = *this; + R = SGTELIB::Matrix("R",1,m); + double dmin; + int i,j,jmin=0; + for (i=0 ; i<m ; i++){ + dmin = +INF; + for (j=0 ; j<m ; j++){ + if (D._X[0][j]<dmin){ + jmin = j; + dmin = D._X[0][j]; + } + } + R.set(0,jmin,double(i)); + D.set(0,jmin,INF); + } + } + return R; +}// + +/*---------------------------*/ +/* Trace */ +/*---------------------------*/ +double SGTELIB::Matrix::trace ( void ) const{ + int min_nm = std::min(_nbCols,_nbRows); + double v = 0; + for (int i=0 ; i<min_nm ; i++){ + // get diagonal term + v += get(i,i); + } + return v; +}// + +/*---------------------------*/ +/* Rmse */ +/*---------------------------*/ +double SGTELIB::Matrix::rmse ( void ) const{ + double v = 0; + + // Compute + int i,j; + double xij; + for ( i = 0 ; i < _nbRows ; ++i ) { + for ( j = 0 ; j < _nbCols ; ++j ){ + xij = _X[i][j]; + v += xij*xij; + } + } + v /= _nbRows * _nbCols; + v = sqrt(v); + return v; +}// + +/*---------------------------*/ +/* norm */ +/*---------------------------*/ +double SGTELIB::Matrix::normsquare ( void ) const{ + double v = 0; + // Compute + int i,j; + double xij; + for ( i = 0 ; i < _nbRows ; ++i ) { + for ( j = 0 ; j < _nbCols ; ++j ){ + xij = _X[i][j]; + v += xij*xij; + } + } + return v; +}// + +/*----------------------------------------*/ +/* normalize_cols */ +/* Normalizes each column so that the sum */ +/* of the terms on this column is 1 */ +/*----------------------------------------*/ +void SGTELIB::Matrix::normalize_cols ( void ){ + int i,j; + double d; + for ( j = 0 ; j < _nbCols ; ++j ){ + d = 0; + + for ( i = 0 ; i < _nbRows ; ++i ) + d += _X[i][j]; + + if (d==0){ + for ( i = 0 ; i < _nbRows ; ++i ) + _X[i][j] = 1/_nbRows; + } + else{ + for ( i = 0 ; i < _nbRows ; ++i ) + _X[i][j] /= d; + } + } +}// + + + +/*---------------------------*/ +/* square norm */ +/*---------------------------*/ +double SGTELIB::Matrix::norm ( void ) const{ + return sqrt(normsquare()); +}// + +/*---------------------------*/ +/* sum */ +/*---------------------------*/ +double SGTELIB::Matrix::sum ( void ) const{ + double v = 0; + + // Compute + int i,j; + for ( i = 0 ; i < _nbRows ; ++i ) { + for ( j = 0 ; j < _nbCols ; ++j ){ + v += _X[i][j]; + } + } + return v; +}// + +/*-------------------------------------------------*/ +/* sum */ +/* Sum the element along one of the two directions */ +/* direction == 1 => return the sum for each row */ +/* direction == 2 => return the sum for each col */ +/*-------------------------------------------------*/ +SGTELIB::Matrix SGTELIB::Matrix::sum ( const int direction ) const{ + + double v; + int i,j; + + if (direction == 1){ + SGTELIB::Matrix S ("S",1,_nbCols); + for ( j = 0 ; j < _nbCols ; ++j ){ + v = 0; + for ( i = 0 ; i < _nbRows ; ++i ) { + v += _X[i][j]; + } + S._X[0][j] = v; + } + return S; + } + else if (direction == 2){ + SGTELIB::Matrix S ("S",_nbRows,1); + for ( i = 0 ; i < _nbRows ; ++i ) { + v = 0; + for ( j = 0 ; j < _nbCols ; ++j ){ + v += _X[i][j]; + } + S._X[i][0] = v; + } + return S; + } + else{ + throw SGTELIB::Exception ( __FILE__ , __LINE__ , + "Matrix::sum(direction): direction must be 1 or 2" ); + } +}// + +/*---------------------------*/ +/* mean */ +/*---------------------------*/ +double SGTELIB::Matrix::mean ( void ) const{ + return sum()/(_nbRows*_nbCols); +}// + +/*---------------------------*/ +/* count */ +/* Number of non null values */ +/*---------------------------*/ +int SGTELIB::Matrix::count ( void ) const{ + int v = 0; + + // Compute + int i,j; + const int nb_rows = get_nb_rows(); + const int nb_cols = get_nb_cols(); + for ( i = 0 ; i < nb_rows ; ++i ) { + for ( j = 0 ; j < nb_cols ; ++j ){ + v += (fabs(_X[i][j])>EPSILON)? 1:0 ; + } + } + return v; +}// + +/*---------------------------*/ +/* Diag inverse */ +/*---------------------------*/ +SGTELIB::Matrix SGTELIB::Matrix::diag_inverse ( void ) const{ + // Return a new matrix such that: + // Non diagonal terms are null + // Diagonal terms are the inverse of the original ones. + // Works for square and non-square matrices. + // + // Does not work if a diag term is 0. + + // New matrix + SGTELIB::Matrix DI("diag("+_name+")^-1",_nbCols,_nbRows); + // nb: this constructor initializes the matrix to 0.0 + + const int min_nm = std::min(_nbCols,_nbRows); + + double v = 0; + for (int i=0 ; i<min_nm ; i++){ + // get diagonal term + v = get(i,i); + DI.set(i,i,1/v); + } + return DI; +}// + +/*------------------------------------------------*/ +/* solve linear system with conjugate gradient */ +/*------------------------------------------------*/ +SGTELIB::Matrix SGTELIB::Matrix::conjugate_solve ( const SGTELIB::Matrix & A , + const SGTELIB::Matrix & b , + const SGTELIB::Matrix & x0 , + const double tol) { + + const int n = x0.get_nb_rows(); + SGTELIB::Matrix x = x0; + SGTELIB::Matrix r = b-A*x; + double rr = r.normsquare(); + SGTELIB::Matrix p = r; + SGTELIB::Matrix Ap; + double rr_old,alpha,pAp; + int iter = 0; + while (iter < 100){ + Ap = A*p; + pAp = 0; + for (int i=0 ; i<n ; i++) pAp += p._X[i][0]*Ap._X[i][0]; + alpha = rr/pAp; + x = x+alpha*p; + rr_old = rr; + r = r-alpha*Ap; + rr = r.normsquare(); + if (rr < tol) break; + p = r + (rr/rr_old)*p; + + Ap.set_name("Ap"); + x.set_name("x"); + r.set_name("r"); + p.set_name("p"); + } + return x; +}// + +/*---------------------------*/ +/* cholesky decomposition */ +/*---------------------------*/ +SGTELIB::Matrix SGTELIB::Matrix::cholesky ( void ) const { + + if (get_nb_rows()!=get_nb_cols()){ + throw SGTELIB::Exception ( __FILE__ , __LINE__ , + "Matrix::cholesky(): dimension error" ); + } + + const int n = get_nb_rows(); + SGTELIB::Matrix L ("L",n,n); + + double s; + int i,j,k; + for (i = 0; i < n; i++) { + for (j = 0; j < (i+1); j++) { + s = 0; + for (k = 0; k < j; k++){ + s += L._X[i][k] * L._X[j][k]; + } + L._X[i][j] = (i == j) ? + sqrt(_X[i][i] - s) : + (1.0 / L._X[j][j] * (_X[i][j] - s)); + } + } + return L; +}// + +/*---------------------------*/ +/* cholesky inverse */ +/*---------------------------*/ +SGTELIB::Matrix SGTELIB::Matrix::cholesky_inverse ( void ) const { + return cholesky_inverse(NULL); +} + + +SGTELIB::Matrix SGTELIB::Matrix::cholesky_inverse ( double * det ) const { + SGTELIB::Matrix L = cholesky(); + SGTELIB::Matrix Li = tril_inverse(L); + + const int n = _nbRows; + + // Compute A = Li'*Li + // Note: by taking into account the fact that Li is tri inf, + // It is possible to divide the cost of the computation + // of Li'*Li by 3. + SGTELIB::Matrix A ("A",n,n); + int i,j,k,kmin; + for (i=0 ; i<n ; i++){ + for (j=0 ; j<n ; j++){ + A._X[i][j] = 0; + kmin = std::max(i,j); + for (k=kmin ; k<n ; k++){ + A._X[i][j] += Li._X[k][i]*Li._X[k][j]; + } + } + } + + if (det){ + double v = 1; + for (i=0 ; i<n ; i++) v *= L._X[i][i]; + v *= v; + if ( isnan(v)) v=+INF; + *det = v; + } + + return A; +}// + +/*-----------------------------------------*/ +/* Solve Upper Triangular Linear system */ +/*-----------------------------------------*/ +SGTELIB::Matrix SGTELIB::Matrix::triu_solve( const SGTELIB::Matrix & U , + const SGTELIB::Matrix & b ){ + const int n = U.get_nb_rows(); + if (n!=U.get_nb_cols()){ + throw SGTELIB::Exception ( __FILE__ , __LINE__ , + "Matrix::triu_solve(): dimension error" ); + } + if (n!=b.get_nb_rows()){ + throw SGTELIB::Exception ( __FILE__ , __LINE__ , + "Matrix::triu_solve(): dimension error" ); + } + if (1!=b.get_nb_cols()){ + throw SGTELIB::Exception ( __FILE__ , __LINE__ , + "Matrix::triu_solve(): dimension error" ); + } + + SGTELIB::Matrix x = b; + + for (int i=n-1 ; i>=0 ; i--){ + for (int j=i+1 ; j<n ; j++){ + x._X[i][0] -= U._X[i][j]*x._X[j][0]; + } + x._X[i][0] /= U._X[i][i]; + } + + return x; +}// + +/*-----------------------------------------*/ +/* Inverse Lower Triangular Matrix */ +/*-----------------------------------------*/ +SGTELIB::Matrix SGTELIB::Matrix::tril_inverse( const SGTELIB::Matrix & L ){ + const int n = L.get_nb_rows(); + SGTELIB::Matrix Li = L; + SGTELIB::Matrix b ("b",n,1); + + for (int i=0 ; i<n ; i++){ + b.set(i,0,1.0); + Li.set_col( SGTELIB::Matrix::tril_solve(L,b) , i); + b.set(i,0,0.0); + } + + return Li; +}// + +/*-----------------------------------------*/ +/* Solve Lower Triangular Linear system */ +/*-----------------------------------------*/ +SGTELIB::Matrix SGTELIB::Matrix::tril_solve( const SGTELIB::Matrix & L , + const SGTELIB::Matrix & b ){ + const int n = L.get_nb_rows(); + if (n!=L.get_nb_cols()){ + throw SGTELIB::Exception ( __FILE__ , __LINE__ , + "Matrix::tril_solve(): dimension error" ); + } + if (n!=b.get_nb_rows()){ + throw SGTELIB::Exception ( __FILE__ , __LINE__ , + "Matrix::tril_solve(): dimension error" ); + } + if (1!=b.get_nb_cols()){ + throw SGTELIB::Exception ( __FILE__ , __LINE__ , + "Matrix::tril_solve(): dimension error" ); + } + + SGTELIB::Matrix x = b; + + for (int i=0 ; i<n ; i++){ + for (int j=0 ; j<i ; j++){ + x._X[i][0] -= L._X[i][j]*x._X[j][0]; + } + x._X[i][0] /= L._X[i][i]; + } + + return x; +}// + +/*-----------------------------------------*/ +/* Solve System with Cholesky */ +/*-----------------------------------------*/ +SGTELIB::Matrix SGTELIB::Matrix::cholesky_solve ( const SGTELIB::Matrix & A , + const SGTELIB::Matrix & b ) { + SGTELIB::Matrix L = A.cholesky(); + SGTELIB::Matrix y = tril_solve(L,b); + SGTELIB::Matrix x = triu_solve(L.transpose(),y); + return x; +}// + +/*---------------------------*/ +/* SVD inverse */ +/*---------------------------*/ +SGTELIB::Matrix SGTELIB::Matrix::SVD_inverse ( void ) const { + + if (get_nb_rows()!=get_nb_cols()){ + throw SGTELIB::Exception ( __FILE__ , __LINE__ , + "Matrix::SVD_inverse(): dimension error" ); + } + + // Init SVD matrices + SGTELIB::Matrix * U; + SGTELIB::Matrix * W; + SGTELIB::Matrix * V; + + // Perform SVD + std::string error_msg; + SVD_decomposition ( error_msg , U, W, V, 1000000000 ); + + // Inverse diag terms of W. + for (int i=0 ; i<W->get_nb_rows() ; i++){ + W->set(i,i,1/W->get(i,i)); + } + + *U = U->transpose(); + SGTELIB::Matrix INVERSE (product ( *V , *W , *U )); + INVERSE.set_name("inv("+_name+")"); + delete V; + delete W; + delete U; + return INVERSE; +}// + +/*---------------------------*/ +/* transpose */ +/*---------------------------*/ +SGTELIB::Matrix SGTELIB::Matrix::transpose ( void ) const{ + SGTELIB::Matrix A (_name+"'",_nbCols,_nbRows); + for (int i=0 ; i<_nbCols ; i++){ + for (int j=0 ; j<_nbRows ; j++){ + A.set(i,j,_X[j][i]); + } + } + return A; +}// + +/*---------------------------*/ +/* diag */ +/*---------------------------*/ +SGTELIB::Matrix SGTELIB::Matrix::diag ( void ) const{ + + SGTELIB::Matrix A; + if (_nbCols==_nbRows){ + A = SGTELIB::Matrix("A",_nbRows,1); + for (int i=0 ; i<_nbCols ; i++) A.set(i,0,_X[i][i]); + } + else if ( (_nbCols==1) || (_nbRows==1) ){ + const int n=std::max(_nbCols,_nbRows); + A = SGTELIB::Matrix("A",_nbRows,1); + for (int i=0 ; i<n ; i++) A.set(i,i,get(i)); + } + else{ + throw SGTELIB::Exception ( __FILE__ , __LINE__ ,"Matrix::diag(): dimension error" ); + } + + A.set_name("diag("+_name+")"); + return A; +}// + +/*--------------------------------------------------------------*/ +/* SVD decomposition */ +/* inspired and recoded from an old numerical recipes version */ +/*--------------------------------------------------------------*/ +/* */ +/* M = U . W . V' (M: current matrix object) */ +/* */ +/* M ( nbRows x nbCols ) */ +/* U ( nbRows x nbCols ) */ +/* W ( nbCols x nbCols ) */ +/* V ( nbCols x nbCols ) */ +/* */ +/* U.U' = U'.U = I if nbRows = nbCols */ +/* U'.U = I if nbRows > nbCols */ +/* */ +/* V.V' = V'.V = I */ +/* */ +/* W diagonal, given as a size-nbCols vector */ +/* */ +/* V is given, not V' */ +/* */ +/*--------------------------------------------------------------*/ + +bool SGTELIB::Matrix::SVD_decomposition ( std::string & error_msg , + SGTELIB::Matrix *& MAT_U, // OUT, nbRows x nbCols + SGTELIB::Matrix *& MAT_W, // OUT, nbCols x nbCols, diagonal + SGTELIB::Matrix *& MAT_V, // OUT, nbCols x nbCols + int max_mpn ) const { + + // Dimension + const int nbRows = _nbRows; + const int nbCols = _nbCols; + + // init matrices for SVD + double ** U = new double *[nbRows]; + double * W = new double [nbCols]; + double ** V = new double *[nbCols]; + for (int i = 0 ; i < nbCols ; ++i ) { + U[i] = new double[nbCols]; + V[i] = new double[nbCols]; + } + + // call SVD + bool result; + result = this->SVD_decomposition ( error_msg , U , W , V , max_mpn ); + + // Init matrix for result + MAT_U = new SGTELIB::Matrix ("MAT_U",nbRows,nbCols); + MAT_W = new SGTELIB::Matrix ("MAT_W",nbCols,nbCols); + MAT_V = new SGTELIB::Matrix ("MAT_V",nbCols,nbCols); + + // Fill matrices + for (int i=0 ; i<nbRows ; i++){ + for (int j=0 ; j<nbCols ; j++){ + MAT_U->set(i,j,U[i][j]); + } + } + for (int i=0 ; i<nbCols ; i++){ + for (int j=0 ; j<nbCols ; j++){ + MAT_V->set(i,j,V[i][j]); + MAT_W->set(i,j,0.0); + } + MAT_W->set(i,i,W[i]); + } + + // Delete U, V, W + for (int i=0 ; i<nbRows ; i++){ + delete [] U[i]; + } + delete [] U; + for (int j=0 ; j<nbCols ; j++){ + delete [] V[j]; + } + delete [] V; + delete [] W; + + return result; +}// + +bool SGTELIB::Matrix::SVD_decomposition ( std::string & error_msg , + double ** U , // OUT, nbRows x nbCols + double * W , // OUT, nbCols x nbCols, diagonal + double ** V , // OUT, nbCols x nbCols + int max_mpn ) const { + const int nbRows = _nbRows; + const int nbCols = _nbCols; + + error_msg.clear(); + + if ( max_mpn > 0 && nbRows+nbCols > max_mpn ) { + error_msg = "SVD_decomposition() error: nbRows+nbCols > " + SGTELIB::itos ( max_mpn ); + return false; + } + + double * rv1 = new double[nbCols]; + double scale = 0.0; + double g = 0.0; + double norm = 0.0; + + int nm1 = nbCols - 1; + + bool flag; + int i , j , k , l = 0 , its , jj , nm = 0; + double s , f , h , tmp , c , x , y , z , absf , absg , absh; + + const int NITER = 30; + + // copy the current matrix into U: + for ( i = 0 ; i < nbRows ; ++i ) + for ( j = 0 ; j < nbCols ; ++j ) + U[i][j] = _X[i][j]; + + // Householder reduction to bidiagonal form: + for ( i = 0 ; i < nbCols ; ++i ) { + l = i + 1; + rv1[i] = scale * g; + g = s = scale = 0.0; + if ( i < nbRows ) { + for ( k = i ; k < nbRows ; ++k ) + scale += fabs ( U[k][i] ); + if ( scale != 0.0 ) { + for ( k = i ; k < nbRows ; ++k ) { + U[k][i] /= scale; + s += U[k][i] * U[k][i]; + } + f = U[i][i]; + g = ( f >= 0.0 ) ? -fabs(sqrt(s)) : fabs(sqrt(s)); + h = f * g - s; + U[i][i] = f - g; + for ( j = l ; j < nbCols ; ++j ) { + for ( s = 0.0 , k = i ; k < nbRows ; ++k ) + s += U[k][i] * U[k][j]; + f = s / h; + for ( k = i ; k < nbRows ; ++k ) + U[k][j] += f * U[k][i]; + } + for ( k = i ; k < nbRows ; ++k ) + U[k][i] *= scale; + } + } + W[i] = scale * g; + g = s = scale = 0.0; + if ( i < nbRows && i != nm1 ) { + for ( k = l ; k < nbCols ; ++k ) + scale += fabs ( U[i][k] ); + if ( scale != 0.0 ) { + for ( k = l ; k < nbCols ; ++k ) { + U[i][k] /= scale; + s += U[i][k] * U[i][k]; + } + f = U[i][l]; + g = ( f >= 0.0 ) ? -fabs(sqrt(s)) : fabs(sqrt(s)); + h = f * g - s; + U[i][l] = f - g; + for ( k = l ; k < nbCols ; ++k ) + rv1[k] = U[i][k] / h; + for ( j = l ; j < nbRows ; ++j ) { + for ( s=0.0,k=l ; k < nbCols ; ++k ) + s += U[j][k] * U[i][k]; + for ( k=l ; k < nbCols ; ++k ) + U[j][k] += s * rv1[k]; + } + for ( k = l ; k < nbCols ; ++k ) + U[i][k] *= scale; + } + } + tmp = fabs ( W[i] ) + fabs ( rv1[i] ); + norm = ( norm > tmp ) ? norm : tmp; + } + + // accumulation of right-hand transformations: + for ( i = nm1 ; i >= 0 ; --i ) { + if ( i < nm1 ) { + if ( g != 0.0 ) { + for ( j = l ; j < nbCols ; ++j ) + V[j][i] = ( U[i][j] / U[i][l] ) / g; + for ( j = l ; j < nbCols ; ++j ) { + for ( s = 0.0 , k = l ; k < nbCols ; ++k ) + s += U[i][k] * V[k][j]; + for ( k = l ; k < nbCols ; ++k ) + V[k][j] += s * V[k][i]; + } + } + for ( j = l ; j < nbCols ; ++j ) + V[i][j] = V[j][i] = 0.0; + } + V[i][i] = 1.0; + g = rv1[i]; + l = i; + } + + // accumulation of left-hand transformations: + for ( i = ( ( nbRows < nbCols ) ? nbRows : nbCols ) - 1 ; i >= 0 ; --i ) { + l = i + 1; + g = W[i]; + for ( j = l ; j < nbCols ; ++j ) + U[i][j] = 0.0; + if ( g != 0.0 ) { + g = 1.0 / g; + for ( j = l ; j < nbCols ; ++j ) { + for ( s = 0.0 , k = l ; k < nbRows ; ++k ) + s += U[k][i] * U[k][j]; + f = ( s / U[i][i] ) * g; + for ( k = i ; k < nbRows ; ++k ) + U[k][j] += f * U[k][i]; + } + for ( j = i ; j < nbRows ; ++j ) + U[j][i] *= g; + } + else + for ( j = i ; j < nbRows ; ++j ) + U[j][i] = 0.0; + ++U[i][i]; + } + + // diagonalization of the bidiagonal form: + for ( k = nm1 ; k >= 0 ; --k ) { + for ( its = 1 ; its <= NITER ; its++ ) { + flag = true; + for ( l = k ; l >= 0 ; l-- ) { + nm = l - 1; + if ( nm < 0 || fabs ( rv1[l]) + norm == norm ) { + flag = false; + break; + } + if ( fabs ( W[nm] ) + norm == norm ) + break; + } + if ( flag ) { + c = 0.0; + s = 1.0; + for ( i = l ; i <= k ; i++ ) { + f = s * rv1[i]; + rv1[i] = c * rv1[i]; + if ( fabs(f) + norm == norm ) + break; + g = W[i]; + + absf = fabs(f); + absg = fabs(g); + h = ( absf > absg ) ? + absf * sqrt ( 1.0 + pow ( absg/absf , 2.0 ) ) : + ( ( absg==0 ) ? 0.0 : absg * sqrt ( 1.0 + pow ( absf/absg , 2.0 ) ) ); + + W[i] = h; + h = 1.0 / h; + c = g * h; + s = -f * h; + for ( j = 0 ; j < nbRows ; ++j ) { + y = U[j][nm]; + z = U[j][ i]; + U[j][nm] = y * c + z * s; + U[j][ i] = z * c - y * s; + } + } + } + z = W[k]; + if ( l == k) { + if ( z < 0.0 ) { + W[k] = -z; + for ( j = 0 ; j < nbCols ; j++ ) + V[j][k] = -V[j][k]; + } + break; // this 'break' is always active if k==0 + } + if ( its == NITER ) { + error_msg = "SVD_decomposition() error: no convergence in " + + SGTELIB::itos ( NITER ) + " iterations"; + delete [] rv1; + return false; + } + x = W[l]; + nm = k - 1; + y = W[nm]; + g = rv1[nm]; + h = rv1[k]; + f = ( (y-z) * (y+z) + (g-h) * (g+h) ) / ( 2.0 * h * y ); + + absf = fabs(f); + g = ( absf > 1.0 ) ? + absf * sqrt ( 1.0 + pow ( 1.0/absf , 2.0 ) ) : + sqrt ( 1.0 + pow ( absf , 2.0 ) ); + + f = ( (x-z) * (x+z) + + h * ( ( y / ( f + ( (f >= 0)? fabs(g) : -fabs(g) ) ) ) - h ) ) / x; + c = s = 1.0; + + for ( j = l ; j <= nm ; ++j ) { + i = j + 1; + g = rv1[i]; + y = W[i]; + h = s * g; + g = c * g; + + absf = fabs(f); + absh = fabs(h); + z = ( absf > absh ) ? + absf * sqrt ( 1.0 + pow ( absh/absf , 2.0 ) ) : + ( ( absh==0 ) ? 0.0 : absh * sqrt ( 1.0 + pow ( absf/absh , 2.0 ) ) ); + + rv1[j] = z; + c = f / z; + s = h / z; + f = x * c + g * s; + g = g * c - x * s; + h = y * s; + y *= c; + for ( jj = 0 ; jj < nbCols ; ++jj ) { + x = V[jj][j]; + z = V[jj][i]; + V[jj][j] = x * c + z * s; + V[jj][i] = z * c - x * s; + } + + absf = fabs(f); + absh = fabs(h); + z = ( absf > absh ) ? + absf * sqrt ( 1.0 + pow ( absh/absf , 2.0 ) ) : + ( ( absh==0 ) ? 0.0 : absh * sqrt ( 1.0 + pow ( absf/absh , 2.0 ) ) ); + + W[j] = z; + + if ( z ) { + z = 1.0 / z; + c = f * z; + s = h * z; + } + f = c * g + s * y; + x = c * y - s * g; + for ( jj = 0 ; jj < nbRows ; ++jj ) { + y = U[jj][j]; + z = U[jj][i]; + U[jj][j] = y * c + z * s; + U[jj][i] = z * c - y * s; + } + } + rv1[l] = 0.0; + rv1[k] = f; + W [k] = x; + } + } + + delete [] rv1; + return true; +}// + +/*--------------------------------*/ +/* is there any NaN in the matrix */ +/*--------------------------------*/ +bool SGTELIB::Matrix::has_nan ( void ) const { + int i , j; + for ( i = 0 ; i < _nbRows ; ++i ){ + for ( j = 0 ; j < _nbCols ; ++j ){ + if ( isnan(_X[i][j])){ + return true; + } + } + } + return false; +}// + +/*--------------------------------*/ +/* is there any NaN in the matrix */ +/*--------------------------------*/ +bool SGTELIB::Matrix::has_inf ( void ) const { + int i , j; + for ( i = 0 ; i < _nbRows ; ++i ){ + for ( j = 0 ; j < _nbCols ; ++j ){ + if ( isinf(_X[i][j])){ + return true; + } + } + } + return false; +}// + +/*--------------------------------*/ +/* is there any NaN in the matrix */ +/*--------------------------------*/ +void SGTELIB::Matrix::replace_nan ( double d ) { + int i , j; + for ( i = 0 ; i < _nbRows ; ++i ){ + for ( j = 0 ; j < _nbCols ; ++j ){ + if ( isnan(_X[i][j])){ + _X[i][j] = d; + } + } + } +}// + +/*-------------------------------------------------*/ +/* return the index of the largest value */ +/*-------------------------------------------------*/ +int SGTELIB::Matrix::get_max_index (void ) { + int i,j,k=0,kmax=0; + double vmax = -SGTELIB::INF; + // We use the same mono-indexation as in matlab: + // 1 4 + // 2 5 + // 3 6 + for ( j = 0 ; j < _nbCols ; ++j ){ + for ( i = 0 ; i < _nbRows ; ++i ){ + if (_X[i][j] > vmax){ + vmax = _X[i][j]; + kmax = k; + } + k++; + } + } + return kmax; +}// + +/*-------------------------------------------------*/ +/* min & max of a matrix */ +/*-------------------------------------------------*/ +double SGTELIB::Matrix::min (void) { + double d = +INF; + int i,j; + for ( j = 0 ; j < _nbCols ; ++j ){ + for ( i = 0 ; i < _nbRows ; ++i ){ + d = std::min(d,_X[i][j]); + } + } + return d; +}// + +double SGTELIB::Matrix::max (void) { + double d = -INF; + int i,j; + for ( j = 0 ; j < _nbCols ; ++j ){ + for ( i = 0 ; i < _nbRows ; ++i ){ + d = std::max(d,_X[i][j]); + } + } + return d; +}// + +/*-------------------------------------------------*/ +/* min and max of two matrices */ +/*-------------------------------------------------*/ +SGTELIB::Matrix SGTELIB::Matrix::max ( const SGTELIB::Matrix & A , + const SGTELIB::Matrix & B ){ + const int nb_rows = A.get_nb_rows(); + const int nb_cols = A.get_nb_cols(); + + if (B.get_nb_rows()!=nb_rows){ + throw SGTELIB::Exception ( __FILE__ , __LINE__ , "Matrix::max(A,B): dimension error" ); + } + if (B.get_nb_cols()!=nb_cols){ + throw SGTELIB::Exception ( __FILE__ , __LINE__ , "Matrix::max(A,B): dimension error" ); + } + + // Init matrix + SGTELIB::Matrix C("max("+A.get_name()+";"+B.get_name()+")",nb_rows,nb_cols); + + // Compute + int i,j; + for ( i = 0 ; i < nb_rows ; ++i ) { + for ( j = 0 ; j < nb_cols ; ++j ){ + C._X[i][j] = std::max( A._X[i][j] , B._X[i][j] ); + } + } + return C; +}// + +SGTELIB::Matrix SGTELIB::Matrix::min ( const SGTELIB::Matrix & A , + const SGTELIB::Matrix & B ){ + const int nb_rows = A.get_nb_rows(); + const int nb_cols = A.get_nb_cols(); + + if (B.get_nb_rows()!=nb_rows){ + throw SGTELIB::Exception ( __FILE__ , __LINE__ , "Matrix::min(A,B): dimension error" ); + } + if (B.get_nb_cols()!=nb_cols){ + throw SGTELIB::Exception ( __FILE__ , __LINE__ , "Matrix::min(A,B): dimension error" ); + } + + // Init matrix + SGTELIB::Matrix C("min("+A.get_name()+";"+B.get_name()+")",nb_rows,nb_cols); + + // Compute + int i,j; + for ( i = 0 ; i < nb_rows ; ++i ) { + for ( j = 0 ; j < nb_cols ; ++j ){ + C._X[i][j] = std::min( A._X[i][j] , B._X[i][j] ); + } + } + return C; +}// + +/*-------------------------------------------------*/ +/* return the index of the smallest value */ +/*-------------------------------------------------*/ +int SGTELIB::Matrix::get_min_index (void ) { + int i,j,k=0,kmin=0; + double vmin = +SGTELIB::INF; + // We use the same mono-indexation as in matlab: + // 1 4 + // 2 5 + // 3 6 + for ( j = 0 ; j < _nbCols ; ++j ){ + for ( i = 0 ; i < _nbRows ; ++i ){ + if (_X[i][j] < vmin){ + vmin = _X[i][j]; + kmin = k; + } + k++; + } + } + return kmin; +}// + +/*-------------------------------------------------*/ +/* return the index of the smallest value on row i */ +/*-------------------------------------------------*/ +int SGTELIB::Matrix::get_min_index_row ( const int i ) { + int j, jmin=0; + double vmin = +SGTELIB::INF; + for ( j = 0 ; j < _nbCols ; ++j ){ + if (_X[i][j] < vmin){ + vmin = _X[i][j]; + jmin = j; + } + } + return jmin; +}// + +/*-------------------------------------------------*/ +/* return the index of the smallest value on row i */ +/*-------------------------------------------------*/ +int SGTELIB::Matrix::get_min_index_col ( const int j ) { + int i, imin=0; + double vmin = +SGTELIB::INF; + for ( i = 0 ; i < _nbRows ; ++i ){ + if (_X[i][j] < vmin){ + vmin = _X[i][j]; + imin = i; + } + } + return imin; +}// + +/*-------------------------------------------------*/ +/* Return NORM2 distance */ +/*-------------------------------------------------*/ +SGTELIB::Matrix SGTELIB::Matrix::get_distances_norm2 ( const SGTELIB::Matrix & A , + const SGTELIB::Matrix & B ){ + const int n = A.get_nb_cols(); + if ( B.get_nb_cols()!=n ){ + throw SGTELIB::Exception ( __FILE__ , __LINE__ , "get_distances_norm2: dimension error" ); + } + + const int pa = A.get_nb_rows(); + const int pb = B.get_nb_rows(); + SGTELIB::Matrix D = SGTELIB::Matrix("D",pa,pb); + double v,d; + int ia, ib, j; + + for (ia=0 ; ia < pa ; ia++){ + for (ib=0 ; ib < pb ; ib++){ + // Distance between the point ia of the cache and the point ib of the matrix XXs + v = 0; + for (j=0 ; j < n ; j++){ + d = A._X[ia][j]-B._X[ib][j]; + v += d*d; + } + D._X[ia][ib] = sqrt(v); + } + } + return D; +}// + +/*-------------------------------------------------*/ +/* Return NORM1 distance */ +/*-------------------------------------------------*/ +SGTELIB::Matrix SGTELIB::Matrix::get_distances_norm1 ( const SGTELIB::Matrix & A , + const SGTELIB::Matrix & B ){ + const int n = A.get_nb_cols(); + if ( B.get_nb_cols()!=n ){ + throw SGTELIB::Exception ( __FILE__ , __LINE__ , "get_distances_norm2: dimension error" ); + } + + const int pa = A.get_nb_rows(); + const int pb = B.get_nb_rows(); + SGTELIB::Matrix D = SGTELIB::Matrix("D",pa,pb); + double v; + int ia, ib, j; + + for (ia=0 ; ia < pa ; ia++){ + for (ib=0 ; ib < pb ; ib++){ + // Distance between the point ia of the cache and the point ib of the matrix XXs + v = 0; + for (j=0 ; j < n ; j++){ + v += fabs(A._X[ia][j]-B._X[ib][j]); + } + D._X[ia][ib] = v; + } + } + return D; +}// + +/*-------------------------------------------------*/ +/* Return NORMINF distance */ +/*-------------------------------------------------*/ +SGTELIB::Matrix SGTELIB::Matrix::get_distances_norminf ( const SGTELIB::Matrix & A , + const SGTELIB::Matrix & B ){ + const int n = A.get_nb_cols(); + if ( B.get_nb_cols()!=n ){ + throw SGTELIB::Exception ( __FILE__ , __LINE__ , "get_distances_norm2: dimension error" ); + } + + const int pa = A.get_nb_rows(); + const int pb = B.get_nb_rows(); + SGTELIB::Matrix D = SGTELIB::Matrix("D",pa,pb); + double v; + int ia, ib, j; + + for (ia=0 ; ia < pa ; ia++){ + for (ib=0 ; ib < pb ; ib++){ + // Distance between the point ia of the cache and the point ib of the matrix XXs + v = 0; + for (j=0 ; j < n ; j++){ + v = std::max( v , fabs(A._X[ia][j]-B._X[ib][j]) ); + } + D._X[ia][ib] = v; + } + } + return D; +}// + + +/*-------------------------------------------------*/ +/* find_row */ +/* Check if the matrix has a row identical to R */ +/*-------------------------------------------------*/ +int SGTELIB::Matrix::find_row (SGTELIB::Matrix & R){ + + // If the matrix is empty, return false. + if (_nbRows==0) return -1; + + // Then, check dimensions. + if (R.get_nb_rows()!=1) + throw SGTELIB::Exception ( __FILE__ , __LINE__ , "find_row: dimension error" ); + if (R.get_nb_cols()!=_nbCols) + throw SGTELIB::Exception ( __FILE__ , __LINE__ , "find_row: dimension error" ); + + // Look for the row. + int i,j; + bool diff; + for (i=0 ; i<_nbRows ; i++){ + diff = false; + for (j=0 ; j<_nbCols ; j++){ + if (_X[i][j]!=R._X[0][j]){ + diff = true; + break; + } + } + if ( ! diff) return i; + } + return -1; + + + + +}// + + +/*-------------------------------------------------*/ +/* Generate poll directions */ +/*-------------------------------------------------*/ +SGTELIB::Matrix SGTELIB::Matrix::get_poll_directions ( const SGTELIB::Matrix scaling, + const SGTELIB::param_domain_t * domain, + double psize ) { + + int i,j,k; + // i : index of the poll direction (rows of D and POLL) + // (Each line of D and POLL is a poll direction) + // j : index of the optimization variable (columns of D and POLL) + // k : integer buffer, when needed. + double d; + + // Number of variables + const int N = scaling.get_nb_cols(); + SGTELIB::Matrix D("D",N,N); + + // Number of continuous variables + int Ncont = 0; + for (j=0 ; j<N ; j++){ + if (domain[j]==SGTELIB::PARAM_DOMAIN_CONTINUOUS) Ncont++; + } + + // Generate directions for continuous variables + if (Ncont>0){ + // Generate one random direction + SGTELIB::Matrix v("v",1,N); + for (j=0 ; j<N ; j++){ + if (domain[j]==SGTELIB::PARAM_DOMAIN_CONTINUOUS){ + v._X[0][j] = SGTELIB::quick_norm_rand(); + } + } + + // Normalize v (Euclidian Norm) + v = v/v.norm(); + + // Build D (Householder matrix) + for (i=0 ; i<N ; i++){ + if (domain[i]==SGTELIB::PARAM_DOMAIN_CONTINUOUS){ + for (j=0 ; j<N ; j++){ + D._X[i][j] = double(i==j)-2*v[i]*v[j]; + } + } + } + } // END if (Ncont>0) + + + + double msize = std::min(psize*psize,psize); + double rho = psize/msize; + // Normalize directions + for (i=0 ; i<N ; i++){ + + // Fill continous dimensions with rand if necessary + if (domain[i]!=SGTELIB::PARAM_DOMAIN_CONTINUOUS){ + for (j=0 ; j<N ; j++){ + if (domain[j]==SGTELIB::PARAM_DOMAIN_CONTINUOUS){ + D._X[i][j] = 2*uniform_rand()-1; + } + } + } + + // Find max asb + d = 0; + for (j=0 ; j<N ; j++) d = std::max( d , fabs(D._X[i][j]) ); + + // Scale continuous dimensions + for (j=0 ; j<N ; j++){ + if (domain[j]==SGTELIB::PARAM_DOMAIN_CONTINUOUS){ + D._X[i][j] = scaling[j]*msize*SGTELIB::rceil(rho*D._X[i][j]/d); + } + } + + // Add extended POLL for discrete values + if ( (domain[i]==SGTELIB::PARAM_DOMAIN_INTEGER) || + (domain[i]==SGTELIB::PARAM_DOMAIN_BOOL) ){ + D._X[i][i] = (i%2==0)?-1:+1; + } + else if (domain[i]==SGTELIB::PARAM_DOMAIN_CAT){ + D._X[i][i] = SGTELIB::rceil(uniform_rand()*scaling[i]); + } + + } + + + // Add opposite directions and sort + SGTELIB::Matrix POLL("POLL-DIR",2*N,N); + k = 0; + for (i=0 ; i<N ; i++){ + if (domain[i]==SGTELIB::PARAM_DOMAIN_CONTINUOUS){ + POLL.set_row(D.get_row(i),k++); + POLL.set_row(-D.get_row(i),k++); + } + } + for (i=0 ; i<N ; i++){ + if (domain[i]!=SGTELIB::PARAM_DOMAIN_CONTINUOUS){ + POLL.set_row(D.get_row(i),k++); + POLL.set_row(-D.get_row(i),k++); + } + } + + if (k!=2*N){ + std::cout << "k,N : " << k << " " << N << "\n"; + throw SGTELIB::Exception ( __FILE__ , __LINE__ ,"Unconcistency in the value of k." ); + } + + return POLL; +}// + +/*-------------------------------------------------*/ +/* Swap two rows */ +/*-------------------------------------------------*/ +void SGTELIB::Matrix::swap_rows(const int i1 , const int i2){ + double buffer; + for (int j=0 ; j<_nbCols ; j++){ + buffer = _X[i1][j]; + _X[i1][j] = _X[i2][j]; + _X[i2][j] = buffer; + } +}// + +/*-------------------------------------------------*/ +/* LU inverse */ +/*-------------------------------------------------*/ + +SGTELIB::Matrix SGTELIB::Matrix::lu_inverse ( void ) const { + return lu_inverse(NULL); +} + +SGTELIB::Matrix SGTELIB::Matrix::lu_inverse ( double * det ) const{ + + const int N = _nbRows; + SGTELIB::Matrix A (*this); + + int i,j,k,ip=0; + double pivot,pivot_max; + + // Permuation vector + int * P = new int [N]; + for (i=0 ; i<N ; i++) P[i]=i; + + // LU factorization (in-place) + for (k=0 ; k<N-1 ; k++){ + + // Find pivot + pivot_max = -1; + for (i=k ; i<N ; i++){ + pivot = A._X[k][i]; + if (pivot<0) pivot*=-1; + if (pivot>pivot_max){ + ip = i; + pivot_max = pivot; + } + } + + // Swap rows of A and P + if (ip!=k){ + A.swap_rows(ip,k); + i=P[ip]; P[ip]=P[k]; P[k]=i; + } + + // Gaussian elimination + for (j=k+1 ; j<N ; j++){ + pivot = A._X[j][k]/A._X[k][k]; + A._X[j][k] = pivot; + for (i=k+1 ; i<N ; i++) A._X[j][i] -= pivot*A._X[k][i]; + } + } + + // Construct the whole matrix P (under the name Ai) + SGTELIB::Matrix Ai ("Ai",N,N); + for (i=0 ; i<N; i++) Ai._X[i][P[i]] = 1; + + + + if (det){ + // Compute the determinant of the matrix that is inverted + double v = 1; + // Compute the determinant of U + for (i=0 ; i<N ; i++) v *= A._X[i][i]; + // Comput ethe determinant of P + i = 0; + while (i<N){ + if (P[i]!=i){ + j = P[i]; + P[i] = P[j]; + P[j] = j; + v *= -1; + } + else i++; + } + *det = v; + } + + // Triangular inversion for each column of Ai. + SGTELIB::Matrix y; + for (k=0 ; k<N; k++){ + y = Ai.get_col(k); + + // Tri-L solve + for (i=0 ; i<N ; i++){ + for (j=0 ; j<i ; j++){ + y._X[i][0] -= A._X[i][j]*y._X[j][0]; + } + } + + // Tri-U solve + for (int i=N-1 ; i>=0 ; i--){ + for (int j=i+1 ; j<N ; j++){ + y._X[i][0] -= A._X[i][j]*y._X[j][0]; + } + y._X[i][0] /= A._X[i][i]; + } + + Ai.set_col(y,k); + } + + delete [] P; + + Ai.set_name(_name+"^-1"); + return Ai; + +}// + + + diff --git a/ext/sgtelib/src/Matrix.hpp b/ext/sgtelib/src/Matrix.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d98c65bebb29c126348690e7d65068e2895b7a35 --- /dev/null +++ b/ext/sgtelib/src/Matrix.hpp @@ -0,0 +1,401 @@ +/*-------------------------------------------------------------------------------------*/ +/* sgtelib - A surrogate model library for derivative-free optimization */ +/* Version 2.0.1 */ +/* */ +/* Copyright (C) 2012-2017 Sebastien Le Digabel - Ecole Polytechnique, Montreal */ +/* Bastien Talgorn - McGill University, Montreal */ +/* */ +/* Author: Bastien Talgorn */ +/* email: bastientalgorn@fastmail.com */ +/* */ +/* This program is free software: you can redistribute it and/or modify it under the */ +/* terms of the GNU Lesser General Public License as published by the Free Software */ +/* Foundation, either version 3 of the License, or (at your option) any later */ +/* version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ +/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ +/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License along */ +/* with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on sgtelib at https://github.com/bastientalgorn/sgtelib */ +/*-------------------------------------------------------------------------------------*/ + +#ifndef __SGTELIB_MATRIX__ +#define __SGTELIB_MATRIX__ + +#include <set> +#include <fstream> +#include <vector> +#include <list> +#include <climits> +#include <algorithm> +#include "Surrogate_Utils.hpp" +#include "Exception.hpp" + +namespace SGTELIB { + + + class Matrix { + + private: + + std::string _name; + + int _nbRows; // nbRows x nbCols matrix + int _nbCols; + + double ** _X; + + public: + + // constructor 1: + Matrix ( const std::string & name , + int nbRows , + int nbCols ); + + // constructor 2: + Matrix ( const std::string & name , + int nbRows , + int nbCols , + double ** A ); + + // constructor 3: + Matrix ( const std::string & file_name ); + + // constructor 4: + Matrix ( void ); + + // copy constructor: + Matrix ( const Matrix & ); + + // affectation operator: + Matrix & operator = ( const Matrix & A ); + + //Matrix & operator * ( const Matrix & B); + + + + // destructor: + virtual ~Matrix ( void ); + + // fill the matrix randomly: + void set_random ( double l , double u , bool round = false ); + void fill (double v); + + // add rows: + void add_rows ( const Matrix & X ); + void add_cols ( const Matrix & X ); + void add_row ( const double * row ); + void add_rows ( const int p); // add empty rows + void add_cols ( const int p); // add empty cols + void remove_rows ( const int p); // remove last rows + + // GET methods: + int get_nb_rows ( void ) const { return _nbRows; } + int get_nb_cols ( void ) const { return _nbCols; } + int get_numel ( void ) const { return _nbRows*_nbCols; } + + double get ( const int k ) const; // access to element (k) + double get ( const int i , const int j ) const; // access to element (i,j) + + const double & operator [] ( int k ) const; + double & operator [] ( int k ); + + + + SGTELIB::Matrix get ( const std::list<int> & list_cols , + const std::list<int> & list_rows) const; + + SGTELIB::Matrix get_row (const int i) const; + SGTELIB::Matrix get_col (const int i) const; + + SGTELIB::Matrix get_rows (const std::list<int> & list_rows) const; + SGTELIB::Matrix get_cols (const std::list<int> & list_cols) const; + + SGTELIB::Matrix get_rows (const int i1, const int i2) const; + SGTELIB::Matrix get_cols (const int i1, const int i2) const; + + void swap_rows (const int i1, const int i2); + + + // count the number of different values in column j: + int get_nb_diff_values ( int j ) const; + + // get the constant columns (constant variables): + void get_fix_columns ( std::list<int> & fix_col ) const; + + // check symmetry + bool is_sym ( void ) const; + + // SET methods: + void set_name ( const std::string & name ) { _name = name; } + std::string get_name ( void ) const { return _name; } + + void set (const int i , const int j , const double d ); + void set_row (const SGTELIB::Matrix & T , const int i); // T is row vector + void set_col (const SGTELIB::Matrix & T , const int j); // T is col vector + void set_row (const double v , const int i); // T is row vector + void set_col (const double v , const int j); // T is col vector + + // Permute terms (i1,j1) and (i2,j2) + void permute (const int i1 , const int j1 , const int i2 , const int j2 ); + + // Multiply row + void multiply_row (const double v , const int i); // T is row vector + void multiply_col (const double v , const int j); // T is col vector + + // Inverse + SGTELIB::Matrix SVD_inverse ( void ) const; + + // Inverse the diagonal terms + SGTELIB::Matrix diag_inverse ( void ) const; + + // Build vector from a double* + static SGTELIB::Matrix row_vector ( const double * v, + const int n ); + + static SGTELIB::Matrix col_vector ( const double * v, + const int n ); + + // Transpose + SGTELIB::Matrix transpose ( void ) const; + + // Diag + SGTELIB::Matrix diag (void ) const; + + + // Trace + double trace ( void ) const; + + // Rmse + double rmse ( void ) const; + + // Norm + double norm ( void ) const; + double normsquare ( void ) const; + void normalize_cols ( void ); + + // Sum + double sum ( void ) const; + SGTELIB::Matrix sum ( const int direction ) const; + + // Mean + double mean ( void ) const; + + // Count (number of non null values) + int count ( void ) const; + + + // Product + static SGTELIB::Matrix product ( const SGTELIB::Matrix & A, + const SGTELIB::Matrix & B); + + static SGTELIB::Matrix product ( const SGTELIB::Matrix & A, + const SGTELIB::Matrix & B, + const SGTELIB::Matrix & C); + + static SGTELIB::Matrix product ( const SGTELIB::Matrix & A, + const SGTELIB::Matrix & B, + const SGTELIB::Matrix & C, + const SGTELIB::Matrix & D); + + void product ( const int i , const int j , const double v){ _X[i][j]*=v; }; + + // Subset product, multiply + // the p first rows and q first columns of A + // with the q first rows and r first columns of B. + // Result is a matrix of size p/r. + static SGTELIB::Matrix subset_product (const SGTELIB::Matrix & A, + const SGTELIB::Matrix & B, + int p, + int q, + int r); + + static SGTELIB::Matrix diagA_product ( const SGTELIB::Matrix & A, + const SGTELIB::Matrix & B); + + static SGTELIB::Matrix diagB_product ( const SGTELIB::Matrix & A, + const SGTELIB::Matrix & B); + + static SGTELIB::Matrix transposeA_product ( const SGTELIB::Matrix & A, + const SGTELIB::Matrix & B); + + + static SGTELIB::Matrix hadamard_product ( const SGTELIB::Matrix & A, + const SGTELIB::Matrix & B); + + static SGTELIB::Matrix hadamard_square ( const SGTELIB::Matrix & A ); + + static SGTELIB::Matrix hadamard_sqrt ( const SGTELIB::Matrix & A ); + + static SGTELIB::Matrix hadamard_power ( const SGTELIB::Matrix & A , + const double e ); + + void hadamard_inverse ( void ); + void hadamard_sqrt ( void ); + void hadamard_square ( void ); + + // Addition + static SGTELIB::Matrix add ( const SGTELIB::Matrix & A, + const SGTELIB::Matrix & B); + + // Add to the matrix itself + void add ( const SGTELIB::Matrix & B); + void add ( const int i , const int j , const double v){ _X[i][j]+=v; }; + + // Add and fill with 0 (add two matrices of different sizes) + static SGTELIB::Matrix add_fill ( const SGTELIB::Matrix & A, + const SGTELIB::Matrix & B); + + // Substract + static SGTELIB::Matrix sub ( const SGTELIB::Matrix & A, + const SGTELIB::Matrix & B); + + void sub ( const SGTELIB::Matrix & B); + + // Identity matrix + static SGTELIB::Matrix identity ( const int n ); + + // ones matrix + static SGTELIB::Matrix ones ( const int nbRows , const int nbCols ); + + // random permutation matrix + static SGTELIB::Matrix random_permutation_matrix ( const int n ); + + // Lines random permutation + SGTELIB::Matrix random_line_permutation ( void ) const; + + // Rank of the values + SGTELIB::Matrix rank ( void ) const; + + // Conjugate gradient + static SGTELIB::Matrix conjugate_solve ( const SGTELIB::Matrix & A , + const SGTELIB::Matrix & b , + const SGTELIB::Matrix & x0 , + const double tol); + + // LU factorization + SGTELIB::Matrix lu_inverse ( void ) const; + SGTELIB::Matrix lu_inverse ( double * det ) const; + + // Cholesky + SGTELIB::Matrix cholesky ( void ) const; + SGTELIB::Matrix cholesky_inverse ( double * det ) const; + SGTELIB::Matrix cholesky_inverse ( void ) const; + static SGTELIB::Matrix cholesky_solve ( const SGTELIB::Matrix & A , + const SGTELIB::Matrix & b ); + + + + // Triangular matrix + static SGTELIB::Matrix tril_inverse (const SGTELIB::Matrix & L ); + + static SGTELIB::Matrix triu_solve ( const SGTELIB::Matrix & U , + const SGTELIB::Matrix & b ); + + static SGTELIB::Matrix tril_solve ( const SGTELIB::Matrix & L , + const SGTELIB::Matrix & b ); + // SVD decomposition: + bool SVD_decomposition ( std::string & error_msg , + SGTELIB::Matrix * &MAT_U, // OUT, nbRows x nbCols + SGTELIB::Matrix * &MAT_W, // OUT, nbCols x nbCols, diagonal + SGTELIB::Matrix * &MAT_V, // OUT, nbCols x nbCols + int max_mpn = 1500 ) const; + + bool SVD_decomposition ( std::string & error_msg , + double ** U , // OUT, nbRows x nbCols + double * W , // OUT, nbCols x nbCols, diagonal + double ** V , // OUT, nbCols x nbCols + int max_mpn = 1500 ) const; + + // Projection matrix for linear over-determined models + static SGTELIB::Matrix get_matrix_P ( const SGTELIB::Matrix & Ai, + const SGTELIB::Matrix & H ); + + static double get_trace_P ( const SGTELIB::Matrix & Ai, + const SGTELIB::Matrix & H ); + + static SGTELIB::Matrix get_matrix_PZs ( const SGTELIB::Matrix & Ai, + const SGTELIB::Matrix & H , + const SGTELIB::Matrix & Zs); + + static SGTELIB::Matrix get_matrix_dPiPZs( const SGTELIB::Matrix & Ai, + const SGTELIB::Matrix & H , + const SGTELIB::Matrix & Zs); + + static SGTELIB::Matrix get_matrix_dPiPZs( const SGTELIB::Matrix & Ai, + const SGTELIB::Matrix & H , + const SGTELIB::Matrix & Zs , + const SGTELIB::Matrix & ALPHA); + + + static SGTELIB::Matrix get_matrix_dPi ( const SGTELIB::Matrix & Ai, + const SGTELIB::Matrix & H ); + + // Min / Max + double max (void); + double min (void); + static SGTELIB::Matrix max ( const SGTELIB::Matrix & A , + const SGTELIB::Matrix & B ); + static SGTELIB::Matrix min ( const SGTELIB::Matrix & A , + const SGTELIB::Matrix & B ); + + // Get min index + int get_max_index ( void ); + int get_min_index ( void ); + int get_min_index_row ( const int i ); + int get_min_index_col ( const int j ); + + // display: + void display ( std::ostream & out ) const; + void display_short( std::ostream & out ) const; + void write ( const std::string & file_name ) const; + void display_size ( std::ostream & out ) const; + + // import data in plain format + static SGTELIB::Matrix import_data ( const std::string & file_name ); + static SGTELIB::Matrix string_to_matrix ( std::string s ); + static SGTELIB::Matrix string_to_row ( const std::string & s , int nbCols = 0 ); + + // distances + static SGTELIB::Matrix get_distances_norm1 ( const SGTELIB::Matrix & A , + const SGTELIB::Matrix & B ); + static SGTELIB::Matrix get_distances_norm2 ( const SGTELIB::Matrix & A , + const SGTELIB::Matrix & B ); + static SGTELIB::Matrix get_distances_norminf ( const SGTELIB::Matrix & A , + const SGTELIB::Matrix & B ); + + int find_row (SGTELIB::Matrix & R); + + // nan + bool has_nan (void) const; + bool has_inf (void) const; + void replace_nan (double d); + + // Generate poll directions + static SGTELIB::Matrix get_poll_directions ( const SGTELIB::Matrix scaling, + const SGTELIB::param_domain_t * domain, + double psize ); + + + SGTELIB::Matrix LUPinverse (void); + + }; +} + +SGTELIB::Matrix operator * (const SGTELIB::Matrix & A , const double v ); +SGTELIB::Matrix operator * (const double v , const SGTELIB::Matrix & A); +SGTELIB::Matrix operator * (const SGTELIB::Matrix & A , const SGTELIB::Matrix & B); +SGTELIB::Matrix operator + (const SGTELIB::Matrix & A , const SGTELIB::Matrix & B); +SGTELIB::Matrix operator + (const SGTELIB::Matrix & A , const double v ); +SGTELIB::Matrix operator + (const double v , const SGTELIB::Matrix & A); +SGTELIB::Matrix operator - (const SGTELIB::Matrix & A , const SGTELIB::Matrix & B); +SGTELIB::Matrix operator - (const SGTELIB::Matrix & A , const double v); +SGTELIB::Matrix operator - (const double v , const SGTELIB::Matrix & A); +SGTELIB::Matrix operator - (const SGTELIB::Matrix & A); +SGTELIB::Matrix operator / (const SGTELIB::Matrix & A , const double v ); + +#endif diff --git a/ext/sgtelib/src/Surrogate.cpp b/ext/sgtelib/src/Surrogate.cpp new file mode 100644 index 0000000000000000000000000000000000000000..008a894dcf30245a09f6fa3374c7ab40504068c6 --- /dev/null +++ b/ext/sgtelib/src/Surrogate.cpp @@ -0,0 +1,1664 @@ +/*-------------------------------------------------------------------------------------*/ +/* sgtelib - A surrogate model library for derivative-free optimization */ +/* Version 2.0.1 */ +/* */ +/* Copyright (C) 2012-2017 Sebastien Le Digabel - Ecole Polytechnique, Montreal */ +/* Bastien Talgorn - McGill University, Montreal */ +/* */ +/* Author: Bastien Talgorn */ +/* email: bastientalgorn@fastmail.com */ +/* */ +/* This program is free software: you can redistribute it and/or modify it under the */ +/* terms of the GNU Lesser General Public License as published by the Free Software */ +/* Foundation, either version 3 of the License, or (at your option) any later */ +/* version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ +/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ +/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License along */ +/* with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on sgtelib at https://github.com/bastientalgorn/sgtelib */ +/*-------------------------------------------------------------------------------------*/ + +#include "Surrogate.hpp" + +using namespace SGTELIB; + +/*--------------------------------------*/ +/* constructor */ +/*--------------------------------------*/ + +SGTELIB::Surrogate::Surrogate ( SGTELIB::TrainingSet & trainingset, + const SGTELIB::Surrogate_Parameters param) : + _trainingset ( trainingset ) , + _param ( param ) , + _n (_trainingset.get_input_dim() ) , + _m (_trainingset.get_output_dim() ) , + _p_ts (0 ) , + _p_ts_old (999999999 ) , + _p (0 ) , + _p_old (999999999 ) , + _ready (false ) , + _Zhs (NULL ) , + _Shs (NULL ) , + _Zvs (NULL ) , + _Svs (NULL ) , + _selected_points (1,-1 ) , + _metric_emax (NULL ) , + _metric_emaxcv (NULL ) , + _metric_rmse (NULL ) , + _metric_rmsecv (NULL ) , + _metric_oe (NULL ) , + _metric_oecv (NULL ) , + _metric_linv (NULL ) , + _metric_aoe (-1.0 ) , + _metric_aoecv (-1.0 ) , + _metric_armse (-1.0 ) , + _metric_armsecv (-1.0 ) , + _psize_max ( 0.5 ) , + _out ( ) , + _display ( false ) {; +}// + + +SGTELIB::Surrogate::Surrogate ( SGTELIB::TrainingSet & trainingset, + const SGTELIB::model_t mt ) : + _trainingset ( trainingset ) , + _param ( mt ) , + _n (_trainingset.get_input_dim() ) , + _m (_trainingset.get_output_dim() ) , + _p_ts (0 ) , + _p_ts_old (999999999 ) , + _p (0 ) , + _p_old (999999999 ) , + _ready (false ) , + _Zhs (NULL ) , + _Shs (NULL ) , + _Zvs (NULL ) , + _Svs (NULL ) , + _selected_points (1,-1 ) , + _metric_emax (NULL ) , + _metric_emaxcv (NULL ) , + _metric_rmse (NULL ) , + _metric_rmsecv (NULL ) , + _metric_oe (NULL ) , + _metric_oecv (NULL ) , + _metric_linv (NULL ) , + _metric_aoe (-1.0 ) , + _metric_aoecv (-1.0 ) , + _metric_efioe (-1.0 ) , + _metric_efioecv (-1.0 ) , + _metric_armse (-1.0 ) , + _metric_armsecv (-1.0 ) , + _psize_max ( 0.5 ) , + _out ( ) , + _display ( false ) { +}// + +SGTELIB::Surrogate::Surrogate ( SGTELIB::TrainingSet & trainingset, + const std::string & s) : + _trainingset ( trainingset ) , + _param ( s ) , + _n (_trainingset.get_input_dim() ) , + _m (_trainingset.get_output_dim() ) , + _p_ts (0 ) , + _p_ts_old (0 ) , + _p (0 ) , + _p_old (0 ) , + _ready (false ) , + _Zhs (NULL ) , + _Shs (NULL ) , + _Zvs (NULL ) , + _Svs (NULL ) , + _selected_points (1,-1 ) , + _metric_emax (NULL ) , + _metric_emaxcv (NULL ) , + _metric_rmse (NULL ) , + _metric_rmsecv (NULL ) , + _metric_oe (NULL ) , + _metric_oecv (NULL ) , + _metric_linv (NULL ) , + _metric_aoe (-1.0 ) , + _metric_aoecv (-1.0 ) , + _metric_efioe (-1.0 ) , + _metric_efioecv (-1.0 ) , + _metric_armse (-1.0 ) , + _metric_armsecv (-1.0 ) , + _psize_max ( 0.5 ) , + _out ( ) , + _display ( false ) { +}// + + +/*--------------------------------------*/ +/* destructor */ +/*--------------------------------------*/ +SGTELIB::Surrogate::~Surrogate ( void ) { + reset_metrics(); +}// + + +void SGTELIB::Surrogate::info ( void ) const { + _trainingset.info(); +}// + + +/*--------------------------------------*/ +/* display */ +/*--------------------------------------*/ +void SGTELIB::Surrogate::display ( std::ostream & out ) const { + out << "Surrogate: " << get_string() << "\n"; + out << "ready: " << _ready << "\n"; + out << "n: " << _n << " (input dim)\n"; + out << "m: " << _m << " (output dim)\n"; + out << "p: " << _p << " (nb points)\n"; + display_private ( out ); +}// + +/*--------------------------------------*/ +/* erase_data */ +/*--------------------------------------*/ +void SGTELIB::Surrogate::reset_metrics ( void ) { + #ifdef SGTELIB_DEBUG + std::cout << "Surrogate: reset_metrics..."; + #endif + + if (_Zhs) delete _Zhs; + _Zhs = NULL; + + if (_Shs) delete _Shs; + _Shs = NULL; + + if (_Zvs) delete _Zvs; + _Zvs = NULL; + + if (_Svs) delete _Svs; + _Svs = NULL; + + if (_metric_emax) delete [] _metric_emax; + _metric_emax = NULL; + + if (_metric_emaxcv) delete [] _metric_emaxcv; + _metric_emaxcv = NULL; + + if (_metric_rmse) delete [] _metric_rmse; + _metric_rmse = NULL; + + if (_metric_rmsecv) delete [] _metric_rmsecv; + _metric_rmsecv = NULL; + + if (_metric_oe) delete [] _metric_oe; + _metric_oe = NULL; + + if (_metric_oecv) delete [] _metric_oecv; + _metric_oecv = NULL; + + if (_metric_linv) delete [] _metric_linv; + _metric_linv = NULL; + + _metric_aoe = -1.0; + _metric_aoecv = -1.0; + _metric_efioe = -1.0; + _metric_efioecv = -1.0; + _metric_armse = -1.0; + _metric_armsecv = -1.0; + + #ifdef SGTELIB_DEBUG + std::cout << "OK\n"; + #endif +}// + +/*--------------------------------------*/ +/* build */ +/*--------------------------------------*/ +bool SGTELIB::Surrogate::build ( void ) { + + #ifdef SGTELIB_DEBUG + std::cout << "Surrogate build - BEGIN\n"; + #endif + + if (streqi(_param.get_output(),"NULL")){ + _display = false; + } + else{ + _display = true; + } + + // Check the parameters of the model: + _param.check(); + + // Before building the surrogate, the trainingset must be ready + _trainingset.build(); + + // Number of points in the training set. + _p_ts = _trainingset.get_nb_points(); + //std::cout << _ready << " " << _p_ts << " " << _p_ts_old << "\n"; + if ( (_ready) && (_p_ts==_p_ts_old) ){ + #ifdef SGTELIB_DEBUG + std::cout << "Surrogate build - SKIP Build\n"; + #endif + return true; + } + + // Otherwise, the model is not ready and we need to call build_private + _ready = false; + + + // Get the number of points used in the surrogate + if ( (_selected_points.size()==1) && (_selected_points.front()==-1) ) + _p = _p_ts; + else + _p = static_cast<int>(_selected_points.size()); + + // Need at least 2 point to build a surrogate. + if (_p<2){ + return false; + } + + // Delete the intermediate data and metrics + // (they will have to be recomputed...) + reset_metrics(); + + // If there are new points, + // Call to the private build + #ifdef SGTELIB_DEBUG + std::cout << "Surrogate build - BUILD_PRIVATE\n"; + #endif + + bool ok; + ok = init_private(); + if ( ! ok) return false; + + // Optimize parameters + if (_param.get_nb_parameter_optimization()>0){ + ok = optimize_parameters(); + if ( ! ok){ + _ready = false; + return false; + } + } + + // Build private + ok = build_private(); + if ( ! ok){ + _ready = false; + return false; + } + + + // Memorize previous number of points + _p_ts_old = _p_ts; + _p_old = _p; + + #ifdef SGTELIB_DEBUG + std::cout << "Surrogate build - END\n"; + #endif + + if (_display){ + _out.open(_param.get_output().c_str() , std::ios::out | std::ios::app); + if (_out.fail()) std::cout << "Out.fail1!!!\n"; + std::cout << "Write in " << _param.get_output() << "\n"; + if (_out.fail()) std::cout << "Out.fail2!!!\n"; + display(_out); + if (_out.fail()) std::cout << "Out.fail3!!!\n"; + //_out << "AOECV: " << get_metric(SGTELIB::METRIC_AOECV,0) << "\n"; + //_out << "ARMSECV: " << get_metric(SGTELIB::METRIC_ARMSECV,0) << "\n"; + _out.close(); + } + + + _ready = true; + return true; +}// + +bool SGTELIB::Surrogate::init_private (void) { + // Empty initialization function + #ifdef SGTELIB_DEBUG + std::cout << model_type_to_str(get_type()) << " : init_private\n"; + #endif + return true; +} + + +/*--------------------------------------*/ +/* check_ready */ +/*--------------------------------------*/ +void SGTELIB::Surrogate::check_ready (void) const { + check_ready(""); +}// + +/*--------------------------------------*/ +void SGTELIB::Surrogate::check_ready (const std::string & file, + const std::string & function, + const int & i ) const { + check_ready(file+"::"+function+"::"+itos(i)); +}// +/*--------------------------------------*/ +void SGTELIB::Surrogate::check_ready (const std::string & s) const { + + // Check the tag _ready + if ( ! _ready){ + display(std::cout); + std::cout << "Surrogate: NOT READY! (" << s << ")\n"; + throw SGTELIB::Exception ( __FILE__ , __LINE__ , + "check_ready(): Not ready!" ); + } + + // Check if the trainingset is ready + _trainingset.check_ready("From Surrogate ()"); + + + // Check the new number of points in the trainingset + if (_trainingset.get_nb_points()>_p_ts){ + display(std::cout); + std::cout << "Surrogate: NOT READY! (" << s << ")\n"; + throw SGTELIB::Exception ( __FILE__ , __LINE__ , + "check_ready(): Not ready!" ); + } + +}// + + +/*--------------------------------------*/ +/* add points */ +/*--------------------------------------*/ +bool SGTELIB::Surrogate::add_points ( const SGTELIB::Matrix & Xnew , + const SGTELIB::Matrix & Znew ){ + throw SGTELIB::Exception ( __FILE__ , __LINE__ , + "add_points: forbiden." ); + return _trainingset.add_points(Xnew,Znew); +}// +/*--------------------------------------*/ +bool SGTELIB::Surrogate::add_point ( const double * xnew , + const double * znew ){ + throw SGTELIB::Exception ( __FILE__ , __LINE__ , + "add_point: forbiden." ); + return _trainingset.add_point(xnew,znew); +}// + + +/*--------------------------------------*/ +/* predict */ +/*--------------------------------------*/ +void SGTELIB::Surrogate::predict ( const SGTELIB::Matrix & XX , + SGTELIB::Matrix * ZZ , + SGTELIB::Matrix * std, + SGTELIB::Matrix * ei , + SGTELIB::Matrix * cdf) { + + check_ready(__FILE__,__FUNCTION__,__LINE__); + + //std::cout << "IN PREDICT (public) " << __FILE__ << " " << ZZ << " " << std << " " << ei << " " << cdf << "\n"; + + // Check the number of columns in XX + if (XX.get_nb_cols() != _n){ + display(std::cout); + throw SGTELIB::Exception ( __FILE__ , __LINE__ , + "predict(): dimension error" ); + } + + *ZZ = SGTELIB::Matrix("ZZ",XX.get_nb_rows(),_m); + + // Scale the input + SGTELIB::Matrix XXs(XX); + XXs.set_name("XXs"); + _trainingset.X_scale(XXs); + + if (ei){ + ei->fill(-INF); + } + + // Call the private prediction with normalize input XXs + predict_private( XXs , ZZ , std , ei , cdf ); + + // If nbdiff==1, put the values to 0.0 + int pxx = XX.get_nb_rows(); + if (ZZ){ + for (int j=0 ; j<_m ; j++){ + if (_trainingset.get_Z_nbdiff(j)==1){ + for (int i=0 ; i<pxx ; i++){ + ZZ->set(i,j,0.0); + } + } + } + } + + + #ifdef SGTELIB_DEBUG + if (ZZ){ + if (ZZ->has_nan()){ + ZZ->replace_nan (+INF); + } + } + if (std){ + if (std->has_nan()){ + display(std::cout); + throw SGTELIB::Exception ( __FILE__ , __LINE__ , "predict(): std has nan" ); + } + } + if (ei){ + if (ei->has_nan()){ + display(std::cout); + throw SGTELIB::Exception ( __FILE__ , __LINE__ , "predict(): ei has nan" ); + } + } + if (cdf){ + if (cdf->has_nan()){ + display(std::cout); + throw SGTELIB::Exception ( __FILE__ , __LINE__ , "predict(): cdf has nan" ); + } + } + #endif + + ZZ->replace_nan (+INF); + std->replace_nan (+INF); + ei->replace_nan (-INF); + cdf->replace_nan (0); + + // UnScale the output + if (ZZ ){ + ZZ->set_name("ZZ"); + _trainingset.Z_unscale(ZZ); + } + if (std){ + std->set_name("std"); + _trainingset.ZE_unscale(std); + } + if (ei ){ + ei->set_name("ei"); + _trainingset.ZE_unscale(ei); + // ei is only computed for the OBJ output, so the other values are dummy, + // So we put them all to 0. + for (int j=0 ; j<_m ; j++){ + if (_trainingset.get_bbo(j)!=SGTELIB::BBO_OBJ){ + for (int i=0 ; i<pxx ; i++){ + ei->set(i,j,0.0); + } + } + } + } + if (cdf){ + cdf->set_name("cdf"); + } + + +}// + + + +/*--------------------------------------*/ +/* predict (ZZs,std,ei) */ +/*--------------------------------------*/ +// This function is the default method to compute std, ei and cdf. +// It can be overloaded, but models PRS, RBF and KS use the default method. +// This method relies on the private method predict_private(XXs,ZZs) +// which HAS TO be overloaded (pure virtual) +void SGTELIB::Surrogate::predict_private (const SGTELIB::Matrix & XXs, + SGTELIB::Matrix * ZZs, + SGTELIB::Matrix * std, + SGTELIB::Matrix * ei , + SGTELIB::Matrix * cdf) { + check_ready(__FILE__,__FUNCTION__,__LINE__); + + + const int pxx = XXs.get_nb_rows(); + const double fs_min = _trainingset.get_fs_min(); + int i,j; + + // Prediction of ZZs + if ( (ZZs) || (ei) || (cdf) ){ + predict_private(XXs,ZZs); + } + + // Prediction of statistical data + if ( (std) || (ei) || (cdf) ){ + + if (std) std->fill(-SGTELIB::INF); + else std = new SGTELIB::Matrix("std",pxx,_m); + + if (ei) ei->fill(-SGTELIB::INF); + if (cdf) cdf->fill(-SGTELIB::INF); + + // Use distance to closest as std + SGTELIB::Matrix dtc = _trainingset.get_distance_to_closest(XXs); + dtc.set_name("dtc"); + compute_metric_rmse(); + + for (j=0 ; j<_m ; j++){ + // Set std + double s = _metric_rmse[j]; + std->set_col( dtc+s , j ); + + if (_trainingset.get_bbo(j)==SGTELIB::BBO_OBJ){ + // Compute CDF + if (cdf){ + for (i=0 ; i<pxx ; i++){ + cdf->set(i,j, normcdf( fs_min , ZZs->get(i,j) , std->get(i,j) ) ); + } + } + if (ei){ + for (i=0 ; i<pxx ; i++){ + ei->set(i,j, normei( ZZs->get(i,j) , std->get(i,j) , fs_min ) ); + } + } + }// END CASE OBJ + else if (_trainingset.get_bbo(j)==SGTELIB::BBO_CON){ + // Compute CDF + if (cdf){ + // Scaled Feasibility Threshold + double cs = _trainingset.Z_scale(0.0,j); + for (i=0 ; i<pxx ; i++){ + cdf->set(i,j, normcdf( cs , ZZs->get(i,j) , std->get(i,j) ) ); + } + } + }// END CASE CON + + }// End for j + + } +}// + + + + + + +/*--------------------------------------*/ +/* predict */ +/*--------------------------------------*/ +void SGTELIB::Surrogate::predict ( const SGTELIB::Matrix & XX , + SGTELIB::Matrix * ZZ ) { + + check_ready(__FILE__,__FUNCTION__,__LINE__); + + + + // Check the number of columns in XX + if (XX.get_nb_cols() != _n){ + display(std::cout); + throw SGTELIB::Exception ( __FILE__ , __LINE__ , + "predict(): dimension error" ); + } + *ZZ = SGTELIB::Matrix("ZZ",XX.get_nb_rows(),_m); + + // Scale the input + SGTELIB::Matrix XXs(XX); + _trainingset.X_scale(XXs); + + + // Call the private prediction with normalize input XXs + predict_private( XXs , ZZ ); + #ifdef SGTELIB_DEBUG + if (ZZ->has_nan()){ + display(std::cout); + throw SGTELIB::Exception ( __FILE__ , __LINE__ , + "predict(): ZZ has nan" ); + } + #endif + + // UnScale the output + _trainingset.Z_unscale(ZZ); + +}// + +/*--------------------------------------*/ +/* get metric (general) */ +/*--------------------------------------*/ +double SGTELIB::Surrogate::get_metric (SGTELIB::metric_t mt , int j){ + + // Check dimension + if ( (j<0) || (j>_m) ){ + display(std::cout); + std::cout << "j = "<< j << "\n"; + throw SGTELIB::Exception ( __FILE__ , __LINE__ , + "get_metric(): dimension error" ); + } + + // If the model is not ready, return +INF + if ( ! _ready){ + #ifdef SGTELIB_DEBUG + std::cout << get_string() << " is not ready => _metric = +INF\n"; + #endif + return SGTELIB::INF; + } + + double m; + switch(mt){ + case SGTELIB::METRIC_EMAX : + compute_metric_emax(); + m = _trainingset.ZE_unscale( _metric_emax[j] , j ); + break; + case SGTELIB::METRIC_EMAXCV : + compute_metric_emaxcv(); + m = _trainingset.ZE_unscale( _metric_emaxcv[j] , j ); + break; + case SGTELIB::METRIC_RMSE : + compute_metric_rmse(); + m = _trainingset.ZE_unscale( _metric_rmse[j] , j ); + break; + case SGTELIB::METRIC_RMSECV: + compute_metric_rmsecv(); + m = _trainingset.ZE_unscale( _metric_rmsecv[j] , j ); + break; + case SGTELIB::METRIC_ARMSE : + compute_metric_armse(); + m = _metric_armse; + break; + case SGTELIB::METRIC_ARMSECV : + compute_metric_armsecv(); + m = _metric_armsecv; + break; + case SGTELIB::METRIC_OE : + compute_metric_oe(); + m = _metric_oe[j]; + break; + case SGTELIB::METRIC_OECV : + compute_metric_oecv(); + m = _metric_oecv[j]; + break; + case SGTELIB::METRIC_LINV : + compute_metric_linv(); + m = _metric_linv[j]; + break; + case SGTELIB::METRIC_AOE : + compute_metric_aoe(); + m = _metric_aoe; + break; + case SGTELIB::METRIC_AOECV : + compute_metric_aoecv(); + m = _metric_aoecv; + break; + case SGTELIB::METRIC_EFIOE : + compute_metric_efioe(); + m = _metric_efioe; + break; + case SGTELIB::METRIC_EFIOECV : + compute_metric_efioecv(); + m = _metric_efioecv; + break; + default: + throw SGTELIB::Exception ( __FILE__ , __LINE__ , + "get_metric(): unknown metric" ); + } + + if (isnan(m) ){ m = SGTELIB::INF; } + if (m < -EPSILON){ m = SGTELIB::INF; } + if (m <= 0.0 ){ m = 0.0; } + return m; +}// + + +/*---------------------------------------*/ +/* compute matrix Zhs */ +/* Zhs is the prediction on the training */ +/* points */ +/*---------------------------------------*/ +const SGTELIB::Matrix * SGTELIB::Surrogate::get_matrix_Zhs (void){ + if ( ! _Zhs){ + check_ready(__FILE__,__FUNCTION__,__LINE__); + + //#ifdef SGTELIB_DEBUG + //#endif + // Init + _Zhs = new SGTELIB::Matrix("Zhs",_p,_m); + //call the predict function on the training points + predict_private (get_matrix_Xs(),_Zhs); + _Zhs->replace_nan(+INF); + _Zhs->set_name("Zhs"); + } + return _Zhs; +}// + + +/*--------------------------------------*/ +/* compute matrix Shs */ +/* (Compute the predictive std) */ +/*--------------------------------------*/ +const SGTELIB::Matrix * SGTELIB::Surrogate::get_matrix_Shs (void){ + if ( ! _Shs){ + check_ready(__FILE__,__FUNCTION__,__LINE__); + + #ifdef SGTELIB_DEBUG + std::cout << "Compute _Shs\n"; + #endif + // Init + _Shs = new SGTELIB::Matrix("Shs",_p,_m); + //call the predict function on the training points + predict_private (get_matrix_Xs(),NULL,_Shs,NULL,NULL); + _Shs->replace_nan(+INF); + _Shs->set_name("Shs"); + } + return _Shs; +}// + +// If no specific method is defined, consider Svs = Shs. +const SGTELIB::Matrix * SGTELIB::Surrogate::get_matrix_Svs (void){ + if ( ! _Svs){ + _Svs = new SGTELIB::Matrix("Svs",_p,_m); + const SGTELIB::Matrix Ds = _trainingset.get_matrix_Ds(); + for (int i=0 ; i<_p ; i++){ + double dmin = +INF; + for (int j=0 ; j<_p ; j++){ + if (i!=j){ + dmin = std::min(dmin,Ds.get(i,j)); + } + } + _Svs->set_row(dmin,i); + } + } + return _Svs; +}// + + + +/*--------------------------------------*/ +/* get_Xs */ +/*--------------------------------------*/ +const SGTELIB::Matrix SGTELIB::Surrogate::get_matrix_Xs (void){ + _trainingset.build(); + return _trainingset.get_matrix_Xs().get_rows(_selected_points); +}// + + +/*--------------------------------------*/ +/* get_Zs */ +/*--------------------------------------*/ +const SGTELIB::Matrix SGTELIB::Surrogate::get_matrix_Zs (void){ + _trainingset.build(); + return _trainingset.get_matrix_Zs().get_rows(_selected_points); +}// + + +/*--------------------------------------*/ +/* get_Ds */ +/*--------------------------------------*/ +const SGTELIB::Matrix SGTELIB::Surrogate::get_matrix_Ds (void){ + _trainingset.build(); + return _trainingset.get_matrix_Ds().get( _selected_points , _selected_points ); +}// + + +/*--------------------------------------*/ +/* get_Zv */ +/*--------------------------------------*/ +const SGTELIB::Matrix SGTELIB::Surrogate::get_matrix_Zv (void){ + // Return unscaled matrix Zv + check_ready(__FILE__,__FUNCTION__,__LINE__); + SGTELIB::Matrix Zv (*get_matrix_Zvs()); // Get scaled matrix + _trainingset.Z_unscale(&Zv); // Unscale + return Zv; // Return unscaled +}// + + +/*--------------------------------------*/ +/* get_Zh */ +/*--------------------------------------*/ +const SGTELIB::Matrix SGTELIB::Surrogate::get_matrix_Zh (void){ + // Return unscaled matrix Zh + check_ready(__FILE__,__FUNCTION__,__LINE__); + SGTELIB::Matrix Zh (*get_matrix_Zhs()); // Get scaled matrix + _trainingset.Z_unscale(&Zh); // Unscale + return Zh; // Return unscaled +}// + + +/*--------------------------------------*/ +/* get_Sh */ +/*--------------------------------------*/ +const SGTELIB::Matrix SGTELIB::Surrogate::get_matrix_Sh (void){ + // Return unscaled matrix Shs + check_ready(__FILE__,__FUNCTION__,__LINE__); + SGTELIB::Matrix Sh = (*get_matrix_Shs()); + _trainingset.ZE_unscale(&Sh); // Unscale + return Sh; // Return unscaled +}// + +/*--------------------------------------*/ +/* get_Sh */ +/*--------------------------------------*/ +const SGTELIB::Matrix SGTELIB::Surrogate::get_matrix_Sv (void){ + // Return unscaled matrix Zh + check_ready(__FILE__,__FUNCTION__,__LINE__); + SGTELIB::Matrix Sv (*get_matrix_Svs()); // Get scaled matrix + _trainingset.ZE_unscale(&Sv); // Unscale + return Sv; // Return unscaled +}// + + +/*--------------------------------------*/ +/* compute rmsecv */ +/*--------------------------------------*/ +void SGTELIB::Surrogate::compute_metric_rmsecv (void){ + check_ready(); + if ( ! _metric_rmsecv){ + // Init + _metric_rmsecv = new double [_m]; + + // Call to the method of the derivated class to + // compute Zv + + int i,j; + double e; + const SGTELIB::Matrix Zs = get_matrix_Zs(); + const SGTELIB::Matrix * Zvs = get_matrix_Zvs(); + + // Loop on the outputs + for (j=0 ; j<_m ; j++){ + // Compute the error for output j + e = 0; + for (i=0 ; i<_p ; i++){ + e += pow(Zs.get(i,j)-Zvs->get(i,j),2); + } + _metric_rmsecv[j] = sqrt(e/_p); + } + } +}// + +/*--------------------------------------*/ +/* compute emax */ +/*--------------------------------------*/ +void SGTELIB::Surrogate::compute_metric_emax (void){ + check_ready(__FILE__,__FUNCTION__,__LINE__); + if ( ! _metric_emax){ + #ifdef SGTELIB_DEBUG + std::cout << "Compute _metric_emax\n"; + #endif + // Init + _metric_emax = new double [_m]; + + int i,j; + double e; + const SGTELIB::Matrix Zs = get_matrix_Zs(); + const SGTELIB::Matrix * Zhs = get_matrix_Zhs(); + // Loop on the outputs + for (j=0 ; j<_m ; j++){ + // Compute the error for output j + e = 0; + for (i=0 ; i<_p ; i++){ + e = std::max( e , fabs( Zs.get(i,j)-Zhs->get(i,j) ) ); + } + _metric_emax[j] = e; + } + } + + #ifdef SGTELIB_DEBUG + std::cout << "metric_emax: " ; + for (int j=0 ; j<_m ; j++){ + std::cout << _metric_emax[j] << " "; + } + std::cout << "\n"; + #endif +}// + + +/*--------------------------------------*/ +/* compute emaxcv */ +/*--------------------------------------*/ +void SGTELIB::Surrogate::compute_metric_emaxcv (void){ + check_ready(__FILE__,__FUNCTION__,__LINE__); + if ( ! _metric_emaxcv){ + #ifdef SGTELIB_DEBUG + std::cout << "Compute _metric_emaxcv\n"; + #endif + // Init + _metric_emaxcv = new double [_m]; + + int i,j; + double e; + const SGTELIB::Matrix Zs = get_matrix_Zs(); + const SGTELIB::Matrix * Zvs = get_matrix_Zvs(); + // Loop on the outputs + for (j=0 ; j<_m ; j++){ + // Compute the error for output j + e = 0; + for (i=0 ; i<_p ; i++){ + e = std::max( e , fabs( Zs.get(i,j)-Zvs->get(i,j) ) ); + } + _metric_emaxcv[j] = e; + } + } + + #ifdef SGTELIB_DEBUG + std::cout << "metric_emaxcv: " ; + for (int j=0 ; j<_m ; j++){ + std::cout << _metric_emaxcv[j] << " "; + } + std::cout << "\n"; + #endif + +}// + +/*--------------------------------------*/ +/* compute rmse */ +/*--------------------------------------*/ +void SGTELIB::Surrogate::compute_metric_rmse (void){ + check_ready(__FILE__,__FUNCTION__,__LINE__); + if ( ! _metric_rmse){ + #ifdef SGTELIB_DEBUG + std::cout << "Compute _metric_rmse\n"; + #endif + // Init + _metric_rmse = new double [_m]; + + int i,j; + double e; + const SGTELIB::Matrix Zs = get_matrix_Zs(); + const SGTELIB::Matrix * Zhs = get_matrix_Zhs(); + // Loop on the outputs + for (j=0 ; j<_m ; j++){ + // Compute the error for output j + e = 0; + for (i=0 ; i<_p ; i++){ + e += pow(Zs.get(i,j)-Zhs->get(i,j),2); + } + _metric_rmse[j] = sqrt(e/_p); + } + } + + #ifdef SGTELIB_DEBUG + std::cout << "metric_rmse: " ; + for (int j=0 ; j<_m ; j++){ + std::cout << _metric_rmse[j] << " "; + } + std::cout << "\n"; + #endif + +}// + + + + +/*--------------------------------------*/ +/* compute oe */ +/*--------------------------------------*/ +void SGTELIB::Surrogate::compute_metric_oe (void){ + check_ready(__FILE__,__FUNCTION__,__LINE__); + if ( ! _metric_oe){ + #ifdef SGTELIB_DEBUG + std::cout << "Compute _metric_oe\n"; + #endif + // Init + _metric_oe = new double [_m]; + // Compute the prediction on the training points + const SGTELIB::Matrix * Zhs = get_matrix_Zhs(); + // Compute the order-efficiency metric using the matrix Zh + // nb: oe => use matrix _Z + // oecv => use matrix _Zv + compute_order_error(Zhs,_metric_oe); + } +}// + +/*--------------------------------------*/ +/* compute oecv */ +/*--------------------------------------*/ +void SGTELIB::Surrogate::compute_metric_oecv (void){ + check_ready(__FILE__,__FUNCTION__,__LINE__); + if ( ! _metric_oecv){ + #ifdef SGTELIB_DEBUG + std::cout << "Compute _metric_oecv\n"; + #endif + // Init + _metric_oecv = new double [_m]; + // Compute the prediction on the training points + const SGTELIB::Matrix * Zvs = get_matrix_Zvs(); + // Compute the order-efficiency metric using the matrix Zh + // nb: oe => use matrix _Z + // oecv => use matrix _Zv + compute_order_error(Zvs,_metric_oecv); + } +}// + + + +/*--------------------------------------*/ +/* compute aoe */ +/*--------------------------------------*/ +void SGTELIB::Surrogate::compute_metric_aoe (void){ + check_ready(__FILE__,__FUNCTION__,__LINE__); + if (_metric_aoe<0){ + #ifdef SGTELIB_DEBUG + std::cout << "Compute _metric_aoe\n"; + #endif + // Compute the prediction on the training points + const SGTELIB::Matrix * Zhs = get_matrix_Zhs(); + _metric_aoe = compute_aggregate_order_error(Zhs); + } +}// + + +/*--------------------------------------*/ +/* compute aoecv */ +/*--------------------------------------*/ +void SGTELIB::Surrogate::compute_metric_aoecv (void){ + check_ready(__FILE__,__FUNCTION__,__LINE__); + if (_metric_aoecv<0){ + #ifdef SGTELIB_DEBUG + std::cout << "Compute _metric_aoecv\n"; + #endif + // Compute the prediction on the training points + const SGTELIB::Matrix * Zvs = get_matrix_Zvs(); + _metric_aoecv = compute_aggregate_order_error(Zvs); + } +}// + + +/*--------------------------------------*/ +/* compute efioe */ +/*--------------------------------------*/ +void SGTELIB::Surrogate::compute_metric_efioe (void){ + check_ready(__FILE__,__FUNCTION__,__LINE__); + if (_metric_efioe<0){ + #ifdef SGTELIB_DEBUG + std::cout << "Compute _metric_efioe\n"; + #endif + SGTELIB::Matrix * EFI = new SGTELIB::Matrix("EFI",_p,_m); + EFI->fill(-1); + EFI->set_col(compute_efi(*get_matrix_Zhs(),*get_matrix_Shs()),_trainingset.get_j_obj()); + _metric_efioecv = compute_aggregate_order_error(EFI); + delete EFI; + } +}// + +/*--------------------------------------*/ +/* compute efioecv */ +/*--------------------------------------*/ +void SGTELIB::Surrogate::compute_metric_efioecv (void){ + check_ready(__FILE__,__FUNCTION__,__LINE__); + if (_metric_efioecv<0){ + #ifdef SGTELIB_DEBUG + std::cout << "Compute _metric_efioe\n"; + #endif + SGTELIB::Matrix * EFI = new SGTELIB::Matrix("EFI",_p,_m); + EFI->fill(-1); + EFI->set_col(compute_efi(*get_matrix_Zvs(),*get_matrix_Svs()),_trainingset.get_j_obj()); + _metric_efioecv = compute_aggregate_order_error(EFI); + delete EFI; + } +}// + + +/*----------------------------------------------------------*/ +/* compute EFI from the predictive mean and std */ +/*----------------------------------------------------------*/ +SGTELIB::Matrix SGTELIB::Surrogate::compute_efi( const SGTELIB::Matrix Zs, + const SGTELIB::Matrix Ss ){ + + const int p = Zs.get_nb_rows(); + if (Zs.get_nb_cols()!=_m) throw SGTELIB::Exception ( __FILE__ , __LINE__ ,"Unconsistent nb of cols" ); + + const SGTELIB::Matrix Z = _trainingset.Z_unscale(Zs); + const SGTELIB::Matrix S = _trainingset.ZE_unscale(Ss); + const double fmin = _trainingset.get_f_min(); + + SGTELIB::Matrix EFI ("EFI",p,1); + EFI.fill(1.0); + double v; + + for (int j=0 ; j<_m ; j++){ + if (_trainingset.get_bbo(j)==SGTELIB::BBO_OBJ){ + for (int i=0 ; i<p ; i++){ + v = SGTELIB::normei( Z.get(i,j) , S.get(i,j) , fmin ); + EFI.product(i,0,v); + } + } + if (_trainingset.get_bbo(j)==SGTELIB::BBO_CON){ + for (int i=0 ; i<p ; i++){ + v = SGTELIB::normcdf( 0.0 , Z.get(i,j) , S.get(i,j) ); + EFI.product(i,0,v); + } + } + }// end loop on j + + return EFI; + +}// + + + + + +/*--------------------------------------*/ +/* compute armse */ +/*--------------------------------------*/ +void SGTELIB::Surrogate::compute_metric_armse (void){ + check_ready(__FILE__,__FUNCTION__,__LINE__); + if (_metric_armse<0){ + #ifdef SGTELIB_DEBUG + std::cout << "Compute _metric_armse\n"; + #endif + compute_metric_rmse(); + _metric_armse = 0; + for (int j=0 ; j<_m ; j++) _metric_armse += _metric_rmse[j]; + } +}// + + +/*--------------------------------------*/ +/* compute armsecv */ +/*--------------------------------------*/ +void SGTELIB::Surrogate::compute_metric_armsecv (void){ + check_ready(__FILE__,__FUNCTION__,__LINE__); + if (_metric_armsecv<0){ + #ifdef SGTELIB_DEBUG + std::cout << "Compute _metric_armsecv\n"; + #endif + compute_metric_rmsecv(); + _metric_armsecv = 0; + for (int j=0 ; j<_m ; j++) _metric_armsecv += _metric_rmsecv[j]; + } +}// + +/*--------------------------------------*/ +/* compute linv */ +/*--------------------------------------*/ +void SGTELIB::Surrogate::compute_metric_linv (void){ + check_ready(__FILE__,__FUNCTION__,__LINE__); + if ( ! _metric_linv){ + #ifdef SGTELIB_DEBUG + std::cout << "Compute _metric_linv\n"; + #endif + // Init + _metric_linv = new double [_m]; + + // Compute the prediction on the training points + const SGTELIB::Matrix * Zhs = get_matrix_Zhs(); + const SGTELIB::Matrix * Shs = get_matrix_Shs(); + // True values + const SGTELIB::Matrix Zs = get_matrix_Zs(); + double s,dz; + double linv; + // TODO : improve the behavior of linv for very small s. + for (int j=0 ; j<_m ; j++){ + if (_trainingset.get_bbo(j)!=SGTELIB::BBO_DUM){ + linv = 0; + for (int i=0 ; i<_p ; i++){ + dz = Zhs->get(i,j)-Zs.get(i,j); + s = Shs->get(i,j); + s = std::max(s ,EPSILON); + dz= std::max(dz,EPSILON); + linv += -log(s) - pow(dz/s,2)/2; + } + linv /= _p; // normalization by the number of points + linv -= 0.5*log(2*3.141592654); // add the normal pdf constant + // Add this point, we have log(prod g)/p + linv = exp(-linv); + _metric_linv[j] = linv; + } + else{ + _metric_linv[j] = -SGTELIB::INF; + } + } + } + +}// + + + +/*--------------------------------------*/ +/* compute order efficiency */ +/*--------------------------------------*/ +void SGTELIB::Surrogate::compute_order_error (const SGTELIB::Matrix * const Zpred , + double * m ){ + + check_ready(__FILE__,__FUNCTION__,__LINE__); + // Compute the order-efficiency metric by comparing the + // values of - _Zs (in the trainingset) + // - Zpred (input of this function) + // Put the results in "m" (output of this function) + + if ( ! m){ + display(std::cout); + throw SGTELIB::Exception ( __FILE__ , __LINE__ , + "compute_order_error(): m is NULL" ); + } + + int nb_fail; + const SGTELIB::Matrix Zs = get_matrix_Zs(); + + for (int j=0 ; j<_m ; j++){ + switch (_trainingset.get_bbo(j)){ + //===============================================// + case SGTELIB::BBO_OBJ: + double z1,z1h,z2,z2h; + nb_fail = 0; + for (int i1=0 ; i1<_p ; i1++){ + z1 = Zs.get(i1,j); + z1h = Zpred->get(i1,j); + for (int i2=0 ; i2<_p ; i2++){ + z2 = Zs.get(i2,j); + z2h = Zpred->get(i2,j); + if ( (z1-z2<0)^(z1h-z2h<0) ) nb_fail++; + } + } + m[j] = double(nb_fail)/double(_p*_p); + break; + //===============================================// + case SGTELIB::BBO_CON: + nb_fail = 0; + double z,zh; + for (int i=0 ; i<_p ; i++){ + z = Zs.get(i,j); + zh = Zpred->get(i,j); + if ( (z<0)^(zh<0) ) nb_fail++; + } + + m[j] = double(nb_fail)/double(_p); + break; + //===============================================// + case SGTELIB::BBO_DUM: + m[j] = -1.0; + break; + //===============================================// + default: + display(std::cout); + throw SGTELIB::Exception ( __FILE__ , __LINE__ ,"Undefined type" ); + //===============================================// + }// end switch + }// end loop on j +}// + + +/*--------------------------------------*/ +/* compute order efficiency */ +/*--------------------------------------*/ +double SGTELIB::Surrogate::compute_aggregate_order_error (const SGTELIB::Matrix * const Zpred){ + + check_ready(__FILE__,__FUNCTION__,__LINE__); + + const SGTELIB::Matrix Zs = get_matrix_Zs(); + + // Build f1,h1,f2 and h2. + // f1 and h1 are the real data + // f2 and h2 are the surrogate. + + SGTELIB::Matrix fhr ("fhr",_p,2); + SGTELIB::Matrix fhs ("fhs",_p,2); + fhr.fill(0.0); + fhs.fill(0.0); + int i,j; + for (j=0 ; j<_m ; j++){ + switch (_trainingset.get_bbo(j)){ + //===============================================// + case SGTELIB::BBO_OBJ: + fhr.set_col( Zs.get_col(j) , 0 ); + fhs.set_col( Zpred->get_col(j) , 0 ); + break; + //===============================================// + case SGTELIB::BBO_CON: + for (i=0 ; i<_p ; i++){ + double d; + d = Zs.get(i,j); + if (d>0) fhr.add(i,1,d*d); + d = Zpred->get(i,j); + if (d>0) fhs.add(i,1,d*d); + } + break; + //===============================================// + case SGTELIB::BBO_DUM: + break; + //===============================================// + default: + display(std::cout); + throw SGTELIB::Exception ( __FILE__ , __LINE__ ,"Undefined type" ); + //===============================================// + }// end switch + }// end loop on j + + int e = 0; + int i1,i2; + double hr1,hr2,hs1,hs2,fr1,fr2,fs1,fs2; + bool inf_r,inf_s; + // i1 and i2 are the indexes of the two points that are compared. + // fr1 and hr1 (resp. fr2 and hr2) are the real values of f and r for these points. + // fs1 and hs1 (resp. fs2 and hs2) are the surrogate (or CV) values. + for (i1=0 ; i1<_p ; i1++){ + fr1 = fhr.get(i1,0); + hr1 = fhr.get(i1,1); + fs1 = fhs.get(i1,0); + hs1 = fhs.get(i1,1); + for (i2=0 ; i2<_p ; i2++){ + fr2 = fhr.get(i2,0); + hr2 = fhr.get(i2,1); + fs2 = fhs.get(i2,0); + hs2 = fhs.get(i2,1); + // Compute the order for real (r) data and for surrogate (s) model + inf_r = ( (hr1<hr2) | ( (hr1==hr2) & (fr1<fr2) ) ); + inf_s = ( (hs1<hs2) | ( (hs1==hs2) & (fs1<fs2) ) ); + // If they don't agree, increment e. (Note that ^ is the xor operator) + if (inf_r ^ inf_s) e++; + } + } + return double(e)/double(_p*_p); + +}// + +/*--------------------------------------*/ +/* get_exclusion_area_penalty */ +/*--------------------------------------*/ +SGTELIB::Matrix SGTELIB::Surrogate::get_exclusion_area_penalty ( const SGTELIB::Matrix & XX , const double tc ) const{ + // Scale the input + SGTELIB::Matrix XXs(XX); + XXs.set_name("XXs"); + _trainingset.X_scale(XXs); + return _trainingset.get_exclusion_area_penalty ( XXs , tc ); +}// + + +/*--------------------------------------*/ +/* get_distance_to_closest */ +/*--------------------------------------*/ +SGTELIB::Matrix SGTELIB::Surrogate::get_distance_to_closest ( const SGTELIB::Matrix & XX ) const{ + // Scale the input + SGTELIB::Matrix XXs(XX); + XXs.set_name("XXs"); + _trainingset.X_scale(XXs); + return _trainingset.get_distance_to_closest ( XXs ); +}// + + + + +/*--------------------------------------*/ +/* optimize model parameters */ +/*--------------------------------------*/ +bool SGTELIB::Surrogate::optimize_parameters ( void ) { + + + // Number of parameters to optimize + const int N = _param.get_nb_parameter_optimization(); + // Budget + int budget = N*_param.get_budget(); + + int i,j,k; + double d; + const bool display = false; + if (display){ + std::cout << "Begin parameter optimization\n"; + std::cout << "Metric: " << SGTELIB::metric_type_to_str(_param.get_metric_type()) << "\n"; + } + + + + //----------------------------------------- + // Bounds, Scaling and domain + //----------------------------------------- + SGTELIB::Matrix lb("lb",1,N); + SGTELIB::Matrix ub("ub",1,N); + SGTELIB::Matrix scaling ("scaling",1,N); + bool * logscale = new bool [N]; + SGTELIB::param_domain_t * domain = new SGTELIB::param_domain_t[N]; + + _param.get_x_bounds ( &lb , &ub , domain , logscale ); + + for (i=0 ; i<N ; i++){ + if (domain[i]==SGTELIB::PARAM_DOMAIN_CONTINUOUS){ + if (logscale[i]) d = 1; + else d = (ub[i]-lb[i])/5; + scaling.set(0,i,d); + if (d<EPSILON) throw SGTELIB::Exception ( __FILE__ , __LINE__ ,"Bad scaling." ); + } + else if (domain[i]==SGTELIB::PARAM_DOMAIN_CAT){ + scaling.set(0,i,ub[i]-lb[i]); + } + else{ + scaling.set(0,i,1); + } + } + + if (display){ + std::cout << "Model: " << get_short_string() << "\n"; + std::cout << "lb: [ "; + for (i=0 ; i<N ; i++) std::cout << lb[i] << " "; + std::cout << "]\n"; + std::cout << "ub: [ "; + for (i=0 ; i<N ; i++) std::cout << ub[i] << " "; + std::cout << "]\n"; + std::cout << "scaling: [ "; + for (i=0 ; i<N ; i++){ + std::cout << scaling[i]; + if (logscale[i]) std::cout << "(log)"; + std::cout << " "; + } + std::cout << "]\n"; + } + + // Build set of starting points + const int nx0 = 1+budget/10; + SGTELIB::Matrix X0 ("X0",nx0,N); + X0.set_row(_param.get_x(),0); + for (j=0 ; j<N ; j++){ + double lbj = lb[j]; + double ubj = ub[j]; + for (i=1 ; i<nx0 ; i++){ // nb: Skip the first row of X0 + d = uniform_rand(); + if (logscale[j]) d = lb[j] * pow(ubj/lbj,d); + else d = lbj + (ubj-lbj)*d; + X0.set(i,j,d); + } + } + + //--------------------------------------------- + // Budget, poll size, success and objectives + //--------------------------------------------- + + SGTELIB::Matrix xtry ("xtry",1,N); + double fmin = +INF; + double pmin = +INF; + double ftry, ptry; + bool success; + double psize = 0.5; + SGTELIB::Matrix POLL; + SGTELIB::Matrix xmin = X0.get_row(0); + + // Init cache of evaluated points + SGTELIB::Matrix CACHE ("CACHE",0,N); + bool cache_hit; + + //------------------------ + // LOOP + //------------------------ + int iter=0; + while (budget>0){ + + success = false; + + if (display){ + std::cout << "=================================================\n"; + std::cout << "Budget: " << budget << "\n"; + // Display best solution + std::cout << "\nCurrent xmin:\n"; + std::cout << "X=[ " ; + for (j=0 ; j<N ; j++) std::cout << xmin[j] << " "; + std::cout << "] => " << fmin << " / " << pmin << "\n\n"; + } + + if (iter){ + // Create POLL candidates + POLL = SGTELIB::Matrix::get_poll_directions(scaling,domain,psize); + //POLL.display(std::cout); + for (i=0 ; i<POLL.get_nb_rows() ; i++){ + for (j=0 ; j<N ; j++){ + // Add poll directions to poll center + d = xmin[j]; + if (logscale[j]) d *= pow(4.0,POLL.get(i,j)); //exp(POLL.get(i,j)); + else d += POLL.get(i,j); + xtry.set(0,j,d); + }// End build candidate + POLL.set_row(xtry,i); + } // End Create POLL + POLL.set_name("POLL-CANDIDATES"); + //POLL.display(std::cout); + } + else{ + // If iter==0, then evaluate starting points + POLL = X0; + } + + // Evaluate POLL + for (i=0 ; i<POLL.get_nb_rows() ; i++){ + + // Candidate + xtry = POLL.get_row(i); + xtry.set_name("xtry"); + + // Display candidate + if (display){ + if (iter) std::cout << "X = [ " ; + else std::cout << "X0= [ " ; + for (j=0 ; j<N ; j++) std::cout << xtry[j] << " "; + std::cout << "] => "; + } + + // Snap to bounds + for (j=0 ; j<N ; j++){ + d = xtry[j]; + // Snap to bounds + double lbj = lb[j]; + double ubj = ub[j]; + switch (domain[j]){ + case SGTELIB::PARAM_DOMAIN_CONTINUOUS: + if (d<lbj) d = lbj; + if (d>ubj) d = ubj; + break; + case SGTELIB::PARAM_DOMAIN_INTEGER: + d = double(round(d)); + if (d<lbj) d=lbj; + if (d>ubj) d=ubj; + break; + case SGTELIB::PARAM_DOMAIN_CAT: + k = round(d); + while (k>ubj) k-=int(ubj-lbj); + while (k<lbj) k+=int(ubj-lbj); + d = double(k); + break; + case SGTELIB::PARAM_DOMAIN_BOOL: + d = (d>1/2)?1.0:0.0; + break; + case SGTELIB::PARAM_DOMAIN_MISC: + throw SGTELIB::Exception ( __FILE__ , __LINE__ ,"Invalid variable domain!" ); + break; + } + xtry.set(0,j,d); + } + + // Check Cache + cache_hit = (CACHE.find_row(xtry)!=-1); + if (cache_hit){ + if (display) std::cout << "Cache hit\n"; + } + else{ + // --------------------------------- + // EVALUATION + // --------------------------------- + _param.set_x(xtry); + _param.check(); + ftry = eval_objective(); + ptry = _param.get_x_penalty(); + budget--; + CACHE.add_rows(xtry); + + // Display f + if (display){ + if (ftry>=+INF) std::cout << "+inf" ; + else std::cout << ftry; + std::cout << " / " ; + if (ptry>=+INF) std::cout << "+inf" ; + else std::cout << ptry; + } + + // Check for success for each objective + if ( (ftry<fmin) || ((ftry==fmin) && (ptry<pmin)) ){ + if (display) std::cout << "(!)"; + xmin = xtry; + fmin = ftry; + pmin = ptry; + success = true; + } + if (display) std::cout << "\n"; + } // End Evaluation (i.e. No Cache Hit) + + if ( (iter) && (success) ) break; + + }// END LOOP ON POLL (for i...) + + if (iter){ + // Update poll size + if (success) psize*=2; + else psize/=2; + } + iter++; + + // Check convergence + if (psize<1e-6) break; + if (budget<=0) break; + + }// End of optimization + + // Set param to optimal value + _param.set_x(xmin); + _param.check(); + + fmin = eval_objective(); + /* + _param.display(std::cout); + std::cout << "fmin = " << fmin << "\n"; + std::cout << "=================================\n"; + */ + if (display){ + _param.display(std::cout); + std::cout << "End parameter optimization\n"; + std::cout << "=================================\n"; + } + + // Check for Nan + if (xmin.has_nan() || xmin.has_inf()) return false; + + delete [] logscale; + delete [] domain; + + // Return success + return true; + +}// + + +/*--------------------------------------*/ +/* Evaluate a set of parameters */ +/*--------------------------------------*/ +double SGTELIB::Surrogate::eval_objective ( void ){ + + //std::cout << "Eval obj...\n"; + reset_metrics(); + + // Build model + bool ok = build_private(); + if ( ! ok) return +INF; + + // Compute metric + const SGTELIB::metric_t mt = _param.get_metric_type(); + + double metric = 0; + if (SGTELIB::metric_multiple_obj(mt)){ + for (int i=0 ; i<_m ; i++) metric += get_metric(mt,i); + } + else{ + metric = get_metric(mt,0); + } + + if ( isnan(metric) ) return +INF; + if ( isinf(metric) ) return +INF; + return metric; + +}// + + + + + + + + + diff --git a/ext/sgtelib/src/Surrogate.hpp b/ext/sgtelib/src/Surrogate.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f28690e85cdc7f7f78e919ca00ef490dc5f45696 --- /dev/null +++ b/ext/sgtelib/src/Surrogate.hpp @@ -0,0 +1,237 @@ +/*-------------------------------------------------------------------------------------*/ +/* sgtelib - A surrogate model library for derivative-free optimization */ +/* Version 2.0.1 */ +/* */ +/* Copyright (C) 2012-2017 Sebastien Le Digabel - Ecole Polytechnique, Montreal */ +/* Bastien Talgorn - McGill University, Montreal */ +/* */ +/* Author: Bastien Talgorn */ +/* email: bastientalgorn@fastmail.com */ +/* */ +/* This program is free software: you can redistribute it and/or modify it under the */ +/* terms of the GNU Lesser General Public License as published by the Free Software */ +/* Foundation, either version 3 of the License, or (at your option) any later */ +/* version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ +/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ +/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License along */ +/* with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on sgtelib at https://github.com/bastientalgorn/sgtelib */ +/*-------------------------------------------------------------------------------------*/ + +#ifndef __SGTELIB_SURROGATE__ +#define __SGTELIB_SURROGATE__ + +#include "Matrix.hpp" +#include "TrainingSet.hpp" +#include "Kernel.hpp" +#include "Surrogate_Parameters.hpp" + +namespace SGTELIB { + + /*--------------------------------------*/ + /* Surrogate class */ + /*--------------------------------------*/ + class Surrogate { + + // Surrogate Ensemble is a friend, so that it can access to private and protected + // prediction methods of other derived classed of Surrogate_Ensemble + friend class Surrogate_Ensemble; + + protected: + + // TrainingSet containing the data + // (may be shared between several surrogates) + SGTELIB::TrainingSet & _trainingset; + // Parameters + SGTELIB::Surrogate_Parameters _param; + + // Input dim + const int _n; + // Ouptut dim + const int _m; + + // Number of data points of the training set + int _p_ts; + int _p_ts_old; + // Number of data points used in the model + int _p; + int _p_old; + + // Is the surrogate ready to perform predictions ? + bool _ready; + + // Predictions + // _Zhs: Prediction of the model in the training points + // (used to compute emax, rmse, eotp, linv) + SGTELIB::Matrix * _Zhs; + SGTELIB::Matrix * _Shs; // Predictive std on the training points + + // _Zvs: Cross-Validation prediction of the model in the training points + // (used to compute rmsecv, oecv) + SGTELIB::Matrix * _Zvs; + SGTELIB::Matrix * _Svs; // Cross-validation std on the training points + + // List of points used to build the model + std::list<int> _selected_points; + + // metrics + double * _metric_emax; + double * _metric_emaxcv; + double * _metric_rmse; + double * _metric_rmsecv; + double * _metric_oe; + double * _metric_oecv; + double * _metric_linv; + double _metric_aoe; + double _metric_aoecv; + double _metric_efioe; + double _metric_efioecv; + double _metric_armse; + double _metric_armsecv; + + // psize_max : Larger value of psize that led to a success + // in the previous parameter optimization. + double _psize_max; + + // Output stream + std::ofstream _out; + bool _display; + + // private affectation operator: + Surrogate & operator = ( const Surrogate & ); + + // build model (private): + virtual bool build_private (void) = 0; + virtual bool init_private (void); + + // Compute metrics + void compute_metric_emax (void); + void compute_metric_emaxcv (void); + void compute_metric_rmse (void); + void compute_metric_rmsecv (void); + void compute_metric_armse (void); + void compute_metric_armsecv (void); + void compute_metric_oe (void); + void compute_metric_oecv (void); + void compute_metric_aoe (void); + void compute_metric_aoecv (void); + void compute_metric_efioe (void); + void compute_metric_efioecv (void); + virtual void compute_metric_linv (void); + //virtual void compute_metric_eficv (void); + + // Function used to compute "_metric_oe" and "_metric_oecv" + void compute_order_error ( const SGTELIB::Matrix * const Zpred , + double * m ); + double compute_aggregate_order_error ( const SGTELIB::Matrix * const Zpred ); + + SGTELIB::Matrix compute_efi( const SGTELIB::Matrix Zs, + const SGTELIB::Matrix Ss ); + + // predict model (private): + virtual void predict_private ( const SGTELIB::Matrix & XXs, + SGTELIB::Matrix * ZZs, + SGTELIB::Matrix * std, + SGTELIB::Matrix * ei , + SGTELIB::Matrix * cdf ); + + virtual void predict_private ( const SGTELIB::Matrix & XXs, + SGTELIB::Matrix * ZZs) = 0; + + + // Display private + virtual void display_private ( std::ostream & out ) const = 0; + + // get matrices (these matrices are unscaled before being returned) + // (That's why these functions cant be public) + const SGTELIB::Matrix get_matrix_Xs (void); + const SGTELIB::Matrix get_matrix_Zs (void); + const SGTELIB::Matrix get_matrix_Ds (void); + + // Compute scaled data + // Compute the cross-validation matrix + virtual const SGTELIB::Matrix * get_matrix_Zvs (void) = 0; + virtual const SGTELIB::Matrix * get_matrix_Zhs (void); + virtual const SGTELIB::Matrix * get_matrix_Shs (void); + virtual const SGTELIB::Matrix * get_matrix_Svs (void); + + public: + // constructor: + + Surrogate ( SGTELIB::TrainingSet & trainingset, + const SGTELIB::Surrogate_Parameters param); + + Surrogate ( SGTELIB::TrainingSet & trainingset, + const SGTELIB::model_t mt ); + + Surrogate ( SGTELIB::TrainingSet & trainingset, + const std::string & s ); + + // destructor: + virtual ~Surrogate ( void ); + + void reset_metrics ( void ); + void info ( void ) const ; + + // check ready + void check_ready (const std::string & s) const; + void check_ready (const std::string & file, const std::string & function, const int & i) const; + void check_ready (void) const; + + // Get metrics + double get_metric (SGTELIB::metric_t mt , int j); + + // construct: + bool build (void); + + // predict: + void predict ( const SGTELIB::Matrix & XX , + SGTELIB::Matrix * ZZ , // nb : ZZ is a ptr + SGTELIB::Matrix * std, + SGTELIB::Matrix * ei , + SGTELIB::Matrix * cdf); + + void predict ( const SGTELIB::Matrix & XX , + SGTELIB::Matrix * ZZ ); + + // Compute unscaled data + const SGTELIB::Matrix get_matrix_Zh (void); + const SGTELIB::Matrix get_matrix_Sh (void); + const SGTELIB::Matrix get_matrix_Zv (void); + const SGTELIB::Matrix get_matrix_Sv (void); + + // add points: + bool add_points ( const SGTELIB::Matrix & Xnew , + const SGTELIB::Matrix & Znew ); + bool add_point ( const double * xnew , + const double * znew ); + + // exclusion_area + SGTELIB::Matrix get_exclusion_area_penalty ( const SGTELIB::Matrix & XX , const double tc ) const; + SGTELIB::Matrix get_distance_to_closest ( const SGTELIB::Matrix & XX ) const; + + bool is_ready (void) const {return _ready;}; + void display_trainingset (void) const {_trainingset.build();_trainingset.display(std::cout);}; + SGTELIB::model_t get_type (void) const {return _param.get_type();}; + std::string get_string (void) const {return _param.get_string();}; + std::string get_short_string (void) const {return _param.get_short_string();}; + void display ( std::ostream & out ) const; + const SGTELIB::Surrogate_Parameters get_param (void) const {return _param;}; + + // Set: + void set_kernel_coef (double v) { _param.set_kernel_coef(v); }; + + // Parameter optimization + bool optimize_parameters ( void ); + double eval_objective ( void ); + + }; +} + +#endif + diff --git a/ext/sgtelib/src/Surrogate_CN.cpp b/ext/sgtelib/src/Surrogate_CN.cpp new file mode 100644 index 0000000000000000000000000000000000000000..abb25fbaff6f14e2dbdc97e4a87ae9ad111f0271 --- /dev/null +++ b/ext/sgtelib/src/Surrogate_CN.cpp @@ -0,0 +1,191 @@ +/*-------------------------------------------------------------------------------------*/ +/* sgtelib - A surrogate model library for derivative-free optimization */ +/* Version 2.0.1 */ +/* */ +/* Copyright (C) 2012-2017 Sebastien Le Digabel - Ecole Polytechnique, Montreal */ +/* Bastien Talgorn - McGill University, Montreal */ +/* */ +/* Author: Bastien Talgorn */ +/* email: bastientalgorn@fastmail.com */ +/* */ +/* This program is free software: you can redistribute it and/or modify it under the */ +/* terms of the GNU Lesser General Public License as published by the Free Software */ +/* Foundation, either version 3 of the License, or (at your option) any later */ +/* version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ +/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ +/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License along */ +/* with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on sgtelib at https://github.com/bastientalgorn/sgtelib */ +/*-------------------------------------------------------------------------------------*/ + +#include "Surrogate_CN.hpp" + +/*----------------------------*/ +/* constructor */ +/*----------------------------*/ +SGTELIB::Surrogate_CN::Surrogate_CN ( SGTELIB::TrainingSet & trainingset, + SGTELIB::Surrogate_Parameters param) : + SGTELIB::Surrogate ( trainingset , param ) { + #ifdef SGTELIB_DEBUG + std::cout << "constructor CN\n"; + #endif +}// + + +/*----------------------------*/ +/* destructor */ +/*----------------------------*/ +SGTELIB::Surrogate_CN::~Surrogate_CN ( void ) { + +}// + + +/*--------------------------------------*/ +/* display */ +/*--------------------------------------*/ +void SGTELIB::Surrogate_CN::display_private ( std::ostream & out ) const { + out << "(No special members)\n"; +}// + + +/*--------------------------------------*/ +/* build_private */ +/*--------------------------------------*/ +bool SGTELIB::Surrogate_CN::build_private ( void ) { + _ready = true; + return true; +}// + +/*--------------------------------------*/ +/* predict_private (ZZs only) */ +/*--------------------------------------*/ +void SGTELIB::Surrogate_CN::predict_private ( const SGTELIB::Matrix & XXs, + SGTELIB::Matrix * ZZs) { + + int i,imin; + const int pxx = XXs.get_nb_rows(); + + // D : distance between points of XXs and other points of the trainingset + SGTELIB::Matrix D = _trainingset.get_distances(XXs,get_matrix_Xs(),_param.get_distance_type()); + + // Data: + const SGTELIB::Matrix & Zs = get_matrix_Zs(); + + // Loop on the points of XXs + for (i=0 ; i<pxx ; i++){ + // imin is the index of the closest neighbor of xx in Xs + imin = D.get_min_index_row(i); + // Copy the output of this point + ZZs->set_row( Zs.get_row(imin) , i); + } + +}// + + +/*--------------------------------------*/ +/* compute cv values */ +/*--------------------------------------*/ +bool SGTELIB::Surrogate_CN::compute_cv_values (void){ + check_ready(__FILE__,__FUNCTION__,__LINE__); + + if ((_Zvs) && (_Svs)) return true; + + + // Init matrices + if ( ! _Zvs){ + _Zvs = new SGTELIB::Matrix ("Zvs",_p,_m); + _Zvs->set_name("Zvs"); + } + + if ( ! _Svs){ + _Svs = new SGTELIB::Matrix ("Svs",_p,_m); + _Svs->set_name("Svs"); + } + + + int i,i2,imin=0; + double d; + SGTELIB::Matrix D = _trainingset.get_distances(get_matrix_Xs(),get_matrix_Xs(),_param.get_distance_type()); + const SGTELIB::Matrix & Zs = get_matrix_Zs(); + + // Loop on the outputs + for (i=0 ; i<_p ; i++){ + // Find the closest point to iv (not itself) + double dmin = SGTELIB::INF; + // Loop on the points of the trainingset + for (i2=0 ; i2<_p ; i2++){ + d = D.get(i,i2); + if ( (i!=i2) && (d<dmin) ){ + dmin = d; + imin = i2; + } + } + _Zvs->set_row( Zs.get_row(imin) , i); + _Svs->set_row( dmin , i); + } + + + return true; + +}// + +/*--------------------------------------*/ +/* get_matrix_Zhs */ +/*--------------------------------------*/ +const SGTELIB::Matrix * SGTELIB::Surrogate_CN::get_matrix_Zhs (void){ + check_ready(__FILE__,__FUNCTION__,__LINE__); + if ( ! _Zhs){ + _Zhs = new SGTELIB::Matrix(get_matrix_Zs()); + } + return _Zhs; +}// + +/*--------------------------------------*/ +/* get_matrix_Shs */ +/*--------------------------------------*/ +const SGTELIB::Matrix * SGTELIB::Surrogate_CN::get_matrix_Shs (void){ + check_ready(__FILE__,__FUNCTION__,__LINE__); + if ( ! _Shs){ + _Shs = new SGTELIB::Matrix("Shs",_p,_m); + } + return _Shs; +}// + + +/*--------------------------------------*/ +/* get_matrix_Zvs */ +/*--------------------------------------*/ +const SGTELIB::Matrix * SGTELIB::Surrogate_CN::get_matrix_Zvs (void){ + check_ready(__FILE__,__FUNCTION__,__LINE__); + compute_cv_values(); + return _Zvs; +}// + +/*--------------------------------------*/ +/* get_matrix_Svs */ +/*--------------------------------------*/ +const SGTELIB::Matrix * SGTELIB::Surrogate_CN::get_matrix_Svs (void){ + check_ready(__FILE__,__FUNCTION__,__LINE__); + compute_cv_values(); + return _Svs; +}// + + + + + + + + + + + + + + + diff --git a/ext/sgtelib/src/Surrogate_CN.hpp b/ext/sgtelib/src/Surrogate_CN.hpp new file mode 100644 index 0000000000000000000000000000000000000000..9c405559eb81b032a55def4a668a486726d0f577 --- /dev/null +++ b/ext/sgtelib/src/Surrogate_CN.hpp @@ -0,0 +1,68 @@ +/*-------------------------------------------------------------------------------------*/ +/* sgtelib - A surrogate model library for derivative-free optimization */ +/* Version 2.0.1 */ +/* */ +/* Copyright (C) 2012-2017 Sebastien Le Digabel - Ecole Polytechnique, Montreal */ +/* Bastien Talgorn - McGill University, Montreal */ +/* */ +/* Author: Bastien Talgorn */ +/* email: bastientalgorn@fastmail.com */ +/* */ +/* This program is free software: you can redistribute it and/or modify it under the */ +/* terms of the GNU Lesser General Public License as published by the Free Software */ +/* Foundation, either version 3 of the License, or (at your option) any later */ +/* version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ +/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ +/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License along */ +/* with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on sgtelib at https://github.com/bastientalgorn/sgtelib */ +/*-------------------------------------------------------------------------------------*/ + +#ifndef __SGTELIB_SURROGATE_CN__ +#define __SGTELIB_SURROGATE_CN__ + +#include "Surrogate.hpp" + +namespace SGTELIB { + + /*--------------------------------------*/ + /* Surrogate_CN class */ + /*--------------------------------------*/ + class Surrogate_CN : public SGTELIB::Surrogate { + + private: + + virtual bool build_private (void); + + virtual void predict_private ( const SGTELIB::Matrix & XXs, + SGTELIB::Matrix * ZZs); + + // Compute metrics + virtual const SGTELIB::Matrix * get_matrix_Zvs (void); + virtual const SGTELIB::Matrix * get_matrix_Zhs (void); + virtual const SGTELIB::Matrix * get_matrix_Svs (void); + virtual const SGTELIB::Matrix * get_matrix_Shs (void); + + bool compute_cv_values (void); + + public: + + // Constructor + Surrogate_CN ( SGTELIB::TrainingSet & trainingset , + SGTELIB::Surrogate_Parameters param) ; + + // destructor: + virtual ~Surrogate_CN ( void ); + + virtual void display_private ( std::ostream & out ) const; + + }; +} + +#endif + diff --git a/ext/sgtelib/src/Surrogate_Ensemble.cpp b/ext/sgtelib/src/Surrogate_Ensemble.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f6aadfbab4b89161bce18994e3683bd4cf6f678f --- /dev/null +++ b/ext/sgtelib/src/Surrogate_Ensemble.cpp @@ -0,0 +1,1061 @@ +/*-------------------------------------------------------------------------------------*/ +/* sgtelib - A surrogate model library for derivative-free optimization */ +/* Version 2.0.1 */ +/* */ +/* Copyright (C) 2012-2017 Sebastien Le Digabel - Ecole Polytechnique, Montreal */ +/* Bastien Talgorn - McGill University, Montreal */ +/* */ +/* Author: Bastien Talgorn */ +/* email: bastientalgorn@fastmail.com */ +/* */ +/* This program is free software: you can redistribute it and/or modify it under the */ +/* terms of the GNU Lesser General Public License as published by the Free Software */ +/* Foundation, either version 3 of the License, or (at your option) any later */ +/* version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ +/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ +/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License along */ +/* with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on sgtelib at https://github.com/bastientalgorn/sgtelib */ +/*-------------------------------------------------------------------------------------*/ + +#include "Surrogate_Ensemble.hpp" + +/*----------------------------*/ +/* constructor */ +/*----------------------------*/ +SGTELIB::Surrogate_Ensemble::Surrogate_Ensemble ( SGTELIB::TrainingSet & trainingset, + SGTELIB::Surrogate_Parameters param ) : + SGTELIB::Surrogate ( trainingset , param ), + _kmax ( 0 ), + _kready ( 0 ), + _active ( NULL ), + _metric ( new double [_m] ){ + + #ifdef ENSEMBLE_DEBUG + std::cout << "constructor Ensemble 1\n"; + #endif + // Init Model list + model_list_preset(_param.get_preset()); + // Init the weight matrix in _param + SGTELIB::Matrix W ("W",_kmax,_m); + W.fill(1.0/double(_kmax)); + _param.set_weight(W); +} + + +/*----------------------------*/ +/* destructor */ +/*----------------------------*/ +SGTELIB::Surrogate_Ensemble::~Surrogate_Ensemble ( void ) { + + delete [] _active; + delete [] _metric; + + for (int k=0 ; k<_kmax ; k++){ + if ( _surrogates.at(k) ){ + surrogate_delete( _surrogates.at(k) ); + } + } + _surrogates.clear(); + +}// + +/*--------------------------------------*/ +/* display */ +/*--------------------------------------*/ +void SGTELIB::Surrogate_Ensemble::display_private ( std::ostream & out ) const { + + out << "kmax: " << _kmax << "\n"; + out << "kready: " << _kready << "\n"; + + SGTELIB::Matrix W = _param.get_weight(); + /* + out << "W = [ "; + for ( int k=0 ; k<_kmax ; k++) out << W.get(k,0) << " "; + out << " ]\n"; + */ +/* + for (int k=0 ; k<_kmax ; k++){ + out <<"model[" << k << "]: " << _surrogates.at(k)->get_string() << "\n"; + } +*/ +/* + double w; + for (int j=0 ; j<_m ; j++){ + out << "output " << j << ":\n"; + for ( int k=0 ; k<_kmax ; k++){ + out << " ["; + out.width(2); + out << k; + out << "]: "; + out.width(12); + out << _surrogates.at(k)->get_metric(_param.get_metric_type(),j) << " ; w: "; + + w = W.get(k,j); + if (w==0) out << " 0 %"; + else if (w<=0.01) out << " <1 %"; + else{ + w = double(round(w*100)); + out.width(3); + out << w << " %"; + } + out << " ; "; + out << _surrogates.at(k)->get_short_string(); + if (! is_ready(k)) + out << " (Not Ready)"; + out << "\n"; + } + // Metric of the Ensemble + out << " =====>"; + out.width(8); + out << _metric[j] ; + out << " ; weight: N.A. ; " << get_short_string() << "\n"; + } + +*/ + + double w; + for (int j=0 ; j<_m ; j++){ + out << "output " << _p << " " << j << ":"; + for ( int k=0 ; k<_kmax ; k++){ + w = W.get(k,j); + if (w>EPSILON) out << " " << k ; + } + out << "\n"; + } + + + +}// + + +/*-----------------------------------------*/ +/* display model list */ +/* (remove all the models of a given type) */ +/*-----------------------------------------*/ +void SGTELIB::Surrogate_Ensemble::model_list_display ( std::ostream & out ) { + out << "model list (_kmax=" << _kmax << "):\n"; + if (_kmax==0){ + out << "model list is empty\n"; + } + for (int k=0 ; k<_kmax ; k++){ + out <<" Model " << k << ": " << _surrogates.at(k)->get_string() << "\n"; + } + +}// + + +/*-----------------------------------------*/ +/* remove all models from model list */ +/*-----------------------------------------*/ +void SGTELIB::Surrogate_Ensemble::model_list_remove_all ( void ){ + + std::vector<SGTELIB::Surrogate *>::iterator it = _surrogates.begin(); + while (it != _surrogates.end()){ + SGTELIB::surrogate_delete(*it); + it = _surrogates.erase(it); + } + _surrogates.clear(); + _kmax = 0; +}// + +/*-----------------------------------------*/ +/* add one model */ +/*-----------------------------------------*/ +void SGTELIB::Surrogate_Ensemble::model_list_add ( const std::string & definition ){ + _surrogates.push_back( SGTELIB::Surrogate_Factory(_trainingset,definition) ); + _kmax++; +}// + + +/*--------------------------------------*/ +/* init_private */ +/*--------------------------------------*/ +bool SGTELIB::Surrogate_Ensemble::init_private ( void ) { + #ifdef SGTELIB_DEBUG + std::cout << "Surrogate_Ensemble : init_private\n"; + #endif + + // Need at least 2 surrogates + if (_kmax<=1){ + #ifdef ENSEMBLE_DEBUG + std::cout << "Surrogate_Ensemble : _kmax : " << _kmax << "\n"; + #endif + return false; + } + + // Build them & count the number of ready + _kready = 0; + int k; + for (k=0 ; k<_kmax ; k++){ + #ifdef ENSEMBLE_DEBUG + std::cout << "Init model " << k << "/" << _kmax << ": " << _surrogates.at(k)->get_short_string(); + #endif + if (_surrogates.at(k)->build()){ + _kready++; + #ifdef ENSEMBLE_DEBUG + std::cout << " (ready)\n"; + #endif + } + } + #ifdef ENSEMBLE_DEBUG + std::cout << "Surrogate_Ensemble : _kready/_kmax : " << _kready << "/" << _kmax << "\n"; + #endif + + + // Need at least 2 ready surrogates + if (_kready<=1){ + return false; + } + + // Init weights with selection + compute_W_by_select(); + + return true; +}// + + +/*--------------------------------------*/ +/* build */ +/*--------------------------------------*/ +bool SGTELIB::Surrogate_Ensemble::build_private ( void ) { + + #ifdef ENSEMBLE_DEBUG + std::cout << "Surrogate_Ensemble : build_private\n"; + #endif + + int k; + + // computation of the weight + switch (_param.get_weight_type()){ + case SGTELIB::WEIGHT_SELECT: + compute_W_by_select(); + break; + case SGTELIB::WEIGHT_WTA1: + compute_W_by_wta1(); + break; + case SGTELIB::WEIGHT_WTA3: + compute_W_by_wta3(); + break; + case SGTELIB::WEIGHT_OPTIM: + case SGTELIB::WEIGHT_EXTERN: + #ifdef ENSEMBLE_DEBUG + std::cout << "Weight corrections\n"; + #endif + { + SGTELIB::Matrix W = _param.get_weight(); + for (k=0 ; k<_kmax ; k++){ + if (! is_ready(k)){ + W.set_row(0.0,k); + } + } + W.normalize_cols(); + _param.set_weight(W); + } + break; + default: + throw SGTELIB::Exception ( __FILE__ , __LINE__ , + "Surrogate_Ensemble::build(): undefined aggregation method." ); + } + + + _out << "BUILD...\n"; + + if (check_weight_vector()){ + #ifdef ENSEMBLE_DEBUG + std::cout << "Weights non valid\n"; + #endif + _ready = false; + return false; + } + compute_active_models(); + _ready = true; + + + // Memorize the value of the metric for each output + for (int j=0 ; j<_m ; j++){ + _metric[j] = get_metric(_param.get_metric_type(),j); + } + + + #ifdef ENSEMBLE_DEBUG + std::cout << "Surrogate_Ensemble : end build_private\n"; + #endif + + + return true; +}// + + +/*--------------------------------------*/ +/* compute_active_models */ +/*--------------------------------------*/ +void SGTELIB::Surrogate_Ensemble::compute_active_models ( void ) { + + // Compute the array _active + // (_active[k] is true if the model k is ready AND the weight in k is not null for + // at least one output) + SGTELIB::Matrix W = _param.get_weight(); + if (! _active){ + _active = new bool [_kmax]; + } + int k; + for (k=0 ; k<_kmax ; k++){ + _active[k] = false; + if ( is_ready(k) ){ + for (int j=0 ; j<_m ; j++){ + if ( (_trainingset.get_bbo(j)!=SGTELIB::BBO_DUM) && (W.get(k,j)>EPSILON) ){ + _active[k] = true; + break; + } + } + } + } + +}// + +/*--------------------------------------*/ +/* compute_W_by_select */ +/*--------------------------------------*/ +void SGTELIB::Surrogate_Ensemble::compute_W_by_select ( void ) { + + // Init Weight matrix + SGTELIB::Matrix W ("W", _kmax , _m ); + W.fill(0.0); + + int j,k; + int k_best = 0; + double metric_best; + double metric; + + // Loop on the outputs + for (j=0 ; j<_m ; j++){ + if (_trainingset.get_bbo(j)!=SGTELIB::BBO_DUM){ + + metric_best = SGTELIB::INF; + // Find the value of the best metric + for (k=0 ; k<_kmax ; k++){ + if (is_ready(k)){ + metric = _surrogates.at(k)->get_metric(_param.get_metric_type(),j); + if (! isnan(metric)) { + metric_best = std::min(metric,metric_best); + } + } + }// end loop k + + // Find the number of surrogate that have this metric value + k_best = 0; + for (k=0 ; k<_kmax ; k++){ + if (is_ready(k)){ + metric = _surrogates.at(k)->get_metric(_param.get_metric_type(),j); + // If the metric is close to metric_best + if ( fabs(metric-metric_best)<EPSILON ){ + // Give weight to this model + W.set(k,j,1.0); + // Increment k_best (number of surrogates such that metric=metric_best) + k_best++; + } + } + }// end loop k + + // Normalise + if (k_best>1){ + for (k=0 ; k<_kmax ; k++){ + if (is_ready(k)){ + if ( W.get(k,j) > EPSILON ){ + W.set(k,j,1.0/double(k_best)); + } + } + }// end loop k + }//end if + + + }// end DUM + }// end loop j + + _param.set_weight(W); + +}// + +/*--------------------------------------*/ +/* compute_W_by_wta1 */ +/*--------------------------------------*/ +void SGTELIB::Surrogate_Ensemble::compute_W_by_wta1 ( void ) { + + #ifdef ENSEMBLE_DEBUG + std::cout << "SGTELIB::Surrogate_Ensemble::compute_W_by_wta1\n"; + #endif + + // Init Weight matrix + SGTELIB::Matrix W ("W", _kmax , _m ); + W.fill(0.0); + + int k; + double metric; + double metric_sum; + double weight_sum; + + // Loop on the outputs + for (int j=0 ; j<_m ; j++){ + if (_trainingset.get_bbo(j)!=SGTELIB::BBO_DUM){ + + // Compute the sum of the metric on all the surrogates ready + metric_sum = 0; + for (k=0 ; k<_kmax ; k++){ + if (is_ready(k)){ + metric = _surrogates.at(k)->get_metric(_param.get_metric_type(),j); + if (isdef(metric)) metric_sum += metric; + } + } + + // Affect weight: + if (metric_sum>EPSILON){ + for (k=0 ; k<_kmax ; k++){ + if (is_ready(k)){ + metric = _surrogates.at(k)->get_metric(_param.get_metric_type(),j); + if (isdef(metric)) W.set(k,j,1-metric/metric_sum); + else W.set(k,j,0.0); + } + } + } + else{ + for (k=0 ; k<_kmax ; k++){ + if (is_ready(k)) W.set(k,j,1.0); + } + } + + // Normalize + weight_sum = 0; + for (k=0 ; k<_kmax ; k++){ + weight_sum += W.get(k,j); + } + W.multiply_col( 1.0/weight_sum , j ); + + + } // End if not DUMM + }// End loop on outputs + + _param.set_weight(W); + +}// + +/*--------------------------------------*/ +/* compute_W_by_wta3 */ +/*--------------------------------------*/ +void SGTELIB::Surrogate_Ensemble::compute_W_by_wta3 ( void ) { + + #ifdef ENSEMBLE_DEBUG + std::cout << "SGTELIB::Surrogate_Ensemble::compute_W_by_wta3\n"; + #endif + + // Init Weight matrix + SGTELIB::Matrix W ("W", _kmax , _m ); + W.fill(0.0); + + int k; + double metric; + double metric_avg; + double w; + double w_sum; + + // Loop on the outputs + for (int j=0 ; j<_m ; j++){ + + // Compute the average of the metric on all the surrogates ready + metric_avg = 0; + for (k=0 ; k<_kmax ; k++){ + if (is_ready(k)){ + metric_avg += _surrogates.at(k)->get_metric(_param.get_metric_type(),j); + } + } + metric_avg /= _kready; + + if (metric_avg > EPSILON){ + + // Normal WA3 method. + // Affect un-normalized weight: (which means that the sum of the weight is not 1) + w_sum = 0; + for (k=0 ; k<_kmax ; k++){ + if (is_ready(k)){ + metric = _surrogates.at(k)->get_metric(_param.get_metric_type(),j); + w = pow( metric + wta3_alpha * metric_avg , wta3_beta ); + w_sum += w; + W.set(k,j,w); + } + } + // Then, normalize + for (k=0 ; k<_kmax ; k++){ + if (is_ready(k)){ + W.set(k,j,W.get(k,j)/w_sum); + } + } + + } + else{ + + // If the metric is null for all models, then set to 1/_kready + w = 1.0 / double(_kready); + for (k=0 ; k<_kmax ; k++){ + if (is_ready(k)){ + W.set(k,j,w); + } + } + + } + }// End loop on outputs + + _param.set_weight(W); + +}// + + + +/*--------------------------------------*/ +/* predict (ZZ only) */ +/*--------------------------------------*/ +void SGTELIB::Surrogate_Ensemble::predict_private ( const SGTELIB::Matrix & XXs, + SGTELIB::Matrix * ZZ ) { + #ifdef ENSEMBLE_DEBUG + check_ready(__FILE__,__FUNCTION__,__LINE__); + #endif + + const SGTELIB::Matrix W = _param.get_weight(); + const int pxx = XXs.get_nb_rows(); + + ZZ->fill(0.0); + // Tmp matrix for model k + SGTELIB::Matrix * ZZk = new SGTELIB::Matrix("ZZk",pxx,_m); + + double w; + for (int k=0 ; k<_kmax ; k++){ + if (_active[k]){ + // Call the output for this surrogate + _surrogates.at(k)->predict_private(XXs,ZZk); + for (int j=0 ; j<_m ; j++){ + w = W.get(k,j); + for (int i=0 ; i<pxx ; i++){ + ZZ->set(i,j, ZZ->get(i,j) + w*ZZk->get(i,j) ); + }// end loop i + }// end loop j + }// end if ready + }//end loop k + + delete ZZk; +}// + + +/*--------------------------------------*/ +/* predict_private */ +/*--------------------------------------*/ +void SGTELIB::Surrogate_Ensemble::predict_private ( const SGTELIB::Matrix & XXs, + SGTELIB::Matrix * ZZ , + SGTELIB::Matrix * std, + SGTELIB::Matrix * ei , + SGTELIB::Matrix * cdf) { + #ifdef ENSEMBLE_DEBUG + check_ready(__FILE__,__FUNCTION__,__LINE__); + #endif + + const SGTELIB::Matrix W = _param.get_weight(); + + // If no statistical information is required, use the simpler prediction method + if (! (std || ei || cdf)){ + predict_private ( XXs, ZZ ); + return; + } + + // Else, go for the big guns... + const int pxx = XXs.get_nb_rows(); + + // Init ZZ + bool delete_ZZ = false; + if ( ! ZZ){ + // if ZZ is not required, we build it anyway, but delete it in the end + ZZ = new SGTELIB::Matrix ("ZZ",pxx,_m); + delete_ZZ = true; + } + ZZ->fill(0.0); + + + // Fill output matricres + if (std) std->fill(0.0); + if (ei) ei->fill(0.0); + if (cdf) cdf->fill(0.0); + + // Init tmp matrices + SGTELIB::Matrix * ZZk = new SGTELIB::Matrix ("ZZk" ,pxx,_m); + SGTELIB::Matrix * stdk = new SGTELIB::Matrix ("stdk",pxx,_m); + + // Tmp matrix cdfk + SGTELIB::Matrix * cdfk; + if (cdf) cdfk = new SGTELIB::Matrix ("cdfk",pxx,_m); + else cdfk = NULL; + + // Same story for ei. + SGTELIB::Matrix * eik; + if (ei) eik = new SGTELIB::Matrix ("eik",pxx,_m); + else eik = NULL; + + double w,z,s; + + + // Loop on the models + for (int k=0 ; k<_kmax ; k++){ + if (_active[k]){ + + // Call the output for this surrogate + _surrogates.at(k)->predict_private(XXs,ZZk,stdk,eik,cdfk); + + for (int j=0 ; j<_m ; j++){ + w = W.get(k,j); + if (w>EPSILON/_kmax){ + + // Compute ZZ + for (int i=0 ; i<pxx ; i++){ + z = ZZk->get(i,j); + ZZ->set( i,j, ZZ->get(i,j) + w*z ); + } + + // Compute std + if (std){ + for (int i=0 ; i<pxx ; i++){ + z = ZZk->get(i,j); + s = stdk->get(i,j); + std->set(i,j, std->get(i,j) + w*(s*s + z*z) ); + //std->set(i,j, std->get(i,j) + w*z*z ); + }// end loop i + } + + // EI is linear on w + if ( (ei) && (_trainingset.get_bbo(j)==SGTELIB::BBO_OBJ) ){ + for (int i=0 ; i<pxx ; i++){ + ei->set(i,j, ei->get(i,j) + w*eik->get(i,j) ); + }// end loop i + } + + // CDF is linear on w + if (cdf){ + for (int i=0 ; i<pxx ; i++){ + cdf->set(i,j, cdf->get(i,j) + w*cdfk->get(i,j) ); + }// end loop i + } + + }// end if w>eps + }// end loop j + + }// end if ready + }//end loop k + + + // Correction of std + if (std){ + for (int j=0 ; j<_m ; j++){ + for (int i=0 ; i<pxx ; i++){ + z = ZZ->get(i,j); + s = std->get(i,j) - z*z; + std->set(i,j, sqrt(fabs(s)) ); + }// end loop i + } + } + + if (delete_ZZ) delete ZZ; + if (ZZk ) delete ZZk; + if (stdk) delete stdk; + if (eik ) delete eik; + if (cdfk) delete cdfk; + +}// + +/*--------------------------------------*/ +/* get_matrix_Zvs */ +/*--------------------------------------*/ +const SGTELIB::Matrix * SGTELIB::Surrogate_Ensemble::get_matrix_Zvs (void){ + if ( ! _Zvs){ + #ifdef ENSEMBLE_DEBUG + check_ready(__FILE__,__FUNCTION__,__LINE__); + #endif + const SGTELIB::Matrix W = _param.get_weight(); + _Zvs = new SGTELIB::Matrix("Zv",_p,_m); + _Zvs->fill(0.0); + int i,j; + double wkj; + + for (int k=0 ; k<_kmax ; k++){ + if (_active[k]){ + // Call the output for this surrogate + const SGTELIB::Matrix * Zvs_k = _surrogates.at(k)->get_matrix_Zvs(); + for ( j=0 ; j<_m ; j++){ + wkj = W.get(k,j); + if (wkj>0){ + for ( i=0 ; i<_p ; i++){ + _Zvs->add(i,j, wkj*Zvs_k->get(i,j) ); + } + } + }// end loop j + }// end if ready + }//end loop k + + _Zvs->set_name("Zvs"); + _Zvs->replace_nan(+INF); + + } + return _Zvs; +}// + +/*--------------------------------------*/ +/* get_matrix_Zhs */ +/*--------------------------------------*/ +const SGTELIB::Matrix * SGTELIB::Surrogate_Ensemble::get_matrix_Zhs (void){ + if ( ! _Zhs){ + #ifdef ENSEMBLE_DEBUG + check_ready(__FILE__,__FUNCTION__,__LINE__); + #endif + const SGTELIB::Matrix W = _param.get_weight(); + _Zhs = new SGTELIB::Matrix("Zv",_p,_m); + _Zhs->fill(0.0); + int i,j; + double wkj; + + for (int k=0 ; k<_kmax ; k++){ + if (_active[k]){ + // Call the output for this surrogate + const SGTELIB::Matrix * Zhs_k = _surrogates.at(k)->get_matrix_Zhs(); + for ( j=0 ; j<_m ; j++){ + wkj = W.get(k,j); + if (wkj>0){ + for ( i=0 ; i<_p ; i++){ + _Zhs->add(i,j, wkj*Zhs_k->get(i,j) ); + } + } + }// end loop j + }// end if ready + }//end loop k + + _Zhs->set_name("Zhs"); + _Zhs->replace_nan(+INF); + + } + return _Zhs; +}// + +/*--------------------------------------*/ +/* get_matrix_Shs */ +/*--------------------------------------*/ +const SGTELIB::Matrix * SGTELIB::Surrogate_Ensemble::get_matrix_Shs (void){ + if ( ! _Shs){ + const SGTELIB::Matrix W = _param.get_weight(); + _Shs = new SGTELIB::Matrix("Zv",_p,_m); + _Shs->fill(0.0); + SGTELIB::Matrix col ("col",_p,1); + + int i,j; + double wkj; + for (int k=0 ; k<_kmax ; k++){ + if (_active[k]){ + // Call the output for this surrogate + const SGTELIB::Matrix * Zhs_k = _surrogates.at(k)->get_matrix_Zhs(); + const SGTELIB::Matrix * Shs_k = _surrogates.at(k)->get_matrix_Shs(); + + for ( j=0 ; j<_m ; j++){ + wkj = W.get(k,j); + if (wkj>0){ + for ( i=0 ; i<_p ; i++){ + _Shs->add(i,j, wkj*( pow(Shs_k->get(i,j),2) + pow(Zhs_k->get(i,j),2) ) ); + } + } + }// end loop j + }// end if ready + }//end loop k + + const SGTELIB::Matrix * Zhs = get_matrix_Zhs(); + _Shs->sub( Matrix::hadamard_square( *Zhs ) ); + _Shs->hadamard_sqrt(); + + _Shs->set_name("Shs"); + _Shs->replace_nan(+INF); + + } + return _Shs; +}// + + + + + +/*--------------------------------------*/ +/* to know if basic model k is ready */ +/*--------------------------------------*/ +bool SGTELIB::Surrogate_Ensemble::is_ready (const int k) const{ + if ((k<0) || (k>=_kmax)){ + throw SGTELIB::Exception ( __FILE__ , __LINE__ , + "Surrogate_Ensemble::set_weight_vector (const int k): k out of range" ); + } + return _surrogates.at(k)->is_ready(); +} + + +/*--------------------------------------*/ +/* external set of the weight vector */ +/* (use model k for output j) */ +/*--------------------------------------*/ +/* +void SGTELIB::Surrogate_Ensemble::set_weight_vector (const int k, const int j){ + if (_param.get_weight_type() != SGTELIB::WEIGHT_EXTERN){ + throw SGTELIB::Exception ( __FILE__ , __LINE__ , + "Surrogate_Ensemble::set_weight_vector (k,j): Not in EXTERN mode" ); + } + if ((k<0) or (k>=_kmax)){ + throw SGTELIB::Exception ( __FILE__ , __LINE__ , + "Surrogate_Ensemble::set_weight_vector (k,j): k out of range" ); + } + if ((j<0) or (j>=_m)){ + throw SGTELIB::Exception ( __FILE__ , __LINE__ , + "Surrogate_Ensemble::set_weight_vector (k,j): k out of range" ); + } + if (not is_ready(k)){ + throw SGTELIB::Exception ( __FILE__ , __LINE__ , + "Surrogate_Ensemble::set_weight_vector (k,j): Surrogate not ready" ); + } + + // Set the column j to 0 + _W.set_col( 0.0 , j ); + // Select model k for output j + _W.set(k,j,1.0); + // Check and reset + reset_metrics(); + compute_active_models(); +}// +*/ + +/*--------------------------------------*/ +/* external set of the weight vector */ +/* (use model k for every output) */ +/*--------------------------------------*/ +/* +void SGTELIB::Surrogate_Ensemble::set_weight_vector (const int k){ + if (_param.get_weight_type() != SGTELIB::WEIGHT_EXTERN){ + throw SGTELIB::Exception ( __FILE__ , __LINE__ , + "Surrogate_Ensemble::set_weight_vector (k,j): Not in EXTERN mode" ); + } + if ((k<0) or (k>=_kmax)){ + throw SGTELIB::Exception ( __FILE__ , __LINE__ , + "Surrogate_Ensemble::set_weight_vector (k,j): k out of range" ); + } + if (not is_ready(k)){ + throw SGTELIB::Exception ( __FILE__ , __LINE__ , + "Surrogate_Ensemble::set_weight_vector (k,j): Surrogate not ready" ); + } + // Put _W at 0 + _W.fill(0.0); + // Put model k at 1.0 for every output + _W.set_row( 1.0 , k ); + // Check and reset + reset_metrics(); + compute_active_models(); +}// +*/ + +/*--------------------------------------*/ +/* external set of the weight vector */ +/* (with the whole matrix) */ +/*--------------------------------------*/ +/* +void SGTELIB::Surrogate_Ensemble::set_weight_vector (const SGTELIB::Matrix & W){ + if (_param.get_weight_type() != SGTELIB::WEIGHT_EXTERN){ + throw SGTELIB::Exception ( __FILE__ , __LINE__ , + "Surrogate_Ensemble::set_weight_vector (k,j): Not in EXTERN mode" ); + } + // Set _W + _W = W; + // Check and reset + reset_metrics(); + compute_active_models(); +}// +*/ + +/*--------------------------------------*/ +/* check the weight vector */ +/*--------------------------------------*/ +bool SGTELIB::Surrogate_Ensemble::check_weight_vector ( void ) const { + const SGTELIB::Matrix W = _param.get_weight(); + double s,w; + int j,k; + for (j=0 ; j<_m ; j++){ + if (_trainingset.get_bbo(j)!=SGTELIB::BBO_DUM){ + for (k=0 ; k<_kmax ; k++){ + w = W.get(k,j); + if (w<-EPSILON) return true; + if (w>1+EPSILON) return true; + if ( isnan(w) ) return true; + } + s = W.get_col(j).sum(); + if (fabs(s-1.0)>_kready*EPSILON) return true; + } + } + + return false; + +}// + + + + + + +/*--------------------------------------*/ +/* define model list */ +/*--------------------------------------*/ +void SGTELIB::Surrogate_Ensemble::model_list_preset ( const std::string & preset ) { + + + #ifdef ENSEMBLE_DEBUG + std::cout << "Build model list\n"; + #endif + + model_list_remove_all(); + + const std::string p = toupper(preset); + const std::string m = " METRIC_TYPE "+_param.get_metric_type_str(); + const std::string d = " DISTANCE_TYPE "+_param.get_distance_type_str(); + const std::string dm = d+m; + + if (SGTELIB::streqi(p,"DEFAULT")) { + model_list_add("TYPE PRS DEGREE 1 RIDGE 0"); + model_list_add("TYPE PRS DEGREE 1 RIDGE 0.001"); + model_list_add("TYPE PRS DEGREE 2 RIDGE 0"); + model_list_add("TYPE PRS DEGREE 2 RIDGE 0.001"); + model_list_add("TYPE PRS DEGREE 3 RIDGE 0.0"); + model_list_add("TYPE PRS DEGREE 6 RIDGE 0.001"); + model_list_add("TYPE KS KERNEL_TYPE D1 KERNEL_COEF 0.1"+dm); + model_list_add("TYPE KS KERNEL_TYPE D1 KERNEL_COEF 0.3"+dm); + model_list_add("TYPE KS KERNEL_TYPE D1 KERNEL_COEF 1 "+dm); + model_list_add("TYPE KS KERNEL_TYPE D1 KERNEL_COEF 3 "+dm); + model_list_add("TYPE KS KERNEL_TYPE D1 KERNEL_COEF 10 "+dm); + model_list_add("TYPE RBF PRESET I KERNEL_TYPE D1 KERNEL_COEF 0.3"+dm); + model_list_add("TYPE RBF PRESET I KERNEL_TYPE D1 KERNEL_COEF 1 "+dm); + model_list_add("TYPE RBF PRESET I KERNEL_TYPE D1 KERNEL_COEF 3 "+dm); + model_list_add("TYPE RBF PRESET I KERNEL_TYPE D1 KERNEL_COEF 10 "+dm); + model_list_add("TYPE RBF PRESET I KERNEL_TYPE I1"+dm); + model_list_add("TYPE RBF PRESET I KERNEL_TYPE I2"+dm); + model_list_add("TYPE CN"+dm); + } + else if (SGTELIB::streqi(p,"KS")) { + model_list_add("TYPE KS KERNEL_TYPE D1 KERNEL_COEF 0.1"+d); + model_list_add("TYPE KS KERNEL_TYPE D1 KERNEL_COEF 0.2"+d); + model_list_add("TYPE KS KERNEL_TYPE D1 KERNEL_COEF 0.5"+d); + model_list_add("TYPE KS KERNEL_TYPE D1 KERNEL_COEF 1 "+d); + model_list_add("TYPE KS KERNEL_TYPE D1 KERNEL_COEF 2 "+d); + model_list_add("TYPE KS KERNEL_TYPE D1 KERNEL_COEF 5 "+d); + model_list_add("TYPE KS KERNEL_TYPE D1 KERNEL_COEF 10 "+d); + } + else if (SGTELIB::streqi(p,"PRS")) { + model_list_add("TYPE PRS DEGREE 1"); + model_list_add("TYPE PRS DEGREE 2"); + model_list_add("TYPE PRS DEGREE 3"); + model_list_add("TYPE PRS DEGREE 4"); + model_list_add("TYPE PRS DEGREE 5"); + model_list_add("TYPE PRS DEGREE 6"); + } + else if (SGTELIB::streqi(p,"IS0")) { + model_list_add("TYPE PRS_EDGE DEGREE 2"); + model_list_add("TYPE PRS_EDGE DEGREE 3"); + + model_list_add("TYPE KS KERNEL_TYPE D1 KERNEL_COEF 0.1 DISTANCE_TYPE NORM2_IS0"); + model_list_add("TYPE KS KERNEL_TYPE D1 KERNEL_COEF 0.2 DISTANCE_TYPE NORM2_IS0"); + model_list_add("TYPE KS KERNEL_TYPE D1 KERNEL_COEF 0.5 DISTANCE_TYPE NORM2_IS0"); + model_list_add("TYPE KS KERNEL_TYPE D1 KERNEL_COEF 1 DISTANCE_TYPE NORM2_IS0"); + model_list_add("TYPE KS KERNEL_TYPE D1 KERNEL_COEF 2 DISTANCE_TYPE NORM2_IS0"); + model_list_add("TYPE KS KERNEL_TYPE D1 KERNEL_COEF 5 DISTANCE_TYPE NORM2_IS0"); + model_list_add("TYPE KS KERNEL_TYPE D1 KERNEL_COEF 10 DISTANCE_TYPE NORM2_IS0"); + + model_list_add("TYPE KS KERNEL_TYPE D2 KERNEL_COEF 0.1 DISTANCE_TYPE NORM2_IS0"); + model_list_add("TYPE KS KERNEL_TYPE D2 KERNEL_COEF 0.2 DISTANCE_TYPE NORM2_IS0"); + model_list_add("TYPE KS KERNEL_TYPE D2 KERNEL_COEF 0.5 DISTANCE_TYPE NORM2_IS0"); + model_list_add("TYPE KS KERNEL_TYPE D2 KERNEL_COEF 1 DISTANCE_TYPE NORM2_IS0"); + model_list_add("TYPE KS KERNEL_TYPE D2 KERNEL_COEF 2 DISTANCE_TYPE NORM2_IS0"); + model_list_add("TYPE KS KERNEL_TYPE D2 KERNEL_COEF 5 DISTANCE_TYPE NORM2_IS0"); + model_list_add("TYPE KS KERNEL_TYPE D2 KERNEL_COEF 10 DISTANCE_TYPE NORM2_IS0"); + + model_list_add("TYPE RBF PRESET I KERNEL_TYPE D1 KERNEL_COEF 0.1 DISTANCE_TYPE NORM2_IS0"); + model_list_add("TYPE RBF PRESET I KERNEL_TYPE D1 KERNEL_COEF 0.2 DISTANCE_TYPE NORM2_IS0"); + model_list_add("TYPE RBF PRESET I KERNEL_TYPE D1 KERNEL_COEF 0.5 DISTANCE_TYPE NORM2_IS0"); + model_list_add("TYPE RBF PRESET I KERNEL_TYPE D1 KERNEL_COEF 1 DISTANCE_TYPE NORM2_IS0"); + model_list_add("TYPE RBF PRESET I KERNEL_TYPE D1 KERNEL_COEF 2 DISTANCE_TYPE NORM2_IS0"); + model_list_add("TYPE RBF PRESET I KERNEL_TYPE D1 KERNEL_COEF 5 DISTANCE_TYPE NORM2_IS0"); + model_list_add("TYPE RBF PRESET I KERNEL_TYPE D1 KERNEL_COEF 10 DISTANCE_TYPE NORM2_IS0"); + + model_list_add("TYPE RBF PRESET I KERNEL_TYPE D2 KERNEL_COEF 0.1 DISTANCE_TYPE NORM2_IS0"); + model_list_add("TYPE RBF PRESET I KERNEL_TYPE D2 KERNEL_COEF 0.2 DISTANCE_TYPE NORM2_IS0"); + model_list_add("TYPE RBF PRESET I KERNEL_TYPE D2 KERNEL_COEF 0.5 DISTANCE_TYPE NORM2_IS0"); + model_list_add("TYPE RBF PRESET I KERNEL_TYPE D2 KERNEL_COEF 1 DISTANCE_TYPE NORM2_IS0"); + model_list_add("TYPE RBF PRESET I KERNEL_TYPE D2 KERNEL_COEF 2 DISTANCE_TYPE NORM2_IS0"); + model_list_add("TYPE RBF PRESET I KERNEL_TYPE D2 KERNEL_COEF 5 DISTANCE_TYPE NORM2_IS0"); + model_list_add("TYPE RBF PRESET I KERNEL_TYPE D2 KERNEL_COEF 10 DISTANCE_TYPE NORM2_IS0"); + } + else if (SGTELIB::streqi(p,"CAT")) { + model_list_add("TYPE PRS_CAT DEGREE 2"); + model_list_add("TYPE PRS_CAT DEGREE 3"); + + model_list_add("TYPE KS KERNEL_TYPE D1 KERNEL_COEF 0.1 DISTANCE_TYPE NORM2_CAT"); + model_list_add("TYPE KS KERNEL_TYPE D1 KERNEL_COEF 0.2 DISTANCE_TYPE NORM2_CAT"); + model_list_add("TYPE KS KERNEL_TYPE D1 KERNEL_COEF 0.5 DISTANCE_TYPE NORM2_CAT"); + model_list_add("TYPE KS KERNEL_TYPE D1 KERNEL_COEF 1 DISTANCE_TYPE NORM2_CAT"); + model_list_add("TYPE KS KERNEL_TYPE D1 KERNEL_COEF 2 DISTANCE_TYPE NORM2_CAT"); + model_list_add("TYPE KS KERNEL_TYPE D1 KERNEL_COEF 5 DISTANCE_TYPE NORM2_CAT"); + model_list_add("TYPE KS KERNEL_TYPE D1 KERNEL_COEF 10 DISTANCE_TYPE NORM2_CAT"); + + model_list_add("TYPE KS KERNEL_TYPE D2 KERNEL_COEF 0.1 DISTANCE_TYPE NORM2_CAT"); + model_list_add("TYPE KS KERNEL_TYPE D2 KERNEL_COEF 0.2 DISTANCE_TYPE NORM2_CAT"); + model_list_add("TYPE KS KERNEL_TYPE D2 KERNEL_COEF 0.5 DISTANCE_TYPE NORM2_CAT"); + model_list_add("TYPE KS KERNEL_TYPE D2 KERNEL_COEF 1 DISTANCE_TYPE NORM2_CAT"); + model_list_add("TYPE KS KERNEL_TYPE D2 KERNEL_COEF 2 DISTANCE_TYPE NORM2_CAT"); + model_list_add("TYPE KS KERNEL_TYPE D2 KERNEL_COEF 5 DISTANCE_TYPE NORM2_CAT"); + model_list_add("TYPE KS KERNEL_TYPE D2 KERNEL_COEF 10 DISTANCE_TYPE NORM2_CAT"); + + model_list_add("TYPE RBF PRESET I KERNEL_TYPE D1 KERNEL_COEF 0.1 DISTANCE_TYPE NORM2_CAT"); + model_list_add("TYPE RBF PRESET I KERNEL_TYPE D1 KERNEL_COEF 0.2 DISTANCE_TYPE NORM2_CAT"); + model_list_add("TYPE RBF PRESET I KERNEL_TYPE D1 KERNEL_COEF 0.5 DISTANCE_TYPE NORM2_CAT"); + model_list_add("TYPE RBF PRESET I KERNEL_TYPE D1 KERNEL_COEF 1 DISTANCE_TYPE NORM2_CAT"); + model_list_add("TYPE RBF PRESET I KERNEL_TYPE D1 KERNEL_COEF 2 DISTANCE_TYPE NORM2_CAT"); + model_list_add("TYPE RBF PRESET I KERNEL_TYPE D1 KERNEL_COEF 5 DISTANCE_TYPE NORM2_CAT"); + model_list_add("TYPE RBF PRESET I KERNEL_TYPE D1 KERNEL_COEF 10 DISTANCE_TYPE NORM2_CAT"); + + model_list_add("TYPE RBF PRESET I KERNEL_TYPE D2 KERNEL_COEF 0.1 DISTANCE_TYPE NORM2_CAT"); + model_list_add("TYPE RBF PRESET I KERNEL_TYPE D2 KERNEL_COEF 0.2 DISTANCE_TYPE NORM2_CAT"); + model_list_add("TYPE RBF PRESET I KERNEL_TYPE D2 KERNEL_COEF 0.5 DISTANCE_TYPE NORM2_CAT"); + model_list_add("TYPE RBF PRESET I KERNEL_TYPE D2 KERNEL_COEF 1 DISTANCE_TYPE NORM2_CAT"); + model_list_add("TYPE RBF PRESET I KERNEL_TYPE D2 KERNEL_COEF 2 DISTANCE_TYPE NORM2_CAT"); + model_list_add("TYPE RBF PRESET I KERNEL_TYPE D2 KERNEL_COEF 5 DISTANCE_TYPE NORM2_CAT"); + model_list_add("TYPE RBF PRESET I KERNEL_TYPE D2 KERNEL_COEF 10 DISTANCE_TYPE NORM2_CAT"); + } + else if (SGTELIB::streqi(p,"SUPER1")) { + model_list_add("TYPE KS KERNEL_TYPE OPTIM KERNEL_COEF OPTIM"+dm); + model_list_add("TYPE RBF KERNEL_TYPE OPTIM KERNEL_COEF OPTIM RIDGE 0.001 PRESET I"+dm); + model_list_add("TYPE PRS DEGREE OPTIM RIDGE OPTIM"+m); + model_list_add("TYPE LOWESS DEGREE OPTIM RIDGE 0.001 KERNEL_COEF OPTIM KERNEL_TYPE D1"+dm); + } + else if (SGTELIB::streqi(p,"SMALL")) { + model_list_add("TYPE PRS"); + model_list_add("TYPE KS"); + model_list_add("TYPE RBF PRESET I"); + } + else if (SGTELIB::streqi(p,"NONE")) { + // None + } + else { + throw SGTELIB::Exception ( __FILE__ , __LINE__ , + "Surrogate_Ensemble::model_list_preset: unrecognized preset \""+preset+"\"" ); + } + + #ifdef ENSEMBLE_DEBUG + std::cout << "END Build model list\n"; + #endif + +}// + + diff --git a/ext/sgtelib/src/Surrogate_Ensemble.hpp b/ext/sgtelib/src/Surrogate_Ensemble.hpp new file mode 100644 index 0000000000000000000000000000000000000000..59c5f233e2c7f35d6c848437332ba6aa32e77981 --- /dev/null +++ b/ext/sgtelib/src/Surrogate_Ensemble.hpp @@ -0,0 +1,130 @@ +/*-------------------------------------------------------------------------------------*/ +/* sgtelib - A surrogate model library for derivative-free optimization */ +/* Version 2.0.1 */ +/* */ +/* Copyright (C) 2012-2017 Sebastien Le Digabel - Ecole Polytechnique, Montreal */ +/* Bastien Talgorn - McGill University, Montreal */ +/* */ +/* Author: Bastien Talgorn */ +/* email: bastientalgorn@fastmail.com */ +/* */ +/* This program is free software: you can redistribute it and/or modify it under the */ +/* terms of the GNU Lesser General Public License as published by the Free Software */ +/* Foundation, either version 3 of the License, or (at your option) any later */ +/* version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ +/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ +/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License along */ +/* with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on sgtelib at https://github.com/bastientalgorn/sgtelib */ +/*-------------------------------------------------------------------------------------*/ + +#ifndef __SGTELIB_SURROGATE_ENSEMBLE__ +#define __SGTELIB_SURROGATE_ENSEMBLE__ + +#include "Surrogate.hpp" +#include "Surrogate_Factory.hpp" + + +//#include <time.h> + + +namespace SGTELIB { + + const double wta3_alpha = 0.05; + const double wta3_beta = -1; + + /*--------------------------------------*/ + /* Surrogate_Ensemble class */ + /*--------------------------------------*/ + class Surrogate_Ensemble : public SGTELIB::Surrogate { + + /*--------------------------------------------------------*/ + /* these members are defined in the Surrogate superclass */ + /*--------------------------------------------------------*/ + // int _p; // number of data points in X and Z + // int _n; // dimension -- number of variables + // int _m; // number of outputs (includes the objective) + + protected: + + int _kmax; // Nb of surrogates in the ensemble + int _kready; // Nb of surrogates READY in the ensemble + //SGTELIB::Matrix _W; // Weight vector + std::vector<SGTELIB::Surrogate *> _surrogates; // List des surrogates + bool * _active; // Array of boolean. Is _active[k] is true if surrogate k is ready + // AND if there is a j such that W(k,j)!=0 + // ie: the weight in k is non null for at least one output + double * _metric; // Value of the metric for the Ensemble + + // build model (private): + virtual bool build_private (void); + virtual bool init_private (void); + + // Compute metrics + virtual const SGTELIB::Matrix * get_matrix_Zhs (void); + virtual const SGTELIB::Matrix * get_matrix_Shs (void); + virtual const SGTELIB::Matrix * get_matrix_Zvs (void); + + void compute_W_by_select(void); + void compute_W_by_wta1 (void); + void compute_W_by_wta3 (void); + + // predict model (private): + virtual void predict_private ( const SGTELIB::Matrix & XXs, + SGTELIB::Matrix * ZZ , + SGTELIB::Matrix * std, + SGTELIB::Matrix * ei , + SGTELIB::Matrix * cdf ); + + virtual void predict_private ( const SGTELIB::Matrix & XXs, + SGTELIB::Matrix * ZZ ); + + + public: + + // Constructor + Surrogate_Ensemble ( SGTELIB::TrainingSet & trainingset , + SGTELIB::Surrogate_Parameters param) ; + + /* + Surrogate_Ensemble ( SGTELIB::TrainingSet & trainingset , + const std::string & s) ; + */ + + // destructor: + virtual ~Surrogate_Ensemble ( void ); + + virtual void display_private ( std::ostream & out ) const; + void display ( std::ostream & out , const int k ) const {_surrogates.at(k)->display(out);}; + + // ==============================================// + // Method for inspection of the basic surrogates // + // ==============================================// + + // Test if basic model k is ready. + bool is_ready (const int k) const; + + // Compute the boolean array _active + void compute_active_models ( void ) ; + // Check the weight vector + bool check_weight_vector ( void ) const; + + + + // ==============================================// + // Method to define the model_list // + // ==============================================// + void model_list_display ( std::ostream & out ); + void model_list_preset ( const std::string & preset ); + void model_list_remove_all ( void ); + void model_list_add ( const std::string & definition ); + + }; +} + +#endif diff --git a/ext/sgtelib/src/Surrogate_Factory.cpp b/ext/sgtelib/src/Surrogate_Factory.cpp new file mode 100644 index 0000000000000000000000000000000000000000..205bb233186c2fd28a4420bef2814f285459af60 --- /dev/null +++ b/ext/sgtelib/src/Surrogate_Factory.cpp @@ -0,0 +1,133 @@ +/*-------------------------------------------------------------------------------------*/ +/* sgtelib - A surrogate model library for derivative-free optimization */ +/* Version 2.0.1 */ +/* */ +/* Copyright (C) 2012-2017 Sebastien Le Digabel - Ecole Polytechnique, Montreal */ +/* Bastien Talgorn - McGill University, Montreal */ +/* */ +/* Author: Bastien Talgorn */ +/* email: bastientalgorn@fastmail.com */ +/* */ +/* This program is free software: you can redistribute it and/or modify it under the */ +/* terms of the GNU Lesser General Public License as published by the Free Software */ +/* Foundation, either version 3 of the License, or (at your option) any later */ +/* version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ +/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ +/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License along */ +/* with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on sgtelib at https://github.com/bastientalgorn/sgtelib */ +/*-------------------------------------------------------------------------------------*/ + +#include "Surrogate_Factory.hpp" + + +/*----------------------------------------------------------*/ +SGTELIB::Surrogate * SGTELIB::Surrogate_Factory (SGTELIB::Matrix & X0, + SGTELIB::Matrix & Z0, + const std::string & s ){ + SGTELIB::TrainingSet * TS; + TS = new SGTELIB::TrainingSet(X0,Z0); + TS->info(); + throw SGTELIB::Exception ( __FILE__ , __LINE__ , + "Surrogate_factory: constructor from matrices is forbiden." ); + return SGTELIB::Surrogate_Factory(*TS,s); +}// +/*----------------------------------------------------------*/ + + + + + +/*----------------------------------------------------------*/ +SGTELIB::Surrogate * SGTELIB::Surrogate_Factory ( SGTELIB::TrainingSet & TS, + const std::string & s ) { +/*----------------------------------------------------------*/ + + #ifdef SGTELIB_DEBUG + std::cout << "SGTELIB::Surrogate_Factory (TS,p) begin\n"; + std::cout << "s = " << s << "\n"; + TS.info(); + #endif + + SGTELIB::Surrogate * S; + SGTELIB::Surrogate_Parameters p ( s ); + + + + switch ( p.get_type() ) { + + case SGTELIB::SVN: + throw SGTELIB::Exception ( __FILE__ , __LINE__ , + "Surrogate_Factory: not implemented yet! \""+s+"\"" ); + + case SGTELIB::PRS: + S = new Surrogate_PRS(TS,p); + break; + + case SGTELIB::PRS_EDGE: + S = new Surrogate_PRS_EDGE(TS,p); + break; + + case SGTELIB::PRS_CAT: + S = new Surrogate_PRS_CAT(TS,p); + break; + + case SGTELIB::KS: + S = new Surrogate_KS(TS,p); + break; + + case SGTELIB::CN: + S = new Surrogate_CN(TS,p); + break; + + case SGTELIB::RBF: + S = new Surrogate_RBF(TS,p); + break; + + case SGTELIB::LOWESS: + S = new Surrogate_LOWESS(TS,p); + break; + + case SGTELIB::ENSEMBLE: + S = new Surrogate_Ensemble(TS,p); + break; + + case SGTELIB::KRIGING: + S = new Surrogate_Kriging(TS,p); + break; + + default: + throw SGTELIB::Exception ( __FILE__ , __LINE__ ,"Undefined type" ); + } + + + #ifdef SGTELIB_DEBUG + std::cout << "SGTELIB::Surrogate_Factory (TS,p) AFTER set param\n"; + std::cout << "TS.info()\n"; + TS.info(); + std::cout << "S->info()\n"; + S->info(); + std::cout << "SGTELIB::Surrogate_Factory (TS,p) RETURN\n"; + #endif + return S; + +}// + + +/*----------------------------------------------------------*/ +void SGTELIB::surrogate_delete ( SGTELIB::Surrogate * S ){ +/*----------------------------------------------------------*/ + if (S){ + #ifdef SGTELIB_DEBUG + std::cout << "Delete surrogate\n"; + #endif + delete S; + S = NULL; + } +}// + diff --git a/ext/sgtelib/src/Surrogate_Factory.hpp b/ext/sgtelib/src/Surrogate_Factory.hpp new file mode 100644 index 0000000000000000000000000000000000000000..6ba52c570775e2f084a75f838747dcc8a4f8ad37 --- /dev/null +++ b/ext/sgtelib/src/Surrogate_Factory.hpp @@ -0,0 +1,56 @@ +/*-------------------------------------------------------------------------------------*/ +/* sgtelib - A surrogate model library for derivative-free optimization */ +/* Version 2.0.1 */ +/* */ +/* Copyright (C) 2012-2017 Sebastien Le Digabel - Ecole Polytechnique, Montreal */ +/* Bastien Talgorn - McGill University, Montreal */ +/* */ +/* Author: Bastien Talgorn */ +/* email: bastientalgorn@fastmail.com */ +/* */ +/* This program is free software: you can redistribute it and/or modify it under the */ +/* terms of the GNU Lesser General Public License as published by the Free Software */ +/* Foundation, either version 3 of the License, or (at your option) any later */ +/* version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ +/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ +/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License along */ +/* with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on sgtelib at https://github.com/bastientalgorn/sgtelib */ +/*-------------------------------------------------------------------------------------*/ + +#ifndef __SURROGATE_FACTORY__ +#define __SURROGATE_FACTORY__ + +#include "Defines.hpp" +#include "Exception.hpp" +#include "Surrogate.hpp" +#include "Surrogate_KS.hpp" +#include "Surrogate_CN.hpp" +#include "Surrogate_RBF.hpp" +#include "Surrogate_PRS.hpp" +#include "Surrogate_PRS_EDGE.hpp" +#include "Surrogate_PRS_CAT.hpp" +//#include "Surrogate_dynaTree.hpp" +#include "Surrogate_Ensemble.hpp" +#include "Surrogate_LOWESS.hpp" +#include "Surrogate_Kriging.hpp" + +namespace SGTELIB { + +SGTELIB::Surrogate * Surrogate_Factory ( SGTELIB::TrainingSet & C, + const std::string & s ); + +SGTELIB::Surrogate * Surrogate_Factory ( SGTELIB::Matrix & X0, + SGTELIB::Matrix & Z0, + const std::string & s ); + +void surrogate_delete ( SGTELIB::Surrogate * S ); + +} + +#endif diff --git a/ext/sgtelib/src/Surrogate_KS.cpp b/ext/sgtelib/src/Surrogate_KS.cpp new file mode 100644 index 0000000000000000000000000000000000000000..2380598afecd7272cbfdf8e5dafc15e485a32c80 --- /dev/null +++ b/ext/sgtelib/src/Surrogate_KS.cpp @@ -0,0 +1,314 @@ +/*-------------------------------------------------------------------------------------*/ +/* sgtelib - A surrogate model library for derivative-free optimization */ +/* Version 2.0.1 */ +/* */ +/* Copyright (C) 2012-2017 Sebastien Le Digabel - Ecole Polytechnique, Montreal */ +/* Bastien Talgorn - McGill University, Montreal */ +/* */ +/* Author: Bastien Talgorn */ +/* email: bastientalgorn@fastmail.com */ +/* */ +/* This program is free software: you can redistribute it and/or modify it under the */ +/* terms of the GNU Lesser General Public License as published by the Free Software */ +/* Foundation, either version 3 of the License, or (at your option) any later */ +/* version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ +/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ +/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License along */ +/* with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on sgtelib at https://github.com/bastientalgorn/sgtelib */ +/*-------------------------------------------------------------------------------------*/ + +#include "Surrogate_KS.hpp" + +/*----------------------------*/ +/* constructor */ +/*----------------------------*/ +SGTELIB::Surrogate_KS::Surrogate_KS ( SGTELIB::TrainingSet & trainingset, + SGTELIB::Surrogate_Parameters param) : + SGTELIB::Surrogate ( trainingset , param ) { + #ifdef SGTELIB_DEBUG + std::cout << "constructor KS\n"; + #endif +}// + + +/*----------------------------*/ +/* destructor */ +/*----------------------------*/ +SGTELIB::Surrogate_KS::~Surrogate_KS ( void ) { + +}// + + +/*--------------------------------------*/ +/* display */ +/*--------------------------------------*/ +void SGTELIB::Surrogate_KS::display_private ( std::ostream & out ) const { + out << "(No special members)\n"; +}// + + +/*--------------------------------------*/ +/* build_private */ +/*--------------------------------------*/ +bool SGTELIB::Surrogate_KS::build_private ( void ) { + + // Verify that the kernel is decreasing + if ( ! kernel_is_decreasing(_param.get_kernel_type())){ + throw SGTELIB::Exception ( __FILE__ , __LINE__ , + "Surrogate_KS::build_private(): Kernel must be decreasing for KS model" ); + } + + _ready = true; + return true; +}// + +/*--------------------------------------*/ +/* predict_private (ZZs only) */ +/*--------------------------------------*/ +void SGTELIB::Surrogate_KS::predict_private ( const SGTELIB::Matrix & XXs, + SGTELIB::Matrix * ZZs) { + + // i: index of a point in Xs + // ixx: index of a point in XXs + // j: index of an output (ie: a column of ZZs) + int i,ixx,j; + + // pxx: nb of prediction points + int pxx = XXs.get_nb_rows(); + + // D : distance between points of XXs and other points of the trainingset + SGTELIB::Matrix D = _trainingset.get_distances(XXs,get_matrix_Xs(),_param.get_distance_type()); + + // Kernel shape coefficient + //double ks = _param.get_kernel_coef() / _trainingset.get_Ds_mean(); + double ks = _param.get_kernel_coef() / _trainingset.get_Ds_mean(); + + // Compute weights + SGTELIB::Matrix phi = kernel(_param.get_kernel_type(),ks,D); + + const SGTELIB::Matrix & Zs = get_matrix_Zs(); + + SGTELIB::Matrix PhiZ = phi*Zs; + SGTELIB::Matrix Div = phi.sum(2); + Div.hadamard_inverse(); + *ZZs = SGTELIB::Matrix::diagA_product(Div,PhiZ); + + if (Div.has_inf()){ + // Loop on the points of XXs + for (ixx=0 ; ixx<pxx ; ixx++){ + if ( isinf(Div.get(ixx,0)) ){ + // Need to use the limit behavior of kernels + switch (_param.get_kernel_type()){ + case SGTELIB::KERNEL_D1: + case SGTELIB::KERNEL_D4: + case SGTELIB::KERNEL_D5: + // imin is the index of the closest neighbor of xx in Xs + i = D.get_min_index_row(ixx); + // Copy the output of this point + ZZs->set_row( Zs.get_row(i) , ixx); + break; + case SGTELIB::KERNEL_D2: + case SGTELIB::KERNEL_D3: + case SGTELIB::KERNEL_D6: + // Use the mean of the output over the trainingset + for (j=0 ; j<_m ; j++){ + ZZs->set(ixx,j,_trainingset.get_Zs_mean(j)); + } + break; + default: + throw SGTELIB::Exception ( __FILE__ , __LINE__ , + "Surrogate_KS::predict_private: Unacceptable kernel type" ); + } + } + } + } + +}// + + +/*--------------------------------------*/ +/* get_matrix_Zvs */ +/*--------------------------------------*/ +const SGTELIB::Matrix * SGTELIB::Surrogate_KS::get_matrix_Zvs (void){ + + check_ready(__FILE__,__FUNCTION__,__LINE__); + + // Check that it's NULL + if ( ! _Zvs ){ + + #ifdef SGTELIB_DEBUG + std::cout << "Compute _Zvs\n"; + #endif + + // Init the matrix + _Zvs = new SGTELIB::Matrix("Zvs",_p,_m); + + // i : index of point of the trainingset + // j : index of an output of the trainingset + // iv: index of the point which is excluded from the model construction, and where the + // cross-validation model is evaluated. + int i,j,iv; + + // w : sum of the weights + // wz : sum of (weights*output) + // z : predicted output (= wz/z) + double w,wz,z; + + // Construction of the phi matrix + // phi(i,iv) = kernel( || x(i) - x(iv) || ) + //double ks = _param.get_kernel_coef() / _trainingset.get_Ds_mean(); + double ks = _param.get_kernel_coef() / _trainingset.get_Ds_mean(); + + // D : distance between points of XXs and other points of the trainingset + SGTELIB::Matrix D = _trainingset.get_distances(get_matrix_Xs(),get_matrix_Xs(),_param.get_distance_type()); + + SGTELIB::Matrix phi; + phi = kernel(_param.get_kernel_type(),ks,D); + + // Loop on the outputs + for (j=0 ; j<_m ; j++){ + + // Compute the LOO-CV prediction for output j + for (iv=0 ; iv<_p ; iv++){ + w = 0; + wz= 0; + // Loop on the points of the trainingset + for (i=0 ; i<_p ; i++){ + // exclude the point iv from the construction + if (i!=iv){ + w += phi.get(i,iv); + wz+= phi.get(i,iv)*_trainingset.get_Zs(i,j); + } + } + + // Compute z + if (w>EPSILON){ + // Normal method + z = wz/w; + } + else{ + // Need to use the limit behavior of kernels + switch (_param.get_kernel_type()){ + case SGTELIB::KERNEL_D1: + case SGTELIB::KERNEL_D4: + case SGTELIB::KERNEL_D5: + { + // Find the closest point to iv + // Nb: We must have imin != iv + double d; + double dmin = SGTELIB::INF; + int imin = 0; // no need to init imin; + // Loop on the points of the trainingset + for (i=0 ; i<_p ; i++){ + + d = D.get(i,iv); + if ( (i!=iv) && (d<dmin) ){ + dmin = d; + imin = i; + } + } + // Copy the output of this point + z = _trainingset.get_Zs(imin,j); + break; + } + case SGTELIB::KERNEL_D2: + case SGTELIB::KERNEL_D3: + case SGTELIB::KERNEL_D6: + // Use the mean of the output over the trainingset + // Loop on the outputs + z = _trainingset.get_Zs_mean(j); + break; + default: + throw SGTELIB::Exception ( __FILE__ , __LINE__ , + "Surrogate_KS::predict_private: Unacceptable kernel type" ); + } + }// End of special case for computation of z + + // Affectation of the CV prediction + _Zvs->set(iv,j,z); + } + + } + _Zvs->replace_nan(+INF); + _Zvs->set_name("Zvs"); + } + return _Zvs; + +}// + +/*--------------------------------------*/ +/* get_matrix_Zhs */ +/*--------------------------------------*/ +const SGTELIB::Matrix * SGTELIB::Surrogate_KS::get_matrix_Zhs (void){ + + check_ready(__FILE__,__FUNCTION__,__LINE__); + + // Check that it's NULL + if ( ! _Zhs ){ + + #ifdef SGTELIB_DEBUG + std::cout << "Compute _Zhs\n"; + #endif + + int ixx,j; + + // w : sum of the weights + // wz : sum of (weights*output) + double w; + SGTELIB::Matrix wZ; + + // Init the matrix + _Zhs = new SGTELIB::Matrix("Zhs",_p,_m); + + // Construction of the phi matrix + double ks = _param.get_kernel_coef() / _trainingset.get_Ds_mean(); + SGTELIB::Matrix phi; + SGTELIB::Matrix D = _trainingset.get_distances(get_matrix_Xs(),get_matrix_Xs(),_param.get_distance_type()); + phi = kernel(_param.get_kernel_type(),ks,D); + SGTELIB::Matrix phi_ixx; + const SGTELIB::Matrix & Zs = get_matrix_Zs(); + + // Loop on the outputs + for (j=0 ; j<_m ; j++){ + // Compute the prediction for output j + for (ixx=0 ; ixx<_p ; ixx++){ + phi_ixx = phi.get_row(ixx); + w = phi_ixx.sum(); + wZ = phi_ixx*Zs; + _Zhs->set_row( wZ/w , ixx ); + } + + } + + _Zhs->replace_nan(+INF); + _Zhs->set_name("Zhs"); + + } + return _Zhs; + +}// + + + + + + + + + + + + + + + + + + + diff --git a/ext/sgtelib/src/Surrogate_KS.hpp b/ext/sgtelib/src/Surrogate_KS.hpp new file mode 100644 index 0000000000000000000000000000000000000000..2869e2ab03bb918d16f04cde127fe5c6de95683a --- /dev/null +++ b/ext/sgtelib/src/Surrogate_KS.hpp @@ -0,0 +1,64 @@ +/*-------------------------------------------------------------------------------------*/ +/* sgtelib - A surrogate model library for derivative-free optimization */ +/* Version 2.0.1 */ +/* */ +/* Copyright (C) 2012-2017 Sebastien Le Digabel - Ecole Polytechnique, Montreal */ +/* Bastien Talgorn - McGill University, Montreal */ +/* */ +/* Author: Bastien Talgorn */ +/* email: bastientalgorn@fastmail.com */ +/* */ +/* This program is free software: you can redistribute it and/or modify it under the */ +/* terms of the GNU Lesser General Public License as published by the Free Software */ +/* Foundation, either version 3 of the License, or (at your option) any later */ +/* version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ +/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ +/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License along */ +/* with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on sgtelib at https://github.com/bastientalgorn/sgtelib */ +/*-------------------------------------------------------------------------------------*/ + +#ifndef __SGTELIB_SURROGATE_KS__ +#define __SGTELIB_SURROGATE_KS__ + +#include "Surrogate.hpp" + +namespace SGTELIB { + + /*--------------------------------------*/ + /* Surrogate_KS class */ + /*--------------------------------------*/ + class Surrogate_KS : public SGTELIB::Surrogate { + + private: + + virtual bool build_private (void); + + virtual void predict_private ( const SGTELIB::Matrix & XXs, + SGTELIB::Matrix * ZZs); + + // Compute metrics + virtual const SGTELIB::Matrix * get_matrix_Zvs (void); + virtual const SGTELIB::Matrix * get_matrix_Zhs (void); + + public: + + // Constructor + Surrogate_KS ( SGTELIB::TrainingSet & trainingset , + SGTELIB::Surrogate_Parameters param) ; + + // destructor: + virtual ~Surrogate_KS ( void ); + + virtual void display_private ( std::ostream & out ) const; + + }; +} + +#endif + diff --git a/ext/sgtelib/src/Surrogate_Kriging.cpp b/ext/sgtelib/src/Surrogate_Kriging.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e86a859351b163f23ea7557a26a6cdf74239efad --- /dev/null +++ b/ext/sgtelib/src/Surrogate_Kriging.cpp @@ -0,0 +1,324 @@ +/*-------------------------------------------------------------------------------------*/ +/* sgtelib - A surrogate model library for derivative-free optimization */ +/* Version 2.0.1 */ +/* */ +/* Copyright (C) 2012-2017 Sebastien Le Digabel - Ecole Polytechnique, Montreal */ +/* Bastien Talgorn - McGill University, Montreal */ +/* */ +/* Author: Bastien Talgorn */ +/* email: bastientalgorn@fastmail.com */ +/* */ +/* This program is free software: you can redistribute it and/or modify it under the */ +/* terms of the GNU Lesser General Public License as published by the Free Software */ +/* Foundation, either version 3 of the License, or (at your option) any later */ +/* version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ +/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ +/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License along */ +/* with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on sgtelib at https://github.com/bastientalgorn/sgtelib */ +/*-------------------------------------------------------------------------------------*/ + +#include "Surrogate_Kriging.hpp" + + +/*----------------------------*/ +/* constructor */ +/*----------------------------*/ +SGTELIB::Surrogate_Kriging::Surrogate_Kriging ( SGTELIB::TrainingSet & trainingset, + SGTELIB::Surrogate_Parameters param) : + SGTELIB::Surrogate ( trainingset , param ), + _R ( "R",0,0 ), + _Ri ( "Ri",0,0 ), + _H ( "H",0,0 ), + _alpha ( "alpha",0,0 ), + _beta ( "beta",0,0 ), + _var ( "var",0,0 ){ + #ifdef SGTELIB_DEBUG + std::cout << "constructor Kriging\n"; + #endif + +}// + +/*----------------------------*/ +/* destructor */ +/*----------------------------*/ +SGTELIB::Surrogate_Kriging::~Surrogate_Kriging ( void ) { + +}// + + +/*----------------------------*/ +/* display */ +/*----------------------------*/ +void SGTELIB::Surrogate_Kriging::display_private ( std::ostream & out ) const { + //_alpha.display(out); + _beta.display(out); + _var.display(out); +}// + + +/*--------------------------------------*/ +/* init_private */ +/*--------------------------------------*/ +bool SGTELIB::Surrogate_Kriging::init_private ( void ) { + #ifdef SGTELIB_DEBUG + std::cout << "Surrogate_Kriging : init_private\n"; + #endif + return true; +}// + + +/*--------------------------------------*/ +/* build */ +/*--------------------------------------*/ +bool SGTELIB::Surrogate_Kriging::build_private ( void ) { + + // The build mainly consists of computing alpha + + // Compute scaling distance for each training point + const int mvar = _trainingset.get_mvar(); + const int nvar = _trainingset.get_nvar(); + const SGTELIB::Matrix & Zs = get_matrix_Zs(); + + _R = compute_covariance_matrix(get_matrix_Xs()); + _H = SGTELIB::Matrix::ones(_p,1); + _Ri = _R.lu_inverse(&_detR); + + if (_detR<=0){ + _detR = +INF; + return false; + } + + + //std::cout << "detR = "<< _detR << "\n"; + const SGTELIB::Matrix HRi = _H.transpose()*_Ri; + const SGTELIB::Matrix HRiH = HRi*_H; + _beta = HRiH.cholesky_inverse() * HRi * Zs; + _alpha = _Ri*(Zs-_H*_beta); + + _beta.set_name("beta"); + _alpha.set_name("alpha"); + + _var = SGTELIB::Matrix("var",1,mvar); + double v; + SGTELIB::Matrix Zj; + SGTELIB::Matrix Vj; + for (int j=0 ; j<mvar ; j++){ + Zj = Zs.get_col(j); + Zj = (Zj-_H*_beta.get_col(j)); + Vj = Zj.transpose() * _Ri * Zj; + v = Vj.get(0,0) / (_p-nvar); + if (v<0) return false; + _var.set(0,j,v); + + } + + _ready = true; + return true; + +}// + + + + + +/*--------------------------------------*/ +/* Compute Design matrix */ +/*--------------------------------------*/ +const SGTELIB::Matrix SGTELIB::Surrogate_Kriging::compute_covariance_matrix ( const SGTELIB::Matrix & XXs ) { + + // Xs can be, either the training set, to build the model, or prediction points. + const int pxx = XXs.get_nb_rows(); + const SGTELIB::Matrix Xs = get_matrix_Xs(); + const SGTELIB::Matrix coef = _param.get_covariance_coef(); + const SGTELIB::Matrix D = _trainingset.get_distances(XXs,get_matrix_Xs(),_param.get_distance_type()); + + SGTELIB::Matrix R ("R",pxx,_p); + + double d, cov;// dsum; + for (int i1=0 ; i1<pxx ; i1++){ + for (int i2=0 ; i2<_p ; i2++){ + d = D.get(i1,i2); + cov = coef[1] * pow(d,coef[0]); + cov = exp(-cov); + // Add noise if the distance is 0. + if (d==0) cov = 1.0+_param.get_ridge(); + R.set(i1,i2,cov); + } + } + + return R; +}// + + + + +/*--------------------------------------*/ +/* predict (ZZs only) */ +/*--------------------------------------*/ +void SGTELIB::Surrogate_Kriging::predict_private ( const SGTELIB::Matrix & XXs, + SGTELIB::Matrix * ZZs) { + check_ready(__FILE__,__FUNCTION__,__LINE__); + const int pxx = XXs.get_nb_rows(); + const SGTELIB::Matrix r = compute_covariance_matrix(XXs).transpose(); + *ZZs = SGTELIB::Matrix::ones(pxx,1)*_beta + r.transpose() * _alpha; +}// + + +void SGTELIB::Surrogate_Kriging::predict_private (const SGTELIB::Matrix & XXs, + SGTELIB::Matrix * ZZs, + SGTELIB::Matrix * std, + SGTELIB::Matrix * ei , + SGTELIB::Matrix * cdf) { + check_ready(__FILE__,__FUNCTION__,__LINE__); + + const int pxx = XXs.get_nb_rows(); + const double fs_min = _trainingset.get_fs_min(); + const SGTELIB::Matrix r = compute_covariance_matrix(XXs).transpose(); + int i,j; + + // Predict ZZ + if (ZZs) predict_private(XXs,ZZs); + + // Predict std + if (std) std->fill(-SGTELIB::INF); + else std = new SGTELIB::Matrix ("std",pxx,_m); + + double rRr; + const double HRH = (_H.transpose()*_Ri*_H).get(0,0); + + double v; + SGTELIB::Matrix ri; + for (i=0 ; i<pxx ; i++){ + ri = r.get_col(i); + rRr = (ri.transpose()*_Ri*ri).get(0,0); + if (fabs(rRr-1)<EPSILON){ + v = fabs(rRr-1); + } + else{ + v = 1-rRr+(1-rRr)*(1-rRr)/HRH; + } + v = fabs(v); + for (j=0 ; j<_m ; j++){ + std->set(i,j,v*_var[j]); + } + } + + // Prediction of statistical data + if ( (ei) || (cdf) ){ + double v; + if (ei) ei->fill(-SGTELIB::INF); + if (cdf) cdf->fill(-SGTELIB::INF); + for (j=0 ; j<_m ; j++){ + if (_trainingset.get_bbo(j)==SGTELIB::BBO_OBJ){ + // Compute CDF + if (cdf){ + for (i=0 ; i<pxx ; i++){ + v = normcdf( fs_min , ZZs->get(i,j) , std->get(i,j) ); + if (v<0) v=0; + cdf->set(i,j,v); + } + } + if (ei){ + for (i=0 ; i<pxx ; i++){ + v = normei( ZZs->get(i,j) , std->get(i,j) , fs_min ); + if (v<0) v=0; + ei->set(i,j,v ); + } + } + }// END CASE OBJ + else if (_trainingset.get_bbo(j)==SGTELIB::BBO_CON){ + // Compute CDF + if (cdf){ + // Scaled Feasibility Threshold + double cs = _trainingset.Z_scale(0.0,j); + for (i=0 ; i<pxx ; i++){ + v = normcdf( cs , ZZs->get(i,j) , std->get(i,j) ); + if (v<0) v=0; + cdf->set(i,j,v); + } + } + }// END CASE CON + }// End for j + } + +}// + + + + + +bool SGTELIB::Surrogate_Kriging::compute_cv_values (void){ + check_ready(__FILE__,__FUNCTION__,__LINE__); + + if ((_Zvs) && (_Svs)) return true; + + const SGTELIB::Matrix & Zs = get_matrix_Zs(); + const SGTELIB::Matrix RiH = _Ri*_H; + const SGTELIB::Matrix Q = _Ri - RiH*( _H.transpose()*_Ri*_H)*RiH.transpose(); + const SGTELIB::Matrix dQ = Q.diag_inverse(); + + // Init matrices + if ( ! _Zvs){ + _Zvs = new SGTELIB::Matrix; + *_Zvs = Zs - SGTELIB::Matrix::diagA_product(dQ,Q)*Zs; + _Zvs->replace_nan(+INF); + _Zvs->set_name("Zvs"); + } + + if ( ! _Svs){ + _Svs = new SGTELIB::Matrix ("Svs",_p,_m); + double q; + for (int i=0 ; i<_p ; i++){ + q = dQ.get(i,i); + for (int j=0 ; j<_m ; j++){ + _Svs->set(i,j,sqrt(_var[j]*q)); + } + } + _Svs->replace_nan(+INF); + _Svs->set_name("Svs"); + } + return true; +}// + + +/*--------------------------------------*/ +/* get cv values */ +/*--------------------------------------*/ +const SGTELIB::Matrix * SGTELIB::Surrogate_Kriging::get_matrix_Zvs (void){ + compute_cv_values(); + return _Zvs; +} +const SGTELIB::Matrix * SGTELIB::Surrogate_Kriging::get_matrix_Svs (void){ + compute_cv_values(); + return _Svs; +} + + +/*--------------------------------------*/ +/* compute linv */ +/*--------------------------------------*/ +void SGTELIB::Surrogate_Kriging::compute_metric_linv (void){ + check_ready(__FILE__,__FUNCTION__,__LINE__); + if ( ! _metric_linv){ + #ifdef SGTELIB_DEBUG + std::cout << "Compute _metric_linv\n"; + #endif + _metric_linv = new double [_m]; + for (int j=0 ; j<_m ; j++){ + _metric_linv[j] = pow(_var[j],_p)*_detR; + } + } + +}// + + + + + + diff --git a/ext/sgtelib/src/Surrogate_Kriging.hpp b/ext/sgtelib/src/Surrogate_Kriging.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ca399c901590980b30baddd8e5b1900254009b9a --- /dev/null +++ b/ext/sgtelib/src/Surrogate_Kriging.hpp @@ -0,0 +1,111 @@ +/*-------------------------------------------------------------------------------------*/ +/* sgtelib - A surrogate model library for derivative-free optimization */ +/* Version 2.0.1 */ +/* */ +/* Copyright (C) 2012-2017 Sebastien Le Digabel - Ecole Polytechnique, Montreal */ +/* Bastien Talgorn - McGill University, Montreal */ +/* */ +/* Author: Bastien Talgorn */ +/* email: bastientalgorn@fastmail.com */ +/* */ +/* This program is free software: you can redistribute it and/or modify it under the */ +/* terms of the GNU Lesser General Public License as published by the Free Software */ +/* Foundation, either version 3 of the License, or (at your option) any later */ +/* version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ +/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ +/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License along */ +/* with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on sgtelib at https://github.com/bastientalgorn/sgtelib */ +/*-------------------------------------------------------------------------------------*/ + +#ifndef __SGTELIB_SURROGATE_KRIGING__ +#define __SGTELIB_SURROGATE_KRIGING__ + +#include "Surrogate.hpp" + +namespace SGTELIB { + + /*--------------------------------------*/ + /* Surrogate_Kriging class */ + /*--------------------------------------*/ + class Surrogate_Kriging : public SGTELIB::Surrogate { + + /*--------------------------------------------------------*/ + /* these members are defined in the Surrogate superclass */ + /*--------------------------------------------------------*/ + // int _p; // number of data points in X and Z + // int _n; // dimension -- number of variables + // int _m; // number of outputs (includes the objective) + + private: + + /*--------------------------------------*/ + /* Attributes */ + /*--------------------------------------*/ + SGTELIB::Matrix _R; // Covariance Matrix + SGTELIB::Matrix _Ri; // Inverte of _R + SGTELIB::Matrix _H; // Polynomial terms + SGTELIB::Matrix _alpha; + SGTELIB::Matrix _beta; + SGTELIB::Matrix _var; + double _detR; + + /*--------------------------------------*/ + /* Building methods */ + /*--------------------------------------*/ + const SGTELIB::Matrix compute_covariance_matrix ( const SGTELIB::Matrix & XXs ); + + /*--------------------------------------*/ + /* Build model */ + /*--------------------------------------*/ + virtual bool build_private (void); + virtual bool init_private (void); + //void init_covariance_coef (void); + virtual void compute_metric_linv (void); + bool compute_cv_values (void); + + /*--------------------------------------*/ + /* predict */ + /*--------------------------------------*/ + virtual void predict_private ( const SGTELIB::Matrix & XXs, + SGTELIB::Matrix * ZZs); + + virtual void predict_private ( const SGTELIB::Matrix & XXs, + SGTELIB::Matrix * ZZs, + SGTELIB::Matrix * std, + SGTELIB::Matrix * ei , + SGTELIB::Matrix * cdf ); + + /*--------------------------------------*/ + /* Compute matrices */ + /*--------------------------------------*/ + virtual const SGTELIB::Matrix * get_matrix_Zvs (void); + virtual const SGTELIB::Matrix * get_matrix_Svs (void); + + public: + + /*--------------------------------------*/ + /* Constructor */ + /*--------------------------------------*/ + Surrogate_Kriging ( SGTELIB::TrainingSet & trainingset , + SGTELIB::Surrogate_Parameters param) ; + + /*--------------------------------------*/ + /* Destructor */ + /*--------------------------------------*/ + virtual ~Surrogate_Kriging ( void ); + + /*--------------------------------------*/ + /* Misc */ + /*--------------------------------------*/ + virtual void display_private ( std::ostream & out ) const; + + }; +} + +#endif diff --git a/ext/sgtelib/src/Surrogate_LOWESS.cpp b/ext/sgtelib/src/Surrogate_LOWESS.cpp new file mode 100644 index 0000000000000000000000000000000000000000..5728edd293ca6342dd717fcec48598776e75a474 --- /dev/null +++ b/ext/sgtelib/src/Surrogate_LOWESS.cpp @@ -0,0 +1,709 @@ +/*-------------------------------------------------------------------------------------*/ +/* sgtelib - A surrogate model library for derivative-free optimization */ +/* Version 2.0.1 */ +/* */ +/* Copyright (C) 2012-2017 Sebastien Le Digabel - Ecole Polytechnique, Montreal */ +/* Bastien Talgorn - McGill University, Montreal */ +/* */ +/* Author: Bastien Talgorn */ +/* email: bastientalgorn@fastmail.com */ +/* */ +/* This program is free software: you can redistribute it and/or modify it under the */ +/* terms of the GNU Lesser General Public License as published by the Free Software */ +/* Foundation, either version 3 of the License, or (at your option) any later */ +/* version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ +/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ +/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License along */ +/* with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on sgtelib at https://github.com/bastientalgorn/sgtelib */ +/*-------------------------------------------------------------------------------------*/ + +#include "Surrogate_LOWESS.hpp" + +//#define SGTELIB_LOWESS_DEV +//#define SGTELIB_DEBUG + + +const int GAMMA_EXP = 2; + +/*----------------------------*/ +/* constructor */ +/*----------------------------*/ +SGTELIB::Surrogate_LOWESS::Surrogate_LOWESS ( SGTELIB::TrainingSet & trainingset, + SGTELIB::Surrogate_Parameters param) : + SGTELIB::Surrogate ( trainingset , param ), + _q ( 0 ), + _q_old ( 99999999 ), + _degree ( 0 ), + _H ( NULL ), + _W ( NULL ), + _A ( NULL ), + _HWZ ( NULL ), + _u ( NULL ), + _old_u ( NULL ), + _old_x ( NULL ), + _ZZsi ("ZZsi",0,0){ + #ifdef SGTELIB_DEBUG + std::cout << "constructor LOWESS\n"; + #endif +}// + + +/*--------------------------------------*/ +/* delete matrices */ +/*--------------------------------------*/ +void SGTELIB::Surrogate_LOWESS::delete_matrices ( void ) { + + if (_W) delete [] _W; + _W = NULL; + + if (_u) delete []_u; + _u = NULL; + + if (_old_u) delete [] _old_u; + _old_u = NULL; + + if (_old_x) delete [] _old_x; + _old_x = NULL; + + + const int p = std::min(_p_old,_p); + if (_H){ + for (int i=0 ; i<p ; i++) delete [] _H[i]; + delete [] _H; + } + _H = NULL; + + + const int q = std::min(_q_old,_q); + if (_A){ + for (int i=0 ; i<q ; i++) delete [] _A[i]; + delete [] _A; + } + _A = NULL; + + if (_HWZ){ + for (int i=0 ; i<q ; i++) delete [] _HWZ[i]; + delete [] _HWZ; + } + _HWZ = NULL; +}// + + +/*--------------------------------------*/ +/* destructor */ +/*--------------------------------------*/ +SGTELIB::Surrogate_LOWESS::~Surrogate_LOWESS ( void ) { + delete_matrices(); +}// + + + + +/*----------------------------*/ +/* display */ +/*----------------------------*/ +void SGTELIB::Surrogate_LOWESS::display_private ( std::ostream & out ) const { + out << "q: " << _q << "\n"; +}// + +/*--------------------------------------*/ +/* build */ +/*--------------------------------------*/ +bool SGTELIB::Surrogate_LOWESS::build_private ( void ) { + + const int pvar = _trainingset.get_pvar(); + + if (pvar<2) return false; + + // Get the number of basis functions. + const int n1=_trainingset.get_X_nbdiff1(); + const int n2=_trainingset.get_X_nbdiff2(); + const int q10 = 1+n1; + const int q15 = 1+n1+n2; + const int q20 = 1+n1+n2*(n2+1)/2; + const int degree_max = _param.get_degree(); + if ((pvar>q20) & (degree_max>=2)){ + _q = q20; + _degree = 20; + } + else if ((pvar>q15) & (degree_max>=2)){ + _q = q15; + _degree = 15; + } + else if ((pvar>q10) & (degree_max>=1)){ + _q = q10; + _degree = 10; + } + else{ + _q = 1; + _degree = 0; + } + + #ifdef SGTELIB_DEBUG + std::cout << "_q = " << _q << " (degree=" << double(_degree)/10 << ")\n"; + #endif + + // Init matrices for prediction + + delete_matrices(); + + if ( ! _W){ + _W = new double [_p]; + } + if ( ! _A){ + _A = new double * [_q]; + for (int j=0 ; j<_q ; j++) _A[j] = new double [_q]; + } + if ( ! _H){ + _H = new double * [_p]; + for (int j=0 ; j<_p ; j++) _H[j] = new double [_q]; + } + if ( ! _HWZ){ + _HWZ = new double * [_q]; + for (int j=0 ; j<_q ; j++) _HWZ[j] = new double [_m]; + } + if ( ! _u){ + _u = new double [_q]; + for (int i=0 ; i<_q ; i++) _u[i] = 0.0; + } + if ( ! _old_u){ + _old_u = new double [_q]; + for (int i=0 ; i<_q ; i++) _old_u[i] = 0.0; + } + #ifdef SGTELIB_LOWESS_DEV + if ( ! _old_x){ + _old_x = new double [_n]; + for (int i=0 ; i<_n ; i++) _old_x[i] = 0.0; + } + #endif + + _ZZsi = SGTELIB::Matrix("ZZsi",1,_m); + #ifdef SGTELIB_DEBUG + std::cout << "Line " << __LINE__ << "(End of private build)\n"; + #endif + + _q_old = _q; + + // C.Tribes jan 17th, 2017 --- update _p_old to prevent memory leak + _p_old = _p; + + _ready = true; + return true; +}// + + + + +/*--------------------------------------*/ +/* predict (ZZs only) */ +/*--------------------------------------*/ +void SGTELIB::Surrogate_LOWESS::predict_private ( const SGTELIB::Matrix & XXs, + SGTELIB::Matrix * ZZs ) { + + check_ready(__FILE__,__FUNCTION__,__LINE__); + const int pxx = XXs.get_nb_rows(); + if (pxx>1){ + for (int i=0 ; i<XXs.get_nb_rows() ; i++){ + #ifdef SGTELIB_DEBUG + std::cout << "============================================\n"; + std::cout << "Prediction of point " << i << "/" << XXs.get_nb_rows() << "\n"; + std::cout << "============================================\n"; + #endif + predict_private_single ( XXs.get_row(i) ); + ZZs->set_row( _ZZsi , i ); + } + } + else{ + predict_private_single ( XXs ); + *ZZs = _ZZsi; + } +}// + +/*--------------------------------------*/ +/* predict (for one point) */ +/*--------------------------------------*/ +void SGTELIB::Surrogate_LOWESS::predict_private_single ( const SGTELIB::Matrix XXs , int i_exclude ) { + if (XXs.get_nb_rows()!=1){ + throw SGTELIB::Exception ( __FILE__ , __LINE__ ,"predict_private_single : XXs must have only one row." ); + } + + int i,j,j1,j2,k; + double d; + + #ifdef SGTELIB_DEBUG + std::cout << "i_exclude = " << i_exclude << "\n"; + #endif + + #ifdef SGTELIB_LOWESS_DEV + int clock_start; + clock_start = clock(); + #endif + + // Distance Matrix + // D : distance between points of XXs and other points of the trainingset + SGTELIB::Matrix D = _trainingset.get_distances(XXs,get_matrix_Xs(),_param.get_distance_type()); + + // Preset + const std::string preset = _param.get_preset(); + + + // ================================== + // GAMMA DISTRIBUTION + // ================================== + // Number of points taken into account + // = p if no point is excluded + // = p-1 if one point is excluded (ie:i_exclude!=-1). + const double p_divide = double(_p)-double(i_exclude != -1); + // Empirical mean & variance of the distances + SGTELIB::Matrix Distances = D; + if (GAMMA_EXP==2) Distances=SGTELIB::Matrix::hadamard_square(Distances); + const double mean = Distances.sum()/p_divide; + const double var = SGTELIB::Matrix::hadamard_square(Distances+(-mean)).sum()/p_divide; + #ifdef SGTELIB_DEBUG + std::cout << "mean var = " << mean << " " << var << "\n"; + #endif + if ( (mean<0) || (var<0) ){ + std::cout << "mean: " << mean << "\n"; + std::cout << "var: " << var << "\n"; + throw SGTELIB::Exception ( __FILE__ , __LINE__ ,"Error on computation of mean and var" ); + } + // Gamma parameters + const double gamma_shape = mean*mean/var; + const double gamma_scale = var/mean; + + + + #ifdef SGTELIB_LOWESS_DEV + // Write in a file the values of dq + if (i_exclude==-1){ + const SGTELIB::Matrix R = D.rank(); + i = 0; + while (R.get(i)!=_q-1) i++; + const double dq_emp = D.get(i); + const double dq_gam = pow(SGTELIB::gammacdfinv(double(_q)/double(_p),gamma_shape,gamma_scale),1./GAMMA_EXP); + + std::ofstream fileout; + fileout.open ("data_dq.txt" , std::fstream::out | std::fstream::app); + fileout << dq_emp << " " << dq_gam << " " << _q << " " << _p << " " << gamma_shape << " " << gamma_scale << "\n"; + fileout.close(); + } + #endif + + + + if (preset=="D"){ + // ======================================================== + // Distance only + for (i=0 ; i<_p ; i++) _W[i] = D.get(i); + } + else if (preset=="DEN"){ + // ======================================================== + // Distance, normalized with empirical method + const SGTELIB::Matrix R = D.rank(); + i = 0; + while (R.get(i)!=_q-1) i++; + const double dq = 2.0*D.get(i); + for (i=0 ; i<_p ; i++) _W[i] = D.get(i)/dq; + } + else if (preset=="DGN"){ + // ======================================================== + // Distance, normalized with Gamma method + const double dq = pow(SGTELIB::gammacdfinv(double(_q)/double(p_divide),gamma_shape,gamma_scale),1./GAMMA_EXP); + for (i=0 ; i<_p ; i++) _W[i] = D.get(i)/dq; + } + else if ( (preset=="RE") || (preset=="REN") ){ + // ======================================================== + // Rank, computed with empirical method + const SGTELIB::Matrix R = D.rank(); + for (i=0 ; i<_p ; i++) _W[i] = R.get(i); + if (preset=="REN"){ + for (i=0 ; i<_p ; i++) _W[i] /= (double(_p)-1.0); + } + } + else if ( (preset=="RG") || (preset=="RGN") ){ + // ======================================================== + // Rank, computed with gamma method + for (i=0 ; i<_p ; i++){ + _W[i] = SGTELIB::gammacdf(pow(D.get(i),GAMMA_EXP),gamma_shape,gamma_scale); + } + // DE-Normalization + if (preset=="RG"){ + for (i=0 ; i<_p ; i++) _W[i] *= (double(_p)-1.0); + } + } + + + + + + double wsum; + // For Gamma methods, Handle special case where the variance of the distances is null + if (var==0){ + for (i=0 ; i<_p ; i++){ + _W[i] = 1.0; + } + wsum = _p; + } + // Normal case + else{ + // parameters of the gamma distribution + + const double lambda = _param.get_kernel_coef(); + //std::cout << "lambda : " << lambda << "\n"; + const SGTELIB::kernel_t kt = _param.get_kernel_type(); + // Weights + wsum = 0; + for (i=0 ; i<_p ; i++){ + _W[i] = kernel(kt,lambda,_W[i]); + wsum += _W[i]; + } + } + + // If a point must be excluded from the training points, set its weight to 0. + if (i_exclude != -1){ + wsum -= _W[i_exclude]; + _W[i_exclude] = 0.0; + #ifdef SGTELIB_DEBUG + std::cout << "Exclude training point " << i_exclude << "\n"; + #endif + } + + + if (wsum>EPSILON){ + for (i=0 ; i<_p ; i++){ + _W[i] /= wsum; + } + } + else{ + // If all the weights are negligible, put 1 everywhere + for (i=0 ; i<_p ; i++){ + _W[i] = 1; + } + } + + // Ridge + double ridge = _param.get_ridge(); + + // Build matrices + const int nvar = _trainingset.get_nvar(); + const SGTELIB::Matrix & Zs = get_matrix_Zs(); + const SGTELIB::Matrix & Xs = get_matrix_Xs(); + // Reset H + for (i=0 ; i<_p ; i++){ + for (j=0 ; j<_q ; j++){ + _H[i][j] = 0; + } + } + + // Build H + for (i=0 ; i<_p ; i++){ + k = 0; + _H[i][k++] = 1; + if (_W[i]>EPSILON){ + if (_degree>=10){ + // Linear terms + for (j=0 ; j<nvar ; j++){ + _H[i][k++] = Xs.get(i,j)-XXs.get(0,j); + } + } + if (_degree>=15){ + // Quad and crossed terms + for (j1=0 ; j1<nvar ; j1++){ + if (_trainingset.get_X_nbdiff(j1)>1){ + j2=j1; + if (_trainingset.get_X_nbdiff(j2)>1){ + _H[i][k++] = (Xs.get(i,j1)-XXs.get(0,j1))*(Xs.get(i,j2)-XXs.get(0,j2)); + } + if (_degree>=20){ + for (j2=j1+1 ; j2<nvar ; j2++){ + if (_trainingset.get_X_nbdiff(j2)>1){ + _H[i][k++] = (Xs.get(i,j1)-XXs.get(0,j1))*(Xs.get(i,j2)-XXs.get(0,j2)); + } + } + } + } + } + } + } + } + + + + // Reset A and HWZ + for (i=0 ; i<_q ; i++){ + for (j=i ; j<_q ; j++){ + _A[i][j] = 0; + } + for (j=0 ; j<_m ; j++){ + _HWZ[i][j] = 0; + } + } + #ifdef SGTELIB_DEBUG + int w_count = 0; + #endif + + // Build A and HWZ + double w; + for (k=0 ; k<_p ; k++){ + w = _W[k]; + if (w>EPSILON){ + #ifdef SGTELIB_DEBUG + w_count++; + #endif + for (i=0 ; i<_q ; i++){ + d = _H[k][i]*w; + for (j=i ; j<_q ; j++){ + _A[i][j] += d*_H[k][j]; + } + for (j=0 ; j<_m ; j++){ + _HWZ[i][j] += d*Zs.get(k,j); + } + } + } + } + #ifdef SGTELIB_DEBUG + std::cout << "non null w : " << w_count << " / " << _p << "\n"; + #endif + // Symmetry of A + for (i=0 ; i<_q ; i++){ + for (j=i+1 ; j<_q ; j++){ + _A[j][i] = _A[i][j]; + } + } + + // Add ridge term + //for (i=_trainingset.get_X_nbdiff1()+1 ; i<_q ; i++){ + for (i=1 ; i<_q ; i++){ + _A[i][i] += ridge; + } + + #ifdef SGTELIB_LOWESS_DEV + double time_build; + time_build = double(clock() - clock_start)/double(CLOCKS_PER_SEC); + #endif + + //=========================// + // RESOLUTION // + //=========================// + + + const double tol = 1e-12; + int iter_conj = 0; + + // Initial residual error ||Au-b||_2^2 + double res = 0; + { + double Au_i = -1; + for (i=0 ; i<_q ; i++){ + for (j=0 ; j<_q ; j++){ + Au_i += _A[i][j]*_old_u[j]; + } + res += Au_i*Au_i; + Au_i = 0; + } + res = sqrt(res); + } + + // Choice of the method + bool USE_CHOL = false; + bool USE_CONJ = false; + if (res<1e-4) USE_CONJ = true; + else USE_CHOL = true; + + + #ifdef SGTELIB_DEBUG + std::cout << "USE CHOL / CONJ : " << USE_CHOL << " " << USE_CONJ << " ( " << res << " )\n"; + #endif + #ifdef SGTELIB_LOWESS_DEV + USE_CHOL = true; + USE_CONJ = true; + double time_chol; + double time_conj; + #endif + + + if (USE_CONJ){ + double * r = new double [_q]; + double * p = new double [_q]; + double * Ap = new double [_q]; + + // Use conjugate + #ifdef SGTELIB_LOWESS_DEV + clock_start = clock(); + #endif + + // rr = b-Ax // ================== + double rr = 0; + d = +1; // Special initialization of the first value of d + // to take into account the first term of b (which is 1); + for (i=0 ; i<_q ; i++){ + for (j=0 ; j<_q ; j++){ + d -= _A[i][j]*_u[j]; + } + r[i] = d; + p[i] = d; + rr += d*d; + d = 0; + } + + double rr_old,alpha,pAp; + + while (iter_conj < 100){ + // Ap // =================== + for (i=0 ; i<_q ; i++){ + d = 0; + for (j=0 ; j<_q ; j++){ + d += _A[i][j]*p[j]; + } + Ap[i] = d; + } + // pAp // =================== + pAp = 0; + for (i=0 ; i<_q ; i++) pAp += p[i]*Ap[i]; + // Alpha // ================= + alpha = rr/pAp; + // u // ====================== + for (i=0 ; i<_q ; i++) _u[i] += alpha*p[i]; + // r // ======================== + for (i=0 ; i<_q ; i++) r[i] -= alpha*Ap[i]; + rr_old = rr; + rr = 0; + for (i=0 ; i<_q ; i++) rr += r[i]*r[i]; + + // Break ?? // ================= + if (rr < tol) break; + // p //========================= + d = rr/rr_old; + for (i=0 ; i<_q ; i++){ + p[i] *= d; + p[i] += r[i]; + } + iter_conj++; + } + + #ifdef SGTELIB_DEBUG + std::cout << "Conj rr = " << rr << "\n"; + std::cout << "Conj iter = " << iter_conj << "\n"; + #endif + #ifdef SGTELIB_LOWESS_DEV + time_conj = double(clock() - clock_start)/double(CLOCKS_PER_SEC); + #endif + delete [] r; + delete [] p; + delete [] Ap; + } + + + if (USE_CHOL){ + // Use cholesky + #ifdef SGTELIB_LOWESS_DEV + clock_start = clock(); + #endif + SGTELIB::Matrix A("A",_q,_q,_A); + SGTELIB::Matrix b = SGTELIB::Matrix("b",_q,1); + b.set(0,0,1.0); + SGTELIB::Matrix u_mat = SGTELIB::Matrix::cholesky_solve(A,b); + #ifdef SGTELIB_LOWESS_DEV + time_chol = double(clock() - clock_start)/double(CLOCKS_PER_SEC); + #endif + //std::cout << "Clock (CHOL): " << time_chol << "sec\n"; + for (i=0 ; i<_q ; i++){ + _u[i] = u_mat.get(i,0); + } + } + + + // Compute the output + for (j=0 ; j<_m ; j++){ + d = 0; + for (k=0 ; k<_q ; k++){ + d += _u[k]*_HWZ[k][j]; + } + _ZZsi.set(0,j,d); + } + // _ZZsi is the output of this method, but is not returned as it's an attribut of the class. + + /* + std::cout << "A = [\n"; + for (i=0 ; i<_q ; i++){ + for (j=0 ; j<_q ; j++) + std::cout << _A[i][j] << " "; + std::cout << "\n"; + } + std::cout << "]\n"; + */ + + #ifdef SGTELIB_LOWESS_DEV + // STATISTICS // + // Compute norm dx + double dx = 0; + for (i=0 ; i<_n ; i++){ + d = _old_x[i] - XXs.get(0,i); + dx += d*d; + } + dx = sqrt(dx); + + // Norm du + double du = 0; + for (i=0 ; i<_q ; i++){ + d = _old_u[i] - _u[i]; + du += d*d; + } + du = sqrt(du); + // Display stat + if (i_exclude==-1){ + std::ofstream myfile; + const std::string file_name = "LOWESS_times_n"+itos(_n)+".txt"; + myfile.open (file_name.c_str(),std::ios::app); + myfile << _n << " , " << dx << " " << du << " " << res << " , " << time_build << " " << time_chol << " " << time_conj << " , " << iter_conj << "\n"; + myfile.close(); + } + + // Save old x + for (i=0 ; i<_n ; i++){ + _old_x[i] = XXs.get(0,i); + } + #endif + + + // Save old u + for (i=0 ; i<_q ; i++){ + _old_u[i] = _u[i]; + } + +} + +/*--------------------------------------*/ +/* compute Zvs */ +/*--------------------------------------*/ +const SGTELIB::Matrix * SGTELIB::Surrogate_LOWESS::get_matrix_Zvs (void){ + check_ready(__FILE__,__FUNCTION__,__LINE__); + #ifdef SGTELIB_DEBUG + std::cout << "==========================\n"; + std::cout << "Compute Zvs\n"; + std::cout << "==========================\n"; + #endif + if ( ! _Zvs){ + _Zvs = new SGTELIB::Matrix("Zvs",_p,_m); + for (int i=0 ; i<_p ; i++){ + predict_private_single( get_matrix_Xs().get_row(i) , i); + _Zvs->set_row( _ZZsi ,i); + } + } + #ifdef SGTELIB_DEBUG + std::cout << "==========================\n"; + std::cout << "END Compute Zvs\n"; + std::cout << "==========================\n"; + #endif + return _Zvs; +}// + + + + diff --git a/ext/sgtelib/src/Surrogate_LOWESS.hpp b/ext/sgtelib/src/Surrogate_LOWESS.hpp new file mode 100644 index 0000000000000000000000000000000000000000..94ad8366646debed10ca63acdffac35699c86f4d --- /dev/null +++ b/ext/sgtelib/src/Surrogate_LOWESS.hpp @@ -0,0 +1,83 @@ +/*-------------------------------------------------------------------------------------*/ +/* sgtelib - A surrogate model library for derivative-free optimization */ +/* Version 2.0.1 */ +/* */ +/* Copyright (C) 2012-2017 Sebastien Le Digabel - Ecole Polytechnique, Montreal */ +/* Bastien Talgorn - McGill University, Montreal */ +/* */ +/* Author: Bastien Talgorn */ +/* email: bastientalgorn@fastmail.com */ +/* */ +/* This program is free software: you can redistribute it and/or modify it under the */ +/* terms of the GNU Lesser General Public License as published by the Free Software */ +/* Foundation, either version 3 of the License, or (at your option) any later */ +/* version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ +/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ +/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License along */ +/* with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on sgtelib at https://github.com/bastientalgorn/sgtelib */ +/*-------------------------------------------------------------------------------------*/ + +#ifndef __SGTELIB_SURROGATE_LOWESS__ +#define __SGTELIB_SURROGATE_LOWESS__ + +#include "Surrogate.hpp" + +#include <iostream> +#include <fstream> + +namespace SGTELIB { + + /*--------------------------------------*/ + /* Surrogate_LOWESS class */ + /*--------------------------------------*/ + class Surrogate_LOWESS : public SGTELIB::Surrogate { + + protected: + + int _q; // Number of basis functions + int _q_old; + int _degree; // Degree of local regression + double ** _H; // Design matrix + double * _W; // Weights of each observation + double ** _A; // Matrix of the linear system (and preconditionner) + double ** _HWZ; // Second term + double * _u; // First line of inverse of A + double * _old_u; // Last value of gamma + double * _old_x; // Last value of x + + SGTELIB::Matrix _ZZsi; // Outputs for one point (buffer) + + // build model (private): + virtual bool build_private (void); + + void predict_private ( const SGTELIB::Matrix & XXs, + SGTELIB::Matrix * ZZs); + + void delete_matrices (void); + + void predict_private_single ( SGTELIB::Matrix XXs , int i_exclude = -1); + + // Compute metrics + const SGTELIB::Matrix * get_matrix_Zvs (void); + + public: + // Constructor + Surrogate_LOWESS ( SGTELIB::TrainingSet & trainingset , + SGTELIB::Surrogate_Parameters param) ; + + // destructor: + virtual ~Surrogate_LOWESS ( void ); + + // Build the monome exponents + virtual void display_private ( std::ostream & out ) const; + + }; +} + +#endif diff --git a/ext/sgtelib/src/Surrogate_PRS.cpp b/ext/sgtelib/src/Surrogate_PRS.cpp new file mode 100644 index 0000000000000000000000000000000000000000..bf8db98516ad450821df4704c7dccd0754c69035 --- /dev/null +++ b/ext/sgtelib/src/Surrogate_PRS.cpp @@ -0,0 +1,278 @@ +/*-------------------------------------------------------------------------------------*/ +/* sgtelib - A surrogate model library for derivative-free optimization */ +/* Version 2.0.1 */ +/* */ +/* Copyright (C) 2012-2017 Sebastien Le Digabel - Ecole Polytechnique, Montreal */ +/* Bastien Talgorn - McGill University, Montreal */ +/* */ +/* Author: Bastien Talgorn */ +/* email: bastientalgorn@fastmail.com */ +/* */ +/* This program is free software: you can redistribute it and/or modify it under the */ +/* terms of the GNU Lesser General Public License as published by the Free Software */ +/* Foundation, either version 3 of the License, or (at your option) any later */ +/* version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ +/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ +/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License along */ +/* with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on sgtelib at https://github.com/bastientalgorn/sgtelib */ +/*-------------------------------------------------------------------------------------*/ + +#include "Surrogate_PRS.hpp" + +/*----------------------------*/ +/* constructor */ +/*----------------------------*/ +SGTELIB::Surrogate_PRS::Surrogate_PRS ( SGTELIB::TrainingSet & trainingset, + SGTELIB::Surrogate_Parameters param) : + SGTELIB::Surrogate ( trainingset , param ), + _q ( 0 ), + _M ( "M",0,0 ), + _H ( "H",0,0 ), + _Ai ( "Ai",0,0 ), + _alpha ( "alpha",0,0 ){ + #ifdef SGTELIB_DEBUG + std::cout << "constructor PRS\n"; + #endif +}// + + +/*----------------------------*/ +/* destructor */ +/*----------------------------*/ +SGTELIB::Surrogate_PRS::~Surrogate_PRS ( void ) { + +}// + + +/*----------------------------*/ +/* display */ +/*----------------------------*/ +void SGTELIB::Surrogate_PRS::display_private ( std::ostream & out ) const { + out << "q: " << _q << "\n"; +}// + + +/*--------------------------------------*/ +/* build */ +/*--------------------------------------*/ +bool SGTELIB::Surrogate_PRS::build_private ( void ) { + + const int pvar = _trainingset.get_pvar(); + const int nvar = _trainingset.get_nvar(); + + // Get the number of basis functions. + _q = Surrogate_PRS::get_nb_PRS_monomes(nvar,_param.get_degree()); + + // If _q is too big or there is not enough points, then quit + if (_q>200) return false; + if ( (_q>pvar-1) && (_param.get_ridge()==0) ) return false; + + // Compute the exponents of the basis functions + _M = get_PRS_monomes(nvar,_param.get_degree()); + + // DESIGN MATRIX H + _H = compute_design_matrix ( _M , get_matrix_Xs() ); + + // Compute alpha + if ( ! compute_alpha()) return false; + + _ready = true; + return true; +}// + +/*--------------------------------------*/ +/* Compute PRS matrix */ +/*--------------------------------------*/ +const SGTELIB::Matrix SGTELIB::Surrogate_PRS::compute_design_matrix ( const SGTELIB::Matrix Monomes, + const SGTELIB::Matrix & Xs ) { + + const int n = Xs.get_nb_cols(); // Nb of points in the matrix X given in argument + const int p = Xs.get_nb_rows(); // Nb of points in the matrix X given in argument + double v; + int i,j,jj,k,exponent; + + const int nbMonomes = Monomes.get_nb_rows(); + + // Init the design matrix + SGTELIB::Matrix H("H",p,nbMonomes); + // Current basis function (vector column to construct 1 basis function) + SGTELIB::Matrix h("h",p,1); + + // j is the corresponding index among all input (j in [0;n-1]) + // jj is the index of the input variabe amongst the varying input (jj in [0;nvar-1]) + // k is the index of the monome (ie: the basis function) (k in [0;q-1]) + // i is the index of a point (i in [0;p-1]) + // Loop on the monomes + for (k=0 ; k<nbMonomes ; k++){ + h.fill(1.0); + jj=0; + // Loop on the input variables + for (j=0 ; j<n ; j++){ + if (_trainingset.get_X_nbdiff(j)>1){ + exponent = int(Monomes.get(k,jj)); + if (exponent>0){ + for (i=0 ; i<p ; i++){ + v = h.get(i,0); + v *= pow(Xs.get(i,jj),exponent); + h.set(i,0,v); + } + } + jj++; + } + } + H.set_col(h,k); + } + return H; +}// + + +/*--------------------------------------*/ +/* compute alpha */ +/*--------------------------------------*/ +bool SGTELIB::Surrogate_PRS::compute_alpha ( void ){ + + const SGTELIB::Matrix Ht = _H.transpose(); + const SGTELIB::Matrix & Zs = get_matrix_Zs(); + + // Ridge + double r = _param.get_ridge(); + + // COMPUTE COEFS + if (r>0){ + //_Ai = (Ht*_H+r*SGTELIB::Matrix::identity(_q)).SVD_inverse(); + _Ai = (Ht*_H+r*SGTELIB::Matrix::identity(_q)).cholesky_inverse(); + } + else{ + //_Ai = (Ht*_H).SVD_inverse(); + _Ai = (Ht*_H).cholesky_inverse(); + } + + _alpha = _Ai * (Ht * Zs); + _alpha.set_name("alpha"); + if (_alpha.has_nan()){ + return false; + } + return true; +} + +/*--------------------------------------*/ +/* predict (ZZs only) */ +/*--------------------------------------*/ +void SGTELIB::Surrogate_PRS::predict_private ( const SGTELIB::Matrix & XXs, + SGTELIB::Matrix * ZZs ) { + check_ready(__FILE__,__FUNCTION__,__LINE__); + *ZZs = compute_design_matrix(_M,XXs) * _alpha; +}// + +/*--------------------------------------*/ +/* compute Zvs */ +/*--------------------------------------*/ +const SGTELIB::Matrix * SGTELIB::Surrogate_PRS::get_matrix_Zvs (void){ + check_ready(__FILE__,__FUNCTION__,__LINE__); + // Not necessary. Zv is computed in "build". + if ( ! _Zvs){ + _Zvs = new SGTELIB::Matrix; + // Projection matrix + const SGTELIB::Matrix & Zs = get_matrix_Zs(); + SGTELIB::Matrix dPiPZs = SGTELIB::Matrix::get_matrix_dPiPZs(_Ai,_H,Zs); + + // dPi is the inverse of the diag of P + // Compute _Zv = Zs - dPi*P*Zs + *_Zvs = Zs - dPiPZs; + _Zvs->replace_nan(+INF); + _Zvs->set_name("Zvs"); + } + return _Zvs; +}// + + + +/*-----------------------------------------*/ +/* Compute the theorical number of monomes */ +/*-----------------------------------------*/ +int SGTELIB::Surrogate_PRS::get_nb_PRS_monomes(const int nvar, const int degree){ + // Return the number of lines in the matrix M computed in get_PRS_monomes() + int S = 1; + int v = nvar; + for (int d = 1 ; d<=degree ; d++){ + S += v; + v = (v*(nvar+d))/(d+1); + } + return S; +}// + + + +/*----------------------------------*/ +/* BUILD THE INDEX MATRICES */ +/*----------------------------------*/ +SGTELIB::Matrix SGTELIB::Surrogate_PRS::get_PRS_monomes(const int nvar, const int degree){ + + double * z = new double [nvar]; + SGTELIB::Matrix M("Monomes",1,nvar); + bool continuer; + + int i,j,di,ci; + + // Loop on the number of non null terms in z + // c is the number of non-null terms of the monome. + // We start with the monomes with only one non-null term. + for (int c=1 ; c<=std::min(degree,nvar) ; c++){ + for (int d=c ; d<=degree ; d++){ + + // First monome (c,d) + z[0] = d-c+1; + for (i=1 ; i<c ; i++) + z[i] = 1; + for (i=c ; i<nvar ; i++) + z[i] = 0; + + continuer = true; + while (continuer){ + M.add_row(z); + // Pivot + i = 0; + while ( (i<nvar-1) && (z[i]<=z[i+1]) && ( (z[i]<=1) || (z[i+1]>=d-c+1)) ) + i++; + // Transfert + if (i < nvar-1){ + z[i+1]++; + for (j=0; j<=i ; j++){ + z[j] = 0; + } + ci = c; + di = d; + for (j=i+1 ; j<nvar ; j++){ + ci -= (z[j]!=0); + di -= static_cast<int>(z[j]); + } + if ( (ci==0) && (di>0) ){ + z[i+1] = z[i+1]+di; + } + else{ + for (int j=0; j<ci; j++){ + z[j] = 1; + z[0] -= z[j]; + } + z[0] += di; + } + } + else{ + continuer = false; + } + } // loop while + }// loop d + }// loop c + delete [] z; + return M; +}// + + + + diff --git a/ext/sgtelib/src/Surrogate_PRS.hpp b/ext/sgtelib/src/Surrogate_PRS.hpp new file mode 100644 index 0000000000000000000000000000000000000000..fd45ad33b438ee61626d6b47afd9148208a8b998 --- /dev/null +++ b/ext/sgtelib/src/Surrogate_PRS.hpp @@ -0,0 +1,85 @@ +/*-------------------------------------------------------------------------------------*/ +/* sgtelib - A surrogate model library for derivative-free optimization */ +/* Version 2.0.1 */ +/* */ +/* Copyright (C) 2012-2017 Sebastien Le Digabel - Ecole Polytechnique, Montreal */ +/* Bastien Talgorn - McGill University, Montreal */ +/* */ +/* Author: Bastien Talgorn */ +/* email: bastientalgorn@fastmail.com */ +/* */ +/* This program is free software: you can redistribute it and/or modify it under the */ +/* terms of the GNU Lesser General Public License as published by the Free Software */ +/* Foundation, either version 3 of the License, or (at your option) any later */ +/* version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ +/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ +/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License along */ +/* with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on sgtelib at https://github.com/bastientalgorn/sgtelib */ +/*-------------------------------------------------------------------------------------*/ + +#ifndef __SGTELIB_SURROGATE_PRS__ +#define __SGTELIB_SURROGATE_PRS__ + +#include "Surrogate.hpp" + +namespace SGTELIB { + + /*--------------------------------------*/ + /* Surrogate_PRS class */ + /*--------------------------------------*/ + class Surrogate_PRS : public SGTELIB::Surrogate { + + /*--------------------------------------------------------*/ + /* these members are defined in the Surrogate superclass */ + /*--------------------------------------------------------*/ + // int _p; // number of data points in X and Z + // int _n; // dimension -- number of variables + // int _m; // number of outputs (includes the objective) + + protected: + + int _q; // Nb of basis function + SGTELIB::Matrix _M; // Monomes + SGTELIB::Matrix _H; // Design matrix + SGTELIB::Matrix _Ai; // Inverse of Ht*H + SGTELIB::Matrix _alpha; // Coefficients + + virtual const SGTELIB::Matrix compute_design_matrix ( const SGTELIB::Matrix Monomes, + const SGTELIB::Matrix & Xs ); + + // build model (private): + virtual bool build_private (void); + + void predict_private ( const SGTELIB::Matrix & XXs, + SGTELIB::Matrix * ZZs); + + + // Compute metrics + const SGTELIB::Matrix * get_matrix_Zvs (void); + + bool compute_alpha ( void ); + + public: + + // Constructor + Surrogate_PRS ( SGTELIB::TrainingSet & trainingset , + SGTELIB::Surrogate_Parameters param) ; + + // destructor: + virtual ~Surrogate_PRS ( void ); + + // Build the monome exponents + static int get_nb_PRS_monomes(const int nvar, const int degree); + static SGTELIB::Matrix get_PRS_monomes(const int nvar, const int degree); + virtual void display_private ( std::ostream & out ) const; + + }; +} + +#endif diff --git a/ext/sgtelib/src/Surrogate_PRS_CAT.cpp b/ext/sgtelib/src/Surrogate_PRS_CAT.cpp new file mode 100644 index 0000000000000000000000000000000000000000..9cea7a1c96d68eb6e2690ab53e5bccec5fd0d01a --- /dev/null +++ b/ext/sgtelib/src/Surrogate_PRS_CAT.cpp @@ -0,0 +1,139 @@ +/*-------------------------------------------------------------------------------------*/ +/* sgtelib - A surrogate model library for derivative-free optimization */ +/* Version 2.0.1 */ +/* */ +/* Copyright (C) 2012-2017 Sebastien Le Digabel - Ecole Polytechnique, Montreal */ +/* Bastien Talgorn - McGill University, Montreal */ +/* */ +/* Author: Bastien Talgorn */ +/* email: bastientalgorn@fastmail.com */ +/* */ +/* This program is free software: you can redistribute it and/or modify it under the */ +/* terms of the GNU Lesser General Public License as published by the Free Software */ +/* Foundation, either version 3 of the License, or (at your option) any later */ +/* version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ +/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ +/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License along */ +/* with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on sgtelib at https://github.com/bastientalgorn/sgtelib */ +/*-------------------------------------------------------------------------------------*/ + +#include "Surrogate_PRS_CAT.hpp" + +/*----------------------------*/ +/* constructor */ +/*----------------------------*/ +SGTELIB::Surrogate_PRS_CAT::Surrogate_PRS_CAT ( SGTELIB::TrainingSet & trainingset, + SGTELIB::Surrogate_Parameters param) : + SGTELIB::Surrogate_PRS ( trainingset , param ){ + #ifdef SGTELIB_DEBUG + std::cout << "constructor PRS_CAT\n"; + #endif +}// + + +/*----------------------------*/ +/* destructor */ +/*----------------------------*/ +SGTELIB::Surrogate_PRS_CAT::~Surrogate_PRS_CAT ( void ) { + +}// + +/*----------------------------*/ +/* display */ +/*----------------------------*/ +void SGTELIB::Surrogate_PRS_CAT::display_private ( std::ostream & out ) const { + out << "q: " << _q << "\n"; + out << "nb_cat: " << _nb_cat << "\n"; +}// + +/*--------------------------------------*/ +/* init_private */ +/*--------------------------------------*/ +bool SGTELIB::Surrogate_PRS_CAT::init_private ( void ) { + #ifdef SGTELIB_DEBUG + std::cout << "Surrogate_PRS_CAT : init_private\n"; + #endif + // Compute the number of categories + _cat.clear(); + for ( int i = 0 ; i < _p ; ++i ){ + _cat.insert ( _trainingset.get_Xs(i,0) ); + } + _nb_cat = static_cast<int> ( _cat.size() ); + return true; +}// + +/*--------------------------------------*/ +/* build */ +/*--------------------------------------*/ +bool SGTELIB::Surrogate_PRS_CAT::build_private ( void ) { + + const int pvar = _trainingset.get_pvar(); + const int nvar = _trainingset.get_nvar(); + + // Get the number of basis functions. + int nb_monomes = Surrogate_PRS::get_nb_PRS_monomes(nvar-1,_param.get_degree()); + _q = nb_monomes*_nb_cat; + + // If _q is too big or there is not enough points, then quit + if (nb_monomes>100) return false; + if ( (_q>pvar-1) && (_param.get_ridge()==0) ) return false; + + // Compute the exponents of the basis functions (nb there is one less variable + // as the first one is the cat) + _M = SGTELIB::Matrix ("M",nb_monomes,1); + _M.fill(0.0); + _M.add_cols(get_PRS_monomes(nvar-1,_param.get_degree())); + + // DESIGN MATRIX H + _H = compute_design_matrix ( _M , get_matrix_Xs() ); + + // Compute alpha + bool ok = compute_alpha(); + return ok; +}// + + + +/*-------------------------------------------------*/ +/* Compute PRS_CAT design matrix */ +/*-------------------------------------------------*/ +const SGTELIB::Matrix SGTELIB::Surrogate_PRS_CAT::compute_design_matrix ( const SGTELIB::Matrix Monomes, + const SGTELIB::Matrix & Xs ) { + + const int p = Xs.get_nb_rows(); + SGTELIB::Matrix H("H",p,0); + SGTELIB::Matrix is_cat ("is_cat",p,1); + const SGTELIB::Matrix H_prs = SGTELIB::Surrogate_PRS::compute_design_matrix ( Monomes, Xs ); + + std::set<double>::iterator it; + double c; + for (it = _cat.begin(); it != _cat.end(); ++it){ + c = *it; + for (int i=0 ; i<p ; i++){ + is_cat.set(i,0,(double)(Xs.get(i,0)==c)); + } + H.add_cols( Matrix::diagA_product(is_cat,H_prs) ); + } + return H; +}// + + + + + + + + + + + + + + + diff --git a/ext/sgtelib/src/Surrogate_PRS_CAT.hpp b/ext/sgtelib/src/Surrogate_PRS_CAT.hpp new file mode 100644 index 0000000000000000000000000000000000000000..4be0649ca29f97572706f7aca52bac22f5cefdfb --- /dev/null +++ b/ext/sgtelib/src/Surrogate_PRS_CAT.hpp @@ -0,0 +1,61 @@ +/*-------------------------------------------------------------------------------------*/ +/* sgtelib - A surrogate model library for derivative-free optimization */ +/* Version 2.0.1 */ +/* */ +/* Copyright (C) 2012-2017 Sebastien Le Digabel - Ecole Polytechnique, Montreal */ +/* Bastien Talgorn - McGill University, Montreal */ +/* */ +/* Author: Bastien Talgorn */ +/* email: bastientalgorn@fastmail.com */ +/* */ +/* This program is free software: you can redistribute it and/or modify it under the */ +/* terms of the GNU Lesser General Public License as published by the Free Software */ +/* Foundation, either version 3 of the License, or (at your option) any later */ +/* version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ +/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ +/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License along */ +/* with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on sgtelib at https://github.com/bastientalgorn/sgtelib */ +/*-------------------------------------------------------------------------------------*/ + +#ifndef __SGTELIB_SURROGATE_PRS_CAT__ +#define __SGTELIB_SURROGATE_PRS_CAT__ + +#include "Surrogate_PRS.hpp" + +namespace SGTELIB { + + /*--------------------------------------*/ + /* Surrogate_PRS_CAT class */ + /*--------------------------------------*/ + class Surrogate_PRS_CAT : public SGTELIB::Surrogate_PRS { + + protected: + std::set<double> _cat; // Categories + int _nb_cat; // Number of categories + + virtual const SGTELIB::Matrix compute_design_matrix ( const SGTELIB::Matrix Monomes, + const SGTELIB::Matrix & Xs ); + // build model (private): + virtual bool build_private (void); + virtual bool init_private (void); + public: + + // Constructor + Surrogate_PRS_CAT ( SGTELIB::TrainingSet & trainingset , + SGTELIB::Surrogate_Parameters param) ; + + // destructor: + virtual ~Surrogate_PRS_CAT ( void ); + + virtual void display_private ( std::ostream & out ) const; + + }; +} + +#endif diff --git a/ext/sgtelib/src/Surrogate_PRS_EDGE.cpp b/ext/sgtelib/src/Surrogate_PRS_EDGE.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c9a8920e2123206c6261ce1f557e4d4a96c56254 --- /dev/null +++ b/ext/sgtelib/src/Surrogate_PRS_EDGE.cpp @@ -0,0 +1,134 @@ +/*-------------------------------------------------------------------------------------*/ +/* sgtelib - A surrogate model library for derivative-free optimization */ +/* Version 2.0.1 */ +/* */ +/* Copyright (C) 2012-2017 Sebastien Le Digabel - Ecole Polytechnique, Montreal */ +/* Bastien Talgorn - McGill University, Montreal */ +/* */ +/* Author: Bastien Talgorn */ +/* email: bastientalgorn@fastmail.com */ +/* */ +/* This program is free software: you can redistribute it and/or modify it under the */ +/* terms of the GNU Lesser General Public License as published by the Free Software */ +/* Foundation, either version 3 of the License, or (at your option) any later */ +/* version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ +/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ +/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License along */ +/* with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on sgtelib at https://github.com/bastientalgorn/sgtelib */ +/*-------------------------------------------------------------------------------------*/ + +#include "Surrogate_PRS_EDGE.hpp" + +/*----------------------------*/ +/* constructor */ +/*----------------------------*/ +SGTELIB::Surrogate_PRS_EDGE::Surrogate_PRS_EDGE ( SGTELIB::TrainingSet & trainingset, + SGTELIB::Surrogate_Parameters param) : + SGTELIB::Surrogate_PRS ( trainingset , param ){ + #ifdef SGTELIB_DEBUG + std::cout << "constructor PRS_EDGE\n"; + #endif +}// + + +/*----------------------------*/ +/* destructor */ +/*----------------------------*/ +SGTELIB::Surrogate_PRS_EDGE::~Surrogate_PRS_EDGE ( void ) { + +}// + + +/*----------------------------*/ +/* display */ +/*----------------------------*/ +void SGTELIB::Surrogate_PRS_EDGE::display_private ( std::ostream & out ) const { + out << "q: " << _q << "\n"; +}// + + +/*--------------------------------------*/ +/* build */ +/*--------------------------------------*/ +bool SGTELIB::Surrogate_PRS_EDGE::build_private ( void ) { + + const int pvar = _trainingset.get_pvar(); + const int nvar = _trainingset.get_nvar(); + + // Get the number of basis functions. + _q = Surrogate_PRS::get_nb_PRS_monomes(nvar,_param.get_degree())+nvar; + + // If _q is too big or there is not enough points, then quit + if (_q>200) return false; + if ( (_q>pvar-1) && (_param.get_ridge()==0) ) return false; + + // Compute the exponents of the basis functions + _M = get_PRS_monomes(nvar,_param.get_degree()); + + // DESIGN MATRIX H + _H = compute_design_matrix ( _M , get_matrix_Xs() ); + + return compute_alpha(); +}// + + + + + +/*-------------------------------------------------*/ +/* Compute PRS_EDGE design matrix */ +/*-------------------------------------------------*/ +const SGTELIB::Matrix SGTELIB::Surrogate_PRS_EDGE::compute_design_matrix ( const SGTELIB::Matrix Monomes, + const SGTELIB::Matrix & Xs ) { + + // Call the standard design matrix + const SGTELIB::Matrix H_prs = SGTELIB::Surrogate_PRS::compute_design_matrix ( Monomes, Xs ); + // Add the edge basis functions + const int p = Xs.get_nb_rows(); + const int n = Xs.get_nb_cols(); + const int nvar = _trainingset.get_nvar(); + + // Add the special basis function (xi==0) + // Loop on the input variables + SGTELIB::Matrix H_edge ("He",p,nvar); + int i,j,jj; + double v; + double xs0; // value that xs will have if x=0 (for a given input j) + jj=0; + for (j=0 ; j<n ; j++){ + if (_trainingset.get_X_nbdiff(j)>1){ + xs0 = _trainingset.X_scale( 0.0 , j ); + for (i=0 ; i<p ; i++){ + v = (double) (Xs.get(i,j)==xs0); + H_edge.set(i,jj,v); + } + jj++; + } + } + + SGTELIB::Matrix H(H_prs); + H.add_cols(H_edge); + return H; + +}// + + + + + + + + + + + + + + + diff --git a/ext/sgtelib/src/Surrogate_PRS_EDGE.hpp b/ext/sgtelib/src/Surrogate_PRS_EDGE.hpp new file mode 100644 index 0000000000000000000000000000000000000000..4edb18ea5dff495a0e1120c7d73d41f8ccff1d4f --- /dev/null +++ b/ext/sgtelib/src/Surrogate_PRS_EDGE.hpp @@ -0,0 +1,59 @@ +/*-------------------------------------------------------------------------------------*/ +/* sgtelib - A surrogate model library for derivative-free optimization */ +/* Version 2.0.1 */ +/* */ +/* Copyright (C) 2012-2017 Sebastien Le Digabel - Ecole Polytechnique, Montreal */ +/* Bastien Talgorn - McGill University, Montreal */ +/* */ +/* Author: Bastien Talgorn */ +/* email: bastientalgorn@fastmail.com */ +/* */ +/* This program is free software: you can redistribute it and/or modify it under the */ +/* terms of the GNU Lesser General Public License as published by the Free Software */ +/* Foundation, either version 3 of the License, or (at your option) any later */ +/* version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ +/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ +/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License along */ +/* with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on sgtelib at https://github.com/bastientalgorn/sgtelib */ +/*-------------------------------------------------------------------------------------*/ + +#ifndef __SGTELIB_SURROGATE_PRS_EDGE__ +#define __SGTELIB_SURROGATE_PRS_EDGE__ + +#include "Surrogate_PRS.hpp" + +namespace SGTELIB { + + /*--------------------------------------*/ + /* Surrogate_PRS_EDGE class */ + /*--------------------------------------*/ + class Surrogate_PRS_EDGE : public SGTELIB::Surrogate_PRS { + + protected: + + virtual const SGTELIB::Matrix compute_design_matrix ( const SGTELIB::Matrix Monomes, + const SGTELIB::Matrix & Xs ); + + // build model (private): + virtual bool build_private (void); + + public: + + // Constructor + Surrogate_PRS_EDGE ( SGTELIB::TrainingSet & trainingset , + SGTELIB::Surrogate_Parameters param) ; + // destructor: + virtual ~Surrogate_PRS_EDGE ( void ); + + virtual void display_private ( std::ostream & out ) const; + + }; +} + +#endif diff --git a/ext/sgtelib/src/Surrogate_Parameters.cpp b/ext/sgtelib/src/Surrogate_Parameters.cpp new file mode 100644 index 0000000000000000000000000000000000000000..735fc73214352d73e547dd5a22afc7a1bb69b75e --- /dev/null +++ b/ext/sgtelib/src/Surrogate_Parameters.cpp @@ -0,0 +1,1221 @@ +/*-------------------------------------------------------------------------------------*/ +/* sgtelib - A surrogate model library for derivative-free optimization */ +/* Version 2.0.1 */ +/* */ +/* Copyright (C) 2012-2017 Sebastien Le Digabel - Ecole Polytechnique, Montreal */ +/* Bastien Talgorn - McGill University, Montreal */ +/* */ +/* Author: Bastien Talgorn */ +/* email: bastientalgorn@fastmail.com */ +/* */ +/* This program is free software: you can redistribute it and/or modify it under the */ +/* terms of the GNU Lesser General Public License as published by the Free Software */ +/* Foundation, either version 3 of the License, or (at your option) any later */ +/* version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ +/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ +/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License along */ +/* with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on sgtelib at https://github.com/bastientalgorn/sgtelib */ +/*-------------------------------------------------------------------------------------*/ + +#include "Surrogate_Parameters.hpp" +using namespace SGTELIB; +/*----------------------------*/ +/* constructor */ +/*----------------------------*/ +SGTELIB::Surrogate_Parameters::Surrogate_Parameters ( const model_t mt ): + _type ( mt ){ + set_defaults(); + check(); +}// + + +/*----------------------------*/ +/* constructor */ +/*----------------------------*/ +SGTELIB::Surrogate_Parameters::Surrogate_Parameters ( const std::string & s ): + _type ( read_model_type(s) ){ + set_defaults(); + read_string(s); + check(); +}// + +/*----------------------------*/ +/* Destructor */ +/*----------------------------*/ +SGTELIB::Surrogate_Parameters::~Surrogate_Parameters ( void ) { + +}// + + + + +/*----------------------------------------*/ +/* Extract the model type from a string */ +/*----------------------------------------*/ +SGTELIB::model_t SGTELIB::Surrogate_Parameters::read_model_type ( const std::string & model_description){ + std::string s; + std::istringstream in_line (model_description); + while ( in_line >> s ){ + s = SGTELIB::toupper(s); + if (streqi(s,"TYPE")){ + in_line >> s; + s = SGTELIB::toupper(s); + return SGTELIB::str_to_model_type(s); + } + } + // If nothing was found + std::cout << "model_description: " << model_description << "\n"; + throw SGTELIB::Exception ( __FILE__ , __LINE__ , "No field \"TYPE\" found."); +}// + +/*--------------------------------------------------------------------*/ +/* Convert the param name provided by user into a standard param name */ +/*--------------------------------------------------------------------*/ +std::string SGTELIB::Surrogate_Parameters::to_standard_field_name (const std::string field){ + + if ( streqi(field,"TYPE") ) return "TYPE"; + if ( streqi(field,"TYPE_MODEL") ) return "TYPE"; + if ( streqi(field,"MODEL_TYPE") ) return "TYPE"; + + if ( streqi(field,"DEGREE") ) return "DEGREE"; + + if ( streqi(field,"WEIGHT") ) return "WEIGHT_TYPE"; + if ( streqi(field,"WEIGHT_TYPE") ) return "WEIGHT_TYPE"; + if ( streqi(field,"TYPE_WEIGHT") ) return "WEIGHT_TYPE"; + if ( streqi(field,"WEIGHT_CHOICE") ) return "WEIGHT_TYPE"; + if ( streqi(field,"CHOICE_WEIGHT") ) return "WEIGHT_TYPE"; + + if ( streqi(field,"RIDGE") ) return "RIDGE"; + if ( streqi(field,"RIDGE_COEF") ) return "RIDGE"; + if ( streqi(field,"RIDGE_PARAM") ) return "RIDGE"; + + if ( streqi(field,"KERNEL_TYPE") ) return "KERNEL_TYPE"; + if ( streqi(field,"TYPE_KERNEL") ) return "KERNEL_TYPE"; + if ( streqi(field,"KERNEL") ) return "KERNEL_TYPE"; + + if ( streqi(field,"KERNEL_COEF") ) return "KERNEL_COEF"; + if ( streqi(field,"COEF_KERNEL") ) return "KERNEL_COEF"; + if ( streqi(field,"KERNEL_SHAPE") ) return "KERNEL_COEF"; + if ( streqi(field,"COEF_SHAPE") ) return "KERNEL_COEF"; + if ( streqi(field,"SHAPE") ) return "KERNEL_COEF"; + if ( streqi(field,"SHAPE_COEF") ) return "KERNEL_COEF"; + + if ( streqi(field,"METRIC") ) return "METRIC_TYPE"; + if ( streqi(field,"METRIC_TYPE") ) return "METRIC_TYPE"; + if ( streqi(field,"TYPE_METRIC") ) return "METRIC_TYPE"; + + if ( streqi(field,"BUDGET") ) return "BUDGET"; + if ( streqi(field,"OPTIM_BUDGET") ) return "BUDGET"; + if ( streqi(field,"BUDGET_OPTIM") ) return "BUDGET"; + if ( streqi(field,"OPTIMIZATION_BUDGET") ) return "BUDGET"; + if ( streqi(field,"BUDGET_OPTIMIZATION") ) return "BUDGET"; + + if ( streqi(field,"PRESET") ) return "PRESET"; + + if ( streqi(field,"OUTPUT") ) return "OUTPUT"; + if ( streqi(field,"OUTPUT_FILE") ) return "OUTPUT"; + + if ( streqi(field,"DISTANCE") ) return "DISTANCE_TYPE"; + if ( streqi(field,"DISTANCE_TYPE") ) return "DISTANCE_TYPE"; + if ( streqi(field,"TYPE_DISTANCE") ) return "DISTANCE_TYPE"; + + + std::cout << "Field: " << field << "\n"; + throw SGTELIB::Exception ( __FILE__ , __LINE__ , "Field not recognized: \""+field+"\"" ); + return "ERROR"; +} + +/*----------------------------*/ +/* Read model definition */ +/*----------------------------*/ +void SGTELIB::Surrogate_Parameters::read_string (const std::string & model_description){ + + std::string field; + std::string content; + bool content_is_optim; + std::istringstream in_line (model_description); + #ifdef SGTELIB_DEBUG + std::cout << "Model description: " << model_description << "\n"; + #endif + while ( in_line >> field ){ + + #ifdef SGTELIB_DEBUG + std::cout << "FIELD: " << field ; + #endif + // Convert the field name into a std field name + field = to_standard_field_name(field); + #ifdef SGTELIB_DEBUG + std::cout << " (" << field << ")\n"; + #endif + // Check if this field is authorized for this type of model. + if ( ! authorized_field(field)){ + std::cout << "model_description: " << model_description << "\n"; + throw SGTELIB::Exception ( __FILE__ , __LINE__ ,"Unauthorized field \""+field+"\" in a model of type "+model_type_to_str(_type) ); + } + #ifdef SGTELIB_DEBUG + std::cout << "CONTENT: " << content << "\n"; + #endif + // Read the content + if ( ! (in_line >> content)) + throw SGTELIB::Exception ( __FILE__ , __LINE__ ,"Missing content for field \""+field+"\"" ); + + + + // Detect if the content is "OPTIM". + content_is_optim = ( streqi(content,"OPTIM") || streqi(content,"OPTIMIZATION") || streqi(content,"OPTIMIZE") ); + + // Check if optimization is allowed for this field. + if ((content_is_optim) && ( ! authorized_optim(field))) { + std::cout << "model_description: " << model_description << "\n"; + throw SGTELIB::Exception ( __FILE__ , __LINE__ ,"Field \""+field+"\" cannot be optimized." ); + } + + if (streqi(field,"TYPE")){ + if ( str_to_model_type(content) != _type ){ + std::cout << "model_description: " << model_description << "\n"; + throw SGTELIB::Exception ( __FILE__ , __LINE__ ,"Unconsistent model type!" ); + } + } + else if (streqi(field,"DEGREE")){ + if (content_is_optim) + _degree_status = SGTELIB::STATUS_OPTIM; + else{ + _degree = SGTELIB::stoi(content); + _degree_status = SGTELIB::STATUS_FIXED; + } + } + else if (streqi(field,"KERNEL_TYPE")){ + if (content_is_optim) + _kernel_type_status = SGTELIB::STATUS_OPTIM; + else{ + _kernel_type = SGTELIB::str_to_kernel_type(content); + _kernel_type_status = SGTELIB::STATUS_FIXED; + } + } + else if ( streqi(field,"KERNEL_COEF") ){ + if (content_is_optim) + _kernel_coef_status = SGTELIB::STATUS_OPTIM; + else{ + _kernel_coef = SGTELIB::stod(content); + _kernel_coef_status = SGTELIB::STATUS_FIXED; + } + } + else if (streqi(field,"RIDGE")){ + if (content_is_optim) + _ridge_status = SGTELIB::STATUS_OPTIM; + else{ + _ridge = SGTELIB::stod(content); + _ridge_status = SGTELIB::STATUS_FIXED; + } + } + else if ( streqi(field,"DISTANCE_TYPE") ){ + if (content_is_optim) + _distance_type_status = SGTELIB::STATUS_OPTIM; + else{ + _distance_type = str_to_distance_type(content); + _distance_type_status = SGTELIB::STATUS_FIXED; + } + } + else if ( streqi(field,"WEIGHT_TYPE") ){ + _weight_type = str_to_weight_type(content); + if (content_is_optim) + _weight_status = SGTELIB::STATUS_OPTIM; + } + else if ( streqi(field,"METRIC_TYPE") ){ + _metric_type = str_to_metric_type(content); + } + else if ( streqi(field,"BUDGET") ){ + _budget = SGTELIB::stoi(content); + } + else if ( streqi(field,"PRESET") ){ + _preset = content; + } + else if ( streqi(field,"OUTPUT") ){ + _output = content; + } + else{ + std::cout << "model_description: " << model_description << "\n"; + throw SGTELIB::Exception ( __FILE__ , __LINE__ , "Field not recognized: \""+field+"\"" ); + } + }// end while read +}// + + + +bool SGTELIB::Surrogate_Parameters::authorized_field ( const std::string & field ) const{ + + if (streqi(field,"TYPE")) return true; + if (streqi(field,"OUTPUT")) return true; + if (streqi(field,"METRIC_TYPE")) return true; + if (streqi(field,"BUDGET")) return true; + + switch (_type) { + case SGTELIB::LINEAR: + case SGTELIB::TGP: + case SGTELIB::SVN: + throw SGTELIB::Exception ( __FILE__ , __LINE__ , "Not implemented yetnot " ); + + case SGTELIB::CN: + if (streqi(field,"DISTANCE_TYPE")) return true; + break; + + case SGTELIB::KRIGING: + if (streqi(field,"RIDGE")) return true; + if (streqi(field,"DISTANCE_TYPE")) return true; + + case SGTELIB::PRS: + case SGTELIB::PRS_EDGE: + case SGTELIB::PRS_CAT: + if (streqi(field,"DEGREE")) return true; + if (streqi(field,"RIDGE")) return true; + break; + + case SGTELIB::KS: + if (streqi(field,"KERNEL_TYPE")) return true; + if (streqi(field,"KERNEL_COEF")) return true; + if (streqi(field,"DISTANCE_TYPE")) return true; + break; + + case SGTELIB::RBF: + if (streqi(field,"KERNEL_TYPE")) return true; + if (streqi(field,"KERNEL_COEF")) return true; + if (streqi(field,"DISTANCE_TYPE")) return true; + if (streqi(field,"RIDGE")) return true; + if (streqi(field,"PRESET")) return true; + + break; + + case SGTELIB::LOWESS: + if (streqi(field,"DEGREE")) return true; + if (streqi(field,"RIDGE")) return true; + if (streqi(field,"KERNEL_TYPE")) return true; + if (streqi(field,"KERNEL_COEF")) return true; + if (streqi(field,"PRESET")) return true; + if (streqi(field,"DISTANCE_TYPE")) return true; + break; + + case SGTELIB::ENSEMBLE: + if (streqi(field,"WEIGHT_TYPE")) return true; + if (streqi(field,"PRESET")) return true; + if (streqi(field,"DISTANCE_TYPE")) return true; + break; + + default: + throw SGTELIB::Exception ( __FILE__ , __LINE__ ,"Undefined model type" ); + break; + } + + return false; +}// + +bool SGTELIB::Surrogate_Parameters::authorized_optim ( const std::string & field ) { + + if (streqi(field,"DEGREE")) return true; + if (streqi(field,"RIDGE")) return true; + if (streqi(field,"KERNEL_TYPE")) return true; + if (streqi(field,"KERNEL_COEF")) return true; + if (streqi(field,"DISTANCE_TYPE")) return true; + if (streqi(field,"WEIGHT_TYPE")) return true; + + if (streqi(field,"TYPE")) return false; + if (streqi(field,"OUTPUT")) return false; + if (streqi(field,"METRIC_TYPE")) return false; + if (streqi(field,"PRESET")) return false; + if (streqi(field,"BUDGET")) return false; + + std::cout << "Field : " << field << "\n"; + throw SGTELIB::Exception ( __FILE__ , __LINE__ ,"Undefined field" ); + + return false; +}// + + + +/*----------------------------*/ +/* Check */ +/*----------------------------*/ +void SGTELIB::Surrogate_Parameters::check ( void ) { + switch (_type) { + case SGTELIB::LINEAR: + case SGTELIB::TGP: + case SGTELIB::SVN: + throw SGTELIB::Exception ( __FILE__ , __LINE__ ,"Not implemented yet!" ); + + + case SGTELIB::PRS: + case SGTELIB::PRS_EDGE: + case SGTELIB::PRS_CAT: + if (_degree < 0 ) + throw SGTELIB::Exception ( __FILE__ , __LINE__ ,"degree must be >= 0" ); + if (_ridge<0) + throw SGTELIB::Exception ( __FILE__ , __LINE__ ,"ridge must be >= 0" ); + break; + + case SGTELIB::KRIGING: + if (!SGTELIB::kernel_is_decreasing(_kernel_type)) + throw SGTELIB::Exception ( __FILE__ , __LINE__ ,"kernel_type must be decreasing" ); + break; + + + case SGTELIB::KS: + if (_kernel_coef <= 0) + throw SGTELIB::Exception ( __FILE__ , __LINE__ ,"kernel_coef must be > 0" ); + if (!SGTELIB::kernel_is_decreasing(_kernel_type)) + throw SGTELIB::Exception ( __FILE__ , __LINE__ ,"kernel_type must be decreasing" ); + break; + + case SGTELIB::RBF: + if (_kernel_coef <= 0) + throw SGTELIB::Exception ( __FILE__ , __LINE__ ,"kernel_coef must be > 0" ); + if (_ridge<0) + throw SGTELIB::Exception ( __FILE__ , __LINE__ ,"ridge must be >= 0" ); + if ( ( ! kernel_has_parameter(_kernel_type)) && (_kernel_type_status==SGTELIB::STATUS_FIXED) ){ + // If the kernel coef is not used in this type of kernel, then it should be fixed. + _kernel_coef = 1; + _kernel_coef_status = SGTELIB::STATUS_FIXED; + } + break; + + case SGTELIB::LOWESS: + if ( (_degree < 0) || (_degree > 2) ) + throw SGTELIB::Exception ( __FILE__ , __LINE__ ,"degree for LOWESS model must be 0, 1 or 2" ); + if (_ridge<0) + throw SGTELIB::Exception ( __FILE__ , __LINE__ ,"ridge must be >= 0" ); + if ( (_preset!="D" ) && + (_preset!="DEN") && + (_preset!="DGN") && + (_preset!="RE" ) && + (_preset!="RG" ) && + (_preset!="REN") && + (_preset!="RGN") ){ + std::cout << "LOWESS preset : " << _preset << "\n"; + std::cout << "Possible values: D, DEN, DGN, RE, RG, REN, RGN.\n"; + throw SGTELIB::Exception ( __FILE__ , __LINE__ ,"preset not recognized" ); + } + if ( ! SGTELIB::kernel_is_decreasing( _kernel_type ) ) + throw SGTELIB::Exception ( __FILE__ , __LINE__ ,"kernel_type must be decreasing" ); + break; + + case SGTELIB::ENSEMBLE: + break; + + case SGTELIB::CN: + break; + + default: + throw SGTELIB::Exception ( __FILE__ , __LINE__ ,"Undefined type" ); + } + + + + + // Count the number of parameters to optimize + _nb_parameter_optimization = 0; + if (_degree_status==SGTELIB::STATUS_OPTIM) _nb_parameter_optimization++; + if (_kernel_type_status==SGTELIB::STATUS_OPTIM) _nb_parameter_optimization++; + if (_kernel_coef_status==SGTELIB::STATUS_OPTIM) _nb_parameter_optimization++; + if (_ridge_status==SGTELIB::STATUS_OPTIM) _nb_parameter_optimization++; + if (_distance_type_status==SGTELIB::STATUS_OPTIM) _nb_parameter_optimization++; + if (_covariance_coef_status==SGTELIB::STATUS_OPTIM) _nb_parameter_optimization += _covariance_coef.get_numel(); + if (_weight_status==SGTELIB::STATUS_OPTIM) _nb_parameter_optimization += _weight.get_numel(); + +}// + +/*----------------------------*/ +/* Display */ +/*----------------------------*/ +void SGTELIB::Surrogate_Parameters::display ( std::ostream & out ) const { + + out << "Type: " << SGTELIB::model_type_to_str(_type) << std::endl; + + switch (_type) { + + case SGTELIB::SVN: + throw SGTELIB::Exception ( __FILE__ , __LINE__ , + "Not implemented yet!" ); + + case SGTELIB::CN: + out << "Distance_type: " << distance_type_to_str(_distance_type) << std::endl; + break; + + case SGTELIB::KRIGING: + out << "Covariance coefs: " << "\n"; + out << "Ridge: " << _ridge << std::endl; + _covariance_coef.display(out); + break; + + case SGTELIB::PRS: + case SGTELIB::PRS_EDGE: + case SGTELIB::PRS_CAT: + out << "Degree: " << _degree << std::endl; + out << "Ridge: " << _ridge << std::endl; + out << "Distance_type: " << distance_type_to_str(_distance_type) << std::endl; + break; + + case SGTELIB::KS: + out << "Kernel type: " << _kernel_type << std::endl; + out << "Kernel coef: " << _kernel_coef << std::endl; + out << "Distance_type: " << distance_type_to_str(_distance_type) << std::endl; + break; + + case SGTELIB::RBF: + out << "Kernel type: " << _kernel_type << std::endl; + out << "Kernel coef: " << _kernel_coef << std::endl; + out << "Distance_type: " << distance_type_to_str(_distance_type) << std::endl; + out << "ridge: " << _ridge << std::endl; + break; + + case SGTELIB::LOWESS: + out << "Kernel coef: " << _kernel_coef << std::endl; + out << "Distance_type: " << distance_type_to_str(_distance_type) << std::endl; + out << "degree: " << _degree << std::endl; + out << "ridge: " << _ridge << std::endl; + out << "Preset: " << _preset << std::endl; + break; + + case SGTELIB::ENSEMBLE: + out << "Metric type: " << metric_type_to_str(_metric_type) << std::endl; + out << "Weight type: " << weight_type_to_str(_weight_type) << std::endl; + out << "Preset: " << _preset << std::endl; + break; + + default: + throw SGTELIB::Exception ( __FILE__ , __LINE__ ,"Undefined type" ); + } +}// + +/*----------------------------*/ +/* Set defaults */ +/*----------------------------*/ +void SGTELIB::Surrogate_Parameters::set_defaults ( void ) { + + _budget = 100; + _metric_type = SGTELIB::METRIC_AOECV; + _distance_type = SGTELIB::DISTANCE_NORM2; + _distance_type_status = SGTELIB::STATUS_FIXED; + _covariance_coef_status = SGTELIB::STATUS_FIXED; + _weight_status = SGTELIB::STATUS_MODEL_DEFINED; + _ridge = 0.001; + _kernel_coef = 1; + _kernel_type = SGTELIB::KERNEL_D1; + _covariance_coef = SGTELIB::Matrix("COVARIANCE_COEF",0,0); + _weight = SGTELIB::Matrix("WEIGHT",0,0); + + + switch (_type) { + case SGTELIB::LINEAR: + case SGTELIB::TGP: + case SGTELIB::SVN: + throw SGTELIB::Exception ( __FILE__ , __LINE__ ,"Not implemented yet!" ); + + case SGTELIB::KRIGING: + _distance_type = SGTELIB::DISTANCE_NORM2; + _distance_type_status = SGTELIB::STATUS_FIXED; + _ridge = 1e-16; + _ridge_status = SGTELIB::STATUS_OPTIM; + _covariance_coef = SGTELIB::Matrix("COVARIANCE_COEF",1,2); + { + const double default_exponent = 2; + _covariance_coef.set(0,0,default_exponent); + + const double default_factor = 1; + _covariance_coef.set(0,1,default_factor); + } + _covariance_coef_status = SGTELIB::STATUS_OPTIM; + break; + + case SGTELIB::PRS: + case SGTELIB::PRS_EDGE: + case SGTELIB::PRS_CAT: + _degree = 2; + _degree_status = SGTELIB::STATUS_FIXED; + _ridge = 0.001; + _ridge_status = SGTELIB::STATUS_FIXED; + break; + + case SGTELIB::KS: + _kernel_type = SGTELIB::KERNEL_D1; + _kernel_type_status = SGTELIB::STATUS_FIXED; + _kernel_coef = 5; + _kernel_coef_status = SGTELIB::STATUS_OPTIM; + _distance_type = SGTELIB::DISTANCE_NORM2; + _distance_type_status = SGTELIB::STATUS_FIXED; + break; + + case SGTELIB::RBF: + _kernel_type = SGTELIB::KERNEL_I2; + _kernel_type_status = SGTELIB::STATUS_FIXED; + _kernel_coef = 1; + _kernel_coef_status = SGTELIB::STATUS_OPTIM; + _distance_type = SGTELIB::DISTANCE_NORM2; + _distance_type_status = SGTELIB::STATUS_FIXED; + _ridge = 0.001; + _ridge_status = SGTELIB::STATUS_FIXED; + _preset = "I"; + break; + + case SGTELIB::LOWESS: + _kernel_coef = 1.0; + _kernel_coef_status = SGTELIB::STATUS_OPTIM; + _kernel_type = SGTELIB::KERNEL_D1; + _kernel_type_status = SGTELIB::STATUS_FIXED; + _distance_type = SGTELIB::DISTANCE_NORM2; + _distance_type_status = SGTELIB::STATUS_FIXED; + _degree = 2; + _degree_status = SGTELIB::STATUS_FIXED; + _ridge = 0.001; + _ridge_status = SGTELIB::STATUS_FIXED; + _preset = "DGN"; + break; + + case SGTELIB::ENSEMBLE: + _weight_type = WEIGHT_SELECT; + _weight_status = SGTELIB::STATUS_MODEL_DEFINED; + _preset = "DEFAULT"; + break; + + case SGTELIB::CN: + break; + + default: + throw SGTELIB::Exception ( __FILE__ , __LINE__ ,"Undefined type" ); + } + + // Default output file + _output = "NULL"; + +}// + +/*----------------------------*/ +/* Display */ +/*----------------------------*/ +std::string SGTELIB::Surrogate_Parameters::get_string ( void ) const { + + std::string s = "TYPE "+model_type_to_str(_type); + + switch (_type) { + case SGTELIB::LINEAR: + case SGTELIB::TGP: + + case SGTELIB::SVN: + throw SGTELIB::Exception ( __FILE__ , __LINE__ , "Not implemented yet!" ); + + case SGTELIB::KRIGING: + s += " DISTANCE_TYPE " + distance_type_to_str(_distance_type); + break; + + case SGTELIB::CN: + s += " DISTANCE_TYPE " + distance_type_to_str(_distance_type); + break; + + case SGTELIB::PRS: + case SGTELIB::PRS_EDGE: + case SGTELIB::PRS_CAT: + s += " DEGREE " + itos(_degree); + s += " RIDGE " + dtos(_ridge); + break; + + case SGTELIB::KS: + s += " KERNEL_TYPE " + kernel_type_to_str(_kernel_type); + s += " KERNEL_SHAPE " + dtos(_kernel_coef); + s += " DISTANCE_TYPE " + distance_type_to_str(_distance_type); + break; + + case SGTELIB::RBF: + s += " PRESET " + _preset; + s += " KERNEL_TYPE " + kernel_type_to_str(_kernel_type); + s += " KERNEL_SHAPE " + dtos(_kernel_coef); + s += " DISTANCE_TYPE " + distance_type_to_str(_distance_type); + s += " RIDGE " + dtos(_ridge); + break; + + case SGTELIB::LOWESS: + s += " DEGREE " + itos(_degree); + s += " KERNEL_TYPE " + kernel_type_to_str(_kernel_type); + s += " KERNEL_SHAPE " + dtos(_kernel_coef); + s += " DISTANCE_TYPE " + distance_type_to_str(_distance_type); + s += " RIDGE " + dtos(_ridge); + break; + + case SGTELIB::ENSEMBLE: + s += " METRIC_TYPE " + metric_type_to_str(_metric_type); + s += " WEIGHT_TYPE " + weight_type_to_str(_weight_type); + s += " PRESET " + _preset; + s += " DISTANCE_TYPE " + distance_type_to_str(_distance_type); + break; + + default: + throw SGTELIB::Exception ( __FILE__ , __LINE__ ,"Undefined type" ); + } + return s; + +}// + +/*----------------------------*/ +/* Display */ +/*----------------------------*/ +std::string SGTELIB::Surrogate_Parameters::get_short_string ( void ) const { + + std::string s = model_type_to_str(_type); + + switch (_type) { + case SGTELIB::LINEAR: + case SGTELIB::TGP: + case SGTELIB::SVN: + throw SGTELIB::Exception ( __FILE__ , __LINE__ , "Not implemented yet!" ); + + case SGTELIB::KRIGING: + if (_kernel_type != SGTELIB::KERNEL_D1){ + s += " " + kernel_type_to_str(_kernel_type); + } + if (_distance_type != SGTELIB::DISTANCE_NORM2){ + s += " " + distance_type_to_str(_distance_type); + } + break; + + case SGTELIB::PRS: + case SGTELIB::PRS_EDGE: + case SGTELIB::PRS_CAT: + s += " " + itos(_degree); + if (_ridge>0) s+= " R "+dtos(_ridge); + break; + + case SGTELIB::KS: + s += " " + dtos(_kernel_coef); + if (_kernel_type != SGTELIB::KERNEL_D1){ + s += " " + kernel_type_to_str(_kernel_type); + } + if (_distance_type != SGTELIB::DISTANCE_NORM2){ + s += " " + distance_type_to_str(_distance_type); + } + break; + + case SGTELIB::CN: + if (_distance_type != SGTELIB::DISTANCE_NORM2){ + s += " " + distance_type_to_str(_distance_type); + } + break; + + case SGTELIB::RBF: + s += " " + dtos(_kernel_coef); + if (_kernel_type != SGTELIB::KERNEL_D1){ + s += " " + kernel_type_to_str(_kernel_type); + } + if (_distance_type != SGTELIB::DISTANCE_NORM2){ + s += " " + distance_type_to_str(_distance_type); + } + s += " " + dtos(_ridge); + s += " "+_preset; + break; + + + case SGTELIB::LOWESS: + s += " " + dtos(_kernel_coef); + if (_distance_type != SGTELIB::DISTANCE_NORM2){ + s += " " + distance_type_to_str(_distance_type); + } + if (_kernel_type != SGTELIB::KERNEL_D1){ + s += " " + kernel_type_to_str(_kernel_type); + } + if (_degree!=2) s += " Degree " + itos(_degree); + if (_ridge>0) s+= " R "+dtos(_ridge); + s += " "+_preset; + break; + + case SGTELIB::ENSEMBLE: + s += " " + metric_type_to_str(_metric_type) + " " + weight_type_to_str(_weight_type); + if (!streqi(_preset,"DEFAULT")) s += " "+_preset; + break; + + default: + throw SGTELIB::Exception ( __FILE__ , __LINE__ ,"Undefined type" ); + } + return s; + +}// + + + + + +/*------------------------------------*/ +/* Parameter domains and definitions */ +/*------------------------------------*/ +SGTELIB::Matrix SGTELIB::Surrogate_Parameters::get_x ( void ){ + + SGTELIB::Matrix X ("X",1,_nb_parameter_optimization); + int k=0; + if (_degree_status == SGTELIB::STATUS_OPTIM) X.set(0,k++,double(_degree)); + if (_ridge_status == SGTELIB::STATUS_OPTIM) X.set(0,k++,double(_ridge)); + if (_kernel_coef_status == SGTELIB::STATUS_OPTIM) X.set(0,k++,double(_kernel_coef)); + if (_kernel_type_status == SGTELIB::STATUS_OPTIM) X.set(0,k++,double(_kernel_type)); + if (_distance_type_status == SGTELIB::STATUS_OPTIM) X.set(0,k++,double(_distance_type)); + + if (_covariance_coef_status == SGTELIB::STATUS_OPTIM){ + for (int j=0 ; j<_covariance_coef.get_nb_cols() ; j++){ + X.set(0,k++,_covariance_coef[j]); + } + } + + if (_weight_status == SGTELIB::STATUS_OPTIM){ + for (int i=0 ; i<_weight.get_nb_rows() ; i++){ + for (int j=0 ; j<_weight.get_nb_cols() ; j++){ + X.set(0,k++,_weight.get(i,j)); + } + } + } + + if ( k != _nb_parameter_optimization){ + std::cout << "k=" << k << "\n"; + std::cout << "_nb_parameter_optimization=" << _nb_parameter_optimization << "\n"; + throw SGTELIB::Exception ( __FILE__ , __LINE__ ,"Unconcistency in the value of k." ); + } + + return X; + +}// + +/*-------------------------------------------------*/ +/* Set the parameters from an external value of x */ +/*-------------------------------------------------*/ +void SGTELIB::Surrogate_Parameters::set_x ( const SGTELIB::Matrix X ){ + + int k=0; + if (_degree_status == SGTELIB::STATUS_OPTIM) _degree = int(X.get(k++)); + if (_ridge_status == SGTELIB::STATUS_OPTIM) _ridge = double(X.get(k++)); + if (_kernel_coef_status == SGTELIB::STATUS_OPTIM) _kernel_coef = double(X.get(k++)); + if (_kernel_type_status == SGTELIB::STATUS_OPTIM) _kernel_type = SGTELIB::int_to_kernel_type(int(X.get(k++))); + if (_distance_type_status == SGTELIB::STATUS_OPTIM) _distance_type=SGTELIB::int_to_distance_type(int(X.get(k++))); + + if (_covariance_coef_status == SGTELIB::STATUS_OPTIM){ + for (int j=0 ; j<_covariance_coef.get_nb_cols() ; j++){ + _covariance_coef.set(0,j,X.get(k++)); + } + } + + if (_weight_status == SGTELIB::STATUS_OPTIM){ + // For each BBO + for (int i=0 ; i<_weight.get_nb_rows() ; i++){ + for (int j=0 ; j<_weight.get_nb_cols() ; j++){ + // For each model + _weight.set(i,j,X.get(k++)); + } + } + _weight.normalize_cols(); + } + + if ( k != _nb_parameter_optimization ){ + std::cout << "k=" << k << "\n"; + std::cout << "_nb_parameter_optimization=" << _nb_parameter_optimization << "\n"; + throw SGTELIB::Exception ( __FILE__ , __LINE__ ,"Unconcistency in the value of k." ); + } + +}// + +/*------------------------------------*/ +/* Parameter domains and definitions */ +/*------------------------------------*/ +void SGTELIB::Surrogate_Parameters::get_x_bounds ( SGTELIB::Matrix * LB , + SGTELIB::Matrix * UB , + SGTELIB::param_domain_t * domain, + bool * logscale ){ + + if ( ( ! LB) || ( ! UB) || ( ! domain) || ( ! logscale) ){ + std::cout << LB << " " << UB << " " << domain << " " << logscale << "\n"; + throw SGTELIB::Exception ( __FILE__ , __LINE__ ,"Pointers are NULL." ); + } + + + int i,j; + const int N = _nb_parameter_optimization; + for (i=0 ; i<N ; i++) logscale[i] = false; + + int k=0; + // --------- DEGREE -------------------- + if (_degree_status == SGTELIB::STATUS_OPTIM){ + LB->set(0,k,0); + if (_type==SGTELIB::LOWESS) { + UB->set(0,k,2); + domain[k] = SGTELIB::PARAM_DOMAIN_INTEGER; + } + else { + UB->set(0,k,6); + domain[k] = SGTELIB::PARAM_DOMAIN_INTEGER; + } + k++; + } + // --------- RIDGE -------------------- + if (_ridge_status == SGTELIB::STATUS_OPTIM){ + LB->set(0,k,1e-16); + UB->set(0,k,1e-1); + domain[k] = SGTELIB::PARAM_DOMAIN_CONTINUOUS; + logscale[k] = true; + k++; + } + // --------- KERNEL_COEF -------------------- + if (_kernel_coef_status == SGTELIB::STATUS_OPTIM){ + LB->set(0,k,1e-2); + UB->set(0,k,100); + domain[k] = SGTELIB::PARAM_DOMAIN_CONTINUOUS; + logscale[k] = true; + k++; + } + // --------- KERNEL_TYPE -------------------- + if (_kernel_type_status == SGTELIB::STATUS_OPTIM){ + LB->set(0,k,0); + if (_type==SGTELIB::RBF) { + UB->set(0,k,double(NB_KERNEL_TYPES-1)); + } + else{ + UB->set(0,k,double(NB_DECREASING_KERNEL_TYPES-1)); + } + domain[k] = SGTELIB::PARAM_DOMAIN_CAT; + k++; + } + // --------- DISTANCE_TYPE -------------------- + if (_distance_type_status == SGTELIB::STATUS_OPTIM){ + LB->set(0,k,0); + UB->set(0,k,double(NB_DISTANCE_TYPES-1)); + domain[k] = SGTELIB::PARAM_DOMAIN_CAT; + k++; + } + // --------- COVARIANCE COEF -------------------- + if (_covariance_coef_status == SGTELIB::STATUS_OPTIM){ + const int v = _covariance_coef.get_nb_cols()/2; + for (j=0 ; j<v ; j++){ + // Exponent parameter + LB->set(0,k,0.5); + UB->set(0,k,3.0); + domain[k] = SGTELIB::PARAM_DOMAIN_CONTINUOUS; + logscale[k] = false; + k++; + // Factor parameter + LB->set(0,k,1e-3); + UB->set(0,k,1e+0); + domain[k] = SGTELIB::PARAM_DOMAIN_CONTINUOUS; + logscale[k] = true; + k++; + } + } + // --------- WEIGHT -------------------- + if (_weight_status == SGTELIB::STATUS_OPTIM){ + for (i=0 ; i<_weight.get_nb_rows() ; i++){ + for (j=0 ; j<_weight.get_nb_cols() ; j++){ + LB->set(0,k,0); + UB->set(0,k,1); + domain[k] = SGTELIB::PARAM_DOMAIN_CONTINUOUS; + logscale[k] = false; + k++; + } + } + } + + if ( k != N){ + std::cout << "k=" << k << "\n"; + std::cout << "N=" << N << "\n"; + throw SGTELIB::Exception ( __FILE__ , __LINE__ ,"Unconcistency in the value of k." ); + } + // ----- CHECK CONSISTENCY ------- + bool error = false; + for (j=0 ; j<N ; j++){ + // Check bounds order + if (LB->get(j)>=UB->get(j)){ + error=true; + std::cout << "Variable " << j << "\n"; + std::cout << "LB (=" << LB->get(j) << ") >= UB (=" << UB->get(j) << ")\n"; + } + // Check that only continuous variables are using a log scale + if ( (logscale[j]) && (domain[j]!=SGTELIB::PARAM_DOMAIN_CONTINUOUS) ){ + error=true; + std::cout << "Variable " << j << "\n"; + std::cout << "Uses logscale and is not continuous.\n"; + } + // Check that variables with log scale have bounds of the same sign. + if (logscale[j]){ + if (LB->get(j)*UB->get(j)<=0){ + //error=true; + std::cout << "Variable " << j << "\n"; + std::cout << "LB =" << LB->get(j) << "\nUB =" << UB->get(j) << "\n"; + std::cout << "The bounds are not appropriate for logscale optimization.\n"; + } + } + + // Check fo reach domain type + switch (domain[j]){ + case SGTELIB::PARAM_DOMAIN_CONTINUOUS: + break; + case SGTELIB::PARAM_DOMAIN_INTEGER: + case SGTELIB::PARAM_DOMAIN_CAT: + if (double(round(LB->get(j)))!=LB->get(j)){ + error=true; + std::cout << "Variable " << j << " (Integer or Categorical)\n"; + std::cout << "LB (=" << LB->get(j) << ") is not an integer\n"; + } + if (double(round(UB->get(j)))!=UB->get(j)){ + error=true; + std::cout << "Variable " << j << " (Integer or Categorical)\n"; + std::cout << "UB (=" << UB->get(j) << ") is not an integer\n"; + } + break; + case SGTELIB::PARAM_DOMAIN_BOOL: + if (LB->get(j)==0){ + error=true; + std::cout << "Variable " << j << " (Boolean)\n"; + std::cout << "LB (=" << LB->get(j) << ") is not 0\n"; + } + if (UB->get(j)==1){ + error=true; + std::cout << "Variable " << j << " (Boolean)\n"; + std::cout << "UB (=" << UB->get(j) << ") is not 1\n"; + } + break; + case SGTELIB::PARAM_DOMAIN_MISC: + error=true; + std::cout << "Variable " << j << " is MISC\n"; + break; + } + } + + if (error){ + throw SGTELIB::Exception ( __FILE__ , __LINE__ ,"Error in definition of LB, UB or domain!" ); + } + +}// + +/*------------------------------------*/ +/* Check parameter X */ +/*------------------------------------*/ +bool SGTELIB::Surrogate_Parameters::check_x ( void ){ + + SGTELIB::Matrix X = get_x(); + bool error = false; + // Check dimension of X + if (X.get_nb_rows()!=1){ + error = true; + std::cout << "Number of rows is not 1\n"; + } + // Check dimension of X + const int N = _nb_parameter_optimization; + if (X.get_nb_cols()!=N){ + error = true; + std::cout << "Number of cols is not consistent with _nb_parameter_optimization\n"; + } + + // Get bound info. + SGTELIB::Matrix * LB = new SGTELIB::Matrix("LB",1,N); + SGTELIB::Matrix * UB = new SGTELIB::Matrix("UB",1,N); + param_domain_t * domain = new param_domain_t[N]; + bool * logscale = new bool[N]; + get_x_bounds ( LB , UB , domain , logscale); + + for (int j=0 ; j<_nb_parameter_optimization ; j++){ + // Check bounds + if (X[j]<LB->get(j)){ + error=true; + std::cout << "X[" << j << "] < lower bound\n"; + } + if (X[j]>UB->get(j)){ + error=true; + std::cout << "X[" << j << "] > upper bound\n"; + } + // Check types + switch (domain[j]){ + case SGTELIB::PARAM_DOMAIN_CONTINUOUS: + break; + case SGTELIB::PARAM_DOMAIN_INTEGER: + case SGTELIB::PARAM_DOMAIN_CAT: + if (double(round(X[j]))!=X[j]){ + error=true; + std::cout << "Variable " << j << " (Integer or Categorical)\n"; + std::cout << "X[" << j << "]=" << X[j] << " is not an integer\n"; + } + break; + case SGTELIB::PARAM_DOMAIN_BOOL: + if ((X[j]!=0) && (X[j]!=1)){ + error=true; + std::cout << "Variable " << j << " (Boolean)\n"; + std::cout << "X[" << j << "]=" << X[j] << " is not a boolean\n"; + } + break; + case SGTELIB::PARAM_DOMAIN_MISC: + error=true; + std::cout << "Variable " << j << " is MISC\n"; + break; + } + }// End loop on j + + // Check dimension of _covariance_coef + if (_covariance_coef.get_nb_rows()>1){ + error = true; + std::cout << "Covariance_coef should have only one row.\n"; + } + + if (error){ + throw SGTELIB::Exception ( __FILE__ , __LINE__ ,"Invalid X!" ); + } + + delete LB; + delete UB; + delete [] domain; + + return ( ! error); +}// + + + +/*------------------------------------*/ +/* Parameter domains and definitions */ +/*------------------------------------*/ +void SGTELIB::Surrogate_Parameters::display_x ( std::ostream & out ){ + out << "Parameter set {\n"; + out << " Dimension(X) " << _nb_parameter_optimization << "\n"; + if (_degree_status == SGTELIB::STATUS_OPTIM) + out << " Degree " << _degree << " "; + if (_ridge_status == SGTELIB::STATUS_OPTIM) + out << " Ridge " << _ridge << " "; + if (_kernel_coef_status == SGTELIB::STATUS_OPTIM) + out << " Kernel_coef " << _kernel_coef << " "; + if (_kernel_type_status == SGTELIB::STATUS_OPTIM) + out << " Kernel_type " << SGTELIB::kernel_type_to_str(_kernel_type) << " (" << _kernel_type << ") "; + if (_distance_type_status == SGTELIB::STATUS_OPTIM) + out << " Distance_type " << SGTELIB::distance_type_to_str(_distance_type) << " (" << _distance_type << ") "; + if (_covariance_coef_status == SGTELIB::STATUS_OPTIM){ + out << " Covariance_coef [ "; + for (int j=0 ; j<_covariance_coef.get_nb_cols() ; j++){ + out << _covariance_coef.get(0,j) << " "; + } + out << "]\n"; + } + if (_weight_status == SGTELIB::STATUS_OPTIM){ + out << " Weight [ "; + for (int i=0 ; i<_weight.get_nb_rows() ; i++){ + if (i>0) out << " "; + for (int j=0 ; j<_weight.get_nb_cols() ; j++){ + out << _weight.get(i,j) << " "; + } + if (i==_weight.get_nb_rows()) out << " ]"; + out << "\n"; + } + } + + out << "}\n"; + +}// + + +/*----------------------------------------------*/ +/* smoothness penalty for a set of parameters */ +/*----------------------------------------------*/ +double SGTELIB::Surrogate_Parameters::get_x_penalty ( void ){ + double pen = 0; + + if (_degree_status == SGTELIB::STATUS_OPTIM) pen += _degree; + if (_ridge_status == SGTELIB::STATUS_OPTIM) pen += log(_ridge); + if (_kernel_coef_status == SGTELIB::STATUS_OPTIM) pen += log(_kernel_coef); + if (_distance_type_status == SGTELIB::STATUS_OPTIM){ + switch (_distance_type){ + case DISTANCE_NORM2: + pen += 0; + break; + case DISTANCE_NORM1: + case DISTANCE_NORMINF: + pen += 1; + break; + case DISTANCE_NORM2_IS0: + case DISTANCE_NORM2_CAT: + pen += 10; + break; + } + } + if (_covariance_coef_status == SGTELIB::STATUS_OPTIM){ + int v = _covariance_coef.get_nb_cols()/2; + int ip=0; + for (int i=0 ; i<v ; i++){ + // Exponent (the larger, the smoother) + pen -= _covariance_coef.get(ip++); + // Factor (the smaller, the smoother) + pen += log( _covariance_coef.get(ip++) ); + } + } + if (_weight_status == SGTELIB::STATUS_OPTIM){ + double wij; + for (int i=0 ; i<_weight.get_nb_rows() ; i++){ + for (int j=0 ; j<_weight.get_nb_cols() ; j++){ + wij = _weight.get(i,j); + pen += wij*wij; + } + } + } + + if ( isinf(pen) ) pen=+INF; + if ( isnan(pen) ) pen=+INF; + return pen; +} + + + + + +/*-------------------------------------------------*/ +/* update the dimension of _covariance_parameter */ +/* for Kriging models */ +/*-------------------------------------------------*/ +void SGTELIB::Surrogate_Parameters::update_covariance_coef ( const int v ){ + + // Check the old dimension + const int v0 = _covariance_coef.get_nb_cols()/2; + if (v<v0) throw SGTELIB::Exception ( __FILE__ , __LINE__ ,"v < v0" ); + if (v0 == v) return; + + // Filling values + double factor_mean = 0; + double exponent_mean = 0; + + // First component is the noise. Then the exponent and factor for each dimension. + int k = 1; + for (int i=0 ; i<v0 ; i++){ + exponent_mean += _covariance_coef[k++]; + factor_mean += _covariance_coef[k++]; + } + exponent_mean /= v0; + factor_mean /= v0; + + // Create additional columns + SGTELIB::Matrix Add("Add",1,2); + Add.set(0,0,exponent_mean); + Add.set(0,1,factor_mean); + + // Add columns to _covariance_coef + for (int i=0 ; i<v-v0 ; i++) _covariance_coef.add_cols(Add); +}// + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ext/sgtelib/src/Surrogate_Parameters.hpp b/ext/sgtelib/src/Surrogate_Parameters.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a0d16ebc244e369e1345fb5470576251d1563486 --- /dev/null +++ b/ext/sgtelib/src/Surrogate_Parameters.hpp @@ -0,0 +1,150 @@ +/*-------------------------------------------------------------------------------------*/ +/* sgtelib - A surrogate model library for derivative-free optimization */ +/* Version 2.0.1 */ +/* */ +/* Copyright (C) 2012-2017 Sebastien Le Digabel - Ecole Polytechnique, Montreal */ +/* Bastien Talgorn - McGill University, Montreal */ +/* */ +/* Author: Bastien Talgorn */ +/* email: bastientalgorn@fastmail.com */ +/* */ +/* This program is free software: you can redistribute it and/or modify it under the */ +/* terms of the GNU Lesser General Public License as published by the Free Software */ +/* Foundation, either version 3 of the License, or (at your option) any later */ +/* version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ +/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ +/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License along */ +/* with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on sgtelib at https://github.com/bastientalgorn/sgtelib */ +/*-------------------------------------------------------------------------------------*/ + +#ifndef __SGTELIB_SURROGATE_PARAMETERS__ +#define __SGTELIB_SURROGATE_PARAMETERS__ + +#include "Defines.hpp" +#include "Kernel.hpp" +#include <string> + +namespace SGTELIB { + + /*--------------------------------------*/ + /* Surrogate_Parameters class */ + /*--------------------------------------*/ + class Surrogate_Parameters { + + protected: + + // Type of the model + const model_t _type; + + // Degree + int _degree; + SGTELIB::param_status_t _degree_status; + // Kernel type + kernel_t _kernel_type; + SGTELIB::param_status_t _kernel_type_status; + // Kernel coef + double _kernel_coef; + SGTELIB::param_status_t _kernel_coef_status; + // Use ridge + double _ridge; + SGTELIB::param_status_t _ridge_status; + // Distance + distance_t _distance_type; + SGTELIB::param_status_t _distance_type_status; + // Ensemble weights + SGTELIB::Matrix _weight; // Stores the weight values + weight_t _weight_type; // Indicate the method (WTA1, WTA2, WTA3, or OPTIM) + SGTELIB::param_status_t _weight_status; + // Kriging covariance coefficients + SGTELIB::Matrix _covariance_coef; + SGTELIB::param_status_t _covariance_coef_status; + // Metric used for weight calculation + metric_t _metric_type; + // Preset + std::string _preset; + // Output file + std::string _output; + // Optimization budget + int _budget; + + // Nb of parameters that are optimized + int _nb_parameter_optimization; + + public: + + // Constructors + Surrogate_Parameters ( const model_t mt); + Surrogate_Parameters ( const std::string & s); + //Surrogate_Parameters ( const SGTELIB::Surrogate_Parameters & p ); + + // Defaults + void set_defaults (void); + + // Read strings + bool authorized_field (const std::string & field) const; + static bool authorized_optim (const std::string & field); + void read_string (const std::string & model_description); + static SGTELIB::model_t read_model_type ( const std::string & model_description); + static std::string to_standard_field_name (const std::string field); + + // Check + void check (void); + + // Get + model_t get_type (void) const {return _type;}; + int get_degree (void) const {return _degree;}; + kernel_t get_kernel_type (void) const {return _kernel_type;}; + double get_kernel_coef (void) const {return _kernel_coef;}; + double get_ridge (void) const {return _ridge;}; + SGTELIB::Matrix get_weight (void) const {return _weight;}; + weight_t get_weight_type (void) const {return _weight_type;}; + metric_t get_metric_type (void) const {return _metric_type;}; + std::string get_metric_type_str (void) const {return SGTELIB::metric_type_to_str(_metric_type);}; + distance_t get_distance_type (void) const {return _distance_type;}; + std::string get_preset (void) const {return _preset;}; + std::string get_output (void) const {return _output;}; + SGTELIB::Matrix get_covariance_coef (void) const {return _covariance_coef;}; + int get_budget (void) const {return _budget;}; + // Get the distance type (return OPTIM if the distance type has to be optimized). + std::string get_distance_type_str (void) const { + if (_distance_type_status==SGTELIB::STATUS_OPTIM) return "OPTIM"; + else return SGTELIB::distance_type_to_str(_distance_type); + }; + + + // Set + void set_kernel_coef ( const double v ) { _kernel_coef = v; }; + void set_weight_type ( const weight_t wt ) { _weight_type = wt; }; + void set_weight ( const SGTELIB::Matrix W ) { _weight = W; }; + void update_covariance_coef ( const int nvar ); + //void set_distance_type ( distance_t dt ) { _distance_type = dt; }; + //void set_degree ( int d ) { _degree = d; }; + + // destructor: + virtual ~Surrogate_Parameters ( void ); + std::string get_string(void) const; + std::string get_short_string(void) const; + void display ( std::ostream & out ) const; + + // Information and optimization + SGTELIB::Matrix get_x ( void ); + double get_x_penalty ( void ); + bool check_x ( void ); + void display_x ( std::ostream & out ); + void set_x ( const SGTELIB::Matrix X ); + void get_x_bounds ( SGTELIB::Matrix * LB , + SGTELIB::Matrix * UB , + SGTELIB::param_domain_t * domain, + bool * logscale ); + int get_nb_parameter_optimization (void) { return _nb_parameter_optimization; }; + + }; +} + +#endif diff --git a/ext/sgtelib/src/Surrogate_RBF.cpp b/ext/sgtelib/src/Surrogate_RBF.cpp new file mode 100644 index 0000000000000000000000000000000000000000..16e7b3fcb97fa9993f61eec9cffe9ee8959345e6 --- /dev/null +++ b/ext/sgtelib/src/Surrogate_RBF.cpp @@ -0,0 +1,303 @@ +/*-------------------------------------------------------------------------------------*/ +/* sgtelib - A surrogate model library for derivative-free optimization */ +/* Version 2.0.1 */ +/* */ +/* Copyright (C) 2012-2017 Sebastien Le Digabel - Ecole Polytechnique, Montreal */ +/* Bastien Talgorn - McGill University, Montreal */ +/* */ +/* Author: Bastien Talgorn */ +/* email: bastientalgorn@fastmail.com */ +/* */ +/* This program is free software: you can redistribute it and/or modify it under the */ +/* terms of the GNU Lesser General Public License as published by the Free Software */ +/* Foundation, either version 3 of the License, or (at your option) any later */ +/* version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ +/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ +/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License along */ +/* with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on sgtelib at https://github.com/bastientalgorn/sgtelib */ +/*-------------------------------------------------------------------------------------*/ + +#include "Surrogate_RBF.hpp" + + +/*----------------------------*/ +/* constructor */ +/*----------------------------*/ +SGTELIB::Surrogate_RBF::Surrogate_RBF ( SGTELIB::TrainingSet & trainingset, + SGTELIB::Surrogate_Parameters param) : + SGTELIB::Surrogate ( trainingset , param ), + _q ( -1 ), + _qrbf ( -1 ), + _qprs ( -1 ), + _H ( "H",0,0 ), + _HtH ( "HtH",0,0 ), + _HtZ ( "HtZ",0,0 ), + _Ai ( "Ai",0,0 ), + _Alpha ( "alpha",0,0 ), + _selected_kernel (1,-1 ){ + #ifdef SGTELIB_DEBUG + std::cout << "constructor RBF\n"; + #endif +}// + +/*----------------------------*/ +/* destructor */ +/*----------------------------*/ +SGTELIB::Surrogate_RBF::~Surrogate_RBF ( void ) { + +}// + + +/*----------------------------*/ +/* display */ +/*----------------------------*/ +void SGTELIB::Surrogate_RBF::display_private ( std::ostream & out ) const { + out << "_q: " << _q << "\n"; + out << "_qrbf: " << _qrbf << "\n"; + out << "_qprs: " << _qprs << "\n"; + out << "_kernel_coef: " << _param.get_kernel_coef() << "\n"; + out << "_ridge: " << _param.get_ridge() << "\n"; +}// + + +/*--------------------------------------*/ +/* init_private */ +/*--------------------------------------*/ +bool SGTELIB::Surrogate_RBF::init_private ( void ) { + + #ifdef SGTELIB_DEBUG + std::cout << "Surrogate_RBF : init_private\n"; + #endif + + const int pvar = _trainingset.get_pvar(); + if (pvar<3) return false; + + // Check preset + const std::string preset = _param.get_preset(); + const bool modeO = string_find(preset,"O") || string_find(preset,"0"); + const bool modeR = string_find(preset,"R"); + const bool modeI = string_find(preset,"I"); + if (modeO+modeR+modeI!=1){ + throw SGTELIB::Exception ( __FILE__ , __LINE__ , + "RBF preset must contain either \"O\", \"R\" or \"I\", exclusively." ); + } + + if (modeI){ + // Select Incomplete basis + const int nvar = _trainingset.get_nvar(); + _qrbf = std::min(pvar/2,100*nvar); + if (_qrbf<3) return false; + _selected_kernel.clear(); + _selected_kernel = _trainingset.select_greedy( get_matrix_Xs(), + _trainingset.get_i_min(), + _qrbf, + 1.0, + _param.get_distance_type()); + } + else{ + _qrbf = _p; + } + + // Number of PRS basis functions + if (modeO){ + const int dmin = SGTELIB::kernel_dmin(_param.get_kernel_type()); + if (dmin==-1) _qprs = 0; + else if (dmin==0 ) _qprs = 1; + else if (dmin==1 ) _qprs = 1 + _trainingset.get_nvar(); + else{ + std::cout << "dmin = " << dmin << "\n"; + throw SGTELIB::Exception ( __FILE__ , __LINE__ ,"dmin out of range." ); + } + } + else{ + // For modes R and I, use n+1 prs basis functions. + _qprs = 1 + _trainingset.get_nvar(); + } + + // Total number of basis function + _q = _qrbf + _qprs; + + if ( (modeO) & (_q>pvar) ) return false; + + return true; +}// + + +/*--------------------------------------*/ +/* build */ +/*--------------------------------------*/ +bool SGTELIB::Surrogate_RBF::build_private ( void ) { + + // The build primarily consists of computing alpha + + // Compute scaling distance for each training point + const SGTELIB::Matrix & Zs = get_matrix_Zs(); + + if ( string_find(_param.get_preset(),"O") || string_find(_param.get_preset(),"0") ){ + // ========================================= + // Solve with orthogonality constraints + // ========================================= + // Build design matrix with constraints lines + _H = compute_design_matrix(get_matrix_Xs(),true); + // Inverte matrix + _Ai = _H.lu_inverse(); + // Product (only the p first rows of Ai) + _Alpha = SGTELIB::Matrix::subset_product(_Ai,Zs,-1,_p,-1); + } + else{ + // ========================================= + // Solve with ridge coefficient + // ========================================= + + // Build design matrix WITHOUT constraints lines + _H = compute_design_matrix(get_matrix_Xs(),false); + _HtH = SGTELIB::Matrix::transposeA_product(_H,_H); + _HtZ = SGTELIB::Matrix::transposeA_product(_H,get_matrix_Zs()); + SGTELIB::Matrix A = _HtH; + + const double r = _param.get_ridge(); + + // Add regularization term + if ( string_find(_param.get_preset(),"1") ){ + // Add ridge to all basis function + for (int i=0 ; i<_q ; i++) A.add(i,i,r); + } + else if ( string_find(_param.get_preset(),"2") ){ + // Add ridge to all basis function except constant + for (int i=0 ; i<_q-1 ; i++) A.add(i,i,r); + } + else if ( string_find(_param.get_preset(),"3") ){ + // Add ridge to all radial basis function + for (int i=0 ; i<_qrbf ; i++) A.add(i,i,r); + } + else { + // Add ridge to all radial basis function (Same as R3) + for (int i=0 ; i<_qrbf ; i++) A.add(i,i,r); + } + _Ai = A.cholesky_inverse(); + _Alpha = _Ai*_HtZ; + } + + // Check for Nan + if (_Alpha.has_nan()){ + return false; + } + + _ready = true; + return true; + +}// + + + + + +/*--------------------------------------*/ +/* Compute Design matrix */ +/*--------------------------------------*/ +const SGTELIB::Matrix SGTELIB::Surrogate_RBF::compute_design_matrix ( const SGTELIB::Matrix & XXs , const bool constraints ) { + + // Xs can be, either the training set, to build the model, or prediction points. + // To build the model, we need the orthogonality constraints, so the 2nd arg is going to be true. + // For prediction, constraints = false. + + const int pxx = XXs.get_nb_rows(); + + // Get the distance from each input point XXs to each kernel + SGTELIB::Matrix H = _trainingset.get_distances(XXs,get_matrix_Xs().get_rows(_selected_kernel),_param.get_distance_type()); + // Apply kernel values + /* + for ( int i=0 ; i<_qrbf ; i++ ){ + H.set_col(kernel(_param.get_kernel_type(),_kernel_coef,H.get_col(i)),i); + } + */ + H = kernel(_param.get_kernel_type(),_param.get_kernel_coef(),H); + + // If there are some PRS basis functions + if (_qprs>0){ + + // Build the matrix that contains linear terms and the constant + SGTELIB::Matrix L ("L",pxx,_qprs); + int k = 0; + + // First columns are the linear terms + if (_qprs>1){ + for ( int j=0 ; j<_n ; j++){ + if (_trainingset.get_X_nbdiff(j)>1){ + L.set_col ( XXs.get_col(j) , k++ ); + } + } + } + + // Last column is the constant term + L.set_col( 1.0 , k ); + + // Concatenate with the RBF terms + H.add_cols(L); + + if (constraints){ + // The constraints are the transpose of L + L = L.transpose(); + // And we add some zeros for the right bottom part of the matrix + L.add_cols(_qprs); + // We add this to the design matrix + H.add_rows(L); + } + + } + + return H; +}// + + + + +/*--------------------------------------*/ +/* predict (ZZs only) */ +/*--------------------------------------*/ +void SGTELIB::Surrogate_RBF::predict_private ( const SGTELIB::Matrix & XXs, + SGTELIB::Matrix * ZZs) { + check_ready(__FILE__,__FUNCTION__,__LINE__); + *ZZs = compute_design_matrix(XXs,false) * _Alpha; +}// + +/*--------------------------------------*/ +/* get matrix Zvs */ +/*--------------------------------------*/ +const SGTELIB::Matrix * SGTELIB::Surrogate_RBF::get_matrix_Zvs (void){ + check_ready(__FILE__,__FUNCTION__,__LINE__); + if ( ! _Zvs){ + + // Init _Zvs + _Zvs = new SGTELIB::Matrix; + const SGTELIB::Matrix & Zs = get_matrix_Zs(); + + if ( string_find(_param.get_preset(),"O") ){ + //============================================ + // ORTHOGONALITY CONSTRAINTS + //============================================ + SGTELIB::Matrix dAiAlpha = SGTELIB::Matrix::diagA_product(_Ai.diag_inverse(),_Alpha); + dAiAlpha.remove_rows(_qprs); + *_Zvs = Zs-dAiAlpha; + } + else{ + //SGTELIB::Matrix dPiPZs = SGTELIB::Matrix::get_matrix_dPiPZs(_Ai,_H,Zs); + SGTELIB::Matrix dPiPZs = SGTELIB::Matrix::get_matrix_dPiPZs(_Ai,_H,Zs,_Alpha); + + // dPi is the inverse of the diag of P + // Compute _Zv = Zs - dPi*P*Zs + *_Zvs = Zs - dPiPZs; + } + + _Zvs->replace_nan(+INF); + _Zvs->set_name("Zvs"); + + } + return _Zvs; +}// diff --git a/ext/sgtelib/src/Surrogate_RBF.hpp b/ext/sgtelib/src/Surrogate_RBF.hpp new file mode 100644 index 0000000000000000000000000000000000000000..5eb87167c19a9fc0405f6e6394bfee9428af82e8 --- /dev/null +++ b/ext/sgtelib/src/Surrogate_RBF.hpp @@ -0,0 +1,107 @@ +/*-------------------------------------------------------------------------------------*/ +/* sgtelib - A surrogate model library for derivative-free optimization */ +/* Version 2.0.1 */ +/* */ +/* Copyright (C) 2012-2017 Sebastien Le Digabel - Ecole Polytechnique, Montreal */ +/* Bastien Talgorn - McGill University, Montreal */ +/* */ +/* Author: Bastien Talgorn */ +/* email: bastientalgorn@fastmail.com */ +/* */ +/* This program is free software: you can redistribute it and/or modify it under the */ +/* terms of the GNU Lesser General Public License as published by the Free Software */ +/* Foundation, either version 3 of the License, or (at your option) any later */ +/* version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ +/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ +/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License along */ +/* with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on sgtelib at https://github.com/bastientalgorn/sgtelib */ +/*-------------------------------------------------------------------------------------*/ + +#ifndef __SGTELIB_SURROGATE_RBF__ +#define __SGTELIB_SURROGATE_RBF__ + +#include "Surrogate.hpp" + +namespace SGTELIB { + + /*--------------------------------------*/ + /* Surrogate_RBF class */ + /*--------------------------------------*/ + class Surrogate_RBF : public SGTELIB::Surrogate { + + /*--------------------------------------------------------*/ + /* these members are defined in the Surrogate superclass */ + /*--------------------------------------------------------*/ + // int _p; // number of data points in X and Z + // int _n; // dimension -- number of variables + // int _m; // number of outputs (includes the objective) + + private: + + /*--------------------------------------*/ + /* Attributes */ + /*--------------------------------------*/ + int _q; // Nb of basis function + int _qrbf; // Nb of RBF basis function + int _qprs; // Nb of PRS basis function + SGTELIB::Matrix _H; // Design matrix + SGTELIB::Matrix _HtH; // H'*H + SGTELIB::Matrix _HtZ; // H'*Z + SGTELIB::Matrix _Ai; // inverse of H or Ht*H+r*J + SGTELIB::Matrix _Alpha; // Coefficients + + std::list<int> _selected_kernel; + + + /*--------------------------------------*/ + /* Building methods */ + /*--------------------------------------*/ + const SGTELIB::Matrix compute_design_matrix ( const SGTELIB::Matrix & XXs , const bool constraints ); + + /*--------------------------------------*/ + /* Build model */ + /*--------------------------------------*/ + bool select_kernels ( void ); + virtual bool build_private (void); + virtual bool init_private (void); + //SGTELIB::Matrix get_bumpiness (void); + + /*--------------------------------------*/ + /* predict */ + /*--------------------------------------*/ + virtual void predict_private ( const SGTELIB::Matrix & XXs, + SGTELIB::Matrix * ZZs); + + /*--------------------------------------*/ + /* Compute matrices */ + /*--------------------------------------*/ + virtual const SGTELIB::Matrix * get_matrix_Zvs (void); + + public: + + /*--------------------------------------*/ + /* Constructor */ + /*--------------------------------------*/ + Surrogate_RBF ( SGTELIB::TrainingSet & trainingset , + SGTELIB::Surrogate_Parameters param) ; + + /*--------------------------------------*/ + /* Destructor */ + /*--------------------------------------*/ + virtual ~Surrogate_RBF ( void ); + + /*--------------------------------------*/ + /* Misc */ + /*--------------------------------------*/ + virtual void display_private ( std::ostream & out ) const; + + }; +} + +#endif diff --git a/ext/sgtelib/src/Surrogate_Utils.cpp b/ext/sgtelib/src/Surrogate_Utils.cpp new file mode 100644 index 0000000000000000000000000000000000000000..01d4b1b57c44c5c7700c27b7b3a52926613dd3e6 --- /dev/null +++ b/ext/sgtelib/src/Surrogate_Utils.cpp @@ -0,0 +1,735 @@ +/*-------------------------------------------------------------------------------------*/ +/* sgtelib - A surrogate model library for derivative-free optimization */ +/* Version 2.0.1 */ +/* */ +/* Copyright (C) 2012-2017 Sebastien Le Digabel - Ecole Polytechnique, Montreal */ +/* Bastien Talgorn - McGill University, Montreal */ +/* */ +/* Author: Bastien Talgorn */ +/* email: bastientalgorn@fastmail.com */ +/* */ +/* This program is free software: you can redistribute it and/or modify it under the */ +/* terms of the GNU Lesser General Public License as published by the Free Software */ +/* Foundation, either version 3 of the License, or (at your option) any later */ +/* version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ +/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ +/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License along */ +/* with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on sgtelib at https://github.com/bastientalgorn/sgtelib */ +/*-------------------------------------------------------------------------------------*/ + +#include "Surrogate_Utils.hpp" + +/*-------------------------------*/ +/* string comparison */ +/*-------------------------------*/ +bool SGTELIB::streq ( const std::string & s1 , const std::string & s2 ){ + return !std::strcmp(s1.c_str(),s2.c_str()); +}// + +bool SGTELIB::streqi ( const std::string & s1 , const std::string & s2 ){ + const std::string s1u = SGTELIB::toupper(s1); + const std::string s2u = SGTELIB::toupper(s2); + return !std::strcmp(SGTELIB::toupper(s1).c_str(),s2u.c_str()); +}// + +// Check if s is in S. +bool SGTELIB::string_find ( const std::string & S , const std::string & s ){ + const std::string Su = SGTELIB::toupper(S); + const std::string su = SGTELIB::toupper(s); + return ( Su.find(su) < Su.size() ); +}// +/* +bool SGTELIB::issubstring (const std::string S , const std::string s){ + return result = (S.find(s) != std::string::npos); +} +*/ + +/*-------------------------------*/ +/* deblank */ +/*-------------------------------*/ +std::string SGTELIB::deblank ( const std::string & s_input ){ + std::string s = s_input; + // Remove leading spaces + while ( (s.length()) && (s.at(0)==' ') ){ + s.erase(0,1); + } + // Remove trailing spaces + size_t i = s.length(); + while ( (i>0) && (s.at(i-1)==' ') ) { + s.erase(i-1,1); + i--; + } + // Remove double spaces + i=1; + while (i+2<s.length()){ + if ( (s.at(i)==' ') && (s.at(i+1)==' ') ){ + s.erase(i,1); + } + else{ + i++; + } + } + return s; +}// + + + + +/*-------------------------------*/ +/* test if a file is existing */ +/*-------------------------------*/ +bool SGTELIB::exists (const std::string & file) { + struct stat buffer; + return (stat (file.c_str(), &buffer) == 0); +}// + + +/*-------------------------------*/ +/* count_words */ +/*-------------------------------*/ +int SGTELIB::count_words( const std::string & s ) { + int word_count( 0 ); + std::stringstream ss( s ); + std::string word; + while( ss >> word ) ++word_count; + return word_count; +}// + + +/*-------------------------------*/ +/* add string on a new line of */ +/* an existing files */ +/*-------------------------------*/ +void SGTELIB::append_file (const std::string & s , const std::string & file){ + std::string dummy_str; + std::string cmd; + if ( ! SGTELIB::exists(file)){ + cmd = "touch "+ file; + dummy_str = system( cmd.c_str() ); + } + cmd = "echo "+s+" >> "+file; + //std::cout << "cmd : " << cmd << "\n"; + dummy_str = system( cmd.c_str() ); +}// + + +/*-------------------------------*/ +/* wait */ +/*-------------------------------*/ +void SGTELIB::wait (double t) { + // t is a number of seconds +#ifdef _MSC_VER +// Sleep(t*1000000.0); +#else + usleep(t*1000000.0); +#endif +}// + + + +/*-------------------------------*/ +/* isdef (not nan nor inf) */ +/*-------------------------------*/ +bool SGTELIB::isdef ( const double x ) { + if ( isnan(x) ) return false; + if ( isinf(x) ) return false; + if ( fabs(x)>=SGTELIB::INF) return false; + if ( fabs(x)>=1e+16){ + return false; + } + return true; +} + + + +/*-------------------------------*/ +/* distance between two points */ +/*-------------------------------*/ +double SGTELIB::dist ( const double * x , const double * y , int n ) { + double s = 0.0; + double d = 0; + for ( int i = 0 ; i < n ; ++i ) + d = x[i]-y[i]; + s += d*d; + return sqrt(s); +} + +/*------------------*/ +/* relative error */ +/*------------------*/ +double SGTELIB::rel_err ( double x , double y ) { + if ( x*y < 0.0 ) + return 1.0; + if ( x*y == 0.0 ) + return fabs(x-y); + double max = fabs(x); + if ( fabs(y) > max ) + max = fabs(y); + return ( fabs ( x-y ) / max ); +} + +/*---------------------------------*/ +int SGTELIB::round ( double d ) { +/*---------------------------------*/ + return static_cast<int>(d < 0.0 ? -floor(.5-d) : floor(.5+d)); +} + +/*------------------------------------------*/ +std::string SGTELIB::itos ( int i ) { +/*------------------------------------------*/ + std::ostringstream oss; + oss << i; + return oss.str(); +}// + +/*------------------------------------------*/ +std::string SGTELIB::dtos (double d ) { +/*------------------------------------------*/ + std::ostringstream oss; + oss << d; + return oss.str(); +}// + +/*------------------------------------------*/ +std::string SGTELIB::btos (bool b ) { +/*------------------------------------------*/ + if (b) return "True"; + else return "False"; +}// + +/*------------------------------------------*/ +double SGTELIB::stod ( const std::string & s ){ +/*------------------------------------------*/ + double d = atof(s.c_str()); + return d; +}// + +/*------------------------------------------*/ +int SGTELIB::stoi ( const std::string & s ){ +/*------------------------------------------*/ + int d = atoi(s.c_str()); + return d; +}// + +/*----------------------------------------------------------*/ +bool SGTELIB::stob ( const std::string & s ) { +/*----------------------------------------------------------*/ + std::string ss = toupper(s); + if ( ss=="TRUE" ) return true; + if ( ss=="FALSE") return false; + if ( ss=="YES" ) return true; + if ( ss=="NO" ) return false; + if ( ss=="1" ) return true; + if ( ss=="0" ) return false; + throw SGTELIB::Exception ( __FILE__ , __LINE__ ,"Unrecognised string \""+s+"\" ( "+ss+" )" ); +}// + +/*------------------------------------------*/ +bool SGTELIB::isdigit ( const std::string & s ){ +/*------------------------------------------*/ + std::string::const_iterator it = s.begin(); + char c; + while (it != s.end()){ + c = *it; + if ( ! ( ( isdigit(std::string(1,c))) || (c=='+') || (c=='-') || (c=='.') ) ){ + return false; + } + it++; + } + return true; +}// + + + + +/*-----------------------------------------------------------------*/ +/* NOMAD::toupper - 1/2 */ +/*-----------------------------------------------------------------*/ +std::string SGTELIB::toupper ( const std::string & s ) +{ + std::string s2(s); + size_t ns = s2.size(); + for ( size_t i = 0 ; i < ns ; ++i ) + s2[i] = std::toupper(s2[i]); + return s2; +}// + + +/*----------------------------------------------------------*/ +std::string SGTELIB::model_output_to_str ( const SGTELIB::model_output_t ot ) { +/*----------------------------------------------------------*/ + switch ( ot ) { + case SGTELIB::NORMAL_OUTPUT: return "normal"; + case SGTELIB::FIXED_OUTPUT : return "fixed"; + case SGTELIB::BINARY_OUTPUT: return "binary"; + default: + throw SGTELIB::Exception ( __FILE__ , __LINE__ ,"Undefined type" ); + } +}// + +/*----------------------------------------------------------*/ +std::string SGTELIB::model_type_to_str ( const SGTELIB::model_t t ) { +/*----------------------------------------------------------*/ + switch ( t ) { + case SGTELIB::LINEAR : return "LINEAR"; + case SGTELIB::TGP : return "TGP"; + case SGTELIB::DYNATREE : return "DYNATREE"; + case SGTELIB::KS : return "KS"; + case SGTELIB::CN : return "CN"; + case SGTELIB::PRS : return "PRS"; + case SGTELIB::PRS_EDGE : return "PRS_EDGE"; + case SGTELIB::PRS_CAT : return "PRS_CAT"; + case SGTELIB::RBF : return "RBF"; + case SGTELIB::KRIGING : return "KRIGING"; + case SGTELIB::SVN : return "SVN"; + case SGTELIB::LOWESS : return "LOWESS"; + case SGTELIB::ENSEMBLE : return "ENSEMBLE"; + default: + throw SGTELIB::Exception ( __FILE__ , __LINE__ ,"Undefined type" ); + } +}// + +/*----------------------------------------------------------*/ +std::string SGTELIB::distance_type_to_str ( const SGTELIB::distance_t t ) { +/*----------------------------------------------------------*/ + switch ( t ) { + case SGTELIB::DISTANCE_NORM2 : return "NORM2"; + case SGTELIB::DISTANCE_NORM1 : return "NORM1"; + case SGTELIB::DISTANCE_NORMINF : return "NORMINF"; + case SGTELIB::DISTANCE_NORM2_IS0 : return "NORM2_IS0"; + case SGTELIB::DISTANCE_NORM2_CAT : return "NORM2_CAT"; + default: + throw SGTELIB::Exception ( __FILE__ , __LINE__ ,"Undefined type" ); + } +}// + + +/*----------------------------------------------------------*/ +std::string SGTELIB::weight_type_to_str ( const SGTELIB::weight_t cb ) { +/*----------------------------------------------------------*/ + switch (cb){ + case SGTELIB::WEIGHT_SELECT : return "SELECT"; + case SGTELIB::WEIGHT_OPTIM : return "OPTIM" ; + case SGTELIB::WEIGHT_WTA1 : return "WTA1" ; + case SGTELIB::WEIGHT_WTA3 : return "WTA3" ; + case SGTELIB::WEIGHT_EXTERN : return "EXTERN"; + default : + throw SGTELIB::Exception ( __FILE__ , __LINE__ ,"Undefined type" ); + } +}// + +/*----------------------------------------------------------*/ +std::string SGTELIB::metric_type_to_str ( const SGTELIB::metric_t mt ) { +/*----------------------------------------------------------*/ + switch (mt){ + case SGTELIB::METRIC_EMAX : return "EMAX" ; + case SGTELIB::METRIC_EMAXCV : return "EMAXCV" ; + case SGTELIB::METRIC_RMSE : return "RMSE" ; + case SGTELIB::METRIC_RMSECV : return "RMSECV" ; + case SGTELIB::METRIC_ARMSE : return "ARMSE" ; + case SGTELIB::METRIC_ARMSECV: return "ARMSECV"; + case SGTELIB::METRIC_OE : return "OE" ; + case SGTELIB::METRIC_OECV : return "OECV" ; + case SGTELIB::METRIC_AOE : return "AOE" ; + case SGTELIB::METRIC_AOECV : return "AOECV" ; + case SGTELIB::METRIC_EFIOE : return "EFIOE" ; + case SGTELIB::METRIC_EFIOECV: return "EFIOECV" ; + case SGTELIB::METRIC_LINV : return "LINV" ; + default: + throw SGTELIB::Exception ( __FILE__ , __LINE__ ,"Undefined metric" ); + } +}// + + +/*----------------------------------------------------------*/ +bool SGTELIB::metric_multiple_obj ( const SGTELIB::metric_t mt ) { +/*----------------------------------------------------------*/ + switch (mt){ + case SGTELIB::METRIC_EMAX : + case SGTELIB::METRIC_EMAXCV : + case SGTELIB::METRIC_RMSE : + case SGTELIB::METRIC_RMSECV : + case SGTELIB::METRIC_OE : + case SGTELIB::METRIC_OECV : + case SGTELIB::METRIC_LINV : + return true; + case SGTELIB::METRIC_ARMSE : + case SGTELIB::METRIC_ARMSECV: + case SGTELIB::METRIC_AOE : + case SGTELIB::METRIC_AOECV : + case SGTELIB::METRIC_EFIOE : + case SGTELIB::METRIC_EFIOECV : + return false; + default: + throw SGTELIB::Exception ( __FILE__ , __LINE__ ,"Undefined metric" ); + } +}// + +/*----------------------------------------------------------*/ +SGTELIB::metric_t SGTELIB::metric_convert_single_obj ( const SGTELIB::metric_t mt ) { +/*----------------------------------------------------------*/ + switch (mt){ + // Metric that do not have a "Single obj" equivalent + case SGTELIB::METRIC_EMAX : + case SGTELIB::METRIC_EMAXCV : + case SGTELIB::METRIC_LINV : + std::cout << "The metric " << SGTELIB::metric_type_to_str(mt) << "is not supported for this type of model\n"; + std::cout << "AOECV metric will be used.\n"; + return SGTELIB::METRIC_AOECV; + // Metric that have a "single obj" equivalent + case SGTELIB::METRIC_RMSE : + return SGTELIB::METRIC_ARMSE; + case SGTELIB::METRIC_RMSECV : + return SGTELIB::METRIC_ARMSECV; + case SGTELIB::METRIC_OE : + return SGTELIB::METRIC_AOE; + case SGTELIB::METRIC_OECV : + return SGTELIB::METRIC_AOECV; + // Metric that are "single obj" + case SGTELIB::METRIC_ARMSE : + case SGTELIB::METRIC_ARMSECV: + case SGTELIB::METRIC_AOE : + case SGTELIB::METRIC_AOECV : + case SGTELIB::METRIC_EFIOE : + case SGTELIB::METRIC_EFIOECV : + return mt; + default: + throw SGTELIB::Exception ( __FILE__ , __LINE__ ,"Undefined metric" ); + } +}// + + + +/*----------------------------------------------------------*/ +std::string SGTELIB::bbo_type_to_str ( SGTELIB::bbo_t bbot ) { +/*----------------------------------------------------------*/ + switch ( bbot ) { + case SGTELIB::BBO_OBJ: return "OBJ"; + case SGTELIB::BBO_CON: return "CON"; + case SGTELIB::BBO_DUM: return "DUM"; + default: + throw SGTELIB::Exception ( __FILE__ , __LINE__ ,"Undefined type" ); + } +}// + +/*----------------------------------------------------------*/ +SGTELIB::model_t SGTELIB::str_to_model_type ( const std::string & s ) { +/*----------------------------------------------------------*/ + std::string ss = SGTELIB::toupper(s); + if ( ss=="LINEAR" ){ return SGTELIB::LINEAR; } + if ( ss=="TGP" ){ return SGTELIB::TGP; } + if ( ss=="DYNATREE" ){ return SGTELIB::DYNATREE; } + if ( ss=="KS" ){ return SGTELIB::KS; } + if ( ss=="CN" ){ return SGTELIB::CN; } + if ( ss=="PRS" ){ return SGTELIB::PRS; } + if ( ss=="PRS_EDGE" ){ return SGTELIB::PRS_EDGE; } + if ( ss=="PRS_CAT" ){ return SGTELIB::PRS_CAT; } + if ( ss=="RBF" ){ return SGTELIB::RBF; } + if ( ss=="KRIGING" ){ return SGTELIB::KRIGING; } + if ( ss=="SVN" ){ return SGTELIB::SVN; } + if ( ss=="LWR" ){ return SGTELIB::LOWESS; } + if ( ss=="LOWESS" ){ return SGTELIB::LOWESS; } + if ( ss=="ENSEMBLE" ){ return SGTELIB::ENSEMBLE; } + throw SGTELIB::Exception ( __FILE__ , __LINE__ ,"Unrecognised string \""+s+"\" ( "+ss+" )" ); +}// + +/*----------------------------------------------------------*/ +SGTELIB::weight_t SGTELIB::str_to_weight_type ( const std::string & s ) { +/*----------------------------------------------------------*/ + std::string ss = SGTELIB::toupper(s); + if ( ss=="SELECT" ){ return SGTELIB::WEIGHT_SELECT;} + if ( ss=="OPTIM" ){ return SGTELIB::WEIGHT_OPTIM; } + if ( ss=="WTA1" ){ return SGTELIB::WEIGHT_WTA1; } + if ( ss=="WTA3" ){ return SGTELIB::WEIGHT_WTA3; } + if ( ss=="EXTERN" ){ return SGTELIB::WEIGHT_EXTERN;} + throw SGTELIB::Exception ( __FILE__ , __LINE__ ,"Unrecognised string \""+s+"\" ( "+ss+" )" ); +}// + +/*----------------------------------------------------------*/ +SGTELIB::distance_t SGTELIB::str_to_distance_type ( const std::string & s ) { +/*----------------------------------------------------------*/ + std::string ss = SGTELIB::toupper(s); + if ( ss=="NORM2" ){ return SGTELIB::DISTANCE_NORM2; } + if ( ss=="NORM1" ){ return SGTELIB::DISTANCE_NORM1; } + if ( ss=="NORMINF" ){ return SGTELIB::DISTANCE_NORMINF; } + + if ( ss=="ISO" ){ return SGTELIB::DISTANCE_NORM2_IS0; } + if ( ss=="IS0" ){ return SGTELIB::DISTANCE_NORM2_IS0; } + if ( ss=="NORM2_ISO"){ return SGTELIB::DISTANCE_NORM2_IS0; } + if ( ss=="NORM2_IS0"){ return SGTELIB::DISTANCE_NORM2_IS0; } + + if ( ss=="CAT" ){ return SGTELIB::DISTANCE_NORM2_CAT; } + if ( ss=="NORM2_CAT"){ return SGTELIB::DISTANCE_NORM2_CAT; } + throw SGTELIB::Exception ( __FILE__ , __LINE__ ,"Unrecognised string \""+s+"\" ( "+ss+" )" ); +}// + +/*----------------------------------------------------------*/ +SGTELIB::distance_t SGTELIB::int_to_distance_type ( const int i ) { +/*----------------------------------------------------------*/ + if ( (i<0) || (i>=SGTELIB::NB_DISTANCE_TYPES) ){ + throw SGTELIB::Exception ( __FILE__ , __LINE__ , + "int_to_distance_type: invalid integer "+itos(i) ); + } + switch ( i ){ + case 0: return SGTELIB::DISTANCE_NORM2; + case 1: return SGTELIB::DISTANCE_NORM1; + case 2: return SGTELIB::DISTANCE_NORMINF; + case 3: return SGTELIB::DISTANCE_NORM2_IS0; + case 4: return SGTELIB::DISTANCE_NORM2_CAT; + default: + throw SGTELIB::Exception ( __FILE__ , __LINE__ , + "int_to_kernel_type: invalid integer "+itos(i) ); + } +}// + +/*----------------------------------------------------------*/ +SGTELIB::metric_t SGTELIB::str_to_metric_type ( const std::string & s ) { +/*----------------------------------------------------------*/ + std::string ss = SGTELIB::toupper(s); + if ( ss=="EMAX" ){ return SGTELIB::METRIC_EMAX ;} + if ( ss=="EMAXCV" ){ return SGTELIB::METRIC_EMAXCV ;} + if ( ss=="RMSE" ){ return SGTELIB::METRIC_RMSE ;} + if ( ss=="RMSECV" ){ return SGTELIB::METRIC_RMSECV ;} + if ( ss=="PRESS" ){ return SGTELIB::METRIC_RMSECV ;} + if ( ss=="ARMSE" ){ return SGTELIB::METRIC_ARMSE ;} + if ( ss=="ARMSECV"){ return SGTELIB::METRIC_ARMSECV ;} + if ( ss=="OE" ){ return SGTELIB::METRIC_OE ;} + if ( ss=="OECV" ){ return SGTELIB::METRIC_OECV ;} + if ( ss=="AOE" ){ return SGTELIB::METRIC_AOE ;} + if ( ss=="AOECV" ){ return SGTELIB::METRIC_AOECV ;} + if ( ss=="EFIOE" ){ return SGTELIB::METRIC_EFIOE ;} + if ( ss=="EFIOECV" ){ return SGTELIB::METRIC_EFIOECV;} + if ( ss=="LINV" ){ return SGTELIB::METRIC_LINV ;} + throw SGTELIB::Exception ( __FILE__ , __LINE__ ,"Unrecognised string \""+s+"\" ( "+ss+" )" ); +}// + + + +/*----------------------------------------------*/ +/* Same sign */ +/*----------------------------------------------*/ +bool SGTELIB::same_sign (const double a, const double b) { + return ( (a*b>0) || ( (fabs(a)<EPSILON) && (fabs(b)<EPSILON) ) ); +}// + + +/*----------------------------------------*/ +/* Compute CUMULATIVE Density Function */ +/* (Centered & Normalized Gaussian law) */ +/*----------------------------------------*/ +double SGTELIB::normcdf ( double x ) { + double t , t2 , v , Phi; + if (fabs(x)<EPSILON){ + Phi = 0.5; + } + else{ + t = 1.0 / ( 1.0 + 0.2316419 * fabs(x) ); + t2 = t*t; + v = exp(-x*x/2.0)*t*(0.319381530-0.356563782*t+1.781477937*t2-1.821255978*t*t2+1.330274429*t2*t2)/2.506628274631; + Phi = (x<0.0)?v:1.0-v; + } + return Phi; +}// + +/*----------------------------------------*/ +/* Compute CUMULATIVE Density Function */ +/* (Gaussian law) */ +/*----------------------------------------*/ +double SGTELIB::normcdf ( double x , double mu , double sigma ) { + if (sigma<-EPSILON){ + throw SGTELIB::Exception ( __FILE__ , __LINE__ , + "Surrogate_Utils::normpdf: sigma is <0" ); + } + // Apply lower bound to sigma + if (APPROX_CDF){ + sigma = std::max(sigma,EPSILON); + } + // Compute CDF + if (sigma<EPSILON){ + // The cdf is an Heavyside function + return (x>mu)?1.0:0.0; + } + else{ + // Normal case + return normcdf( (x-mu)/sigma ); + } +}// + + +/*----------------------------------------*/ +/* Compute PROBABILITY Density Function */ +/* (Centered & Normalized Gaussian law) */ +/*----------------------------------------*/ +double SGTELIB::normpdf ( double x ) { + return 0.398942280401*exp(-0.5*x*x); +}// + +/*----------------------------------------*/ +/* Compute PROBABILITY Density Function */ +/* (Gaussian law) */ +/*----------------------------------------*/ +double SGTELIB::normpdf ( double x , double mu , double sigma ) { + if (sigma<EPSILON){ + throw SGTELIB::Exception ( __FILE__ , __LINE__ , + "Surrogate_Utils::normpdf: sigma is NULL" ); + } + return normpdf( (x-mu)/sigma )/sigma; +}// + +/*----------------------------------------*/ +/* Compute EI (expected improvement) */ +/* (Gaussian law) */ +/*----------------------------------------*/ +double SGTELIB::normei ( double fh , double sh , double f_min ) { + if (sh<-EPSILON){ + throw SGTELIB::Exception ( __FILE__ , __LINE__ , + "Surrogate_Utils::normei: sigma is <0" ); + } + // Apply lower bound to sigma + if (APPROX_CDF){ + sh = std::max(sh,EPSILON); + } + if (sh<EPSILON){ + // If there is no uncertainty, then: + // - fh<f_min => EI = f_min-fh + // - fh>f_min => EI = 0 + return (fh<f_min)?(f_min-fh):0; + } + else{ + // Normal case + double d = (f_min-fh)/sh; + return (f_min-fh)*normcdf(d) + sh*normpdf(d); + } +}// + +/*----------------------------------------*/ +/* CDF of gamma distribution */ +/*----------------------------------------*/ +double SGTELIB::gammacdf(double x, double a, double b){ + // a : shape coef + // b : scale coef + if ( (a<=0) || (b<=0) ){ + throw SGTELIB::Exception ( __FILE__ , __LINE__ , + "Surrogate_Utils::gammacdf: a or b is <0" ); + } + if (x<EPSILON) return 0.0; + + return lower_incomplete_gamma(x/b,a); +}// + +/*----------------------------------------*/ +/* Inverse CDF of gamma distribution */ +/*----------------------------------------*/ +double SGTELIB::gammacdfinv(double f, double a, double b){ + // a : shape coef + // b : scale coef + if ( (a<=0) || (b<=0) ){ + throw SGTELIB::Exception ( __FILE__ , __LINE__ , + "Surrogate_Utils::gammacdfinv: a or b is <0" ); + } + if ( (f<0) || (f>1) ){ + throw SGTELIB::Exception ( __FILE__ , __LINE__ , + "Surrogate_Utils::gammacdfinv: f<0 or f>1" ); + } + if (f==1.0) return INF; + if (f==0.0) return 0; + + //std::cout << "f,a,b : " << f << " " << a << " " << b << "\n"; + + double xmin = 0; + double xmax = 1; + double xtry; + // Extend upper bound +int k = 0; + while (SGTELIB::gammacdf(xmax,a,b)<f){ + xmin = xmax; + xmax*=2.0; + //std::cout << "up " << xmax << " " << a << " " << b << " " << SGTELIB::gammacdf(xmax,a,b) << "\n"; + k++; + if (k>10) break; + } + + while (xmax-xmin>10000*EPSILON){ + xtry = (xmin+xmax)/2.0; + if (SGTELIB::gammacdf(xtry,a,b)>f) xmax = xtry; + else xmin = xtry; + //std::cout << "dichotomie : " << xtry << "\n"; + } + return (xmin+xmax)/2.0; +}// + +/*----------------------------------------*/ +/* lower incomplete gamma function */ +/*----------------------------------------*/ +// See: +// Milton Abramowitz, Irene Stegun,Handbook of Mathematical Functions, National Bureau of Standards, 1964. +// Stephen Wolfram, The Mathematica Book,Fourth Edition,Cambridge University Press, 1999. +double SGTELIB::lower_incomplete_gamma ( const double x, double p ){ + // Special cases + if ( ( x < EPSILON ) || ( p < EPSILON ) ) return 0; + +#ifdef _MSC_VER +#if ( _MSC_VER <= 1600 ) + throw SGTELIB::Exception ( __FILE__ , __LINE__ , + "Surrogate_Utils:: lgamma function not supported with VisualStudio 2010 or lower " ); +#define _LGAMMA_GUARD +#endif +#endif + double f=0; +#ifndef _LGAMMA_GUARD + f = exp( p * log ( x ) - lgamma ( p + 1.0 ) - x ); +#endif + double dv = 1.0, v = 1.0; + while (dv > v/1e+9) { + dv *= x / (++p); + v += dv; + } + return v*f; + +}// + +/*----------------------------------------*/ +/* difference between two timeval, in ms */ +/*----------------------------------------*/ +int SGTELIB::diff_ms(timeval t1, timeval t2){ + return static_cast<int>((((t1.tv_sec - t2.tv_sec) * 1000000) + (t1.tv_usec - t2.tv_usec +500))/1000); +}// + +/*----------------------------------------*/ +/* uniform rand generator */ +/*----------------------------------------*/ +double SGTELIB::uniform_rand (void){ + return double(rand() / double(INT_MAX)); +}// + +/*----------------------------------------*/ +/* quick gaussian random generator */ +/*----------------------------------------*/ +double SGTELIB::quick_norm_rand (void){ + const int N = 24; + double d = 0; + for (int i=1 ; i<N ; i++) d+= uniform_rand(); + d -= double(N)/2.0; + d *= sqrt(12.0/double(N)); + return d; +}// + +/*----------------------------------------*/ +/* relative ceil */ +/*----------------------------------------*/ +double SGTELIB::rceil (double d){ + if (d>0) return std::ceil(d); + else if (d<0) return std::floor(d); + else return 0.0; +}// + + + + + diff --git a/ext/sgtelib/src/Surrogate_Utils.hpp b/ext/sgtelib/src/Surrogate_Utils.hpp new file mode 100644 index 0000000000000000000000000000000000000000..4cbeb3f20ee759495cc863cec1786f4a66aa69fc --- /dev/null +++ b/ext/sgtelib/src/Surrogate_Utils.hpp @@ -0,0 +1,210 @@ +/*-------------------------------------------------------------------------------------*/ +/* sgtelib - A surrogate model library for derivative-free optimization */ +/* Version 2.0.1 */ +/* */ +/* Copyright (C) 2012-2017 Sebastien Le Digabel - Ecole Polytechnique, Montreal */ +/* Bastien Talgorn - McGill University, Montreal */ +/* */ +/* Author: Bastien Talgorn */ +/* email: bastientalgorn@fastmail.com */ +/* */ +/* This program is free software: you can redistribute it and/or modify it under the */ +/* terms of the GNU Lesser General Public License as published by the Free Software */ +/* Foundation, either version 3 of the License, or (at your option) any later */ +/* version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ +/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ +/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License along */ +/* with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on sgtelib at https://github.com/bastientalgorn/sgtelib */ +/*-------------------------------------------------------------------------------------*/ + +#ifndef __SGTELIB_SURROGATE_UTILS__ +#define __SGTELIB_SURROGATE_UTILS__ + +#include "Defines.hpp" +#include "Exception.hpp" +#include "Matrix.hpp" +#include <sys/stat.h> + +// CASE Visual Studio C++ compiler +#ifdef _MSC_VER +#pragma warning(disable:4996) +#include <io.h> +#define isnan(x) _isnan(x) +#define isdigit(x) _isdigit(x) +#define isinf(x) (!_finite(x)) + +typedef struct timeval { + long tv_sec; + long tv_usec; +} timeval; + +#else +#include <unistd.h> +#endif + + +#include <cstring> +#include <cctype> + +namespace SGTELIB { + + enum distance_t { + DISTANCE_NORM2 , + DISTANCE_NORM1 , + DISTANCE_NORMINF , + DISTANCE_NORM2_IS0, + DISTANCE_NORM2_CAT + }; + const int NB_DISTANCE_TYPES = 5; + + // model type: + enum model_t { + LINEAR , + TGP , + DYNATREE , + PRS , + PRS_EDGE , + PRS_CAT , + KS , + CN , + KRIGING , + SVN , + RBF , + LOWESS , + ENSEMBLE + }; + const int NB_MODEL_TYPES = 12; + + // Aggregation methods (for the Surrogate_Ensemble) + enum weight_t { + WEIGHT_SELECT,// Take the model with the best metrics. + WEIGHT_OPTIM, // Optimize the metric + WEIGHT_WTA1, // Goel, Ensemble of surrogates 2007 + WEIGHT_WTA3, // Goel, Ensemble of surrogates 2007 + WEIGHT_EXTERN // Belief vector is set externaly by the user. + }; + const int NB_WEIGHT_TYPES = 5; + + // Metrics + enum metric_t { + METRIC_EMAX, // Max absolute error + METRIC_EMAXCV,// Max absolute error on cross-validation value + METRIC_RMSE, // Root mean square error + METRIC_ARMSE, // Agregate Root mean square error + METRIC_RMSECV, // Leave-one-out cross-validation + METRIC_ARMSECV, // Agregate Leave-one-out cross-validation + METRIC_OE, // Order error on the training points + METRIC_OECV, // Order error on the cross-validation output + METRIC_AOE, // Agregate Order error + METRIC_AOECV, // Agregate Order error on the cross-validation output + METRIC_EFIOE, // Order error on the cross-validation output + METRIC_EFIOECV, // Agregate Order error on the cross-validation output + METRIC_LINV // Inverse of the likelihood + }; + const int NB_METRIC_TYPES = 11; + + + // Diff in ms + int diff_ms(timeval t1, timeval t2); + + // Compare strings + bool streq ( const std::string & s1 , const std::string & s2 ); + bool streqi ( const std::string & s1 , const std::string & s2 ); + // Check if s is a substring of S + bool string_find ( const std::string & S , const std::string & s ); + //bool issubstring (const std::string S , const std::string s); + + + // Remove useless spaces in string + std::string deblank ( const std::string & s_input ); + + // test if a file exists + bool exists (const std::string & file); + + // Word count + int count_words(const std::string & s ); + + // add string on a new line of an existing files + void append_file (const std::string & s , const std::string & file); + + // wait + void wait (double t); + + // isdef (not nan nor inf) + bool isdef ( const double x ); + + // rounding: + int round ( double d ); + double rceil (double d); + + // relative error: + double rel_err ( double x , double y ); + + // distance between two points: + double dist ( const double * x , const double * y , int n ); + + // same sign + bool same_sign (const double a, const double b); + + // conversion functions (to string) : + std::string itos ( int ); + std::string dtos ( double ); + std::string btos ( bool ); + double stod ( const std::string & s ); + int stoi ( const std::string & s ); + bool stob ( const std::string & s ); + + std::string toupper ( const std::string & s ); + + std::string model_output_to_str ( const SGTELIB::model_output_t ); + std::string model_type_to_str ( const SGTELIB::model_t ); + std::string bbo_type_to_str ( const SGTELIB::bbo_t ); + std::string weight_type_to_str ( const SGTELIB::weight_t ); + std::string metric_type_to_str ( const SGTELIB::metric_t ); + std::string distance_type_to_str ( const SGTELIB::distance_t ); + + // conversion functions (from string) : + bool isdigit ( const std::string & s ); + SGTELIB::model_t str_to_model_type ( const std::string & s ); + SGTELIB::weight_t str_to_weight_type ( const std::string & s ); + SGTELIB::metric_t str_to_metric_type ( const std::string & s ); + SGTELIB::distance_t str_to_distance_type ( const std::string & s ); + SGTELIB::distance_t int_to_distance_type ( const int i ); + + // Info on metric + // Tells if a metric returns one or multiple objectives + // (i.e. One for all the BBO OR One per BBO) + bool metric_multiple_obj ( const SGTELIB::metric_t mt ); + + // Convert a metric to another metric that returns only 1 obj. + SGTELIB::metric_t metric_convert_single_obj ( const SGTELIB::metric_t mt ); + + + /* + // Find the index of the smallest value in an array v of size vsize. + int get_min_index ( const double * v , const int vsize ); + // (optional: exclude index "i_exclude" from the search) + int get_min_index ( const double * v , const int vsize , const int i_exclude); + */ + + // Statistics + double normcdf ( double x ); + double normcdf ( double x , double mu , double sigma ); + double normpdf ( double x ); + double normpdf ( double x , double mu , double sigma ); + double normei ( double fh, double sh , double f_min ); + double gammacdf ( double x, double a, double b); + double gammacdfinv( double f, double a, double b); + double lower_incomplete_gamma ( const double x, const double p ); + + double uniform_rand (void); + double quick_norm_rand (void); +} + +#endif diff --git a/ext/sgtelib/src/Tests.cpp b/ext/sgtelib/src/Tests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ee4dd3c7a58d6555b7b715245e0181cca8664969 --- /dev/null +++ b/ext/sgtelib/src/Tests.cpp @@ -0,0 +1,1580 @@ +/*-------------------------------------------------------------------------------------*/ +/* sgtelib - A surrogate model library for derivative-free optimization */ +/* Version 2.0.1 */ +/* */ +/* Copyright (C) 2012-2017 Sebastien Le Digabel - Ecole Polytechnique, Montreal */ +/* Bastien Talgorn - McGill University, Montreal */ +/* */ +/* Author: Bastien Talgorn */ +/* email: bastientalgorn@fastmail.com */ +/* */ +/* This program is free software: you can redistribute it and/or modify it under the */ +/* terms of the GNU Lesser General Public License as published by the Free Software */ +/* Foundation, either version 3 of the License, or (at your option) any later */ +/* version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ +/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ +/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License along */ +/* with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on sgtelib at https://github.com/bastientalgorn/sgtelib */ +/*-------------------------------------------------------------------------------------*/ + +#include "Tests.hpp" +#include "Surrogate_Ensemble.hpp" + +void SGTELIB::sand_box (void){ + + std::cout << "End of sandbox\nEXIT\n"; +}// + + +void SGTELIB::test_LOWESS_times ( void ){ + + std::cout << "====================================================================\n"; + std::cout << "START LOWESS TIMES\n"; + + const int m = 1; + const int pp = 6; + int n = 0; + + for (int in=0 ; in<1 ; in++){ + if (in==0) n = 16; + if (in==1) n = 8; + if (in==2) n = 4; + if (in==3) n = 2; + if (in==4) n = 1; + + std::cout <<"--------------------\n"; + + int NEXP = 20; + + int p = (n+1)*(n+2); + //if (p<20) p=20; + double dx; + + for (int id=10 ; id<11 ; id++){ + dx = pow(10.0,-id); + std::cout << "n=" << n << ", dx=" << dx << "\n"; + + SGTELIB::Matrix DX ("DX",1,n); + SGTELIB::Matrix X ("X",p,n); + SGTELIB::Matrix XX ("XX",pp,n); + SGTELIB::Matrix Z ("Z",p,m); + SGTELIB::Matrix * ZZ = new SGTELIB::Matrix("ZZ",pp,m); + + for (int i = 0 ; i<NEXP ; i++){ + std::cout << "n=" << n << ", dx=" << dx << ", nexp=" << i << "\n"; + // Build data + X.set_random(-5,+5,false); + Z.set_random(-5,+5,false); + SGTELIB::TrainingSet C0(X,Z); + SGTELIB::Surrogate * S0; + // Build model + S0 = SGTELIB::Surrogate_Factory(C0,"TYPE LOWESS RIDGE 0.001"); + S0->build(); + // Build XX + DX.set_random(-1,+1,false); + XX.set_row(DX,0); + for (int j=1 ; j<pp ; j++){ + DX.set_random(-1,+1,false); + DX = DX*(dx/DX.norm()); + DX = DX + XX.get_row(j-1); + XX.set_row(DX,j); + } + // Prediction + S0->predict(XX,ZZ); + }// end loop i + + delete ZZ; + + }// end loop id + }// end loop in + + std::cout << "FINISH LOWESS TIMES\n"; + std::cout << "====================================================================\n"; + +}// + + + + +void SGTELIB::test_many_models ( const std::string & output_file , + const SGTELIB::Matrix & X0 , + const SGTELIB::Matrix & Z0 ){ + std::cout << "======================================================\n"; + std::cout << "SGTELIB::test_many_models\n"; + + // Data information + const int m = Z0.get_nb_cols(); + + // TrainingSet creation + SGTELIB::TrainingSet C0(X0,Z0); + #ifdef SGTELIB_DEBUG + C0.display(std::cout); + #endif + // Init model + SGTELIB::Surrogate * S0; + + // LOAD MODEL LIST in model_list_file + std::vector<std::string> model_list; + model_list.push_back("TYPE PRS DEGREE 2"); + model_list.push_back("TYPE PRS DEGREE OPTIM"); + model_list.push_back("TYPE KS KERNEL_COEF OPTIM"); + model_list.push_back("TYPE LOWESS KERNEL_COEF OPTIM DEGREE 1"); + model_list.push_back("TYPE LOWESS KERNEL_COEF OPTIM DEGREE OPTIM KERNEL_TYPE OPTIM"); + model_list.push_back("TYPE RBF PRESET I"); + + + // BUILD THE METRIC LIST + std::vector<SGTELIB::metric_t> metric_list; + + metric_list.push_back( METRIC_RMSE ); + metric_list.push_back( METRIC_RMSECV ); + metric_list.push_back( METRIC_OE ); + metric_list.push_back( METRIC_OECV ); + + // Open an output file + std::ofstream out; + out.open (output_file.c_str()); + + out << "list_metrics " ; + for (std::vector<SGTELIB::metric_t>::iterator it_metric = metric_list.begin() ; it_metric != metric_list.end(); ++it_metric){ + out << SGTELIB::metric_type_to_str(*it_metric) << " "; + } + out << "\n\n"; + + bool ready; + // Loop on the models + for (std::vector<std::string>::iterator it_model = model_list.begin() ; it_model != model_list.end(); ++it_model){ + + std::cout << "Build " << *it_model << "\n"; + out << *it_model << "\n"; + + // Create model + S0 = SGTELIB::Surrogate_Factory(C0,*it_model); + ready = S0->build(); + + // Loop on the outputs + for (int j=0 ; j<m ; j++){ + out << "output " << j << "\n"; + out << "metrics "; + // Loop on the metrics + for (std::vector<SGTELIB::metric_t>::iterator it_metric = metric_list.begin() ; it_metric != metric_list.end(); ++it_metric){ + if (ready) + out << S0->get_metric (*it_metric,j) << " "; + else + out << "-999 "; + } + out << "\n"; + } + out << "\n"; + SGTELIB::surrogate_delete(S0); + } + out.close(); + +}// + + +/*----------------------------------------------------*/ +/* TEST QUICK */ +/*----------------------------------------------------*/ +std::string SGTELIB::test_quick (const std::string & s , const SGTELIB::Matrix & X0){ + + + std::cout << "======================================================\n"; + std::cout << "SGTELIB::test_quick\n"; + std::cout << s << "\n"; + + // CONSTRUCT DATA + SGTELIB::Matrix Z0 = test_functions(X0); + const int m = Z0.get_nb_cols(); + bool ready; + + // CONSTRUCT REFERENCE MODEL + SGTELIB::TrainingSet C0(X0,Z0); + SGTELIB::Surrogate * S0; + S0 = SGTELIB::Surrogate_Factory(C0,s); + ready = S0->build(); + + if ( ! ready){ + surrogate_delete(S0); + std::cout << "test_quick: model ("+s+") is not ready\n"; + return "test_quick: model ("+s+") is not ready\n"; + } + + // Compute the metrics + double * emax = new double [m]; + double * rmse = new double [m]; + double * rmsecv= new double [m]; + double * oe = new double [m]; + double * oecv = new double [m]; + double * linv = new double [m]; + for (int j=0 ; j<m ; j++){ + emax[j] = S0->get_metric(SGTELIB::METRIC_EMAX,j); + rmse[j] = S0->get_metric(SGTELIB::METRIC_RMSE,j); + rmsecv[j]=S0->get_metric(SGTELIB::METRIC_RMSECV,j); + oe[j] = S0->get_metric(SGTELIB::METRIC_OE,j); + oecv[j] = S0->get_metric(SGTELIB::METRIC_OECV,j); + linv[j] = S0->get_metric(SGTELIB::METRIC_LINV,j); + } + + // Display + std::ostringstream oss; + oss << "test_quick\n"; + oss << "Surrogate string: " << s << "\n"; + oss << " j| emax| rmse| rmsecv| oe| oecv| linv|\n"; + oss << "---|--------------|--------------|--------------|--------------|--------------|--------------|\n"; + for (int j=0 ; j<m ; j++){ + oss.width(3); + oss << j << "|"; + oss.width(14); + oss << emax[j] << "|"; + oss.width(14); + oss << rmse[j] << "|"; + oss.width(14); + oss << rmsecv[j] << "|"; + oss.width(14); + oss << oe[j] << "|"; + oss.width(14); + oss << oecv[j] << "|"; + oss.width(14); + oss << linv[j] << "|\n"; + } + oss << "---|--------------|--------------|--------------|--------------|--------------|--------------|\n"; + std::cout << oss.str(); + + for (int j=0 ; j<m ; j++){ + if ( (isnan(emax[j])) || (isnan(rmsecv[j])) || (isnan(oe[j])) || (isnan(oecv[j])) || (isnan(linv[j])) ){ + std::cout << "There is some nan\n"; + std::cout << "EXIT!\n"; + exit(0); + } + if ( (isinf(emax[j])) || (isinf(rmse[j])) || ( isinf(rmsecv[j])) || (isinf(oe[j])) || (isinf(oecv[j])) || (isinf(linv[j])) ){ + std::cout << "There is some inf\n"; + std::cout << "EXIT!\n"; + exit(0); + } + } + delete [] emax; + delete [] rmse; + delete [] rmsecv; + delete [] oe; + delete [] oecv; + delete [] linv; + + SGTELIB::surrogate_delete(S0); + + return oss.str(); +}// + + +/*----------------------------------------------------*/ +/* TEST pxx */ +/*----------------------------------------------------*/ +std::string SGTELIB::test_pxx (const std::string & s , const SGTELIB::Matrix & X0){ + + std::cout << "======================================================\n"; + std::cout << "SGTELIB::test_pxx\n"; + std::cout << s << "\n"; + + SGTELIB::Matrix Z0 = test_functions(X0); + + // CONSTRUCT DATA + const int n = X0.get_nb_cols(); + const int p = X0.get_nb_rows(); + const int m = Z0.get_nb_cols(); + + // CONSTRUCT REFERENCE MODEL + SGTELIB::TrainingSet C0(X0,Z0); + SGTELIB::Surrogate * S0; + S0 = SGTELIB::Surrogate_Factory(C0,s); + bool ready; + ready = S0->build(); + + if ( ! ready){ + surrogate_delete(S0); + std::cout << "test_pxx: model ("+s+") is not ready\n"; + return "test_pxx: model ("+s+") is not ready\n"; + } + + // Init + SGTELIB::Matrix XX; + int pxx; + + // Validation predictions + SGTELIB::Matrix * ZZ = NULL; + SGTELIB::Matrix * std = NULL; + SGTELIB::Matrix * ei = NULL; + SGTELIB::Matrix * cdf = NULL; + + // Reference prediction + SGTELIB::Matrix * ZZ0 = NULL; + SGTELIB::Matrix * std0 = NULL; + SGTELIB::Matrix * ei0 = NULL; + SGTELIB::Matrix * cdf0 = NULL; + + for (int i=0 ; i<4 ; i++){ + switch (i){ + case 0: + pxx = 1; + break; + case 1: + pxx = 2; + break; + case 2: + pxx = p; + break; + case 3: + pxx = 2*p; + break; + default: + std::cout << "ERROR i = " << i << "\n"; + exit(0); + } + + // TESTING POINT(S) + XX = SGTELIB::Matrix("XX",pxx,n); + XX.set_random(-10,+10,false); + + // Reference output matrices + ZZ0 = new SGTELIB::Matrix("ZZ0" ,pxx,m); + std0 = new SGTELIB::Matrix("std0",pxx,m); + ei0 = new SGTELIB::Matrix("ei0" ,pxx,m); + cdf0 = new SGTELIB::Matrix("cdf0",pxx,m); + + S0->predict(XX,ZZ0,std0,ei0,cdf0); + + for (int k=0 ; k<7 ; k++){ + + // Output matrices + ZZ = new SGTELIB::Matrix("ZZ" ,pxx,m); + std = new SGTELIB::Matrix("std",pxx,m); + ei = new SGTELIB::Matrix("ei" ,pxx,m); + cdf = new SGTELIB::Matrix("cdf",pxx,m); + + switch (k){ + case 0: + S0->predict(XX,ZZ); + check_matrix_diff(ZZ0 ,ZZ); + break; + case 1: + S0->predict(XX,ZZ,std ,NULL,NULL); + check_matrix_diff(ZZ0 ,ZZ); + check_matrix_diff(std0,std); + break; + case 2: + S0->predict(XX,ZZ,NULL,ei ,NULL); + check_matrix_diff(ZZ0 ,ZZ); + check_matrix_diff(ei0,ei); + break; + case 3: + S0->predict(XX,ZZ,NULL,NULL,cdf ); + check_matrix_diff(ZZ0 ,ZZ); + check_matrix_diff(cdf0,cdf); + break; + case 4: + S0->predict(XX,ZZ,NULL,ei ,cdf ); + check_matrix_diff(ZZ0 ,ZZ); + check_matrix_diff(ei0 ,ei); + check_matrix_diff(cdf0,cdf); + break; + case 5: + S0->predict(XX,ZZ,std ,NULL,cdf ); + check_matrix_diff(ZZ0 ,ZZ); + check_matrix_diff(std0,std); + check_matrix_diff(cdf0,cdf); + break; + case 6: + S0->predict(XX,ZZ,std ,ei ,NULL); + check_matrix_diff(ZZ0 ,ZZ); + check_matrix_diff(std0,std); + check_matrix_diff(ei0 ,ei); + break; + default: + std::cout << "ERROR k = " << k << "\n"; + exit(0); + + }// end switch + + delete ZZ; + delete std; + delete ei; + delete cdf; + + }// end loop k + + delete ZZ0; + delete std0; + delete ei0; + delete cdf0; + + }//end loop i + + SGTELIB::surrogate_delete(S0); + + return "test_pxx ok\n"; +}// + + + +/*----------------------------------------------------*/ +/* TEST update */ +/*----------------------------------------------------*/ +std::string SGTELIB::test_update (const std::string & s , const SGTELIB::Matrix & X0){ + + std::cout << "======================================================\n"; + std::cout << "SGTELIB::test_update\n"; + std::cout << s << "\n"; + + // CONSTRUCT DATA + const int p = X0.get_nb_rows(); + const int n = X0.get_nb_cols(); + SGTELIB::Matrix Z0 = test_functions(X0); + const int m = Z0.get_nb_cols(); + + // CONSTRUCT MODEL + SGTELIB::TrainingSet C0(X0,Z0); + SGTELIB::Surrogate * S0; + S0 = SGTELIB::Surrogate_Factory(C0,s); + bool ready; + ready = S0->build(); + + if ( ! ready){ + surrogate_delete(S0); + std::cout << "test_update: model ("+s+") is not ready\n"; + return "test_update: model ("+s+") is not ready\n"; + } + + // Testing set + const int pxx = 3; + SGTELIB::Matrix XX("XX",pxx,n); + XX.set_random(-5,+5,false); + + // Reference prediction + SGTELIB::Matrix * ZZ0 = new SGTELIB::Matrix("ZZ0" ,pxx,m); + SGTELIB::Matrix * std0 = new SGTELIB::Matrix("std0",pxx,m); + SGTELIB::Matrix * ei0 = new SGTELIB::Matrix("ei0" ,pxx,m); + SGTELIB::Matrix * cdf0 = new SGTELIB::Matrix("cdf0",pxx,m); + S0->predict(XX,ZZ0,std0,ei0,cdf0); + + + // CONSTRUCT MODEL + SGTELIB::TrainingSet C1(X0.get_row(0),Z0.get_row(0)); + SGTELIB::Surrogate * S1; + S1 = SGTELIB::Surrogate_Factory(C1,s); + S1->build(); + + for (int i=1 ; i<p ; i++){ + C1.add_points(X0.get_row(i),Z0.get_row(i)); + S1->build(); + } + + // Validation predictions + SGTELIB::Matrix * ZZ1 = new SGTELIB::Matrix("ZZ1" ,pxx,m); + SGTELIB::Matrix * std1 = new SGTELIB::Matrix("std1",pxx,m); + SGTELIB::Matrix * ei1 = new SGTELIB::Matrix("ei1" ,pxx,m); + SGTELIB::Matrix * cdf1 = new SGTELIB::Matrix("cdf1",pxx,m); + S1->predict(XX,ZZ1,std1,ei1,cdf1); + + // Check consistency + check_matrix_diff(ZZ0 ,ZZ1 ); + check_matrix_diff(std0,std1); + check_matrix_diff(ei0 ,ei1 ); + check_matrix_diff(cdf0,cdf1); + + // Free space + SGTELIB::surrogate_delete(S0); + SGTELIB::surrogate_delete(S1); + + delete ZZ0; + delete std0; + delete ei0; + delete cdf0; + + delete ZZ1; + delete std1; + delete ei1; + delete cdf1; + + return "test_update ok\n"; + +}// + + + +/*----------------------------------------------------*/ +/* TEST SINGULAR DATA */ +/*----------------------------------------------------*/ +std::string SGTELIB::test_singular_data (const std::string & s ) { + + std::cout << "======================================================\n"; + std::cout << "SGTELIB::test_singular_data\n"; + std::cout << s << "\n"; + + // CONSTRUCT DATA + const int n = 3; + const int p = 10; + SGTELIB::Matrix X0 ("X0",p,n); + X0.set_random(0,10,false); + SGTELIB::Matrix Z0 = test_functions(X0); + const int m = Z0.get_nb_cols(); + Z0.set_name("Z0"); + + // Column 0 of X0 is constant (= 0.0); + X0.set_col(0.0,0); + // Column 0 of Z0 is constant (= 0.0); + Z0.set_col(0.0,0); + // Column 1 of Z0 has some nan + // Z0.set(2,1,0.0/0.0); + // Z0.set(5,1,0.0/0.0); + Z0.set(2,1,SGTELIB::NaN); + Z0.set(5,1,SGTELIB::NaN); + // Column 2 of Z0 has some inf + Z0.set(4,2,SGTELIB::INF); + Z0.set(7,2,SGTELIB::INF); + // Column 3 of Z0 has some nan and some inf + Z0.set(5,3,SGTELIB::INF); + Z0.set(8,3,SGTELIB::NaN); + // Z0.set(8,3,0.0/0.0); + + #ifdef SGTELIB_DEBUG + X0.display(std::cout); + Z0.display(std::cout); + #endif + + // CONSTRUCT MODEL + SGTELIB::TrainingSet C0(X0,Z0); + SGTELIB::Surrogate * S0; + S0 = SGTELIB::Surrogate_Factory(C0,s); + bool ready = S0->build(); + + if ( ! ready){ + surrogate_delete(S0); + std::cout << "test_singular_data: model ("+s+") is not ready\n"; + return "test_singular_data: model ("+s+") is not ready\n"; + } + + // Get the rmse and rmsecv + double * rmse = new double [m]; + double * rmsecv = new double [m]; + for (int j=0 ; j<m ; j++){ + rmse[j] = S0->get_metric(SGTELIB::METRIC_RMSE,j); + rmsecv[j] = S0->get_metric(SGTELIB::METRIC_RMSECV,j); + } + + // Display + std::ostringstream oss; + oss << "test_singular_data\n"; + oss << "Surrogate string: " << s << "\n"; + oss << " j| rmse| rmsecv|\n"; + oss << "---|--------------|--------------|\n"; + for (int j=0 ; j<m ; j++){ + oss.width(3); + oss << j << "|"; + oss.width(14); + oss << rmse[j] << "|"; + oss.width(14); + oss << rmsecv[j] << "|\n"; + } + oss << "---|--------------|--------------|\n"; + + for (int j=0 ; j<m ; j++){ + if ( ( ! isdef(rmse[j])) || ( ! isdef(rmse[j])) ){ + std::cout << "There are some nan !"; + C0.get_matrix_Xs().display(std::cout); + exit(0); + } + } + + std::cout << oss.str(); + SGTELIB::surrogate_delete(S0); + delete [] rmse; + delete [] rmsecv; + return oss.str(); + +}// + + + + +/*----------------------------------------------------*/ +/* TEST scale */ +/*----------------------------------------------------*/ +std::string SGTELIB::test_scale (const std::string & s , const SGTELIB::Matrix & X0){ + + std::cout << "======================================================\n"; + std::cout << "SGTELIB::test_scale\n"; + std::cout << s << "\n"; + + // CONSTRUCT DATA + const int p = X0.get_nb_rows(); + const int n = X0.get_nb_cols(); + SGTELIB::Matrix Z0 = test_functions(X0); + const int m = Z0.get_nb_cols(); + bool ready; + + // CONSTRUCT MODEL + SGTELIB::TrainingSet C0(X0,Z0); + SGTELIB::Surrogate * S0; + S0 = SGTELIB::Surrogate_Factory(C0,s); + ready = S0->build(); + + if ( ! ready){ + surrogate_delete(S0); + std::cout << "test_scale: model ("+s+") is not ready\n"; + return "test_scale: model ("+s+") is not ready\n"; + } + + // Testing set + const int pxx = 3; + SGTELIB::Matrix XX0("XX0",pxx,n); + XX0.set_random(-5,+5,false); + + // Reference prediction + SGTELIB::Matrix * ZZ0 = new SGTELIB::Matrix("ZZ0" ,pxx,m); + SGTELIB::Matrix * std0 = new SGTELIB::Matrix("std0",pxx,m); + SGTELIB::Matrix * ei0 = new SGTELIB::Matrix("ei0" ,pxx,m); + SGTELIB::Matrix * cdf0 = new SGTELIB::Matrix("cdf0",pxx,m); + S0->predict(XX0,ZZ0,std0,ei0,cdf0); + + // Build scaling values + double * ax = new double [n]; + double * bx = new double [n]; + for (int i=0 ; i<n ; i++){ + ax[i] = double(i+2); // arbitrary values + bx[i] = 1.5+1/double(i+2); // arbitrary values + } + double * az = new double [m]; + double * bz = new double [m]; + for (int i=0 ; i<m ; i++){ + az[i] = 0.0; // No offset on the constraints (we don't want to change the feasibility) + bz[i] = 3.0+double(i+2); // arbitrary values + } + + // CONSTRUCT SCALED DATA + SGTELIB::Matrix X1 = X0; + SGTELIB::Matrix Z1 = Z0; + for (int i=0 ; i<p ; i++){ + for (int j=0 ; j<n ; j++){ + X1.set(i,j, ax[j] + bx[j] * X0.get(i,j) ); + } + for (int j=0 ; j<m ; j++){ + Z1.set(i,j, az[j] + bz[j] * Z0.get(i,j) ); + } + } + + // Build new model + SGTELIB::TrainingSet C1(X1,Z1); + SGTELIB::Surrogate * S1; + S1 = SGTELIB::Surrogate_Factory(C1,s); + S1->build(); + + // Verif prediction + SGTELIB::Matrix * ZZ1 = new SGTELIB::Matrix("ZZ1" ,pxx,m); + SGTELIB::Matrix * std1 = new SGTELIB::Matrix("std1",pxx,m); + SGTELIB::Matrix * ei1 = new SGTELIB::Matrix("ei1" ,pxx,m); + SGTELIB::Matrix * cdf1 = new SGTELIB::Matrix("cdf1",pxx,m); + + // CONSTRUCT SCALED PREDICTION POINTS + SGTELIB::Matrix XX1= XX0; + for (int i=0 ; i<pxx ; i++){ + for (int j=0 ; j<n ; j++){ + XX1.set(i,j, ax[j] + bx[j] * XX0.get(i,j) ); + } + } + S1->predict(XX1,ZZ1,std1,ei1,cdf1); + + // Renormalize + for (int i=0 ; i<pxx ; i++){ + for (int j=0 ; j<m ; j++){ + ZZ1->set(i,j, ( ZZ1->get(i,j)-az[j] ) / bz[j] ); + std1->set(i,j, ( std1->get(i,j) ) / bz[j] ); + ei1->set(i,j, ( ei1->get(i,j) ) / bz[j] ); + } + } + + // Check consistency + std::cout << s << "\n"; + std::cout << "Check ZZ\n"; + check_matrix_diff(ZZ0 ,ZZ1 ); + std::cout << "Check std\n"; + check_matrix_diff(std0,std1); + std::cout << "Check ei\n"; + check_matrix_diff(ei0 ,ei1 ); + std::cout << "Check cdf\n"; + check_matrix_diff(cdf0,cdf1); + + // Free space + SGTELIB::surrogate_delete(S0); + SGTELIB::surrogate_delete(S1); + + delete ZZ0; + delete std0; + delete ei0; + delete cdf0; + + delete ZZ1; + delete std1; + delete ei1; + delete cdf1; + + delete [] ax; + delete [] bx; + delete [] az; + delete [] bz; + + std::cout << "test_scale OK for model " << s << "\n"; + return "test_scale ok\n"; +}// + + + + +/*----------------------------------------------------*/ +/* TEST dimension */ +/*----------------------------------------------------*/ +std::string SGTELIB::test_dimension (const std::string & s ){ + + std::cout << "======================================================\n"; + std::cout << "SGTELIB::test_dimension\n"; + std::cout << s << "\n"; + + // INIT DATA + int p =0,n=0,m=0,pxx=1; + + bool ready; + + // Training Set and Surrogate + SGTELIB::TrainingSet * C0=NULL; + SGTELIB::Surrogate * S0=NULL; + + // Predictions + SGTELIB::Matrix X0,Z0; + SGTELIB::Matrix XX, ZZ, STD, EI, CDF; + + // BUILD THE METRIC LIST + std::vector<SGTELIB::metric_t> metric_list; + metric_list.push_back( METRIC_RMSECV ); + metric_list.push_back( METRIC_EMAX ); + metric_list.push_back( METRIC_EMAXCV ); + metric_list.push_back( METRIC_RMSE ); + metric_list.push_back( METRIC_RMSECV ); + metric_list.push_back( METRIC_OE ); + metric_list.push_back( METRIC_OECV ); + metric_list.push_back( METRIC_LINV ); + + int i_case; + const int i_case_max = 5; + for ( i_case = 0 ; i_case < i_case_max ; i_case++ ){ + std::cout << "------------------------------------------------------\n"; + std::cout << "i_case = " << i_case ; + if (i_case==0){ + std::cout << " (small m,n,p,pxx) "; + m = 1; + n = 2; + p = 3; + pxx = 4; + } + else if (i_case==1){ + std::cout << " (big m) "; + m = 30; + n = 1; + p = 10; + pxx = 2; + } + else if (i_case==2){ + std::cout << " (big n) "; + m = 1; + n = 30; + p = 10; + pxx = 2; + } + else if (i_case==3){ + std::cout << " (big p) "; + m = 1; + n = 2; + p = 30; + pxx = 3; + } + else if (i_case==4){ + std::cout << " (big pxx) "; + m = 1; + n = 2; + p = 30; + pxx = 50; + } + + std::cout << "m,n,p,pxx = " << m << " " << n << " " << p << " " << pxx << "\n"; + + X0 = SGTELIB::Matrix("X0",p,n); + Z0 = SGTELIB::Matrix("X0",p,m); + X0.set_random(0,10,false); + Z0.set_random(0,10,false); + + C0 = new SGTELIB::TrainingSet (X0,Z0); + S0 = SGTELIB::Surrogate_Factory(*C0,s); + ready = S0->build(); + + // Loop on the metrics + std::vector<SGTELIB::metric_t>::iterator it; + int j; + double v = 0; + if (ready){ + for (it = metric_list.begin() ; it != metric_list.end(); ++it){ + std::cout << "Metric " << SGTELIB::metric_type_to_str(*it) << "\n"; + for (j=0 ; j<m ; j++){ + v = S0->get_metric (*it,j); + std::cout << "v = " << v << "\n"; + } + } + + XX = SGTELIB::Matrix("XX",pxx,n); + XX.set_random(0,10,false); + ZZ = SGTELIB::Matrix("ZZ" ,pxx,m); + STD = SGTELIB::Matrix("std",pxx,m); + EI = SGTELIB::Matrix("ei" ,pxx,m); + CDF = SGTELIB::Matrix("cdf",pxx,m); + + std::cout << "m,n,p,pxx = " << m << " " << n << " " << p << " " << pxx << "\n"; + std::cout << "predict(XX,&ZZ)...\n"; + S0->predict(XX,&ZZ); + + std::cout << "m,n,p,pxx = " << m << " " << n << " " << p << " " << pxx << "\n"; + std::cout << "predict(XX,&ZZ,&STD,&EI,&CDF)...\n"; + S0->predict(XX,&ZZ,&STD,&EI,&CDF); + std::cout << "Finish!\n"; + } + else{ + std::cout << "Not Ready\n" ; + } + } + + // Free space + SGTELIB::surrogate_delete(S0); + delete C0; + + std::cout << "test_dimension OK for model " << s << "\n"; + std::cout << "======================================================\n"; + return "test_dimension ok\n"; +}// + + +/*----------------------------------------------------*/ +/* TEST rmse */ +/*----------------------------------------------------*/ +std::string SGTELIB::test_rmse (const std::string & s , const SGTELIB::Matrix & X0){ + + std::cout << "======================================================\n"; + std::cout << "SGTELIB::test_rmse\n"; + std::cout << s << "\n"; + + // CONSTRUCT DATA + const int p = X0.get_nb_rows(); + SGTELIB::Matrix Z0 = test_functions(X0); + const int m = Z0.get_nb_cols(); + bool ready; + + // CONSTRUCT MODEL + SGTELIB::TrainingSet C0(X0,Z0); + SGTELIB::Surrogate * S0; + S0 = SGTELIB::Surrogate_Factory(C0,s); + ready = S0->build(); + + if ( ! ready){ + surrogate_delete(S0); + std::cout << "test_rmse: model ("+s+") is not ready\n"; + return "test_rmse: model ("+s+") is not ready\n"; + } + + // Get the rmse + double * rmse = new double [m]; + for (int j=0 ; j<m ; j++){ + rmse[j] = S0->get_metric(SGTELIB::METRIC_RMSE,j); + } + + // GET THE PREDICTION ON THE TP OUTPUT (matrix Zh) + const SGTELIB::Matrix Zh = S0->get_matrix_Zh(); + + // Recompute the prediction on the TP + SGTELIB::Matrix Zh_verif("Zh_verif",p,m); + SGTELIB::Matrix z("z",1,m); + for (int i=0 ; i<p ; i++){ + S0->predict(X0.get_row(i),&z); + Zh_verif.set_row(z,i); + } + + // Recompute the rmse + double * rmse_verif = new double [m]; + double e; + for (int j=0 ; j<m ; j++){ + e = 0; + for (int i=0 ; i<p ; i++){ + e += pow(Z0.get(i,j)-Zh_verif.get(i,j),2); + } + rmse_verif[j] = sqrt(e/p); + } + + // Display + std::ostringstream oss; + oss << "test_rmse\n"; + oss << "Surrogate string: " << s << "\n"; + oss << " j| rmse| rmse_verif| diff|\n"; + oss << "---|--------------|--------------|--------------|\n"; + for (int j=0 ; j<m ; j++){ + oss.width(3); + oss << j << "|"; + oss.width(14); + oss << rmse[j] << "|"; + oss.width(14); + oss << rmse_verif[j] << "|"; + oss.width(14); + oss << rmse[j]-rmse_verif[j] << "|\n"; + if ( fabs(rmse[j]-rmse_verif[j])>1e-6 ){ + oss << "Error! Diff is too big!\n"; + } + } + oss << "---|--------------|--------------|--------------|\n"; + + std::cout << oss.str(); + SGTELIB::surrogate_delete(S0); + delete [] rmse; + delete [] rmse_verif; + + + return oss.str(); +}// + + +/*----------------------------------------------------*/ +/* TEST RMSECV */ +/*----------------------------------------------------*/ +std::string SGTELIB::test_rmsecv (const std::string & s , const SGTELIB::Matrix & X0){ + + std::cout << "======================================================\n"; + std::cout << "SGTELIB::test_rmsecv\n"; + std::cout << s << "\n"; + + // CONSTRUCT DATA + const int p = X0.get_nb_rows(); + const int n = X0.get_nb_cols(); + const SGTELIB::model_t mt = SGTELIB::Surrogate_Parameters::read_model_type(s); + SGTELIB::Matrix Z0 = test_functions(X0); + const int m = Z0.get_nb_cols(); + + #ifdef SGTELIB_DEBUG + X0.display(std::cout); + Z0.display(std::cout); + #endif + + double dmean0, dmeanv, kc0, kcv , xsa0, xsav; + + // CONSTRUCT REFERENCE MODEL + bool ready; + SGTELIB::TrainingSet C0(X0,Z0); + SGTELIB::Surrogate * S0; + S0 = SGTELIB::Surrogate_Factory(C0,s); + ready = S0->build(); + dmean0 = C0.get_Ds_mean(); + xsa0 = C0.get_X_scaling_a(0); + + + // Get original kernel coefficient + kc0 = 0.0; + S0->get_param().get_kernel_coef(); + + // Check ready + if ( ! ready){ + surrogate_delete(S0); + std::cout << "test_rmsecv: model ("+s+") is not ready\n"; + return "test_rmsecv: model ("+s+") is not ready\n"; + } + + // Get the RMSECV metric + double * rmsecv = new double [m]; + double * rmse = new double [m]; + for (int j=0 ; j<m ; j++){ + rmsecv[j] = S0->get_metric(SGTELIB::METRIC_RMSECV,j); + rmse[j] = S0->get_metric(SGTELIB::METRIC_RMSE,j); + } + // Delete the original model + SGTELIB::surrogate_delete(S0); + + // INIT THE CROSS VALIDATION MATRICES + SGTELIB::Matrix X0i ("X0i",p-1,n); + SGTELIB::Matrix Z0i ("Z0i",p-1,m); + for (int i=1 ; i<p ; i++){ + // Skip the first line + X0i.set_row(X0.get_row(i),i-1); + Z0i.set_row(Z0.get_row(i),i-1); + } + + // Cross-validation models and trainingset + SGTELIB::Surrogate * Sv; + SGTELIB::TrainingSet * Cv; + + // Output for one point + SGTELIB::Matrix Zvi ("Zvi",1,m); + + // Cross validation output for all the training points: + // (Supposed to be identical to _Zv of class Surrogate) + SGTELIB::Matrix Zv_verif ("Zv_verif",p,m); + + // BUILD THE CV MODELS + for (int i=0 ; i<p ; i++){ + // Build the trainingset (without point i); + Cv = new SGTELIB::TrainingSet(X0i,Z0i); + Cv->build(); + dmeanv = Cv->get_Ds_mean(); + xsav = Cv->get_X_scaling_a(0); + // Init surrogate + Sv = SGTELIB::Surrogate_Factory(*Cv,s); + // Correct ks for RBF and KS + kcv = kc0*(dmeanv/dmean0)*(xsa0/xsav); + if (mt==SGTELIB::RBF) static_cast<SGTELIB::Surrogate_RBF*>(Sv)->set_kernel_coef(kcv); + if (mt==SGTELIB::KS) static_cast<SGTELIB::Surrogate_KS* >(Sv)->set_kernel_coef(kcv); + // Build + Sv->build(); + // Do the prediction on point i + Sv->predict(X0.get_row(i),&Zvi); + Zv_verif.set_row(Zvi,i); + // update the matrices so that they lack the point i+1 + if (i<p-1){ + X0i.set_row(X0.get_row(i),i); + Z0i.set_row(Z0.get_row(i),i); + } + delete Cv; + surrogate_delete(Sv); + } + + + // Re-Compute the rmsecv + double * rmsecv_verif = new double [m]; + double e; + for (int j=0 ; j<m ; j++){ + e = 0; + for (int i=0 ; i<p ; i++){ + e += pow(Z0.get(i,j)-Zv_verif.get(i,j),2); + } + rmsecv_verif[j] = sqrt(e/p); + } + + // Display + double d; + std::ostringstream oss; + oss << "Surrogate string: " << s << "\n"; + oss << " j| rmse|| rmsecv| rmsecv_verif| rel diff|\n"; + oss << "---|--------------||--------------|--------------|--------------|\n"; + for (int j=0 ; j<m ; j++){ + oss.width(3); + oss << j << "|"; + oss.width(14); + oss << rmse[j] << "||"; + oss.width(14); + oss << rmsecv[j] << "|"; + oss.width(14); + oss << rmsecv_verif[j] << "|"; + oss.width(14); + d = 2*fabs(rmsecv[j]-rmsecv_verif[j])/(rmsecv[j]+rmsecv_verif[j]); + oss << d << "|\n"; + if (d>0.01){ + oss << "Error! Diff is too big!\n"; + } + } + oss << "---|--------------||--------------|--------------|--------------|\n"; + + delete [] rmse; + delete [] rmsecv; + delete [] rmsecv_verif; + + std::cout << oss.str(); + return oss.str(); +}// + + + +/*----------------------------------------------------*/ +/* TEST MULTIPLE */ +/*----------------------------------------------------*/ +std::string SGTELIB::test_multiple_occurrences (const std::string & s ){ + + std::cout << "======================================================\n"; + std::cout << "SGTELIB::test_multiple_occurences\n"; + std::cout << s << "\n"; + + // CONSTRUCT DATA + const int p = 20; + const int n = 2; + + // Build X0 + SGTELIB::Matrix X0 ("X0",p,n); + X0.set_random(-3,+8,false); + // Build Z0 + SGTELIB::Matrix Z0 = test_functions(X0); + const int m = Z0.get_nb_cols(); + // Create multiple occurences in X0 + X0.set_row( X0.get_row(0) , 1 ); + X0.set_row( X0.get_row(0) , 2 ); + X0.set_row( X0.get_row(10) , 11 ); + + #ifdef SGTELIB_DEBUG + X0.display(std::cout); + Z0.display(std::cout); + #endif + + // CONSTRUCT REFERENCE MODEL + bool ready; + SGTELIB::TrainingSet C0(X0,Z0); + SGTELIB::Surrogate * S0; + S0 = SGTELIB::Surrogate_Factory(C0,s); + ready = S0->build(); + + // Some data to correct the kernel coef in KS and RBF. + const SGTELIB::model_t mt = SGTELIB::Surrogate_Parameters::read_model_type(s); + double dmean0, dmeanv, kc0, kcv , xsa0, xsav; + dmean0 = C0.get_Ds_mean(); + xsa0 = C0.get_X_scaling_a(0); + // Get original kernel coefficient + kc0 = 0.0; + kc0 = S0->get_param().get_kernel_coef(); + + + // Check ready + if ( ! ready){ + surrogate_delete(S0); + std::cout << "test_rmsecv: model ("+s+") is not ready\n"; + return "test_rmsecv: model ("+s+") is not ready\n"; + } + + // Get the RMSECV metric + double * rmsecv = new double [m]; + double * rmse = new double [m]; + for (int j=0 ; j<m ; j++){ + rmsecv[j] = S0->get_metric(SGTELIB::METRIC_RMSECV,j); + rmse[j] = S0->get_metric(SGTELIB::METRIC_RMSE,j); + } + // Delete the original model + SGTELIB::surrogate_delete(S0); + + // INIT THE CROSS VALIDATION MATRICES + SGTELIB::Matrix X0i ("X0i",p-1,n); + SGTELIB::Matrix Z0i ("Z0i",p-1,m); + for (int i=1 ; i<p ; i++){ + // Skip the first line + X0i.set_row(X0.get_row(i),i-1); + Z0i.set_row(Z0.get_row(i),i-1); + } + + // Cross-validation models and trainingset + SGTELIB::Surrogate * Sv; + SGTELIB::TrainingSet * Cv; + + // Output for one point + SGTELIB::Matrix Zvi ("Zvi",1,m); + + // Cross validation output for all the training points: + // (Supposed to be identical to _Zv of class Surrogate) + SGTELIB::Matrix Zv_verif ("Zv_verif",p,m); + + + //std::cout << "SGTELIB::CV\n"; + // BUILD THE CV MODELS + for (int i=0 ; i<p ; i++){ + std::cout << "BUILD CV MODELS " << i << "\n"; + // Build the trainingset (without point i); + Cv = new SGTELIB::TrainingSet(X0i,Z0i); + Cv->build(); + dmeanv = Cv->get_Ds_mean(); + xsav = Cv->get_X_scaling_a(0); + // Init surrogate + Sv = SGTELIB::Surrogate_Factory(*Cv,s); + + // Correct ks for RBF and KS + kcv = kc0*(dmeanv/dmean0)*(xsa0/xsav); + if (mt==SGTELIB::RBF) static_cast<SGTELIB::Surrogate_RBF*>(Sv)->set_kernel_coef(kcv); + if (mt==SGTELIB::KS) static_cast<SGTELIB::Surrogate_KS* >(Sv)->set_kernel_coef(kcv); + // Build + Sv->build(); + + // Do the prediction on point i + Sv->predict(X0.get_row(i),&Zvi); + Zv_verif.set_row(Zvi,i); + + // update the matrices so that they lack the point i+1 + if (i<p-1){ + X0i.set_row(X0.get_row(i),i); + Z0i.set_row(Z0.get_row(i),i); + } + + delete Cv; + surrogate_delete(Sv); + } + + + // Re-Compute the rmsecv + double * rmsecv_verif = new double [m]; + double e; + for (int j=0 ; j<m ; j++){ + e = 0; + for (int i=0 ; i<p ; i++){ + e += pow(Z0.get(i,j)-Zv_verif.get(i,j),2); + } + rmsecv_verif[j] = sqrt(e/p); + } + + // Display + double d; + std::ostringstream oss; + oss << "Surrogate string: " << s << "\n"; + oss << " j| rmse|| rmsecv| rmsecv_verif| rel diff|\n"; + oss << "---|--------------||--------------|--------------|--------------|\n"; + for (int j=0 ; j<m ; j++){ + oss.width(3); + oss << j << "|"; + oss.width(14); + oss << rmse[j] << "||"; + oss.width(14); + oss << rmsecv[j] << "|"; + oss.width(14); + oss << rmsecv_verif[j] << "|"; + oss.width(14); + d = 2*fabs(rmsecv[j]-rmsecv_verif[j])/(rmsecv[j]+rmsecv_verif[j]); + oss << d << "|\n"; + if (d>0.01){ + oss << "Error! Diff is too big!\n"; + } + } + oss << "---|--------------||--------------|--------------|--------------|\n"; + + delete [] rmse; + delete [] rmsecv; + delete [] rmsecv_verif; + + std::cout << oss.str(); + + return oss.str(); +}// + + + + + + +/*----------------------------------------------------*/ +/* test functions */ +/*----------------------------------------------------*/ +SGTELIB::Matrix SGTELIB::test_functions (const SGTELIB::Matrix & X){ + + const int n = X.get_nb_cols(); // Input dim + const int p = X.get_nb_rows(); // Nb of points + const int m = 6; // There are 6 test functions, ie 6 outputs + + SGTELIB::Matrix T ("T" ,p,1); // Aggregate input + SGTELIB::Matrix ZT ("ZT",p,1); // 1 output + + + const double div = 1.0/double(n); + + // Build matrix SX + SGTELIB::Matrix SX ("SX",p,1); // Sum of x for each point + for (int j=0 ; j<n ; j++){ + SX = SX + X.get_col(j); + } + SX = SX * div; + + // Build m + SGTELIB::Matrix Z ("Z",p,m); + + for (int j=0 ; j<m ; j++){ + ZT.fill(0.0); + for (int i=0 ; i<n ; i++){ + if (i==0){ + T = SX; + } + else{ + T = SX - X.get_col(i) * 2 * div; + } + ZT = ZT + test_functions_1D (T,j); + } + ZT = ZT * div; + Z.set_col(ZT,j); + } + return Z; +}// + +/*----------------------------------------------------*/ +/* Create some 1D test functions */ +/*----------------------------------------------------*/ +double SGTELIB::test_functions_1D (const double t, const int function_index){ + + switch (function_index){ + case 0: + return 6.0*t*t + t - 1.0; // Quad function + case 1: + return t/(1.0+fabs(5.0*t)); // Sigmoid + case 2: + return 0.5-exp(-10*t*t); // bump + case 3: + return 0.5-((t>-0.2) && (t<0.5)); // square + case 4: + return 5.0*t-17.0*pow(t,3)+13*pow(t,5); // Oscillations/polynomial + case 5: + return sin(6.0*t)+cos(15.0*sqrt(fabs(t))); // Difficult function + default: + std::cout << "function_index : " << function_index << "\n"; + throw SGTELIB::Exception ( __FILE__ , __LINE__ ,"test_function_1D : function_index not recognized" ); + } +}// + + +/*----------------------------------------------------*/ +/* Create some 1D test functions */ +/*----------------------------------------------------*/ +SGTELIB::Matrix SGTELIB::test_functions_1D (const SGTELIB::Matrix & T, const int function_index){ + if (T.get_nb_cols()!=1){ + throw SGTELIB::Exception ( __FILE__ , __LINE__ ,"test_function_1D : only for column vector!" ); + } + const int p = T.get_nb_rows(); + SGTELIB::Matrix Z ("Z(T)",p,1); + for (int i=0 ; i<p ; i++){ + Z.set(i,0,test_functions_1D(T.get(i,0),function_index)); + } + return Z; +}// + + +/*----------------------------------------------------*/ +/* Check differences between two matrices */ +/*----------------------------------------------------*/ +void SGTELIB::check_matrix_diff(const SGTELIB::Matrix * A, const SGTELIB::Matrix * B){ + // Check not NULL + if ( ! A){ + std::cout << "A is NULL\n"; + throw SGTELIB::Exception ( __FILE__ , __LINE__ ,"check_matrix_diff : A is NULL" ); + } + if ( ! B){ + std::cout << "B is NULL\n"; + throw SGTELIB::Exception ( __FILE__ , __LINE__ ,"check_matrix_diff : B is NULL" ); + } + + // Check dimension + if (A->get_nb_rows()!=B->get_nb_rows()){ + std::cout << "Different number of rows !! " << A->get_nb_rows() << " " << B->get_nb_rows() << "\n"; + throw SGTELIB::Exception ( __FILE__ , __LINE__ ,"check_matrix_diff : != nb of rows" ); + } + const int m = A->get_nb_rows(); + if (A->get_nb_cols()!=B->get_nb_cols()){ + std::cout << "Different number of cols !! " << A->get_nb_cols() << " " << B->get_nb_cols() << "\n"; + throw SGTELIB::Exception ( __FILE__ , __LINE__ ,"check_matrix_diff : != nb of cols" ); + } + const int n = A->get_nb_cols(); + + double va,vb,dab; + bool eij = false; // true if there is a problem with value (i,j) + bool e = false; // true if there is a problem, anywhere in the matrices + + for (int i=0 ; i<m ; i++){ + for (int j=0 ; j<n ; j++){ + va = A->get(i,j); + vb = B->get(i,j); + eij = false; + dab = fabs(va-vb)/std::max( 0.5*(fabs(va)+fabs(vb)) , 1.0); + if (dab>1e-6){ + eij = true; + std::cout << "diff is too big !\n"; + } + if (isnan(va)){ + eij = true; + std::cout << "va is nan !\n"; + } + if (isnan(vb)){ + eij = true; + std::cout << "vb is nan !\n"; + } + if (isinf(va)){ + eij = true; + std::cout << "va is inf !\n"; + } + if (isinf(vb)){ + eij = true; + std::cout << "vb is inf !\n"; + } + if (eij){ + e = true; + std::cout << "A(" << i << "," << j << ") = " << va << "\n"; + std::cout << "B(" << i << "," << j << ") = " << vb << "\n"; + std::cout << "diff = " << fabs(va-vb) << "\n"; + std::cout << "dab = " << dab << "\n"; + } + } + } + if (e){ + A->display(std::cout); + B->display(std::cout); + } + + +}// + + + + + + + + + +/*----------------------------------------------------*/ +/* build test data */ +/*----------------------------------------------------*/ +void SGTELIB::build_test_data ( const std::string & function_name , + SGTELIB::Matrix & X0 , + SGTELIB::Matrix & Z0 ){ + + int p = 0; + int n = 0; + int m = 0; + + if ( (function_name=="hartman3") || (function_name=="hartman6") ){ + int q = 0; + SGTELIB::Matrix B,D; + std::string B_str,D_str; + if (function_name=="hartman3"){ + B_str = "3.0 10.0 30.0 ;" + "0.1 10.0 35.0 ;" + "3.0 10.0 30.0 ;" + "0.1 10.0 35.0 ;"; + + D_str = "0.3689 0.1170 0.2673 ;" + "0.4699 0.4387 0.7470 ;" + "0.1091 0.8732 0.5547 ;" + "0.03815 0.5743 0.8828 ;"; + } + else if (function_name=="hartman6"){ + B_str = "10.0 3.0 17.0 3.5 1.7 8.0 ;" + "0.05 10.0 17.0 0.1 8.0 14.0 ;" + "3.0 3.5 1.7 10.0 17.0 8.0 ;" + "17.0 8.0 0.05 10.0 0.1 14.0 ;"; + + D_str = "0.1312 0.1696 0.5569 0.0124 0.8283 0.5886 ;" + "0.2329 0.4135 0.8307 0.3736 0.1004 0.9991 ;" + "0.2348 0.1451 0.3522 0.2883 0.3047 0.6650 ;" + "0.4047 0.8828 0.8732 0.5743 0.1091 0.0381 ;"; + } + + B = SGTELIB::Matrix::string_to_matrix(B_str); + D = SGTELIB::Matrix::string_to_matrix(D_str); + n = B.get_nb_cols(); + q = B.get_nb_rows(); + m = 1; + + p = 100*(n+1); + X0 = SGTELIB::Matrix("X0",p,n); + Z0 = SGTELIB::Matrix("Z0",p,m); + X0.set_random(0.0,1.0,false); + + double zi,eik,ak=0; + for (int i=0 ; i<p ; i++){ + zi = 0; + for (int k=0 ; k<q ; k++){ + eik = 0; + for (int j=0 ; j<n ; j++){ + eik -= B.get(k,j)*pow(X0.get(i,j)-D.get(k,j),2.0); + } + switch (k){ + case 0: ak=1.0; break; + case 1: ak=1.2; break; + case 2: ak=3.0; break; + case 3: ak=3.2; break; + } + zi -= ak * exp(eik); + } + Z0.set(i,0,zi); + } + return; + }// end hartman + + + if ((function_name=="branin-hoo") || (function_name=="braninhoo")) { + n = 2; + m = 1; + p = 100*(n+1); + X0 = SGTELIB::Matrix("X0",p,n); + Z0 = SGTELIB::Matrix("Z0",p,m); + X0.set_random(0.0,1.0,false); + X0.set_col(-5.0+15.0*X0.get_col(0),0); + X0.set_col( 0.0+15.0*X0.get_col(1),1); + #ifdef SGTELIB_DEBUG + X0.display(std::cout); + #endif + + double zi,x1,x2; + for (int i=0 ; i<p ; i++){ + x1 = X0.get(i,0); + x2 = X0.get(i,1); + zi = pow(x2-5.1*x1*x1*.25/PI+5.*x1/PI-6.,2.) + 10.*(1.-1./(8.*PI))*cos(x1) + 10.; + Z0.set(i,0,zi); + } + return; + }// end branin-hoo + + + + if (function_name=="camelback") { + n = 2; + m = 1; + p = 100*(n+1); + X0 = SGTELIB::Matrix("X0",p,n); + Z0 = SGTELIB::Matrix("Z0",p,m); + X0.set_random(0.0,1.0,false); + X0.set_col(-3.0+6.0*X0.get_col(0),0); + X0.set_col(-2.0+4.0*X0.get_col(1),1); + #ifdef SGTELIB_DEBUG + X0.display(std::cout); + #endif + + double zi,x1,x2; + for (int i=0 ; i<p ; i++){ + x1 = X0.get(i,0); + x2 = X0.get(i,1); + zi = (pow(x1,4.)/3.-2.1*x1*x1+4.)*x1*x1 + x1*x2 + (4.*x2*x2-4.)*x2*x2; + Z0.set(i,0,zi); + } + return; + }// end camelback + + + if (function_name=="rosenbrock") { + n = 2; + m = 1; + p = 100*(n+1); + X0 = SGTELIB::Matrix("X0",p,n); + Z0 = SGTELIB::Matrix("Z0",p,m); + X0.set_random(0.0,1.0,false); + X0 = -5.+15.*X0; + #ifdef SGTELIB_DEBUG + X0.display(std::cout); + #endif + + double zi,xj,xjp; + for (int i=0 ; i<p ; i++){ + zi = 0; + for (int j=0 ; j<n-1 ; j++){ + xj = X0.get(i,j); + xjp = X0.get(i,j+1); + zi += pow(1-xj,2)+100*pow(xjp-xj*xj,2); + } + Z0.set(i,0,zi); + } + return; + }// end camelback + + + throw SGTELIB::Exception ( __FILE__ , __LINE__ ,"build_test_data : function name not recognized" ); + +} + + diff --git a/ext/sgtelib/src/Tests.hpp b/ext/sgtelib/src/Tests.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d43ef568a9409c4db929f62413843408a9f8a6c2 --- /dev/null +++ b/ext/sgtelib/src/Tests.hpp @@ -0,0 +1,74 @@ +/*-------------------------------------------------------------------------------------*/ +/* sgtelib - A surrogate model library for derivative-free optimization */ +/* Version 2.0.1 */ +/* */ +/* Copyright (C) 2012-2017 Sebastien Le Digabel - Ecole Polytechnique, Montreal */ +/* Bastien Talgorn - McGill University, Montreal */ +/* */ +/* Author: Bastien Talgorn */ +/* email: bastientalgorn@fastmail.com */ +/* */ +/* This program is free software: you can redistribute it and/or modify it under the */ +/* terms of the GNU Lesser General Public License as published by the Free Software */ +/* Foundation, either version 3 of the License, or (at your option) any later */ +/* version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ +/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ +/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License along */ +/* with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on sgtelib at https://github.com/bastientalgorn/sgtelib */ +/*-------------------------------------------------------------------------------------*/ + +#ifndef __SGTELIB_TESTS__ +#define __SGTELIB_TESTS__ + +#include "sgtelib.hpp" + +namespace SGTELIB { + + void sand_box (void); + + // test_quick: build the surrogate and compute the metrics + std::string test_quick (const std::string & s , const SGTELIB::Matrix & X0 ); + // test_rmsecv: build the surrogate, then build all the CV models and verif the RMSECV + std::string test_rmsecv (const std::string & s , const SGTELIB::Matrix & X0 ); + // test_rmse: build the surrogate, then perform prediction on the TP to verif rmse + std::string test_rmse (const std::string & s , const SGTELIB::Matrix & X0 ); + // test_update: build a surrogate all-at-once, or point-by-point + std::string test_update(const std::string & s , const SGTELIB::Matrix & X0 ); + // test_pxx: build a surrogate and perform prediction on XX of various sizes + // (especially pxx > _p) + std::string test_pxx (const std::string & s , const SGTELIB::Matrix & X0 ); + // test_scale: build 2 surrogates with a different scale on the data. + std::string test_scale (const std::string & s , const SGTELIB::Matrix & X0 ); + // test_dimension: build surrogates with various sizes of p,n,m to check for dimension errors + std::string test_dimension (const std::string & s ); + // test_singular_data (if there are constant inputs, or outputs or Nan outputs) + std::string test_singular_data (const std::string & s ); + std::string test_multiple_occurrences (const std::string & s ); + + // test_scale: build 2 surrogates with a different scale on the data. + void test_many_models ( const std::string & out_file , const SGTELIB::Matrix & X0 , const SGTELIB::Matrix & Z0 ); + + + void test_LOWESS_times (void); + + // analyse ensembl + void analyse_ensemble ( const std::string & s ); + + SGTELIB::Matrix test_functions (const SGTELIB::Matrix & X); + SGTELIB::Matrix test_functions_1D (const SGTELIB::Matrix & T, const int function_index); + double test_functions_1D (const double t, const int function_index); + void check_matrix_diff (const SGTELIB::Matrix * A, const SGTELIB::Matrix * B); + + + void build_test_data ( const std::string & function_name , SGTELIB::Matrix & X0 , SGTELIB::Matrix & Z0 ); + + +} + +#endif diff --git a/ext/sgtelib/src/TrainingSet.cpp b/ext/sgtelib/src/TrainingSet.cpp new file mode 100644 index 0000000000000000000000000000000000000000..604d31104dc72dbe93d5d2526988a2693cebc407 --- /dev/null +++ b/ext/sgtelib/src/TrainingSet.cpp @@ -0,0 +1,1436 @@ +/*-------------------------------------------------------------------------------------*/ +/* sgtelib - A surrogate model library for derivative-free optimization */ +/* Version 2.0.1 */ +/* */ +/* Copyright (C) 2012-2017 Sebastien Le Digabel - Ecole Polytechnique, Montreal */ +/* Bastien Talgorn - McGill University, Montreal */ +/* */ +/* Author: Bastien Talgorn */ +/* email: bastientalgorn@fastmail.com */ +/* */ +/* This program is free software: you can redistribute it and/or modify it under the */ +/* terms of the GNU Lesser General Public License as published by the Free Software */ +/* Foundation, either version 3 of the License, or (at your option) any later */ +/* version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ +/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ +/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License along */ +/* with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on sgtelib at https://github.com/bastientalgorn/sgtelib */ +/*-------------------------------------------------------------------------------------*/ + +#include "TrainingSet.hpp" +using namespace SGTELIB; + +/*--------------------------------------*/ +/* constructor */ +/*--------------------------------------*/ +SGTELIB::TrainingSet::TrainingSet ( const Matrix & X , + const Matrix & Z ) : + _p ( X.get_nb_rows() ) , // Nb of points + _n ( X.get_nb_cols() ) , // Nb of input + _m ( Z.get_nb_cols() ) , // Nb of output + _ready ( false ) , + _bbo ( new bbo_t [_m] ) , // Types of output (OBJ, CON or DUM) + _bbo_is_def ( false ) , // Allows to know if _bbo has been def + _j_obj ( 0 ) , // Index of the output that represents the objective + _f_min ( INF ) , + _fs_min ( INF ) , + _i_min ( 0 ) , // Index of the point where f_min is reached + _X ( X ) , // Input Data + _Z ( Z ) , // Output Data + _Xs ( "TrainingSet._Xs" , _p , _n ) , // Normalized Input Data + _Zs ( "TrainingSet._Zs" , _p , _m ) , // Normalized Output Data + _Ds ( "TrainingSet._Ds" , _p , _p ) , // Nb of varying input + _nvar ( -1 ) , // Nb of varying output + _mvar ( -1 ) , + _pvar ( -1 ) , + _X_lb ( new double [_n] ) , + _X_ub ( new double [_n] ) , + _X_scaling_a ( new double [_n] ) , + _X_scaling_b ( new double [_n] ) , + _X_mean ( new double [_n] ) , + _X_std ( new double [_n] ) , + _X_nbdiff ( new int [_n] ) , + _X_nbdiff1 ( 0 ) , + _X_nbdiff2 ( 0 ) , + _Z_lb ( new double [_m] ) , + _Z_ub ( new double [_m] ) , + _Z_replace ( new double [_m] ) , + _Z_scaling_a ( new double [_m] ) , + _Z_scaling_b ( new double [_m] ) , + _Z_mean ( new double [_m] ) , // Mean of each output + _Z_std ( new double [_m] ) , + _Zs_mean ( new double [_m] ) , // Mean of each normalized output + _Z_nbdiff ( new int [_m] ) , + _Ds_mean ( 0.0 ) { + + // Init bounds + for (int i=0 ; i<_n ; i++){ + _X_lb[i] = 0; + _X_ub[i] = 0; + } + for (int j=1 ; j<_m ; j++){ + _Z_lb[j] = 0; + _Z_ub[j] = 0; + } + + // Init the _bbo with standard values: + // First is the objective, + // Then constraints + _bbo[0] = BBO_OBJ; + for (int j=1 ; j<_m ; j++){ + _bbo[j] = BBO_CON; + _Z_lb[j] = 0; + _Z_ub[j] = 0; + } + +}// + + + + + +/*---------------------------*/ +/* copy constructor */ +/*---------------------------*/ + +SGTELIB::TrainingSet::TrainingSet ( const TrainingSet & C ) : + _p ( C._p ) , + _n ( C._n ) , + _m ( C._m ) { + info(); + throw Exception ( __FILE__ , __LINE__ , + "TrainingSet: copy constructor forbiden." ); + +}// + + + + +/*--------------------------------------*/ +/* info (debug) */ +/*--------------------------------------*/ +void SGTELIB::TrainingSet::info (void) const{ + std::cout << " ## ## TrainingSet::info " << this << " " << _ready << " " << _p << "\n"; +} + +/*--------------------------------------*/ +/* destructor */ +/*--------------------------------------*/ +SGTELIB::TrainingSet::~TrainingSet ( void ) { + #ifdef SGTELIB_DEBUG + std::cout << " ## ## Delete TrainingSet " << this << "\n"; + #endif + delete [] _bbo; + delete [] _X_lb; + delete [] _X_ub; + delete [] _X_scaling_a; + delete [] _X_scaling_b; + delete [] _X_mean; + delete [] _X_std; + delete [] _X_nbdiff; + delete [] _Z_lb; + delete [] _Z_ub; + delete [] _Z_replace; + delete [] _Z_scaling_a; + delete [] _Z_scaling_b; + delete [] _Z_mean; + delete [] _Z_std; + delete [] _Zs_mean; + delete [] _Z_nbdiff; +}// + +/*--------------------------------------*/ +/* operator = */ +/*--------------------------------------*/ +SGTELIB::TrainingSet & SGTELIB::TrainingSet::operator = ( const SGTELIB::TrainingSet & A ) { + A.info(); + throw Exception ( __FILE__ , __LINE__ , + "TrainingSet: operator \"=\" forbiden." ); + return *this; +} + + +/*--------------------------------------*/ +/* Set bbo type */ +/*--------------------------------------*/ +void SGTELIB::TrainingSet::set_bbo_type (const std::string & line){ + // BBOT must be separated by space + + if (_bbo_is_def){ + throw Exception ( __FILE__ , __LINE__ , + "TrainingSet::set_bbo_type: _bbo must be defined before the first build." ); + } + #ifdef SGTELIB_DEBUG + std::cout << "SGTELIB::TrainingSet::set_bbo_type\n"; + std::cout << "Input string: \"" << line << "\"\n"; + #endif + + std::string s; + std::istringstream in_line (line); + + int j = 0; + while (in_line.good()){ + in_line >> s; + if (j>=_m){ + throw Exception ( __FILE__ , __LINE__ , + "TrainingSet::set_bbo_type: string error (j>_m)" ); + } + if ( (streqi(s,"OBJ")) || (streqi(s,"O")) ){ + _bbo[j] = BBO_OBJ; + _j_obj = j; + } + else if ( (streqi(s,"CON")) || (streqi(s,"C")) ){ + _bbo[j] = BBO_CON; + } + else if ( (streqi(s,"DUM")) || (streqi(s,"D")) ){ + _bbo[j] = BBO_DUM; + } + else{ + throw Exception ( __FILE__ , __LINE__ , + "TrainingSet::set_bbo_type: string error (string "+s+" not recognized)" ); + } + j++; + } + + // Check the number of OBJ + double n = 0; + for (j=0 ; j<_m ; j++){ + if (_bbo[j] == BBO_OBJ){ + n++; + } + } + if (n>1){ + throw Exception ( __FILE__ , __LINE__ , + "TrainingSet::set_bbo_type: Only one obj is allowed" ); + } + + // Check the number of OBJ+CON + for (j=0 ; j<_m ; j++){ + if (_bbo[j] == BBO_CON){ + n++; + } + } + if (n==0){ + throw Exception ( __FILE__ , __LINE__ , + "TrainingSet::set_bbo_type: all outputs are \"DUM\"" ); + } + + #ifdef SGTELIB_DEBUG + std::cout << "Output types:\n"; + for (j=0 ; j<_m ; j++){ + std::cout << j << ": " << bbo_type_to_str(_bbo[j]) << "\n"; + } + #endif + + // nb: this method is supposed to be used only once, in the begining. + // Plus, it may have big changes on the results, so this changes the + // trainingset to "not ready". + _fs_min = INF; + _f_min = INF; + _bbo_is_def = true; + _ready = false; +}// + +/*--------------------------------------*/ +/* Construct */ +/*--------------------------------------*/ +void SGTELIB::TrainingSet::build ( void ){ + + + + // check the dimensions: + if ( _X.get_nb_rows() != _Z.get_nb_rows() ) + throw Exception ( __FILE__ , __LINE__ , + "TrainingSet::build(): dimension error" ); + + // Check number of points + if ( _p < 1 ) + throw Exception ( __FILE__ , __LINE__ , + "TrainingSet::build(): empty training set"); + + if ( ! _ready){ + #ifdef SGTELIB_DEBUG + std::cout << "TrainingSet::build BEGIN, X:(" << _p << "," << _n << ") Z:(" << _p << "," << _m << ")\n"; + #endif + + // Compute the number of varying input and output + compute_nbdiff(_X,_X_nbdiff,_nvar); + compute_nbdiff(_Z,_Z_nbdiff,_mvar); + + // Compute the number of input dimension for which + // nbdiff is greater than 1 (resp. greater than 2). + _X_nbdiff1 = 0; + _X_nbdiff2 = 0; + for (int j=0 ; j<_n ; j++){ + if (_X_nbdiff[j]>1) _X_nbdiff1++; + if (_X_nbdiff[j]>2) _X_nbdiff2++; + } + + // Check singular data (inf and void) + check_singular_data(); + + // Compute scaling values + compute_scaling(); + + // Compute scaled matrices + compute_scaled_matrices(); + + // Build matrix of distances between each pair of points + compute_Ds(); + + // Compute fs_min + compute_f_min(); + + // The training set is now ready! + _ready = true; + + #ifdef SGTELIB_DEBUG + std::cout << "TrainingSet::build END\n"; + #endif + } + + // _bbo is considered as defined. It can not be modified anymore. + _bbo_is_def = true; + +}// + + +/*--------------------------------------*/ +/* Check if the training set is ready */ +/*--------------------------------------*/ +void SGTELIB::TrainingSet::check_ready (void) const{ + if ( ! _ready){ + std::cout << "TrainingSet: NOT READY!\n"; + throw Exception ( __FILE__ , __LINE__ , "TrainingSet::check_ready(): TrainingSet not ready. Use method TrainingSet::build()" ); + } +}// +/*--------------------------------------*/ +void SGTELIB::TrainingSet::check_ready (const std::string & file, + const std::string & function, + const int & i ) const { + check_ready(file+"::"+function+":"+itos(i)); +}// +/*--------------------------------------*/ +void SGTELIB::TrainingSet::check_ready (const std::string & s) const{ + if ( ! _ready){ + std::cout << "TrainingSet: NOT READY! (" << s << ")\n"; + throw Exception ( __FILE__ , __LINE__ , "TrainingSet::check_ready(): TrainingSet not ready. Use method TrainingSet::build()" ); + } +}// + + +/*--------------------------------------*/ +/* add_points */ +/*--------------------------------------*/ +bool SGTELIB::TrainingSet::add_points ( const Matrix & Xnew , + const Matrix & Znew ) { + + // Check dim + if ( Xnew.get_nb_rows() != Znew.get_nb_rows() || Xnew.get_nb_cols() != _n || Znew.get_nb_cols() != _m ){ + throw Exception ( __FILE__ , __LINE__ , "TrainingSet::add_points(): dimension error" ); + } + + // Check for nan + if (Xnew.has_nan()){ + throw Exception ( __FILE__ , __LINE__ , "TrainingSet::add_points(): Xnew is nan" ); + } + if (Znew.has_nan()){ + throw Exception ( __FILE__ , __LINE__ , "TrainingSet::add_points(): Znew is nan" ); + } + + // Add the points in the trainingset + _X.add_rows(Xnew); + _Z.add_rows(Znew); + + // Add empty rows + int pnew = Xnew.get_nb_rows(); + _Xs.add_rows(pnew); + _Zs.add_rows(pnew); + _Ds.add_rows(pnew); + _Ds.add_cols(pnew); + // Update p + _p += pnew; + // Note that the trainingset needs to be updated. + _ready = false; + + return true; +}// + +/*--------------------------------------*/ +/* add_point */ +/*--------------------------------------*/ +bool SGTELIB::TrainingSet::add_point ( const double * xnew , + const double * znew ) { + + return add_points ( Matrix::row_vector ( xnew , _n ), + Matrix::row_vector ( znew , _m ) ); +}// + + +/*---------------------------------------------------*/ +/* compute the mean and std over */ +/* the columns of a matrix */ +/*---------------------------------------------------*/ +void SGTELIB::TrainingSet::check_singular_data ( void ){ + + int i,j; + bool e = false; + // Check that all the _X data are defined + for ( j = 0 ; j < _n ; j++ ) { + for ( i = 0 ; i < _p ; i++ ) { + if ( ! isdef(_X.get(i,j))){ + std::cout << "_X(" << i << "," << j << ") = " << _X.get(i,j) << "\n"; + e = true; + } + } + } + + // Check that, for each output index, SOME data are defined + bool isdef_Zj; // True if at least one value is defined for output j. + // Loop on the output indexes + for ( j = 0 ; j < _m ; j++ ) { + // no def value so far + isdef_Zj = false; + for ( i = 0 ; i < _p ; i++ ) { + if (isdef(_Z.get(i,j))){ + isdef_Zj = true; + break; + } + } + // if there is more than 10 points and no correct value was found, return an error. + if ( (_p>10) && ( ! isdef_Zj) ){ + std::cout << "_Z(:," << j << ") has no defined value !\n"; + e = true; + } + } + + if (e){ + throw Exception ( __FILE__ , __LINE__ , "TrainingSet::check_singular_data(): incorrect data !" ); + } + +}// + +/*---------------------------------------------------*/ +/* compute the mean and std over */ +/* the columns of a matrix */ +/*---------------------------------------------------*/ +void SGTELIB::TrainingSet::compute_mean_std ( void ){ + + int i,j; + double v, mu, var; + // Loop on the inputs + for ( j=0 ; j<_n ; j++ ) { + // Loop on lines for MEAN computation + mu = 0; + for ( i=0 ; i<_p ; i++ ) { + mu += _X.get(i,j); + } + mu /= _p; + _X_mean[j] = mu; + // Loop on lines for VAR computation + var = 0; + for ( i=0 ; i<_p ; i++ ) { + v = _X.get(i,j); + var += (v-mu)*(v-mu); + } + var /= (_p-1); + _X_std[j] = sqrt(var); + } + + // Loop on the outputs + for ( j=0 ; j<_m ; j++ ) { + // Loop on lines for MEAN computation + mu = 0; + for ( i=0 ; i<_p ; i++ ) { + v = _Z.get(i,j); + if ( ! isdef(v)) v = _Z_replace[j]; + mu += v; + } + mu /= _p; + _Z_mean[j] = mu; + // Loop on lines for VAR computation + var = 0; + for ( i=0 ; i<_p ; i++ ) { + v = _Z.get(i,j); + if ( ! isdef(v)) v = _Z_replace[j]; + var += (v-mu)*(v-mu); + } + var /= (_p-1); + _Z_std[j] = sqrt(var); + } + +}// + +/*---------------------------------------------------*/ +/* compute the bounds over */ +/* the columns of a matrix */ +/*---------------------------------------------------*/ +void SGTELIB::TrainingSet::compute_bounds ( void ){ + + int i,j; + double v; + + // Bound of X + for ( j=0 ; j<_n ; j++ ) { + _X_lb[j] = +INF; + _X_ub[j] = -INF; + // Loop on points + for ( i=0 ; i<_p ; i++ ) { + v = _X.get(i,j); + _X_lb[j] = std::min(v,_X_lb[j]); + _X_ub[j] = std::max(v,_X_ub[j]); + } + } + + // Bound of Z + for ( j=0 ; j<_m ; j++ ) { + _Z_lb[j] = +INF; + _Z_ub[j] = -INF; + // Loop on points + for ( i=0 ; i<_p ; i++ ) { + v = _Z.get(i,j); + if ( isdef(v) ){ + _Z_lb[j] = std::min(v,_Z_lb[j]); + _Z_ub[j] = std::max(v,_Z_ub[j]); + } + } + + // Compute replacement value for undef Z + // If there are no correct bounds defined yet + if ( ( ! isdef(_Z_lb[j])) || ( ! isdef(_Z_ub[j])) ){ + _Z_replace[j] = 1.0; + } + else{ + _Z_replace[j] = std::max(_Z_ub[j],0.0) + std::max(_Z_ub[j]-_Z_lb[j],1.0); + } + + } + +}// + + +/*---------------------------------------------------*/ +/* compute the number of different values over */ +/* the columns of a matrix */ +/*---------------------------------------------------*/ +void SGTELIB::TrainingSet::compute_nbdiff ( const Matrix & MAT , + int * nbdiff, + int & njvar ){ + + int nj = MAT.get_nb_cols(); // nb of columns + njvar = 0; // nb of columns that are not constant + for ( int j = 0 ; j < nj ; j++ ){ + nbdiff[j] = MAT.get_nb_diff_values(j); + if (nbdiff[j]>1) njvar++; + } +}// + + + + + + + +/*---------------------------------------------------*/ +/* compute the bounds over */ +/* the columns of a matrix */ +/*---------------------------------------------------*/ +void SGTELIB::TrainingSet::compute_nvar_mvar ( void ){ + + // Compute _nvar + if (_nvar!=_n){ + _nvar = 0; + for ( int j = 0 ; j < _n ; j++ ) + if (_X_nbdiff[j] > 1) _nvar++; + } + + // Compute _mvar + if (_mvar!=_m){ + _mvar = 0; + for ( int j = 0 ; j < _m ; j++ ) + if (_Z_nbdiff[j] > 1) _mvar++; + } +}// + + + +/*---------------------------------------------------*/ +/* compute scaling parameters */ +/*---------------------------------------------------*/ +void SGTELIB::TrainingSet::compute_scaling ( void ){ + int j=0; + + // Neutral values + for ( j = 0 ; j < _n ; j++ ) { + _X_scaling_a[j] = 1; + _X_scaling_b[j] = 0; + } + for ( j = 0 ; j < _m ; j++ ) { + _Z_scaling_a[j] = 1; + _Z_scaling_b[j] = 0; + } + + switch (scaling_method){ + case SCALING_NONE: + //Nothing to do! + break; + case SCALING_MEANSTD: + // Compute mean and std over columns of X and Z + compute_mean_std(); + // Compute scaling constants + for ( j = 0 ; j < _n ; j++ ) { + if (_X_nbdiff[j]>1) _X_scaling_a[j] = 1/_X_std[j]; + _X_scaling_b[j] = -_X_mean[j]*_X_scaling_a[j]; + } + for ( j = 0 ; j < _m ; j++ ) { + if (_Z_nbdiff[j]>1) _Z_scaling_a[j] = 1/_Z_std[j]; + _Z_scaling_b[j] = -_Z_mean[j]*_Z_scaling_a[j]; + } + break; + case SCALING_BOUNDS: + // Compute bounds over columns of X and Z + compute_bounds(); + // Compute scaling constants + for ( j = 0 ; j < _n ; j++ ) { + if (_X_nbdiff[j]>1) _X_scaling_a[j] = 1/(_X_ub[j]-_X_lb[j]); + _X_scaling_b[j] = -_X_lb[j]*_X_scaling_a[j]; + } + for ( j = 0 ; j < _m ; j++ ) { + if (_Z_nbdiff[j]>1) _Z_scaling_a[j] = 1/(_Z_ub[j]-_Z_lb[j]); + _Z_scaling_b[j] = -_Z_lb[j]*_Z_scaling_a[j]; + } + break; + }// end switch +}// + + +/*---------------------------------------------------*/ +/* compute scale matrices _Xs and _Zs */ +/*---------------------------------------------------*/ +void SGTELIB::TrainingSet::compute_scaled_matrices ( void ){ + + double v, mu; + int i,j; + + // Compute _Xs + for ( j = 0 ; j < _n ; j++ ){ + for ( i = 0 ; i < _p ; i++ ){ + v = _X.get(i,j)*_X_scaling_a[j]+_X_scaling_b[j]; + _Xs.set(i,j,v); + } + } + + // Compute _Zs and Mean_Zs + for ( j = 0 ; j < _m ; j++ ){ + mu = 0; + for ( i = 0 ; i < _p ; i++ ){ + v = _Z.get(i,j); + if ( ! isdef(v)){ + v = _Z_replace[j]; + } + v = v*_Z_scaling_a[j]+_Z_scaling_b[j]; + mu +=v; + _Zs.set(i,j,v); + } + _Zs_mean[j] = mu/_p; + } + +}// + + + +/*---------------------------------------------------*/ +/* compute distance matrix */ +/* the columns of a matrix */ +/*---------------------------------------------------*/ +void SGTELIB::TrainingSet::compute_Ds ( void ){ + double d; + double di1i2; + _pvar = _p; + _Ds_mean = 0.0; + bool unique; + for ( int i1 = 0 ; i1 < _p-1 ; i1++ ){ + _Ds.set(i1,i1,0.0); + unique = true; + for ( int i2 = i1+1 ; i2 < _p ; i2++ ){ + d = 0; + for ( int j = 0 ; j < _n ; j++ ){ + di1i2 = _Xs.get(i1,j)-_Xs.get(i2,j); + d += di1i2*di1i2; + } + d = sqrt(d); + _Ds.set(i1,i2,d); + _Ds.set(i2,i1,d); + // Compute the mean distance between the points + _Ds_mean += d; + // If d==0, then the point i2 is not unique. + if (fabs(d)<EPSILON){ + unique = false; + } + } + // If there are some points equal to the point of index i2, + // then reduce the number of different points. + if ( ! unique) _pvar--; + } + _Ds_mean /= double(_pvar*(_pvar-1)/2); + +}// + + + +/*---------------------------------------------------*/ +/* compute fs_min (scaled value of f_min) */ +/*---------------------------------------------------*/ +// the lazy way.... +void SGTELIB::TrainingSet::compute_f_min ( void ){ + + double f; + bool feasible; + // Go through all points + for ( int i=0 ; i<_p ; i++ ){ + // Get the unscaled objective + f = _Z.get(i,_j_obj); + // If objective is good + if (f<_f_min){ + // check the constraints + feasible = true; + for ( int j=0 ; j<_m ; j++ ) + if (_bbo[j]==BBO_CON) + if (_Z.get(i,j)>0.0){ feasible = false; break; } + // If the point is feasible, save the value. + if (feasible){ + _f_min = f; + _i_min = i; + } + } + } + // Compute the scaled objective. + _fs_min = Z_scale( _f_min, _j_obj ); + +}// + + +/*---------------------------------------------------*/ +/* get */ +/*---------------------------------------------------*/ +double SGTELIB::TrainingSet::get_Xs ( const int i , const int j ) const { + #ifdef SGTELIB_DEBUG + check_ready(); + // Check index + if ( (i<0) ||�(i>=_p) ||�(j<0) ||�(j>=_n) ){ + throw Exception ( __FILE__ , __LINE__ , + "TrainingSet::TrainingSet(): dimension error" ); + } + #endif + // Return value + return _Xs.get(i,j); +}// +/*---------------------------------------------------*/ +double SGTELIB::TrainingSet::get_Zs ( const int i , const int j ) const { + #ifdef SGTELIB_DEBUG + check_ready(); + // Check index + if ( (i<0) ||�(i>=_p) ||�(j<0) ||�(j>=_m) ){ + throw Exception ( __FILE__ , __LINE__ , + "TrainingSet::TrainingSet(): dimension error" ); + } + #endif + // Return value + return _Zs.get(i,j); +}// +/*---------------------------------------------------*/ +void SGTELIB::TrainingSet::get_Xs ( const int i , double * x ) const { + #ifdef SGTELIB_DEBUG + check_ready(__FILE__,__FUNCTION__,__LINE__); + // Check index + if ( (i<0) ||�(i>=_p) ){ + throw Exception ( __FILE__ , __LINE__ , + "TrainingSet::TrainingSet(): dimension error" ); + } + #endif + // Check/initialize pointer + if ( ! x){ + x = new double [_n]; + } + // Fill pointer + for ( int j = 0 ; j < _n ; j++ ){ + x[j] = _Xs.get(i,j); + } +}// +/*---------------------------------------------------*/ +void SGTELIB::TrainingSet::get_Zs ( const int i , double * z ) const { + #ifdef SGTELIB_DEBUG + check_ready(__FILE__,__FUNCTION__,__LINE__); + // Check index + if ( (i<0) ||�(i>=_p) ){ + throw Exception ( __FILE__ , __LINE__ , + "TrainingSet::get_Zs(): dimension error" ); + } + #endif + // Check/initialize pointer + if ( ! z){ + z = new double [_m]; + } + // Fill pointer + for ( int j = 0 ; j < _m ; j++ ){ + z[j] = _Zs.get(i,j); + } +}// +/*---------------------------------------------------*/ +double SGTELIB::TrainingSet::get_Zs_mean ( const int j ) const { + #ifdef SGTELIB_DEBUG + check_ready(__FILE__,__FUNCTION__,__LINE__); + // Check index + if ( (j<0) ||�(j>=_m) ){ + throw Exception ( __FILE__ , __LINE__ , + "TrainingSet::get_Zs_mean(): dimension error" ); + } + #endif + return _Zs_mean[j]; +}// + + +/*---------------------------------------------------*/ +int SGTELIB::TrainingSet::get_X_nbdiff ( const int i ) const { + #ifdef SGTELIB_DEBUG + check_ready(__FILE__,__FUNCTION__,__LINE__); + // Check index + if ( (i<0) ||�(i>=_n) ){ + throw Exception ( __FILE__ , __LINE__ , + "TrainingSet::get_X_nbdiff(): dimension error" ); + } + #endif + return _X_nbdiff[i]; +}// + +/*---------------------------------------------------*/ +const Matrix SGTELIB::TrainingSet::get_X_nbdiff ( void ) const { + Matrix V ("NbDiff",1,_n); + for (int j=0 ; j<_n ; j++){ + V.set(0,j,(double)_X_nbdiff[j]); + } + return V; +}// + + +/*---------------------------------------------------*/ +int SGTELIB::TrainingSet::get_Z_nbdiff ( const int j ) const { + #ifdef SGTELIB_DEBUG + check_ready(__FILE__,__FUNCTION__,__LINE__); + // Check index + if ( (j<0) ||�(j>=_m) ){ + throw Exception ( __FILE__ , __LINE__ , + "TrainingSet::get_Z_nbdiff(): dimension error" ); + } + #endif + return _Z_nbdiff[j]; +}// +/*---------------------------------------------------*/ +// Return the normalized distance between points i1 an i2 +double SGTELIB::TrainingSet::get_Ds ( const int i1 , const int i2 ) const { + #ifdef SGTELIB_DEBUG + check_ready(); + // Check index + if ( (i1<0) ||�(i1>=_p) ||�(i2<0) ||�(i2>=_p) ){ + throw Exception ( __FILE__ , __LINE__ , + "TrainingSet::get_Ds(): dimension error" ); + } + #endif + return _Ds.get(i1,i2); +}// + +/*--------------------------------------------------*/ +/* compute the distances between two sets of points */ +/*--------------------------------------------------*/ +Matrix SGTELIB::TrainingSet::get_distances ( const Matrix & A , + const Matrix & B , + const distance_t dt ) const{ + + + switch (dt){ + + case DISTANCE_NORM1: + return Matrix::get_distances_norm1(A,B); + + case DISTANCE_NORM2: + return Matrix::get_distances_norm2(A,B); + + case DISTANCE_NORMINF: + return Matrix::get_distances_norminf(A,B); + + case DISTANCE_NORM2_IS0: + // Two points x and y are in the same "IS0-class" if (x_j==0 <=> y_j==0 for each j). + // The distance "IS0" between two points of the same IS0-class is the norm 2 distance. + // The distance "IS0" between two points of different IS0-class is INF. + { + const int n = A.get_nb_cols(); + const int pa = A.get_nb_rows(); + const int pb = B.get_nb_rows(); + double v,d; + int ia, ib, j; + Matrix D = Matrix::get_distances_norm2(A,B); + double * x0 = new double [n]; + for (j=0 ; j < n ; j++){ + x0[j] = X_scale( 0.0 , j ); + } + for (ia=0 ; ia < pa ; ia++){ + for (ib=0 ; ib < pb ; ib++){ + // For each value of D + d = D.get(ia,ib); + v = d*d; + for (j=0 ; j < n ; j++){ + // If they are not in the same 0-class + if ( (fabs(A.get(ia,j)-x0[j])<EPSILON) ^ (fabs(B.get(ib,j)-x0[j])<EPSILON) ){ + v+=10000; + } + } + v = sqrt(v); + D.set(ia,ib,v); + } + } + delete [] x0; + return D; + } + + case DISTANCE_NORM2_CAT: + // Two points x and y are in the same "X0-class" if x_0==y_0. + // The distance "IS0" between two points of the same X0-class is the norm 2 distance. + // The distance "IS0" between two points of different X0-class is INF. + { + const int pa = A.get_nb_rows(); + const int pb = B.get_nb_rows(); + double v,d; + int ia, ib, j; + Matrix D = Matrix::get_distances_norm2(A,B); + j = 0; + for (ib=0 ; ib < pb ; ib++){ + for (ia=0 ; ia < pa ; ia++){ + // For each value of D + d = D.get(ia,ib); + v = d*d; + // If they are not in the same 0-class + if ( fabs(A.get(ia,j)-B.get(ib,j))>EPSILON ) { + v+=10000; + } + v = sqrt(v); + D.set(ia,ib,v); + } + } + return D; + } + + default: + throw Exception ( __FILE__ , __LINE__ ,"Undefined type" ); + } + + + +}// + + +/*--------------------------------------*/ +/* X scale: x->y: y = a.x + b */ +/*--------------------------------------*/ +void SGTELIB::TrainingSet::X_scale ( double * x ) const { + for ( int j = 0 ; j < _n ; j++ ) + x[j] = _X_scaling_a[j] * x[j] + _X_scaling_b[j]; +}// + +double SGTELIB::TrainingSet::X_scale ( double x , int var_index ) const { + return _X_scaling_a[var_index] * x + _X_scaling_b[var_index]; +}// + +/*--------------------------------------*/ +/* X unscale: y->x: x = (y-b)/a */ +/*--------------------------------------*/ +void SGTELIB::TrainingSet::X_unscale ( double * y ) const { + for ( int j = 0 ; j < _n ; j++ ) + y[j] = ( y[j] - _X_scaling_b[j] ) / _X_scaling_a[j]; +} + +double SGTELIB::TrainingSet::X_unscale ( double y , int var_index ) const { + return ( y - _X_scaling_b[var_index] ) / _X_scaling_a[var_index]; +} + +/*--------------------------------------*/ +/* Z scale: z->w: w = a.z + b */ +/*--------------------------------------*/ +void SGTELIB::TrainingSet::Z_scale ( double * z ) const { + for ( int j = 0 ; j < _m ; j++ ) + z[j] = _Z_scaling_a[j] * z[j] + _Z_scaling_b[j]; +}// + +double SGTELIB::TrainingSet::Z_scale ( double z , int output_index ) const { + return _Z_scaling_a[output_index] * z + _Z_scaling_b[output_index]; +}// + +/*--------------------------------------*/ +/* Z unscale: w->z: z = (w-b)/a */ +/*--------------------------------------*/ +void SGTELIB::TrainingSet::Z_unscale ( double * w ) const { + for ( int j = 0 ; j < _m ; j++ ) + w[j] = ( w[j] - _Z_scaling_b[j] ) / _Z_scaling_a[j]; +}// + +double SGTELIB::TrainingSet::Z_unscale ( double w , int output_index ) const { + return ( w - _Z_scaling_b[output_index] ) / _Z_scaling_a[output_index]; +}// + +/*------------------------------------------*/ +/* ZE unscale: w->z: z = (w)/a */ +/* Used to unscale errors, std and EI */ +/*------------------------------------------*/ +double SGTELIB::TrainingSet::ZE_unscale ( double w , int output_index ) const { + return w / _Z_scaling_a[output_index]; +}// + + +/*--------------------------------------*/ +/* X scale: x->y: y = a.x + b */ +/*--------------------------------------*/ +void SGTELIB::TrainingSet::X_scale ( Matrix & X ) { + int p = X.get_nb_rows(); + int n = X.get_nb_cols(); + if (n!=_n){ + throw Exception ( __FILE__ , __LINE__ , + "TrainingSet::TrainingSet(): dimension error" ); + } + double v; + // UnScale the output + for (int i=0 ; i<p ; i++){ + for (int j=0 ; j<n ; j++){ + // Z + v = X.get(i,j); + v = X_scale ( v , j ); + X.set(i,j,v); + } + } +}// + +/*--------------------------------------*/ +/* Z unscale: w->z: z = (w-b)/a */ +/*--------------------------------------*/ +void SGTELIB::TrainingSet::Z_unscale ( Matrix * Z ) { + int p = Z->get_nb_rows(); + int m = Z->get_nb_cols(); + if (m!=_m){ + throw Exception ( __FILE__ , __LINE__ , + "TrainingSet::TrainingSet(): dimension error" ); + } + double v; + // UnScale the output + for (int i=0 ; i<p ; i++){ + for (int j=0 ; j<m ; j++){ + // Z + v = Z->get(i,j); + v = Z_unscale ( v , j ); + Z->set(i,j,v); + } + } +}// +Matrix SGTELIB::TrainingSet::Z_unscale ( const Matrix & Z ) { + Matrix Z2 (Z); + Z_unscale(&Z2); + return Z2; +}// + +/*--------------------------------------*/ +/* ZE unscale: w->z: z = w/a */ +/*--------------------------------------*/ +void SGTELIB::TrainingSet::ZE_unscale ( Matrix * ZE ) { + int p = ZE->get_nb_rows(); + int m = ZE->get_nb_cols(); + if (m!=_m){ + throw Exception ( __FILE__ , __LINE__ , + "TrainingSet::TrainingSet(): dimension error" ); + } + double v; + // UnScale the output + for (int i=0 ; i<p ; i++){ + for (int j=0 ; j<m ; j++){ + // Z + v = ZE->get(i,j); + v = ZE_unscale ( v , j ); + ZE->set(i,j,v); + } + } +}// +Matrix SGTELIB::TrainingSet::ZE_unscale ( const Matrix & ZE ) { + Matrix ZE2 (ZE); + ZE_unscale(&ZE2); + return ZE2; +}// + + +/*--------------------------------------*/ +/* get d1 over d2 */ +/*--------------------------------------*/ +double SGTELIB::TrainingSet::get_d1_over_d2 ( const Matrix & XXs ) const { + if (XXs.get_nb_rows()>1){ + throw Exception ( __FILE__ , __LINE__ , + "TrainingSet::get_d1_over_d2: XXs must have only one line." ); + } + double d1 = +INF; + double d2 = +INF; + double d; + double dxj; + int i,i1,j; + i1 = 0; // Index of the closest point + + // If only 1 point, it is not possible to compute d2, + // so we use a dummy value. + if (_p==1){ + return 1.0; + } + + // Parcours des points + for ( i=0 ; i<_p ; i++ ){ + + // Calcul de d + d = 0.0; + for ( j=0 ; j<_n ; j++){ + dxj = XXs.get(0,j)-_Xs.get(i,j); + d += dxj*dxj; + } + if (d==0){ + return 0.0; + } + if (d<d1){ + d2=d1; + d1=d; + i1=i;// Memorize index of closest point + } + else if ((d<d2) && (_Ds.get(i,i1)>0)){ + // nb: the point i can be kept as 2nd closest point only if it is different from the point + // i1, which means that the distance to this point must be non null. + d2=d; + } + + } + return sqrt(d1/d2); +}// + + +/*--------------------------------------*/ +/* get d1 over d2 */ +/*--------------------------------------*/ +double SGTELIB::TrainingSet::get_d1 ( const Matrix & XXs ) const { + if (XXs.get_nb_rows()>1){ + throw Exception ( __FILE__ , __LINE__ , + "TrainingSet::get_d1: XXs must have only one line." ); + } + double d; + double d1 = +INF; + int i,j; + double dxj; + + // Parcours des points + for ( i=0 ; i<_p ; i++ ){ + + // Calcul de d + d = 0.0; + for ( j=0 ; j<_n ; j++){ + dxj = XXs.get(0,j)-_Xs.get(i,j); + d += dxj*dxj; + } + if (d==0){ + return 0.0; + } + if (d<d1){ + d1=d; + } + + } + return sqrt(d1); +}// + + +/*--------------------------------------*/ +/* get_exclusion_area_penalty */ +/*--------------------------------------*/ +Matrix SGTELIB::TrainingSet::get_exclusion_area_penalty ( const Matrix & XXs , const double tc ) const { + const int pxx = XXs.get_nb_rows(); + double r12,p; + //double logtc = log(tc); + + // tc = 0 => no penalty + // tc > 0 => infinite penalty for points of the cache + // Small value of tc (close to 0) => penalty is null nearly everywhere + // Large value of tc (close to 1) => penalty is non null nearly everywhere + + Matrix P ("P",pxx,1); + for (int i=0 ; i<pxx ; i++){ + r12 = get_d1_over_d2( XXs.get_row(i) ); + if ( r12<tc ) + //p = std::max(0.0,-1+log(r12)/logtc); + p = 1e+9 - r12; + else + p = 0.0; + P.set(i,0,p); + } + return P; +}// + +/*--------------------------------------*/ +/* get_distance_to_closest */ +/*--------------------------------------*/ +Matrix SGTELIB::TrainingSet::get_distance_to_closest ( const Matrix & XXs ) const { + #ifdef SGTELIB_DEBUG + check_ready(); + #endif + const int pxx = XXs.get_nb_rows(); + double d; + Matrix P ("P",pxx,1); + for (int i=0 ; i<pxx ; i++){ + d = get_d1 ( XXs.get_row(i) ); + P.set(i,0,d); + } + return P; +}// + + + +/*--------------------------------------*/ +/* get_closest */ +/*--------------------------------------*/ +// Return the index of the closest point to point i +int SGTELIB::TrainingSet::get_closest ( const int i ) const { + std::cout << i; + throw Exception ( __FILE__ , __LINE__ , + "TrainingSet::TrainingSet::get_closest ( const int i ): To be implemented." ); + return 0; +} + +/*--------------------------------------*/ +/* get_closest */ +/*--------------------------------------*/ + // Return the indexes of the nb_pts closest points to point i +/* +std::list<int> SGTELIB::TrainingSet::get_closest ( const int i_min , const int nb_pts ) const { + + #ifdef SGTELIB_DEBUG + check_ready(); + // Check index + if ( (i_min<0) or (i_min>=_p) or (nb_pts<0) or (nb_pts>=_p) ){ + throw Exception ( __FILE__ , __LINE__ ,"TrainingSet::TrainingSet(): dimension error" ); + } + #endif + + + //const Matrix & Ds = get_matrix_Ds(); + Matrix d = get_matrix_Ds().get_row(i_min); + Matrix ind("indexes",1,_p); + + int i; + for (i=0 ; i<_p ; i++) ind.set(0,i,i); + + bool change = true; + while (change) { + change = false; + for (i=0 ; i<_p-1 ; i++){ + if (d.get(0,i)>d.get(0,i+1)){ + d.permute(0,i,0,i+1); + ind.permute(0,i,0,i+1); + change = true; + } + } + } + + std::list<int> list; + list.clear(); + for (i=0 ; i<nb_pts ; i++) list.push_back(int(ind.get(0,i))); + return list; + +} +*/ + +/*--------------------------------------*/ +/* select points */ +/*--------------------------------------*/ +std::list<int> SGTELIB::TrainingSet::select_greedy ( const Matrix & X, + const int imin, + const int pS, + const double lambda0, + const distance_t dt ){ + + const int p = X.get_nb_rows(); + const int n = X.get_nb_cols(); + + if ( pS<3 || pS>=p ){ + std::cout << "pS = " << pS << "\n"; + throw Exception ( __FILE__ , __LINE__ ,"TrainingSet::TrainingSet(): wrong value of pS" ); + } + + std::list<int> S; + S.clear(); + + int inew; + Matrix xnew("xnew",1,n); + Matrix x ("x" ,1,n); + + // Select the best point (here, the set B is only the point i_min) + xnew = X.get_row(imin); + // Distance vector between the set B and the cache + Matrix dB = get_distances(X,xnew,dt); + dB.set_name("dB"); + // Add to S + S.push_back(imin); + #ifdef SGTELIB_DEBUG + std::cout << "First point : " << imin << "\n"; + #endif + + // Select the further point from B + // (nb : selecting one point randomly works as well) + inew = dB.get_max_index(); + xnew = X.get_row(inew); + // Distance vector between the set S and the cache + Matrix dS = get_distances(X,xnew,dt); + dS.set_name("dS"); + // Add to S + S.push_back(inew); + #ifdef SGTELIB_DEBUG + std::cout << "Second point : " << inew << "\n"; + #endif + + // As B is in S, we can take the min of both distances + dS = Matrix::min(dS,dB); + + // Compute lambda init : + #ifdef SGTELIB_DEBUG + std::cout << "Compute lambda init\n"; + #endif + double lambda = 0; + if (lambda0!=0){ + for (int i=0 ; i<p ; i++){ + if (dB.get(i)>0){ + lambda = std::max ( lambda , dS.get(i)/dB.get(i) ); + } + } + lambda *= lambda0; + } + + + // Iterative selection + #ifdef SGTELIB_DEBUG + std::cout << "Start greedy selection (S.size / pS = " << S.size() << " / " << pS << ")\n"; + #endif + while ((int) S.size() < pS){ + #ifdef SGTELIB_DEBUG + std::cout << "New iteration with lambda = " << lambda << "\n"; + (dS-lambda*dB).display(std::cout); + #endif + inew = (dS-lambda*dB).get_max_index(); + #ifdef SGTELIB_DEBUG + std::cout << "inew : " << inew << "\n"; + #endif + if (dS.get(inew)==0){ + #ifdef SGTELIB_DEBUG + std::cout << "dS(inew) == 0 !\n"; + #endif + // Update lambda + lambda *= 0.99; + if (lambda<1e-6) break; + } + else{ + #ifdef SGTELIB_DEBUG + std::cout << "Add point " << inew << " to set\n"; + #endif + // Add index in S + S.push_back(inew); + // Get coordinates of new points + xnew = X.get_row(inew); + // Update dS + dS = Matrix::min( dS , get_distances(X,xnew,dt) ); + dS.set_name("dS"); + } + }// End while + + return S; +}// + + +/*--------------------------------------*/ +/* display */ +/*--------------------------------------*/ +void SGTELIB::TrainingSet::display ( std::ostream & out ) const { + check_ready(); + int j; + + // dimensions: + out << "Number of points, p="; + out.width(4); + out << _p << " (" << _pvar << ")\n"; + out << "Input dimension, n="; + out.width(4); + out << _n << " (" << _nvar << ")\n"; + out << "Output dimension, m="; + out.width(4); + out << _m << " (" << _mvar << ")\n"; + + + if (_ready){ + out << "X (Input matrix):\n"; + out << "___________________________________________________________________________________\n"; + out << "Dim|type|nbdiff| mean std| lb ub| a b|\n"; + out << "---|----|------|----------------------|----------------------|---------------------|\n"; + for ( j = 0 ; j < _n ; j++ ){ + out.width(3); + out << j <<"| "; + out << " NA| "; + out.width(5); + out << _X_nbdiff[j] <<"| "; + out.width(10); + out << _X_mean[j] <<" "; + out.width(10); + out << _X_std[j] <<"| "; + out.width(10); + out << _X_lb[j] <<" "; + out.width(10); + out << _X_ub[j] <<"|"; + out.width(10); + out << _X_scaling_a[j] <<" "; + out.width(10); + out << _X_scaling_b[j] <<"|\n"; + } + out << "------------------------------------------------------------------------------------\n"; + + out << "\n"; + + out << "Z (Input matrix):\n"; + out << "___________________________________________________________________________________\n"; + out << "Dim|type|nbdiff| mean std| lb ub| a b|\n"; + out << "---|----|------|----------------------|----------------------|---------------------|\n"; + for ( j = 0 ; j < _m ; j++ ){ + out.width(3); + out << j <<"| "; + out << bbo_type_to_str(_bbo[j]) << "| "; + out.width(5); + out << _Z_nbdiff[j] <<"| "; + out.width(10); + out << _Z_mean[j] <<" "; + out.width(10); + out << _Z_std[j] <<"| "; + out.width(10); + out << _Z_lb[j] <<" "; + out.width(10); + out << _Z_ub[j] <<"|"; + out.width(10); + out << _Z_scaling_a[j] <<" "; + out.width(10); + out << _Z_scaling_b[j] <<"|\n"; + } + out << "------------------------------------------------------------------------------------\n"; + std::cout << "fs_min: " << _fs_min << "\n"; + std::cout << "f_min: " << _f_min << "\n"; + } + + + out << std::endl; + +}// diff --git a/ext/sgtelib/src/TrainingSet.hpp b/ext/sgtelib/src/TrainingSet.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ec6c86dac0f72129e81742938070ab7fb2194bd2 --- /dev/null +++ b/ext/sgtelib/src/TrainingSet.hpp @@ -0,0 +1,232 @@ +/*-------------------------------------------------------------------------------------*/ +/* sgtelib - A surrogate model library for derivative-free optimization */ +/* Version 2.0.1 */ +/* */ +/* Copyright (C) 2012-2017 Sebastien Le Digabel - Ecole Polytechnique, Montreal */ +/* Bastien Talgorn - McGill University, Montreal */ +/* */ +/* Author: Bastien Talgorn */ +/* email: bastientalgorn@fastmail.com */ +/* */ +/* This program is free software: you can redistribute it and/or modify it under the */ +/* terms of the GNU Lesser General Public License as published by the Free Software */ +/* Foundation, either version 3 of the License, or (at your option) any later */ +/* version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ +/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ +/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License along */ +/* with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on sgtelib at https://github.com/bastientalgorn/sgtelib */ +/*-------------------------------------------------------------------------------------*/ + +#ifndef __SGTELIB_TRAININGSET__ +#define __SGTELIB_TRAININGSET__ + +#include "Matrix.hpp" +#include "Defines.hpp" +namespace SGTELIB { + + /*--------------------------------------*/ + /* TrainingSet class */ + /*--------------------------------------*/ + class TrainingSet { + + private: + + int _p; // number of data points in X and Z + const int _n; // dimension -- number of variables + const int _m; // number of outputs (includes the objective) + bool _ready; // True if data have been processed and are ready to be used + + // Output type + SGTELIB::bbo_t * _bbo; + bool _bbo_is_def; + int _j_obj; // Index of the objective + + // f_min + double _f_min; + double _fs_min; + int _i_min; // Index of the point where f_min is reached + + // data points: + SGTELIB::Matrix _X; // p x n + SGTELIB::Matrix _Z; // p x m + + // scaled matrices + SGTELIB::Matrix _Xs; // p x n + SGTELIB::Matrix _Zs; // p x m + + // Distance matrix + SGTELIB::Matrix _Ds; // p x p + + // Nb of varying data + int _nvar; // Nb of varying input + int _mvar; // Nb of varying output + int _pvar; // Nb of different points + + // Data + double * _X_lb; + double * _X_ub; + double * _X_scaling_a; + double * _X_scaling_b; + double * _X_mean; + double * _X_std; + int * _X_nbdiff; + int _X_nbdiff1; + int _X_nbdiff2; + double * _Z_lb; + double * _Z_ub; + double * _Z_replace; + double * _Z_scaling_a; + double * _Z_scaling_b; + double * _Z_mean; + double * _Z_std; + double * _Zs_mean; + int * _Z_nbdiff; + + // scaled bounds: + //double * _X_lb_scaled; + //double * _X_ub_scaled; + + // Mean distance between points + double _Ds_mean; + + // private affectation operator: + TrainingSet & operator = ( const TrainingSet & ); + + // Data preparation + + static void compute_nbdiff ( const SGTELIB::Matrix & MAT , + int * nbdiff , + int & njvar ); + + void compute_bounds (void); + void compute_mean_std (void); + void compute_nvar_mvar (void); + void compute_scaling (void); + void compute_Ds (void); + void compute_scaled_matrices (void); + void compute_f_min (void); + void check_singular_data (void); + + // FORBIDEN copy constructor: + TrainingSet ( const TrainingSet & ); + + + public: + // constructor 1: + TrainingSet ( const SGTELIB::Matrix & X , + const SGTELIB::Matrix & Z ); + + // destructor: + virtual ~TrainingSet ( void ); + + // Define the bbo types + void set_bbo_type (const std::string & s); + + // construct/process the data of the TrainingSet + void build ( void ); + + // check ready + bool is_ready ( void ) const {return _ready;}; + void check_ready (const std::string & s) const; + void check_ready (const std::string & file, const std::string & function, const int & i) const; + void check_ready (void) const; + + // add points: + bool add_points ( const SGTELIB::Matrix & Xnew , + const SGTELIB::Matrix & Znew ); + bool add_point ( const double * xnew , + const double * znew ); + + // scale and unscale: + void X_scale ( double * x ) const; + void X_unscale ( double * y ) const; + + double X_scale ( double x , int var_index ) const; + double X_unscale ( double y , int var_index ) const; + + void Z_scale ( double * z ) const; + void Z_unscale ( double * w ) const; + + double Z_scale ( double z , int output_index ) const; + double Z_unscale ( double w , int output_index ) const; + double ZE_unscale ( double w , int output_index ) const; + + void X_scale ( SGTELIB::Matrix &X); + void Z_unscale ( SGTELIB::Matrix *Z); + void ZE_unscale ( SGTELIB::Matrix *ZE); + SGTELIB::Matrix Z_unscale ( const SGTELIB::Matrix & Z ); + SGTELIB::Matrix ZE_unscale ( const SGTELIB::Matrix & ZE ); + + // Get data + double get_Xs ( const int i , const int j ) const; + double get_Zs ( const int i , const int j ) const; + void get_Xs ( const int i , double * x ) const; + void get_Zs ( const int i , double * z ) const; + double get_Zs_mean ( const int j ) const; + int get_X_nbdiff ( const int i ) const; + int get_Z_nbdiff ( const int j ) const; + int get_X_nbdiff1 (void) const { check_ready(); return _X_nbdiff1; }; + int get_X_nbdiff2 (void) const { check_ready(); return _X_nbdiff2; }; + double get_Ds ( const int i1, const int i2) const; + const SGTELIB::Matrix get_X_nbdiff ( void ) const; + + + SGTELIB::Matrix get_distances ( const SGTELIB::Matrix & A , + const SGTELIB::Matrix & B , + const distance_t dt = SGTELIB::DISTANCE_NORM2 ) const; + + double get_d1_over_d2 ( const SGTELIB::Matrix & XXs ) const; + double get_d1 ( const SGTELIB::Matrix & XXs ) const; + SGTELIB::Matrix get_exclusion_area_penalty ( const SGTELIB::Matrix & XXs , const double tc ) const; + SGTELIB::Matrix get_distance_to_closest ( const SGTELIB::Matrix & XXs ) const; + + // Return the index of the closest point to point i + int get_closest ( const int i ) const; + // Return the indexes of the nb_pts closest points to point i + //std::list<int> get_closest ( const int i , const int nb_pts ) const; + + // Get basic information + int get_nb_points ( void ) const { return _p; }; + int get_input_dim ( void ) const { return _n; }; + int get_output_dim ( void ) const { return _m; }; + int get_nvar ( void ) const { check_ready(); return _nvar; }; + int get_mvar ( void ) const { check_ready(); return _mvar; }; + int get_pvar ( void ) const { check_ready(); return _pvar; }; + + double get_fs_min ( void ) const { check_ready(); return _fs_min; }; + double get_f_min ( void ) const { check_ready(); return _f_min; }; + int get_i_min ( void ) const { check_ready(); return _i_min; }; + double get_Ds_mean ( void ) const { check_ready(); return _Ds_mean; }; + int get_j_obj ( void ) const { check_ready(); return _j_obj; }; + //double get_Ds_min ( void ) const ; + + SGTELIB::bbo_t get_bbo ( int j) const { check_ready(); return _bbo[j]; }; + + double get_X_scaling_a ( int j) const { check_ready(); return _X_scaling_a[j]; }; + + // Return the design matrix + const SGTELIB::Matrix & get_matrix_Xs ( void ) const { check_ready(); return _Xs; }; + const SGTELIB::Matrix & get_matrix_Zs ( void ) const { check_ready(); return _Zs; }; + const SGTELIB::Matrix & get_matrix_Ds ( void ) const { check_ready(); return _Ds; }; + + // display: + void display ( std::ostream & out ) const; + void info (void) const; + + // Selection of points + std::list<int> select_greedy ( const SGTELIB::Matrix & X, + const int imin, + const int pS, + const double lambda0, + const distance_t dt = SGTELIB::DISTANCE_NORM2); + + }; +} + +#endif diff --git a/ext/sgtelib/src/header.txt b/ext/sgtelib/src/header.txt new file mode 100644 index 0000000000000000000000000000000000000000..c297ebcebc63cda198d95173443b9c96900246c8 --- /dev/null +++ b/ext/sgtelib/src/header.txt @@ -0,0 +1,24 @@ +/*-------------------------------------------------------------------------------------*/ +/* sgtelib - A surrogate model library for derivative-free optimization */ +/* Version 2.0.1 */ +/* */ +/* Copyright (C) 2012-2016 Sebastien Le Digabel - Ecole Polytechnique, Montreal */ +/* Bastien Talgorn - McGill University, Montreal */ +/* */ +/* Author: Bastien Talgorn */ +/* email: bastientalgorn@fastmail.com */ +/* */ +/* This program is free software: you can redistribute it and/or modify it under the */ +/* terms of the GNU Lesser General Public License as published by the Free Software */ +/* Foundation, either version 3 of the License, or (at your option) any later */ +/* version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ +/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ +/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License along */ +/* with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on sgtelib at https://github.com/bastientalgorn/sgtelib */ +/*-------------------------------------------------------------------------------------*/ diff --git a/ext/sgtelib/src/makefile b/ext/sgtelib/src/makefile new file mode 100644 index 0000000000000000000000000000000000000000..a27db392e2fb83de749e56ad344dafec49bb87c1 --- /dev/null +++ b/ext/sgtelib/src/makefile @@ -0,0 +1,97 @@ +EXE = ../bin/sgtelib.exe +LIB_NAME = libsgtelib.so +LIB_DIR = ../lib +LIB = $(LIB_DIR)/$(LIB_NAME) +COMPILATOR = g++ +COMPILATOR_OPTIONS = -O3 -pedantic -Wall -Wextra -g3 -fpic + +LIB_CURRENT_VERSION= 1.0.0 + +LIBS = -lc -lm +LDLIB_EXE = -lsgtelib +LDFLAGS = -L$(LIB_DIR) + +UNAME := $(shell uname) + +BUILD_DIR = ../build + +ifeq ($(UNAME), Darwin) +SHARED_OPTIONS_LIB = -current_version $(LIB_CURRENT_VERSION) -compatibility_version $(LIB_CURRENT_VERSION) -install_name $(LIB_NAME) -headerpad_max_install_names +endif + +ifeq ($(UNAME), Linux) +SHARED_OPTIONS_EXE = -Wl,-rpath-link,'.' -Wl,-rpath,'$$ORIGIN/../lib' +COMPILATOR_OPTIONS+= -ansi +LIBS += -ldl +endif + +INCLUDE = -I. +COMPILE = $(COMPILATOR) $(COMPILATOR_OPTIONS) $(INCLUDE) -c +OBJS_LIB = TrainingSet.o Surrogate_Parameters.o Surrogate_KS.o Surrogate_RBF.o \ + Surrogate_PRS.o Surrogate_PRS_EDGE.o Surrogate_LOWESS.o Surrogate_Kriging.o\ + Surrogate_PRS_CAT.o Surrogate_Ensemble.o Surrogate_CN.o \ + Surrogate.o Matrix.o Kernel.o Surrogate_Utils.o Surrogate_Factory.o \ + Tests.o sgtelib_help.o +OBJS_MAIN = sgtelib.o + +OBJS_MAIN := $(addprefix $(BUILD_DIR)/,$(OBJS_MAIN)) +OBJS_LIB := $(addprefix $(BUILD_DIR)/,$(OBJS_LIB)) + +.SECONDARY: %.o + +all: $(OBJS_LIB) $(LIB) $(OBJS_MAIN) $(EXE) + +$(EXE): $(OBJS_MAIN) $(LIB) + @echo + @echo "== Making $@ ==" + $(call DisplayCommand,$(COMPILATOR) -o $@ $< $(LIBS) $(LDLIB_EXE) $(COMPILATOR_OPTIONS) $(LDFLAGS) $(SHARED_OPTIONS_EXE)) +ifeq ($(UNAME), Darwin) + @install_name_tool -change $(LIB_NAME) @loader_path/$(LIB) $@ +endif + @echo + +$(LIB): $(OBJS_LIB) + @echo + @echo "== Making $@ ==" + $(call DisplayCommand,$(COMPILATOR) -shared -o $@ $(OBJS_LIB) $(LIBS) $(COMPILATOR_OPTIONS) $(SHARED_OPTIONS_LIB)) + +$(BUILD_DIR)/%.o: %.cpp %.hpp + @mkdir -p $(BUILD_DIR) $(LIB_DIR) ../bin + $(call DisplayCommand,$(COMPILE) $< -o $@) + +$(BUILD_DIR)/%.o: %.cpp + @mkdir -p $(BUILD_DIR) $(LIB_DIR) ../bin + $(call DisplayCommand,$(COMPILE) $< -o $@) + +.PHONY : clean +clean: + @echo " --> cleaning obj files" + $(call DisplayCommand0,rm -f $(OBJS_LIB) $(OBJS_MAIN) ) + +.PHONY : del +del: + @echo " --> cleaning trash files" + $(call DisplayCommand0,rm -f core *~) + @echo " --> cleaning obj files" + $(call DisplayCommand0,rm -f $(OBJS_LIB) $(OBJS_MAIN) ) + @echo " --> cleaning exe file" + $(call DisplayCommand0,rm -f $(EXE)) + @echo " --> cleaning library file" + $(call DisplayCommand0,rm -f $(LIB)) + + +ifdef SHORT_DISPLAY +define DisplayCommand + @if $(1) ; then echo "---> $@ OK" ; else echo "compilation failed for $@" ; fi +endef +define DisplayCommand0 + @if $(1) ; then echo " ----> OK" ; else echo " ----> FAILED" ; fi +endef +else +define DisplayCommand + $(1) +endef +define DisplayCommand0 + $(1) +endef +endif diff --git a/ext/sgtelib/src/sgtelib.cpp b/ext/sgtelib/src/sgtelib.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c9f54656e5731b6b8ea199c14d3bbe2add880cad --- /dev/null +++ b/ext/sgtelib/src/sgtelib.cpp @@ -0,0 +1,782 @@ +/*-------------------------------------------------------------------------------------*/ +/* sgtelib - A surrogate model library for derivative-free optimization */ +/* Version 2.0.1 */ +/* */ +/* Copyright (C) 2012-2017 Sebastien Le Digabel - Ecole Polytechnique, Montreal */ +/* Bastien Talgorn - McGill University, Montreal */ +/* */ +/* Author: Bastien Talgorn */ +/* email: bastientalgorn@fastmail.com */ +/* */ +/* This program is free software: you can redistribute it and/or modify it under the */ +/* terms of the GNU Lesser General Public License as published by the Free Software */ +/* Foundation, either version 3 of the License, or (at your option) any later */ +/* version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ +/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ +/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License along */ +/* with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on sgtelib at https://github.com/bastientalgorn/sgtelib */ +/*-------------------------------------------------------------------------------------*/ +#include "sgtelib.hpp" +#include "Surrogate_Factory.hpp" +#include "Surrogate_Utils.hpp" +#include <fstream> +#include <string> +using namespace SGTELIB; + +/*--------------------------------------*/ +/* main function */ +/*--------------------------------------*/ +int main ( int argc , char ** argv ) { + + int i,j,ikw; + bool error = false; + + //============================================ + // Check action + //============================================ + std::vector<std::string> keyword; + // Consider only the action keywords. + keyword.push_back("-predict"); + keyword.push_back("-help"); + keyword.push_back("-test"); + keyword.push_back("-server"); + keyword.push_back("-best"); + + // Check that exactly one action is required. + std::string action = "null"; + for (i=1 ; i<argc ; i++){ + for (j=0 ; j<static_cast<int>(keyword.size()) ; j++){ + //std::cout << argv[i] << " vs " << keyword.at(j) << "\n"; + if (streq(argv[i],keyword.at(j))){ + // action kw found. + if (streq(action,"null")){ + action = argv[i]; + } + else{ + std::cout << "Error! Two actions have been requested: \"" << action << "\" and \"" << argv[i] << "\".\n"; + std::cout << "You can only perform one action at a time.\n"; + error = true; + } + } + } + } + if (!strcmp(action.c_str(),"null")){ + std::cout << "Error! No action was found.\n"; + error = true; + } + + //============================================ + // Add other keywords. + //============================================ + keyword.push_back("-model"); + keyword.push_back("-verbose"); + const int NKW = static_cast<int>(keyword.size()); + // Create empty strings to store the information following each keyword. + std::vector<std::string> info; + for (i=0 ; i<NKW ; i++){ + info.push_back(""); + } + + //============================================ + // Parse + //============================================ + i = 1; + j = -1; + while (i<argc){ + // Check if the word is one of the keywords. + bool found_kw = false; + for (ikw=0 ; ikw<NKW ; ikw++){ + if (!strcmp( keyword.at(ikw).c_str(),argv[i] )){ + j = ikw; + found_kw = true; + //std::cout << "keyword: " <<keyword.at(ikw) << "\n"; + break; + } + } + if (j==-1){ + // If no kw was specified, break. + error = true; + break; + } + // Then continue ready the words for the current keyword. + info.at(j) += " "; + if ( ! found_kw) info.at(j) += std::string(argv[i]); + i++; + } + + //============================================ + // help + //============================================ + bool verbose=false; + for (i=0 ; i<NKW ; i++) { + if (!strcmp(keyword.at(i).c_str(),"-verbose")) break; + } + if (info.at(i).size()){ + std::cout << "verbose mode\n"; + verbose = true; + } + + + //============================================ + // Deblank + //============================================ + for (i=0 ; i<NKW ; i++) { + if (info.at(i).size()){ + info.at(i) = SGTELIB::deblank(info.at(i)); + } + } + + //============================================ + // Display error + //============================================ + if (error){ + // Display results + for (i=0 ; i<NKW ; i++) { + if (info.at(i).size()){ + std::cout << keyword.at(i) << " \"" << info.at(i) << "\"\n"; + } + } + std::cout << "Could not parse command.\n"; + } + + //============================================ + // Search for best model + //============================================ + if (!strcmp(action.c_str(),"-best")){ + for (i=0 ; i<NKW ; i++) { + if (!strcmp(keyword.at(i).c_str(),"-best")) break; + } + SGTELIB::sgtelib_best(info.at(i),verbose); + } + + + + //============================================ + // Get model name + //============================================ + std::string model; + for (i=0 ; i<NKW ; i++) { + if (!strcmp(keyword.at(i).c_str(),"-model")) break; + } + model = info.at(i); + if (!strcmp(model.c_str(),"")){ + model = "TYPE ENSEMBLE PRESET SUPER1 METRIC PRESS"; + } + + + //============================================ + // predict + //============================================ + if (!strcmp(action.c_str(),"-predict")){ + std::cout << "model: " << model << "\n"; + for (i=0 ; i<NKW ; i++) { + if (!strcmp(keyword.at(i).c_str(),"-predict")) break; + } + SGTELIB::sgtelib_predict(info.at(i),model); + } + + //============================================ + // help + //============================================ + if (!strcmp(action.c_str(),"-help") || error){ + std::string model; + for (i=0 ; i<NKW ; i++) { + if (!strcmp(keyword.at(i).c_str(),"-help")) break; + } + SGTELIB::sgtelib_help(info.at(i)); + } + + //============================================ + // server + //============================================ + if (!strcmp(action.c_str(),"-server")){ + std::cout << "model: " << model << "\n"; + SGTELIB::sgtelib_server(model,verbose); + } + + //============================================ + // test + //============================================ + if (!strcmp(action.c_str(),"-test")){ + SGTELIB::sgtelib_test(); + } + + //std::cout << "Quit sgtelib.\n"; + + return 0; +} + + + + + + + +/*--------------------------------------*/ +/* one prediction */ +/*--------------------------------------*/ +void SGTELIB::sgtelib_predict( const std::string & file_list , const std::string & model ){ + bool error = false; + std::string file; + SGTELIB::Matrix X,Z,XX,ZZ; + std::istringstream in_line (file_list); + if ( ( ! error) && (in_line >> file) && (SGTELIB::exists(file)) ){ + std::cout << "Read file " << file << "\n"; + X = SGTELIB::Matrix(file); + //X.display(std::cout); + } + else{ + std::cout << "Could not find " << file << "\n"; + error = true; + } + if ( ( ! error) && (in_line >> file) && (SGTELIB::exists(file)) ){ + std::cout << "Read file " << file << "\n"; + Z = SGTELIB::Matrix(file); + //Z.display(std::cout); + } + else{ + std::cout << "Could not find " << file << "\n"; + error = true; + } + if ( ( ! error) && (in_line >> file) && (SGTELIB::exists(file)) ){ + std::cout << "Read file " << file << "\n"; + XX = SGTELIB::Matrix(file); + //XX.display(std::cout); + } + else{ + std::cout << "Could not find " << file << "\n"; + error = true; + } + if ( ! (in_line >> file)){ + std::cout << "No zz file (display output in terminal)\n"; + file = "null"; + } + if ( ! error){ + SGTELIB::TrainingSet TS(X,Z); + SGTELIB::Surrogate * S = Surrogate_Factory(TS,model); + S->build(); + ZZ = SGTELIB::Matrix("ZZ",XX.get_nb_rows(),Z.get_nb_cols()); + S->predict(XX,&ZZ); + ZZ.set_name("ZZ"); + if (strcmp(file.c_str(),"null")){ + std::cout << "Write output matrix in " << file << "\n"; + ZZ.write(file); + } + else{ + ZZ.display(std::cout); + } + + } + if (error){ + sgtelib_help(); + } +}// + + + + + + +/*--------------------------------------*/ +/* find best model for a set of data */ +/*--------------------------------------*/ +void SGTELIB::sgtelib_best( const std::string & file_list , const bool verbose){ + bool error = false; + std::string file; + SGTELIB::Matrix X,Z; + std::istringstream in_line (file_list); + if ( ( ! error) && (in_line >> file) && (SGTELIB::exists(file)) ){ + std::cout << "Read file " << file << "\n"; + X = SGTELIB::Matrix(file); + } + else{ + std::cout << "Could not find " << file << "\n"; + error = true; + } + if ( ( ! error) && (in_line >> file) && (SGTELIB::exists(file)) ){ + std::cout << "Read file " << file << "\n"; + Z = SGTELIB::Matrix(file); + } + else{ + std::cout << "Could not find " << file << "\n"; + error = true; + } + if (error){ + sgtelib_help(); + return; + } + + + std::string m; + double v; + + SGTELIB::TrainingSet TS(X,Z); + for (int i=0 ; i<2 ; i++){ + std::cout << "=============================================================\n"; + if (i==0){ + std::cout << "Test models for optimization...\n"; + m = "AOECV"; + } + else{ + std::cout << "Test models for prediction...\n"; + m = "ARMSECV"; + } + std::cout << "=============================================================\n"; + + std::vector<std::string> model_list; + model_list.push_back("TYPE PRS DEGREE OPTIM RIDGE OPTIM"); + model_list.push_back("TYPE KS KERNEL_SHAPE OPTIM KERNEL_TYPE OPTIM DISTANCE OPTIM"); + model_list.push_back("TYPE RBF PRESET O KERNEL_SHAPE OPTIM KERNEL_TYPE OPTIM DISTANCE OPTIM"); + model_list.push_back("TYPE RBF PRESET R KERNEL_SHAPE OPTIM KERNEL_TYPE OPTIM DISTANCE OPTIM RIDGE OPTIM"); + model_list.push_back("TYPE RBF PRESET I KERNEL_SHAPE OPTIM KERNEL_TYPE OPTIM DISTANCE OPTIM RIDGE OPTIM"); + model_list.push_back("TYPE LOWESS DEGREE OPTIM KERNEL_SHAPE OPTIM KERNEL_TYPE OPTIM DISTANCE OPTIM RIDGE OPTIM"); + model_list.push_back("TYPE KRIGING"); + model_list.push_back("TYPE CN"); + std::vector<double> model_metric; + + double vmin = +INF; + std::cout << "Testing "; + if (verbose) std::cout << "...\n"; + for (std::vector<std::string>::iterator it_model = model_list.begin() ; it_model != model_list.end(); ++it_model){ + std::string model_def = *it_model+" METRIC "+m+" BUDGET 500"; + SGTELIB::Surrogate * S = Surrogate_Factory(TS,model_def); + if (verbose) std::cout << *it_model << "\n"; + else std::cout << model_type_to_str(S->get_type()) << " "; + S->build(); + if (S->is_ready()){ + v = S->get_metric(SGTELIB::str_to_metric_type(m),0); + model_metric.push_back(v); + vmin = std::min(v,vmin); + if (verbose) std::cout << "===> " << v << "\n"; + } + else{ + model_metric.push_back(+INF); + if (verbose) std::cout << "===> no ready\n"; + } + // Store model definition after parameter optimization + *it_model = S->get_string(); + // Delete model + SGTELIB::surrogate_delete(S); + } + std::cout << "\n"; + std::cout << "Best metric: " << m << " = " << vmin << "\n"; + std::cout << "Best model(s):\n "; + for (int k=0 ; k<int(model_list.size()) ; k++){ + if (model_metric.at(k)<=vmin+EPSILON){ + std::cout << model_list.at(k) << "\n"; + } + } + + } + std::cout << "=============================================================\n"; + + +}// + + +/*--------------------------------------*/ +/* sgtelib server */ +/*--------------------------------------*/ +void SGTELIB::sgtelib_server( const std::string & model , const bool verbose ){ + + SGTELIB::TrainingSet * TS = NULL; + SGTELIB::Surrogate * S = NULL; + SGTELIB::Matrix X, Z, std, ei, cdf; + std::string dummy_str; + + std::cout << "========== SERVER ==========================\n"; + + + std::cout << "Start server\n"; + std::cout << "Remove all flag files...\n"; + dummy_str = system("rm flag_* 2>/dev/null"); + std::cout << "Ok.\n"; + + int dummy_k = 0; + int pxx = 0; + int m = 0; + const bool display = verbose; + + std::ofstream out; + std::ifstream in; + + while (true){ + + SGTELIB::wait(0.01); + + if (SGTELIB::exists("flag_new_data_transmit")){ + //------------------------------ + // NEW DATA + //------------------------------ + std::cout << "============flag: new_data===================\n"; + dummy_k = 0; + dummy_str = system("mv flag_new_data_transmit flag_new_data_received"); + if (display) std::cout << "Read new data"; + X = SGTELIB::Matrix("new_data_x.txt"); + Z = SGTELIB::Matrix("new_data_z.txt"); + if (display) X.display_short(std::cout); + if (display) Z.display_short(std::cout); + std::cout << X.get_nb_rows() << " new data points...\n"; + + if ( ! S){ + if (display) std::cout << "First data: Build Trainig Set & Model\n"; + TS = new SGTELIB::TrainingSet(X,Z); + S = Surrogate_Factory(*TS,model); + m = TS->get_output_dim(); + dummy_str = system("rm -f flag_not_ready"); + } + else{ + if (display) std::cout << "Add points to TS\n"; + TS->add_points(X,Z); + } + dummy_str = system("rm new_data_x.txt new_data_z.txt"); + if (display) std::cout << "Waiting...\n"; + + } + else if (SGTELIB::exists("flag_predict_transmit")){ + //------------------------------ + // PREDICT + //------------------------------ + std::cout << "============flag: predict==================" << dummy_k++ << "\n"; + dummy_str = system("mv flag_predict_transmit flag_predict_received"); + + bool ready = false; + if (S){ + if (display) std::cout << "Build Sgte (" << TS->get_nb_points() << " pts)\n"; + ready = S->build(); + if (display) S->display(std::cout); + } + + // Read input matrix + if (display) std::cout << "Read matrix... "; + X = SGTELIB::Matrix("flag_predict_received"); + pxx = X.get_nb_rows(); + Z = SGTELIB::Matrix("ZZ",pxx,m); + std = SGTELIB::Matrix("std",pxx,m); + ei = SGTELIB::Matrix("ei",pxx,m); + cdf = SGTELIB::Matrix("cdf",pxx,m); + if (ready){ + // Do prediction + if (display) std::cout << "Predict... "; + S->predict(X,&Z,&std,&ei,&cdf); + //S->predict(X,&Z,NULL,NULL,NULL); + if (display) X.display_short(std::cout); + if (display) Z.display_short(std::cout); + } + else{ + if (display) std::cout << "Surrogate not ready\n"; + dummy_str = system("touch flag_not_ready"); + Z.fill(+SGTELIB::INF); + } + + // Open stream and write matrices + if (display) std::cout << "Write output.\n"; + out.open ("flag_predict_received"); + { + // Correct matrix names + Z.set_name("Z"); + std.set_name("std"); + ei.set_name("ei"); + cdf.set_name("cdf"); + // Write matrices + Z.display(out); + std.display(out); + ei.display(out); + cdf.display(out); + } + out.close(); + + // Change flag + dummy_str = system("mv flag_predict_received flag_predict_finished"); + if (display) std::cout << "Waiting...\n"; + + } + else if (SGTELIB::exists("flag_cv_transmit")){ + //------------------------------ + // CV values + //------------------------------ + std::cout << "============flag: cv values==================" << dummy_k++ << "\n"; + dummy_str = system("mv flag_cv_transmit flag_cv_received"); + + bool ready = false; + if (S) ready = S->build(); + if ( ! ready){ + if (display) std::cout << "Surrogate not ready\n"; + dummy_str = system("touch flag_not_ready"); + } + else{ + S->display(std::cout); + } + + SGTELIB::Matrix Zh, Sh, Zv, Sv; + if (ready){ + Zh = S->get_matrix_Zh(); + Sh = S->get_matrix_Sh(); + Zv = S->get_matrix_Zv(); + Sv = S->get_matrix_Sv(); + } + else{ + if (display) std::cout << "Surrogate not ready\n"; + dummy_str = system("touch flag_not_ready"); + } + + // Open stream and write matrices + if (display) std::cout << "Write output.\n"; + out.open ("flag_cv_received"); + { + // Correct matrix names + Zh.set_name("Zh"); + Sh.set_name("Sh"); + Zv.set_name("Zv"); + Sv.set_name("Sv"); + // Write matrices + Zh.display(out); + Sh.display(out); + Zv.display(out); + Sv.display(out); + } + out.close(); + + // Change flag + dummy_str = system("mv flag_cv_received flag_cv_finished"); + if (display) std::cout << "Waiting...\n"; + + } + else if (SGTELIB::exists("flag_metric_transmit")){ + //------------------------------ + // METRIC + //------------------------------ + + std::cout << "============flag: metric===================" << dummy_k++ << "\n"; + dummy_str = system("mv flag_metric_transmit flag_metric_received"); + + bool ready = false; + if (S) ready = S->build(); + if ( ! ready){ + if (display) std::cout << "Surrogate not ready\n"; + dummy_str = system("touch flag_not_ready"); + } + + + std::string metric_string; + SGTELIB::metric_t mt; + double metric_value; + + // Read metric_string + in.open("flag_metric_received"); + in >> metric_string; + in.close(); + if (display) std::cout << "metric : " << metric_string << "\n"; + mt = SGTELIB::str_to_metric_type(metric_string); + + // Open stream and write metric + if (display) std::cout << "Write output.\n"; + out.open ("flag_metric_received"); + if (ready){ + for (int j=0 ; j<TS->get_output_dim() ; j++){ + metric_value = S->get_metric(mt,j); + out << metric_value << " "; + if (display){ + std::cout << "output[" << j << "]: " << metric_value << "\n"; + } + } + } + else{ + out << -1; + } + out.close(); + + // Change flag + dummy_str = system("mv flag_metric_received flag_metric_finished"); + if (display) std::cout << "Waiting...\n"; + + } + else if (SGTELIB::exists("flag_info_transmit")){ + //------------------------------ + // INFO + //------------------------------ + + std::cout << "============flag: info===================" << dummy_k++ << "\n"; + dummy_str = system("mv flag_info_transmit flag_info_received"); + + bool ready = false; + if (S) ready = S->build(); + if ( ! ready){ + if (display) std::cout << "Surrogate not ready\n"; + dummy_str = system("touch flag_not_ready"); + } + + // Open stream and write metric + if (ready) S->display(std::cout); + else std::cout << "Not ready."; + // Change flag + dummy_str = system("mv flag_info_received flag_info_finished"); + if (display) std::cout << "Waiting...\n"; + + } + else if (SGTELIB::exists("flag_reset_transmit")){ + //------------------------------ + // RESET + //------------------------------ + + std::cout << "============flag: reset======================" << "\n"; + dummy_str = system("mv flag_reset_transmit flag_reset_received"); + + surrogate_delete(S); + delete TS; + TS = NULL; + S = NULL; + + if (display) std::cout << "Pointers: S=" << S << ", TS=" << TS << "\n"; + + // Change flag + dummy_str = system("mv flag_reset_received flag_reset_finished"); + if (display) std::cout << "Waiting...\n"; + + } + else if (SGTELIB::exists("flag_ping")){ + //------------------------------ + // PING + //------------------------------ + if (display) std::cout << "ping "; + // Write state in the ping file + + bool ready = false; + if (S){ + if (display) std::cout << "Build Sgte (" << TS->get_nb_points() << " pts)\n"; + ready = S->build(); + } + if (ready){ + std::cout << "pong: Model is ready.\n"; + dummy_str = system("echo 1 >> flag_ping"); + } + else{ + std::cout << "pong: Model is not ready.\n"; + dummy_str = system("echo 0 >> flag_ping"); + } + // Send an answer! + dummy_str = system("mv flag_ping flag_pong"); + } + else if (SGTELIB::exists("flag_quit")){ + //------------------------------ + // QUIT + //------------------------------ + surrogate_delete(S); + delete TS; + dummy_str = system("rm flag_quit"); + std::cout << "flag: quit\n"; + break; + } + + } + + std::cout << "Remove all flag files..."; + dummy_str = system("rm flag_* 2>/dev/null"); + std::cout << "Ok.\n"; + + std::cout << "Quit server\n"; + +}// + + + + + +/*--------------------------------------*/ +/* help */ +/*--------------------------------------*/ +void SGTELIB::sgtelib_help( std::string word ){ + + int i,j; + if (!strcmp(word.c_str(),"")) word = "GENERAL"; + //std::cout << "HELP about " << word << "\n"; + + std::string ** DATA = SGTELIB::get_help_data(); + const int NL = SGTELIB::dim_help_data(); + bool failedsearch = true; + bool found = false; + + for (j=0 ; j<3 ; j++){ + // j=0 => search in title + // j=1 => search in associated keywords + // j=2 => search in content + for (i=0 ; i<NL ; i++){ + if ( (SGTELIB::string_find(DATA[i][j],word)) || (streqi(word,"ALL")) ){ + //std::cout << i << " " << j << " " << (SGTELIB::string_find(DATA[i][j],word)) << " " << word << " " << DATA[i][j] << "\n"; + std::cout << "===============================================\n\n"; + std::cout << " \33[4m" << DATA[i][0] << "\33[0m" << "\n\n"; + //std::cout << " *** " << DATA[i][0] << " *** " << "\n\n"; + std::cout << DATA[i][2] << "\n\n"; + found = true; + failedsearch = false; + } + } + // If some data where found for this value of j (i.e. for this depth of search) + // then we don't search for higher j. + if (found) break; + } + + // Search if the word appears in the keywords of some datum. + std::string SeeAlso = "\33[4mSee also\33[0m:"; + found = false; + for (i=0 ; i<NL ; i++){ + if ( SGTELIB::string_find(DATA[i][1],word) ){ + SeeAlso+=" "+DATA[i][0]; + found = true; + } + } + if (found){ + std::cout << "=======================================\n"; + std::cout << "\n" << SeeAlso << "\n\n"; + std::cout << "=======================================\n"; + } + + if (failedsearch){ + std::cout << "We could not find any information associated to your search.\n"; + SGTELIB::sgtelib_help("MAIN"); + } + + +}// + + + + + + +/*--------------------------------------*/ +/* test */ +/*--------------------------------------*/ +void SGTELIB::sgtelib_test( void ){ + + SGTELIB::sand_box(); + + SGTELIB::Matrix X0; + SGTELIB::Matrix Z0; + + std::cout << "========== TEST MANY MODELS ==========================\n"; + + SGTELIB::build_test_data("hartman6",X0,Z0); + SGTELIB::test_many_models("output_hartman6.txt",X0,Z0); + + SGTELIB::build_test_data("hartman3",X0,Z0); + SGTELIB::test_many_models("output_hartman3.txt",X0,Z0); + + SGTELIB::build_test_data("braninhoo",X0,Z0); + SGTELIB::test_many_models("output_braninhoo.txt",X0,Z0); + + SGTELIB::build_test_data("camelback",X0,Z0); + SGTELIB::test_many_models("output_camelback.txt",X0,Z0); + + SGTELIB::build_test_data("rosenbrock",X0,Z0); + SGTELIB::test_many_models("output_rosenbrock.txt",X0,Z0); + + + std::cout << "========== END ================================\n"; +}// diff --git a/ext/sgtelib/src/sgtelib.hpp b/ext/sgtelib/src/sgtelib.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a14fa275e8725dde5d79be9697be5a3db9354277 --- /dev/null +++ b/ext/sgtelib/src/sgtelib.hpp @@ -0,0 +1,46 @@ +/*-------------------------------------------------------------------------------------*/ +/* sgtelib - A surrogate model library for derivative-free optimization */ +/* Version 2.0.1 */ +/* */ +/* Copyright (C) 2012-2017 Sebastien Le Digabel - Ecole Polytechnique, Montreal */ +/* Bastien Talgorn - McGill University, Montreal */ +/* */ +/* Author: Bastien Talgorn */ +/* email: bastientalgorn@fastmail.com */ +/* */ +/* This program is free software: you can redistribute it and/or modify it under the */ +/* terms of the GNU Lesser General Public License as published by the Free Software */ +/* Foundation, either version 3 of the License, or (at your option) any later */ +/* version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ +/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ +/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License along */ +/* with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on sgtelib at https://github.com/bastientalgorn/sgtelib */ +/*-------------------------------------------------------------------------------------*/ + +// SGTELIB 2014-02-07 + +#ifndef __SGTELIB__ +#define __SGTELIB__ + +#include "Surrogate_Factory.hpp" +#include "Tests.hpp" +#include "Matrix.hpp" +#include "Defines.hpp" +#include "Surrogate_Utils.hpp" +#include "sgtelib_help.hpp" + +namespace SGTELIB { + void sgtelib_server ( const std::string & model , const bool verbose ); + void sgtelib_predict ( const std::string & file_list , const std::string & model ); + void sgtelib_best ( const std::string & file_list , const bool verbose ); + void sgtelib_help ( std::string word="GENERAL" ); + void sgtelib_test ( void ); +} + +#endif diff --git a/ext/sgtelib/src/sgtelib_help.cpp b/ext/sgtelib/src/sgtelib_help.cpp new file mode 100644 index 0000000000000000000000000000000000000000..5331a7cfbd325355c3693babf64f2def3162347d --- /dev/null +++ b/ext/sgtelib/src/sgtelib_help.cpp @@ -0,0 +1,516 @@ +/*-------------------------------------------------------------------------------------*/ +/* sgtelib - A surrogate model library for derivative-free optimization */ +/* Version 2.0.1 */ +/* */ +/* Copyright (C) 2012-2017 Sebastien Le Digabel - Ecole Polytechnique, Montreal */ +/* Bastien Talgorn - McGill University, Montreal */ +/* */ +/* Author: Bastien Talgorn */ +/* email: bastientalgorn@fastmail.com */ +/* */ +/* This program is free software: you can redistribute it and/or modify it under the */ +/* terms of the GNU Lesser General Public License as published by the Free Software */ +/* Foundation, either version 3 of the License, or (at your option) any later */ +/* version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ +/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ +/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License along */ +/* with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on sgtelib at https://github.com/bastientalgorn/sgtelib */ +/*-------------------------------------------------------------------------------------*/ + + +#include "sgtelib_help.hpp" + + +//================================ +// Get dimension of HELP_DATA +//================================ +int SGTELIB::dim_help_data (void){ + return 32; +}// + +//================================ +// Construct the help data +//================================ +std::string ** SGTELIB::get_help_data (void){ + int i; + const int NL = 32; + const int NC = 3; + std::string ** HELP_DATA = new std::string * [NL]; + for (i = 0 ; i<NL ; i++) HELP_DATA[i] = new std::string [NC]; + i = 0; + //================================ + // GENERAL + //================================ + HELP_DATA[i][0] = "GENERAL"; + HELP_DATA[i][1] = "GENERAL MAIN SGTELIB HELP"; + HELP_DATA[i][2] = "sgtelib is a dynamic surrogate modeling library. Given a set of data points [X,z(X)], it allows to estimate the value of z(x) for any x.\n" +" \n" +"sgtelib can be called in 5 modes \n" +" * -predict: build a model on a set of data points and perform a prediction on a set of prediction points. See PREDICT for more information. This requires the definition of a model with the option -model, see MODEL.\n" +" sgtelib.exe -model <model description> -predict <input/output files>\n" +" sgtelib.exe -model TYPE PRS DEGREE 2 -predict x.txt z.txt xx.txt zz.txt\n" +" \n" +" * -server: starts a server that can be interrogated to perform predictions or compute the error metric of a model. The server should be used via the Matlab interface (see SERVER). This requires the definition of a model with the option -model, see MODEL. \n" +" sgtelib.exe -server -model <model description>\n" +" sgtelib.exe -server -model TYPE LOWESS SHAPE_COEF OPTIM\n" +" \n" +" * -best: returns the best type of model for a set of data points\n" +" sgtelib.exe -best <x file name> <z file name>\n" +" sgtelib.exe -best x.txt z.txt\n" +" \n" +" * -help: allows to ask for some information about some keyword.\n" +" sgtelib.exe -help keyword\n" +" sgtelib.exe -help DEGREE\n" +" sgtelib.exe -help LOWESS\n" +" sgtelib.exe -help\n" +" \n" +" * -test: runs a test of the sgtelib library.\n" +" sgtelib.exe -test\n" +" "; + i++; + //================================ + // PREDICT + //================================ + HELP_DATA[i][0] = "PREDICT"; + HELP_DATA[i][1] = "PREDICT PREDICTION INLINE SGTELIB"; + HELP_DATA[i][2] = "Performs a prediction in command line on a set of data provided through text files. If no ZZ file is provided, the predictions are displayed in the terminal. If no model is provided, the default model is used.\n" +" \n" +"Example\n" +" sgtelib.exe -predict <x file name> <z file name> <xx file name>\n" +" sgtelib.exe -predict x.txt z.txt xx.txt -model TYPE PRS DEGREE 2\n" +" sgtelib.exe -predict x.txt z.txt xx.txt zz.txt"; + i++; + //================================ + // BEST + //================================ + HELP_DATA[i][0] = "BEST"; + HELP_DATA[i][1] = "GENERAL BEST SGTELIB"; + HELP_DATA[i][2] = "Displays the description of the model that best fit the data provided in text files.\n" +" \n" +"Example\n" +" sgtelib.exe -best x_file.txt z.file.txt "; + i++; + //================================ + // SERVER + //================================ + HELP_DATA[i][0] = "SERVER"; + HELP_DATA[i][1] = "SERVER MATLAB SGTELIB"; + HELP_DATA[i][2] = "Starts a sgtelib server. See MATLAB_SERVER for more details.\n" +" \n" +"Example\n" +" sgtelib.exe -server -model TYPE LOWESS DEGREE 1 KERNEL_SHAPE OPTIM"; + i++; + //================================ + // MODEL + //================================ + HELP_DATA[i][0] = "MODEL"; + HELP_DATA[i][1] = "MODEL FIELD DESCRIPTION MODEL_DESCRIPTION DEFINITION MODEL_DEFINITION TYPE"; + HELP_DATA[i][2] = "Models in sgtelib are defined by using a succession of field names (see FIELD for the list of possible fields) and field values. Each field name is made of one single word. Each field value is made of one single word or numerical value. It is good practice to start by the field name TYPE, followed by the model type. \n" +" \n" +"Possible field names \n" +" * TYPE: mandatory field that specifies the type of model \n" +" * DEGREE: degree of the model for PRS and LOWESS models \n" +" * RIDGE: regularization parameter for PRS, RBF and LOWESS models \n" +" * KERNEL_TYPE: Kernel function for RBF, KS, LOWESS and KRIGING models \n" +" * KERNEL_SHAPE: Shape coefficient for RBF, KS and LOWESS models \n" +" * METRIC_TYPE: Error metric used as criteria for model parameter optimization/selection \n" +" * DISTANCE_TYPE: Metric used to compute the distance between points \n" +" * PRESET: Special information for some types of model \n" +" * WEIGHT_TYPE: Defines how the weights of Ensemble of model are computed \n" +" * BUDGET: Defines the parameter optimization budget \n" +" * OUTPUT: Defines the output text file "; + i++; + //================================ + // FIELD + //================================ + HELP_DATA[i][0] = "FIELD"; + HELP_DATA[i][1] = "FIELD NAME FIELD_NAME MODEL DEFINITION DESCRIPTION"; + HELP_DATA[i][2] = "A model description is composed of field names and field values.\n" +" \n" +"Example\n" +" TYPE <model type> FIELD1 <field 1 value> FIELD2 <field 2 value>"; + i++; + //================================ + // PRS + //================================ + HELP_DATA[i][0] = "PRS"; + HELP_DATA[i][1] = "TYPE POLYNOMIAL RESPONSE SURFACE QUADRATIC"; + HELP_DATA[i][2] = "PRS (Polynomial Response Surface) is a type of model. \n" +" \n" +"Authorized fields for this type of model \n" +" * DEGREE (Can be optimized) \n" +" * RIDGE (Can be optimized) \n" +" \n" +"Example\n" +" TYPE PRS DEGREE 2\n" +" TYPE PRS DEGREE OPTIM RIDGE OPTIM"; + i++; + //================================ + // PRS_EDGE + //================================ + HELP_DATA[i][0] = "PRS_EDGE"; + HELP_DATA[i][1] = "TYPE POLYNOMIAL RESPONSE SURFACE QUADRATIC DISCONTINUITY DISCONTINUITIES EDGE"; + HELP_DATA[i][2] = "PRS_EDGE (Polynomial Response Surface EDGE) is a type of model that allows to model discontinuities at 0 by using additional basis functions. \n" +" \n" +"Authorized fields for this type of model \n" +" * DEGREE (Can be optimized) \n" +" * RIDGE (Can be optimized) \n" +" \n" +"Example\n" +" TYPE PRS_EDGE DEGREE 2\n" +" TYPE PRS_EDGE DEGREE OPTIM RIDGE OPTIM"; + i++; + //================================ + // PRS_CAT + //================================ + HELP_DATA[i][0] = "PRS_CAT"; + HELP_DATA[i][1] = "TYPE POLYNOMIAL RESPONSE SURFACE QUADRATIC DISCONTINUITY DISCONTINUITIES"; + HELP_DATA[i][2] = "PRS_CAT (Categorical Polynomial Response Surface) is a type of model that allows to build one PRS model for each different value of the first component of x. \n" +" \n" +"Authorized fields for this type of model \n" +" * DEGREE (Can be optimized) \n" +" * RIDGE (Can be optimized) \n" +" \n" +"Example\n" +" TYPE PRS_CAT DEGREE 2\n" +" TYPE PRS_CAT DEGREE OPTIM RIDGE OPTIM"; + i++; + //================================ + // RBF + //================================ + HELP_DATA[i][0] = "RBF"; + HELP_DATA[i][1] = "TYPE RADIAL BASIS FUNCTION KERNEL"; + HELP_DATA[i][2] = "RBF (Radial Basis Function) is a type of model. \n" +" \n" +"Authorized fields for this type of model \n" +" * KERNEL_TYPE (Can be optimized) \n" +" * KERNEL_COEF (Can be optimized) \n" +" * DISTANCE_TYPE (Can be optimized) \n" +" * RIDGE (Can be optimized) \n" +" * PRESET: \"O\" for RBF with linear terms and orthogonal constraints, \"R\" for RBF with linear terms and regularization term, \"I\" for RBF with incomplete set of basis functions. This parameter cannot be optimized. \n" +" \n" +"Example\n" +" TYPE RBF KERNEL_TYPE D1 KERNEL_SHAPE OPTIM DISTANCE_TYPE NORM2"; + i++; + //================================ + // KS + //================================ + HELP_DATA[i][0] = "KS"; + HELP_DATA[i][1] = "TYPE KERNEL SMOOTHING SMOOTHING_KERNEL"; + HELP_DATA[i][2] = "KS (Kernel Smoothing) is a type of model. \n" +" \n" +"Authorized fields for this type of model \n" +" * KERNEL_TYPE (Can be optimized) \n" +" * KERNEL_COEF (Can be optimized) \n" +" * DISTANCE_TYPE (Can be optimized) \n" +" \n" +"Example\n" +" TYPE KS KERNEL_TYPE OPTIM KERNEL_SHAPE OPTIM"; + i++; + //================================ + // KRIGING + //================================ + HELP_DATA[i][0] = "KRIGING"; + HELP_DATA[i][1] = "TYPE GAUSSIAN PROCESS GP COVARIANCE"; + HELP_DATA[i][2] = "KRIGING is a type of model. \n" +" \n" +"Authorized fields for this type of model \n" +" * RIDGE (Can be optimized) \n" +" * DISTANCE_TYPE (Can be optimized) \n" +" \n" +"Example\n" +" TYPE KRIGING"; + i++; + //================================ + // LOWESS + //================================ + HELP_DATA[i][0] = "LOWESS"; + HELP_DATA[i][1] = "TYPE LOCALLY WEIGHTED REGRESSION LOWESS LOWER RIDGE DEGREE KERNEL"; + HELP_DATA[i][2] = "LOWESS (Locally Weighted Regression) is a type of model. \n" +" \n" +"Authorized fields for this type of model \n" +" * DEGREE: Must be 1 (default) or 2 (Can be optimized). \n" +" * RIDGE (Can be optimized) \n" +" * KERNEL_TYPE (Can be optimized) \n" +" * KERNEL_COEF (Can be optimized) \n" +" * DISTANCE_TYPE (Can be optimized) \n" +" \n" +"Example\n" +" TYPE LOWESS DEGREE 1 TYPE LOWESS DEGREE OPTIM KERNEL_SHAPE OPTIM KERNEL_TYPE D1 TYPE LOWESS DEGREE OPTIM KERNEL_SHAPE OPTIM KERNEL_TYPE OPTIM DISTANCE_TYPE OPTIM"; + i++; + //================================ + // ENSEMBLE + //================================ + HELP_DATA[i][0] = "ENSEMBLE"; + HELP_DATA[i][1] = "TYPE WEIGHT SELECT SELECTION"; + HELP_DATA[i][2] = "ENSEMBLE is a type of model. \n" +" \n" +"Authorized fields for this type of model \n" +" * WEIGHT: Defines how the ensemble weights are computed. \n" +" * METRIC: Defines which metric is used to compute the weights. \n" +" \n" +"Example\n" +" TYPE ENSEMBLE WEIGHT SELECT METRIC OECV TYPE ENSEMBLE WEIGHT OPTIM METRIC RMSECV DISTANCE_TYPE NORM2 BUDGET 100"; + i++; + //================================ + // TYPE + //================================ + HELP_DATA[i][0] = "TYPE"; + HELP_DATA[i][1] = "MODEL DESCRIPTION DEFINITION TYPE PRS KS PRS_EDGE PRS_CAT RBF LOWESS ENSEMBLE KRIGING CN"; + HELP_DATA[i][2] = "The field name TYPE defines which type of model is used.\n" +" \n" +"Possible model type \n" +" * PRS: Polynomial Response Surface \n" +" * KS: Kernel Smoothing \n" +" * PRS_EDGE: PRS EDGE model \n" +" * PRS_CAT: PRS CAT model \n" +" * RBF: Radial Basis Function Model \n" +" * LOWESS: Locally Weighted Regression \n" +" * ENSEMBLE: Ensemble of surrogates \n" +" * KRIGING: Kriging model \n" +" * CN: Closest neighbor \n" +" \n" +"Example\n" +" TYPE PRS: defines a PRS model.\n" +" TYPE ENSEMBLE: defines an ensemble of models."; + i++; + //================================ + // DEGREE + //================================ + HELP_DATA[i][0] = "DEGREE"; + HELP_DATA[i][1] = "PRS LOWESS PRS_CAT PRS_EDGE"; + HELP_DATA[i][2] = "The field name DEGREE defines the degree of a polynomial response surface. The value must be an integer ge 1. \n" +"Allowed for models of type PRS, PRS_EDGE, PRS_CAT, LOWESS. \n" +"Default values \n" +" * For PRS models, the default degree is 2. \n" +" * For LOWESS models, the degree must be 1 (default) or 2. \n" +" \n" +"Example\n" +" TYPE PRS DEGREE 3 defines a PRS model of degree 3.\n" +" TYPE PRS_EDGE DEGREE 2 defines a PRS_EDGE model of degree 2.\n" +" TYPE LOWESS DEGREE OPTIM defines a LOWESS model where the degree is optimized."; + i++; + //================================ + // RIDGE + //================================ + HELP_DATA[i][0] = "RIDGE"; + HELP_DATA[i][1] = "PRS LOWESS PRS_CAT PRS_EDGE RBF"; + HELP_DATA[i][2] = "The field name RIDGE defines the regularization parameter of the model. \n" +"Allowed for models of type PRS, PRS_EDGE, PRS_CAT, LOWESS, RBF. \n" +"Possible values Real value ge 0. Recommended values are 0 and 0.001. \n" +"Default values Default value is 0.01. \n" +"Example\n" +" TYPE PRS DEGREE 3 RIDGE 0 defines a PRS model of degree 3 with no ridge.\n" +" TYPE PRS DEGREE OPTIM RIDGE OPTIM defines a PRS model where the degree and ridge coefficient are optimized."; + i++; + //================================ + // KERNEL_TYPE + //================================ + HELP_DATA[i][0] = "KERNEL_TYPE"; + HELP_DATA[i][1] = "KS RBF LOWESS GAUSSIAN BI-QUADRATIC BIQUADRATIC TRICUBIC TRI-CUBIC INVERSE SPLINES POLYHARMONIC"; + HELP_DATA[i][2] = "The field name KERNEL_TYPE defines the type of kernel used in the model. The field name KERNEL is equivalent. \n" +"Allowed for models of type RBF, RBFI, Kriging, LOWESS and KS. \n" +"Possible values \n" +" * D1: Gaussian kernel (default) \n" +" * D2: Inverse Quadratic Kernel \n" +" * D3: Inverse Multiquadratic Kernel \n" +" * D4: Bi-quadratic Kernel \n" +" * D5: Tri-cubic Kernel \n" +" * D6: Exponential Sqrt Kernel \n" +" * D7: Epanechnikov Kernel \n" +" * I0: Multiquadratic Kernel \n" +" * I1: Polyharmonic splines, degree 1 \n" +" * I2: Polyharmonic splines, degree 2 \n" +" * I3: Polyharmonic splines, degree 3 \n" +" * I4: Polyharmonic splines, degree 4 \n" +" * OPTIM: The type of kernel is optimized \n" +" \n" +"Example\n" +" TYPE KS KERNEL_TYPE D2 defines a KS model with Inverse Quadratic Kernel\n" +" TYPE KS KERNEL_TYPE OPTIM KERNEL_SHAPE OPTIM defines a KS model with optimized kernel shape and type"; + i++; + //================================ + // KERNEL_COEF + //================================ + HELP_DATA[i][0] = "KERNEL_COEF"; + HELP_DATA[i][1] = "KS RBF LOWESS"; + HELP_DATA[i][2] = "The field name KERNEL_COEF defines the shape coefficient of the kernel function. Note that this field name has no impact for KERNEL_TYPES I1, I2, I3 and I4 because these kernels do not include a shape parameter. \n" +"Allowed for models of type RBF, KS, KRIGING, LOWESS. \n" +"Possible values Real value ge 0. Recommended range is [0.1 , 10]. For KS and LOWESS model, small values lead to smoother models. \n" +"Default values By default, the kernel coefficient is optimized. \n" +"Example\n" +" TYPE RBF KERNEL_COEF 10 defines a RBF model with a shape coefficient of 10.\n" +" TYPE KS KERNEL_TYPE OPTIM KERNEL_SHAPE OPTIM defines a KS model with optimized kernel shape and type"; + i++; + //================================ + // DISTANCE_TYPE + //================================ + HELP_DATA[i][0] = "DISTANCE_TYPE"; + HELP_DATA[i][1] = "KS RBF CN LOWESS"; + HELP_DATA[i][2] = "The field name DISTANCE_TYPE defines the distance function used in the model. \n" +"Allowed for models of type RBF, RBF, KS, LOWESS. \n" +"Possible values \n" +" * NORM1: Euclidian distance \n" +" * NORM2: Distance based on norm 1 \n" +" * NORMINF: Distance based on norm infty \n" +" * NORM2_IS0: Tailored distance for discontinuity in 0. \n" +" * NORM2_CAT: Tailored distance for categorical models. \n" +" \n" +"Default values Default value is NORM2. \n" +"Example\n" +" TYPE KS DISTANCE NORM2_IS0 defines a KS model tailored for VAN optimization."; + i++; + //================================ + // WEIGHT + //================================ + HELP_DATA[i][0] = "WEIGHT"; + HELP_DATA[i][1] = "ENSEMBLE SELECTION WTA1 WTA2 WTA3 WTA4 WTA"; + HELP_DATA[i][2] = "The field name WEIGHT defines the method used to compute the weights w of the ensemble of models. The keyword WEIGHT_TYPE is equivalent. Allowed for models of type ENSEMBLE.\n" +" \n" +"Allowed for models of type ENSEMBLE. \n" +" \n" +"Possible values \n" +" * WTA1: w_k propto metric_sum - metric_k (default) \n" +" * WTA3: w_k propto (metric_k + alpha metric_mean)^beta \n" +" * SELECT: w_k propto 1 textif metric_k = metric_min \n" +" * OPTIM: w minimizes metric(w) \n" +" \n" +"Example\n" +" TYPE ENSEMBLE WEIGHT SELECT METRIC RMSECV defines an ensemble of models which selects the model that has the best RMSECV.\n" +" TYPE ENSEMBLE WEIGHT OPTIM METRIC RMSECV defines an ensemble of models where the weights w are computed to minimize the RMSECV of the model."; + i++; + //================================ + // OUTPUT + //================================ + HELP_DATA[i][0] = "OUTPUT"; + HELP_DATA[i][1] = "OUT DISPLAY"; + HELP_DATA[i][2] = "Defines a text file in which informations will be recorded."; + i++; + //================================ + // OPTIM + //================================ + HELP_DATA[i][0] = "OPTIM"; + HELP_DATA[i][1] = "OPTIM BUDGET PARAMETERS PARAMETER OPTIMIZATION"; + HELP_DATA[i][2] = "The field value OPTIM indicate that the model parameter must be optimized. The default optimization criteria is the AOECV error metric.\n" +" \n" +"Parameters that can be optimized \n" +" * DEGREE \n" +" * RIDGE \n" +" * KERNEL_TYPE \n" +" * KERNEL_COEF \n" +" * DISTANCE_TYPE \n" +" \n" +"Example\n" +" TYPE PRS DEGREE OPTIM\n" +" TYPE LOWESS DEGREE OPTIM KERNEL_TYPE OPTIM KERNEL_SHAPE OPTIM METRIC ARMSECV"; + i++; + //================================ + // METRIC + //================================ + HELP_DATA[i][0] = "METRIC"; + HELP_DATA[i][1] = "PARAMETER OPTIMIZATION CHOICE SELECTION OPTIM BUDGET ENSEMBLE"; + HELP_DATA[i][2] = "The field name METRIC defines the metric used to select the parameters of the model (including the weights of Ensemble models).\n" +" \n" +"Allowed for models of type All types of model.\n" +" \n" +"Possible values \n" +" * EMAX: Error Max \n" +" * EMAXCV: Error Max with Cross-Validation \n" +" * RMSE: Root Mean Square Error \n" +" * RMSECV: RMSE with Cross-Validation \n" +" * OE: Order Error \n" +" * OECV: Order Error with Cross-Validation \n" +" * LINV: Invert of the Likelihood \n" +" * AOE: Aggregate Order Error \n" +" * AOECV: Aggregate Order Error with Cross-Validation \n" +" \n" +"Default values AOECV.\n" +" \n" +"Example\n" +" TYPE ENSEMBLE WEIGHT SELECT METRIC RMSECV defines an ensemble of models which selects the model that has the best RMSECV."; + i++; + //================================ + // BUDGET + //================================ + HELP_DATA[i][0] = "BUDGET"; + HELP_DATA[i][1] = "PARAMETER PARAMETERS OPTIM OPTIMIZATION"; + HELP_DATA[i][2] = "Budget for model parameter optimization. The number of sets of model parameters that are tested is equal to the optimization budget multiplied by the the number of parameters to optimize. \n" +"Default values 20\n" +" \n" +"Example\n" +" TYPE LOWESS KERNEL_SHAPE OPTIM METRIC AOECV BUDGET 100\n" +" TYPE ENSEMBLE WEIGHT OPTIM METRIC RMSECV BUDGET 50"; + i++; + //================================ + // SGTELIB_SERVER_START + //================================ + HELP_DATA[i][0] = "SGTELIB_SERVER_START"; + HELP_DATA[i][1] = "Matlab server interface"; + HELP_DATA[i][2] = "Start a sgtelib model in a server from Matlab. \n" +" \n" +"Example\n" +" sgtelib_server_start('TYPE PRS'); Start a sgtelib server with a PRS model\n" +" sgtelib_server_start('TYPE LOWESS DEGREE 1'); Start a Lowess model\n" +" sgtelib_server_start(model_name,true); Start a model defined in model_name and keep the window open"; + i++; + //================================ + // SGTELIB_SERVER_NEWDATA + //================================ + HELP_DATA[i][0] = "SGTELIB_SERVER_NEWDATA"; + HELP_DATA[i][1] = "Matlab server interface data newdata"; + HELP_DATA[i][2] = "Add data points to the sgtelib model from Matlab. \n" +" \n" +"Example\n" +" sgtelib_server_newdata(X,Z); Add data points [X,Z]"; + i++; + //================================ + // SGTELIB_SERVER_PREDICT + //================================ + HELP_DATA[i][0] = "SGTELIB_SERVER_PREDICT"; + HELP_DATA[i][1] = "Matlab server interface prediction predict"; + HELP_DATA[i][2] = "Perform a prediction from Matlab.\n" +" \n" +"Example\n" +" [ZZ,std,ei,cdf] = sgtelib_server_predict(XX); Prediction at points XX."; + i++; + //================================ + // SGTELIB_SERVER_INFO + //================================ + HELP_DATA[i][0] = "SGTELIB_SERVER_INFO"; + HELP_DATA[i][1] = "Matlab server interface"; + HELP_DATA[i][2] = "Command from Matlab. Use sgtelib_server_info to display information about the model."; + i++; + //================================ + // SGTELIB_SERVER_METRIC + //================================ + HELP_DATA[i][0] = "SGTELIB_SERVER_METRIC"; + HELP_DATA[i][1] = "Matlab server interface RMSE OECV RMSECV OE METRIC"; + HELP_DATA[i][2] = "Command from Matlab. Use sgtelib_server_stop(metric_name) to access the error metric of the model.\n" +" \n" +"Example\n" +" m = sgtelib_server_metric('OECV'); Return the OECV error metric\n" +" m = sgtelib_server_metric('RMSE'); Return the RMSE error metric"; + i++; + //================================ + // SGTELIB_SERVER_RESET + //================================ + HELP_DATA[i][0] = "SGTELIB_SERVER_RESET"; + HELP_DATA[i][1] = "Matlab server interface reset"; + HELP_DATA[i][2] = "Reset the model of the sgtelib server from Matlab."; + i++; + //================================ + // SGTELIB_SERVER_STOP + //================================ + HELP_DATA[i][0] = "SGTELIB_SERVER_STOP"; + HELP_DATA[i][1] = "Matlab server interface stop"; + HELP_DATA[i][2] = "Stop the sgtelib server from Matlab."; + i++; + //================================ + return HELP_DATA; +}// diff --git a/ext/sgtelib/src/sgtelib_help.hpp b/ext/sgtelib/src/sgtelib_help.hpp new file mode 100644 index 0000000000000000000000000000000000000000..9ae95837d4479c03b3b7ede2d6b91dbe72dbf07d --- /dev/null +++ b/ext/sgtelib/src/sgtelib_help.hpp @@ -0,0 +1,44 @@ +/*-------------------------------------------------------------------------------------*/ +/* sgtelib - A surrogate model library for derivative-free optimization */ +/* Version 2.0.1 */ +/* */ +/* Copyright (C) 2012-2017 Sebastien Le Digabel - Ecole Polytechnique, Montreal */ +/* Bastien Talgorn - McGill University, Montreal */ +/* */ +/* Author: Bastien Talgorn */ +/* email: bastientalgorn@fastmail.com */ +/* */ +/* This program is free software: you can redistribute it and/or modify it under the */ +/* terms of the GNU Lesser General Public License as published by the Free Software */ +/* Foundation, either version 3 of the License, or (at your option) any later */ +/* version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ +/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ +/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License along */ +/* with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on sgtelib at https://github.com/bastientalgorn/sgtelib */ +/*-------------------------------------------------------------------------------------*/ + +#ifndef __SGTELIB_HELP__ +#define __SGTELIB_HELP__ + +#include <set> +#include <fstream> +#include <vector> +#include <list> +#include <climits> +#include <algorithm> +#include <iostream> +#include "Defines.hpp" + + +namespace SGTELIB { + int dim_help_data (void); + std::string ** get_help_data (void); +} + +#endif diff --git a/ext/sgtelib/user_guide/sgtelib_user_guide.pdf b/ext/sgtelib/user_guide/sgtelib_user_guide.pdf new file mode 100644 index 0000000000000000000000000000000000000000..74b05b32932b052b1d18fe8b0e0d9d8bafe3bce6 Binary files /dev/null and b/ext/sgtelib/user_guide/sgtelib_user_guide.pdf differ diff --git a/install/install.sh b/install/install.sh index 27e136c5cc028c6ccb661afab8d426c4443ec298..63279af5f2e4238fda06b1f94b486e6a8eeb9d85 100755 --- a/install/install.sh +++ b/install/install.sh @@ -1,51 +1,7 @@ #!/bin/bash -#-------------------------------------------------------------------------------------# -# NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 # -# # -# # -# NOMAD - version 3.7.3 has been created by # -# Charles Audet - Ecole Polytechnique de Montreal # -# Sebastien Le Digabel - Ecole Polytechnique de Montreal # -# Christophe Tribes - Ecole Polytechnique de Montreal # -# # -# The copyright of NOMAD - version 3.7.3 is owned by # -# Sebastien Le Digabel - Ecole Polytechnique de Montreal # -# Christophe Tribes - Ecole Polytechnique de Montreal # -# # -# NOMAD v3 has been funded by AFOSR and Exxon Mobil. # -# # -# NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and # -# developed by Mark A. Abramson from The Boeing Company, Charles Audet and # -# Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from # -# Rice University, and were funded by AFOSR and Exxon Mobil. # -# # -# # -# Contact information: # -# Ecole Polytechnique de Montreal - GERAD # -# C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada # -# e-mail: nomad@gerad.ca # -# phone : 1-514-340-6053 #6928 # -# fax : 1-514-340-5665 # -# # -# This program is free software: you can redistribute it and/or modify it under the # -# terms of the GNU Lesser General Public License as published by the Free Software # -# Foundation, either version 3 of the License, or (at your option) any later # -# version. # -# # -# This program is distributed in the hope that it will be useful, but WITHOUT ANY # -# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A # -# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. # -# # -# You should have received a copy of the GNU Lesser General Public License along # -# with this program. If not, see <http://www.gnu.org/licenses/>. # -# # -# You can find information on the NOMAD software at www.gerad.ca/nomad # -#-------------------------------------------------------------------------------------# -# - echo "*****************************************************" -echo " NOMAD 3.7.3 Installation Script " +echo " NOMAD 3.8.1 Installation Script " echo " usage: ./install.sh [nparallel] " echo " - nparallel : number of parallel process to make " echo "*****************************************************" diff --git a/src/Barrier.cpp b/src/Barrier.cpp index b9289d785bea6cb9002bac970389c14007304592..9425d79f64555eff4f0508fcff5597f87ba01f37 100644 --- a/src/Barrier.cpp +++ b/src/Barrier.cpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Barrier.cpp \brief Barrier for constraints handling (implementation) @@ -255,11 +257,50 @@ void NOMAD::Barrier::insert ( const Barrier & b ) /*---------------------------------------------------------*/ NOMAD::success_type NOMAD::Barrier::insert_feasible ( const NOMAD::Eval_Point & x ) { - if ( !_best_feasible || ( x.get_f().value() < _best_feasible->get_f().value() ) ) + + Double fx; + Double fx_bf; + if ( _p.get_robust_mads() ) + { + if ( x.get_smoothing_status() != NOMAD::SMOOTHING_OK ) + return NOMAD::UNSUCCESSFUL; + + if ( _best_feasible ) + fx_bf = _best_feasible->get_fsmooth(); + else + { + _best_feasible = &x; + return NOMAD::FULL_SUCCESS; + } + fx = x.get_fsmooth(); + } + else + { + if ( _best_feasible ) + fx_bf = _best_feasible->get_f(); + else + { + _best_feasible = &x; + return NOMAD::FULL_SUCCESS; + } + + fx= x.get_f(); + + } + if ( !fx.is_defined() || ! fx_bf.is_defined() ) + throw NOMAD::Exception ( __FILE__ , __LINE__ , + "insert_feasible(): one point has no f value" ); + + if ( fx.value() < fx_bf.value() ) { _best_feasible = &x; return NOMAD::FULL_SUCCESS; } + + + + + return NOMAD::UNSUCCESSFUL; } diff --git a/src/Barrier.hpp b/src/Barrier.hpp index a41ad4cb940be700d7a7e436b6e232ce8686f773..d80f8c5a4f475af1fffdcb798198227fbbe81b1e 100644 --- a/src/Barrier.hpp +++ b/src/Barrier.hpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Barrier.hpp \brief Barrier for constraints handling (headers) diff --git a/src/Cache.cpp b/src/Cache.cpp index d65dfcfb82fc4542e92685da79a80b3f54394c49..0b2c5d06da78f365c97a3597f69e77308ff45461 100644 --- a/src/Cache.cpp +++ b/src/Cache.cpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Cache.cpp \brief Cache memorizing all evaluations (implementation) @@ -391,7 +393,8 @@ bool NOMAD::Cache::is_locked ( const std::string & file_name ) { if ( file_name == _locked_file ) return true; - return ( Cache::_locked_files.find ( file_name ) != Cache::_locked_files.end() ); + + return ( ! Cache::_locked_files.find ( file_name )->empty() ); } /*---------------------------------------------------------------------*/ @@ -530,7 +533,9 @@ bool NOMAD::Cache::load ( const std::string & file_name , if ( !file_name.empty() && file_name == _locked_file ) return true; - if ( file_name.empty() || !_locked_file.empty() || is_locked(file_name) ) + if ( file_name.empty() || + !_locked_file.empty() || + is_locked(file_name) ) return false; // the file exists: @@ -820,3 +825,7 @@ void NOMAD::Cache::display ( const NOMAD::Display & out ) const out << std::endl; #endif } + + + + diff --git a/src/Cache.hpp b/src/Cache.hpp index 260ec72f4031a4a53123e7e0f5c765f6750503e2..dd8160a6a7e11a28beb121eb49e9d8edb286521c 100644 --- a/src/Cache.hpp +++ b/src/Cache.hpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Cache.hpp \brief Cache memorizing all evaluations (headers) @@ -337,9 +339,9 @@ namespace NOMAD { \param p_nb_bb_outputs A pointer to the number of blackbox outputs. It is ignored if equal to \c NULL. - Points from the file with a different number - of outputs are ignored - -- \b IN -- \b optional (default = \c NULL). + Points from the file with a different number + of outputs are ignored + -- \b IN -- \b optional (default = \c NULL). \param display A boolean equal to \c true if displays are authorized @@ -399,6 +401,7 @@ namespace NOMAD { Uses the \c this->_out member as NOMAD::Display object. */ void display ( void ) const { display ( _out ); } + }; diff --git a/src/Cache_File_Point.cpp b/src/Cache_File_Point.cpp index d5255df29cee55e09e14e70a7c6539c56e3c19c9..17604708241541d203db68b6d1a456a6e7df47da 100644 --- a/src/Cache_File_Point.cpp +++ b/src/Cache_File_Point.cpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Cache_File_Point.cpp \brief Class for points in binary files (implementation) diff --git a/src/Cache_File_Point.hpp b/src/Cache_File_Point.hpp index 7688a9e74624dcbb96d088daa9904bb9df84e460..38dc9a1da7fb6daf458015f17a99b46a025d0c48 100644 --- a/src/Cache_File_Point.hpp +++ b/src/Cache_File_Point.hpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Cache_File_Point.hpp \brief Class for points in binary files (headers) diff --git a/src/Cache_Point.cpp b/src/Cache_Point.cpp index ef4334526a1e4c6ee24852f3bd8ad13479cc2755..5f6516f4753b16e42575321015507d345a222b96 100644 --- a/src/Cache_Point.cpp +++ b/src/Cache_Point.cpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Cache_Point.cpp \brief Point stored in the cache (implementation) diff --git a/src/Cache_Point.hpp b/src/Cache_Point.hpp index 4a7bd2c4700d04239937bdb1798aaccc10bbfd80..a77212c4c6fb7a080b150fbb0122a101f2bd2d4a 100644 --- a/src/Cache_Point.hpp +++ b/src/Cache_Point.hpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Cache_Point.hpp \brief Point stored in the cache (headers) diff --git a/src/Cache_Search.cpp b/src/Cache_Search.cpp index 2d22fc9ee7b5e1f32b52508be80bea183e100a93..509db8a153e940225f1b3af66a6819611b9d5c04 100644 --- a/src/Cache_Search.cpp +++ b/src/Cache_Search.cpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Cache_Search.cpp \brief NOMAD::Search subclass for the cache search (implementation) diff --git a/src/Cache_Search.hpp b/src/Cache_Search.hpp index 94029651f5daf45c80614cdbec0dcfe2cabacd31..27052890d7d1f6083444460e4508c74eaac4ea9b 100644 --- a/src/Cache_Search.hpp +++ b/src/Cache_Search.hpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Cache_Search.hpp \brief NOMAD::Search subclass for the cache search (headers) diff --git a/src/Clock.cpp b/src/Clock.cpp index 5e69bf090727e827aee1d3ae2a9b07fb7e8007e2..a74a5ec957c26a192f96527126a4f4ee39110a88 100644 --- a/src/Clock.cpp +++ b/src/Clock.cpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Clock.cpp \brief Clock class (implementation) diff --git a/src/Clock.hpp b/src/Clock.hpp index 2b9466c908ec57cf1970b2aa6632d1567d3ac5cd..ee8b5f3f4f122a35709f785d62bd8ce027f6920f 100644 --- a/src/Clock.hpp +++ b/src/Clock.hpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Clock.hpp \brief Clock class (headers) diff --git a/src/Direction.cpp b/src/Direction.cpp index 1f6c9415617e098099fc96ff40dd323279daea25..fe5abd48e1cd8f8e0a4537081188b7f8b3d2b847 100644 --- a/src/Direction.cpp +++ b/src/Direction.cpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Direction.cpp \brief Polling direction (implementation) @@ -61,9 +63,9 @@ int NOMAD::Direction::_max_cardinality = 0; /* constructor 1 */ /*---------------------------------------------------------*/ NOMAD::Direction::Direction ( void ) -: NOMAD::Point ( ) , -_type ( NOMAD::UNDEFINED_DIRECTION ) , -_index ( -1 ), +: NOMAD::Point ( ) , +_type ( NOMAD::UNDEFINED_DIRECTION ) , +_index ( -1 ), _dir_group_index (-1) { #ifdef MEMORY_DEBUG @@ -76,10 +78,10 @@ _dir_group_index (-1) /*---------------------------------------------------------*/ /* constructor 2 */ /*---------------------------------------------------------*/ -NOMAD::Direction::Direction ( int n , +NOMAD::Direction::Direction ( int n , const NOMAD::Double & v , NOMAD::direction_type type , - int dir_group_index ) + int dir_group_index ) : NOMAD::Point ( n , v ) , _type ( type ) , _index ( -1 ) , diff --git a/src/Direction.hpp b/src/Direction.hpp index 2a2813e6118b1502d178ca3b4d774dad1c52ca24..503e3c6a611f30bddfa42300b30883dbc26cd6ec 100644 --- a/src/Direction.hpp +++ b/src/Direction.hpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Direction.hpp \brief Polling direction (headers) @@ -68,7 +70,7 @@ namespace NOMAD { NOMAD::direction_type _type; ///< Type of direction. mutable int _index; ///< Direction index (used only for display). - int _dir_group_index ; ///< Index a the group of direction + int _dir_group_index ; ///< Index a the group of direction public: diff --git a/src/Directions.cpp b/src/Directions.cpp index 8c34295411eb29b231e40b126e640ced0be68bd9..4727ace3af50f2c9c38c226f273508a76d1e2189 100644 --- a/src/Directions.cpp +++ b/src/Directions.cpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Directions.cpp \brief Set of polling directions (implementation) @@ -50,6 +52,7 @@ #include "Directions.hpp" #include <math.h> #include "XMesh.hpp" +#include "GMesh.hpp" #include "SMesh.hpp" @@ -117,16 +120,11 @@ void NOMAD::Directions::lt_mads_init ( void ) /*---------------------------------------------------------*/ void NOMAD::Directions::set_binary ( void ) { + + _is_binary = true; _is_categorical = false; _is_orthomads = false; - _direction_types.clear(); - _direction_types.insert ( NOMAD::GPS_BINARY ); - if ( !_sec_poll_dir_types.empty() ) - { - _sec_poll_dir_types.clear(); - _sec_poll_dir_types.insert ( NOMAD::GPS_BINARY ); - } } /*---------------------------------------------------------*/ @@ -153,7 +151,8 @@ void NOMAD::Directions::compute_binary_directions ( std::list<NOMAD::Direction> { d.push_back ( NOMAD::Direction ( _nc , 0.0 , NOMAD::GPS_BINARY ) ); pd = &(*(--d.end())); - (*pd)[i] = 1.0; + + (*pd)[i] = ( NOMAD::RNG::rand()%2 == 0 ) ? 1.0: 0.0; } } @@ -161,9 +160,9 @@ void NOMAD::Directions::compute_binary_directions ( std::list<NOMAD::Direction> /*----------------------------------------------------------------------------*/ /* get the directions on a unit n-sphere for a given mesh */ /*----------------------------------------------------------------------------*/ -void NOMAD::Directions::compute ( std::list<NOMAD::Direction> & dirs , - NOMAD::poll_type poll , - const NOMAD::OrthogonalMesh & mesh ) +void NOMAD::Directions::compute ( std::list<NOMAD::Direction> & dirs , + NOMAD::poll_type poll , + const NOMAD::OrthogonalMesh & mesh ) { dirs.clear(); @@ -172,13 +171,6 @@ void NOMAD::Directions::compute ( std::list<NOMAD::Direction> & dirs , if ( _is_categorical ) return; - // binary variables: we use special directions: - if ( _is_binary ) - { - compute_binary_directions ( dirs ); - return; - } - NOMAD::Double pow_gps , cst; const NOMAD::Direction * bl; NOMAD::Direction * pd; @@ -222,10 +214,10 @@ void NOMAD::Directions::compute ( std::list<NOMAD::Direction> & dirs , if ( success_dir ) { #ifdef DEBUG - if ( dynamic_cast<const NOMAD::XMesh*> ( &mesh ) ) + if ( dynamic_cast<const NOMAD::XMesh*> ( &mesh ) || dynamic_cast<const NOMAD::GMesh*> ( &mesh ) ) { _out << std::endl - << NOMAD::open_block ( "compute Ortho-MADS directions with XMesh" ) + << NOMAD::open_block ( "compute Ortho-MADS directions with XMesh/GMesh" ) << "type = " << *it << std::endl; NOMAD::Point mesh_indices=mesh.get_mesh_indices(); _out<< "Mesh indices = ( "; @@ -669,7 +661,7 @@ void NOMAD::Directions::compute ( std::list<NOMAD::Direction> & dirs , /* compute a random direction on a unit N-Sphere */ /* see http://en.wikipedia.org/wiki/N-sphere */ /*-----------------------------------------------------------------------------*/ -bool NOMAD::Directions::compute_dir_on_unit_sphere ( NOMAD::Direction & random_dir ) const +bool NOMAD::Directions::compute_dir_on_unit_sphere ( NOMAD::Direction & random_dir ) const { int i; @@ -678,8 +670,6 @@ bool NOMAD::Directions::compute_dir_on_unit_sphere ( NOMAD::Direction & rando for ( i = 0 ; i < _nc ; ++i ) random_dir[i]=NOMAD::RNG::normal_rand(0,1); - // } - norm=random_dir.norm(); if ( norm==0 ) @@ -777,6 +767,7 @@ const NOMAD::Direction * NOMAD::Directions::get_bl ( const NOMAD::OrthogonalMesh NOMAD::Point mesh_indices = mesh.get_mesh_indices(); + // First mesh index is considered (no anisotropy for LT-MADS int mesh_index =static_cast<int>(mesh_indices[0].value()); NOMAD::Direction * bl = _bl [ mesh_index + NOMAD::L_LIMITS ]; hat_i = _hat_i [ mesh_index + NOMAD::L_LIMITS ]; diff --git a/src/Directions.hpp b/src/Directions.hpp index 2651974063d9747bbf7d46d9f8b89b1766598777..27e6dcc350c8039bd9e940df1663dd4bb97ce74e 100644 --- a/src/Directions.hpp +++ b/src/Directions.hpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Directions.hpp \brief Set of polling directions (headers) @@ -206,20 +208,20 @@ namespace NOMAD { /// Compute the directions for a given mesh. /** - \param mesh The given mesh -- \b IN. - \param dirs Set of directions -- \b OUT. - \param poll Type of poll (primary or secondary) -- \b IN. + \param mesh The given mesh -- \b IN. + \param dirs Set of directions -- \b OUT. + \param poll Type of poll (primary or secondary) -- \b IN. */ void compute ( std::list<NOMAD::Direction> & dirs , NOMAD::poll_type poll , - const NOMAD::OrthogonalMesh & mesh ); + const NOMAD::OrthogonalMesh & mesh ); /// Compute a random direction on a N-Sphere. /** - \param random_dir -- \b OUT. + \param random_dir -- \b OUT. \return A boolean equal to \c true if the computation went well. */ - bool compute_dir_on_unit_sphere ( NOMAD::Direction & random_dir ) const; + bool compute_dir_on_unit_sphere ( NOMAD::Direction & random_dir ) const; /// Check if Ortho-MADS directions are used. @@ -295,7 +297,7 @@ namespace NOMAD { /// Display a NOMAD::Directions object. /** - \param out The NOMAD::Display object -- \b IN. + \param out The NOMAD::Display object -- \b IN. \param d The NOMAD::Directions object to be displayed -- \b IN. \return The NOMAD::Display object. */ diff --git a/src/Display.cpp b/src/Display.cpp index 4cb46314971bf064f6fa16c7b725d16634d0bb51..34d5b64a30d34d5870efd9461ec66d530a1a5184 100644 --- a/src/Display.cpp +++ b/src/Display.cpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Display.cpp \brief Custom class for display (implementation) @@ -228,6 +230,31 @@ void NOMAD::Display::extract_display_format ( std::string & s , std::string & fo } } + +/*--------------------------------------------------------*/ +/* extract reported count value from a string */ +/*--------------------------------------------------------*/ +/* example: s="152+" return 152 */ +/*--------------------------------------------------------*/ +int NOMAD::Display::extract_reported_count_value ( std::string & s ) +{ + if ( s.empty() ) + return 0; + size_t k = s.find("+"); + size_t n = s.size(); + size_t klast = s.find_last_of("+"); + if ( n == 0 || k == std::string::npos || klast == std::string::npos || k != klast ) + return 0; + + int reported_count_value = 0; + bool success = atoi ( s.substr ( 0 , k ) , reported_count_value ); + + if ( success ) + return reported_count_value; + else + return 0; +} + /*---------------------------------------------------------*/ /* to display a duration with a smart format */ /* (t is in seconds and integer) */ @@ -268,8 +295,7 @@ void NOMAD::Display::display_size_of ( float size ) const /*-------------------------------------------------------------------*/ /* get the display_stats_type from a string (static) */ /*-------------------------------------------------------------------*/ -NOMAD::display_stats_type NOMAD::Display::get_display_stats_type -( const std::string & s ) +NOMAD::display_stats_type NOMAD::Display::get_display_stats_type ( const std::string & s ) { int idst; std::string ss = s , keyword; @@ -300,6 +326,12 @@ std::string NOMAD::Display::get_display_stats_keyword ( NOMAD::display_stats_typ case NOMAD::DS_OBJ: s = "OBJ"; break; + case NOMAD::DS_CONS_H: + s = "CONS_H"; + break; + case NOMAD::DS_SMOOTH_OBJ: + s = "SMOOTH_O"; + break; case NOMAD::DS_MESH_INDEX: s = "MESH_INDEX"; break; @@ -381,9 +413,18 @@ std::ostream & NOMAD::operator << ( std::ostream & out , NOMAD::success_type st { switch ( st ) { + case NOMAD::FULL_SUCCESS_ZOOM: + out << "dominating (SGTELIB)"; + break; + case NOMAD::FULL_SUCCESS_STAY: + out << "dominating (SGTELIB)"; + break; case NOMAD::FULL_SUCCESS: out << "dominating"; break; + case NOMAD::CACHE_UPDATE_SUCCESS: + out << "dominating (RobustMads)"; + break; case NOMAD::PARTIAL_SUCCESS: out << "improving"; break; @@ -492,13 +533,15 @@ std::ostream & NOMAD::operator << ( std::ostream & out , NOMAD::model_type mt ) case NOMAD::QUADRATIC_MODEL: out << "quadratic"; break; + case NOMAD::SGTELIB_MODEL: + out << "SGTELIB"; + break; case NOMAD::NO_MODEL: out << "no models"; } return out; } - /*-----------------------------------------------------------------*/ /* to display an evaluation type */ /*-----------------------------------------------------------------*/ @@ -576,6 +619,9 @@ std::ostream & NOMAD::operator << ( std::ostream & out , NOMAD::stop_type st ) case NOMAD::MAX_BB_EVAL_REACHED: out << "max number of blackbox evaluations"; break; + case NOMAD::MAX_BLOCK_EVAL_REACHED: + out << "max number of block evaluations"; + break; case NOMAD::MAX_SGTE_EVAL_REACHED: out << "max number of sgte evaluations"; break; diff --git a/src/Display.hpp b/src/Display.hpp index 59ce2c2aeb86bac97e982ba7abc20b768ed1f72c..aa4245769512a2ac8a39813bae9b2651048bc99c 100644 --- a/src/Display.hpp +++ b/src/Display.hpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Display.hpp \brief Custom class for display (headers) @@ -391,6 +393,15 @@ namespace NOMAD { \param format The format -- \b OUT. */ static void extract_display_format ( std::string & s , std::string & format ); + + + /// Extract reported count value from a string. + /** + \param s The string -- \b IN/OUT. + \return The reported count value -- \b OUT. + */ + static int extract_reported_count_value ( std::string & s ); + /// Get the NOMAD::display_stats_type from a string. /** @@ -485,7 +496,7 @@ namespace NOMAD { /// Operator << for NOMAD::model_type. std::ostream & operator << ( std::ostream & , NOMAD::model_type ); - + /// Operator << for NOMAD::direction_type. std::ostream & operator << ( std::ostream & , NOMAD::direction_type ); diff --git a/src/Double.cpp b/src/Double.cpp index 28b1f3c2ff7aacf686d64b1c39ff38207d26f250..faad2580b265fea9382da4e679dae75a7900b250 100644 --- a/src/Double.cpp +++ b/src/Double.cpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Double.cpp \brief Custom class for double-precision reals (implementation) @@ -126,7 +128,7 @@ void NOMAD::Double::set_epsilon ( double eps ) /*-----------------------------------------------*/ /* get the value */ /*-----------------------------------------------*/ -double NOMAD::Double::value ( void ) const +const double & NOMAD::Double::value ( void ) const { if ( !_defined ) throw Not_Defined ( "Double.cpp" , __LINE__ , @@ -487,7 +489,7 @@ void NOMAD::Double::display ( const NOMAD::Display & out , else if ( c=='d' || c=='i' || ( format2.empty() && std::floor(_value) == std::ceil(_value) && fabs(_value) < INT_MAX-1 ) ) - out << round(); + out << roundd(); else { @@ -562,7 +564,7 @@ void NOMAD::Double::display ( const NOMAD::Display & out , /*------------------------------------------*/ -/* round */ +/* round to int */ /*------------------------------------------*/ int NOMAD::Double::round ( void ) const { @@ -588,14 +590,10 @@ const NOMAD::Double NOMAD::Double::roundd ( void ) const throw Not_Defined ( "Double.cpp" , __LINE__ , "NOMAD::Double::round(): value not defined" ); - NOMAD::Double d = (_value < 0.0 ? -std::floor(.5-_value) : std::floor(.5+_value)); - return (_value < 0.0 ? -std::floor(.5-_value) : std::floor(.5+_value)); - } - /*------------------------------------------*/ /* Ceil */ /*------------------------------------------*/ @@ -665,9 +663,6 @@ const NOMAD::Double NOMAD::Double::sqrt ( void ) const // of Computation, 39(160):563–569, 1982. doi:10.1090/S0025-5718-1982-0669649-2. // // The error will be in [0;2] -// -// Modified: 2014-06-07, S. Le Digabel -// const NOMAD::Double NOMAD::Double::rel_err ( const Double & x ) const { if ( !_defined || !x._defined ) diff --git a/src/Double.hpp b/src/Double.hpp index 405f78658f2f02efbf18403ac544332384e902a1..175f1c19fc46bbd0ae9f1c69da56fe12c285672f 100644 --- a/src/Double.hpp +++ b/src/Double.hpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Double.hpp \brief Custom class for double-precision reals (headers) @@ -177,7 +179,13 @@ namespace NOMAD { /** \return The \c double value. */ - double value ( void ) const; + const double & value ( void ) const; + + /// Access to the \c double value pointer + /** + \return The \c double value pointer. + */ + const double * value_ptr (void) const { return (_defined ? &_value:NULL) ; } /// Is the value defined ? /** @@ -246,11 +254,12 @@ namespace NOMAD { NOMAD::Double::_inf_str = inf_str; } - /// Rounding to int + /// Rounding to int. /** \return An integer with the rounding result. */ int round ( void ) const; + /// Rounding to a Double /** diff --git a/src/Eval_Point.cpp b/src/Eval_Point.cpp index f862e1300ef0eb3cd56732a4d1ee7d8e9357a814..369b17f454657846553f8f28805f2125cb0fbd3c 100644 --- a/src/Eval_Point.cpp +++ b/src/Eval_Point.cpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Eval_Point.cpp \brief Evaluation point (implementation) @@ -70,6 +72,7 @@ _eval_type ( NOMAD::TRUTH ) , _direction ( NULL ) , _poll_center_type ( NOMAD::UNDEFINED_POLL_CENTER_TYPE ) , _eval_status ( NOMAD::UNDEFINED_STATUS ) , +_smoothing_status ( NOMAD::SMOOTHING_UNDEFINED ) , _EB_ok ( true ) { #ifdef MODEL_STATS @@ -91,6 +94,7 @@ _eval_type ( NOMAD::TRUTH ) , _direction ( NULL ) , _poll_center_type ( NOMAD::UNDEFINED_POLL_CENTER_TYPE ) , _eval_status ( NOMAD::UNDEFINED_STATUS ) , +_smoothing_status ( NOMAD::SMOOTHING_UNDEFINED ) , _EB_ok ( true ) , _bb_outputs ( m ) { @@ -174,6 +178,7 @@ _eval_type ( x._eval_type ) , _direction ( NULL ) , _poll_center_type ( x._poll_center_type ) , _eval_status ( x._eval_status ) , +_smoothing_status ( x._smoothing_status ) , _EB_ok ( x._EB_ok ) , _bb_outputs ( x.get_bb_outputs() ) , _user_eval_priority ( x._user_eval_priority ) , @@ -311,6 +316,7 @@ int NOMAD::Eval_Point::size_of ( void ) const sizeof (_in_cache ) + sizeof (_eval_type ) + sizeof (_eval_status ) + + sizeof (_smoothing_status ) + sizeof (_EB_ok ) + sizeof (_direction ) + ((_direction ) ? _direction->size_of() : 0); @@ -470,6 +476,8 @@ void NOMAD::Eval_Point::display_eval( const NOMAD::Display & out , bool in_block out << "h = " << _h << std::endl; if ( _f.is_defined() ) out << "f = " << _f << std::endl; + if ( _fsmooth.is_defined() ) + out << "fsmooth = " << _fsmooth << std::endl; out.close_block(); } else @@ -485,6 +493,8 @@ void NOMAD::Eval_Point::display_eval( const NOMAD::Display & out , bool in_block out << " h=" << _h; if ( _f.is_defined() ) out << " f=" << _f; + if ( _fsmooth.is_defined() ) + out << "fsmooth = " << _fsmooth << std::endl; } } diff --git a/src/Eval_Point.hpp b/src/Eval_Point.hpp index 050efcad403c6342f7356cffd09278e08bd3cc1a..e3580cf0b4105b0dcf76ba8eb38ef4e8c50e3f78 100644 --- a/src/Eval_Point.hpp +++ b/src/Eval_Point.hpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Eval_Point.hpp \brief Evaluation point (headers) @@ -71,16 +73,16 @@ namespace NOMAD { private: - static int _current_tag; ///< Current tag for all NOMAD::Eval_Point objects. - int _tag; ///< Unique tag. + static int _current_tag; ///< Current tag for all NOMAD::Eval_Point objects. + int _tag; ///< Unique tag. - static int _current_bbe; ///< Current bbe for all NOMAD::Eval_Point objects - static int _current_sgte_bbe; ///< Current sgte_bbe for all NOMAD::Eval_Point objects . - int _bbe; /// Recorded bbe for current NOMAD::Eval_Point object - int _sgte_bbe; /// Recorded sgte_bbe for current NOMAD::Eval_Point object - int _real_time; /// Recorded time for current NOMAD::Eval_Point object + static int _current_bbe; ///< Current bbe for all NOMAD::Eval_Point objects + static int _current_sgte_bbe; ///< Current sgte_bbe for all NOMAD::Eval_Point objects . + int _bbe; /// Recorded bbe for current NOMAD::Eval_Point object + int _sgte_bbe; /// Recorded sgte_bbe for current NOMAD::Eval_Point object + int _real_time; /// Recorded time for current NOMAD::Eval_Point object - NOMAD::Signature * _signature; ///< Signature of the point. + NOMAD::Signature * _signature; ///< Signature of the point. /** \c f is explicitely computed by a NOMAD::Evaluator object @@ -94,6 +96,11 @@ namespace NOMAD { */ NOMAD::Double _h; + NOMAD::Double _P; + NOMAD::Double _fsmooth; + NOMAD::Double _smoothing_variance; + + /// Flag equal to \c true if this eval point is in the cache. mutable bool _in_cache; @@ -132,6 +139,13 @@ namespace NOMAD { */ NOMAD::eval_status_type _eval_status; + /// Smoothing status. + /** + Indicates if the smoothing failed, succeeded, + or is undefined (default). + */ + NOMAD::smoothing_status_type _smoothing_status; + /// Flag equal to \c true if all EB constraints have been satisfied. bool _EB_ok; @@ -225,6 +239,12 @@ namespace NOMAD { */ NOMAD::Signature * get_signature ( void ) const; + /// Access to the i-th coordinate of a point + /** + \return A constant reference to the value (double) of the coordinate of a point + */ + const double & value (int i) const {return (*this)[i].value();} + /// Access to the number of blackbox outputs. /** \return Number of blackbox outputs. @@ -288,6 +308,25 @@ namespace NOMAD { */ const NOMAD::Double & get_h ( void ) const { return _h; } + /// Access to the smoothed objective value \c f. + /** + \return The smoothed objective value. + */ + const NOMAD::Double & get_fsmooth ( void ) const { return _fsmooth; } + + /// Access to the objective weight value \c f. + /** + \return The objective weight value. + */ + const NOMAD::Double & get_P ( void ) const { return _P; } + + /// Access to the variance for RobustMads kernel smoothing \c f. + /** + \return The smoothing variance associated to the eval_point. + */ + const NOMAD::Double & get_smoothing_variance ( void ) const { return _smoothing_variance; } + + /// Access to the blackbox outputs. /** \return The \c m blackblack outputs. @@ -349,6 +388,14 @@ namespace NOMAD { */ NOMAD::eval_status_type get_eval_status ( void ) const { return _eval_status; } + + /// Access to the smoothing status. + /** + \return The smoothing status + (smoothing failed, succeeded, or undefined(default)). + */ + NOMAD::smoothing_status_type get_smoothing_status ( void ) const { return _smoothing_status; } + /// Access to the user evaluation priority. /** \return The user evaluation priority. @@ -367,6 +414,7 @@ namespace NOMAD { return _rand_eval_priority; } + /// Check the point feasibility. /** The point is feasible if \c h \c <= \c h_min. @@ -464,6 +512,24 @@ namespace NOMAD { */ void set_h ( const NOMAD::Double & h ) { _h = h; } + /// Set the smooth objective value \c f. + /** + \param f objective function value -- \b IN. + */ + void set_fsmooth ( const NOMAD::Double & f ) { _fsmooth = f; } + + /// Set the objective weight value \c f. + /** + \param p objective weight value -- \b IN. + */ + void set_P ( const NOMAD::Double & p ) { _P = p; } + + /// Set the variance for RobustMads kernel smoothing \c f. + /** + \param v variance for RobustMads kernel smoothing-- \b IN. + */ + void set_smoothing_variance ( const NOMAD::Double & v ) { _smoothing_variance = v; } + /// Set the user evaluation priority. /** \param u User evaluation priority -- \b IN. @@ -496,6 +562,13 @@ namespace NOMAD { */ void set_eval_status ( const NOMAD::eval_status_type & e ) { _eval_status = e; } + /// Set the smoothing status. + /** + \param e Smoothing status (failed, succeeded, or undefined (default)) + -- \b IN. + */ + void set_smoothing_status ( const NOMAD::smoothing_status_type & e ) { _smoothing_status = e; } + /// Set if the point respects the EB constraints. /** \param e A boolean equal to \c true if the point @@ -558,7 +631,7 @@ namespace NOMAD { /// Reset the tags and bbes /** - */ + */ static void reset_tags_and_bbes ( void ) {_current_tag = 0;_current_bbe = 0;_current_sgte_bbe = 0;} #ifdef MODEL_STATS diff --git a/src/Evaluator.cpp b/src/Evaluator.cpp index 278b662efa4410b9be8560827e13efc26e2d803d..5ce2b3e319c5cf6b6b2a01b3eb04645fcf7d1d6b 100644 --- a/src/Evaluator.cpp +++ b/src/Evaluator.cpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Evaluator.cpp \brief Evaluation of blackbox functions (implementation) @@ -63,9 +65,9 @@ bool NOMAD::Evaluator::_force_quit = false; /* . _bb_exe includes the blackbox path */ /*-----------------------------------------------------------------*/ NOMAD::Evaluator::Evaluator ( const NOMAD::Parameters & p ) -: _p ( p ) , -_is_multi_obj ( false ) , -_is_model_evaluator ( false ) +: _p ( p ) , +_is_multi_obj ( false ) , +_is_model_evaluator( false ) { NOMAD::Evaluator::_force_quit = false; @@ -378,9 +380,9 @@ void NOMAD::Evaluator::compute_h ( NOMAD::Eval_Point & x ) const /* (unless the output value CNT_EVAL is defined and set to 1 */ /* by the blackbox) */ /*-------------------------------------------------------------------*/ -bool NOMAD::Evaluator::eval_x ( NOMAD::Eval_Point & x , - const NOMAD::Double & h_max , - bool & count_eval ) const +bool NOMAD::Evaluator::eval_x ( NOMAD::Eval_Point & x , + const NOMAD::Double & h_max , + bool & count_eval ) const { count_eval = false; @@ -511,7 +513,7 @@ bool NOMAD::Evaluator::eval_x ( NOMAD::Eval_Point & x , failed = false; bool is_defined = true; bool is_inf = false; - + // loop on the number of outputs for this blackbox: nbbok = _bb_nbo[k]; for ( j = 0 ; j < nbbok ; ++j ) @@ -536,10 +538,11 @@ bool NOMAD::Evaluator::eval_x ( NOMAD::Eval_Point & x , is_inf = true; break; } - + x.set_bb_output ( ibbo++ , d ); } + fin.close(); // the evaluation failed: @@ -577,9 +580,9 @@ bool NOMAD::Evaluator::eval_x ( NOMAD::Eval_Point & x , /*-------------------------------------------------------------------*/ /* . evaluate the black boxes at a list of given Eval_Points */ /*-------------------------------------------------------------------*/ -bool NOMAD::Evaluator::eval_x ( std::list<NOMAD::Eval_Point *> & list_eval, - const NOMAD::Double & h_max , - std::list<bool> & list_count_eval) const +bool NOMAD::Evaluator::eval_x ( std::list<NOMAD::Eval_Point *> & list_eval, + const NOMAD::Double & h_max , + std::list<bool> & list_count_eval) const { std::list<NOMAD::Eval_Point *>::iterator it; @@ -738,9 +741,9 @@ bool NOMAD::Evaluator::eval_x ( std::list<NOMAD::Eval_Point *> & list_eval, it_count=list_count_eval.begin(); for (it=it_begin;it!=it_end;++it,++it_count) { - failed = false; - is_defined = true; - is_inf = false; + failed = false; + is_defined = true; + is_inf = false; // loop on the number of outputs for this blackbox: nbbok = _bb_nbo[k]; diff --git a/src/Evaluator.hpp b/src/Evaluator.hpp index 03d52a83628baa4bc04fa45baa9a732b2d98490e..c51d2fd101719ec6442593138a03cba6c2444b32 100644 --- a/src/Evaluator.hpp +++ b/src/Evaluator.hpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Evaluator.hpp \brief Evaluation of blackbox functions (headers) @@ -56,237 +58,237 @@ #include <list> namespace NOMAD { - - // forward declarations: - class Barrier; - class Pareto_Front; - class Evaluator_Control; - - /// Evaluation of blackbox functions. - /** + + // forward declarations: + class Barrier; + class Pareto_Front; + class Evaluator_Control; + + /// Evaluation of blackbox functions. + /** This class allows the evaluation of one trial point. - */ - class Evaluator : private NOMAD::Uncopyable { - - protected: - - /// Parameters. - const NOMAD::Parameters & _p; - - /// Multi-objective flag. - /** - Identifies if a NOMAD::Evaluator object refers to - a NOMAD::Multi_Obj_Evaluator for more than one - objective function. - */ - bool _is_multi_obj; - - /// Model flag. - /** - Identifies if a NOMAD::Evaluator object refers to - a NOMAD::***_Model_Evaluator - */ - bool _is_model_evaluator; - - private: - - /// Blackbox executable names. - /** - - Not the same as Parameters::_bb_exe. - - NOMAD::Evaluator::_bb_exe is constructed from + */ + class Evaluator : private NOMAD::Uncopyable { + + protected: + + /// Parameters. + const NOMAD::Parameters & _p; + + /// Multi-objective flag. + /** + Identifies if a NOMAD::Evaluator object refers to + a NOMAD::Multi_Obj_Evaluator for more than one + objective function. + */ + bool _is_multi_obj; + + /// Model flag. + /** + Identifies if a NOMAD::Evaluator object refers to + a NOMAD::***_Model_Evaluator + */ + bool _is_model_evaluator; + + private: + + /// Blackbox executable names. + /** + - Not the same as Parameters::_bb_exe. + - NOMAD::Evaluator::_bb_exe is constructed from NOMAD::Parameters::_bb_exe. - */ - std::vector<std::string> _bb_exe; - - std::vector<std::string> _sgte_exe; ///< Surrogate executable names. - - /// Number of outputs for each blackbox executable. - std::vector<int> _bb_nbo; - - static bool _force_quit; ///< Flag equal to \c true if ctrl-c is pressed. - - /// Check the constraints to decide if the evaluations have to be stopped. - /** - \param x Point at which the constraints are checked -- \b IN. - \param h_max Maximal feasibility value \c h_max -- \b IN. - \return A boolean equal to \c true if - the evaluations have to be stopped. - */ - bool interrupt_evaluations ( const NOMAD::Eval_Point & x , - const NOMAD::Double & h_max ) const; - - /// Process a blackbox executable name. - /** - \param bb_exe Executable name -- \b IN/OUT. - */ - void process_bb_exe_name ( std::string & bb_exe ) const; - - public: - - /// Constructor. - /** - \param p Parameters -- \b IN. - */ - Evaluator ( const NOMAD::Parameters & p ); - - /// Destructor. - virtual ~Evaluator ( void ) {} - - /// Force quit (called by pressing ctrl-c). - static void force_quit ( void ) + */ + std::vector<std::string> _bb_exe; + + std::vector<std::string> _sgte_exe; ///< Surrogate executable names. + + /// Number of outputs for each blackbox executable. + std::vector<int> _bb_nbo; + + static bool _force_quit; ///< Flag equal to \c true if ctrl-c is pressed. + + /// Check the constraints to decide if the evaluations have to be stopped. + /** + \param x Point at which the constraints are checked -- \b IN. + \param h_max Maximal feasibility value \c h_max -- \b IN. + \return A boolean equal to \c true if + the evaluations have to be stopped. + */ + bool interrupt_evaluations ( const NOMAD::Eval_Point & x , + const NOMAD::Double & h_max ) const; + + /// Process a blackbox executable name. + /** + \param bb_exe Executable name -- \b IN/OUT. + */ + void process_bb_exe_name ( std::string & bb_exe ) const; + + public: + + /// Constructor. + /** + \param p Parameters -- \b IN. + */ + Evaluator ( const NOMAD::Parameters & p ); + + /// Destructor. + virtual ~Evaluator ( void ) {} + + /// Force quit (called by pressing ctrl-c). + static void force_quit ( void ) { NOMAD::Evaluator::_force_quit = true; } - - /// Access to the \c force_quit flag. - /** - \return The \c force_quit flag. - */ - static bool get_force_quit ( void ) + + /// Access to the \c force_quit flag. + /** + \return The \c force_quit flag. + */ + static bool get_force_quit ( void ) { return NOMAD::Evaluator::_force_quit; } - - /// Access to the multi-objective flag. - /** - \return The multi-objective flag. - */ - bool is_multi_obj ( void ) const + + /// Access to the multi-objective flag. + /** + \return The multi-objective flag. + */ + bool is_multi_obj ( void ) const { return _is_multi_obj; } - - /// Access to the model evaluator flag. - /** - \return The model evaluator flag. - */ - virtual bool is_model_evaluator ( void ) const + + /// Access to the model evaluator flag. + /** + \return The model evaluator flag. + */ + virtual bool is_model_evaluator ( void ) const { return _is_model_evaluator; } - - /// User pre-processing of a list of points. - /** - - This virtual method is called before the evaluation of a list + + /// User pre-processing of a list of points. + /** + - This virtual method is called before the evaluation of a list of points. - - It allows the user to pre-process the points to be evaluated. - \param pts The list of points -- \b IN/OUT. - */ - virtual void list_of_points_preprocessing - ( std::set<Priority_Eval_Point> & pts ) const {} - - /// User updates after a success. - /** - This virtual method is called every time a new (full) success is made. - \param stats Stats -- \b IN. - \param x Last successful point -- \b IN. - */ - virtual void update_success ( const NOMAD::Stats & stats , - const NOMAD::Eval_Point & x ) {} - - /// User updates after an iteration. - /** - This virtual method is called every time a MADS iteration is terminated. - \param success Success of the iteration -- \b IN. - \param stats Stats -- \b IN. - \param ev_control The NOMAD::Evaluator_Control object -- \b IN. - \param true_barrier Barrier for true evaluations -- \b IN. - \param sgte_barrier Barrier for surrogate evaluations -- \b IN. - \param pareto_front Pareto front -- \b IN. - \param stop Allows the user to stop the algorithm -- \b OUT. - */ - virtual void update_iteration ( NOMAD::success_type success , - const NOMAD::Stats & stats , - const NOMAD::Evaluator_Control & ev_control , - const NOMAD::Barrier & true_barrier , - const NOMAD::Barrier & sgte_barrier , - const NOMAD::Pareto_Front & pareto_front , - bool & stop ) {} - - /// Evaluate the blackbox functions at a given trial point (#1). - /** - - Const version. - - May be user-defined. - - Surrogate or true evaluation depending on the value of \c x.is_surrogate(). - \param x The trial point -- \b IN/OUT. - \param h_max Maximal feasibility value \c h_max -- \b IN. - \param count_eval Flag indicating if the evaluation has to be counted - or not -- \b OUT. - \return A boolean equal to \c false if the evaluation failed. - */ - virtual bool eval_x ( NOMAD::Eval_Point & x , - const NOMAD::Double & h_max , - bool & count_eval ) const; - - /// Evaluate the blackbox functions at a given trial point (#2). - /** - - Non-const version. - - Calls the const version by default. - - May be user-defined. - - Surrogate or true evaluation depending on the value of \c x.is_surrogate(). - \param x The trial point -- \b IN/OUT. - \param h_max Maximal feasibility value \c h_max -- \b IN. - \param count_eval Flag indicating if the evaluation has to be counted - or not -- \b OUT. - \return A boolean equal to \c false if the evaluation failed. - */ - virtual bool eval_x ( NOMAD::Eval_Point & x , - const NOMAD::Double & h_max , - bool & count_eval ) + - It allows the user to pre-process the points to be evaluated. + \param pts The list of points -- \b IN/OUT. + */ + virtual void list_of_points_preprocessing + ( std::set<Priority_Eval_Point> & pts ) const {} + + /// User updates after a success. + /** + This virtual method is called every time a new (full) success is made. + \param stats Stats -- \b IN. + \param x Last successful point -- \b IN. + */ + virtual void update_success ( const NOMAD::Stats & stats , + const NOMAD::Eval_Point & x ) {} + + /// User updates after an iteration. + /** + This virtual method is called every time a MADS iteration is terminated. + \param success Success of the iteration -- \b IN. + \param stats Stats -- \b IN. + \param ev_control The NOMAD::Evaluator_Control object -- \b IN. + \param true_barrier Barrier for true evaluations -- \b IN. + \param sgte_barrier Barrier for surrogate evaluations -- \b IN. + \param pareto_front Pareto front -- \b IN. + \param stop Allows the user to stop the algorithm -- \b OUT. + */ + virtual void update_iteration ( NOMAD::success_type success , + const NOMAD::Stats & stats , + const NOMAD::Evaluator_Control & ev_control , + const NOMAD::Barrier & true_barrier , + const NOMAD::Barrier & sgte_barrier , + const NOMAD::Pareto_Front & pareto_front , + bool & stop ) {} + + /// Evaluate the blackbox functions at a given trial point (#1). + /** + - Const version. + - May be user-defined. + - Surrogate or true evaluation depending on the value of \c x.is_surrogate(). + \param x The trial point -- \b IN/OUT. + \param h_max Maximal feasibility value \c h_max -- \b IN. + \param count_eval Flag indicating if the evaluation has to be counted + or not -- \b OUT. + \return A boolean equal to \c false if the evaluation failed. + */ + virtual bool eval_x ( NOMAD::Eval_Point & x , + const NOMAD::Double & h_max , + bool & count_eval ) const; + + /// Evaluate the blackbox functions at a given trial point (#2). + /** + - Non-const version. + - Calls the const version by default. + - May be user-defined. + - Surrogate or true evaluation depending on the value of \c x.is_surrogate(). + \param x The trial point -- \b IN/OUT. + \param h_max Maximal feasibility value \c h_max -- \b IN. + \param count_eval Flag indicating if the evaluation has to be counted + or not -- \b OUT. + \return A boolean equal to \c false if the evaluation failed. + */ + virtual bool eval_x ( NOMAD::Eval_Point & x , + const NOMAD::Double & h_max , + bool & count_eval ) { return static_cast<const Evaluator *>(this)->eval_x ( x , h_max , count_eval ); } - - - - /// Evaluate the blackbox functions at a given list of trial points (#1). - /** - - Const version. - - May be user-defined. - - Surrogate or true evaluation depending on the value of \c x.is_surrogate(). - \param x The list of trial points -- \b IN/OUT. - \param h_max Maximal feasibility value \c h_max -- \b IN. - \param count_eval Number of evaluations that are counted -- \b OUT. - \return A boolean equal to \c false if the evaluation failed. - */ - virtual bool eval_x ( std::list<NOMAD::Eval_Point *> &x , - const NOMAD::Double & h_max, - std::list<bool> & count_eval ) const; - - - /// Evaluate the blackbox functions at a given list of trial points (#2). - /** - - Non-Const version. - - May be user-defined. - - Surrogate or true evaluation depending on the value of \c x.is_surrogate(). - \param x The list of trial points -- \b IN/OUT. - \param h_max Maximal feasibility value \c h_max -- \b IN. - \param count_eval Number of evaluations that are counted -- \b OUT. - \return A boolean equal to \c false if the evaluation failed. - */ - virtual bool eval_x ( std::list<NOMAD::Eval_Point *> &x , - const NOMAD::Double & h_max, - std::list<bool> & count_eval ) - { - return static_cast<const Evaluator *>(this)->eval_x ( x , h_max , count_eval ); - } - - - - /// Compute the objective value \c f(x) from the blackbox outputs of a point. - /** - \param x The point -- \b IN/OUT. - */ - virtual void compute_f ( NOMAD::Eval_Point & x ) const; - - /// Compute the feasibility value \c h(x) from the blackbox outputs of a point. - /** - \param x The point -- \b IN/OUT. - */ - void compute_h ( NOMAD::Eval_Point & x ) const; - }; + + + + /// Evaluate the blackbox functions at a given list of trial points (#1). + /** + - Const version. + - May be user-defined. + - Surrogate or true evaluation depending on the value of \c x.is_surrogate(). + \param x The list of trial points -- \b IN/OUT. + \param h_max Maximal feasibility value \c h_max -- \b IN. + \param count_eval Number of evaluations that are counted -- \b OUT. + \return A boolean equal to \c false if the evaluation failed. + */ + virtual bool eval_x ( std::list<NOMAD::Eval_Point *> &x , + const NOMAD::Double & h_max, + std::list<bool> & count_eval ) const; + + + /// Evaluate the blackbox functions at a given list of trial points (#2). + /** + - Non-Const version. + - May be user-defined. + - Surrogate or true evaluation depending on the value of \c x.is_surrogate(). + \param x The list of trial points -- \b IN/OUT. + \param h_max Maximal feasibility value \c h_max -- \b IN. + \param count_eval Number of evaluations that are counted -- \b OUT. + \return A boolean equal to \c false if the evaluation failed. + */ + virtual bool eval_x ( std::list<NOMAD::Eval_Point *> &x , + const NOMAD::Double & h_max, + std::list<bool> & count_eval ) + { + return static_cast<const Evaluator *>(this)->eval_x ( x , h_max , count_eval ); + } + + + + /// Compute the objective value \c f(x) from the blackbox outputs of a point. + /** + \param x The point -- \b IN/OUT. + */ + virtual void compute_f ( NOMAD::Eval_Point & x ) const; + + /// Compute the feasibility value \c h(x) from the blackbox outputs of a point. + /** + \param x The point -- \b IN/OUT. + */ + void compute_h ( NOMAD::Eval_Point & x ) const; + }; } #endif diff --git a/src/Evaluator_Control.cpp b/src/Evaluator_Control.cpp index d0873d06ef2d7a735ed7f05dc8e0318f8a49ca5d..da3c97c2d264dd08aeffc56ffe055bb772977583 100644 --- a/src/Evaluator_Control.cpp +++ b/src/Evaluator_Control.cpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Evaluator_Control.cpp \brief Control of the blackbox evaluations (implementation) @@ -50,6 +52,10 @@ #include "Evaluator_Control.hpp" #include "Multi_Obj_Quad_Model_Evaluator.hpp" #include "Single_Obj_Quad_Model_Evaluator.hpp" +#include "Sgtelib_Model_Manager.hpp" + + +const double PI = 3.141592654; /*-----------------------------------*/ /* static members initialization */ @@ -61,30 +67,32 @@ bool NOMAD::Evaluator_Control::_force_evaluation_failure = false; /*---------------------------------------------------------*/ /* constructor */ /*---------------------------------------------------------*/ -NOMAD::Evaluator_Control::Evaluator_Control ( const NOMAD::Parameters & p , +NOMAD::Evaluator_Control::Evaluator_Control ( const NOMAD::Parameters & p , NOMAD::Stats & stats , NOMAD::Evaluator * ev , // can be NULL NOMAD::Cache * cache , // can be NULL - NOMAD::Cache * sgte_cache ) // can be NULL -: _p ( p ) , -_ev ( ev ) , -_cache ( cache ) , -_sgte_cache ( sgte_cache ) , -_model_eval_sort ( true ) , -_del_ev ( false ) , -_del_cache ( false ) , -_del_sgte_cache ( false ) , + NOMAD::Cache * sgte_cache ) // can be NULL +: _p ( p ) , +_ev ( ev ) , +_cache ( cache ) , +_sgte_cache ( sgte_cache ) , +_best_smooth_feas_inc ( NULL ) , +_model_eval_sort ( true ) , +_del_ev ( false ) , +_del_cache ( false ) , +_del_sgte_cache ( false ) , #ifdef USE_MPI -_eval_in_progress ( NULL ) , -_nb_in_progress ( 0 ) , -_elop_tag ( 0 ) , -_slaves_elop_tags ( NULL ) , -_slave ( NULL ) , +_eval_in_progress ( NULL ) , +_nb_in_progress ( 0 ) , +_elop_tag ( 0 ) , +_slaves_elop_tags ( NULL ) , +_slave ( NULL ) , #endif -_stats ( stats ) , -_last_stats_tag ( -1 ) , -_last_stats_bbe ( -1 ) , -_last_history_bbe ( -1 ) +_sgtelib_model_manager ( NULL ) , +_stats ( stats ) , +_last_stats_tag ( -1 ) , +_last_stats_bbe ( -1 ) , +_last_history_bbe ( -1 ) { NOMAD::Evaluator_Control::_force_quit = false; @@ -299,9 +307,9 @@ NOMAD::success_type NOMAD::Evaluator_Control::process_barrier_points ( NOMAD::Ba b1.reset_success(); NOMAD::Eval_Point * modifiable_x; - NOMAD::success_type one_eval_succ; + NOMAD::success_type one_eval_succ; const NOMAD::Eval_Point * last_success = NULL; - const std::list<const NOMAD::Eval_Point *> & all_inserted = b2.get_all_inserted(); + const std::list<const NOMAD::Eval_Point *> & all_inserted = b2.get_all_inserted(); std::list<const NOMAD::Eval_Point *>::const_iterator it , end = all_inserted.end(); for ( it = all_inserted.begin() ; it != end ; ++it ) { @@ -412,22 +420,29 @@ void NOMAD::Evaluator_Control::display_stats ( bool he #endif } - NOMAD::Double f; + NOMAD::Double f,f_smooth,h; const NOMAD::Point * sol = NULL; const NOMAD::Point * bbo = NULL; const NOMAD::Signature * signature = NULL; int bbe = _stats.get_bb_eval(); + int sgte_eval = _stats.get_sgte_eval(); + int reported_bbe_value = 0; + int reported_blk_eva_value = 0; + int reported_sgte_value = 0; int real_time = _stats.get_real_time(); int blk_bbe = _stats.get_block_eval(); int i; + bool valid_smooth = false; // this integer is used for the default width display // of the various stats on the number of evaluations: int max_bbe = _p.get_max_bb_eval(); if ( _p.get_max_sgte_eval() > max_bbe ) max_bbe = _p.get_max_sgte_eval(); + if ( _p.get_max_sim_bb_eval() > max_bbe ) max_bbe = _p.get_max_sim_bb_eval(); + if ( _p.get_max_eval() > max_bbe ) max_bbe = _p.get_max_eval(); @@ -435,8 +450,14 @@ void NOMAD::Evaluator_Control::display_stats ( bool he { signature = x->get_signature(); f = (feasible) ? x->get_f() : NOMAD::INF; + if ( _p.get_robust_mads() ) + { + f_smooth = x->get_fsmooth(); + valid_smooth = ( x->get_smoothing_status() == NOMAD::SMOOTHING_OK ); + } sol = x; bbo = &(x->get_bb_outputs()); + h = x->get_h(); if (bbe < _last_stats_bbe && ! multi_obj) return; @@ -447,7 +468,7 @@ void NOMAD::Evaluator_Control::display_stats ( bool he std::string s1 , format; - std::list<std::string>::const_iterator it , end = stats.end(); + std::list<std::string>::const_iterator it , itP, end = stats.end(); for ( it = stats.begin() ; it != end ; ++it ) { @@ -477,7 +498,7 @@ void NOMAD::Evaluator_Control::display_stats ( bool he NOMAD::display_stats_type dst = NOMAD::Display::get_display_stats_type ( *it ); - // some stats types are disables in the multi-objective case: + // some stats types are disabled in the multi-objective case: if ( multi_obj && ( dst == NOMAD::DS_SIM_BBE || dst == NOMAD::DS_BBE || @@ -493,8 +514,27 @@ void NOMAD::Evaluator_Control::display_stats ( bool he { case NOMAD::DS_UNDEFINED: s1 = *it; + + itP = it; + itP++; + NOMAD::Display::extract_display_format ( s1 , format ); - out << s1; + + if ( itP != end && _p.get_report_bbe_value() && NOMAD::Display::get_display_stats_type ( *(itP) ) == NOMAD::DS_BBE ) + reported_bbe_value = NOMAD::Display::extract_reported_count_value ( s1 ); + + if ( itP != end && _p.get_report_sgte_value() && NOMAD::Display::get_display_stats_type ( *(itP) ) == NOMAD::DS_SGTE ) + reported_sgte_value = NOMAD::Display::extract_reported_count_value ( s1 ); + + + if ( itP != end && _p.get_report_blk_eva_value() && NOMAD::Display::get_display_stats_type ( *(itP) ) == NOMAD::DS_BLK_EVA ) + reported_blk_eva_value = NOMAD::Display::extract_reported_count_value ( s1 ); + + + if ( reported_bbe_value == 0 && reported_blk_eva_value ==0 && reported_sgte_value == 0 ) + out << s1; + + break; case NOMAD::DS_OBJ: if ( multi_obj ) @@ -513,6 +553,27 @@ void NOMAD::Evaluator_Control::display_stats ( bool he format.clear(); } break; + case NOMAD::DS_CONS_H: + { + display_stats_real ( out , h , format ); + format.clear(); + break; + } + case NOMAD::DS_SMOOTH_OBJ: + { + + if ( f_smooth.is_defined() && valid_smooth ) + { + display_stats_real ( out , f_smooth , format ); + } + else + out << "0"; + + + break; + } + + case NOMAD::DS_MESH_INDEX: { @@ -568,20 +629,33 @@ void NOMAD::Evaluator_Control::display_stats ( bool he } #else { + if ( reported_bbe_value > 0 ) + bbe+=reported_bbe_value; + display_stats_int ( out , bbe , max_bbe , format ); + reported_bbe_value = 0; + } #endif format.clear(); break; case NOMAD::DS_BLK_EVA: { + if ( reported_blk_eva_value > 0 ) + blk_bbe+=reported_blk_eva_value; + display_stats_int ( out , blk_bbe , max_bbe , format ); + reported_blk_eva_value = 0; + } format.clear(); break; case NOMAD::DS_SGTE: - display_stats_int ( out , _stats.get_sgte_eval() , max_bbe , format ); + if ( reported_sgte_value > 0 ) + sgte_eval+=reported_sgte_value; + display_stats_int ( out , sgte_eval , max_bbe , format ); + reported_sgte_value = 0; format.clear(); break; case NOMAD::DS_EVAL: @@ -646,7 +720,7 @@ void NOMAD::Evaluator_Control::display_stats_type ( const NOMAD::Display case NOMAD::CONTINUOUS: format2 = "%0." + NOMAD::itos(DISPLAY_PRECISION_STD) + "g"; break; - case NOMAD::INTEGER || NOMAD::BINARY || NOMAD::CATEGORICAL: + case NOMAD::INTEGER : case NOMAD::BINARY : case NOMAD::CATEGORICAL: format2 = "%i"; break; default: @@ -744,11 +818,11 @@ void NOMAD::Evaluator_Control::display_stats_point ( const NOMAD::Display if ( !s1.empty() ) out << s1; - if ( !s2.empty() && i < n-1 && s2.find("(VNS)")==std::string::npos && s2.find("(PhaseOne)")==std::string::npos && s2.find("(LH)")==std::string::npos && s2.find("(ExtendedPoll)")==std::string::npos ) + if ( !s2.empty() && i < n-1 && s2.find("(VNS")==std::string::npos && s2.find("(PhaseOne")==std::string::npos && s2.find("(LH")==std::string::npos && s2.find("(ExtendedPoll")==std::string::npos ) out << " " << s2; out << " "; } - if ( !s2.empty() && (s2.find("(VNS)")!=std::string::npos || s2.find("(PhaseOne)")!=std::string::npos || s2.find("(LH)")!=std::string::npos || s2.find("(ExtendedPoll)")!=std::string::npos)) + if ( !s2.empty() && (s2.find("(VNS")!=std::string::npos || s2.find("(PhaseOne")!=std::string::npos || s2.find("(LH")!=std::string::npos || s2.find("(ExtendedPoll")!=std::string::npos)) out << s2; } } @@ -769,10 +843,10 @@ void NOMAD::Evaluator_Control::write_solution_file ( const NOMAD::Eval_Point & x /* or update the history file (HISTORY_FILE ) */ /* (private) */ /*----------------------------------------------*/ -void NOMAD::Evaluator_Control::write_sol_or_his_file ( const std::string & file_name , +void NOMAD::Evaluator_Control::write_sol_or_his_file ( const std::string & file_name , const NOMAD::Eval_Point & x , bool is_sol , - bool display_bimv ) const + bool display_bimv ) const { // if is_sol == true: save the solution file // else: update the history file @@ -955,16 +1029,22 @@ bool NOMAD::Evaluator_Control::cache_check ( const NOMAD::Eval_Point *& x // first cache check: if ( x->is_in_cache() ) + { cache_x = x; + } // second cache check: else + { cache_x = ( ( x->get_eval_type() == NOMAD::TRUTH ) ? _cache : _sgte_cache )->find ( *x ); + } + // cache hit: transfer some data from x to cache_x: if ( cache_x ) { + if ( x_eval_type != cache_x->get_eval_type() ) throw NOMAD::Exception ( "Evaluator_Control.cpp" , __LINE__ , "Evaluator_Control::cache_check(): eval and cache pts have different eval_type" ); @@ -1009,6 +1089,9 @@ bool NOMAD::Evaluator_Control::cache_check ( const NOMAD::Eval_Point *& x cache_x->get_h().is_defined() && cache_x->get_h() < h_max ) ) ) { + if ( display_degree == NOMAD::FULL_DISPLAY ) + cout << "in cache but redo"<<endl; + x = cache_x; cache_x = NULL; } @@ -1044,7 +1127,11 @@ bool NOMAD::Evaluator_Control::cache_check ( const NOMAD::Eval_Point *& x return true; } - + if ( display_degree == NOMAD::FULL_DISPLAY ) + { + const NOMAD::Display & out = _p.out(); + out << "not in cache"<<endl; + } return false; } @@ -1152,6 +1239,13 @@ void NOMAD::Evaluator_Control::eval_point ( NOMAD::Eval_Point & x x.set_in_cache ( false ); } + // Smoothing (robust mads) -->set f smooth + //------------- + // Smooth objective functions values from cache, get best solution (updated cache), update success status + if ( eval_ok && x.is_in_cache() && _p.get_robust_mads() ) + private_smooth_fx ( *eval_x ); + + } } @@ -1160,14 +1254,14 @@ void NOMAD::Evaluator_Control::eval_point ( NOMAD::Eval_Point & x /*----------------------------------------------------*/ /* eval points in a list (private) */ /*----------------------------------------------------*/ -void NOMAD::Evaluator_Control::eval_points ( std::list<NOMAD::Eval_Point *> & list_eval , - NOMAD::Barrier & true_barrier , - NOMAD::Barrier & sgte_barrier , - NOMAD::Pareto_Front * pareto_front , - std::list<bool> & count_list_eval , - bool & stop , - NOMAD::stop_type & stop_reason , - const NOMAD::Double & h_max ) +void NOMAD::Evaluator_Control::eval_points ( std::list<NOMAD::Eval_Point *> & list_eval , + NOMAD::Barrier & true_barrier , + NOMAD::Barrier & sgte_barrier , + NOMAD::Pareto_Front * pareto_front , + std::list<bool> & count_list_eval, + bool & stop , + NOMAD::stop_type & stop_reason , + const NOMAD::Double & h_max ) { int max_bb_eval = _p.get_max_bb_eval(); int max_sgte_eval = _p.get_max_sgte_eval(); @@ -1249,6 +1343,12 @@ void NOMAD::Evaluator_Control::eval_points ( std::list<NOMAD::Eval_Point *> _ev->compute_f ( *(*it) ); _ev->compute_h ( *(*it)); + // Smoothing (robust mads) -->set f smooth + //------------- + // Smooth objective functions values from cache and from eval_lop, get best solution (updated cache), update success status + if ( _p.get_robust_mads() ) + private_smooth_fx ( *(*it) ); + } else if (!eval_rejected) { @@ -1279,7 +1379,6 @@ void NOMAD::Evaluator_Control::eval_points ( std::list<NOMAD::Eval_Point *> (*it)->set_in_cache ( false ); } - // count the output stats (STAT_SUM and STAT_AVG): if ( (_p.check_stat_sum() || _p.check_stat_avg()) && !eval_rejected) count_output_stats(*(*it)); @@ -1340,6 +1439,15 @@ void NOMAD::Evaluator_Control::check_stopping_criteria { int max_bb_eval = _p.get_max_bb_eval(); int max_sgte_eval = _p.get_max_sgte_eval(); + int max_block_eval = _p.get_max_block_eval(); + + // stop when block eval budget is exhausted + if ( max_block_eval > 0 && _stats.get_block_eval() >= max_block_eval ) + { + stop = true; + stop_reason = NOMAD::MAX_BLOCK_EVAL_REACHED; + } + if ( max_bb_eval > 0 && _stats.get_bb_eval() >= max_bb_eval ) { stop = true; @@ -1503,6 +1611,14 @@ void NOMAD::Evaluator_Control::receive_eval_result ( NOMAD::search_type searc int max_bb_eval = _p.get_max_bb_eval(); int max_sgte_eval = _p.get_max_sgte_eval(); + int max_block_eval = _p.get_max_block_eval(); + + // stop when block eval budget is exhausted + if ( max_block_eval > 0 && _stats.get_block_eval() >= max_block_eval ) + { + stop = true; + stop_reason = NOMAD::MAX_BLOCK_EVAL_REACHED; + } if ( max_bb_eval > 0 && _stats.get_bb_eval() >= max_bb_eval ) { @@ -1707,8 +1823,7 @@ void NOMAD::Evaluator_Control::private_eval_list_of_points ( NOMAD::search_type const NOMAD::Eval_Point * x; NOMAD::check_failed_type check_failed_reason; bool count_eval; - std::vector<const NOMAD::Eval_Point *> - to_be_evaluated; + std::vector<const NOMAD::Eval_Point *> to_be_evaluated; NOMAD::success_type one_eval_success; bool one_for_luck = false; bool opp_stop = false; @@ -2124,6 +2239,11 @@ void NOMAD::Evaluator_Control::private_eval_list_of_points ( NOMAD::search_type old_feasible_incumbent = barrier.get_best_feasible(); old_infeasible_incumbent = barrier.get_best_infeasible(); + if ( _p.get_robust_mads() && _best_smooth_feas_inc ) + { + old_feasible_incumbent = _best_smooth_feas_inc; + } + NOMAD::Double f0; if ( _p.get_opportunistic_min_f_imprvmt().is_defined() && old_feasible_incumbent ) @@ -2144,8 +2264,8 @@ void NOMAD::Evaluator_Control::private_eval_list_of_points ( NOMAD::search_type int k = 0; int k_block = 0; int nb_points = get_nb_eval_points(); - int block_size = _p.get_bb_max_block_size(); - int block_nb = 1; + int block_size = _p.get_bb_max_block_size(); + int block_nb = 1; // main loop (on the list of points): // ---------------------------------- @@ -2155,8 +2275,6 @@ void NOMAD::Evaluator_Control::private_eval_list_of_points ( NOMAD::search_type while ( !stop_evals && !stop && it != end ) { - - if ( block_size > 1 && display_degree == NOMAD::FULL_DISPLAY ) { std::ostringstream oss; @@ -2221,6 +2339,7 @@ void NOMAD::Evaluator_Control::private_eval_list_of_points ( NOMAD::search_type list_eval.push_back(&NOMAD::Cache::get_modifiable_point ( *x )); else { + // check stopping criteria for points in cache check_stopping_criteria ( search , count_eval , *x , stop , stop_reason ); @@ -2278,6 +2397,7 @@ void NOMAD::Evaluator_Control::private_eval_list_of_points ( NOMAD::search_type ++it; ++k; } + if ( list_eval.size() != 0 ) { @@ -2285,27 +2405,28 @@ void NOMAD::Evaluator_Control::private_eval_list_of_points ( NOMAD::search_type if (_p.eval_points_as_block()) { - eval_points ( list_eval , - true_barrier , - sgte_barrier , - pareto_front , + eval_points ( list_eval , + true_barrier , + sgte_barrier , + pareto_front , count_list_eval , - stop , + stop , stop_reason , - barrier.get_h_max()); + barrier.get_h_max() ); } else { // bool count_eval=false; x=*(list_eval.begin()); - eval_point ( NOMAD::Cache::get_modifiable_point ( *x ) , + + eval_point ( NOMAD::Cache::get_modifiable_point ( *x ) , true_barrier , sgte_barrier , pareto_front , - count_list_eval.front() , + count_list_eval.front() , stop , - stop_reason , - barrier.get_h_max() ); + stop_reason , + barrier.get_h_max() ); } @@ -2319,6 +2440,7 @@ void NOMAD::Evaluator_Control::private_eval_list_of_points ( NOMAD::search_type std::list<NOMAD::Eval_Point *>::iterator it_x,it_eval; k=k_block; it_eval=list_eval.begin(); + success = NOMAD::UNSUCCESSFUL; for(it_x=list_x.begin();it_x!=list_x.end();++it_x) { @@ -2331,13 +2453,40 @@ void NOMAD::Evaluator_Control::private_eval_list_of_points ( NOMAD::search_type true_barrier : sgte_barrier , pareto_front ); + // With RobustMads smoothing, the barrier is not used to identify a success (no constraints are allowed) + NOMAD::success_type one_eval_success = NOMAD::UNSUCCESSFUL; + if ( _p.get_robust_mads() && _best_smooth_feas_inc && x->is_in_cache() ) + { + if ( _best_smooth_feas_inc != old_feasible_incumbent ) + { + + if ( x==_best_smooth_feas_inc ) + { + one_eval_success = NOMAD::FULL_SUCCESS; + success = NOMAD::FULL_SUCCESS; + } + else + { + one_eval_success = NOMAD::CACHE_UPDATE_SUCCESS; + success = NOMAD::CACHE_UPDATE_SUCCESS; + } + new_feas_inc = _best_smooth_feas_inc; + + barrier.reset(); + barrier.insert( *_best_smooth_feas_inc ); + barrier.select_poll_center( one_eval_success ); + + } + } + else + { + // success: + one_eval_success = barrier.get_one_eval_succ(); + success = barrier.get_success(); + } - // success: - NOMAD::success_type one_eval_success = barrier.get_one_eval_succ(); - success = barrier.get_success(); - // list of processed points: if ( x->is_in_cache() ) evaluated_pts.push_back ( x ); @@ -2347,6 +2496,7 @@ void NOMAD::Evaluator_Control::private_eval_list_of_points ( NOMAD::search_type // the point has not been found in the cache // and it failed to be inserted. one_eval_success = NOMAD::UNSUCCESSFUL; + } // displays: @@ -2393,8 +2543,6 @@ void NOMAD::Evaluator_Control::private_eval_list_of_points ( NOMAD::search_type } } - - // close the evaluation block: if ( display_degree == NOMAD::FULL_DISPLAY ) out << NOMAD::close_block (); @@ -2452,13 +2600,16 @@ void NOMAD::Evaluator_Control::private_eval_list_of_points ( NOMAD::search_type out << std::endl << NOMAD::close_block ( "end of evaluations" ) << std::endl; - // incumbents update: - const NOMAD::Eval_Point * bf = barrier.get_best_feasible (); - const NOMAD::Eval_Point * bi = barrier.get_best_infeasible(); - if ( bf && bf != old_feasible_incumbent ) - new_feas_inc = bf; - if ( bi && bi != old_infeasible_incumbent ) - new_infeas_inc = bi; + if ( ! _p.get_robust_mads() || _best_smooth_feas_inc==NULL ) + { + const NOMAD::Eval_Point * bf = barrier.get_best_feasible (); + const NOMAD::Eval_Point * bi = barrier.get_best_infeasible(); + if ( bf && bf != old_feasible_incumbent ) + new_feas_inc = bf; + if ( bi && bi != old_infeasible_incumbent ) + new_infeas_inc = bi; + } + // the list of eval. points is deleted (only points in the cache are kept): clear_eval_lop(); @@ -2860,6 +3011,63 @@ void NOMAD::Evaluator_Control::quad_model_ordering ( NOMAD::dd_type display_degr } + +/*-------------------------------------------------*/ +/* sgtelib_model model ordering (private) */ +/*-------------------------------------------------*/ +void NOMAD::Evaluator_Control::sgtelib_model_ordering ( NOMAD::dd_type display_degree , + bool & modified_list ) +{ + modified_list = false; + + if ( _p.get_SGTELIB_MODEL_FORMULATION()==NOMAD::SGTELIB_MODEL_FORMULATION_EXTERN ) + { + // ROBIN + return; + } + + + + if ( _sgtelib_model_manager && _sgtelib_model_manager->is_ready() ){ + + NOMAD::Double h_model; + const NOMAD::Double h_max; + bool count_eval = false; + std::vector<NOMAD::Eval_Point *> XX; + const NOMAD::Eval_Point * x; + std::set<NOMAD::Priority_Eval_Point>::const_iterator it , end = _eval_lop.end(); + + + for ( it = _eval_lop.begin() ; it != end ; ++it ) + { + x = it->get_point(); + XX.push_back ( &NOMAD::Cache::get_modifiable_point ( *x ) ); + } + + int n_XX = static_cast<int>( XX.size() ); + _eval_lop.clear(); + + for ( int i = 0 ; i < n_XX ; ++i ) + { + // Prediction + _sgtelib_model_manager->eval_x( XX[i] , h_max , count_eval ); + // Evaluation of h & f + _sgtelib_model_manager->eval_h ( XX[i]->get_bb_outputs() , h_model ); + + // Add the point the eval_lop + add_eval_point ( XX[i] , + display_degree , + _p.get_snap_to_bounds(), + NOMAD::Double() , + NOMAD::Double() , + XX[i]->get_f() , + h_model ); + }//end for + }// end if + modified_list = true; +} + + /*----------------------------------------------------------------------------------*/ /* evaluation of a list of points (public version that calls the private version) */ /*----------------------------------------------------------------------------------*/ @@ -2968,6 +3176,9 @@ void NOMAD::Evaluator_Control::eval_list_of_points ( NOMAD::search_type { switch ( _p.get_model_eval_sort() ) { + case NOMAD::SGTELIB_MODEL: + sgtelib_model_ordering ( display_degree , modified_list ); + break; case NOMAD::QUADRATIC_MODEL: quad_model_ordering ( display_degree , modified_list ); break; @@ -3126,6 +3337,9 @@ void NOMAD::Evaluator_Control::ordering_lop ( NOMAD::search_type sea case NOMAD::QUADRATIC_MODEL: quad_model_ordering ( display_degree , modified_list ); break; + case NOMAD::SGTELIB_MODEL: + sgtelib_model_ordering ( display_degree , modified_list ); + break; case NOMAD::NO_MODEL:; } } @@ -3203,7 +3417,7 @@ bool NOMAD::Evaluator_Control::stop_evaluations ( const NOMAD::Eval_Point & x return true; } - if ( success == NOMAD::FULL_SUCCESS && + if ( ( success == NOMAD::FULL_SUCCESS || success == NOMAD::CACHE_UPDATE_SUCCESS ) && check_opportunistic_criterion ( display_degree , one_eval_success , init_nb_eval , @@ -3222,13 +3436,13 @@ bool NOMAD::Evaluator_Control::stop_evaluations ( const NOMAD::Eval_Point & x /* return true to stop the evaluations */ /* return false to continue the evaluations */ /*-----------------------------------------------------------------*/ -bool NOMAD::Evaluator_Control::check_opportunistic_criterion ( NOMAD::dd_type display_degree , +bool NOMAD::Evaluator_Control::check_opportunistic_criterion ( NOMAD::dd_type display_degree , NOMAD::success_type one_eval_success , int init_nb_eval , const NOMAD::Double & f0 , const NOMAD::Barrier & barrier , int & nb_success , - bool & one_for_luck ) const + bool & one_for_luck ) const { int min_nb_success = _p.get_opportunistic_min_nb_success(); @@ -3240,8 +3454,7 @@ bool NOMAD::Evaluator_Control::check_opportunistic_criterion ( NOMAD::dd_type // min_nb_success: if ( min_nb_success > 0 ) { - - if ( one_eval_success == NOMAD::FULL_SUCCESS ) + if ( one_eval_success == NOMAD::FULL_SUCCESS || one_eval_success == NOMAD::CACHE_UPDATE_SUCCESS ) ++nb_success; if ( nb_success < min_nb_success ) @@ -3308,7 +3521,7 @@ bool NOMAD::Evaluator_Control::check_opportunistic_criterion ( NOMAD::dd_type } // lucky_eval: - if ( lucky_eval && one_eval_success == NOMAD::FULL_SUCCESS ) + if ( lucky_eval && ( one_eval_success == NOMAD::FULL_SUCCESS || one_eval_success == NOMAD::CACHE_UPDATE_SUCCESS ) ) { one_for_luck = true; @@ -3456,6 +3669,7 @@ void NOMAD::Evaluator_Control::add_eval_point( NOMAD::Eval_Point *& x // 2. model values for f and h: pep.set_f_model ( f_model ); pep.set_h_model ( h_model ); + if ( x->get_direction() ) { @@ -3495,6 +3709,139 @@ void NOMAD::Evaluator_Control::add_eval_point( NOMAD::Eval_Point *& x } } +void NOMAD::Evaluator_Control::private_smooth_fx( NOMAD::Eval_Point & eval_pt ) +{ + + if ( ! eval_pt.is_defined()) + throw NOMAD::Exception ("Evaluator_Control.cpp" , __LINE__ ,"NOMAD::Evaluator_Control::private_smooth_fx ---- eval point is not defined. No smoothing is done!" ); + + + NOMAD::Double Px,Fx,gu,Fu; + NOMAD::Eval_Point & ptX_1 = _cache->get_modifiable_point( eval_pt ); + + if ( ptX_1.get_f().value() >= NOMAD::INF || ptX_1.get_f().value() <= -NOMAD::INF ) + { + ptX_1.set_smoothing_status ( NOMAD::SMOOTHING_FAIL ); + return; + } + + // Set the kernel smoothing variance of the point + NOMAD::Point Delta = _p.get_signature()->get_mesh()->get_Delta(); + NOMAD::Double D = Delta[0]; + + NOMAD::Double sigma = D * _p.get_robust_mads_standard_dev_factor() ; + ptX_1.set_smoothing_variance( sigma * sigma ); + + + // Initialize fsmooth with eval point + NOMAD::Double Psmooth=private_grondd ( ptX_1 , ptX_1 ); + NOMAD::Double fsmooth=Psmooth*ptX_1.get_f(); + + // First: Update evaluated point (eval_pt)----> loop on points in cache (U first) + const NOMAD::Eval_Point * curU_1 = _cache->begin(); + + while ( curU_1 ) + { + if ( curU_1->get_eval_status() == NOMAD::EVAL_OK && curU_1->get_f() < NOMAD::INF && curU_1->get_f() > -NOMAD::INF ) + { + + gu = private_grondd ( ptX_1 , *curU_1 ); + Fu = curU_1->get_f(); + + if ( ! gu.is_defined() || ! Fu.is_defined() ) + { + throw NOMAD::Exception ("Evaluator_Control.cpp" , __LINE__ ,"NOMAD::Evaluator_Control::private_smooth_fx_pt ---- not enough information for smoothing fx!" ); + + } + + fsmooth += gu * Fu; + Psmooth += gu; + } + curU_1 = _cache->next(); + } + + fsmooth = fsmooth / Psmooth; + + if ( isnan( fsmooth.value() ) || isnan( Psmooth.value() ) ) + { + ptX_1.set_smoothing_status ( NOMAD::SMOOTHING_FAIL ); + } + else + { + ptX_1.set_smoothing_status ( NOMAD::SMOOTHING_OK ); + ptX_1.set_fsmooth( fsmooth ); + ptX_1.set_P( Psmooth ); + + if ( _best_smooth_feas_inc==NULL || ( _best_smooth_feas_inc->is_defined() && ptX_1.get_fsmooth() < _best_smooth_feas_inc->get_fsmooth() ) ) + _best_smooth_feas_inc = &eval_pt; + + } + + // Second: update pts in cache + const NOMAD::Eval_Point * curX_2 = _cache->begin(); + + while ( curX_2 ) + { + if ( curX_2->get_eval_status() == NOMAD::EVAL_OK && curX_2->get_smoothing_status() == NOMAD::SMOOTHING_OK && eval_pt.get_smoothing_status () == NOMAD::SMOOTHING_OK ) + { + + NOMAD::Eval_Point & ptX_2 = _cache->get_modifiable_point( *curX_2 ); + + Psmooth=ptX_2.get_P(); + fsmooth=Psmooth*ptX_2.get_fsmooth(); + + gu = private_grondd( ptX_2 , eval_pt ); + Fu = eval_pt.get_f(); + + if ( ! gu.is_defined() || ! Fu.is_defined() ) + { + throw NOMAD::Exception ("Evaluator_Control.cpp" , __LINE__ ,"NOMAD::Evaluator_Control::private_smooth_fx_pt ---- not enough information for smoothing fx!" ); + } + + fsmooth += gu * Fu; + Psmooth += gu; + fsmooth = fsmooth / Psmooth; + + // Update only if fsmooth and Psmooth are valid + if ( ! isnan( fsmooth.value() ) && ! isnan( Psmooth.value() ) ) + { + ptX_2.set_fsmooth( fsmooth ); + ptX_2.set_P( Psmooth ); + + if ( ptX_2.get_fsmooth() < _best_smooth_feas_inc->get_fsmooth() ) + _best_smooth_feas_inc = &ptX_2; + } + } + + curX_2=_cache->next(); + + } + +} + +NOMAD::Double NOMAD::Evaluator_Control::private_grondd ( const NOMAD::Eval_Point & x1 , const NOMAD::Eval_Point & x2 ) +{ + + // Important remark: x1 and x2 may have different smoothing variance ---> order matters! + double var = x1.get_smoothing_variance().value(); + + if ( ! x1.get_smoothing_variance().is_defined() ) + throw NOMAD::Exception ("Evaluator_Control.cpp" , __LINE__ ,"NOMAD::Evaluator_Control::private_grondd ---- variance smoothing is not available!" ); + + double g = pow( 2 * PI * var , -0.5 ); + if ( x1 != x2 ) + { + double d=0; + for ( int i=0; i < x1.size() ;i++ ) + { + d+=( x1[i].value()-x2[i].value() ) * ( x1[i].value()-x2[i].value() ) ; + } + g *= exp( - d / (2.0 * var ) ); + } + return NOMAD::Double ( g ); + +} + #ifdef MODEL_STATS /*------------------------------------------------------------------*/ /* display stats on an evaluation for which a model has been used */ diff --git a/src/Evaluator_Control.hpp b/src/Evaluator_Control.hpp index 7ec88a0e4a35b394c06c6b1a66ec5009b1032017..f7b674a9caf649c72a0b6bff08e55e7e6e756566 100644 --- a/src/Evaluator_Control.hpp +++ b/src/Evaluator_Control.hpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Evaluator_Control.hpp \brief Control of the blackbox evaluations (headers) @@ -64,9 +66,11 @@ extern "C" { namespace NOMAD { + class Sgtelib_Model_Manager; + /// Control of the blackbox evaluations. /** - This class allows the evaluation of a list of trial point. + This class allows the evaluation of a list of trial points. */ class Evaluator_Control : private NOMAD::Uncopyable { @@ -81,6 +85,8 @@ namespace NOMAD { NOMAD::Cache * _cache; ///< Cache for true function evaluations. NOMAD::Cache * _sgte_cache; ///< Cache for surrogate evaluations. + NOMAD::Eval_Point * _best_smooth_feas_inc; + /// List of points to be evaluated. std::set<NOMAD::Priority_Eval_Point> _eval_lop; @@ -114,6 +120,10 @@ namespace NOMAD { NOMAD::Slave * _slave; // Slave object for master process #endif + + + NOMAD::Sgtelib_Model_Manager * _sgtelib_model_manager; + NOMAD::Model_Stats _model_ordering_stats; ///< Model ordering stats. NOMAD::Stats & _stats; ///< Algorithm stats. @@ -144,11 +154,11 @@ namespace NOMAD { /// Save the solution file or update the history file. /** - \param file_name Name of the file -- \b IN. - \param x Lattest solution -- \b IN. - \param is_sol Flag equal to \c true if the file is - a solution file; otherwise it is a history file. -- \b IN. - \param display_bimv Display best infeasible (min. viol.)(optional) if \c true + \param file_name Name of the file -- \b IN. + \param x Lattest solution -- \b IN. + \param is_sol Flag equal to \c true if the file is + a solution file; otherwise it is a history file. + \param display_bimv Display best infeasible (min. viol.) if \c true */ void write_sol_or_his_file ( const std::string & file_name , const NOMAD::Eval_Point & x , @@ -233,8 +243,16 @@ namespace NOMAD { */ void quad_model_ordering ( NOMAD::dd_type display_degree , bool & modified_list ); + - + /// Sgtelib model ordering (parameter \c MODEL_EVAL_SORT). + /** + \param display_degree Display degree -- \b IN. + \param modified_list To indicate a change in the evaluation list -- \b OUT. + */ + void sgtelib_model_ordering ( NOMAD::dd_type display_degree , + bool & modified_list ); + /// Count the output stats (STAT_SUM and STAT_AVG). /** @@ -287,24 +305,24 @@ namespace NOMAD { /// Evaluate points. /* - \param list_x The list of points -- \b IN/OUT. - \param true_barrier Barrier for true evaluations -- \b IN/OUT. - \param sgte_barrier Barrier for surrogate evaluations -- \b IN/OUT. - \param pareto_front A pointer to the Pareto front -- \b IN/OUT + \param list_x The list of points -- \b IN/OUT. + \param true_barrier Barrier for true evaluations -- \b IN/OUT. + \param sgte_barrier Barrier for surrogate evaluations -- \b IN/OUT. + \param pareto_front A pointer to the Pareto front -- \b IN/OUT (may be \c NULL). - \param list_count_eval A list of bool for counted evaluations -- \b OUT. - \param stop Stop flag -- \b IN/OUT. - \param stop_reason Stop reason -- \b OUT. - \param h_max Maximal feasibility value -- \b IN. + \param list_count_eval A list of bool for counted evaluations -- \b OUT. + \param stop Stop flag -- \b IN/OUT. + \param stop_reason Stop reason -- \b OUT. + \param h_max Maximal feasibility value -- \b IN. */ - void eval_points ( std::list<NOMAD::Eval_Point *> & list_x , - NOMAD::Barrier & true_barrier , - NOMAD::Barrier & sgte_barrier , - NOMAD::Pareto_Front * pareto_front , - std::list<bool> & list_count_eval , - bool & stop , - NOMAD::stop_type & stop_reason , - const NOMAD::Double & h_max ); + void eval_points ( std::list<NOMAD::Eval_Point *> & list_x , + NOMAD::Barrier & true_barrier , + NOMAD::Barrier & sgte_barrier , + NOMAD::Pareto_Front * pareto_front , + std::list<bool> & list_count_eval , + bool & stop , + NOMAD::stop_type & stop_reason , + const NOMAD::Double & h_max ); @@ -393,6 +411,12 @@ namespace NOMAD { std::list<const NOMAD::Eval_Point *> & evaluated_pts ); + void private_smooth_fx ( NOMAD::Eval_Point & eval_pt ); + + NOMAD::Double private_grondd ( const NOMAD::Eval_Point & x1 , const NOMAD::Eval_Point & x2 ) ; + + + #ifdef MODEL_STATS /// Display stats on an evaluation for which a model has been used. /** @@ -531,8 +555,8 @@ namespace NOMAD { /// Update the solution file. /** - \param x The lattest solution -- \b IN. - \param display_bimv Required to display least infeasible (default=false) -- \b IN + \param x The lattest solution -- \b IN. + \param display_bimv Required to display least infeasible (default=false) -- \b IN */ void write_solution_file ( const NOMAD::Eval_Point & x , bool display_bimv=false) const; @@ -605,6 +629,12 @@ namespace NOMAD { */ void set_evaluator ( NOMAD::Evaluator * e ) { _ev = e; } + /// Set the sgtelib model manager. + /** + \param dtm A pointer to the sgtelib model manager -- \b IN. + */ + void set_sgtelib_model_manager ( NOMAD::Sgtelib_Model_Manager * dtm ){ _sgtelib_model_manager = dtm; } + /// Reset. void reset ( void ); diff --git a/src/Exception.cpp b/src/Exception.cpp index b455c0dd774c1ca49e2ba3956b72297c6d004099..afbcc022155a81f74c2042bc41f47ab83608c03b 100644 --- a/src/Exception.cpp +++ b/src/Exception.cpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Exception.cpp \brief custom class for exceptions (implementation) @@ -55,7 +57,8 @@ const char * NOMAD::Exception::what ( void ) const throw() { std::ostringstream oss; - oss << "NOMAD::Exception thrown (" << _file << ", " << _line << ")"; + if ( ! _file.empty() || _line > 0 ) + oss << "NOMAD::Exception thrown (" << _file << ", " << _line << ")"; if ( !_what.empty() ) oss << " " << _what; _what = oss.str(); diff --git a/src/Exception.hpp b/src/Exception.hpp index 84f0c7fd8ef589ce7410df7151b7622f325bd506..13f6c3fb683976c1e0e7b0f5afff8ca656f3f6ce 100644 --- a/src/Exception.hpp +++ b/src/Exception.hpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Exception.hpp \brief Custom class for exceptions (headers) diff --git a/src/Extended_Poll.cpp b/src/Extended_Poll.cpp index f09390fea7623f9e8a48bda7bb0d733b946440b4..c0b59a5e45468a3fe48bda1f1139ea125de39199 100644 --- a/src/Extended_Poll.cpp +++ b/src/Extended_Poll.cpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Extended_Poll.cpp \brief Extended poll for categorical variables (implementation) @@ -133,8 +135,8 @@ void NOMAD::Extended_Poll::add_extended_poll_point ( NOMAD::Point & ep , // new eval point: // --------------- NOMAD::Eval_Point * pt = new NOMAD::Eval_Point; - pt->set ( ep , _p.get_bb_nb_outputs() ); - pt->set_signature ( new_s ); + pt->set ( ep , _p.get_bb_nb_outputs() ); + pt->set_signature ( new_s ); for ( int i = 0 ; i < pt->get_n() ; ++i ) @@ -313,7 +315,7 @@ void NOMAD::Extended_Poll::descent ( const NOMAD::Eval_Point * y l2 = static_cast<int>((old_bi->get_signature()->get_mesh()->get_min_mesh_indices())[0].value()); - descent_p.get_signature()->get_mesh()->set_limit_mesh_index( std::min( l1, l2) ); + descent_p.get_signature()->get_mesh()->set_limit_mesh_index( std::min( l1, l2) ); // Evaluator_Control object: @@ -539,7 +541,7 @@ void NOMAD::Extended_Poll::set_descent_parameters ( const NOMAD::Eval_Point * y descent_p.set_PERIODIC_VARIABLE ( epc_signature->get_periodic_variables() ); descent_p.set_VARIABLE_GROUP ( epc_signature->get_var_groups() ); descent_p.set_BB_OUTPUT_TYPE ( _p.get_bb_output_type() ); - descent_p.set_DIRECTION_TYPE ( _p.get_direction_types() ); + descent_p.set_DIRECTION_TYPE ( _p.get_direction_types() ); descent_p.set_SEC_POLL_DIR_TYPE ( _p.get_sec_poll_dir_types() ); @@ -574,6 +576,7 @@ void NOMAD::Extended_Poll::set_descent_parameters ( const NOMAD::Eval_Point * y descent_p.set_MODEL_EVAL_SORT ( _p.get_model_eval_sort()); descent_p.set_MODEL_SEARCH (_p.has_model_search()); + } @@ -581,6 +584,7 @@ void NOMAD::Extended_Poll::set_descent_parameters ( const NOMAD::Eval_Point * y int bbe = stats.get_bb_eval(); int sgte_eval = stats.get_sgte_eval(); + int blk_eva = stats.get_block_eval(); { int p_max_bbe = _p.get_max_bb_eval(); @@ -629,7 +633,7 @@ void NOMAD::Extended_Poll::set_descent_parameters ( const NOMAD::Eval_Point * y descent_p.set_OPPORTUNISTIC_MIN_NB_SUCCESS ( _p.get_opportunistic_min_nb_success() ); if ( _p.eval_points_as_block() ) - descent_p.set_BB_MAX_BLOCK_SIZE( _p.get_bb_max_block_size() ); + descent_p.set_BB_MAX_BLOCK_SIZE( _p.get_bb_max_block_size() ); descent_p.set_CACHE_FILE ( _p.get_cache_file() ); @@ -646,42 +650,101 @@ void NOMAD::Extended_Poll::set_descent_parameters ( const NOMAD::Eval_Point * y else descent_p.set_DISPLAY_DEGREE ( _p.out().get_poll_dd()); - // Stats style modified - if ( has_sgte ) - descent_p.set_DISPLAY_STATS ( NOMAD::itos(sgte_eval) + "+SGTE OBJ (ExtendedPoll---surrogate)" ); - else + std::string s_bbe = NOMAD::itos(bbe) + "+"; + std::string s_blk = NOMAD::itos(blk_eva) + "+"; + std::string s_sgte = NOMAD::itos(sgte_eval) + "+"; + + // Display stats { std::list<std::string> ds = _p.get_display_stats(); - std::list<std::string>::iterator it = ds.begin(); - std::list<std::string>::const_iterator end = ds.end(); - std::string s_bbe = NOMAD::itos(bbe) + "+"; - while ( it != end ) + std::list<std::string>::iterator it = ds.begin(); + std::list<std::string>::iterator end = ds.end(); + + if ( has_sgte ) { - if (*it == "BBE") - ds.insert ( it , s_bbe ); - ++it; + while ( it != ds.end() ) + { + if ( *it == "BBE" ) + { + it = ds.erase ( it ); + ds.insert ( it , NOMAD::itos(bbe) ); + } + if ( *it == "BLK_EVA" ) + { + it = ds.erase ( it ); + ds.insert ( it , NOMAD::itos(blk_eva) ); + } + if ( *it == "SGTE" ) + ds.insert ( it , s_sgte ); + + ++it; + } + ds.push_back(" "); + ds.push_back ( "(ExtendedPoll#" + NOMAD::itos(stats.get_nb_ext_poll()) + "--surrogate_evals)" ); + descent_p.set_DISPLAY_STATS ( ds ); + + } + else + { + + while ( it != end ) + { + if ( *it == "BBE" ) + ds.insert ( it , s_bbe ); + if ( *it == "BLK_EVA" ) + ds.insert ( it , s_blk ); + ++it; + } + ds.push_back(" "); + ds.push_back ( "(ExtendedPoll#" + NOMAD::itos(stats.get_nb_ext_poll()) + ")" ); + + descent_p.set_DISPLAY_STATS ( ds ); } - ds.push_back ( " (ExtendedPoll)" ); - descent_p.set_DISPLAY_STATS ( ds ); } // STATS_FILE: - if ( has_sgte ) - descent_p.set_STATS_FILE ( _p.get_stats_file_name() , NOMAD::itos(sgte_eval) + "+SGTE OBJ (ExtendedPoll---surrogate)" ); - else { std::list<std::string> sf = _p.get_stats_file(); std::list<std::string>::iterator it = sf.begin(); std::list<std::string>::const_iterator end = sf.end(); - std::string s_bbe = NOMAD::itos(bbe) + "+"; - while ( it != end ) + if ( has_sgte ) { - if ( *it == "BBE" ) - sf.insert ( it , s_bbe ); - ++it; + while ( it != sf.end() ) + { + if ( *it == "BBE" ) + { + it = sf.erase ( it ); + sf.insert ( it , NOMAD::itos(bbe) ); + } + if ( *it == "BLK_EVA" ) + { + it = sf.erase ( it ); + sf.insert ( it , NOMAD::itos(blk_eva) ); + } + if ( *it == "SGTE" ) + sf.insert ( it , s_sgte ); + + ++it; + } + sf.push_back(" "); + sf.push_back ( "(ExtendedPoll#" + NOMAD::itos(stats.get_nb_ext_poll()) + "--surrogate_evals)" ); + descent_p.set_STATS_FILE ( _p.get_stats_file_name() , sf ); + } + else + { + + while ( it != end ) + { + if ( *it == "BBE" ) + sf.insert ( it , s_bbe ); + if ( *it == "BLK_EVA" ) + sf.insert ( it , s_blk ); + ++it; + } + sf.push_back(" "); + sf.push_back ( "(ExtendedPoll#" + NOMAD::itos(stats.get_nb_ext_poll()) + ")" ); + descent_p.set_STATS_FILE ( _p.get_stats_file_name() , sf ); } - sf.push_back ( " (ExtendedPoll)" ); - descent_p.set_STATS_FILE ( _p.get_stats_file_name() , sf ); } // Mesh: @@ -689,7 +752,8 @@ void NOMAD::Extended_Poll::set_descent_parameters ( const NOMAD::Eval_Point * y const OrthogonalMesh * mesh = epc_signature->get_mesh(); descent_p.set_MIN_MESH_SIZE ( mesh->get_min_mesh_size() ); descent_p.set_MIN_POLL_SIZE ( mesh->get_min_poll_size() ); - descent_p.set_INITIAL_POLL_SIZE ( mesh->get_initial_poll_size() , false ); + descent_p.set_INITIAL_POLL_SIZE ( mesh->get_initial_poll_size() , false ); + } // check the parameters: diff --git a/src/Extended_Poll.hpp b/src/Extended_Poll.hpp index 93df428b79306e86b4ec7f1c07a832c06df90953..e11a2f8370340e1c9536fa7eacab18e6ef298686 100644 --- a/src/Extended_Poll.hpp +++ b/src/Extended_Poll.hpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Extended_Poll.hpp \brief Extended poll for categorical variables (headers) diff --git a/src/Filter_Point.hpp b/src/Filter_Point.hpp index 58de3cfeeb9a7ef885d7641e0927b69fd3c65549..408075732995e9556fcb530aa9152dbf832d7dac 100644 --- a/src/Filter_Point.hpp +++ b/src/Filter_Point.hpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Filter_Point.hpp \brief Point stored in the filter (headers) diff --git a/src/GMesh.cpp b/src/GMesh.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ed4be769c7b5ca6258afb0b767809085c142204e --- /dev/null +++ b/src/GMesh.cpp @@ -0,0 +1,650 @@ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + +/** + \file GMesh.cpp + \brief Class for the MADS xmesh (implementation) + \author Christophe Tribes + \date 2014-07 + \see GMesh.hpp + */ +#include "GMesh.hpp" +#include <math.h> + + +/*-----------------------------------------------------------*/ +/* init the GMesh */ +/*-----------------------------------------------------------*/ +void NOMAD::GMesh::init ( ) +{ + + if ( _limit_mesh_index > 0 ) + throw NOMAD::Exception ( "GMesh.cpp" , __LINE__ , + "NOMAD::GMesh::GMesh(): limit mesh index must be <=0 " ); + // Set the mesh indices + _r.resize( _n ); + _r_max.resize( _n ); + _r_min.resize( _n ); + + for ( int k = 0 ; k < _n ; ++k ) + { + _r[k]=0; + _r_max[k]=0; + _r_min[k]=0; + } + + // Set the mesh mantissas and exponents + init_poll_size_granular ( _Delta_0 ); + + // Update mesh and poll after granular sizing + _Delta_0_exp = _Delta_exp ; + _Delta_0_mant = _Delta_mant; + get_Delta ( _Delta_0 ); + get_delta ( _delta_0 ); + + + +} + + +/*-----------------------------------------------------------*/ +/* Update the provided mesh indices (the Mesh is unchanged). */ +/*-----------------------------------------------------------*/ +void NOMAD::GMesh::update ( NOMAD::success_type success , + NOMAD::Point & mesh_indices, + const NOMAD::Direction *dir ) const +{ + + if ( mesh_indices.is_defined() ) + { + + if ( dir && dir->size() != mesh_indices.size() ) + throw NOMAD::Exception ( "GMesh.cpp" , __LINE__ , + "NOMAD::GMesh::update(): mesh_indices and dir have different sizes" ); + + for (int i=0; i < mesh_indices.size() ; i++) + { + if ( ! _fixed_variables.is_defined() && success == NOMAD::FULL_SUCCESS ) + { + mesh_indices[i] ++; + + if ( mesh_indices[i] > -NOMAD::GL_LIMITS ) + mesh_indices[i] = -NOMAD::GL_LIMITS; + } + else if ( ! _fixed_variables.is_defined() && success == NOMAD::UNSUCCESSFUL ) + mesh_indices[i] --; + } + } +} + + + +/*-----------------------------------------------------------*/ +/* update the granular mesh */ +/*-----------------------------------------------------------*/ +void NOMAD::GMesh::update ( NOMAD::success_type success , const NOMAD::Direction * d ) +{ + + if ( d && d->size() != _n ) + throw NOMAD::Exception ( "GMesh.cpp" , __LINE__ , + "NOMAD::GMesh::update(): delta_0 and d have different sizes" ); + + if ( success == NOMAD::FULL_SUCCESS ) + { + + NOMAD::Double min_rho=NOMAD::INF; + for ( int i=0 ; i < _n ;i++ ) + { + if ( _granularity[i] == 0 && !_fixed_variables[i].is_defined() ) + min_rho=NOMAD::min ( min_rho , get_rho(i) ); + } + + for (int i=0 ; i < _n ; i++ ) + { + + // Test for producing anisotropic mesh + correction to prevent mesh collapsing for some variables ( ifnot ) + if ( !_fixed_variables[i].is_defined() ) + { + + + if ( ! d || ! _anisotropic_mesh || + fabs((*d)[i].value())/get_delta(i).value()/get_rho(i).value() > 0.1 || + ( _granularity[i] == 0 && _Delta_exp[i] < _Delta_0_exp[i] && get_rho(i) > min_rho*min_rho )) + { + // update the mesh index + ++_r[i]; + _r_max[i]=NOMAD::max(_r[i],_r_max[i]); + + // update the mantissa and exponent + if ( _Delta_mant[i] == 1 ) + _Delta_mant[i]= 2; + else if ( _Delta_mant[i] == 2 ) + _Delta_mant[i]=5; + else + { + _Delta_mant[i]=1; + ++_Delta_exp[i]; + } + } + } + } + } + else if ( success == NOMAD::UNSUCCESSFUL ) + { + for (int i=0 ; i < _n ; i++ ) + { + if ( !_fixed_variables[i].is_defined() ) + { + + // update the mesh index + --_r[i]; + + // update the mesh mantissa and exponent + if ( _Delta_mant[i] == 1 ) + { + _Delta_mant[i]= 5; + --_Delta_exp[i]; + } + else if ( _Delta_mant[i] == 2 ) + _Delta_mant[i]=1; + else + _Delta_mant[i]=2; + + + if ( _granularity[i] > 0 && _Delta_exp[i]==-1 && _Delta_mant[i]==5 ) + { + ++_r[i]; + _Delta_exp[i]=0; + _Delta_mant[i]=1; + } + } + // Update the minimal mesh index reached so far + _r_min[i]=NOMAD::min(_r[i],_r_min[i]); + + } + } + + +} + + +/*-----------------------------------------------------------*/ +/* display */ +/*-----------------------------------------------------------*/ +void NOMAD::GMesh::display ( const NOMAD::Display & out ) const +{ + + out << "n : " << _n << std::endl; + out << "minimal mesh size : "; + if ( _delta_min.is_defined() ) + out << "(" << _delta_min << " )" << std::endl; + else + out << "none"; + out << std::endl + << "minimal poll size : "; + if ( _Delta_min_is_defined ) + out << "( " << _Delta_min << " )" << std::endl; + else + out << "none"; + + out << std::endl << "initial poll size : "; + if ( _Delta_0.is_defined() ) + out <<"( " << _Delta_0 << " )" << std::endl; + else + out <<"( none )" << std::endl; + + out << std::endl << "initial mesh size : "; + + if ( _delta_0.is_defined() ) + out <<"( " << _delta_0 << " )" << std::endl; + else + out <<"( none )" << std::endl; + + out << std::endl; +} + + +/*----------------------------------------------------------*/ +/* check the stopping conditions on the minimal poll size */ +/* and on the minimal mesh size */ +/*----------------------------------------------------------*/ +void NOMAD::GMesh::check_min_mesh_sizes ( bool & stop , + NOMAD::stop_type & stop_reason ) const +{ + if ( stop ) + return; + + // Coarse mesh stopping criterion + stop=false; + for (int i=0;i<_n;i++) + if ( _r[i] > -NOMAD::GL_LIMITS ) + { + stop = true; + break; + } + + if ( stop ) + { + stop_reason = NOMAD::GL_LIMITS_REACHED; + return; + } + + stop=true; + + // Fine mesh stopping criterion (do not apply when all variables have granularity + // All mesh indices must < _limit_mesh_index for all continuous variables (granularity==0) and + // and mesh size = granularity for all granular variables to trigger this stopping criterion + if ( _all_granular ) + { + // Do not stop because of to fine a mesh if all variables are granular + stop =false; + } + else + { + for ( int i=0 ; i <_n ; i++ ) + { + // Do not stop if the mesh size of a variable is strictly larger than its granularity + if ( _granularity[i] > 0 && ! _fixed_variables[i].is_defined() && get_delta(i) > _granularity[i] ) + { + stop = false; + break; + } + + // Do not stop if the mesh of a variable is above the limit mesh index + if ( _granularity[i] == 0 && ! _fixed_variables[i].is_defined() && _r[i] >= _limit_mesh_index ) + { + stop = false; + break; + } + } + } + + if ( stop ) + { + stop_reason = NOMAD::GL_LIMITS_REACHED; + return; + } + + // 2. Delta^k (poll size) tests: + if ( check_min_poll_size_criterion ( ) ) + { + stop = true; + stop_reason = NOMAD::DELTA_P_MIN_REACHED; + return; + } + + // 3. delta^k (mesh size) tests: + if ( check_min_mesh_size_criterion ( ) ) + { + stop = true; + stop_reason = NOMAD::DELTA_M_MIN_REACHED; + return; + } +} + +/*-----------------------------------------------------------*/ +/* check the minimal poll size (private) */ +/*-----------------------------------------------------------*/ +bool NOMAD::GMesh::check_min_poll_size_criterion ( ) const +{ + if ( !_Delta_min_is_defined ) + return false; + + NOMAD::Point Delta; + return get_Delta ( Delta ); +} + +/*-----------------------------------------------------------*/ +/* check the minimal mesh size (private) */ +/*-----------------------------------------------------------*/ +bool NOMAD::GMesh::check_min_mesh_size_criterion ( ) const +{ + if ( !_delta_min.is_defined() ) + return false; + + NOMAD::Point delta; + return get_delta ( delta ); +} + + +/*--------------------------------------------------------------*/ +/* get delta (mesh size parameter) */ +/*--------------------------------------------------------------*/ +/* the function also returns true if ALL variables */ +/* with delta_min verify delta[i] < delta_min[i] */ +/*--------------------------------------------------------------*/ +bool NOMAD::GMesh::get_delta ( NOMAD::Point & delta ) const +{ + delta.resize(_n); + + bool stop = true; + + // delta^k = power_of_beta * delta^0: + for ( int i = 0 ; i < _n ; ++i ) + { + + delta[i] = get_delta( i ); + + if ( stop && _delta_min_is_defined && ! _fixed_variables[i].is_defined() && _delta_min[i].is_defined() && delta[i] >= _delta_min[i] ) + stop = false; + } + + return stop; +} + + +/*--------------------------------------------------------------*/ +/* get delta (mesh size parameter) */ +/* delta^k = 10^(b^k-|b^k-b_0^k|) */ +/*--------------------------------------------------------------*/ +NOMAD::Double NOMAD::GMesh::get_delta ( int i ) const +{ + + + NOMAD::Double delta = pow ( 10 , _Delta_exp[i].value() - std::fabs( _Delta_exp[i].value() - _Delta_0_exp[i].value() ) ); + + if ( _granularity[i] > 0 ) + delta = _granularity[i] * NOMAD::max( 1.0 , delta ); + + return delta; + +} + +/*--------------------------------------------------------------*/ +/* get Delta_i (poll size parameter) */ +/* Delta^k = dmin * a^k *10^{b^k} */ +/*--------------------------------------------------------------*/ +NOMAD::Double NOMAD::GMesh::get_Delta ( int i ) const +{ + + NOMAD::Double d_min_gran = 1.0; + + if ( _granularity[i] > 0 ) + d_min_gran = _granularity[i]; + + NOMAD::Double Delta = d_min_gran * _Delta_mant[i] * pow ( 10.0, _Delta_exp[i].value() ) ; + + return Delta; +} + + + +/*--------------------------------------------------------------*/ +/* get Delta (poll size parameter) */ +/*--------------------------------------------------------------*/ +/* the function also returns true if all continuous variables */ +/* have Delta < Delta_min and all granular variables have */ +/* Delta <= Delta_min */ +/*--------------------------------------------------------------*/ +bool NOMAD::GMesh::get_Delta ( NOMAD::Point & Delta ) const +{ + + bool stop = true; + Delta.resize(_n); + + for ( int i = 0 ; i < _n ; ++i ) + { + Delta[i] = get_Delta( i ); + + if ( stop && ! _fixed_variables[i].is_defined() && _granularity[i] == 0 && ( !_Delta_min_is_complete || Delta[i] >= _Delta_min[i] ) ) + stop = false; + + if ( stop && ! _fixed_variables[i].is_defined() && _granularity[i] > 0 && ( !_Delta_min_is_complete || Delta[i] > _Delta_min[i] ) ) + stop = false; + + } + + return stop; +} + + +/*--------------------------------------------------------------*/ +/* get rho (ratio poll/mesh size) */ +/* rho^k = 10^(b^k-|b^k-b_0^k|) */ +/*--------------------------------------------------------------*/ +NOMAD::Double NOMAD::GMesh::get_rho ( int i ) const +{ + NOMAD::Double rho ; + if ( _granularity[i] > 0 ) + rho = _Delta_mant[i] * min( pow ( 10 , _Delta_exp[i].value() ) , pow ( 10 , std::fabs( _Delta_exp[i].value() - _Delta_0_exp[i].value() ) ) ); + else + rho = _Delta_mant[i] * pow ( 10 , std::fabs( _Delta_exp[i].value() - _Delta_0_exp[i].value() ) ); + + + return rho; + +} + + + +bool NOMAD::GMesh::is_finest ( ) const +{ + + for ( int i = 0 ; i < _n ; ++i ) + { + if ( ! _fixed_variables[i].is_defined() && _r[i] > _r_min[i] ) + return false; + } + return true; +} + + +/*-----------------------------------------------------------*/ +/* set the mesh indices */ +/*-----------------------------------------------------------*/ +void NOMAD::GMesh::set_mesh_indices ( const NOMAD::Point & r ) +{ + if ( r.size() != _n ) + throw NOMAD::Exception ( "GMesh.cpp" , __LINE__ , + "NOMAD::GMesh::set_mesh_indices(): dimension of provided mesh indices must be consistent with their previous dimension" ); + + // Set the mesh indices + _r=r; + for ( int i = 0 ; i < _n ; ++i ) + { + if ( r[i] > _r_max[i] ) + _r_max[i] = r[i]; + if ( r[i] < _r_min[i] ) + _r_min[i] = r[i]; + } + + // Set the mesh mantissas and exponents according to the mesh indices + for ( int i = 0 ; i < _n ; ++i ) + { + int shift = static_cast<int>( _r[i].value() + _pos_mant_0[i].value() ); + int pos= ( shift + 300 ) % 3 ; + + _Delta_exp[i] = std::floor( ( shift + 300.0 )/3.0 ) - 100.0 + _Delta_0_exp[i]; + + if ( pos == 0 ) + _Delta_mant[i] = 1; + else if ( pos == 1 ) + _Delta_mant[i] = 2; + else if ( pos == 2 ) + _Delta_mant[i] = 5; + else + throw NOMAD::Exception ( "GMesh.cpp" , __LINE__ , + "NOMAD::GMesh::set_mesh_indices(): something is wrong with conversion from index to mantissa and exponent" ); + } + +} + + +/*-----------------------------------------------------------*/ +/* set the limit mesh index (min value for GMesh) */ +/*-----------------------------------------------------------*/ +void NOMAD::GMesh::set_limit_mesh_index ( int l ) +{ + if ( l > 0 ) + throw NOMAD::Exception ( "GMesh.cpp" , __LINE__ , + "NOMAD::GMesh::set_limit_mesh_index(): the limit mesh index must be negative or null." ); + _limit_mesh_index=l; +} + + + + +/*-----------------------------------------------------------*/ +/* scale and project on the mesh */ +/*-----------------------------------------------------------*/ +NOMAD::Double NOMAD::GMesh::scale_and_project(int i, const NOMAD::Double & l, bool round_up) const +{ + + + NOMAD::Double delta = get_delta( i ); + + if ( i <= _n && _Delta_mant.is_defined() && _Delta_exp.is_defined() && delta.is_defined() ) + { + NOMAD::Double d = get_rho(i) * l; + return d.roundd() * delta; + } + else + + throw NOMAD::Exception ( "GMesh.cpp" , __LINE__ , + "NOMAD::GMesh::scale_and_project(): mesh scaling and projection cannot be performed!" ); +} + + +NOMAD::Point NOMAD::GMesh::get_mesh_ratio_if_success ( void ) const +{ + + try + { + NOMAD::Point ratio( _n ); + for (int i=0 ; i < _n ; i++) + { + NOMAD::Double power_of_tau + = pow ( _update_basis.value() , ( (_r[i] >= 0) ? 0 : 2*_r[i].value() ) ); + + NOMAD::Double power_of_tau_if_success + = pow ( _update_basis.value() , ( (_r[i] + _coarsening_step >= 0) ? 0 : 2*(_r[i].value() + _coarsening_step) ) ); + + ratio[i] = power_of_tau_if_success/power_of_tau; + + } + + return ratio; + } + catch ( NOMAD::Double::Invalid_Value & ) + { + return NOMAD::Point( _n,-1 ); + } +} + + +void NOMAD::GMesh::init_poll_size_granular ( NOMAD::Point & cont_init_poll_size ) +{ + + + if ( ! cont_init_poll_size.is_defined() || cont_init_poll_size.size() != _n ) + throw NOMAD::Exception ( "GMesh.cpp" , __LINE__ , + "NOMAD::GMesh::init_poll_size_granular(): Inconsistent dimension of the poll size!" ); + + _Delta_exp.reset ( _n ); + _Delta_mant.reset ( _n ); + _pos_mant_0.reset ( _n ); + + + NOMAD::Double d_min; + + for ( int i = 0 ; i < _n ; i++ ) + { + + if ( _granularity[i].is_defined() && _granularity[i].value() > 0 ) + d_min=_granularity[i]; + else + d_min=1.0; + + int exp= (int)( std::log10( std::fabs( cont_init_poll_size[i].value()/d_min.value() ))); + _Delta_exp[i]=exp; + + double cont_mant = cont_init_poll_size[i].value() / d_min.value() * pow ( 10.0 , -exp ); + + // round to 1, 2 or 5 + if ( cont_mant < 1.5 ) + { + _Delta_mant[i]=1; + _pos_mant_0[i]=0; + } + else if ( cont_mant >= 1.5 && cont_mant < 3.5 ) + { + _Delta_mant[i]=2; + _pos_mant_0[i]=1; + } + else + { + _Delta_mant[i]=5; + _pos_mant_0[i]=2; + } + } + +} + + +bool NOMAD::GMesh::is_finer_than_initial (void) const +{ + + for (int i =0; i < _n ; ++i ) + { + if ( !_fixed_variables[i].is_defined() ) + { + + // For continuous variables + if ( _granularity[i]==0 && ( _Delta_exp[i] > _Delta_0_exp[i] || ( _Delta_exp[i] == _Delta_0_exp[i] && _Delta_mant[i] >= _Delta_0_mant[i] ) ) ) + return false; + + // For granular variables ( case 1 ) + if ( _granularity[i] > 0 && ( _Delta_exp[i] > _Delta_0_exp[i] || ( _Delta_exp[i] == _Delta_0_exp[i] && _Delta_mant[i] > _Delta_0_mant[i] ) ) ) + return false; + + // For granular variables ( case 2 ) + if ( _granularity[i] > 0 && _Delta_exp[i] == _Delta_0_exp[i] && _Delta_mant[i] == _Delta_0_mant[i] && ( _Delta_exp[i] != 0 || _Delta_mant[i] != 1 ) ) + return false; + } + + + } + + return true; +} diff --git a/src/GMesh.hpp b/src/GMesh.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a871802805920ae3d0f7f56e604b2f74bcb14270 --- /dev/null +++ b/src/GMesh.hpp @@ -0,0 +1,325 @@ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + +/** + \file GMesh.hpp + \brief Class for the GMesh (extensible mesh) (headers) + \author Christophe Tribes + \date 2014-07 + \see GMesh.cpp + */ +#ifndef __GMESH__ +#define __GMESH__ + +#include "OrthogonalMesh.hpp" + +namespace NOMAD { + + /// Class for the MADS GMesh. + /** + - The GMesh in NOMAD is defined with the basic directions and the + mesh size parameter delta^k for each coordinate. + */ + + class GMesh : public NOMAD::OrthogonalMesh { + + /*--------------------------------------------------------------*/ + private: + + NOMAD::Point _r; // Mesh index per coordinate. + NOMAD::Point _r_min; + NOMAD::Point _r_max; + NOMAD::Point _Delta_0_exp; + NOMAD::Point _Delta_mant; + NOMAD::Point _Delta_0_mant; + NOMAD::Point _Delta_exp; + NOMAD::Point _pos_mant_0; + + + /*--------------------------------------------------------------*/ + + /// Private affectation operator. + /** + \param m The right-hand side object -- \b IN. + */ + const GMesh & operator = ( const GMesh & m ); + + /// Check the minimal poll size criterion. + bool check_min_poll_size_criterion ( ) const; + + /// Check the minimal mesh size criterion. + bool check_min_mesh_size_criterion ( ) const; + + + /// Access to the ratio of poll size / mesh size parameter rho^k. + /** + \return rho The ratio poll/mesh size rho^k -- \b OUT. + */ + NOMAD::Double get_rho ( int i ) const; + + /// Access to the mesh size parameter delta^k. + /** + \return delta The mesh size parameter delta^k -- \b OUT. + \param i The index of the mesh size + */ + NOMAD::Double get_delta ( int i ) const ; + + + /// Access to the poll size parameter Delta^k. + /** + \return Delta The poll size parameter Delta^k -- \b OUT. + \param i The index of the poll size + */ + NOMAD::Double get_Delta ( int i ) const ; + + void init ( ); + + /// Initialization of granular poll size mantissa and exponent + /** + \param cont_init_poll_size continuous initial poll size -- \b IN. + */ + void init_poll_size_granular ( NOMAD::Point & cont_init_poll_size ); + + + public: + + /// Constructor. + /** + \param anisotropic_mesh Use anisotropic mesh or not -- \b IN. + \param Delta_0 Initial poll size Delta^0 -- \b IN. + \param Delta_min Minimal poll size Delta^min (may be undefined) -- \b IN. + \param delta_min Minimal mesh size delta^min (may be undefined) -- \b IN. + \param poll_update_basis Poll update basis (b); default=0 -- \b IN. + \param poll_coarsening_step Poll coarsening step (w+); default=0 -- \b IN. + \param poll_refining_step Poll refining step (w-); default=0 -- \b IN. + \param fixed_variables Fixed variables -- \b IN. + \param granularity Granularity of variables -- \b IN. + \param limit_min_mesh_index Limit mesh index (<0) -- \b IN. + */ + GMesh (bool anisotropic_mesh, + const NOMAD::Point & Delta_0 , + const NOMAD::Point & Delta_min , + const NOMAD::Point & delta_min , + const NOMAD::Point & fixed_variables , + const NOMAD::Point & granularity, + NOMAD::Double poll_update_basis=0, + int poll_coarsening_step=0, + int poll_refining_step=0 , + int limit_min_mesh_index=NOMAD::GL_LIMITS ) + : NOMAD::OrthogonalMesh ( anisotropic_mesh, + Delta_0, + Delta_min, + delta_min, + fixed_variables, + granularity, + poll_update_basis, + poll_coarsening_step, + poll_refining_step , + limit_min_mesh_index ) { init();} + + + + + /// Copy constructor. + /** + \param m The copied object -- \b IN. + */ + GMesh ( const GMesh & m ) + : OrthogonalMesh ( m ) , + _r ( m._r ) { init(); } + + /// Destructor. + ~GMesh ( void ){} + + + /// Access to the mesh size parameter delta^k for earch coordinate. + /** + - It is a NOMAD::Point of size \c nc the number of free variables. + \param delta The mesh size parameter delta^k -- \b OUT. + \return A boolean equal to \c true if all values are + strictly inferior than the associated minimal + mesh size delta_min (stopping criterion MIN_MESH_SIZE). + */ + bool get_delta ( NOMAD::Point & delta ) const ; + + + /// Access to the largest mesh size for earch coordinate. + /** + \return delta_max + */ + NOMAD::Point get_delta_max ( void ) const { return _delta_0;} + + + /// Access to the poll size Delta^k for each coordinate. + /** + - It is a NOMAD::Point of size \c nc the number of free variables. + \param Delta The poll size parameter Delta^k -- \b OUT. + \return A boolean equal to \c true if all values are + strictly inferior than the associated minimal + poll size Delta_min + (stopping criterion MIN_POLL_SIZE). + */ + bool get_Delta ( NOMAD::Point & Delta) const ; + + + /// Update the provided mesh indices (the Mesh is unchanged). + /** + \param success Type of success of the iteration -- \b IN. + \param mesh_indices The mesh indices before and after the update -- \b IN/OUT. + \param dir The direction that is considered (opt) -- \b IN. + */ + void update ( NOMAD::success_type success , NOMAD::Point & mesh_indices, const NOMAD::Direction *dir=NULL ) const ; + + + /// Test if mesh finer than initial. + /** + \return True if mesh size is smaller than initial mesh size for all components; False otherwise. + */ + bool is_finer_than_initial (void) const ; + + + /// Update the GMesh (poll and mesh sizes). + /** + \param success Type of success of the iteration -- \b IN. + \param dir Direction of the iteration -- \b IN. + */ + void update ( NOMAD::success_type success, const NOMAD::Direction * dir=NULL); + + /// Reset the mesh to its original size (mesh indices). + void reset ( void ) { init() ;} + + + /// Display. + /** + \param out The NOMAD::Display object -- \b IN. + */ + void display ( const NOMAD::Display & out ) const; + + /// Test if r < r_min so far for all coordinates. + /** + \return True if mesh is the finest so far, False otherwise. + */ + bool is_finest ( void ) const; + + + /// Scale and project the ith component of a vector on the mesh + /** + \param i The vector component number -- \b IN. + \param l The vector component value -- \b IN. + \param round_up The flag for round up -- \b IN. + \return The ith component of a vector after mesh scaling and projection + */ + NOMAD::Double scale_and_project(int i, const NOMAD::Double & l , bool round_up=false ) const ; + + + /// Check the stopping conditions on the minimal poll and mesh sizes. + /** + \param stop Stop flag -- \b IN/OUT. + \param stop_reason Stop reason -- \b OUT. + */ + void check_min_mesh_sizes ( bool & stop , + NOMAD::stop_type & stop_reason ) const; + + /// Access to the mesh indices per coordinate. + /** + \return A point with the mesh index for each coordinate. + */ + const NOMAD::Point get_mesh_indices ( void ) const { return _r; } + + /// Access to the min mesh indices reached so far. + /** + \return A point with the mesh index for each coordinate. + */ + const NOMAD::Point get_min_mesh_indices ( void ) const { return _r_min; } + + + /// Access to the max mesh indices reached so far. + /** + \return A point with the mesh index for each coordinate. + */ + const NOMAD::Point get_max_mesh_indices ( void ) const { return _r_max; } + + + /// Manually set the mesh index. + /** + \param r The mesh indices provided as a point -- \b IN. + */ + void set_mesh_indices ( const NOMAD::Point & r ); + + + + /// Manually set the limit mesh index (termination criterion). + /** + \param l The limit mesh index for all coordinates -- \b IN. + */ + void set_limit_mesh_index ( int l ); + + + + /// Access to the mesh ratios after a success + /** + \return A point with the ratio for each coordinate + */ + NOMAD::Point get_mesh_ratio_if_success ( void ) const; + + + + }; + + /// Display a NOMAD::GMesh object. + /** + \param out The NOMAD::Display object -- \b IN. + \param m The NOMAD::GMesh object to be displayed -- \b IN. + \return The NOMAD::Display object. + */ + inline const NOMAD::Display & operator << ( const NOMAD::Display & out , + const NOMAD::GMesh & m ) + { + m.display ( out ); + return out; + } + +} + +#endif diff --git a/src/LH_Search.cpp b/src/LH_Search.cpp index 745015550b0d7517543186c8934c6847b7b2cd26..dc5aa5833ebc6b9cb2c774d43237faec398a672c 100644 --- a/src/LH_Search.cpp +++ b/src/LH_Search.cpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file LH_Search.cpp \brief Latin-Hypercube search (implementation) @@ -186,9 +188,7 @@ void NOMAD::LH_Search::search ( NOMAD::Mads & mads , else { pts[i] = new NOMAD::Point ( p ); - - // for the initial mesh: delta_m is not used and there will - // be no projection on mesh: + if ( !_initial_search ) delta_i = delta[i]; @@ -268,12 +268,12 @@ void NOMAD::LH_Search::search ( NOMAD::Mads & mads , /* LH search: decide p values for one variable */ /*-----------------------------------------------------------*/ /* . if no bounds, values are scaled with the largest */ -/* delta_m value obtained so far */ +/* delta value obtained so far */ /* . private method */ /*-----------------------------------------------------------*/ void NOMAD::LH_Search::values_for_var_i ( int p , - const NOMAD::Double & delta_m , - const NOMAD::Double & delta_m_max , + const NOMAD::Double & delta , + const NOMAD::Double & delta_max , const NOMAD::bb_input_type & bbit , const NOMAD::Double & lb , const NOMAD::Double & ub , @@ -294,7 +294,7 @@ void NOMAD::LH_Search::values_for_var_i ( int p // main loop: for ( i = 0 ; i < p ; ++i ) { - + // both bounds exist: if ( lb_def && ub_def ) v = lb + ( i + NOMAD::RNG::rand()/NOMAD::D_INT_MAX ) * w; @@ -304,7 +304,7 @@ void NOMAD::LH_Search::values_for_var_i ( int p // lb exists, and ub not: mapping [0;1] --> [lb;+INF[ if ( lb_def ) - v = lb + 10 * delta_m_max * sqrt ( - log ( NOMAD::DEFAULT_EPSILON + + v = lb + 10 * delta_max * sqrt ( - log ( NOMAD::DEFAULT_EPSILON + ( i + NOMAD::RNG::rand()/NOMAD::D_INT_MAX ) * w ) ); // lb does not exist: @@ -313,13 +313,13 @@ void NOMAD::LH_Search::values_for_var_i ( int p // ub exists, and lb not: mapping [0;1] --> ]-INF;ub] if ( ub_def ) - v = ub - delta_m_max * 10 * + v = ub - delta_max * 10 * sqrt ( -log ( NOMAD::DEFAULT_EPSILON + ( i +NOMAD::RNG::rand()/NOMAD::D_INT_MAX ) * w ) ); // there are no bounds: mapping [0;1] --> ]-INF;+INF[ else - v = (NOMAD::RNG::rand()%2 ? -1.0 : 1.0) * delta_m_max * 10 * + v = (NOMAD::RNG::rand()%2 ? -1.0 : 1.0) * delta_max * 10 * sqrt ( - log ( NOMAD::DEFAULT_EPSILON + ( i + NOMAD::RNG::rand()/NOMAD::D_INT_MAX ) * w ) ); } @@ -330,7 +330,7 @@ void NOMAD::LH_Search::values_for_var_i ( int p v = v.round(); // projection to mesh (with ref=0): - v.project_to_mesh ( 0.0 , delta_m , lb , ub ); + v.project_to_mesh ( 0.0 , delta , lb , ub ); // affectation + permutation: x[rp.pickup()] = v; diff --git a/src/LH_Search.hpp b/src/LH_Search.hpp index a3704ee34fd24483587c6e00d626e9be919aa36d..beea6fd13fe95318d5c27b6f4f7478e77e84e867 100644 --- a/src/LH_Search.hpp +++ b/src/LH_Search.hpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file LH_Search.hpp \brief Latin-Hypercube search (headers) diff --git a/src/L_Curve.cpp b/src/L_Curve.cpp index 369b3ae5c0a93edac2b23ef24fef819eff453445..e4275437a9bf8613b203eea5941eac73647440f3 100644 --- a/src/L_Curve.cpp +++ b/src/L_Curve.cpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file L_Curve.cpp \brief L_CURVE_TARGET stopping criterion (implementation) diff --git a/src/L_Curve.hpp b/src/L_Curve.hpp index ee5a635830565785dff2ddd369421d43738a4a54..ac45003783b47ca65849a4ea4f290fd40b7b3f8d 100644 --- a/src/L_Curve.hpp +++ b/src/L_Curve.hpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file L_Curve.hpp \brief L_CURVE_TARGET stopping criterion (headers) diff --git a/src/Mads.cpp b/src/Mads.cpp index 5aae7c5c605d5c60766764e4399c28a1cb1299b5..9a8108d4d4b5904802d755b30258a4da60f930a8 100644 --- a/src/Mads.cpp +++ b/src/Mads.cpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Mads.cpp \brief MADS algorithm (implementation) @@ -48,6 +50,7 @@ \see Mads.hpp */ #include "Mads.hpp" +#include "Sgtelib_Model_Manager.hpp" /*-----------------------------------*/ /* static members initialization */ @@ -112,11 +115,32 @@ void NOMAD::Mads::init ( void ) { if ( _p.get_model_search(1) == NOMAD::QUADRATIC_MODEL ) _model_search1 = new Quad_Model_Search ( _p ); - if ( _p.get_model_search(2) == NOMAD::QUADRATIC_MODEL ) _model_search2 = new Quad_Model_Search ( _p ); } + if ( _p.get_model_search(1) == NOMAD::SGTELIB_MODEL || _p.get_model_search(2) == NOMAD::SGTELIB_MODEL ) + { + + _sgtelib_model_manager = new NOMAD::Sgtelib_Model_Manager( _p , &_ev_control ) ; + _ev_control.set_sgtelib_model_manager( _sgtelib_model_manager ); + _ev_control_for_sorting.set_sgtelib_model_manager( _sgtelib_model_manager ); + + if ( _p.has_model_search() ) + { + if ( _p.get_model_search(1) == NOMAD::SGTELIB_MODEL ) + { + _model_search1 = new Sgtelib_Model_Search ( _p ); + static_cast<NOMAD::Sgtelib_Model_Search *>(_model_search1)->set_sgtelib_model_manager(_sgtelib_model_manager); + } + if ( _p.get_model_search(2) == NOMAD::SGTELIB_MODEL ) + { + _model_search2 = new Sgtelib_Model_Search ( _p ); + static_cast<NOMAD::Sgtelib_Model_Search *>(_model_search2)->set_sgtelib_model_manager(_sgtelib_model_manager); + } + } + } + // VNS search initialization: if ( _p.get_VNS_search() ) _VNS_search = new VNS_Search ( _p ); @@ -143,7 +167,12 @@ NOMAD::Mads::~Mads ( void ) delete _cache_search; delete _L_curve; - if ( _extended_poll && !_user_ext_poll) + if ( _sgtelib_model_manager ) + { + delete _sgtelib_model_manager; + } + + if ( _extended_poll && !_user_ext_poll ) delete _extended_poll; } @@ -155,7 +184,6 @@ NOMAD::Mads::~Mads ( void ) /*-------------------------------------------------------------*/ void NOMAD::Mads::reset ( bool keep_barriers , bool keep_stats ) { - // user search: _user_search = NULL; @@ -165,7 +193,15 @@ void NOMAD::Mads::reset ( bool keep_barriers , bool keep_stats ) if ( _model_search1 ) _model_search1->reset(); else - _model_search1 = new Quad_Model_Search ( _p ); + { + if ( _p.get_model_search(1) == NOMAD::SGTELIB_MODEL ) + { + _model_search1 = new Sgtelib_Model_Search ( _p ) ; + static_cast<NOMAD::Sgtelib_Model_Search *> ( _model_search1 )->set_sgtelib_model_manager( _sgtelib_model_manager ); + } + else + _model_search1 = new Quad_Model_Search ( _p ); + } } else { @@ -179,7 +215,16 @@ void NOMAD::Mads::reset ( bool keep_barriers , bool keep_stats ) if ( _model_search2 ) _model_search2->reset(); else - _model_search2 = new Quad_Model_Search ( _p ); + { + if ( _p.get_model_search(2) == NOMAD::SGTELIB_MODEL ) + { + _model_search2 = new Sgtelib_Model_Search ( _p ) ; + static_cast<NOMAD::Sgtelib_Model_Search *>( _model_search2 )->set_sgtelib_model_manager( _sgtelib_model_manager ); + } + else + + _model_search2 = new Quad_Model_Search ( _p ); + } } else { @@ -478,7 +523,7 @@ NOMAD::stop_type NOMAD::Mads::run ( void ) // final displays: const NOMAD::Eval_Point * bf = get_best_feasible(); - bool write_stats = bf && + bool write_stats = bf && ( bf->get_tag() != _ev_control.get_last_stats_tag() || _stats.get_bb_eval() != _ev_control.get_last_stats_bbe() ); @@ -796,6 +841,7 @@ NOMAD::stop_type NOMAD::Mads::multi_run ( void ) return stop_reason; } + #endif try { @@ -1225,8 +1271,9 @@ NOMAD::stop_type NOMAD::Mads::multi_run ( void ) // stop the slaves: #ifdef USE_MPI + if ( NOMAD::Slave::are_running() && stop_slaves_here ) - NOMAD::Slave::stop_slaves ( out ); + NOMAD::Slave::stop_slaves ( out ); #endif return stop_reason; @@ -1271,7 +1318,7 @@ void NOMAD::Mads::iteration ( bool & stop , // POLL: // ----- - if ( success != NOMAD::FULL_SUCCESS ) + if ( success != NOMAD::FULL_SUCCESS && success != NOMAD::CACHE_UPDATE_SUCCESS ) poll ( stop , stop_reason , success , @@ -1411,7 +1458,7 @@ void NOMAD::Mads::iteration ( bool & stop , /*---------------------------------------------------------*/ /* the poll (private) */ /*---------------------------------------------------------*/ -void NOMAD::Mads::poll ( bool & stop , +void NOMAD::Mads::poll ( bool & stop , NOMAD::stop_type & stop_reason , NOMAD::success_type & success , const NOMAD::Eval_Point *& new_feas_inc , @@ -1543,9 +1590,13 @@ void NOMAD::Mads::poll ( bool & stop , set_poll_trial_points(dirs[i_pc],offset,*poll_center,stop,stop_reason,false); offset = dirs[i_pc].size(); - if ( ( _p.get_intensification_type() == NOMAD::POLL_ONLY || _p.get_intensification_type() == NOMAD::POLL_AND_SEARCH ) && i_pc == NOMAD::PRIMARY ) + + // Intensification only after secondary (or if there is no secondary), but based on primary data + if ( ( _p.get_intensification_type() == NOMAD::POLL_ONLY || _p.get_intensification_type() == NOMAD::POLL_AND_SEARCH ) + && ( (i_pc == NOMAD::SECONDARY) || (! poll_centers[NOMAD::SECONDARY]) ) ) { - set_poll_intensification_points( *poll_center, offset, stop, stop_reason ); + size_t offset2 = dirs[NOMAD::PRIMARY].size(); + set_poll_intensification_points( *poll_centers[NOMAD::PRIMARY], offset2, stop, stop_reason ); } if ( !reducePollToNDir ) @@ -1575,7 +1626,6 @@ void NOMAD::Mads::poll ( bool & stop , } - // display the re-ordered list of poll trial points: if ( display_degree == NOMAD::FULL_DISPLAY && !stop ) { const std::set<NOMAD::Priority_Eval_Point> & poll_pts = _ev_control.get_eval_lop(); @@ -1627,7 +1677,7 @@ void NOMAD::Mads::poll ( bool & stop , // If ortho mads n+1, complete poll with additional evaluations obtained dynamically - if (!stop && success !=NOMAD::FULL_SUCCESS && _p.has_dynamic_direction()) + if ( !stop && success != NOMAD::FULL_SUCCESS && success != NOMAD::CACHE_UPDATE_SUCCESS && _p.has_dynamic_direction() ) { _ev_control.reset(); @@ -1729,8 +1779,8 @@ void NOMAD::Mads::poll ( bool & stop , new_infeas_inc , success ); - if (success==NOMAD::FULL_SUCCESS) - _stats.add_nb_success_dyn_dir(); + if ( success == NOMAD::FULL_SUCCESS ) + _stats.add_nb_success_dyn_dir (); } @@ -1793,6 +1843,8 @@ void NOMAD::Mads::poll ( bool & stop , new_feas_inc , new_infeas_inc ); + + // stats updates: _stats.add_ext_poll_pts ( nb_ext_poll_pts ); if ( success == NOMAD::FULL_SUCCESS ) @@ -1805,7 +1857,7 @@ void NOMAD::Mads::poll ( bool & stop , } // stats updates: - if ( success == NOMAD::FULL_SUCCESS ) + if ( success == NOMAD::FULL_SUCCESS || success == NOMAD::CACHE_UPDATE_SUCCESS ) _stats.add_poll_success(); _stats.add_nb_poll_searches(); @@ -1838,8 +1890,8 @@ void NOMAD::Mads::poll ( bool & stop , /*---------------------------------------------------------*/ // A direction group corresponds to a variable group having directions. // A variable group of categorical variables does not possess directions. -bool NOMAD::Mads::set_reduced_poll_to_n_directions(std::list<NOMAD::Direction> & dirs, - const NOMAD::Eval_Point & poll_center) +bool NOMAD::Mads::set_reduced_poll_to_n_directions(std::list<NOMAD::Direction> & dirs, + const NOMAD::Eval_Point & poll_center) { // get the number of free variables using the signature (because of extended poll and changing signature) @@ -1874,8 +1926,8 @@ bool NOMAD::Mads::set_reduced_poll_to_n_directions(std::list<NOMAD::Direction> // Get all poll directions with a given direction group index + Get a vector of unique indices for those directions std::vector<NOMAD::Direction> pollDirs; std::vector<int> pollDirIndices; - bool containsOrthoMads = false; - for ( itDirs=TmpDirs.begin() ; itDirs != TmpDirs.end() ; ++itDirs) + bool containsOrthoMads=false; + for (itDirs=TmpDirs.begin();itDirs!=TmpDirs.end() ; ++itDirs) { if ( static_cast<size_t>((*itDirs).get_dir_group_index()) == dgi ) { @@ -1889,6 +1941,7 @@ bool NOMAD::Mads::set_reduced_poll_to_n_directions(std::list<NOMAD::Direction> std::list<NOMAD::Direction> sortedDirs; std::list<NOMAD::Direction>::iterator itSortedDirs; + // Sort the directions only if mesh is not finest if ( !_mesh->is_finest() ) { @@ -2499,7 +2552,15 @@ void NOMAD::Mads::set_poll_intensification_points ( const NOMAD::Eval_Point int n_max_size_poll_set = cur_signature->get_max_size_poll_set(); int n_eval_tot = std::min( n_max_size_poll_set , _p.get_max_eval_intensification() ); int n_extra = n_eval_tot - n_eval_sub ; - + + // if n_extra is negative, and intensification > 1, then increase n_extra + // Note that here, I assume that max_block_size and max_eval_intensification are equal. + if (_p.get_max_eval_intensification()>1) + { + while (n_extra<0) n_extra += _p.get_max_eval_intensification(); + } + + if ( display_degree == NOMAD::FULL_DISPLAY && n_extra > 0 ) { out << std::endl << NOMAD::open_block ( "Poll intensification: " )<< std::endl; @@ -2522,7 +2583,10 @@ void NOMAD::Mads::set_poll_intensification_points ( const NOMAD::Eval_Point size_t k = offset; int n_tries = 0; int n_eval_cur = _ev_control.get_nb_eval_points(); - while ( n_eval_cur < n_eval_tot && n_tries < 2 * n_extra ) + + + // replace n_eval_tot with n_eval_sub+n_extra + while ( (n_eval_cur < n_eval_sub+n_extra) && (n_tries < 2 * n_extra) ) { NOMAD::Direction dir( n, 0.0, NOMAD::UNDEFINED_DIRECTION ); @@ -2536,7 +2600,7 @@ void NOMAD::Mads::set_poll_intensification_points ( const NOMAD::Eval_Point if ( dir.is_complete() ) { dir.set_type( NOMAD::ORTHO_1 ); - dir.set_index ( static_cast<int>(k++) ); + dir.set_index ( static_cast<int>( k++ ) ); offset++; @@ -2567,8 +2631,8 @@ void NOMAD::Mads::set_poll_intensification_points ( const NOMAD::Eval_Point n_eval_cur = n_eval_tmp; } - if ( _ev_control.get_nb_eval_points() < n_eval_tot ) - out << " cannot reached the target number of points" <<std::endl; + if ( _ev_control.get_nb_eval_points() < n_eval_tot && display_degree == NOMAD::FULL_DISPLAY ) + out << "cannot reach the target number of points" <<std::endl; if ( display_degree == NOMAD::FULL_DISPLAY ) out.close_block(); @@ -2650,6 +2714,9 @@ void NOMAD::Mads::set_poll_trial_points (std::list<NOMAD::Direction> &dirs, for (int i = 0 ; i < n ; ++i ) (*pt)[i] = ( bbit[i]==NOMAD::BINARY && (*dir)[i]==1.0 && (poll_center)[i]==1.0 ) ? 0.0 : (*pt)[i] = (poll_center)[i] + (*dir)[i]; + // we check that the new poll trial point is different than the poll center + // (this happens when the mesh size becomes too small): + if ( pt->Point::operator == ( poll_center ) ) delete pt; else @@ -2657,7 +2724,7 @@ void NOMAD::Mads::set_poll_trial_points (std::list<NOMAD::Direction> &dirs, pt->set_signature ( cur_signature ); pt->set_direction ( dir ); pt->set_poll_center_type ( pc_type ); - pt->set_poll_center ( &poll_center ); + pt->set_poll_center ( &poll_center ); // random direction? if ( NOMAD::dir_is_random ( dir->get_type() ) ) @@ -2706,9 +2773,9 @@ void NOMAD::Mads::set_poll_trial_points (std::list<NOMAD::Direction> &dirs, /*-------------------------------------------------------------*/ /* compute the poll directions dynamically (private) */ /*-------------------------------------------------------------*/ -bool NOMAD::Mads::get_dynamic_directions (const std::list<NOMAD::Direction> & dirs , - std::list<NOMAD::Direction> & newDirs , - const NOMAD::Eval_Point & poll_center ) +bool NOMAD::Mads::get_dynamic_directions (const std::list<NOMAD::Direction> & dirs, + std::list<NOMAD::Direction> & newDirs, + const NOMAD::Eval_Point & poll_center ) { const NOMAD::Signature * cur_signature=poll_center.get_signature(); @@ -2790,15 +2857,15 @@ bool NOMAD::Mads::get_dynamic_directions (const std::list<NOMAD::Direction> & /*------------------------------------------------------------------------------*/ -/* get a single dynamic direction from incomplete poll */ -/* directions by optimization of a quad model or sum of negative (private) */ +/* get a single dynamic direction from incomplete poll */ +/* directions by optimization of a quad model or sum of negative (private) */ /*------------------------------------------------------------------------------*/ /* The new direction calculation is described in paper from */ /* Audet, Ianni, Le Digabel and Tribes : Reducing the number of */ /* function evaluations in Mesh Adaptive Direct Search Algorithms*/ /*----------------------------------------------------------------*/ -NOMAD::Direction NOMAD::Mads::get_single_dynamic_direction (const std::list<NOMAD::Direction> & dirs, - const NOMAD::Eval_Point & poll_center) +NOMAD::Direction NOMAD::Mads::get_single_dynamic_direction (const std::list<NOMAD::Direction> & dirs, + const NOMAD::Eval_Point & poll_center) { const NOMAD::Signature * cur_signature=poll_center.get_signature(); int n=cur_signature->get_n(); @@ -2827,29 +2894,32 @@ NOMAD::Direction NOMAD::Mads::get_single_dynamic_direction (const std::list<NOMA // New direction obtained by quad model optimization or negative sum of directions NOMAD::Point prospect_point; bool success=false; - if (dir_from_model_opt(dirs)) - success=optimize_quad_model(poll_center,dirs,prospect_point); + if ( dir_from_model_opt(dirs) ) + success=optimize_quad_model( poll_center, dirs, prospect_point ); for (int i=0; i<n; i++) { - if (success) - V[i]=prospect_point[i].value()-poll_center[i].value(); + if ( success ) + V[i] = prospect_point[i].value() - poll_center[i].value(); else - V[i]=Vb1[i]; // use -sum(d^i) if model optimization unsucessfull or no dynamic direction requested + V[i] = Vb1[i]; // use -sum(d^i) if model optimization unsucessfull or no dynamic direction requested } // Update the new directions depending on the input_types const std::vector<NOMAD::bb_input_type> & input_types=cur_signature->get_input_types(); - NOMAD::Point delta,Delta; - _mesh->get_delta ( delta ); - _mesh->get_Delta ( Delta ); + NOMAD::Point delta = cur_signature->get_mesh()->get_delta ( ); + NOMAD::Point Delta = cur_signature->get_mesh()->get_Delta ( ); bool isZero=true; for (int i=0; i<n; ++i) { NOMAD::Double v=V[i].value(),vb1=Vb1[i].value(),dm=delta[i].value(),dp=Delta[i].value(); - // Continous variables ---> rounding towards mesh node. - if (input_types[i]==NOMAD::CONTINUOUS) + // categorical variables: set direction=0: + if ( input_types[i] == NOMAD::CATEGORICAL ) + V[i] = 0.0; + // Continous variables or GMesh+granularity ---> rounding towards mesh node. + // If GMesh and variable is binary --> it is considered as an integer (ordered) with bounds [0;1] (snap to bound done later) + else if ( input_types[i] == NOMAD::CONTINUOUS || ( _p.get_mesh_type()==NOMAD::GMESH && (_p.get_granularity())[i] != 0.0 ) ) { NOMAD::Double d1 = vb1/dm; NOMAD::Double d2 = v/dm; @@ -2868,23 +2938,20 @@ NOMAD::Direction NOMAD::Mads::get_single_dynamic_direction (const std::list<NOMA else if ( v <= -dp/3.0 ) V[i] = v.floor(); else - V[i] = v.round(); + V[i] = v.roundd(); } // binary variables: else if ( input_types[i] == NOMAD::BINARY ) { - if ( v != 0.0 ) + if ( v != 0.0 ) // ---> this will almost always generate a change (not sure about that) V[i] = 1.0; } - // categorical variables: set direction=0: - else if ( input_types[i] == NOMAD::CATEGORICAL ) - V[i] = 0.0; - if ( V[i]!=0 ) + if ( V[i] != 0 ) isZero=false; } - if (isZero ) + if ( isZero ) { NOMAD::Direction Vzero( n , 0.0 ,NOMAD::UNDEFINED_DIRECTION); return Vzero; @@ -3050,6 +3117,7 @@ void NOMAD::Mads::search ( bool & stop , // update stats: if ( success == NOMAD::FULL_SUCCESS ) _stats.add_usr_srch_success(); + if ( count_search ) _stats.add_nb_usr_searches(); _stats.add_usr_srch_pts ( nb_search_pts ); @@ -3080,6 +3148,7 @@ void NOMAD::Mads::search ( bool & stop , // update stats: if ( success == NOMAD::FULL_SUCCESS ) _stats.add_CS_success(); + if ( count_search ) _stats.add_nb_cache_searches(); _stats.add_CS_pts ( nb_search_pts ); @@ -3142,6 +3211,7 @@ void NOMAD::Mads::search ( bool & stop , count_search , new_feas_inc , new_infeas_inc ); + } } @@ -3340,13 +3410,15 @@ void NOMAD::Mads::eval_x0 ( bool & stop , // x0 cache file and the algorithm's cache file are the same: else { - - x = cache.begin(); + + int npts=0; while ( x ) { pt = &NOMAD::Cache::get_modifiable_point ( *x ); + npts++; + if ( x->get_signature() ) pt->set_signature ( x->get_signature() ); else if ( x->size() == n ) @@ -3612,7 +3684,10 @@ void NOMAD::Mads::display ( const NOMAD::Display & out ) const out << "( "; bf->Point::display ( out , " " , -1 , -1 ); out << " ) h=" << bf->get_h() - << " f=" << bf->get_f() << std::endl; + << " f=" << bf->get_f() ; + if ( _p.get_robust_mads() ) + out << " f_smooth=" << bf->get_fsmooth() ; // Smoothing available only for unconstrained problems + out << std::endl; } else out << "no feasible solution has been found" << std::endl; @@ -3670,7 +3745,10 @@ void NOMAD::Mads::display ( const NOMAD::Display & out ) const out << "( "; bf->Point::display ( out , " " , -1 , -1 ); out << " ) h=" << bf->get_h() - << " f=" << bf->get_f() << std::endl; + << " f=" << bf->get_f() ; + if ( _p.get_robust_mads() ) + out << " f_smooth=" << bf->get_fsmooth() ; // Smoothing available only for unconstrained problems + out << std::endl; } else out << "no feasible solution has been found" << std::endl; diff --git a/src/Mads.hpp b/src/Mads.hpp index f3b0b26357c4e98b62041bfc2a9d7e66813f7943..5ba635c5d5c1f7714bdd02d72db9635f3db6e21d 100644 --- a/src/Mads.hpp +++ b/src/Mads.hpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Mads.hpp \brief MADS algorithm (headers) @@ -58,10 +60,8 @@ #include "Phase_One_Search.hpp" #include "L_Curve.hpp" #include "Extended_Poll.hpp" - -#include "XMesh.hpp" -#include "SMesh.hpp" - +#include "Sgtelib_Model_Manager.hpp" +#include "Sgtelib_Model_Search.hpp" namespace NOMAD { @@ -99,6 +99,7 @@ namespace NOMAD { NOMAD::L_Curve * _L_curve; ///< L-curve target. NOMAD::Extended_Poll * _extended_poll; ///< Extended poll for categorical variables. bool _user_ext_poll; ///< Flag for user-defined extended poll. + NOMAD::Sgtelib_Model_Manager * _sgtelib_model_manager; // MADS flags (these are not parameters as users do not modify them): @@ -160,12 +161,12 @@ namespace NOMAD { size stopping criterion has to be disabled for integer variables -- \b OUT. */ - void poll ( bool & stop , - NOMAD::stop_type & stop_reason , - NOMAD::success_type & success , - const NOMAD::Eval_Point *& new_feas_inc , + void poll ( bool & stop, + NOMAD::stop_type & stop_reason, + NOMAD::success_type & success, + const NOMAD::Eval_Point *& new_feas_inc, const NOMAD::Eval_Point *& new_infeas_inc, - bool & forbid_poll_size_stop ); + bool & forbid_poll_size_stop ); /// Sets the poll trial points from poll direction, poll center and mesh size /** @@ -176,12 +177,12 @@ namespace NOMAD { \param offset Dir index offset for primary and sec. poll center -- \b IN. \param sorting If true than the points are for sorting -- \b IN. */ - void set_poll_trial_points ( std::list<NOMAD::Direction> & dirs , - size_t offset , - const NOMAD::Eval_Point & poll_center , - bool & stop , - NOMAD::stop_type & stop_reason , - bool sorting ); + void set_poll_trial_points ( std::list<NOMAD::Direction> & dirs, + size_t offset, + const NOMAD::Eval_Point & poll_center, + bool & stop, + NOMAD::stop_type &stop_reason, + bool sorting); /// Compute a prospect point by optimization on quadratic models. @@ -191,19 +192,19 @@ namespace NOMAD { \param prospect_point The prospect point -- \b OUT. \return A flag equal to \c true if the prospect direction has been computed. */ - bool optimize_quad_model ( const NOMAD::Eval_Point & poll_center , - const std::list<NOMAD::Direction> & dirs , - NOMAD::Point & prospect_point) ; + bool optimize_quad_model ( const NOMAD::Eval_Point & poll_center , + const std::list<NOMAD::Direction> & dirs , + NOMAD::Point & prospect_point ) ; /// Sets the poll directions from signature, poll center and mesh size /** - \param dirs List of directions for the poll -- \b OUT. - \param i_pc Poll type -- \b IN. - \param offset Dir index offset for primary and sec. poll center -- \b IN. - \param poll_center The poll center -- \b IN. - \param stop Stop flag, true if cannot get direction -- \b IN/OUT. - \param stop_reason Stop type -- \b OUT. + \param dirs List of directions for the poll -- \b OUT. + \param i_pc Poll type -- \b IN. + \param offset Dir index offset for primary and sec. poll center -- \b IN. + \param poll_center The poll center -- \b IN. + \param stop Stop flag, true if cannot get direction -- \b IN/OUT. + \param stop_reason Stop type -- \b OUT. */ void set_poll_directions ( std::list<NOMAD::Direction> & dirs , NOMAD::poll_type i_pc , @@ -215,24 +216,24 @@ namespace NOMAD { /// Sets the poll intensification points from signature, poll center and mesh size /** - \param poll_center The poll center -- \b IN. - \param offset Dir index offset for intensification -- \b IN. - \param stop Stop flag, true if cannot get direction -- \b IN/OUT. - \param stop_reason Stop type -- \b OUT. + \param poll_center The poll center -- \b IN. + \param offset Dir index offset for intensification -- \b IN. + \param stop Stop flag, true if cannot get direction -- \b IN/OUT. + \param stop_reason Stop type -- \b OUT. */ - void set_poll_intensification_points ( const NOMAD::Eval_Point & poll_center , - size_t & offset , + void set_poll_intensification_points ( const NOMAD::Eval_Point & poll_center, + size_t & offset , bool & stop , - NOMAD::stop_type & stop_reason ); + NOMAD::stop_type & stop_reason ); /// Reduce the number of poll directions -> n /** - \param dirs List of directions for the poll -- \b IN/OUT. - \param poll_center The poll center -- \b IN. + \param dirs List of directions for the poll -- \b IN/OUT. + \param poll_center the poll center -- \b IN. \return success for this step. */ - bool set_reduced_poll_to_n_directions(std::list<NOMAD::Direction> & dirs, - const NOMAD::Eval_Point & poll_center); + bool set_reduced_poll_to_n_directions(std::list<NOMAD::Direction> & dirs, + const NOMAD::Eval_Point & poll_center); /// Compute the rank of a list of directions /** @@ -319,13 +320,13 @@ namespace NOMAD { /** - The computed opposite directions already include Delta^k_m. \param dirs List of existing directions (no snap to bounds) -- \b IN. - \param newDirs New dynamic directions -- \b OUT. + \param newDirs New dynamic directions -- \b OUT. \param poll_center Poll center -- \b IN. \return true if new dynamic direction generated false otherwise */ - bool get_dynamic_directions (const std::list<NOMAD::Direction> & dirs, - std::list<NOMAD::Direction> & newDirs, - const NOMAD::Eval_Point & poll_center) ; + bool get_dynamic_directions (const std::list<NOMAD::Direction> & dirs, + std::list<NOMAD::Direction> & newDirs, + const NOMAD::Eval_Point & poll_center) ; @@ -349,12 +350,12 @@ namespace NOMAD { /// get a single direction using quad model optimization or sum of negatives /** - \param dirs Reduced poll directions (no snap to bounds) -- \b IN. - \param poll_center Poll center -- \b IN. + \param dirs Reduced poll directions (no snap to bounds) -- \b IN. + \param poll_center Poll center -- \b IN. \return new direction */ - NOMAD::Direction get_single_dynamic_direction (const std::list<NOMAD::Direction> & dirs, - const NOMAD::Eval_Point & poll_center) ; + NOMAD::Direction get_single_dynamic_direction (const std::list<NOMAD::Direction> & dirs, + const NOMAD::Eval_Point & poll_center) ; /*-----------------------------------------------------------------------------*/ @@ -375,7 +376,7 @@ namespace NOMAD { _ev_control_for_sorting( p , _stats , _ev_control.get_evaluator() , &(_ev_control.get_cache()) , &(_ev_control.get_sgte_cache()) ) , _true_barrier ( p , NOMAD::TRUTH ) , _sgte_barrier ( p , NOMAD::SGTE ) , - _mesh ( p.get_signature()->get_mesh() ) , + _mesh ( p.get_signature()->get_mesh() ) , _pareto_front ( NULL ) , _user_search ( NULL ) , _model_search1 ( NULL ) , @@ -384,7 +385,8 @@ namespace NOMAD { _cache_search ( NULL ) , _L_curve ( NULL ) , _extended_poll ( NULL ) , - _user_ext_poll ( false ) { init(); } + _user_ext_poll ( false ) , + _sgtelib_model_manager ( NULL ) { init(); } /// Constructor #2. /** @@ -408,7 +410,7 @@ namespace NOMAD { _ev_control_for_sorting( p , _stats , _ev_control.get_evaluator() , cache , sgte_cache ) , _true_barrier ( p , NOMAD::TRUTH ) , _sgte_barrier ( p , NOMAD::SGTE ) , - _mesh ( p.get_signature()->get_mesh() ) , + _mesh ( p.get_signature()->get_mesh() ) , _pareto_front ( NULL ) , _user_search ( NULL ) , _model_search1 ( NULL ) , @@ -417,7 +419,8 @@ namespace NOMAD { _cache_search ( NULL ) , _L_curve ( NULL ) , _extended_poll ( extended_poll ) , - _user_ext_poll ( (extended_poll!=NULL) ) { init(); } + _user_ext_poll ( (extended_poll!=NULL) ) , + _sgtelib_model_manager ( NULL ) { init(); } /// Destructor. virtual ~Mads ( void ); diff --git a/src/Makefile.am b/src/Makefile.am index bb5d4aa0d380595e0c20da07245cdd720d1b6479..31bee8677d0a0996c772105335c78eb1dddf377a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -9,7 +9,10 @@ libnomad_a_SOURCES = Barrier.cpp Cache.cpp Cache_File_Point.cpp Cache_Point.cpp\ Phase_One_Search.cpp Point.cpp Priority_Eval_Point.cpp Quad_Model.cpp\ Quad_Model_Evaluator.cpp Quad_Model_Search.cpp Random_Pickup.cpp\ RNG.cpp Signature.cpp Slave.cpp Speculative_Search.cpp Stats.cpp\ - utils.cpp Variable_Group.cpp VNS_Search.cpp OrthogonalMesh.cpp + utils.cpp Variable_Group.cpp VNS_Search.cpp OrthogonalMesh.cpp \ + GMesh.cpp Sgtelib_Model_Evaluator.cpp Sgtelib_Model_Manager.cpp \ + Sgtelib_Model_Search.cpp + libnomadmpi_a_SOURCES = Barrier.cpp Cache.cpp Cache_File_Point.cpp Cache_Point.cpp\ Cache_Search.cpp Clock.cpp Direction.cpp Directions.cpp Display.cpp\ @@ -21,8 +24,10 @@ libnomadmpi_a_SOURCES = Barrier.cpp Cache.cpp Cache_File_Point.cpp Cache_Point.c Phase_One_Search.cpp Point.cpp Priority_Eval_Point.cpp Quad_Model.cpp\ Quad_Model_Evaluator.cpp Quad_Model_Search.cpp Random_Pickup.cpp\ RNG.cpp Signature.cpp Slave.cpp Speculative_Search.cpp Stats.cpp\ - utils.cpp Variable_Group.cpp VNS_Search.cpp OrthogonalMesh.cpp - + utils.cpp Variable_Group.cpp VNS_Search.cpp OrthogonalMesh.cpp \ + GMesh.cpp Sgtelib_Model_Evaluator.cpp Sgtelib_Model_Manager.cpp \ + Sgtelib_Model_Search.cpp + pkginclude_HEADERS = Cache_File_Point.hpp Cache.hpp Cache_Point.hpp\ Cache_Search.hpp Clock.hpp defines.hpp Direction.hpp Directions.hpp\ Display.hpp Double.hpp Eval_Point.hpp Evaluator_Control.hpp\ @@ -37,7 +42,9 @@ pkginclude_HEADERS = Cache_File_Point.hpp Cache.hpp Cache_Point.hpp\ Set_Element.hpp Signature_Element.hpp Signature.hpp\ Single_Obj_Quad_Model_Evaluator.hpp Slave.hpp Speculative_Search.hpp\ Stats.hpp Uncopyable.hpp utils.hpp Variable_Group.hpp\ - VNS_Search.hpp Barrier.hpp OrthogonalMesh.hpp + VNS_Search.hpp Barrier.hpp OrthogonalMesh.hpp \ + GMesh.hpp Sgtelib_Model_Evaluator.hpp Sgtelib_Model_Manager.hpp \ + Sgtelib_Model_Search.hpp bin_PROGRAMS = nomad nomad_SOURCES = nomad.cpp diff --git a/src/Makefile.in b/src/Makefile.in new file mode 100644 index 0000000000000000000000000000000000000000..1a59aae8c42ea5866dfb4a12ca0ab980de0955d4 --- /dev/null +++ b/src/Makefile.in @@ -0,0 +1,1575 @@ +# Makefile.in generated by automake 1.15 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2014 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + + + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +bin_PROGRAMS = nomad$(EXEEXT) $(am__EXEEXT_1) +@MPI_ENABLED_TRUE@am__append_1 = libnomadmpi.a +@MPI_ENABLED_TRUE@am__append_2 = ../nomadmpi.pc +@MPI_ENABLED_TRUE@am__append_3 = nomad.mpi +subdir = src +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/lx_find_mpi.m4 \ + $(top_srcdir)/m4/nomad.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(pkginclude_HEADERS) \ + $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \ + "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(pkgincludedir)" +LIBRARIES = $(lib_LIBRARIES) +AR = ar +ARFLAGS = cru +AM_V_AR = $(am__v_AR_@AM_V@) +am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@) +am__v_AR_0 = @echo " AR " $@; +am__v_AR_1 = +libnomad_a_AR = $(AR) $(ARFLAGS) +libnomad_a_LIBADD = +am_libnomad_a_OBJECTS = Barrier.$(OBJEXT) Cache.$(OBJEXT) \ + Cache_File_Point.$(OBJEXT) Cache_Point.$(OBJEXT) \ + Cache_Search.$(OBJEXT) Clock.$(OBJEXT) Direction.$(OBJEXT) \ + Directions.$(OBJEXT) Display.$(OBJEXT) Double.$(OBJEXT) \ + Eval_Point.$(OBJEXT) Evaluator_Control.$(OBJEXT) \ + Evaluator.$(OBJEXT) Exception.$(OBJEXT) \ + Extended_Poll.$(OBJEXT) L_Curve.$(OBJEXT) LH_Search.$(OBJEXT) \ + Mads.$(OBJEXT) SMesh.$(OBJEXT) XMesh.$(OBJEXT) \ + Model_Sorted_Point.$(OBJEXT) Model_Stats.$(OBJEXT) \ + Multi_Obj_Evaluator.$(OBJEXT) Parameter_Entries.$(OBJEXT) \ + Parameter_Entry.$(OBJEXT) Parameters.$(OBJEXT) \ + Pareto_Front.$(OBJEXT) Pareto_Point.$(OBJEXT) \ + Phase_One_Evaluator.$(OBJEXT) Phase_One_Search.$(OBJEXT) \ + Point.$(OBJEXT) Priority_Eval_Point.$(OBJEXT) \ + Quad_Model.$(OBJEXT) Quad_Model_Evaluator.$(OBJEXT) \ + Quad_Model_Search.$(OBJEXT) Random_Pickup.$(OBJEXT) \ + RNG.$(OBJEXT) Signature.$(OBJEXT) Slave.$(OBJEXT) \ + Speculative_Search.$(OBJEXT) Stats.$(OBJEXT) utils.$(OBJEXT) \ + Variable_Group.$(OBJEXT) VNS_Search.$(OBJEXT) \ + OrthogonalMesh.$(OBJEXT) +libnomad_a_OBJECTS = $(am_libnomad_a_OBJECTS) +libnomadmpi_a_AR = $(AR) $(ARFLAGS) +libnomadmpi_a_LIBADD = +am_libnomadmpi_a_OBJECTS = libnomadmpi_a-Barrier.$(OBJEXT) \ + libnomadmpi_a-Cache.$(OBJEXT) \ + libnomadmpi_a-Cache_File_Point.$(OBJEXT) \ + libnomadmpi_a-Cache_Point.$(OBJEXT) \ + libnomadmpi_a-Cache_Search.$(OBJEXT) \ + libnomadmpi_a-Clock.$(OBJEXT) \ + libnomadmpi_a-Direction.$(OBJEXT) \ + libnomadmpi_a-Directions.$(OBJEXT) \ + libnomadmpi_a-Display.$(OBJEXT) libnomadmpi_a-Double.$(OBJEXT) \ + libnomadmpi_a-Eval_Point.$(OBJEXT) \ + libnomadmpi_a-Evaluator_Control.$(OBJEXT) \ + libnomadmpi_a-Evaluator.$(OBJEXT) \ + libnomadmpi_a-Exception.$(OBJEXT) \ + libnomadmpi_a-Extended_Poll.$(OBJEXT) \ + libnomadmpi_a-L_Curve.$(OBJEXT) \ + libnomadmpi_a-LH_Search.$(OBJEXT) libnomadmpi_a-Mads.$(OBJEXT) \ + libnomadmpi_a-SMesh.$(OBJEXT) libnomadmpi_a-XMesh.$(OBJEXT) \ + libnomadmpi_a-Model_Sorted_Point.$(OBJEXT) \ + libnomadmpi_a-Model_Stats.$(OBJEXT) \ + libnomadmpi_a-Multi_Obj_Evaluator.$(OBJEXT) \ + libnomadmpi_a-Parameter_Entries.$(OBJEXT) \ + libnomadmpi_a-Parameter_Entry.$(OBJEXT) \ + libnomadmpi_a-Parameters.$(OBJEXT) \ + libnomadmpi_a-Pareto_Front.$(OBJEXT) \ + libnomadmpi_a-Pareto_Point.$(OBJEXT) \ + libnomadmpi_a-Phase_One_Evaluator.$(OBJEXT) \ + libnomadmpi_a-Phase_One_Search.$(OBJEXT) \ + libnomadmpi_a-Point.$(OBJEXT) \ + libnomadmpi_a-Priority_Eval_Point.$(OBJEXT) \ + libnomadmpi_a-Quad_Model.$(OBJEXT) \ + libnomadmpi_a-Quad_Model_Evaluator.$(OBJEXT) \ + libnomadmpi_a-Quad_Model_Search.$(OBJEXT) \ + libnomadmpi_a-Random_Pickup.$(OBJEXT) \ + libnomadmpi_a-RNG.$(OBJEXT) libnomadmpi_a-Signature.$(OBJEXT) \ + libnomadmpi_a-Slave.$(OBJEXT) \ + libnomadmpi_a-Speculative_Search.$(OBJEXT) \ + libnomadmpi_a-Stats.$(OBJEXT) libnomadmpi_a-utils.$(OBJEXT) \ + libnomadmpi_a-Variable_Group.$(OBJEXT) \ + libnomadmpi_a-VNS_Search.$(OBJEXT) \ + libnomadmpi_a-OrthogonalMesh.$(OBJEXT) +libnomadmpi_a_OBJECTS = $(am_libnomadmpi_a_OBJECTS) +@MPI_ENABLED_TRUE@am__EXEEXT_1 = nomad.mpi$(EXEEXT) +PROGRAMS = $(bin_PROGRAMS) +am_nomad_OBJECTS = nomad.$(OBJEXT) +nomad_OBJECTS = $(am_nomad_OBJECTS) +nomad_DEPENDENCIES = libnomad.a +am__nomad_mpi_SOURCES_DIST = nomad.cpp +@MPI_ENABLED_TRUE@am_nomad_mpi_OBJECTS = nomad_mpi-nomad.$(OBJEXT) +nomad_mpi_OBJECTS = $(am_nomad_mpi_OBJECTS) +@MPI_ENABLED_TRUE@nomad_mpi_DEPENDENCIES = libnomadmpi.a +nomad_mpi_LINK = $(CXXLD) $(nomad_mpi_CXXFLAGS) $(CXXFLAGS) \ + $(nomad_mpi_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +AM_V_CXX = $(am__v_CXX_@AM_V@) +am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) +am__v_CXX_0 = @echo " CXX " $@; +am__v_CXX_1 = +CXXLD = $(CXX) +CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ + -o $@ +AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) +am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) +am__v_CXXLD_0 = @echo " CXXLD " $@; +am__v_CXXLD_1 = +SOURCES = $(libnomad_a_SOURCES) $(libnomadmpi_a_SOURCES) \ + $(nomad_SOURCES) $(nomad_mpi_SOURCES) +DIST_SOURCES = $(libnomad_a_SOURCES) $(libnomadmpi_a_SOURCES) \ + $(nomad_SOURCES) $(am__nomad_mpi_SOURCES_DIST) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +DATA = $(nodist_pkgconfig_DATA) +HEADERS = $(pkginclude_HEADERS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DOT = @DOT@ +DOXYGEN = @DOXYGEN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MPICXX = @MPICXX@ +MPI_CXXFLAGS = @MPI_CXXFLAGS@ +MPI_CXXLDFLAGS = @MPI_CXXLDFLAGS@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build_alias = @build_alias@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host_alias = @host_alias@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +lib_LIBRARIES = libnomad.a $(am__append_1) +libnomad_a_SOURCES = Barrier.cpp Cache.cpp Cache_File_Point.cpp Cache_Point.cpp\ + Cache_Search.cpp Clock.cpp Direction.cpp Directions.cpp Display.cpp\ + Double.cpp Eval_Point.cpp Evaluator_Control.cpp Evaluator.cpp\ + Exception.cpp Extended_Poll.cpp L_Curve.cpp LH_Search.cpp Mads.cpp\ + SMesh.cpp XMesh.cpp Model_Sorted_Point.cpp Model_Stats.cpp Multi_Obj_Evaluator.cpp\ + Parameter_Entries.cpp Parameter_Entry.cpp Parameters.cpp\ + Pareto_Front.cpp Pareto_Point.cpp Phase_One_Evaluator.cpp\ + Phase_One_Search.cpp Point.cpp Priority_Eval_Point.cpp Quad_Model.cpp\ + Quad_Model_Evaluator.cpp Quad_Model_Search.cpp Random_Pickup.cpp\ + RNG.cpp Signature.cpp Slave.cpp Speculative_Search.cpp Stats.cpp\ + utils.cpp Variable_Group.cpp VNS_Search.cpp OrthogonalMesh.cpp + +libnomadmpi_a_SOURCES = Barrier.cpp Cache.cpp Cache_File_Point.cpp Cache_Point.cpp\ + Cache_Search.cpp Clock.cpp Direction.cpp Directions.cpp Display.cpp\ + Double.cpp Eval_Point.cpp Evaluator_Control.cpp Evaluator.cpp\ + Exception.cpp Extended_Poll.cpp L_Curve.cpp LH_Search.cpp Mads.cpp\ + SMesh.cpp XMesh.cpp Model_Sorted_Point.cpp Model_Stats.cpp Multi_Obj_Evaluator.cpp\ + Parameter_Entries.cpp Parameter_Entry.cpp Parameters.cpp\ + Pareto_Front.cpp Pareto_Point.cpp Phase_One_Evaluator.cpp\ + Phase_One_Search.cpp Point.cpp Priority_Eval_Point.cpp Quad_Model.cpp\ + Quad_Model_Evaluator.cpp Quad_Model_Search.cpp Random_Pickup.cpp\ + RNG.cpp Signature.cpp Slave.cpp Speculative_Search.cpp Stats.cpp\ + utils.cpp Variable_Group.cpp VNS_Search.cpp OrthogonalMesh.cpp + +pkginclude_HEADERS = Cache_File_Point.hpp Cache.hpp Cache_Point.hpp\ + Cache_Search.hpp Clock.hpp defines.hpp Direction.hpp Directions.hpp\ + Display.hpp Double.hpp Eval_Point.hpp Evaluator_Control.hpp\ + Evaluator.hpp Exception.hpp Extended_Poll.hpp Filter_Point.hpp\ + L_Curve.hpp LH_Search.hpp Mads.hpp SMesh.hpp XMesh.hpp Model_Sorted_Point.hpp\ + Model_Stats.hpp Multi_Obj_Evaluator.hpp\ + Multi_Obj_Quad_Model_Evaluator.hpp nomad.hpp Parameter_Entries.hpp\ + Parameter_Entry.hpp Parameters.hpp Pareto_Front.hpp Pareto_Point.hpp\ + Phase_One_Evaluator.hpp Phase_One_Search.hpp Point.hpp\ + Priority_Eval_Point.hpp Quad_Model_Evaluator.hpp Quad_Model.hpp\ + Quad_Model_Search.hpp Random_Pickup.hpp RNG.hpp Search.hpp\ + Set_Element.hpp Signature_Element.hpp Signature.hpp\ + Single_Obj_Quad_Model_Evaluator.hpp Slave.hpp Speculative_Search.hpp\ + Stats.hpp Uncopyable.hpp utils.hpp Variable_Group.hpp\ + VNS_Search.hpp Barrier.hpp OrthogonalMesh.hpp + +nomad_SOURCES = nomad.cpp +nomad_LDADD = libnomad.a +pkgconfigdir = $(libdir)/pkgconfig +nodist_pkgconfig_DATA = ../nomad.pc $(am__append_2) +@MPI_ENABLED_TRUE@libnomadmpi_a_CXXFLAGS = -DUSE_MPI $(MPI_LDFLAGS) $(MPI_CXXFLAGS) $(AM_CXXFLAGS) +@MPI_ENABLED_TRUE@nomad_mpi_SOURCES = nomad.cpp +@MPI_ENABLED_TRUE@nomad_mpi_LDADD = libnomadmpi.a +@MPI_ENABLED_TRUE@nomad_mpi_CXXFLAGS = -DUSE_MPI $(MPI_CXXFLAGS) $(AM_CXXFLAGS) +@MPI_ENABLED_TRUE@nomad_mpi_LDFLAGS = $(MPI_CXXLDFLAGS) $(AM_CXXLDFLAGS) +all: all-am + +.SUFFIXES: +.SUFFIXES: .cpp .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-libLIBRARIES: $(lib_LIBRARIES) + @$(NORMAL_INSTALL) + @list='$(lib_LIBRARIES)'; test -n "$(libdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ + echo " $(INSTALL_DATA) $$list2 '$(DESTDIR)$(libdir)'"; \ + $(INSTALL_DATA) $$list2 "$(DESTDIR)$(libdir)" || exit $$?; } + @$(POST_INSTALL) + @list='$(lib_LIBRARIES)'; test -n "$(libdir)" || list=; \ + for p in $$list; do \ + if test -f $$p; then \ + $(am__strip_dir) \ + echo " ( cd '$(DESTDIR)$(libdir)' && $(RANLIB) $$f )"; \ + ( cd "$(DESTDIR)$(libdir)" && $(RANLIB) $$f ) || exit $$?; \ + else :; fi; \ + done + +uninstall-libLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LIBRARIES)'; test -n "$(libdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(libdir)'; $(am__uninstall_files_from_dir) + +clean-libLIBRARIES: + -test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES) + +libnomad.a: $(libnomad_a_OBJECTS) $(libnomad_a_DEPENDENCIES) $(EXTRA_libnomad_a_DEPENDENCIES) + $(AM_V_at)-rm -f libnomad.a + $(AM_V_AR)$(libnomad_a_AR) libnomad.a $(libnomad_a_OBJECTS) $(libnomad_a_LIBADD) + $(AM_V_at)$(RANLIB) libnomad.a + +libnomadmpi.a: $(libnomadmpi_a_OBJECTS) $(libnomadmpi_a_DEPENDENCIES) $(EXTRA_libnomadmpi_a_DEPENDENCIES) + $(AM_V_at)-rm -f libnomadmpi.a + $(AM_V_AR)$(libnomadmpi_a_AR) libnomadmpi.a $(libnomadmpi_a_OBJECTS) $(libnomadmpi_a_LIBADD) + $(AM_V_at)$(RANLIB) libnomadmpi.a +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p \ + ; then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' \ + -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' \ + `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(bindir)" && rm -f $$files + +clean-binPROGRAMS: + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) + +nomad$(EXEEXT): $(nomad_OBJECTS) $(nomad_DEPENDENCIES) $(EXTRA_nomad_DEPENDENCIES) + @rm -f nomad$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(nomad_OBJECTS) $(nomad_LDADD) $(LIBS) + +nomad.mpi$(EXEEXT): $(nomad_mpi_OBJECTS) $(nomad_mpi_DEPENDENCIES) $(EXTRA_nomad_mpi_DEPENDENCIES) + @rm -f nomad.mpi$(EXEEXT) + $(AM_V_CXXLD)$(nomad_mpi_LINK) $(nomad_mpi_OBJECTS) $(nomad_mpi_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Barrier.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Cache.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Cache_File_Point.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Cache_Point.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Cache_Search.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Clock.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Direction.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Directions.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Display.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Double.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Eval_Point.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Evaluator.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Evaluator_Control.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Exception.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Extended_Poll.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LH_Search.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/L_Curve.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Mads.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Model_Sorted_Point.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Model_Stats.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Multi_Obj_Evaluator.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OrthogonalMesh.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Parameter_Entries.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Parameter_Entry.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Parameters.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Pareto_Front.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Pareto_Point.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Phase_One_Evaluator.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Phase_One_Search.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Point.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Priority_Eval_Point.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Quad_Model.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Quad_Model_Evaluator.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Quad_Model_Search.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/RNG.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Random_Pickup.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SMesh.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Signature.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Slave.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Speculative_Search.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Stats.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/VNS_Search.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Variable_Group.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XMesh.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnomadmpi_a-Barrier.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnomadmpi_a-Cache.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnomadmpi_a-Cache_File_Point.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnomadmpi_a-Cache_Point.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnomadmpi_a-Cache_Search.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnomadmpi_a-Clock.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnomadmpi_a-Direction.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnomadmpi_a-Directions.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnomadmpi_a-Display.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnomadmpi_a-Double.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnomadmpi_a-Eval_Point.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnomadmpi_a-Evaluator.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnomadmpi_a-Evaluator_Control.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnomadmpi_a-Exception.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnomadmpi_a-Extended_Poll.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnomadmpi_a-LH_Search.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnomadmpi_a-L_Curve.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnomadmpi_a-Mads.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnomadmpi_a-Model_Sorted_Point.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnomadmpi_a-Model_Stats.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnomadmpi_a-Multi_Obj_Evaluator.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnomadmpi_a-OrthogonalMesh.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnomadmpi_a-Parameter_Entries.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnomadmpi_a-Parameter_Entry.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnomadmpi_a-Parameters.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnomadmpi_a-Pareto_Front.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnomadmpi_a-Pareto_Point.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnomadmpi_a-Phase_One_Evaluator.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnomadmpi_a-Phase_One_Search.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnomadmpi_a-Point.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnomadmpi_a-Priority_Eval_Point.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnomadmpi_a-Quad_Model.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnomadmpi_a-Quad_Model_Evaluator.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnomadmpi_a-Quad_Model_Search.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnomadmpi_a-RNG.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnomadmpi_a-Random_Pickup.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnomadmpi_a-SMesh.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnomadmpi_a-Signature.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnomadmpi_a-Slave.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnomadmpi_a-Speculative_Search.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnomadmpi_a-Stats.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnomadmpi_a-VNS_Search.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnomadmpi_a-Variable_Group.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnomadmpi_a-XMesh.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnomadmpi_a-utils.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nomad.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nomad_mpi-nomad.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utils.Po@am__quote@ + +.cpp.o: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< + +.cpp.obj: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +libnomadmpi_a-Barrier.o: Barrier.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Barrier.o -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Barrier.Tpo -c -o libnomadmpi_a-Barrier.o `test -f 'Barrier.cpp' || echo '$(srcdir)/'`Barrier.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Barrier.Tpo $(DEPDIR)/libnomadmpi_a-Barrier.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Barrier.cpp' object='libnomadmpi_a-Barrier.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Barrier.o `test -f 'Barrier.cpp' || echo '$(srcdir)/'`Barrier.cpp + +libnomadmpi_a-Barrier.obj: Barrier.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Barrier.obj -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Barrier.Tpo -c -o libnomadmpi_a-Barrier.obj `if test -f 'Barrier.cpp'; then $(CYGPATH_W) 'Barrier.cpp'; else $(CYGPATH_W) '$(srcdir)/Barrier.cpp'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Barrier.Tpo $(DEPDIR)/libnomadmpi_a-Barrier.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Barrier.cpp' object='libnomadmpi_a-Barrier.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Barrier.obj `if test -f 'Barrier.cpp'; then $(CYGPATH_W) 'Barrier.cpp'; else $(CYGPATH_W) '$(srcdir)/Barrier.cpp'; fi` + +libnomadmpi_a-Cache.o: Cache.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Cache.o -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Cache.Tpo -c -o libnomadmpi_a-Cache.o `test -f 'Cache.cpp' || echo '$(srcdir)/'`Cache.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Cache.Tpo $(DEPDIR)/libnomadmpi_a-Cache.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Cache.cpp' object='libnomadmpi_a-Cache.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Cache.o `test -f 'Cache.cpp' || echo '$(srcdir)/'`Cache.cpp + +libnomadmpi_a-Cache.obj: Cache.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Cache.obj -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Cache.Tpo -c -o libnomadmpi_a-Cache.obj `if test -f 'Cache.cpp'; then $(CYGPATH_W) 'Cache.cpp'; else $(CYGPATH_W) '$(srcdir)/Cache.cpp'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Cache.Tpo $(DEPDIR)/libnomadmpi_a-Cache.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Cache.cpp' object='libnomadmpi_a-Cache.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Cache.obj `if test -f 'Cache.cpp'; then $(CYGPATH_W) 'Cache.cpp'; else $(CYGPATH_W) '$(srcdir)/Cache.cpp'; fi` + +libnomadmpi_a-Cache_File_Point.o: Cache_File_Point.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Cache_File_Point.o -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Cache_File_Point.Tpo -c -o libnomadmpi_a-Cache_File_Point.o `test -f 'Cache_File_Point.cpp' || echo '$(srcdir)/'`Cache_File_Point.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Cache_File_Point.Tpo $(DEPDIR)/libnomadmpi_a-Cache_File_Point.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Cache_File_Point.cpp' object='libnomadmpi_a-Cache_File_Point.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Cache_File_Point.o `test -f 'Cache_File_Point.cpp' || echo '$(srcdir)/'`Cache_File_Point.cpp + +libnomadmpi_a-Cache_File_Point.obj: Cache_File_Point.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Cache_File_Point.obj -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Cache_File_Point.Tpo -c -o libnomadmpi_a-Cache_File_Point.obj `if test -f 'Cache_File_Point.cpp'; then $(CYGPATH_W) 'Cache_File_Point.cpp'; else $(CYGPATH_W) '$(srcdir)/Cache_File_Point.cpp'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Cache_File_Point.Tpo $(DEPDIR)/libnomadmpi_a-Cache_File_Point.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Cache_File_Point.cpp' object='libnomadmpi_a-Cache_File_Point.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Cache_File_Point.obj `if test -f 'Cache_File_Point.cpp'; then $(CYGPATH_W) 'Cache_File_Point.cpp'; else $(CYGPATH_W) '$(srcdir)/Cache_File_Point.cpp'; fi` + +libnomadmpi_a-Cache_Point.o: Cache_Point.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Cache_Point.o -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Cache_Point.Tpo -c -o libnomadmpi_a-Cache_Point.o `test -f 'Cache_Point.cpp' || echo '$(srcdir)/'`Cache_Point.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Cache_Point.Tpo $(DEPDIR)/libnomadmpi_a-Cache_Point.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Cache_Point.cpp' object='libnomadmpi_a-Cache_Point.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Cache_Point.o `test -f 'Cache_Point.cpp' || echo '$(srcdir)/'`Cache_Point.cpp + +libnomadmpi_a-Cache_Point.obj: Cache_Point.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Cache_Point.obj -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Cache_Point.Tpo -c -o libnomadmpi_a-Cache_Point.obj `if test -f 'Cache_Point.cpp'; then $(CYGPATH_W) 'Cache_Point.cpp'; else $(CYGPATH_W) '$(srcdir)/Cache_Point.cpp'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Cache_Point.Tpo $(DEPDIR)/libnomadmpi_a-Cache_Point.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Cache_Point.cpp' object='libnomadmpi_a-Cache_Point.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Cache_Point.obj `if test -f 'Cache_Point.cpp'; then $(CYGPATH_W) 'Cache_Point.cpp'; else $(CYGPATH_W) '$(srcdir)/Cache_Point.cpp'; fi` + +libnomadmpi_a-Cache_Search.o: Cache_Search.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Cache_Search.o -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Cache_Search.Tpo -c -o libnomadmpi_a-Cache_Search.o `test -f 'Cache_Search.cpp' || echo '$(srcdir)/'`Cache_Search.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Cache_Search.Tpo $(DEPDIR)/libnomadmpi_a-Cache_Search.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Cache_Search.cpp' object='libnomadmpi_a-Cache_Search.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Cache_Search.o `test -f 'Cache_Search.cpp' || echo '$(srcdir)/'`Cache_Search.cpp + +libnomadmpi_a-Cache_Search.obj: Cache_Search.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Cache_Search.obj -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Cache_Search.Tpo -c -o libnomadmpi_a-Cache_Search.obj `if test -f 'Cache_Search.cpp'; then $(CYGPATH_W) 'Cache_Search.cpp'; else $(CYGPATH_W) '$(srcdir)/Cache_Search.cpp'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Cache_Search.Tpo $(DEPDIR)/libnomadmpi_a-Cache_Search.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Cache_Search.cpp' object='libnomadmpi_a-Cache_Search.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Cache_Search.obj `if test -f 'Cache_Search.cpp'; then $(CYGPATH_W) 'Cache_Search.cpp'; else $(CYGPATH_W) '$(srcdir)/Cache_Search.cpp'; fi` + +libnomadmpi_a-Clock.o: Clock.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Clock.o -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Clock.Tpo -c -o libnomadmpi_a-Clock.o `test -f 'Clock.cpp' || echo '$(srcdir)/'`Clock.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Clock.Tpo $(DEPDIR)/libnomadmpi_a-Clock.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Clock.cpp' object='libnomadmpi_a-Clock.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Clock.o `test -f 'Clock.cpp' || echo '$(srcdir)/'`Clock.cpp + +libnomadmpi_a-Clock.obj: Clock.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Clock.obj -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Clock.Tpo -c -o libnomadmpi_a-Clock.obj `if test -f 'Clock.cpp'; then $(CYGPATH_W) 'Clock.cpp'; else $(CYGPATH_W) '$(srcdir)/Clock.cpp'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Clock.Tpo $(DEPDIR)/libnomadmpi_a-Clock.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Clock.cpp' object='libnomadmpi_a-Clock.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Clock.obj `if test -f 'Clock.cpp'; then $(CYGPATH_W) 'Clock.cpp'; else $(CYGPATH_W) '$(srcdir)/Clock.cpp'; fi` + +libnomadmpi_a-Direction.o: Direction.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Direction.o -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Direction.Tpo -c -o libnomadmpi_a-Direction.o `test -f 'Direction.cpp' || echo '$(srcdir)/'`Direction.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Direction.Tpo $(DEPDIR)/libnomadmpi_a-Direction.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Direction.cpp' object='libnomadmpi_a-Direction.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Direction.o `test -f 'Direction.cpp' || echo '$(srcdir)/'`Direction.cpp + +libnomadmpi_a-Direction.obj: Direction.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Direction.obj -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Direction.Tpo -c -o libnomadmpi_a-Direction.obj `if test -f 'Direction.cpp'; then $(CYGPATH_W) 'Direction.cpp'; else $(CYGPATH_W) '$(srcdir)/Direction.cpp'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Direction.Tpo $(DEPDIR)/libnomadmpi_a-Direction.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Direction.cpp' object='libnomadmpi_a-Direction.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Direction.obj `if test -f 'Direction.cpp'; then $(CYGPATH_W) 'Direction.cpp'; else $(CYGPATH_W) '$(srcdir)/Direction.cpp'; fi` + +libnomadmpi_a-Directions.o: Directions.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Directions.o -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Directions.Tpo -c -o libnomadmpi_a-Directions.o `test -f 'Directions.cpp' || echo '$(srcdir)/'`Directions.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Directions.Tpo $(DEPDIR)/libnomadmpi_a-Directions.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Directions.cpp' object='libnomadmpi_a-Directions.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Directions.o `test -f 'Directions.cpp' || echo '$(srcdir)/'`Directions.cpp + +libnomadmpi_a-Directions.obj: Directions.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Directions.obj -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Directions.Tpo -c -o libnomadmpi_a-Directions.obj `if test -f 'Directions.cpp'; then $(CYGPATH_W) 'Directions.cpp'; else $(CYGPATH_W) '$(srcdir)/Directions.cpp'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Directions.Tpo $(DEPDIR)/libnomadmpi_a-Directions.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Directions.cpp' object='libnomadmpi_a-Directions.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Directions.obj `if test -f 'Directions.cpp'; then $(CYGPATH_W) 'Directions.cpp'; else $(CYGPATH_W) '$(srcdir)/Directions.cpp'; fi` + +libnomadmpi_a-Display.o: Display.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Display.o -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Display.Tpo -c -o libnomadmpi_a-Display.o `test -f 'Display.cpp' || echo '$(srcdir)/'`Display.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Display.Tpo $(DEPDIR)/libnomadmpi_a-Display.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Display.cpp' object='libnomadmpi_a-Display.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Display.o `test -f 'Display.cpp' || echo '$(srcdir)/'`Display.cpp + +libnomadmpi_a-Display.obj: Display.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Display.obj -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Display.Tpo -c -o libnomadmpi_a-Display.obj `if test -f 'Display.cpp'; then $(CYGPATH_W) 'Display.cpp'; else $(CYGPATH_W) '$(srcdir)/Display.cpp'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Display.Tpo $(DEPDIR)/libnomadmpi_a-Display.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Display.cpp' object='libnomadmpi_a-Display.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Display.obj `if test -f 'Display.cpp'; then $(CYGPATH_W) 'Display.cpp'; else $(CYGPATH_W) '$(srcdir)/Display.cpp'; fi` + +libnomadmpi_a-Double.o: Double.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Double.o -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Double.Tpo -c -o libnomadmpi_a-Double.o `test -f 'Double.cpp' || echo '$(srcdir)/'`Double.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Double.Tpo $(DEPDIR)/libnomadmpi_a-Double.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Double.cpp' object='libnomadmpi_a-Double.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Double.o `test -f 'Double.cpp' || echo '$(srcdir)/'`Double.cpp + +libnomadmpi_a-Double.obj: Double.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Double.obj -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Double.Tpo -c -o libnomadmpi_a-Double.obj `if test -f 'Double.cpp'; then $(CYGPATH_W) 'Double.cpp'; else $(CYGPATH_W) '$(srcdir)/Double.cpp'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Double.Tpo $(DEPDIR)/libnomadmpi_a-Double.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Double.cpp' object='libnomadmpi_a-Double.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Double.obj `if test -f 'Double.cpp'; then $(CYGPATH_W) 'Double.cpp'; else $(CYGPATH_W) '$(srcdir)/Double.cpp'; fi` + +libnomadmpi_a-Eval_Point.o: Eval_Point.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Eval_Point.o -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Eval_Point.Tpo -c -o libnomadmpi_a-Eval_Point.o `test -f 'Eval_Point.cpp' || echo '$(srcdir)/'`Eval_Point.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Eval_Point.Tpo $(DEPDIR)/libnomadmpi_a-Eval_Point.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Eval_Point.cpp' object='libnomadmpi_a-Eval_Point.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Eval_Point.o `test -f 'Eval_Point.cpp' || echo '$(srcdir)/'`Eval_Point.cpp + +libnomadmpi_a-Eval_Point.obj: Eval_Point.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Eval_Point.obj -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Eval_Point.Tpo -c -o libnomadmpi_a-Eval_Point.obj `if test -f 'Eval_Point.cpp'; then $(CYGPATH_W) 'Eval_Point.cpp'; else $(CYGPATH_W) '$(srcdir)/Eval_Point.cpp'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Eval_Point.Tpo $(DEPDIR)/libnomadmpi_a-Eval_Point.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Eval_Point.cpp' object='libnomadmpi_a-Eval_Point.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Eval_Point.obj `if test -f 'Eval_Point.cpp'; then $(CYGPATH_W) 'Eval_Point.cpp'; else $(CYGPATH_W) '$(srcdir)/Eval_Point.cpp'; fi` + +libnomadmpi_a-Evaluator_Control.o: Evaluator_Control.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Evaluator_Control.o -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Evaluator_Control.Tpo -c -o libnomadmpi_a-Evaluator_Control.o `test -f 'Evaluator_Control.cpp' || echo '$(srcdir)/'`Evaluator_Control.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Evaluator_Control.Tpo $(DEPDIR)/libnomadmpi_a-Evaluator_Control.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Evaluator_Control.cpp' object='libnomadmpi_a-Evaluator_Control.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Evaluator_Control.o `test -f 'Evaluator_Control.cpp' || echo '$(srcdir)/'`Evaluator_Control.cpp + +libnomadmpi_a-Evaluator_Control.obj: Evaluator_Control.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Evaluator_Control.obj -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Evaluator_Control.Tpo -c -o libnomadmpi_a-Evaluator_Control.obj `if test -f 'Evaluator_Control.cpp'; then $(CYGPATH_W) 'Evaluator_Control.cpp'; else $(CYGPATH_W) '$(srcdir)/Evaluator_Control.cpp'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Evaluator_Control.Tpo $(DEPDIR)/libnomadmpi_a-Evaluator_Control.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Evaluator_Control.cpp' object='libnomadmpi_a-Evaluator_Control.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Evaluator_Control.obj `if test -f 'Evaluator_Control.cpp'; then $(CYGPATH_W) 'Evaluator_Control.cpp'; else $(CYGPATH_W) '$(srcdir)/Evaluator_Control.cpp'; fi` + +libnomadmpi_a-Evaluator.o: Evaluator.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Evaluator.o -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Evaluator.Tpo -c -o libnomadmpi_a-Evaluator.o `test -f 'Evaluator.cpp' || echo '$(srcdir)/'`Evaluator.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Evaluator.Tpo $(DEPDIR)/libnomadmpi_a-Evaluator.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Evaluator.cpp' object='libnomadmpi_a-Evaluator.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Evaluator.o `test -f 'Evaluator.cpp' || echo '$(srcdir)/'`Evaluator.cpp + +libnomadmpi_a-Evaluator.obj: Evaluator.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Evaluator.obj -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Evaluator.Tpo -c -o libnomadmpi_a-Evaluator.obj `if test -f 'Evaluator.cpp'; then $(CYGPATH_W) 'Evaluator.cpp'; else $(CYGPATH_W) '$(srcdir)/Evaluator.cpp'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Evaluator.Tpo $(DEPDIR)/libnomadmpi_a-Evaluator.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Evaluator.cpp' object='libnomadmpi_a-Evaluator.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Evaluator.obj `if test -f 'Evaluator.cpp'; then $(CYGPATH_W) 'Evaluator.cpp'; else $(CYGPATH_W) '$(srcdir)/Evaluator.cpp'; fi` + +libnomadmpi_a-Exception.o: Exception.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Exception.o -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Exception.Tpo -c -o libnomadmpi_a-Exception.o `test -f 'Exception.cpp' || echo '$(srcdir)/'`Exception.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Exception.Tpo $(DEPDIR)/libnomadmpi_a-Exception.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Exception.cpp' object='libnomadmpi_a-Exception.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Exception.o `test -f 'Exception.cpp' || echo '$(srcdir)/'`Exception.cpp + +libnomadmpi_a-Exception.obj: Exception.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Exception.obj -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Exception.Tpo -c -o libnomadmpi_a-Exception.obj `if test -f 'Exception.cpp'; then $(CYGPATH_W) 'Exception.cpp'; else $(CYGPATH_W) '$(srcdir)/Exception.cpp'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Exception.Tpo $(DEPDIR)/libnomadmpi_a-Exception.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Exception.cpp' object='libnomadmpi_a-Exception.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Exception.obj `if test -f 'Exception.cpp'; then $(CYGPATH_W) 'Exception.cpp'; else $(CYGPATH_W) '$(srcdir)/Exception.cpp'; fi` + +libnomadmpi_a-Extended_Poll.o: Extended_Poll.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Extended_Poll.o -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Extended_Poll.Tpo -c -o libnomadmpi_a-Extended_Poll.o `test -f 'Extended_Poll.cpp' || echo '$(srcdir)/'`Extended_Poll.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Extended_Poll.Tpo $(DEPDIR)/libnomadmpi_a-Extended_Poll.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Extended_Poll.cpp' object='libnomadmpi_a-Extended_Poll.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Extended_Poll.o `test -f 'Extended_Poll.cpp' || echo '$(srcdir)/'`Extended_Poll.cpp + +libnomadmpi_a-Extended_Poll.obj: Extended_Poll.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Extended_Poll.obj -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Extended_Poll.Tpo -c -o libnomadmpi_a-Extended_Poll.obj `if test -f 'Extended_Poll.cpp'; then $(CYGPATH_W) 'Extended_Poll.cpp'; else $(CYGPATH_W) '$(srcdir)/Extended_Poll.cpp'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Extended_Poll.Tpo $(DEPDIR)/libnomadmpi_a-Extended_Poll.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Extended_Poll.cpp' object='libnomadmpi_a-Extended_Poll.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Extended_Poll.obj `if test -f 'Extended_Poll.cpp'; then $(CYGPATH_W) 'Extended_Poll.cpp'; else $(CYGPATH_W) '$(srcdir)/Extended_Poll.cpp'; fi` + +libnomadmpi_a-L_Curve.o: L_Curve.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-L_Curve.o -MD -MP -MF $(DEPDIR)/libnomadmpi_a-L_Curve.Tpo -c -o libnomadmpi_a-L_Curve.o `test -f 'L_Curve.cpp' || echo '$(srcdir)/'`L_Curve.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-L_Curve.Tpo $(DEPDIR)/libnomadmpi_a-L_Curve.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='L_Curve.cpp' object='libnomadmpi_a-L_Curve.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-L_Curve.o `test -f 'L_Curve.cpp' || echo '$(srcdir)/'`L_Curve.cpp + +libnomadmpi_a-L_Curve.obj: L_Curve.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-L_Curve.obj -MD -MP -MF $(DEPDIR)/libnomadmpi_a-L_Curve.Tpo -c -o libnomadmpi_a-L_Curve.obj `if test -f 'L_Curve.cpp'; then $(CYGPATH_W) 'L_Curve.cpp'; else $(CYGPATH_W) '$(srcdir)/L_Curve.cpp'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-L_Curve.Tpo $(DEPDIR)/libnomadmpi_a-L_Curve.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='L_Curve.cpp' object='libnomadmpi_a-L_Curve.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-L_Curve.obj `if test -f 'L_Curve.cpp'; then $(CYGPATH_W) 'L_Curve.cpp'; else $(CYGPATH_W) '$(srcdir)/L_Curve.cpp'; fi` + +libnomadmpi_a-LH_Search.o: LH_Search.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-LH_Search.o -MD -MP -MF $(DEPDIR)/libnomadmpi_a-LH_Search.Tpo -c -o libnomadmpi_a-LH_Search.o `test -f 'LH_Search.cpp' || echo '$(srcdir)/'`LH_Search.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-LH_Search.Tpo $(DEPDIR)/libnomadmpi_a-LH_Search.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='LH_Search.cpp' object='libnomadmpi_a-LH_Search.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-LH_Search.o `test -f 'LH_Search.cpp' || echo '$(srcdir)/'`LH_Search.cpp + +libnomadmpi_a-LH_Search.obj: LH_Search.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-LH_Search.obj -MD -MP -MF $(DEPDIR)/libnomadmpi_a-LH_Search.Tpo -c -o libnomadmpi_a-LH_Search.obj `if test -f 'LH_Search.cpp'; then $(CYGPATH_W) 'LH_Search.cpp'; else $(CYGPATH_W) '$(srcdir)/LH_Search.cpp'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-LH_Search.Tpo $(DEPDIR)/libnomadmpi_a-LH_Search.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='LH_Search.cpp' object='libnomadmpi_a-LH_Search.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-LH_Search.obj `if test -f 'LH_Search.cpp'; then $(CYGPATH_W) 'LH_Search.cpp'; else $(CYGPATH_W) '$(srcdir)/LH_Search.cpp'; fi` + +libnomadmpi_a-Mads.o: Mads.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Mads.o -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Mads.Tpo -c -o libnomadmpi_a-Mads.o `test -f 'Mads.cpp' || echo '$(srcdir)/'`Mads.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Mads.Tpo $(DEPDIR)/libnomadmpi_a-Mads.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Mads.cpp' object='libnomadmpi_a-Mads.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Mads.o `test -f 'Mads.cpp' || echo '$(srcdir)/'`Mads.cpp + +libnomadmpi_a-Mads.obj: Mads.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Mads.obj -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Mads.Tpo -c -o libnomadmpi_a-Mads.obj `if test -f 'Mads.cpp'; then $(CYGPATH_W) 'Mads.cpp'; else $(CYGPATH_W) '$(srcdir)/Mads.cpp'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Mads.Tpo $(DEPDIR)/libnomadmpi_a-Mads.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Mads.cpp' object='libnomadmpi_a-Mads.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Mads.obj `if test -f 'Mads.cpp'; then $(CYGPATH_W) 'Mads.cpp'; else $(CYGPATH_W) '$(srcdir)/Mads.cpp'; fi` + +libnomadmpi_a-SMesh.o: SMesh.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-SMesh.o -MD -MP -MF $(DEPDIR)/libnomadmpi_a-SMesh.Tpo -c -o libnomadmpi_a-SMesh.o `test -f 'SMesh.cpp' || echo '$(srcdir)/'`SMesh.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-SMesh.Tpo $(DEPDIR)/libnomadmpi_a-SMesh.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='SMesh.cpp' object='libnomadmpi_a-SMesh.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-SMesh.o `test -f 'SMesh.cpp' || echo '$(srcdir)/'`SMesh.cpp + +libnomadmpi_a-SMesh.obj: SMesh.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-SMesh.obj -MD -MP -MF $(DEPDIR)/libnomadmpi_a-SMesh.Tpo -c -o libnomadmpi_a-SMesh.obj `if test -f 'SMesh.cpp'; then $(CYGPATH_W) 'SMesh.cpp'; else $(CYGPATH_W) '$(srcdir)/SMesh.cpp'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-SMesh.Tpo $(DEPDIR)/libnomadmpi_a-SMesh.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='SMesh.cpp' object='libnomadmpi_a-SMesh.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-SMesh.obj `if test -f 'SMesh.cpp'; then $(CYGPATH_W) 'SMesh.cpp'; else $(CYGPATH_W) '$(srcdir)/SMesh.cpp'; fi` + +libnomadmpi_a-XMesh.o: XMesh.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-XMesh.o -MD -MP -MF $(DEPDIR)/libnomadmpi_a-XMesh.Tpo -c -o libnomadmpi_a-XMesh.o `test -f 'XMesh.cpp' || echo '$(srcdir)/'`XMesh.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-XMesh.Tpo $(DEPDIR)/libnomadmpi_a-XMesh.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='XMesh.cpp' object='libnomadmpi_a-XMesh.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-XMesh.o `test -f 'XMesh.cpp' || echo '$(srcdir)/'`XMesh.cpp + +libnomadmpi_a-XMesh.obj: XMesh.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-XMesh.obj -MD -MP -MF $(DEPDIR)/libnomadmpi_a-XMesh.Tpo -c -o libnomadmpi_a-XMesh.obj `if test -f 'XMesh.cpp'; then $(CYGPATH_W) 'XMesh.cpp'; else $(CYGPATH_W) '$(srcdir)/XMesh.cpp'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-XMesh.Tpo $(DEPDIR)/libnomadmpi_a-XMesh.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='XMesh.cpp' object='libnomadmpi_a-XMesh.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-XMesh.obj `if test -f 'XMesh.cpp'; then $(CYGPATH_W) 'XMesh.cpp'; else $(CYGPATH_W) '$(srcdir)/XMesh.cpp'; fi` + +libnomadmpi_a-Model_Sorted_Point.o: Model_Sorted_Point.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Model_Sorted_Point.o -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Model_Sorted_Point.Tpo -c -o libnomadmpi_a-Model_Sorted_Point.o `test -f 'Model_Sorted_Point.cpp' || echo '$(srcdir)/'`Model_Sorted_Point.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Model_Sorted_Point.Tpo $(DEPDIR)/libnomadmpi_a-Model_Sorted_Point.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Model_Sorted_Point.cpp' object='libnomadmpi_a-Model_Sorted_Point.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Model_Sorted_Point.o `test -f 'Model_Sorted_Point.cpp' || echo '$(srcdir)/'`Model_Sorted_Point.cpp + +libnomadmpi_a-Model_Sorted_Point.obj: Model_Sorted_Point.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Model_Sorted_Point.obj -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Model_Sorted_Point.Tpo -c -o libnomadmpi_a-Model_Sorted_Point.obj `if test -f 'Model_Sorted_Point.cpp'; then $(CYGPATH_W) 'Model_Sorted_Point.cpp'; else $(CYGPATH_W) '$(srcdir)/Model_Sorted_Point.cpp'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Model_Sorted_Point.Tpo $(DEPDIR)/libnomadmpi_a-Model_Sorted_Point.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Model_Sorted_Point.cpp' object='libnomadmpi_a-Model_Sorted_Point.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Model_Sorted_Point.obj `if test -f 'Model_Sorted_Point.cpp'; then $(CYGPATH_W) 'Model_Sorted_Point.cpp'; else $(CYGPATH_W) '$(srcdir)/Model_Sorted_Point.cpp'; fi` + +libnomadmpi_a-Model_Stats.o: Model_Stats.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Model_Stats.o -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Model_Stats.Tpo -c -o libnomadmpi_a-Model_Stats.o `test -f 'Model_Stats.cpp' || echo '$(srcdir)/'`Model_Stats.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Model_Stats.Tpo $(DEPDIR)/libnomadmpi_a-Model_Stats.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Model_Stats.cpp' object='libnomadmpi_a-Model_Stats.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Model_Stats.o `test -f 'Model_Stats.cpp' || echo '$(srcdir)/'`Model_Stats.cpp + +libnomadmpi_a-Model_Stats.obj: Model_Stats.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Model_Stats.obj -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Model_Stats.Tpo -c -o libnomadmpi_a-Model_Stats.obj `if test -f 'Model_Stats.cpp'; then $(CYGPATH_W) 'Model_Stats.cpp'; else $(CYGPATH_W) '$(srcdir)/Model_Stats.cpp'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Model_Stats.Tpo $(DEPDIR)/libnomadmpi_a-Model_Stats.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Model_Stats.cpp' object='libnomadmpi_a-Model_Stats.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Model_Stats.obj `if test -f 'Model_Stats.cpp'; then $(CYGPATH_W) 'Model_Stats.cpp'; else $(CYGPATH_W) '$(srcdir)/Model_Stats.cpp'; fi` + +libnomadmpi_a-Multi_Obj_Evaluator.o: Multi_Obj_Evaluator.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Multi_Obj_Evaluator.o -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Multi_Obj_Evaluator.Tpo -c -o libnomadmpi_a-Multi_Obj_Evaluator.o `test -f 'Multi_Obj_Evaluator.cpp' || echo '$(srcdir)/'`Multi_Obj_Evaluator.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Multi_Obj_Evaluator.Tpo $(DEPDIR)/libnomadmpi_a-Multi_Obj_Evaluator.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Multi_Obj_Evaluator.cpp' object='libnomadmpi_a-Multi_Obj_Evaluator.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Multi_Obj_Evaluator.o `test -f 'Multi_Obj_Evaluator.cpp' || echo '$(srcdir)/'`Multi_Obj_Evaluator.cpp + +libnomadmpi_a-Multi_Obj_Evaluator.obj: Multi_Obj_Evaluator.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Multi_Obj_Evaluator.obj -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Multi_Obj_Evaluator.Tpo -c -o libnomadmpi_a-Multi_Obj_Evaluator.obj `if test -f 'Multi_Obj_Evaluator.cpp'; then $(CYGPATH_W) 'Multi_Obj_Evaluator.cpp'; else $(CYGPATH_W) '$(srcdir)/Multi_Obj_Evaluator.cpp'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Multi_Obj_Evaluator.Tpo $(DEPDIR)/libnomadmpi_a-Multi_Obj_Evaluator.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Multi_Obj_Evaluator.cpp' object='libnomadmpi_a-Multi_Obj_Evaluator.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Multi_Obj_Evaluator.obj `if test -f 'Multi_Obj_Evaluator.cpp'; then $(CYGPATH_W) 'Multi_Obj_Evaluator.cpp'; else $(CYGPATH_W) '$(srcdir)/Multi_Obj_Evaluator.cpp'; fi` + +libnomadmpi_a-Parameter_Entries.o: Parameter_Entries.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Parameter_Entries.o -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Parameter_Entries.Tpo -c -o libnomadmpi_a-Parameter_Entries.o `test -f 'Parameter_Entries.cpp' || echo '$(srcdir)/'`Parameter_Entries.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Parameter_Entries.Tpo $(DEPDIR)/libnomadmpi_a-Parameter_Entries.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Parameter_Entries.cpp' object='libnomadmpi_a-Parameter_Entries.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Parameter_Entries.o `test -f 'Parameter_Entries.cpp' || echo '$(srcdir)/'`Parameter_Entries.cpp + +libnomadmpi_a-Parameter_Entries.obj: Parameter_Entries.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Parameter_Entries.obj -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Parameter_Entries.Tpo -c -o libnomadmpi_a-Parameter_Entries.obj `if test -f 'Parameter_Entries.cpp'; then $(CYGPATH_W) 'Parameter_Entries.cpp'; else $(CYGPATH_W) '$(srcdir)/Parameter_Entries.cpp'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Parameter_Entries.Tpo $(DEPDIR)/libnomadmpi_a-Parameter_Entries.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Parameter_Entries.cpp' object='libnomadmpi_a-Parameter_Entries.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Parameter_Entries.obj `if test -f 'Parameter_Entries.cpp'; then $(CYGPATH_W) 'Parameter_Entries.cpp'; else $(CYGPATH_W) '$(srcdir)/Parameter_Entries.cpp'; fi` + +libnomadmpi_a-Parameter_Entry.o: Parameter_Entry.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Parameter_Entry.o -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Parameter_Entry.Tpo -c -o libnomadmpi_a-Parameter_Entry.o `test -f 'Parameter_Entry.cpp' || echo '$(srcdir)/'`Parameter_Entry.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Parameter_Entry.Tpo $(DEPDIR)/libnomadmpi_a-Parameter_Entry.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Parameter_Entry.cpp' object='libnomadmpi_a-Parameter_Entry.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Parameter_Entry.o `test -f 'Parameter_Entry.cpp' || echo '$(srcdir)/'`Parameter_Entry.cpp + +libnomadmpi_a-Parameter_Entry.obj: Parameter_Entry.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Parameter_Entry.obj -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Parameter_Entry.Tpo -c -o libnomadmpi_a-Parameter_Entry.obj `if test -f 'Parameter_Entry.cpp'; then $(CYGPATH_W) 'Parameter_Entry.cpp'; else $(CYGPATH_W) '$(srcdir)/Parameter_Entry.cpp'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Parameter_Entry.Tpo $(DEPDIR)/libnomadmpi_a-Parameter_Entry.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Parameter_Entry.cpp' object='libnomadmpi_a-Parameter_Entry.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Parameter_Entry.obj `if test -f 'Parameter_Entry.cpp'; then $(CYGPATH_W) 'Parameter_Entry.cpp'; else $(CYGPATH_W) '$(srcdir)/Parameter_Entry.cpp'; fi` + +libnomadmpi_a-Parameters.o: Parameters.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Parameters.o -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Parameters.Tpo -c -o libnomadmpi_a-Parameters.o `test -f 'Parameters.cpp' || echo '$(srcdir)/'`Parameters.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Parameters.Tpo $(DEPDIR)/libnomadmpi_a-Parameters.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Parameters.cpp' object='libnomadmpi_a-Parameters.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Parameters.o `test -f 'Parameters.cpp' || echo '$(srcdir)/'`Parameters.cpp + +libnomadmpi_a-Parameters.obj: Parameters.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Parameters.obj -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Parameters.Tpo -c -o libnomadmpi_a-Parameters.obj `if test -f 'Parameters.cpp'; then $(CYGPATH_W) 'Parameters.cpp'; else $(CYGPATH_W) '$(srcdir)/Parameters.cpp'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Parameters.Tpo $(DEPDIR)/libnomadmpi_a-Parameters.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Parameters.cpp' object='libnomadmpi_a-Parameters.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Parameters.obj `if test -f 'Parameters.cpp'; then $(CYGPATH_W) 'Parameters.cpp'; else $(CYGPATH_W) '$(srcdir)/Parameters.cpp'; fi` + +libnomadmpi_a-Pareto_Front.o: Pareto_Front.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Pareto_Front.o -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Pareto_Front.Tpo -c -o libnomadmpi_a-Pareto_Front.o `test -f 'Pareto_Front.cpp' || echo '$(srcdir)/'`Pareto_Front.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Pareto_Front.Tpo $(DEPDIR)/libnomadmpi_a-Pareto_Front.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Pareto_Front.cpp' object='libnomadmpi_a-Pareto_Front.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Pareto_Front.o `test -f 'Pareto_Front.cpp' || echo '$(srcdir)/'`Pareto_Front.cpp + +libnomadmpi_a-Pareto_Front.obj: Pareto_Front.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Pareto_Front.obj -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Pareto_Front.Tpo -c -o libnomadmpi_a-Pareto_Front.obj `if test -f 'Pareto_Front.cpp'; then $(CYGPATH_W) 'Pareto_Front.cpp'; else $(CYGPATH_W) '$(srcdir)/Pareto_Front.cpp'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Pareto_Front.Tpo $(DEPDIR)/libnomadmpi_a-Pareto_Front.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Pareto_Front.cpp' object='libnomadmpi_a-Pareto_Front.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Pareto_Front.obj `if test -f 'Pareto_Front.cpp'; then $(CYGPATH_W) 'Pareto_Front.cpp'; else $(CYGPATH_W) '$(srcdir)/Pareto_Front.cpp'; fi` + +libnomadmpi_a-Pareto_Point.o: Pareto_Point.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Pareto_Point.o -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Pareto_Point.Tpo -c -o libnomadmpi_a-Pareto_Point.o `test -f 'Pareto_Point.cpp' || echo '$(srcdir)/'`Pareto_Point.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Pareto_Point.Tpo $(DEPDIR)/libnomadmpi_a-Pareto_Point.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Pareto_Point.cpp' object='libnomadmpi_a-Pareto_Point.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Pareto_Point.o `test -f 'Pareto_Point.cpp' || echo '$(srcdir)/'`Pareto_Point.cpp + +libnomadmpi_a-Pareto_Point.obj: Pareto_Point.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Pareto_Point.obj -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Pareto_Point.Tpo -c -o libnomadmpi_a-Pareto_Point.obj `if test -f 'Pareto_Point.cpp'; then $(CYGPATH_W) 'Pareto_Point.cpp'; else $(CYGPATH_W) '$(srcdir)/Pareto_Point.cpp'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Pareto_Point.Tpo $(DEPDIR)/libnomadmpi_a-Pareto_Point.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Pareto_Point.cpp' object='libnomadmpi_a-Pareto_Point.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Pareto_Point.obj `if test -f 'Pareto_Point.cpp'; then $(CYGPATH_W) 'Pareto_Point.cpp'; else $(CYGPATH_W) '$(srcdir)/Pareto_Point.cpp'; fi` + +libnomadmpi_a-Phase_One_Evaluator.o: Phase_One_Evaluator.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Phase_One_Evaluator.o -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Phase_One_Evaluator.Tpo -c -o libnomadmpi_a-Phase_One_Evaluator.o `test -f 'Phase_One_Evaluator.cpp' || echo '$(srcdir)/'`Phase_One_Evaluator.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Phase_One_Evaluator.Tpo $(DEPDIR)/libnomadmpi_a-Phase_One_Evaluator.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Phase_One_Evaluator.cpp' object='libnomadmpi_a-Phase_One_Evaluator.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Phase_One_Evaluator.o `test -f 'Phase_One_Evaluator.cpp' || echo '$(srcdir)/'`Phase_One_Evaluator.cpp + +libnomadmpi_a-Phase_One_Evaluator.obj: Phase_One_Evaluator.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Phase_One_Evaluator.obj -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Phase_One_Evaluator.Tpo -c -o libnomadmpi_a-Phase_One_Evaluator.obj `if test -f 'Phase_One_Evaluator.cpp'; then $(CYGPATH_W) 'Phase_One_Evaluator.cpp'; else $(CYGPATH_W) '$(srcdir)/Phase_One_Evaluator.cpp'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Phase_One_Evaluator.Tpo $(DEPDIR)/libnomadmpi_a-Phase_One_Evaluator.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Phase_One_Evaluator.cpp' object='libnomadmpi_a-Phase_One_Evaluator.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Phase_One_Evaluator.obj `if test -f 'Phase_One_Evaluator.cpp'; then $(CYGPATH_W) 'Phase_One_Evaluator.cpp'; else $(CYGPATH_W) '$(srcdir)/Phase_One_Evaluator.cpp'; fi` + +libnomadmpi_a-Phase_One_Search.o: Phase_One_Search.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Phase_One_Search.o -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Phase_One_Search.Tpo -c -o libnomadmpi_a-Phase_One_Search.o `test -f 'Phase_One_Search.cpp' || echo '$(srcdir)/'`Phase_One_Search.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Phase_One_Search.Tpo $(DEPDIR)/libnomadmpi_a-Phase_One_Search.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Phase_One_Search.cpp' object='libnomadmpi_a-Phase_One_Search.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Phase_One_Search.o `test -f 'Phase_One_Search.cpp' || echo '$(srcdir)/'`Phase_One_Search.cpp + +libnomadmpi_a-Phase_One_Search.obj: Phase_One_Search.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Phase_One_Search.obj -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Phase_One_Search.Tpo -c -o libnomadmpi_a-Phase_One_Search.obj `if test -f 'Phase_One_Search.cpp'; then $(CYGPATH_W) 'Phase_One_Search.cpp'; else $(CYGPATH_W) '$(srcdir)/Phase_One_Search.cpp'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Phase_One_Search.Tpo $(DEPDIR)/libnomadmpi_a-Phase_One_Search.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Phase_One_Search.cpp' object='libnomadmpi_a-Phase_One_Search.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Phase_One_Search.obj `if test -f 'Phase_One_Search.cpp'; then $(CYGPATH_W) 'Phase_One_Search.cpp'; else $(CYGPATH_W) '$(srcdir)/Phase_One_Search.cpp'; fi` + +libnomadmpi_a-Point.o: Point.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Point.o -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Point.Tpo -c -o libnomadmpi_a-Point.o `test -f 'Point.cpp' || echo '$(srcdir)/'`Point.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Point.Tpo $(DEPDIR)/libnomadmpi_a-Point.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Point.cpp' object='libnomadmpi_a-Point.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Point.o `test -f 'Point.cpp' || echo '$(srcdir)/'`Point.cpp + +libnomadmpi_a-Point.obj: Point.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Point.obj -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Point.Tpo -c -o libnomadmpi_a-Point.obj `if test -f 'Point.cpp'; then $(CYGPATH_W) 'Point.cpp'; else $(CYGPATH_W) '$(srcdir)/Point.cpp'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Point.Tpo $(DEPDIR)/libnomadmpi_a-Point.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Point.cpp' object='libnomadmpi_a-Point.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Point.obj `if test -f 'Point.cpp'; then $(CYGPATH_W) 'Point.cpp'; else $(CYGPATH_W) '$(srcdir)/Point.cpp'; fi` + +libnomadmpi_a-Priority_Eval_Point.o: Priority_Eval_Point.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Priority_Eval_Point.o -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Priority_Eval_Point.Tpo -c -o libnomadmpi_a-Priority_Eval_Point.o `test -f 'Priority_Eval_Point.cpp' || echo '$(srcdir)/'`Priority_Eval_Point.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Priority_Eval_Point.Tpo $(DEPDIR)/libnomadmpi_a-Priority_Eval_Point.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Priority_Eval_Point.cpp' object='libnomadmpi_a-Priority_Eval_Point.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Priority_Eval_Point.o `test -f 'Priority_Eval_Point.cpp' || echo '$(srcdir)/'`Priority_Eval_Point.cpp + +libnomadmpi_a-Priority_Eval_Point.obj: Priority_Eval_Point.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Priority_Eval_Point.obj -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Priority_Eval_Point.Tpo -c -o libnomadmpi_a-Priority_Eval_Point.obj `if test -f 'Priority_Eval_Point.cpp'; then $(CYGPATH_W) 'Priority_Eval_Point.cpp'; else $(CYGPATH_W) '$(srcdir)/Priority_Eval_Point.cpp'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Priority_Eval_Point.Tpo $(DEPDIR)/libnomadmpi_a-Priority_Eval_Point.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Priority_Eval_Point.cpp' object='libnomadmpi_a-Priority_Eval_Point.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Priority_Eval_Point.obj `if test -f 'Priority_Eval_Point.cpp'; then $(CYGPATH_W) 'Priority_Eval_Point.cpp'; else $(CYGPATH_W) '$(srcdir)/Priority_Eval_Point.cpp'; fi` + +libnomadmpi_a-Quad_Model.o: Quad_Model.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Quad_Model.o -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Quad_Model.Tpo -c -o libnomadmpi_a-Quad_Model.o `test -f 'Quad_Model.cpp' || echo '$(srcdir)/'`Quad_Model.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Quad_Model.Tpo $(DEPDIR)/libnomadmpi_a-Quad_Model.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Quad_Model.cpp' object='libnomadmpi_a-Quad_Model.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Quad_Model.o `test -f 'Quad_Model.cpp' || echo '$(srcdir)/'`Quad_Model.cpp + +libnomadmpi_a-Quad_Model.obj: Quad_Model.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Quad_Model.obj -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Quad_Model.Tpo -c -o libnomadmpi_a-Quad_Model.obj `if test -f 'Quad_Model.cpp'; then $(CYGPATH_W) 'Quad_Model.cpp'; else $(CYGPATH_W) '$(srcdir)/Quad_Model.cpp'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Quad_Model.Tpo $(DEPDIR)/libnomadmpi_a-Quad_Model.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Quad_Model.cpp' object='libnomadmpi_a-Quad_Model.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Quad_Model.obj `if test -f 'Quad_Model.cpp'; then $(CYGPATH_W) 'Quad_Model.cpp'; else $(CYGPATH_W) '$(srcdir)/Quad_Model.cpp'; fi` + +libnomadmpi_a-Quad_Model_Evaluator.o: Quad_Model_Evaluator.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Quad_Model_Evaluator.o -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Quad_Model_Evaluator.Tpo -c -o libnomadmpi_a-Quad_Model_Evaluator.o `test -f 'Quad_Model_Evaluator.cpp' || echo '$(srcdir)/'`Quad_Model_Evaluator.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Quad_Model_Evaluator.Tpo $(DEPDIR)/libnomadmpi_a-Quad_Model_Evaluator.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Quad_Model_Evaluator.cpp' object='libnomadmpi_a-Quad_Model_Evaluator.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Quad_Model_Evaluator.o `test -f 'Quad_Model_Evaluator.cpp' || echo '$(srcdir)/'`Quad_Model_Evaluator.cpp + +libnomadmpi_a-Quad_Model_Evaluator.obj: Quad_Model_Evaluator.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Quad_Model_Evaluator.obj -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Quad_Model_Evaluator.Tpo -c -o libnomadmpi_a-Quad_Model_Evaluator.obj `if test -f 'Quad_Model_Evaluator.cpp'; then $(CYGPATH_W) 'Quad_Model_Evaluator.cpp'; else $(CYGPATH_W) '$(srcdir)/Quad_Model_Evaluator.cpp'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Quad_Model_Evaluator.Tpo $(DEPDIR)/libnomadmpi_a-Quad_Model_Evaluator.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Quad_Model_Evaluator.cpp' object='libnomadmpi_a-Quad_Model_Evaluator.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Quad_Model_Evaluator.obj `if test -f 'Quad_Model_Evaluator.cpp'; then $(CYGPATH_W) 'Quad_Model_Evaluator.cpp'; else $(CYGPATH_W) '$(srcdir)/Quad_Model_Evaluator.cpp'; fi` + +libnomadmpi_a-Quad_Model_Search.o: Quad_Model_Search.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Quad_Model_Search.o -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Quad_Model_Search.Tpo -c -o libnomadmpi_a-Quad_Model_Search.o `test -f 'Quad_Model_Search.cpp' || echo '$(srcdir)/'`Quad_Model_Search.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Quad_Model_Search.Tpo $(DEPDIR)/libnomadmpi_a-Quad_Model_Search.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Quad_Model_Search.cpp' object='libnomadmpi_a-Quad_Model_Search.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Quad_Model_Search.o `test -f 'Quad_Model_Search.cpp' || echo '$(srcdir)/'`Quad_Model_Search.cpp + +libnomadmpi_a-Quad_Model_Search.obj: Quad_Model_Search.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Quad_Model_Search.obj -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Quad_Model_Search.Tpo -c -o libnomadmpi_a-Quad_Model_Search.obj `if test -f 'Quad_Model_Search.cpp'; then $(CYGPATH_W) 'Quad_Model_Search.cpp'; else $(CYGPATH_W) '$(srcdir)/Quad_Model_Search.cpp'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Quad_Model_Search.Tpo $(DEPDIR)/libnomadmpi_a-Quad_Model_Search.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Quad_Model_Search.cpp' object='libnomadmpi_a-Quad_Model_Search.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Quad_Model_Search.obj `if test -f 'Quad_Model_Search.cpp'; then $(CYGPATH_W) 'Quad_Model_Search.cpp'; else $(CYGPATH_W) '$(srcdir)/Quad_Model_Search.cpp'; fi` + +libnomadmpi_a-Random_Pickup.o: Random_Pickup.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Random_Pickup.o -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Random_Pickup.Tpo -c -o libnomadmpi_a-Random_Pickup.o `test -f 'Random_Pickup.cpp' || echo '$(srcdir)/'`Random_Pickup.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Random_Pickup.Tpo $(DEPDIR)/libnomadmpi_a-Random_Pickup.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Random_Pickup.cpp' object='libnomadmpi_a-Random_Pickup.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Random_Pickup.o `test -f 'Random_Pickup.cpp' || echo '$(srcdir)/'`Random_Pickup.cpp + +libnomadmpi_a-Random_Pickup.obj: Random_Pickup.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Random_Pickup.obj -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Random_Pickup.Tpo -c -o libnomadmpi_a-Random_Pickup.obj `if test -f 'Random_Pickup.cpp'; then $(CYGPATH_W) 'Random_Pickup.cpp'; else $(CYGPATH_W) '$(srcdir)/Random_Pickup.cpp'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Random_Pickup.Tpo $(DEPDIR)/libnomadmpi_a-Random_Pickup.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Random_Pickup.cpp' object='libnomadmpi_a-Random_Pickup.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Random_Pickup.obj `if test -f 'Random_Pickup.cpp'; then $(CYGPATH_W) 'Random_Pickup.cpp'; else $(CYGPATH_W) '$(srcdir)/Random_Pickup.cpp'; fi` + +libnomadmpi_a-RNG.o: RNG.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-RNG.o -MD -MP -MF $(DEPDIR)/libnomadmpi_a-RNG.Tpo -c -o libnomadmpi_a-RNG.o `test -f 'RNG.cpp' || echo '$(srcdir)/'`RNG.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-RNG.Tpo $(DEPDIR)/libnomadmpi_a-RNG.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='RNG.cpp' object='libnomadmpi_a-RNG.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-RNG.o `test -f 'RNG.cpp' || echo '$(srcdir)/'`RNG.cpp + +libnomadmpi_a-RNG.obj: RNG.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-RNG.obj -MD -MP -MF $(DEPDIR)/libnomadmpi_a-RNG.Tpo -c -o libnomadmpi_a-RNG.obj `if test -f 'RNG.cpp'; then $(CYGPATH_W) 'RNG.cpp'; else $(CYGPATH_W) '$(srcdir)/RNG.cpp'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-RNG.Tpo $(DEPDIR)/libnomadmpi_a-RNG.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='RNG.cpp' object='libnomadmpi_a-RNG.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-RNG.obj `if test -f 'RNG.cpp'; then $(CYGPATH_W) 'RNG.cpp'; else $(CYGPATH_W) '$(srcdir)/RNG.cpp'; fi` + +libnomadmpi_a-Signature.o: Signature.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Signature.o -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Signature.Tpo -c -o libnomadmpi_a-Signature.o `test -f 'Signature.cpp' || echo '$(srcdir)/'`Signature.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Signature.Tpo $(DEPDIR)/libnomadmpi_a-Signature.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Signature.cpp' object='libnomadmpi_a-Signature.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Signature.o `test -f 'Signature.cpp' || echo '$(srcdir)/'`Signature.cpp + +libnomadmpi_a-Signature.obj: Signature.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Signature.obj -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Signature.Tpo -c -o libnomadmpi_a-Signature.obj `if test -f 'Signature.cpp'; then $(CYGPATH_W) 'Signature.cpp'; else $(CYGPATH_W) '$(srcdir)/Signature.cpp'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Signature.Tpo $(DEPDIR)/libnomadmpi_a-Signature.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Signature.cpp' object='libnomadmpi_a-Signature.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Signature.obj `if test -f 'Signature.cpp'; then $(CYGPATH_W) 'Signature.cpp'; else $(CYGPATH_W) '$(srcdir)/Signature.cpp'; fi` + +libnomadmpi_a-Slave.o: Slave.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Slave.o -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Slave.Tpo -c -o libnomadmpi_a-Slave.o `test -f 'Slave.cpp' || echo '$(srcdir)/'`Slave.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Slave.Tpo $(DEPDIR)/libnomadmpi_a-Slave.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Slave.cpp' object='libnomadmpi_a-Slave.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Slave.o `test -f 'Slave.cpp' || echo '$(srcdir)/'`Slave.cpp + +libnomadmpi_a-Slave.obj: Slave.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Slave.obj -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Slave.Tpo -c -o libnomadmpi_a-Slave.obj `if test -f 'Slave.cpp'; then $(CYGPATH_W) 'Slave.cpp'; else $(CYGPATH_W) '$(srcdir)/Slave.cpp'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Slave.Tpo $(DEPDIR)/libnomadmpi_a-Slave.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Slave.cpp' object='libnomadmpi_a-Slave.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Slave.obj `if test -f 'Slave.cpp'; then $(CYGPATH_W) 'Slave.cpp'; else $(CYGPATH_W) '$(srcdir)/Slave.cpp'; fi` + +libnomadmpi_a-Speculative_Search.o: Speculative_Search.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Speculative_Search.o -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Speculative_Search.Tpo -c -o libnomadmpi_a-Speculative_Search.o `test -f 'Speculative_Search.cpp' || echo '$(srcdir)/'`Speculative_Search.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Speculative_Search.Tpo $(DEPDIR)/libnomadmpi_a-Speculative_Search.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Speculative_Search.cpp' object='libnomadmpi_a-Speculative_Search.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Speculative_Search.o `test -f 'Speculative_Search.cpp' || echo '$(srcdir)/'`Speculative_Search.cpp + +libnomadmpi_a-Speculative_Search.obj: Speculative_Search.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Speculative_Search.obj -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Speculative_Search.Tpo -c -o libnomadmpi_a-Speculative_Search.obj `if test -f 'Speculative_Search.cpp'; then $(CYGPATH_W) 'Speculative_Search.cpp'; else $(CYGPATH_W) '$(srcdir)/Speculative_Search.cpp'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Speculative_Search.Tpo $(DEPDIR)/libnomadmpi_a-Speculative_Search.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Speculative_Search.cpp' object='libnomadmpi_a-Speculative_Search.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Speculative_Search.obj `if test -f 'Speculative_Search.cpp'; then $(CYGPATH_W) 'Speculative_Search.cpp'; else $(CYGPATH_W) '$(srcdir)/Speculative_Search.cpp'; fi` + +libnomadmpi_a-Stats.o: Stats.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Stats.o -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Stats.Tpo -c -o libnomadmpi_a-Stats.o `test -f 'Stats.cpp' || echo '$(srcdir)/'`Stats.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Stats.Tpo $(DEPDIR)/libnomadmpi_a-Stats.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Stats.cpp' object='libnomadmpi_a-Stats.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Stats.o `test -f 'Stats.cpp' || echo '$(srcdir)/'`Stats.cpp + +libnomadmpi_a-Stats.obj: Stats.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Stats.obj -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Stats.Tpo -c -o libnomadmpi_a-Stats.obj `if test -f 'Stats.cpp'; then $(CYGPATH_W) 'Stats.cpp'; else $(CYGPATH_W) '$(srcdir)/Stats.cpp'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Stats.Tpo $(DEPDIR)/libnomadmpi_a-Stats.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Stats.cpp' object='libnomadmpi_a-Stats.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Stats.obj `if test -f 'Stats.cpp'; then $(CYGPATH_W) 'Stats.cpp'; else $(CYGPATH_W) '$(srcdir)/Stats.cpp'; fi` + +libnomadmpi_a-utils.o: utils.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-utils.o -MD -MP -MF $(DEPDIR)/libnomadmpi_a-utils.Tpo -c -o libnomadmpi_a-utils.o `test -f 'utils.cpp' || echo '$(srcdir)/'`utils.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-utils.Tpo $(DEPDIR)/libnomadmpi_a-utils.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='utils.cpp' object='libnomadmpi_a-utils.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-utils.o `test -f 'utils.cpp' || echo '$(srcdir)/'`utils.cpp + +libnomadmpi_a-utils.obj: utils.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-utils.obj -MD -MP -MF $(DEPDIR)/libnomadmpi_a-utils.Tpo -c -o libnomadmpi_a-utils.obj `if test -f 'utils.cpp'; then $(CYGPATH_W) 'utils.cpp'; else $(CYGPATH_W) '$(srcdir)/utils.cpp'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-utils.Tpo $(DEPDIR)/libnomadmpi_a-utils.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='utils.cpp' object='libnomadmpi_a-utils.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-utils.obj `if test -f 'utils.cpp'; then $(CYGPATH_W) 'utils.cpp'; else $(CYGPATH_W) '$(srcdir)/utils.cpp'; fi` + +libnomadmpi_a-Variable_Group.o: Variable_Group.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Variable_Group.o -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Variable_Group.Tpo -c -o libnomadmpi_a-Variable_Group.o `test -f 'Variable_Group.cpp' || echo '$(srcdir)/'`Variable_Group.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Variable_Group.Tpo $(DEPDIR)/libnomadmpi_a-Variable_Group.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Variable_Group.cpp' object='libnomadmpi_a-Variable_Group.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Variable_Group.o `test -f 'Variable_Group.cpp' || echo '$(srcdir)/'`Variable_Group.cpp + +libnomadmpi_a-Variable_Group.obj: Variable_Group.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-Variable_Group.obj -MD -MP -MF $(DEPDIR)/libnomadmpi_a-Variable_Group.Tpo -c -o libnomadmpi_a-Variable_Group.obj `if test -f 'Variable_Group.cpp'; then $(CYGPATH_W) 'Variable_Group.cpp'; else $(CYGPATH_W) '$(srcdir)/Variable_Group.cpp'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-Variable_Group.Tpo $(DEPDIR)/libnomadmpi_a-Variable_Group.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Variable_Group.cpp' object='libnomadmpi_a-Variable_Group.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-Variable_Group.obj `if test -f 'Variable_Group.cpp'; then $(CYGPATH_W) 'Variable_Group.cpp'; else $(CYGPATH_W) '$(srcdir)/Variable_Group.cpp'; fi` + +libnomadmpi_a-VNS_Search.o: VNS_Search.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-VNS_Search.o -MD -MP -MF $(DEPDIR)/libnomadmpi_a-VNS_Search.Tpo -c -o libnomadmpi_a-VNS_Search.o `test -f 'VNS_Search.cpp' || echo '$(srcdir)/'`VNS_Search.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-VNS_Search.Tpo $(DEPDIR)/libnomadmpi_a-VNS_Search.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='VNS_Search.cpp' object='libnomadmpi_a-VNS_Search.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-VNS_Search.o `test -f 'VNS_Search.cpp' || echo '$(srcdir)/'`VNS_Search.cpp + +libnomadmpi_a-VNS_Search.obj: VNS_Search.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-VNS_Search.obj -MD -MP -MF $(DEPDIR)/libnomadmpi_a-VNS_Search.Tpo -c -o libnomadmpi_a-VNS_Search.obj `if test -f 'VNS_Search.cpp'; then $(CYGPATH_W) 'VNS_Search.cpp'; else $(CYGPATH_W) '$(srcdir)/VNS_Search.cpp'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-VNS_Search.Tpo $(DEPDIR)/libnomadmpi_a-VNS_Search.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='VNS_Search.cpp' object='libnomadmpi_a-VNS_Search.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-VNS_Search.obj `if test -f 'VNS_Search.cpp'; then $(CYGPATH_W) 'VNS_Search.cpp'; else $(CYGPATH_W) '$(srcdir)/VNS_Search.cpp'; fi` + +libnomadmpi_a-OrthogonalMesh.o: OrthogonalMesh.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-OrthogonalMesh.o -MD -MP -MF $(DEPDIR)/libnomadmpi_a-OrthogonalMesh.Tpo -c -o libnomadmpi_a-OrthogonalMesh.o `test -f 'OrthogonalMesh.cpp' || echo '$(srcdir)/'`OrthogonalMesh.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-OrthogonalMesh.Tpo $(DEPDIR)/libnomadmpi_a-OrthogonalMesh.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='OrthogonalMesh.cpp' object='libnomadmpi_a-OrthogonalMesh.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-OrthogonalMesh.o `test -f 'OrthogonalMesh.cpp' || echo '$(srcdir)/'`OrthogonalMesh.cpp + +libnomadmpi_a-OrthogonalMesh.obj: OrthogonalMesh.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -MT libnomadmpi_a-OrthogonalMesh.obj -MD -MP -MF $(DEPDIR)/libnomadmpi_a-OrthogonalMesh.Tpo -c -o libnomadmpi_a-OrthogonalMesh.obj `if test -f 'OrthogonalMesh.cpp'; then $(CYGPATH_W) 'OrthogonalMesh.cpp'; else $(CYGPATH_W) '$(srcdir)/OrthogonalMesh.cpp'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnomadmpi_a-OrthogonalMesh.Tpo $(DEPDIR)/libnomadmpi_a-OrthogonalMesh.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='OrthogonalMesh.cpp' object='libnomadmpi_a-OrthogonalMesh.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnomadmpi_a_CXXFLAGS) $(CXXFLAGS) -c -o libnomadmpi_a-OrthogonalMesh.obj `if test -f 'OrthogonalMesh.cpp'; then $(CYGPATH_W) 'OrthogonalMesh.cpp'; else $(CYGPATH_W) '$(srcdir)/OrthogonalMesh.cpp'; fi` + +nomad_mpi-nomad.o: nomad.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nomad_mpi_CXXFLAGS) $(CXXFLAGS) -MT nomad_mpi-nomad.o -MD -MP -MF $(DEPDIR)/nomad_mpi-nomad.Tpo -c -o nomad_mpi-nomad.o `test -f 'nomad.cpp' || echo '$(srcdir)/'`nomad.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nomad_mpi-nomad.Tpo $(DEPDIR)/nomad_mpi-nomad.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='nomad.cpp' object='nomad_mpi-nomad.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nomad_mpi_CXXFLAGS) $(CXXFLAGS) -c -o nomad_mpi-nomad.o `test -f 'nomad.cpp' || echo '$(srcdir)/'`nomad.cpp + +nomad_mpi-nomad.obj: nomad.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nomad_mpi_CXXFLAGS) $(CXXFLAGS) -MT nomad_mpi-nomad.obj -MD -MP -MF $(DEPDIR)/nomad_mpi-nomad.Tpo -c -o nomad_mpi-nomad.obj `if test -f 'nomad.cpp'; then $(CYGPATH_W) 'nomad.cpp'; else $(CYGPATH_W) '$(srcdir)/nomad.cpp'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nomad_mpi-nomad.Tpo $(DEPDIR)/nomad_mpi-nomad.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='nomad.cpp' object='nomad_mpi-nomad.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nomad_mpi_CXXFLAGS) $(CXXFLAGS) -c -o nomad_mpi-nomad.obj `if test -f 'nomad.cpp'; then $(CYGPATH_W) 'nomad.cpp'; else $(CYGPATH_W) '$(srcdir)/nomad.cpp'; fi` +install-nodist_pkgconfigDATA: $(nodist_pkgconfig_DATA) + @$(NORMAL_INSTALL) + @list='$(nodist_pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfigdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \ + done + +uninstall-nodist_pkgconfigDATA: + @$(NORMAL_UNINSTALL) + @list='$(nodist_pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir) +install-pkgincludeHEADERS: $(pkginclude_HEADERS) + @$(NORMAL_INSTALL) + @list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(pkgincludedir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(pkgincludedir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(pkgincludedir)" || exit $$?; \ + done + +uninstall-pkgincludeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(pkgincludedir)'; $(am__uninstall_files_from_dir) + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LIBRARIES) $(PROGRAMS) $(DATA) $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(pkgincludedir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-binPROGRAMS clean-generic clean-libLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-nodist_pkgconfigDATA \ + install-pkgincludeHEADERS + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-binPROGRAMS install-libLIBRARIES + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS uninstall-libLIBRARIES \ + uninstall-nodist_pkgconfigDATA uninstall-pkgincludeHEADERS + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \ + clean-binPROGRAMS clean-generic clean-libLIBRARIES \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-binPROGRAMS \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-libLIBRARIES install-man \ + install-nodist_pkgconfigDATA install-pdf install-pdf-am \ + install-pkgincludeHEADERS install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am uninstall-binPROGRAMS \ + uninstall-libLIBRARIES uninstall-nodist_pkgconfigDATA \ + uninstall-pkgincludeHEADERS + +.PRECIOUS: Makefile + +nomad.pc: ../nomad.pc.in +@MPI_ENABLED_TRUE@nomadmpi.pc: ../nomadmpi.pc.in + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/src/Model_Sorted_Point.cpp b/src/Model_Sorted_Point.cpp index a37d68f9bba5fc25462c139a2db09ea4f93349e3..f8214d59eed423afcac86281630172b79704d29b 100644 --- a/src/Model_Sorted_Point.cpp +++ b/src/Model_Sorted_Point.cpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Model_Sorted_Point.cpp \brief Interpolation point with distance to model center (implementation) diff --git a/src/Model_Sorted_Point.hpp b/src/Model_Sorted_Point.hpp index 1cd2e08bc1fc298a1ff81d3c68351dbbdbab6f4b..8344e3fca6ec1a16ac3df528108d97cb572b8f0c 100644 --- a/src/Model_Sorted_Point.hpp +++ b/src/Model_Sorted_Point.hpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Model_Sorted_Point.hpp \brief Interpolation point with distance to model center (headers) diff --git a/src/Model_Stats.cpp b/src/Model_Stats.cpp index c71aaddb0de0e4a6f6bf398250a3a70b6eadc5c3..01ec29eb5987ca62d9510a98eb4a6ed38aaeb856 100644 --- a/src/Model_Stats.cpp +++ b/src/Model_Stats.cpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Model_Stats.cpp \brief Model stats (implementation) @@ -271,7 +273,7 @@ void NOMAD::Model_Stats::display ( const NOMAD::Display & out ) const << "number of points inside radius: " << _ES_nb_inside_radius << " ("; NOMAD::Double(_ES_nb_inside_radius*100.0/_ES_nb_pts).display ( out , "%.0f" ); - out << "%)" << std::endl + out << "%)" << std::endl << NOMAD::close_block(); } } diff --git a/src/Model_Stats.hpp b/src/Model_Stats.hpp index 97999693a998f47efd46d263449b3171b970d45c..234912bc47d3407be2549bd3f38af7e5f8804843 100644 --- a/src/Model_Stats.hpp +++ b/src/Model_Stats.hpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Model_Stats.hpp \brief Model stats (headers) @@ -208,7 +210,7 @@ namespace NOMAD { /// Add \c 1 to stat \c _nb_regression. void add_nb_regression ( void ) { ++_nb_regression; } - + /// Add \c 1 to stat \c _not_enough_pts. void add_not_enough_pts ( void ) { ++_not_enough_pts; } diff --git a/src/Multi_Obj_Evaluator.cpp b/src/Multi_Obj_Evaluator.cpp index 9fdcf133a682c61f493eb66e584357924612015f..3967d9e4c770a516493d1961df67e2679ca9ae79 100644 --- a/src/Multi_Obj_Evaluator.cpp +++ b/src/Multi_Obj_Evaluator.cpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Multi_Obj_Evaluator.cpp \brief NOMAD::Evaluator subclass for multiobjective optimization (implementation) diff --git a/src/Multi_Obj_Evaluator.hpp b/src/Multi_Obj_Evaluator.hpp index 155be5e7f28a199f93c88a6ac4d049d21f97dd9b..bd967dcd229898570c97b065eceeab95bf1c792f 100644 --- a/src/Multi_Obj_Evaluator.hpp +++ b/src/Multi_Obj_Evaluator.hpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Multi_Obj_Evaluator.hpp \brief NOMAD::Evaluator subclass for multiobjective optimization (headers) diff --git a/src/Multi_Obj_Quad_Model_Evaluator.hpp b/src/Multi_Obj_Quad_Model_Evaluator.hpp index c59b5f4e36e05246295adf9c00d66d99b7d9f521..fc5931290eae0007adb301c144e1d9ff5ae075ce 100644 --- a/src/Multi_Obj_Quad_Model_Evaluator.hpp +++ b/src/Multi_Obj_Quad_Model_Evaluator.hpp @@ -1,43 +1,51 @@ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* Copyright (C) 2001-2015 Mark Abramson - Brigham Young University, Provo */ -/* Charles Audet - Ecole Polytechnique, Montreal */ -/* Gilles Couture - Ecole Polytechnique, Montreal */ -/* John Dennis - Rice University, Houston */ -/* Sebastien Le Digabel - Ecole Polytechnique, Montreal */ -/* Christophe Tribes - Ecole Polytechnique, Montreal */ -/* */ -/* funded in part by AFOSR and Exxon Mobil */ -/* */ -/* Author: Sebastien Le Digabel */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ /** \file Multi_Obj_Quad_Model_Evaluator.hpp - \brief NOMAD::Mulit_Obj_Evaluator subclass for quadratic model optimization (headers) - \author Christophe Tribes + \brief NOMAD::Multi_Obj_Evaluator subclass for quadratic model optimization (headers) + \author Christophe Tribes \date 2014-06-19 \see Multi_Obj_Quad_Model_Evaluator.cpp */ @@ -48,36 +56,36 @@ #include "Multi_Obj_Evaluator.hpp" namespace NOMAD { - - /// Bi-objective NOMAD::Evaluator subclass for quadratic model. - class Multi_Obj_Quad_Model_Evaluator : public NOMAD::Quad_Model_Evaluator, public NOMAD::Multi_Obj_Evaluator { - public: - - /// Constructor. - /** - \param p Parameters -- \b IN. - \param model Model -- \b IN. - */ - Multi_Obj_Quad_Model_Evaluator ( const NOMAD::Parameters & p , - const NOMAD::Quad_Model & model ) : NOMAD::Quad_Model_Evaluator(p,model),NOMAD::Multi_Obj_Evaluator(p) {_is_model_evaluator=true;} - - /// Destructor. - virtual ~Multi_Obj_Quad_Model_Evaluator ( void ){;} - - - /// Evaluate the blackboxes quad model at a given trial point - /** - \param x point to evaluate -- \b IN/OUT. - \param h_max h_max for barrier -- \b IN. - \param count_eval Count eval if true -- \b IN. - \return A boolean equal to \c false if the evaluation failed. - */ - virtual bool eval_x ( NOMAD::Eval_Point & x , - const NOMAD::Double & h_max , - bool & count_eval ) const {return Quad_Model_Evaluator::eval_x(x,h_max,count_eval);} - - - }; + + /// Bi-objective NOMAD::Evaluator subclass for quadratic model. + class Multi_Obj_Quad_Model_Evaluator : public NOMAD::Quad_Model_Evaluator, public NOMAD::Multi_Obj_Evaluator { + public: + + /// Constructor. + /** + \param p Parameters -- \b IN. + \param model Model -- \b IN. + */ + Multi_Obj_Quad_Model_Evaluator ( const NOMAD::Parameters & p , + const NOMAD::Quad_Model & model ) : NOMAD::Quad_Model_Evaluator(p,model),NOMAD::Multi_Obj_Evaluator(p) {_is_model_evaluator=true;} + + /// Destructor. + virtual ~Multi_Obj_Quad_Model_Evaluator ( void ){;} + + + /// Evaluate the blackboxes quad model at a given trial point + /** + \param x point to evaluate -- \b IN/OUT. + \param h_max h_max for barrier -- \b IN. + \param count_eval Count eval if true -- \b IN. + \return A boolean equal to \c false if the evaluation failed. + */ + virtual bool eval_x ( NOMAD::Eval_Point & x , + const NOMAD::Double & h_max , + bool & count_eval ) const {return Quad_Model_Evaluator::eval_x(x,h_max,count_eval);} + + + }; } #endif diff --git a/src/OrthogonalMesh.cpp b/src/OrthogonalMesh.cpp index d0a0e60a4dbcc79b32b7299fd84515f209cebfd2..96d9d011da512394a8348eec677ef3b629472e16 100644 --- a/src/OrthogonalMesh.cpp +++ b/src/OrthogonalMesh.cpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file OrthogonalMesh.hpp \brief implementation @@ -51,23 +53,23 @@ #include "OrthogonalMesh.hpp" /// Constructor (called only by derived objects). -NOMAD::OrthogonalMesh::OrthogonalMesh (bool anisotropic_mesh , - const NOMAD::Point & Delta_0 , - const NOMAD::Point & Delta_min , - const NOMAD::Point & delta_min , - const NOMAD::Point & fixed_variables , - const NOMAD::Point & granularity , - NOMAD::Double update_basis , - int coarsening_step , - int refining_step , - int limit_mesh_index ) : +NOMAD::OrthogonalMesh::OrthogonalMesh (bool anisotropic_mesh , + const NOMAD::Point & Delta_0 , + const NOMAD::Point & Delta_min , + const NOMAD::Point & delta_min , + const NOMAD::Point & fixed_variables , + const NOMAD::Point & granularity , + NOMAD::Double update_basis, + int coarsening_step, + int refining_step, + int limit_mesh_index ) : +_anisotropic_mesh ( anisotropic_mesh ), _delta_0 ( Delta_0 ), _Delta_0 ( Delta_0 ), _Delta_min ( Delta_min ), _delta_min ( delta_min ), _fixed_variables ( fixed_variables ), _granularity ( granularity ), -_anisotropic_mesh ( anisotropic_mesh ), _update_basis ( update_basis ), _coarsening_step ( coarsening_step ), _refining_step ( refining_step ), @@ -107,9 +109,9 @@ _limit_mesh_index ( limit_mesh_index ) for ( int k = 0 ; k < _n ; ++k ) { // we check that Delta_min <= Delta_0 and that delta_min <= delta_0: - if ( _delta_min_is_defined && - _delta_min[k].is_defined() && - _delta_0[k] < _delta_min[k] ) + if ( _delta_min_is_defined && + _delta_min[k].is_defined() && + _delta_0[k] < _delta_min[k] ) { error = "NOMAD::OrthogonalMesh::OrthogonalMesh(): delta_0 < delta_min"; break; @@ -139,7 +141,7 @@ bool NOMAD::OrthogonalMesh::is_finer_than_initial (void) const get_delta(delta); for (int i =0; i < _n ; ++i ) - if ( delta[i] >= _delta_0[i] ) + if ( !_fixed_variables[i].is_defined() && delta[i] >= _delta_0[i] ) return false; return true; @@ -179,17 +181,11 @@ void NOMAD::OrthogonalMesh::set_min_mesh_sizes ( const NOMAD::Point & delta_min { // we check that Delta_min <= Delta_0 and that delta_min <= delta_0: - if ( delta_min[k].is_defined() && - _delta_0[k] < delta_min[k] ) - { + if ( delta_min[k].is_defined() && _delta_0[k] < delta_min[k] ) _delta_min[k]=_delta_0[k]; - } - if ( delta_min[k].is_defined() && - _Delta_0[k] < delta_min[k] ) - { - _delta_min[k]=_Delta_0[k]; - } + if ( delta_min[k].is_defined() && _Delta_0[k] < delta_min[k] ) + _delta_min[k]=_Delta_0[k]; } if ( !error.empty() ) diff --git a/src/OrthogonalMesh.hpp b/src/OrthogonalMesh.hpp index 92887d90b59310f1590abdc1a8368b32828a1d93..50ce94a02db4209b6375aca7f8f577c405cd1369 100644 --- a/src/OrthogonalMesh.hpp +++ b/src/OrthogonalMesh.hpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file OrthogonalMesh.hpp \brief Virtual class for the MADS orthogonal meshes (headers) @@ -83,6 +85,7 @@ namespace NOMAD { /*--------------------------------------------------------------*/ protected: + bool _anisotropic_mesh; NOMAD::Point _delta_0; NOMAD::Point _Delta_0; @@ -91,7 +94,6 @@ namespace NOMAD { NOMAD::Point _fixed_variables; NOMAD::Point _granularity; - bool _anisotropic_mesh; bool _all_granular; bool _Delta_min_is_defined; @@ -100,38 +102,38 @@ namespace NOMAD { bool _delta_min_is_complete; - NOMAD::Double _update_basis; - int _coarsening_step; - int _refining_step ; + NOMAD::Double _update_basis; + int _coarsening_step; + int _refining_step ; - int _n; + int _n; int _n_free_variables; int _limit_mesh_index; // Limit max or min of the mesh index for fine mesh (SMesh->max, XMesh->min) /// Constructor (called only by derived objects). /** - \param anisotropic_mesh Anisotropy of the mesh (true or false) -- \b IN. - \param Delta_0 Initial poll size Delta_0 -- \b IN. - \param Delta_min Minimal poll size Delta_min (may be undefined) -- \b IN. - \param delta_min Minimal mesh size delta_min (may be undefined) -- \b IN. - \param fixed_variables Fixed variables -- \b IN. - \param granularity Granularity of variables -- \b IN. - \param update_basis Mesh/poll update basis (tau) -- \b IN. - \param coarsening_step Mesh/poll coarsening exponent (w+) -- \b IN. - \param refining_step Mesh/poll refining exponent (w-) -- \b IN. - \param limit_mesh_index Limit mesh index to trigger stopping criterion -- \b IN. - */ - OrthogonalMesh (bool anisotropic_mesh , - const NOMAD::Point & Delta_0 , - const NOMAD::Point & Delta_min , - const NOMAD::Point & delta_min , - const NOMAD::Point & fixed_variables , - const NOMAD::Point & granularity , - NOMAD::Double update_basis, - int coarsening_step, - int refining_step, - int limit_mesh_index ) ; + \param anisotropic_mesh Anisotropy of the mesh (true or false) -- \b IN. + \param Delta_0 Initial poll size Delta_0 -- \b IN. + \param Delta_min Minimal poll size Delta_min (may be undefined) -- \b IN. + \param delta_min Minimal mesh size delta_min (may be undefined) -- \b IN. + \param fixed_variables Fixed variables -- \b IN. + \param granularity Granularity of variables -- \b IN. + \param update_basis Mesh/poll update basis (tau) -- \b IN. + \param coarsening_step Mesh/poll coarsening exponent (w+) -- \b IN. + \param refining_step Mesh/poll refining exponent (w-) -- \b IN. + \param limit_mesh_index Limit mesh index to trigger stopping criterion -- \b IN. + */ + OrthogonalMesh (bool anisotropic_mesh , + const NOMAD::Point & Delta_0 , + const NOMAD::Point & Delta_min , + const NOMAD::Point & delta_min , + const NOMAD::Point & fixed_variables , + const NOMAD::Point & granularity , + NOMAD::Double update_basis, + int coarsening_step, + int refining_step, + int limit_mesh_index ) ; /// Copy constructor (called only by derived objects). @@ -140,23 +142,23 @@ namespace NOMAD { */ OrthogonalMesh ( const OrthogonalMesh & m ) : - _delta_0 ( m._delta_0 ), - _Delta_0 ( m._Delta_0 ), - _Delta_min ( m._Delta_min ), - _delta_min ( m._delta_min ), - _fixed_variables ( m._fixed_variables ), - _granularity ( m._granularity ), - _anisotropic_mesh ( m._anisotropic_mesh ), - _Delta_min_is_defined ( m._Delta_min_is_defined ), - _Delta_min_is_complete ( m._Delta_min_is_complete ), - _delta_min_is_defined ( m._delta_min_is_defined ), - _delta_min_is_complete ( m._delta_min_is_complete ), - _update_basis ( m._update_basis ), - _coarsening_step ( m._coarsening_step ), - _refining_step ( m._refining_step ), - _n ( m._n ), - _n_free_variables ( m._n_free_variables ), - _limit_mesh_index ( m._limit_mesh_index ){} + _anisotropic_mesh ( m._anisotropic_mesh ), + _delta_0 ( m._delta_0 ), + _Delta_0 ( m._Delta_0 ), + _Delta_min ( m._Delta_min ), + _delta_min ( m._delta_min ), + _fixed_variables ( m._fixed_variables ), + _granularity ( m._granularity ), + _Delta_min_is_defined ( m._Delta_min_is_defined ), + _Delta_min_is_complete ( m._Delta_min_is_complete ), + _delta_min_is_defined ( m._delta_min_is_defined ), + _delta_min_is_complete ( m._delta_min_is_complete ), + _update_basis ( m._update_basis ), + _coarsening_step ( m._coarsening_step ), + _refining_step ( m._refining_step ), + _n ( m._n ), + _n_free_variables ( m._n_free_variables ), + _limit_mesh_index ( m._limit_mesh_index){} /*--------------------------------------------------------------*/ @@ -169,17 +171,17 @@ namespace NOMAD { /// Update the Mesh (poll and mesh sizes). /** - \param success Type of success of the iteration -- \b IN. - \param dir Direction of the iteration (optional) -- \b IN. + \param success Type of success of the iteration -- \b IN. + \param dir Direction of the iteration (optional) -- \b IN. */ virtual void update ( NOMAD::success_type success, const NOMAD::Direction * dir=NULL) = 0; /// Update the provided mesh indices (the Mesh is unchanged). /** - \param success Type of success of the iteration -- \b IN. - \param mesh_indices Provided mesh indices for update -- \b IN/OUT. - \param dir Direction of the iteration (optional) -- \b IN. + \param success Type of success of the iteration -- \b IN. + \param mesh_indices Provided mesh indices for update -- \b IN/OUT. + \param dir Direction of the iteration (optional) -- \b IN. */ virtual void update ( NOMAD::success_type success, NOMAD::Point & mesh_indices, const NOMAD::Direction * dir=NULL ) const = 0; @@ -320,8 +322,8 @@ namespace NOMAD { \param stop Stop flag -- \b IN/OUT. \param stop_reason Stop reason -- \b OUT. */ - virtual void check_min_mesh_sizes ( bool & stop , - NOMAD::stop_type & stop_reason ) const = 0; + virtual void check_min_mesh_sizes ( bool & stop , + NOMAD::stop_type & stop_reason ) const = 0; /// Access to the mesh indices per coordinate. /** @@ -390,10 +392,10 @@ namespace NOMAD { /// Scale and project the ith component of a vector on the mesh /** - \param i The vector component number -- \b IN. - \param l The vector component value -- \b IN. - \param round_up The flag to perform or not rounding up (optional) -- \b IN. - \return The ith component of a vector after mesh scaling and projection + \param i The vector component number -- \b IN. + \param l The vector component value -- \b IN. + \param round_up Flag to round up -- \b IN. + \return The ith component of a vector after mesh scaling and projection */ virtual NOMAD::Double scale_and_project(int i, const NOMAD::Double & l, @@ -404,7 +406,7 @@ namespace NOMAD { /// Display a NOMAD::OrthogonalMesh object. /** - \param out The NOMAD::Display object -- \b IN. + \param out The NOMAD::Display object -- \b IN. \param m The NOMAD::OrthogonalMesh object to be displayed -- \b IN. \return The NOMAD::Display object. */ diff --git a/src/Parameter_Entries.cpp b/src/Parameter_Entries.cpp index d2ef0d3d8716e55d8d743d4a8f66b7098025239c..edca792267d1de24930cf5517be7439a46a2b222 100644 --- a/src/Parameter_Entries.cpp +++ b/src/Parameter_Entries.cpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Parameter_Entries.cpp \brief Parameter entries (implementation) diff --git a/src/Parameter_Entries.hpp b/src/Parameter_Entries.hpp index d2682bf0323fca1e4a8099f3dc04326abfd78e95..93104a69736d54da415095cc69fc432c741ede9a 100644 --- a/src/Parameter_Entries.hpp +++ b/src/Parameter_Entries.hpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Parameter_Entries.hpp \brief Parameter entries (headers) diff --git a/src/Parameter_Entry.cpp b/src/Parameter_Entry.cpp index 198d80b6d83e18a1b7e7fbae7e6005355bffba05..2d22f1f16ba34f94acb238fa68301fe6c67076af 100644 --- a/src/Parameter_Entry.cpp +++ b/src/Parameter_Entry.cpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Parameter_Entry.cpp \brief Parameter entry (implementation) @@ -55,7 +57,7 @@ /*-----------------------------------*/ NOMAD::Parameter_Entry::Parameter_Entry ( const std::string & entry , bool remove_comments ) -: _ok ( false ) , +: _ok ( false ) , _unique ( true ) , _next ( NULL ) , _has_been_interpreted ( false ) diff --git a/src/Parameter_Entry.hpp b/src/Parameter_Entry.hpp index 85bfe40ca940363d3f1a40d593ef880eaba7cb8f..63d3c396e10441eaa53c046410bc53cc67571492 100644 --- a/src/Parameter_Entry.hpp +++ b/src/Parameter_Entry.hpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Parameter_Entry.hpp \brief Parameter entry (headers) @@ -81,7 +83,7 @@ namespace NOMAD { \param entry A string describing the parameter entry -- \b IN. \param remove_comments A boolean equal to \c true if entries after \c '#' are ignored -- \b IN - -- \b optional (default = \c true). + -- \b optional (default = \c true). */ Parameter_Entry ( const std::string & entry , bool remove_comments = true ); @@ -196,7 +198,7 @@ namespace NOMAD { \return The NOMAD::Display object. */ inline const NOMAD::Display & operator << ( const NOMAD::Display & out , - const NOMAD::Parameter_Entry & e ) + const NOMAD::Parameter_Entry & e ) { e.display ( out ); return out; diff --git a/src/Parameters.cpp b/src/Parameters.cpp index 5e89b82f83b273164dbdf10f8c3e5fd18527a875..ef07b9e9c7d0e56600209b03f96b4ca377dc0e71 100644 --- a/src/Parameters.cpp +++ b/src/Parameters.cpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Parameters.cpp \brief NOMAD parameters (implementation) @@ -50,11 +52,13 @@ #include "Parameters.hpp" #include "Slave.hpp" #include "XMesh.hpp" +#include "GMesh.hpp" #include "SMesh.hpp" bool NOMAD::Parameters::_warning_has_been_displayed=false; + /*----------------------------------------*/ /* destructor */ /*----------------------------------------*/ @@ -76,6 +80,7 @@ void NOMAD::Parameters::init ( void ) _max_eval = -1; _max_sim_bb_eval = -1; _max_bb_eval = -1; + _max_block_eval = -1; _max_bbe_decided = false; _max_time = -1; _max_iterations = -1; @@ -86,6 +91,9 @@ void NOMAD::Parameters::init ( void ) _stop_if_feasible = false; _user_calls_enabled = true; _asynchronous = true; + _report_bbe_value = true; + _report_blk_eva_value= true; + _report_sgte_value = true; _stat_sum_target.clear(); _L_curve_target.clear(); _cache_file.clear(); @@ -106,16 +114,14 @@ void NOMAD::Parameters::init ( void ) set_INF_STR ( NOMAD::DEFAULT_INF_STR ); // Mesh: - _anisotropic_mesh = true; - _mesh_type = NOMAD::XMESH; - + _anisotropic_mesh = true; + _mesh_type = NOMAD::GMESH; _mesh_update_basis = 4; _poll_update_basis = 2; - _mesh_coarsening_exponent = 1; - _mesh_refining_exponent =-1; - _initial_mesh_index = 0; - _limit_mesh_index = NOMAD::XL_LIMITS; - _min_poll_size_defined = false; + _mesh_coarsening_exponent = 1; + _mesh_refining_exponent =-1; + _initial_mesh_index = 0; + _min_poll_size_defined = false; _initial_mesh_size.clear(); _initial_poll_size.clear(); _min_mesh_size.clear(); @@ -226,12 +232,12 @@ void NOMAD::Parameters::init ( void ) _opp_CS_is_defined = false; // opportunistic strategy: - _bb_max_block_size = 1; + _bb_max_block_size = 1; _eval_points_as_block = false; - _opportunistic_eval = true; - _opportunistic_min_nb_success = -1; - _opportunistic_min_eval = -1; - _opportunistic_lucky_eval = false; + _opportunistic_eval = true; + _opportunistic_min_nb_success = -1; + _opportunistic_min_eval = -1; + _opportunistic_lucky_eval = false; _opportunistic_min_f_imprvmt.clear(); // display: @@ -250,6 +256,30 @@ void NOMAD::Parameters::init ( void ) _display_all_eval = false; + + // SGTELIB + // Nb of model evaluation in the solving of the surrogate problem + _sgtelib_model_eval_nb = 10000; + // Nb of candidates returned at each search. + // If -1, then the nb will be the block size. + _sgtelib_model_candidates_nb = -1; + + + _sgtelib_model_trials = 1; + + _sgtelib_model_diversification = 0.0; + _sgtelib_model_exclusion_area = 0.0; + _sgtelib_model_definition = "TYPE LOWESS DEGREE 1 KERNEL_SHAPE OPTIM KERNEL_COEF OPTIM RIDGE 0 METRIC AOECV"; + _sgtelib_model_formulation = NOMAD::SGTELIB_MODEL_FORMULATION_FS; + _sgtelib_model_feasibility = NOMAD::SGTELIB_MODEL_FEASIBILITY_C; + _sgtelib_model_display = ""; + _sgtelib_model_filter = "2345"; // Use step 2345 + + // RobustMads + _robust_mads = false; + _robust_mads_standard_dev_factor = 1.0; + + } /*------------------------------------------------------------------*/ @@ -2321,6 +2351,24 @@ void NOMAD::Parameters::read ( const NOMAD::Parameter_Entries & entries ) set_MAX_BB_EVAL (i); } } + + + // MAX_BLOCK_EVAL: + // ------------ + { + pe = entries.find ( "MAX_BLOCK_EVAL" ); + if ( pe ) + { + if ( !pe->is_unique() ) + throw Invalid_Parameter ( "Parameters.cpp" , __LINE__ , + "invalid parameter: MAX_BLOCK_EVAL not unique" ); + if ( pe->get_nb_values() != 1 || !NOMAD::atoi (*(pe->get_values().begin()) , i) ) + throw Invalid_Parameter ( "Parameters.cpp" , __LINE__ , + "invalid parameter: MAX_BLOCK_EVAL" ); + pe->set_has_been_interpreted(); + set_MAX_BLOCK_EVAL (i); + } + } // MAX_SIM_BB_EVAL: // ---------------- @@ -2845,9 +2893,9 @@ void NOMAD::Parameters::read ( const NOMAD::Parameter_Entries & entries ) interpret_mesh_sizes ( entries , "MIN_POLL_SIZE" ); - // GRANULARITY ---> for the next release! + // GRANULARITY //-------------------- - // interpret_granularity( entries , "GRANULARITY"); + interpret_granularity( entries , "GRANULARITY"); // BB_OUTPUT_TYPE: @@ -3129,6 +3177,55 @@ void NOMAD::Parameters::read ( const NOMAD::Parameter_Entries & entries ) } } + + // ROBUST_MADS: + // ----- + { + pe = entries.find ( "ROBUST_MADS" ); + + if ( pe ) + { + + if ( !pe->is_unique() ) + throw Invalid_Parameter ( "Parameters.cpp" , __LINE__ , + "invalid parameter: ROBUST_MADS not unique" ); + + i = NOMAD::string_to_bool ( *(pe->get_values().begin() ) ); + if ( pe->get_nb_values() != 1 || i == -1 ) + throw Invalid_Parameter ( "Parameters.cpp" , __LINE__ , + "invalid parameter: ROBUST_MADS" ); + set_ROBUST_MADS ( i == 1 ); + pe->set_has_been_interpreted(); + } + + pe = entries.find ( "ROBUST_MADS_STANDARD_DEV_FACTOR" ); + + if ( pe ) + { + + if ( !pe->is_unique() ) + throw Invalid_Parameter ( "Parameters.cpp" , __LINE__ , + "invalid parameter: ROBUST_MADS_STANDARD_DEV_FACTOR not unique" ); + + if ( pe->get_nb_values() != 1 ) + throw Invalid_Parameter ( "Parameters.cpp" , __LINE__ , + "invalid parameter: ROBUST_MADS_STANDARD_DEV_FACTOR" ); + + NOMAD::Double v; + + if ( !v.atof ( *pe->get_values().begin() ) ) + { + err = "invalid parameter: ROBUST_MADS_STANDARD_DEV_FACTOR"; + throw Invalid_Parameter ( "Parameters.cpp" , __LINE__ , err ); + } + set_ROBUST_MADS_STANDARD_DEV_FACTOR(v); + pe->set_has_been_interpreted(); + + } + + } + + // SEED: // ----- { @@ -3158,6 +3255,231 @@ void NOMAD::Parameters::read ( const NOMAD::Parameter_Entries & entries ) } } + + + + // SGTELIB_MODEL_DEFINITION: + // -------------------------------- + { + pe = entries.find ( "SGTELIB_MODEL_DEFINITION" ); + if ( pe ) + { + if ( !pe->is_unique() ) + throw Invalid_Parameter ( "Parameters.cpp" , __LINE__ , + "invalid parameter: SGTELIB_MODEL_DEFINITION not unique" ); + + string md = ""; + std::list<std::string>::const_iterator it; + for ( it=pe->get_values().begin() ; it!=pe->get_values().end() ; ++it) + { + md = md + " " + *it; + } + md.erase(0, 1); + //toupper(md); // modified to handle extern sgte + set_SGTELIB_MODEL_DEFINITION ( md ); + pe->set_has_been_interpreted(); + } + } + + // SGTELIB_MODEL_DISPLAY: + // -------------------------------- + { + pe = entries.find ( "SGTELIB_MODEL_DISPLAY" ); + if ( pe ) + { + if ( !pe->is_unique() ) + throw Invalid_Parameter ( "Parameters.cpp" , __LINE__ , + "invalid parameter: SGTELIB_MODEL_DISPLAY not unique" ); + + string md = ""; + std::list<std::string>::const_iterator it; + for ( it=pe->get_values().begin() ; it!=pe->get_values().end() ; ++it) + { + md = md + " " + *it; + } + md.erase(0, 1); + toupper(md); + set_SGTELIB_MODEL_DISPLAY ( md ); + pe->set_has_been_interpreted(); + } + } + + // SGTELIB_MODEL_EVAL_NB: + // ----------------------- + { + pe = entries.find ( "SGTELIB_MODEL_EVAL_NB" ); + if ( pe ) + { + if ( !pe->is_unique() ) + throw Invalid_Parameter ( "Parameters.cpp" , __LINE__ , + "invalid parameter: SGTELIB_MODEL_EVAL_NB not unique" ); + if ( pe->get_nb_values() != 1 || !NOMAD::atoi (*(pe->get_values().begin()) , i) ) + throw Invalid_Parameter ( "Parameters.cpp" , __LINE__ , + "invalid parameter: SGTELIB_MODEL_EVAL_NB" ); + pe->set_has_been_interpreted(); + set_SGTELIB_MODEL_EVAL_NB (i); + } + } + + + // SGTELIB_MODEL_DIVERSIFICATION: + // ---------------------- + { + pe = entries.find ( "SGTELIB_MODEL_DIVERSIFICATION" ); + if ( pe ) + { + if ( !pe->is_unique() ) + throw Invalid_Parameter ( "Parameters.cpp" , __LINE__ , + "invalid parameter: SGTELIB_MODEL_DIVERSIFICATION not unique" ); + NOMAD::Double v; + if ( pe->get_nb_values() != 1 || !v.atof (*(pe->get_values().begin()) ) ) + throw Invalid_Parameter ( "Parameters.cpp" , __LINE__ , + "invalid parameter: SGTELIB_MODEL_DIVERSIFICATION" ); + pe->set_has_been_interpreted(); + set_SGTELIB_MODEL_DIVERSIFICATION (v); + } + } + + // SGTELIB_MODEL_EXCLUSION_AREA: + // -------------------------- + { + pe = entries.find ( "SGTELIB_MODEL_EXCLUSION_AREA" ); + if ( pe ) + { + if ( !pe->is_unique() ) + throw Invalid_Parameter ( "Parameters.cpp" , __LINE__ , + "invalid parameter: SGTELIB_MODEL_EXCLUSION_AREA not unique" ); + NOMAD::Double v; + if ( pe->get_nb_values() != 1 || !v.atof (*(pe->get_values().begin()) ) ) + throw Invalid_Parameter ( "Parameters.cpp" , __LINE__ , + "invalid parameter: SGTELIB_MODEL_EXCLUSION_AREA" ); + if ( (v>1) || (v<0) ) + throw Invalid_Parameter ( "Parameters.cpp" , __LINE__ , + "invalid parameter: SGTELIB_MODEL_EXCLUSION_AREA (must be in [0 ; 1])" ); + pe->set_has_been_interpreted(); + set_SGTELIB_MODEL_EXCLUSION_AREA (v); + } + } + + // SGTELIB_MODEL_CANDIDATES: + // ----------------------- + { + pe = entries.find ( "SGTELIB_MODEL_CANDIDATES_NB" ); + if ( pe ) + { + if ( !pe->is_unique() ) + throw Invalid_Parameter ( "Parameters.cpp" , __LINE__ , + "invalid parameter: SGTELIB_MODEL_CANDIDATES_NB not unique" ); + if ( pe->get_nb_values() != 1 || !NOMAD::atoi (*(pe->get_values().begin()) , i) ) + throw Invalid_Parameter ( "Parameters.cpp" , __LINE__ , + "invalid parameter: SGTELIB_MODEL_CANDIDATES_NB" ); + pe->set_has_been_interpreted(); + set_SGTELIB_MODEL_CANDIDATES_NB (i); + } + } + + + + // SGTELIB_MODEL_TRIALS: + // ----------------------- + { + pe = entries.find ( "SGTELIB_MODEL_TRIALS" ); + if ( pe ) + { + if ( !pe->is_unique() ) + throw Invalid_Parameter ( "Parameters.cpp" , __LINE__ , + "invalid parameter: SGTELIB_MODEL_TRIALS not unique" ); + if ( pe->get_nb_values() != 1 ) + throw Invalid_Parameter ( "Parameters.cpp" , __LINE__ , + "invalid parameter: SGTELIB_MODEL_TRIALS" ); + string str_trials = *(pe->get_values().begin()); + NOMAD::toupper(str_trials); + if (str_trials=="N") + i = _dimension; + else if (str_trials=="S") + i = _dimension+1; + else if ( !NOMAD::atoi (*(pe->get_values().begin()) , i) ) + throw Invalid_Parameter ( "Parameters.cpp" , __LINE__ , + "invalid parameter: SGTELIB_MODEL_TRIALS" ); + pe->set_has_been_interpreted(); + set_SGTELIB_MODEL_TRIALS (i); + } + } + + + // SGTELIB_MODEL_FILTER: + // -------------------------------- + { + pe = entries.find ( "SGTELIB_MODEL_FILTER" ); + if ( pe ) + { + if ( !pe->is_unique() ) + throw Invalid_Parameter ( "Parameters.cpp" , __LINE__ , + "invalid parameter: SGTELIB_MODEL_FILTER not unique" ); + + string md = ""; + std::list<std::string>::const_iterator it; + for ( it=pe->get_values().begin() ; it!=pe->get_values().end() ; ++it) + { + md = md + " " + *it; + } + md.erase(0, 1); + toupper(md); + set_SGTELIB_MODEL_FILTER ( md ); + pe->set_has_been_interpreted(); + } + } + + + // SGTELIB_MODEL_FORMULATION: + // --------------------- + { + pe = entries.find ( "SGTELIB_MODEL_FORMULATION" ); + if ( pe ) + { + if ( !pe->is_unique() ) + throw Invalid_Parameter ( "Parameters.cpp" , __LINE__ , + "invalid parameter: SGTELIB_MODEL_FORMULATION not unique" ); + if ( pe->get_nb_values() != 1 ) + throw Invalid_Parameter ( "Parameters.cpp" , __LINE__ , + "invalid parameter: SGTELIB_MODEL_FORMULATION" ); + + NOMAD::sgtelib_model_formulation_type dft; + std::string sdf = *(pe->get_values().begin()); + + if ( !NOMAD::string_to_sgtelib_model_formulation_type ( sdf , dft ) ) + throw Invalid_Parameter ( "Parameters.cpp" , __LINE__ , + "invalid parameter: SGTELIB_MODEL_FORMULATION" ); + set_SGTELIB_MODEL_FORMULATION ( dft ); + + pe->set_has_been_interpreted(); + } + } + + // SGTELIB_MODEL_FEASIBILITY: + // ---------------------------- + { + pe = entries.find ( "SGTELIB_MODEL_FEASIBILITY" ); + if ( pe ) + { + if ( !pe->is_unique() ) + throw Invalid_Parameter ( "Parameters.cpp" , __LINE__ , + "invalid parameter: SGTELIB_MODEL_FEASIBILITY not unique" ); + if ( pe->get_nb_values() != 1 ) + throw Invalid_Parameter ( "Parameters.cpp" , __LINE__ , + "invalid parameter: SGTELIB_MODEL_FEASIBILITY" ); + + NOMAD::sgtelib_model_feasibility_type dft ; + std::string sdfm = *(pe->get_values().begin()); + + if ( !NOMAD::string_to_sgtelib_model_feasibility_type ( sdfm , dft ) ) + throw Invalid_Parameter ( "Parameters.cpp" , __LINE__ , + "invalid parameter: SGTELIB_MODEL_FEASIBILITY" ); + set_SGTELIB_MODEL_FEASIBILITY ( dft ); + + pe->set_has_been_interpreted(); + } + } // VARIABLE_GROUP: @@ -3556,6 +3878,14 @@ void NOMAD::Parameters::display ( const NOMAD::Display & out ) const out << NOMAD::open_block ( "xmesh (isotropic)" ); out << "poll update basis : " << std::setw(3) << _poll_update_basis << std::endl; } + else if ( _mesh_type == NOMAD::GMESH ) + { + if ( get_anisotropic_mesh() ) + out << NOMAD::open_block ( "gmesh (anisotropic)" ); + else + out << NOMAD::open_block ( "gmesh (isotropic)" ); + out << "granularity : " << std::setw(3) << _granularity << std::endl; + } out << "coarsening exponent : " << std::setw(3) << _mesh_coarsening_exponent << std::endl @@ -3703,6 +4033,7 @@ void NOMAD::Parameters::display ( const NOMAD::Display & out ) const << "max Y size : " << _model_params.quad_max_Y_size << std::endl << NOMAD::close_block(); } + out.close_block(); } else @@ -3878,6 +4209,29 @@ void NOMAD::Parameters::display ( const NOMAD::Display & out ) const out << std::endl; } + + // SGTELIB + if ( _model_params.eval_sort == NOMAD::SGTELIB_MODEL || + _model_params.search1 == NOMAD::SGTELIB_MODEL || + _model_params.search2 == NOMAD::SGTELIB_MODEL ) + { + out << NOMAD::open_block ( "sgtelib_model" ); + out << "Formulation: " + << sgtelib_model_formulation_type_to_string( _sgtelib_model_formulation ) + << std::endl; + + out << "Feasibility: " + << sgtelib_model_feasibility_type_to_string( _sgtelib_model_feasibility ) + << std::endl; + + out << "eval nb: " << _sgtelib_model_eval_nb << std::endl; + out << "diversification: " << _sgtelib_model_diversification << std::endl; + out << "exclusion_area: " << _sgtelib_model_exclusion_area << std::endl; + out << "definition: " << _sgtelib_model_definition << std::endl; + out << "display: " << _sgtelib_model_display << std::endl; + out << "filter: " << _sgtelib_model_filter << std::endl; + out << NOMAD::close_block(); + } } /*---------------------------------------*/ @@ -4018,7 +4372,11 @@ void NOMAD::Parameters::check ( bool remove_history_file , "invalid parameter: UPPER_BOUND" ); if ( _ub.size() < _dimension ) _ub.resize ( _dimension ); - + + bool warning_once_lb_var_type = false; + bool warning_once_ub_var_type = false; + bool warning_once_lb_gran = false; + bool warning_once_ub_gran = false; for ( i = 0 ; i < _dimension ; ++i ) { if ( _lb[i].is_defined() && _ub[i].is_defined() ) @@ -4030,22 +4388,23 @@ void NOMAD::Parameters::check ( bool remove_history_file , set_FIXED_VARIABLE ( i , _lb[i] ); } + // Check that x0s are within bounds when defined - if(_lb[i].is_defined()) + if( _lb[i].is_defined() ) { std::vector<NOMAD::Point *>::iterator it; - for(it=_x0s.begin();it<_x0s.end();it++) + for( it = _x0s.begin() ; it < _x0s.end() ; it++ ) { // Compare values only if dimension is the same - if ( (*it)->size()==_lb.size() && (**it)[i] < _lb[i] ) + if ( (*it)->size() == _lb.size() && (**it)[i] < _lb[i] ) throw Invalid_Parameter ( "Parameters.cpp" , __LINE__ , "invalid parameter: x0 < LOWER_BOUND " ); } } - if(_ub[i].is_defined()) + if( _ub[i].is_defined() ) { std::vector<NOMAD::Point *>::iterator it; - for(it=_x0s.begin();it<_x0s.end();it++) + for( it = _x0s.begin() ; it < _x0s.end() ; it++ ) { // Compare values only if dimension is the same if ( (*it)->size()==_ub.size() && (**it)[i] > _ub[i] ) @@ -4067,9 +4426,69 @@ void NOMAD::Parameters::check ( bool remove_history_file , else { if ( _lb[i].is_defined() ) - _lb[i] = ceil(_lb[i].value()); + { + // _lb[i] = ceil( _lb[i].value() ); + NOMAD::Double lb = ceil( _lb[i].value() ); + if ( lb != _lb[i] ) + { + _lb[i] = lb; + if ( _out.get_gen_dd() >= NOMAD::NORMAL_DISPLAY && !_warning_has_been_displayed && ! warning_once_lb_var_type ) + { + _out << NOMAD::open_block("Warning:") + << "A lower bound has been ajusted according to variable type." << std::endl + << NOMAD::close_block(); + warning_once_lb_var_type = true; + } + } + } if ( _ub[i].is_defined() ) - _ub[i] = floor(_ub[i].value()); + { + // _ub[i] = floor( _ub[i].value() ); + NOMAD::Double ub = floor( _ub[i].value() ); + if ( ub != _ub[i] ) + { + _ub[i] = ub; + if ( _out.get_gen_dd() >= NOMAD::NORMAL_DISPLAY && !_warning_has_been_displayed && ! warning_once_ub_var_type ) + { + _out << NOMAD::open_block("Warning:") + << "A upper bound has been ajusted according to variable type." << std::endl + << NOMAD::close_block(); + warning_once_ub_var_type = true; + } + } + } + } + } + + if ( _granularity.is_defined() ) + { + if ( _lb[i].is_defined() && _granularity[i] > 0.0 ) + { + NOMAD::Double lb = ceil( _lb[i].value() / _granularity[i].value() ) * _granularity[i]; + if ( lb != _lb[i] ) + { + if ( _out.get_gen_dd() >= NOMAD::NORMAL_DISPLAY && !_warning_has_been_displayed && ! warning_once_lb_gran ) + { + _out << NOMAD::open_block("Warning:") + << "A lower bound has been ajusted according to granularity." << std::endl + << NOMAD::close_block(); + warning_once_lb_gran = true; + } + } + } + if ( _ub[i].is_defined() && _granularity[i] > 0.0 ) + { + NOMAD::Double ub = floor( _ub[i].value() / _granularity[i].value() ) * _granularity[i]; + if ( ub != _ub[i] ) + { + if ( _out.get_gen_dd() >= NOMAD::NORMAL_DISPLAY && !_warning_has_been_displayed && ! warning_once_ub_gran ) + { + _out << NOMAD::open_block("Warning:") + << "An upper bound has been ajusted according to granularity." << std::endl + << NOMAD::close_block(); + warning_once_ub_gran = true ; + } + } } } } @@ -4143,36 +4562,6 @@ void NOMAD::Parameters::check ( bool remove_history_file , } - // limit mesh index: - // -------------------------------- - { - if ( _mesh_type == NOMAD::SMESH && _limit_mesh_index > NOMAD::L_LIMITS ) - if ( !_warning_has_been_displayed ) - _out << NOMAD::open_block("Warning:") - << "A limit mesh index that is greater than the defaut limit of " << NOMAD::L_LIMITS << " is provided. This convergence criterion can be difficult to meet due to nomad precision" << std::endl - << NOMAD::close_block(); - - if ( _mesh_type == NOMAD::SMESH && _limit_mesh_index == NOMAD::XL_LIMITS ) - _limit_mesh_index = NOMAD::L_LIMITS; - - if ( ( _mesh_type == NOMAD::XMESH ) && _limit_mesh_index < NOMAD::XL_LIMITS ) - if ( !_warning_has_been_displayed ) - _out << NOMAD::open_block("Warning:") - << "A limit mesh index that is smaller than the defaut limit of " << NOMAD::L_LIMITS << " is provided. This convergence criterion can be difficult to meet due to nomad precision" << std::endl - << NOMAD::close_block(); - - if ( _mesh_type == NOMAD::SMESH && _limit_mesh_index <= _initial_mesh_index ) - throw Invalid_Parameter ( "Parameters.cpp" , __LINE__ , - "invalid parameter: LIMIT_MESH_INDEX must be larger than INITIAL_MESH_INDEX (SMESH)" ); - - if ( ( _mesh_type == NOMAD::XMESH ) && _limit_mesh_index >= _initial_mesh_index ) - throw Invalid_Parameter ( "Parameters.cpp" , __LINE__ , - "invalid parameter: LIMIT_MESH_INDEX must be smaller than INITIAL_MESH_INDEX (XMESH)" ); - - - } - - // initial mesh size or poll size: // -------------------------------- bool use_x0 = !_x0s.empty() && _x0s[0]->size() == _dimension; @@ -4183,10 +4572,8 @@ void NOMAD::Parameters::check ( bool remove_history_file , // --------------------- if ( _bb_input_type[i] == NOMAD::CONTINUOUS ) { - if ( _initial_mesh_size[i].is_defined() ) - _initial_poll_size[i]=_initial_mesh_size[i]*pow(_dimension,0.5); - + _initial_poll_size[i]=_initial_mesh_size[i]*pow(_nb_free_variables,0.5); // default value for initial mesh size if ( !_initial_poll_size[i].is_defined() ) @@ -4224,16 +4611,15 @@ void NOMAD::Parameters::check ( bool remove_history_file , } } } - + else if ( !_fixed_variables[i].is_defined() && - ( _initial_poll_size[i].value() < NOMAD::Double::get_epsilon() || - _initial_poll_size[i].value() <= 0.0 ) ) + _initial_poll_size[i].value() <= 0.0 ) throw Invalid_Parameter ( "Parameters.cpp" , __LINE__ , "invalid parameter: INITIAL_MESH_SIZE" ); // Determine _initial_mesh_size from _initial_poll_size (this will disappear in future version) if ( !_initial_mesh_size[i].is_defined() ) - _initial_mesh_size[i]=_initial_poll_size[i]*pow(_dimension,-0.5); + _initial_mesh_size[i] = _initial_poll_size[i] * pow( _nb_free_variables , -0.5 ); } @@ -4254,7 +4640,7 @@ void NOMAD::Parameters::check ( bool remove_history_file , { // Determine mesh size from poll size if ( _initial_poll_size[i].is_defined() ) - _initial_mesh_size[i]=_initial_poll_size[i]*pow(_dimension,-0.5); + _initial_mesh_size[i]=_initial_poll_size[i]*pow(_nb_free_variables,-0.5); if ( _initial_mesh_size[i].is_defined() ) @@ -4280,8 +4666,7 @@ void NOMAD::Parameters::check ( bool remove_history_file , } } - // Determine the initial poll size from mesh size - _initial_poll_size[i] = _initial_mesh_size[i] * pow(_dimension,0.5); + _initial_poll_size[i] = _initial_mesh_size[i] * pow(_nb_free_variables,0.5); } } @@ -4346,19 +4731,40 @@ void NOMAD::Parameters::check ( bool remove_history_file , { - // Granularity --> this will be used in the next version in which granular variabtesles will be handled + // Granularity //------------------- if ( _granularity.is_defined () && _granularity.size () != _dimension ) throw Invalid_Parameter ( "Parameters.cpp" , __LINE__ , "invalid parameters: granularity (size must be equal to dimension)" ); + if ( ! _granularity.is_defined() ) + { _granularity = NOMAD::Point ( _dimension ,0 ); + + // For GMesh, the granularity must be set according to bb_input_type + if ( _mesh_type == NOMAD::GMESH ) + { + for ( i = 0 ; i < _dimension ; ++i ) + { + if ( _bb_input_type[i] == NOMAD::INTEGER || _bb_input_type[i] == NOMAD::BINARY ) + _granularity[i] = 1.0; + } + + } + } else { double inpart; + bool has_categorical = false; + bool force_change_to_gmesh = false; + bool warning_once_int_bin_gran = false; for ( i = 0 ; i < _dimension ; ++i ) { + if ( !_fixed_variables[i].is_defined() && _bb_input_type[i] == NOMAD::CATEGORICAL ) + { + has_categorical=true; + } if ( _granularity[i].is_defined() && _granularity[i] < 0 ) throw Invalid_Parameter ( "Parameters.cpp" , __LINE__ , @@ -4368,35 +4774,38 @@ void NOMAD::Parameters::check ( bool remove_history_file , throw Invalid_Parameter ( "Parameters.cpp" , __LINE__ , "invalid parameters: granular variables are not supported when mesh_type = smesh " ); - // Exception if a granularity is not supported by xmesh is given - if ( _granularity[i].is_defined() && _granularity[i] != 0.0 && _granularity[i] != 1.0 ) - throw Invalid_Parameter ( "Parameters.cpp" , __LINE__ , - "invalid parameters: granularity must be 0 (continuous) or 1 (integer). " ); - - //from bb_input_type --> _granularity. No granularity is required for categorical variables (different variable group + no mesh ) - if ( _bb_input_type[i] == NOMAD::CONTINUOUS ) - { - if ( _granularity[i].is_defined() && _granularity[i] != 0.0 && _out.get_gen_dd()>=NOMAD::NORMAL_DISPLAY && !_warning_has_been_displayed ) - _out << NOMAD::open_block("Warning:") - << " The granularity of the continuous variable " << i << " is changed to 0." << std::endl - << NOMAD::close_block(); - _granularity[i] = 0.0; - } + // Force to use gmesh if a granularity not supported by xmesh or gmesh is given + if ( _granularity[i].is_defined() && _granularity[i] != 0.0 && _granularity[i] != 1.0 && _mesh_type != NOMAD::GMESH ) + force_change_to_gmesh = true; if ( _bb_input_type[i] == NOMAD::INTEGER || _bb_input_type[i] == NOMAD::BINARY ) { - if ( _granularity[i].is_defined() && _granularity[i] != 1.0 && _out.get_gen_dd() >= NOMAD::NORMAL_DISPLAY && !_warning_has_been_displayed ) + if ( _granularity[i].is_defined() && _granularity[i] != 1.0 && _out.get_gen_dd() >= NOMAD::NORMAL_DISPLAY && !_warning_has_been_displayed && ! warning_once_int_bin_gran ) + { _out << NOMAD::open_block("Warning:") - << " The granularity of the integer/binary variable " << i << " is changed to 1." << std::endl + << " The granularity of an integer/binary variable has been changed to 1." << std::endl << NOMAD::close_block(); + warning_once_int_bin_gran = true; + } _granularity[i] = 1.0; } - if ( !_x0s.empty() && _granularity[i].is_defined() && _granularity[i] > 0.0 - && std::modf ( (*_x0s[0])[i].value() / _granularity[i].value() , &inpart ) != 0 ) - throw Invalid_Parameter ( "Parameters.cpp" , __LINE__ , - "NOMAD::Parameters::check : invalid granularity of variables vs initial value" ); + if ( !_x0s.empty() && _granularity[i].is_defined() && _granularity[i] > 0.0 ) + for ( int j = 0 ; j < static_cast<int>(_x0s.size()) ; j++ ) + if ( std::modf ( (*_x0s[j])[i].value() / _granularity[i].value() , &inpart ) != 0 ) + throw Invalid_Parameter ( "Parameters.cpp" , __LINE__ , " invalid granularity of variables vs initial value" ); + + } + + + if ( !has_categorical && force_change_to_gmesh ) + { + _mesh_type = NOMAD::GMESH; + if ( _out.get_gen_dd()>=NOMAD::NORMAL_DISPLAY && !_warning_has_been_displayed ) + _out << NOMAD::open_block("Warning:") + << " The mesh type is changed to gmesh to support the granularity of at least one variable." << std::endl + << NOMAD::close_block(); } } @@ -4677,10 +5086,12 @@ void NOMAD::Parameters::check ( bool remove_history_file , /* intensification */ /*----------------------------*/ if ( _max_eval_intensification > 0 ) - _intensification_type = NOMAD::POLL_AND_SEARCH; + _intensification_type = NOMAD::POLL_ONLY; else _intensification_type = NOMAD::NO_INTENSIFICATION; + + /*----------------------------*/ /* periodic variables */ /*----------------------------*/ @@ -4712,16 +5123,16 @@ void NOMAD::Parameters::check ( bool remove_history_file , { // disable models upon request - if ( _disable_models) + if ( _disable_models ) { _model_params.search1 = _model_params.search2 = _model_params.eval_sort = NOMAD::NO_MODEL; - if (_out.get_gen_dd()>NOMAD::MINIMAL_DISPLAY && !_warning_has_been_displayed) + if ( _out.get_gen_dd() > NOMAD::MINIMAL_DISPLAY && !_warning_has_been_displayed ) { _out << NOMAD::open_block("Warning:") << "Model use is forcefully disabled." << std::endl << NOMAD::close_block(); - if (has_direction_type(NOMAD::ORTHO_NP1_QUAD)) + if ( has_direction_type ( NOMAD::ORTHO_NP1_QUAD ) ) { _out << NOMAD::open_block("Warning:") << "Model use is disabled for direction type. Direction types ORTHO N+1 QUAD are changed to ORTHO N+1 NEG." << std::endl @@ -4808,16 +5219,16 @@ void NOMAD::Parameters::check ( bool remove_history_file , #ifdef USE_MPI _model_params.search1 = _model_params.search2 = _model_params.eval_sort = NOMAD::NO_MODEL; set_DIRECTION_TYPE_NO_MODEL(); - if (_out.get_gen_dd()>NOMAD::MINIMAL_DISPLAY && !_warning_has_been_displayed) + if ( _out.get_gen_dd() > NOMAD::MINIMAL_DISPLAY && !_warning_has_been_displayed ) _out << NOMAD::open_block("Warning:") << "Model use is disabled in parallel mode (MPI)." << std::endl << NOMAD::close_block(); - if ((has_direction_type(NOMAD::ORTHO_NP1_QUAD) || has_direction_type(NOMAD::ORTHO_NP1_NEG)) && _asynchronous) + if ( ( has_direction_type ( NOMAD::ORTHO_NP1_QUAD ) || has_direction_type ( NOMAD::ORTHO_NP1_NEG ) ) && _asynchronous ) { set_ASYNCHRONOUS(false); - if (_out.get_gen_dd()>NOMAD::MINIMAL_DISPLAY && !_warning_has_been_displayed) + if ( _out.get_gen_dd() > NOMAD::MINIMAL_DISPLAY && !_warning_has_been_displayed ) _out << NOMAD::open_block("Warning:") << "Asynchronous mode is disabled in parallel mode (MPI) when dynamic directions (ortho n+1) are used." << std::endl << NOMAD::close_block(); @@ -4853,6 +5264,8 @@ void NOMAD::Parameters::check ( bool remove_history_file , throw Invalid_Parameter ( "Parameters.cpp" , __LINE__ , "invalid parameter: MODEL_SEARCH_MAX_TRIAL_PTS (must be >= 1)" ); + if ( _sgtelib_model_formulation == NOMAD::SGTELIB_MODEL_FORMULATION_FS || _sgtelib_model_formulation == NOMAD::SGTELIB_MODEL_FORMULATION_EIS ) + _sgtelib_model_feasibility = NOMAD::SGTELIB_MODEL_FEASIBILITY_C; } @@ -5031,18 +5444,18 @@ void NOMAD::Parameters::check ( bool remove_history_file , if ( !_opp_CS_is_defined ) _opportunistic_cache_search = false; - if (_bb_max_block_size<=0) + if ( _bb_max_block_size <= 0 ) throw Invalid_Parameter ( "Parameters.cpp" , __LINE__ , "Parameters::check(): invalid block size for list evaluation (>0)" ); - if (_out.get_gen_dd()>NOMAD::MINIMAL_DISPLAY && !_warning_has_been_displayed && _bb_max_block_size > 1 && (_max_bb_eval>0 || _max_sim_bb_eval>0 || _max_eval>0)) + if ( _out.get_gen_dd () > NOMAD::MINIMAL_DISPLAY && !_warning_has_been_displayed && _bb_max_block_size > 1 && ( _max_bb_eval > 0 || _max_sim_bb_eval > 0 || _max_eval > 0 ) ) _out << NOMAD::open_block("Warning:") << "The maximum number of evaluations may be exceeded when BB_MAX_BLOCK_SIZE>1." << std::endl << NOMAD::close_block(); #ifdef USE_MPI - if (_bb_max_block_size >1) + if ( _bb_max_block_size > 1 ) throw Invalid_Parameter ( "Parameters.cpp" , __LINE__ , "Parameters::check(): List evaluation by block of size > 1 are not allowed when using MPI." ); #endif @@ -5090,26 +5503,25 @@ void NOMAD::Parameters::check ( bool remove_history_file , /*----------------------------------*/ /* signature (standard or extern) */ /*----------------------------------*/ - NOMAD::Signature * new_s = new NOMAD::Signature ( _dimension , - _bb_input_type , - _lb , - _ub , - _mesh_type , - _anisotropic_mesh , - _granularity , - _initial_poll_size , - _min_poll_size , - _min_mesh_size , - _mesh_update_basis , - _poll_update_basis , + NOMAD::Signature * new_s = new NOMAD::Signature ( _dimension , + _bb_input_type , + _lb , + _ub , + _mesh_type , + _anisotropic_mesh , + _granularity , + _initial_poll_size , + _min_poll_size , + _min_mesh_size , + _mesh_update_basis , + _poll_update_basis , _mesh_coarsening_exponent, - _mesh_refining_exponent, - _initial_mesh_index , - _limit_mesh_index , - _scaling , - _fixed_variables , - _periodic_variables , - _var_groups ); + _mesh_refining_exponent , + _initial_mesh_index , + _scaling , + _fixed_variables , + _periodic_variables , + _var_groups ); // extern signature: if ( _extern_signature ) @@ -5192,6 +5604,32 @@ void NOMAD::Parameters::check ( bool remove_history_file , "invalid parameter: x0 and sgte cache file are the same" ); } + /*----------------------------*/ + /* Robust mads */ + /*----------------------------*/ + { + + if ( _robust_mads && ( _has_constraints || nb_obj > 1 )) + throw Invalid_Parameter ( "Parameters.cpp" , __LINE__ , "NOMAD::Parameters::check : the algorithm RobustMads can be used only when the blackbox returns a single objective without constraints" ); + + if ( _robust_mads && _anisotropic_mesh ) + throw Invalid_Parameter ( "Parameters.cpp" , __LINE__ , "NOMAD::Parameters::check : the algorithm RobustMads cannot be used when the mesh is anisotropic" ); + + + if ( _robust_mads && has_categorical ) + throw Invalid_Parameter ( "Parameters.cpp" , __LINE__ , "NOMAD::Parameters::check : the algorithm RobustMads cannot be used with categorical variables" ); + + if ( _robust_mads && _VNS_search ) + throw Invalid_Parameter ( "Parameters.cpp" , __LINE__ , "NOMAD::Parameters::check : the algorithm RobustMads cannot be used vns search" ); + + if ( _robust_mads && ! _robust_mads_standard_dev_factor.is_defined() ) + throw Invalid_Parameter ( "Parameters.cpp" , __LINE__ , "NOMAD::Parameters::check : a robust mads standard dev factor (beta) > 0 must be provided" ); + + + if ( _robust_mads && _robust_mads_standard_dev_factor.is_defined() && _robust_mads_standard_dev_factor < 0 ) + throw Invalid_Parameter ( "Parameters.cpp" , __LINE__ , "NOMAD::Parameters::check : robust mads standard dev factor (beta) must be > 0" ); + } + /*----------------------*/ @@ -5522,7 +5960,7 @@ bool NOMAD::Parameters::get_anisotropic_mesh ( void ) const return _anisotropic_mesh; } -// mesh_type: + const NOMAD::mesh_type & NOMAD::Parameters::get_mesh_type ( void ) const { if ( _to_be_checked ) @@ -5678,6 +6116,34 @@ bool NOMAD::Parameters::get_asynchronous ( void ) const return _asynchronous; } +// get_report_bbe_value: +bool NOMAD::Parameters::get_report_bbe_value ( void ) const +{ + if ( _to_be_checked ) + throw Bad_Access ( "Parameters.cpp" , __LINE__ , + "Parameters::get_report_bbe_value(), Parameters::check() must be invoked" ); + return _report_bbe_value; +} + +// get_report_sgte_value: +bool NOMAD::Parameters::get_report_sgte_value ( void ) const +{ + if ( _to_be_checked ) + throw Bad_Access ( "Parameters.cpp" , __LINE__ , + "Parameters::get_report_sgte_value(), Parameters::check() must be invoked" ); + return _report_sgte_value; +} + + +// get_report_blk_eva_value: +bool NOMAD::Parameters::get_report_blk_eva_value ( void ) const +{ + if ( _to_be_checked ) + throw Bad_Access ( "Parameters.cpp" , __LINE__ , + "Parameters::get_report_blk_eva_value(), Parameters::check() must be invoked" ); + return _report_blk_eva_value; +} + // get_x0s: const std::vector<NOMAD::Point *> & NOMAD::Parameters::get_x0s ( void ) const { @@ -5984,6 +6450,16 @@ int NOMAD::Parameters::get_max_bb_eval ( void ) const return _max_bb_eval; } +// get_max_block_eval: +int NOMAD::Parameters::get_max_block_eval ( void ) const +{ + if ( _to_be_checked ) + throw Bad_Access ( "Parameters.cpp" , __LINE__ , + "Parameters::get_max_block_eval(), Parameters::check() must be invoked" ); + return _max_block_eval; +} + + // get_max_sim_bb_eval: int NOMAD::Parameters::get_max_sim_bb_eval ( void ) const { @@ -6652,6 +7128,7 @@ void NOMAD::Parameters::set_MODEL_NP1_QUAD_EPSILON ( const NOMAD::Double & d ) _model_params.model_np1_quad_epsilon = d; } + // set_MODEL_SEARCH_MAX_TRIAL_PTS: void NOMAD::Parameters::set_MODEL_SEARCH_MAX_TRIAL_PTS ( int s ) { @@ -6727,8 +7204,8 @@ void NOMAD::Parameters::set_DIRECTION_TYPE_NO_MODEL ( void ) while (it != end) { _direction_types.erase(it); - _direction_types.insert(NOMAD::ORTHO_NP1_NEG); - it=_direction_types.find(NOMAD::ORTHO_NP1_QUAD); + _direction_types.insert( NOMAD::ORTHO_NP1_NEG ); + it=_direction_types.find( NOMAD::ORTHO_NP1_QUAD ); } } @@ -7510,8 +7987,17 @@ void NOMAD::Parameters::set_MAX_BB_EVAL ( int bbe ) _max_bb_eval = ( bbe < 0 ) ? -1 : bbe; } +// set_MAX_BLOCK_EVAL: +void NOMAD::Parameters::set_MAX_BLOCK_EVAL ( int blk ) +{ + _to_be_checked = true; + _max_bbe_decided = true; + _max_block_eval = ( blk <= 0 ) ? -1 : blk; +} -// set_MAX_BB_EVAL: + + +// set_MAX_EVAL_INTENSIFICATION: void NOMAD::Parameters::set_MAX_EVAL_INTENSIFICATION ( int bbe ) { _to_be_checked = true; @@ -7606,7 +8092,7 @@ void NOMAD::Parameters::set_L_CURVE_TARGET ( const NOMAD::Double & lct ) // set_ANISOTROPIC_MESH: void NOMAD::Parameters::set_ANISOTROPIC_MESH ( bool anis ) { - _to_be_checked = true; + _to_be_checked = true; _anisotropic_mesh = anis; } @@ -7913,12 +8399,6 @@ void NOMAD::Parameters::set_MIN_POLL_SIZE ( const NOMAD::Double & d , bool relat _min_poll_size = NOMAD::Point ( _dimension , d ); } -void NOMAD::Parameters::set_LIMIT_MESH_INDEX ( const int & lmi ) -{ - _to_be_checked = true; - _limit_mesh_index = lmi; -} - // set_NEIGHBORS_EXE: void NOMAD::Parameters::set_NEIGHBORS_EXE ( const std::string & ne ) { @@ -8166,6 +8646,124 @@ void NOMAD::Parameters::set_VARIABLE_GROUP } +// SGTELIB +// set & get DIVERSIFICATION +void NOMAD::Parameters::set_SGTELIB_MODEL_DIVERSIFICATION( const NOMAD::Double diversification ) +{ + _sgtelib_model_diversification = diversification; +} + +NOMAD::Double NOMAD::Parameters::get_SGTELIB_MODEL_DIVERSIFICATION( void ) const +{ + return _sgtelib_model_diversification; +} + +// set & get EXCLUSION_AREA +void NOMAD::Parameters::set_SGTELIB_MODEL_EXCLUSION_AREA( const NOMAD::Double tc ) +{ + _sgtelib_model_exclusion_area = tc; +} + +NOMAD::Double NOMAD::Parameters::get_SGTELIB_MODEL_EXCLUSION_AREA( void ) const +{ + return _sgtelib_model_exclusion_area; +} + +// set & get SGTELIB_MODEL_EVAL_NB +void NOMAD::Parameters::set_SGTELIB_MODEL_EVAL_NB( const int me ) +{ + _sgtelib_model_eval_nb = me; +} + +int NOMAD::Parameters::get_SGTELIB_MODEL_EVAL_NB( void ) const +{ + return _sgtelib_model_eval_nb; +} + +// set & get SGTELIB_MODEL_CANDIDATES +void NOMAD::Parameters::set_SGTELIB_MODEL_CANDIDATES_NB( const int cn ) +{ + _sgtelib_model_candidates_nb = cn; +} + +int NOMAD::Parameters::get_SGTELIB_MODEL_CANDIDATES_NB( void ) const +{ + return _sgtelib_model_candidates_nb; +} + + +// set & get SGTELIB_MODEL_TRIALS +void NOMAD::Parameters::set_SGTELIB_MODEL_TRIALS( const int me ) +{ + if (me==-1) + _sgtelib_model_trials = _dimension; + else if (me==-2) + _sgtelib_model_trials = _dimension+1; + else + _sgtelib_model_trials = me; +} + +int NOMAD::Parameters::get_SGTELIB_MODEL_TRIALS( void ) const +{ + return _sgtelib_model_trials; +} + +// set & get SGTELIB_MODEL_DEFINITION +void NOMAD::Parameters::set_SGTELIB_MODEL_DEFINITION( const std::string & md ) +{ + _sgtelib_model_definition = md; +} + +std::string NOMAD::Parameters::get_SGTELIB_MODEL_DEFINITION( void ) const +{ + return _sgtelib_model_definition; +} + +// set & get SGTELIB_MODEL_DISPLAY +void NOMAD::Parameters::set_SGTELIB_MODEL_DISPLAY( const std::string & md ) +{ + _sgtelib_model_display = md; +} + +std::string NOMAD::Parameters::get_SGTELIB_MODEL_DISPLAY( void ) const +{ + return _sgtelib_model_display; +} + +// set & get SGTELIB_MODEL_FILTER +void NOMAD::Parameters::set_SGTELIB_MODEL_FILTER( const std::string & mf ) +{ + _sgtelib_model_filter = mf; +} + +std::string NOMAD::Parameters::get_SGTELIB_MODEL_FILTER( void ) const +{ + return _sgtelib_model_filter; +} + +// set & get SGTELIB_MODEL_FORMULATION +void NOMAD::Parameters::set_SGTELIB_MODEL_FORMULATION( const NOMAD::sgtelib_model_formulation_type dft ) +{ + _sgtelib_model_formulation = dft; +} + +NOMAD::sgtelib_model_formulation_type NOMAD::Parameters::get_SGTELIB_MODEL_FORMULATION (void) const +{ + return _sgtelib_model_formulation; +} + +// set & get SGTELIB_MODEL_FEASIBILITY +void NOMAD::Parameters::set_SGTELIB_MODEL_FEASIBILITY( const NOMAD::sgtelib_model_feasibility_type dft ) +{ + _sgtelib_model_feasibility = dft ; +} + +NOMAD::sgtelib_model_feasibility_type NOMAD::Parameters::get_SGTELIB_MODEL_FEASIBILITY (void) const +{ + return _sgtelib_model_feasibility; +} + + void NOMAD::Parameters::reset_granulary ( void ) { _to_be_checked = true; @@ -8290,8 +8888,8 @@ void NOMAD::Parameters::help ( const std::list<std::string> & pnames,bool develo const char registered_key_basic[]="2N ANGLES AVG BARRIER BASIC BASIC BB_EXE BB_INPUT_TYPE BB_OUTPUT_TYPE BI-MADS BI-OBJECTIVES BIMADS \ - BINARY BIOBJECTIVES BLACK-BOXES BLACKBOXES BOUNDS CACHE BBEVAL CACHE_FILE CNT_EVAL CONSTRAINTS CONTINUOUS COUNT DEBUG DELTA_0 DIMENSION \ - DIRECTION_TYPE DIRECTION_TYPES DIRECTIONS DIRECTIONS_TYPES DIRECTORY DISPLAY_ALL_EVAL DISPLAY_DEGREES DISPLAY_STATS EVALUATIONS \ + BINARY BIOBJECTIVES BLACK-BOXES BLACKBOXES BOUNDS CACHE BBEVAL CACHE_FILE CNT_EVAL CONSTRAINTS CONTINUOUS COUNT DEBUG DELTA_0 DIMENSION \ + DIRECTION_TYPE DIRECTION_TYPES DIRECTIONS DIRECTIONS_TYPES DIRECTORY DISPLAY_ALL_EVAL DISPLAY_DEGREES DISPLAY_STATS EVALUATIONS \ EXECUTABLE F_TARGET FILES FILTER FORMAT GPS h(x) HISTORY_FILE INITIAL_MESH_SIZE INTEGER LATEX LATIN-HYPERCUBE LB LH_SEARCH LOWER_BOUND \ LT LT-MADS LTMADS MADS MAX_BB_EVAL MAX_TIME MAXIMUM MINIMIZE MODEL MODELS MULTI-OBJECTIVE MULTIOBJECTIVES N+1 NUMBER OPTIMIZE ORTHO \ ORTHO-MADS ORTHOMADS OUTPUTS PATH PB PEB POINT POLL PROGRESSIVE-BARRIER RANDOM SAMPLING SCREEN SCREEN SOLUTION_FILE STARTING STATIC \ @@ -8312,7 +8910,8 @@ void NOMAD::Parameters::help ( const std::list<std::string> & pnames,bool develo POLL POLL_UPDATE_BASIS PRECISION PROGRESSIVE-BARRIER PROJECTION PSD-MADS PSDMADS QUAD QUADRATIC RAM RANDOM REALS REGRESSION RHO SAMPLING SCALE SCALING \ SEARCH SEED SGTE_CACHE_FILE SGTE_COST SGTE_EVAL_SORT SGTE_EXE SGTE_ORDERING SGTES SIMULATED SNAP_TO_BOUNDS SPECULATIVE_SEARCH \ STAT_SUM_TARGET STATS STOP_IF_FEASIBLE SUCCESSES SURF SURROGATES TABULATIONS TAU TERMINATES TERMINATION TRIGGER \ - UB UNDEF_STR UNDEFINED USER_CALLS_DISABLED USER_CALLS_ENABLED VARIABLE_GROUP VARIABLES VNS_SEARCH W- W+ "; + UB UNDEF_STR UNDEFINED USER_CALLS_DISABLED USER_CALLS_ENABLED VARIABLE_GROUP VARIABLES VNS_SEARCH W- W+ \ + SGTELIB SGTELIB_MODEL_DEFINITION SGTELIB_MODEL_DIVERSIFICATION SGTELIB_MODEL_SEARCH SGTELIB_MODEL_DISPLAY SGTELIB_MODEL_EVAL_NB SGTELIB_MODEL_CANDIDATES_NB"; const char registered_key_developer[]="BI-MADS BI-OBJECTIVES BIMADS BIOBJECTIVES BLACK-BOXES BLACK-BOXES COMPARISONS DEVELOPER \ DIRECTIONS EPSILON EVALUATIONS FROBENIUS INITIAL_MESH_INDEX IMPROVEMENT INTERPOLATION L_CURVE_TARGET MADS MFN MODEL MODEL_EVAL_SORT_CAUTIOUS MODEL_ORDERING \ @@ -8320,8 +8919,7 @@ void NOMAD::Parameters::help ( const std::list<std::string> & pnames,bool develo MODEL_SEARCH_PROJ_TO_MESH MODELS MULTI_FORMULATION MULTI_USE_DELTA_CRITERION MULTI-OBJECTIVES \ MULTIOBJECTIVES N+1 NP1 OBJECTIVE OPPORTUNISTIC_LUCKY_EVAL OPPORTUNISTIC_MIN_F_IMPRVMT OPPORTUNISTIC_MIN_NB_SUCCESSES OPT_ONLY_SGTES \ ORTHO PARETO PB PEB POLL PRECISION PROGRESSIVE-BARRIER PROJECTION QUAD QUADRATIC REALS REGRESSION SEC_POLL_DIR_TYPES SGTES STOPPING \ - SUCCESSES SURROGATES TERMINATES TERMINATION MESH_TYPE WELL-POISEDNESS " ; - + SUCCESSES SURROGATES TERMINATES TERMINATION MESH_TYPE WELL-POISEDNESS SGTELIB SGTELIB_MODEL_FORMULATION SGTELIB_MODEL_FILTER SGTELIB_MODEL_CANDIDATES_NB SGTELIB_MODEL_TRIALS SGTELIB_MODEL_EXCLUSION_AREA SGTELIB_MODEL_FEASIBILITY "; if ( display_all || NOMAD::string_find ( registered_key_basic, param_names ) ) @@ -8485,7 +9083,7 @@ void NOMAD::Parameters::help ( const std::list<std::string> & pnames,bool develo param_names ) ) { _out << std::endl - << NOMAD::open_block ( "DIRECTION_TYPE (basic)" ) << std::endl + << NOMAD::open_block ( "DIRECTION_TYPE (basic)" ) << std::endl << ". types of directions used in the poll step" << std::endl << ". arguments: direction types (see user" << std::endl << " guide for available types)" << std::endl @@ -8493,10 +9091,14 @@ void NOMAD::Parameters::help ( const std::list<std::string> & pnames,bool develo << " (n+1)th dir)." << std::endl << ". several direction types can be defined" << std::endl << " at the same time (one direction per line)" << std::endl - << ". " << NOMAD::open_block ( "examples" ) << std::endl + << ". in the examples below the directions with " << std::endl + << " the (*) are available only when using a parameter " << std::endl + << " file but not when using the set_DIRECTION_TYPE " << std::endl + << " command in library mode " << std::endl + << ". " << NOMAD::open_block ( "examples" ) << std::endl << "DIRECTION_TYPE ORTHO 1 # OrthoMADS, 1" << std::endl << "DIRECTION_TYPE ORTHO 2 # OrthoMADS, 2" << std::endl - << "DIRECTION_TYPE ORTHO N+1 # OrthoMADS, n+1" << std::endl + << "DIRECTION_TYPE ORTHO N+1 #(*) OrthoMADS, n+1" << std::endl << " # (QUAD model used"<< std::endl << " # for (n+1)th dir)"<< std::endl << "DIRECTION_TYPE ORTHO N+1 QUAD # OrthoMADS, n+1" << std::endl @@ -8510,15 +9112,15 @@ void NOMAD::Parameters::help ( const std::list<std::string> & pnames,bool develo << " # uniform " << std::endl << " # distribution of" << std::endl << " # dirs)" << std::endl - << "DIRECTION_TYPE ORTHO # OrthoMADS, n+1 QUAD " << std::endl + << "DIRECTION_TYPE ORTHO #(*) OrthoMADS, n+1 QUAD " << std::endl << "DIRECTION_TYPE ORTHO 2N # OrthoMADS, 2n" << std::endl << "DIRECTION_TYPE LT 1 # LT-MADS, 1" << std::endl << "DIRECTION_TYPE LT 2 # LT-MADS, 2" << std::endl << "DIRECTION_TYPE LT N+1 # LT-MADS, n+1" << std::endl - << "DIRECTION_TYPE LT # LT-MADS, 2n" << std::endl + << "DIRECTION_TYPE LT #(*) LT-MADS, 2n" << std::endl << "DIRECTION_TYPE LT 2N # LT-MADS, 2n" << std::endl << "DIRECTION_TYPE GPS BINARY or BIN # GPS, bin var" << std::endl - << "DIRECTION_TYPE GPS N+1 # GPS, n+1," << std::endl + << "DIRECTION_TYPE GPS N+1 #(*) GPS, n+1," << std::endl << " # static" << std::endl << "DIRECTION_TYPE GPS N+1 STATIC # GPS, n+1," << std::endl << " # static" << std::endl @@ -8528,7 +9130,7 @@ void NOMAD::Parameters::help ( const std::list<std::string> & pnames,bool develo << " # rand" << std::endl << "DIRECTION_TYPE GPS N+1 RAND UNIFORM # GPS, n+1," << std::endl << " # rand, unif" << std::endl - << "DIRECTION_TYPE GPS # GPS, 2n," << std::endl + << "DIRECTION_TYPE GPS #(*) GPS, 2n," << std::endl << " # static" << std::endl << "DIRECTION_TYPE GPS 2N # GPS, 2n," << std::endl << " # static" << std::endl @@ -9120,7 +9722,7 @@ void NOMAD::Parameters::help ( const std::list<std::string> & pnames,bool develo if ( display_all || NOMAD::string_find ( "MODEL DISABLE MODELS DISABLE_MODELS \ MODEL_EVAL_SORT ADVANCED \ EVAL_SORT \ - ORTHO N+1 QUAD QUADRATIC MODEL_SEARCH" , + ORTHO N+1 QUAD QUADRATIC MODEL_SEARCH SGTELIB" , param_names ) ) { _out << std::endl @@ -9145,6 +9747,230 @@ void NOMAD::Parameters::help ( const std::list<std::string> & pnames,bool develo } + + // SGTELIB_MODEL_DIVERSIFICATION: + // ----------------- + if ( display_all || NOMAD::string_find ( "SGTELIB_MODEL_DIVERSIFICATION DIVERSIFICATION LAMBDA MODEL SGTELIB MODEL_SEARCH ADVANCED" , param_names ) ) + { + _out << std::endl + << NOMAD::open_block ( "SGTELIB_MODEL_DIVERSIFICATION (advanced)" ) << std::endl + << ". coefficient of the exploration term in the " << std::endl + << " surrogate problem." << std::endl + << ". argument: one positive real" << std::endl + << ". default: 0.01" << std::endl + << ". example: SGTELIB_MODEL_DIVERSIFICATION 0 # no exploration" << std::endl + << " SGTELIB_MODEL_DIVERSIFICATION 0.01 # light exploration" << std::endl + << " SGTELIB_MODEL_DIVERSIFICATION 0.1 # medium exploration" << std::endl + << " SGTELIB_MODEL_DIVERSIFICATION 1 # strong exploration" << std::endl + << NOMAD::close_block(); + chk = true; + } + + // SGTELIB_MODEL_TRIALS: + // ----------------------- + if ( display_all || NOMAD::string_find ( "SGTELIB_MODEL_TRIALS MODEL SGTELIB MODEL_SEARCH ADVANCED" , param_names ) ) + { + _out << std::endl + << NOMAD::open_block ( "SGTELIB_MODEL_TRIALS (advanced)" ) << std::endl + << ". max number of sgtelib model trials for each search." << std::endl + << ". argument: one integer > 0" << std::endl + << ". default: 1" << std::endl + << ". example: SGTELIB_MODEL_TRIALS 5000 " << std::endl + << NOMAD::close_block(); + chk = true; + } + + // SGTELIB_MODEL_DEFINITION: + // -------------------------------- + if ( display_all || NOMAD::string_find ( "SGTELIB_MODEL_DEFINITION SGTELIB SEARCH MODEL_SEARCH MODEL MODELS INTERPOLATION REGRESSION ADVANCED" , param_names ) ) + { + _out << std::endl + << NOMAD::open_block ( "SGTELIB_MODEL_DEFINITION (advanced)" ) << std::endl + << ". definition of the surrogate model." << std::endl + << ". argument: Sgtelib model definition. See sgtelib manual." << std::endl + << ". default: TYPE LOWESS DEGREE 1 KERNEL_SHAPE OPTIM KERNEL_COEF OPTIM RIDGE 0 METRIC AOECV" << std::endl + << ". example: TYPE PRS DEGREE 1 # builds a linear model" << std::endl + << ". TYPE PRS DEGREE 2 # builds a quadratic model" << std::endl + << ". TYPE RBF # builds an RBF model" << std::endl + << ". TYPE ENSEMBLE # builds an ensemble of models " << std::endl + << ". TYPE LOWESS DEGREE 1 KERNEL_COEF OPTIM # builds a lowess model with " << std::endl + << " local linear regression " << std::endl + << " and optimized kernel shape" << std::endl + << NOMAD::close_block(); + chk = true; + } + + // SGTELIB_MODEL_DISPLAY: + // -------------------------------- + if ( display_all || NOMAD::string_find ( "SGTELIB_MODEL_DISPLAY ADVANCED SGTELIB DISPLAY SEARCH MODEL_SEARCH" , param_names ) ) + { + _out << std::endl + << NOMAD::open_block ( "SGTELIB_MODEL_DISPLAY (advanced)" ) << std::endl + << ". control the display of the sgtelib model search" << std::endl + << ". arguments: a string containing one or several of the following letters " << std::endl + << ". \"S\": General information on the sgtelib model search" << std::endl + << ". \"F\": Details of the filter step" << std::endl + << ". \"O\": Details of the models optimization" << std::endl + << ". \"P\": Details of the projection" << std::endl + << ". \"U\": Details of the model update" << std::endl + << ". \"I\": Advancement of the model optimization" << std::endl + << ". \"X\": Display of all of the model evaluations" << std::endl + << ". default: empty string (no display)" << std::endl + << ". example: SGTELIB_MODEL_DISPLAY SPF # display the general information on the search " << std::endl + << " and on the filter and projection steps " << std::endl + << NOMAD::close_block(); + chk = true; + } + + + + + + + + + // SGTELIB_MODEL_CANDIDATES_NB: + // ----------------------- + if ( developer && (display_all || NOMAD::string_find ( "SGTELIB_MODEL_CANDIDATES_NB MODEL SGTELIB MODEL_SEARCH DEVELOPER" , param_names ) ) ) + { + _out << std::endl + << NOMAD::open_block ( "SGTELIB_MODEL_CANDIDATES_NB (advanced)" ) << std::endl + << ". number of candidates returned by the sgtelib model search." << std::endl + << ". argument: one integer" << std::endl + << ". if smaller or equal to 0, then the number of candidates" << std::endl + << " will be the MAX_BLOCK_SIZE " << std::endl + << ". default: -1" << std::endl + << ". example: SGTELIB_MODEL_CANDIDATES_NB 8" << std::endl + << NOMAD::close_block(); + chk = true; + } + + + // SGTELIB_MODEL_TRIALS: + // ----------------------- + if ( developer && (display_all || NOMAD::string_find ( "SGTELIB_MODEL_TRIALS TRIALS DEVELOPER SGTELIB MODEL SEARCH" , param_names ) ) ) + { + _out << std::endl + << NOMAD::open_block ( "SGTELIB_MODEL_TRIALS (advanced)" ) << std::endl + << ". max number of sgtelib model search failures before going to the poll step." << std::endl + << ". argument: one integer > 0 or 'N' (==> dim trials) or 'S' (==> dim+1 trials" << std::endl + << ". default: 1" << std::endl + << ". example: SGTELIB_MODEL_TRIALS 5 " << std::endl + << NOMAD::close_block(); + chk = true; + } + + + // SGTELIB_MODEL_FORMULATION: + // --------------- + if ( developer && (display_all || NOMAD::string_find ( "SGTELIB_MODEL_FORMULATION SURROGATE_PROBLEM PROBLEM EXPECTED_IMPROVEMENT EXPECTED IMPROVEMENT FS EI EFI LAMBDA DIVERSIFICATION MODEL SGTELIB MODEL_SEARCH DEVELOPER" , param_names ) ) ) + { + _out << std::endl + << NOMAD::open_block ( "SGTELIB_MODEL_FORMULATION (advanced)" ) << std::endl + << ". formulation of the surrogate problem. " << std::endl + << ". argument: one string in {\'FS\', \'EIS\', \'FSP\'," << std::endl + << " \'EFI\', \'EFIS\',\'EFIM\',\'EFIC\'," << std::endl + << " \'PFI\'," << std::endl + << " \'D\'," << std::endl + << " \'EXTERN\'}" << std::endl + << ". description of the surrogate problem formulations : " << std::endl + << " (FS) min f -d.sigma_f " << std::endl + << " st c_j -d.sigma_j <= 0 " << std::endl + << " " << std::endl + << " (EIS) min -EI -d.sigma_f " << std::endl + << " st c_j -d.sigma_j <= 0 " << std::endl + << " " << std::endl + << " (FSP) min f -d.sigma_f " << std::endl + << " st P >= 1/2 " << std::endl + << " " << std::endl + << " (EFI) min -EFI " << std::endl + << " " << std::endl + << " (EFIS) min -EFI -d.sigma_f " << std::endl + << " " << std::endl + << " (EFIM) min -EFI -d.sigma_f.mu " << std::endl + << " " << std::endl + << " (EFIM) min -EFI -d.(EI.mu+P.sigma_f) " << std::endl + << " " << std::endl + << " (PFI) min -PFI " << std::endl + << " " << std::endl + << " (D) min -distance_to_closest " << std::endl + << " " << std::endl + << ". default: FS " << std::endl + << ". example: SGTELIB_MODEL_FORMULATION EFI" << std::endl + << NOMAD::close_block(); + chk = true; + } + + + // SGTELIB_MODEL_FILTER: + // -------------------------------- + if ( developer && (display_all || NOMAD::string_find ( "SGTELIB_MODEL_FILTER DEVELOPER SGTELIB FILTER SEARCH MODEL_SEARCH" , param_names ) ) ) + { + _out << std::endl + << NOMAD::open_block ( "SGTELIB_MODEL_FILTER (advanced)" ) << std::endl + << ". methods used in the sgtelib search filter to return several" << std::endl + << " search candidates" << std::endl + << ". arguments: a string containing several integers from 0 to 5" << std::endl + << ". default: 2345" << std::endl + << ". method 0: Select the best candidate" << std::endl + << ". method 1: Select the most remote candidate" << std::endl + << ". method 2: Select the best candidate, " << std::endl + << " with minimal distance to the cache" << std::endl + << ". method 3: Select the best candidate, " << std::endl + << " with minimal margin in feasibility" << std::endl + << ". method 4: Select the candidate with the best" << std::endl + << " isolation number" << std::endl + << ". method 5: Select the candidate with the best" << std::endl + << " density number" << std::endl + << ". example: SGTELIB_MODEL_FILTER 0 # Only method 0 will be used" << std::endl + << " SGTELIB_MODEL_FILTER 01 # Alternate between method 0 and 1" << std::endl + << " SGTELIB_MODEL_FILTER 2345 # Cycle through methods 2, 3, 4 and 5" << std::endl + << NOMAD::close_block(); + chk = true; + } + + + + // SGTELIB_MODEL_EXCLUSION_AREA: + // -------------------------------- + if ( developer && (display_all || NOMAD::string_find ( "SGTELIB_MODEL_FILTER DEVELOPER SGTELIB EXCLUSION SEARCH MODEL_SEARCH" , param_names ) ) ) + { + _out << std::endl + << NOMAD::open_block ( "SGTELIB_MODEL_EXCLUSION_AREA (advanced)" ) << std::endl + << ". defines an exclusion area for the sgtelib model search" << std::endl + << " around points of the cache" << std::endl + << ". arguments: one real number in [0;1/2]" << std::endl + << ". default: 0" << std::endl + << ". example: SGTELIB_MODEL_EXCLUSION_AREA 0 # no exclusion area" << std::endl + << " SGTELIB_MODEL_EXCLUSION_AREA 0.1 # small exclusion area" << std::endl + << " SGTELIB_MODEL_EXCLUSION_AREA 0.5 # large exclusion area" << std::endl + << NOMAD::close_block(); + chk = true; + } + + + + // SGTELIB_MODEL_FEASIBILITY: + // --------------------------- + if ( developer && (display_all || NOMAD::string_find ( "SGTELIB_MODEL_FEASIBILITY FEASIBILITY CONSTRAINTS \ + SGTELIB_MODEL_SEARCH DT SGTELIB MODEL_SEARCH \ + MODEL MODELS \ + INTERPOLATION REGRESSION DEVELOPER" , param_names ) ) ) + { + _out << std::endl + << NOMAD::open_block ( "SGTELIB_MODEL_FEASIBILITY (advanced)" ) << std::endl + << ". method used to model the feasibility of a points." << std::endl + << ". arguments: one character in {\'C\', \'H\', \'M\', \'P\'}" << std::endl + << ". default: C" << std::endl + << ". example: SGTELIB_MODEL_FEASIBILITY C # 1 model per constraint" << std::endl + << " SGTELIB_MODEL_FEASIBILITY H # 1 model of the aggregate constraint" << std::endl + << " SGTELIB_MODEL_FEASIBILITY M # 1 model of the max of the constraints" << std::endl + << " SGTELIB_MODEL_FEASIBILITY B # 1 binary model of the feasibility" << std::endl + << NOMAD::close_block(); + chk = true; + } + + // BB_MAX_BLOCK_SIZE //----------- if ( display_all || NOMAD::string_find ( "EVAL LIST MAX BLOCK SIZE BB BLACKBOX \ @@ -9152,20 +9978,20 @@ void NOMAD::Parameters::help ( const std::list<std::string> & pnames,bool develo param_names ) ) { _out << std::endl - << NOMAD::open_block ( "BB_MAX_BLOCK_SIZE (advanced)" ) << std::endl - << ". maximum size of a block of evaluations send to the blackbox" << std::endl - << " executable at once. Blackbox executable can manage parallel" << std::endl - << " evaluations on its own. Opportunistic strategies may apply after" << std::endl + << NOMAD::open_block ( "BB_MAX_BLOCK_SIZE (advanced)" ) << std::endl + << ". maximum size of a block of evaluations send to the blackbox" << std::endl + << " executable at once. Blackbox executable can manage parallel" << std::endl + << " evaluations on its own. Opportunistic strategies may apply after" << std::endl << " each block of evaluations." << std::endl << " Depending on the algorithm phase, the blackbox executable will" << std::endl - << " receive at most BB_MAX_BLOCK_SIZE points to evaluate." << std::endl + << " receive at most BB_MAX_BLOCK_SIZE points to evaluate." << std::endl << " When this parameter is greater than one, the number of evaluations"<< std::endl << " may exceed the MAX_BB_EVAL stopping criterion." << std::endl << ". argument: integer > 0" << std::endl << ". example: BB_MAX_BLOCK_SIZE 3," << std::endl << " The blackbox executable receives blocks of" << std::endl - << " at most 3 points for evaluation." << std::endl - << ". default: 1" << std::endl + << " at most 3 points for evaluation." << std::endl + << ". default: 1" << std::endl << NOMAD::close_block(); chk = true; } @@ -9306,7 +10132,7 @@ void NOMAD::Parameters::help ( const std::list<std::string> & pnames,bool develo // HAS_SGTE: // --------- if ( display_all || NOMAD::string_find ( "HAS_SGTE SGTE_EXE ADVANCED SURROGATES \ - BLACK-BOXES BLACKBOXES \ + BLACK-BOXES BLACKBOXES \ SGTES" , param_names ) ) { _out << std::endl @@ -9362,7 +10188,7 @@ void NOMAD::Parameters::help ( const std::list<std::string> & pnames,bool develo // MAX_CONSECUTIVE_FAILED_ITERATIONS: // ---------------------------------- if ( display_all || NOMAD::string_find ( "MAX_CONSECUTIVE_FAILED_ITERATIONS ADVANCED \ - TERMINATION STOPPING TERMINATES" , param_names ) ) + TERMINATION STOPPING TERMINATES" , param_names ) ) { _out << std::endl << NOMAD::open_block ( "MAX_CONSECUTIVE_FAILED_ITERATIONS (advanced)" ) << std::endl @@ -9459,8 +10285,8 @@ void NOMAD::Parameters::help ( const std::list<std::string> & pnames,bool develo { _out << std::endl << NOMAD::open_block ( "MESH_COARSENING_EXPONENT (advanced)" ) << std::endl - << ". mesh coarsening exponent w^+ used to update the mesh" << std::endl - << " after successes (\\Delta^m_{k+1}=\\tau^{w^+}\\Delta^m_k)" << std::endl + << ". mesh coarsening exponent w^+ used to update the xmesh or gmesh" << std::endl + << " after successes (\\delta_{k+1}=\\tau^{w^+}\\delta_k)" << std::endl << ". argument: one nonnegative integer" << std::endl << ". default: 1" << std::endl << ". example: MESH_COARSENING_EXPONENT 0 # the mesh size is" << std::endl @@ -9477,8 +10303,8 @@ void NOMAD::Parameters::help ( const std::list<std::string> & pnames,bool develo { _out << std::endl << NOMAD::open_block ( "MESH_REFINING_EXPONENT (advanced)" ) << std::endl - << ". mesh refining exponent w^- used to update the mesh" << std::endl - << " after failures (\\Delta^m_{k+1} = \\tau^{w^-}\\Delta^m_k)" << std::endl + << ". mesh refining exponent w^- used to update the xmesh or smesh" << std::endl + << " after failures (\\delta_{k+1} = \\tau^{w^-}\\delta_k)" << std::endl << ". argument: one negative" << std::endl << ". default: -1" << std::endl << ". example: MESH_REFINING_EXPONENT -2" << std::endl @@ -9486,6 +10312,23 @@ void NOMAD::Parameters::help ( const std::list<std::string> & pnames,bool develo chk = true; } + // MESH_TYPE: + // ------------------- + if ( display_all || NOMAD::string_find ( "MESH_TYPE XMESH GMESH SMESH MESH ADVANCED \ + ANISO" , param_names ) ) + { + + _out << std::endl + << NOMAD::open_block ( "MESH_TYPE (advanced)" ) << std::endl + << ". forces the use of a specific type of mesh (xmesh, gmesh, smesh))" << std::endl + << ". arguments: XMESH, GMESH or SMESH" << std::endl + << ". default: GMESH" << std::endl + << ". example: MESH_TYPE GMESH " << std::endl + << NOMAD::close_block(); + chk = true; + } + + // MESH_UPDATE_BASIS: // ------------------ if ( display_all || NOMAD::string_find ( "MESH_UPDATE_BASIS ADVANCED \ @@ -9542,18 +10385,19 @@ void NOMAD::Parameters::help ( const std::list<std::string> & pnames,bool develo // ---------------- if ( display_all || NOMAD::string_find ( "MODEL_ORDERING MODEL_EVAL_SORT ADVANCED \ MODELS INTERPOLATION REGRESSION \ - MFN FROBENIUS QUADRATIC" , param_names ) ) + MFN FROBENIUS QUADRATIC SGTELIB" , param_names ) ) { _out << std::endl - << NOMAD::open_block ( "MODEL_EVAL_SORT (advanced)" ) << std::endl + << NOMAD::open_block ( "MODEL_EVAL_SORT (advanced)" ) << std::endl << ". if models are used to sort the trial points" << std::endl << ". disabled for more than 50 variables" << std::endl << ". disabled with categorical variables" << std::endl << ". argument: one boolean (\'yes\' or \'no\')" << std::endl - << " or one string in {\'QUADRATIC\'}" << std::endl + << " or one string in {\'QUADRATIC\', \'SGTELIB\'}" << std::endl << ". default: \'QUADRATIC\'" << std::endl << ". examples: MODEL_EVAL_SORT quadratic" << std::endl - << " MODEL_EVAL_SORT yes # quadratic is used" << std::endl + << " MODEL_EVAL_SORT yes # quadratic is used" << std::endl + << " MODEL_EVAL_SORT SGTELIB" << std::endl << " MODEL_EVAL_SORT no # no MES" << std::endl << NOMAD::close_block(); chk = true; @@ -9564,7 +10408,7 @@ void NOMAD::Parameters::help ( const std::list<std::string> & pnames,bool develo // ------------- if ( display_all || NOMAD::string_find ( "MODEL_SEARCH ADVANCED CATEGORICAL \ MODELS INTERPOLATION REGRESSION \ - MFN FROBENIUS QUADRATIC PARALLEL" , param_names ) ) + MFN FROBENIUS QUADRATIC PARALLEL SGTELIB" , param_names ) ) { _out << std::endl << NOMAD::open_block ( "MODEL_SEARCH (advanced)" ) << std::endl @@ -9574,9 +10418,10 @@ void NOMAD::Parameters::help ( const std::list<std::string> & pnames,bool develo << ". disabled with categorical variables" << std::endl << ". disabled in parallel mode" << std::endl << ". argument: one boolean (\'yes\' or \'no\')" << std::endl - << " or one string in {\'QUADRATIC\'}" << std::endl + << " or one string in {\'QUADRATIC\', \'SGTELIB\'}" << std::endl << ". default: \'QUADRATIC\'" << std::endl << ". example: MODEL_SEARCH QUADRATIC" << std::endl + << " MODEL_SEARCH SGTELIB" << std::endl << NOMAD::close_block(); chk = true; } @@ -9587,8 +10432,8 @@ void NOMAD::Parameters::help ( const std::list<std::string> & pnames,bool develo // ------------------------ if ( display_all || NOMAD::string_find ( "MODEL_SEARCH_OPTIMISTIC ADVANCED \ MODELS INTERPOLATION REGRESSION \ - MFN FROBENIUS QUADRATIC " - , param_names ) ) + MFN FROBENIUS QUADRATIC \ + SGTELIB" , param_names ) ) { _out << std::endl << NOMAD::open_block ( "MODEL_SEARCH_OPTIMISTIC (advanced)" ) << std::endl @@ -9837,7 +10682,7 @@ void NOMAD::Parameters::help ( const std::list<std::string> & pnames,bool develo // RHO: // ---- if ( display_all || NOMAD::string_find ( "RHO ADVANCED MADS CONSTRAINTS \ - PROGRESSIVE-BARRIER PB PEB \ + PROGRESSIVE-BARRIER PB PEB \ FILTER TRIGGER" , param_names ) ) { _out << std::endl @@ -10315,8 +11160,8 @@ void NOMAD::Parameters::help ( const std::list<std::string> & pnames,bool develo // -------------------------- if ( developer && ( display_all || NOMAD::string_find ( "MODEL_SEARCH_PROJ_TO_MESH DEVELOPER \ MODELS INTERPOLATION REGRESSION \ - MFN FROBENIUS QUADRATIC PROJECTION " , - param_names ) ) ) + MFN FROBENIUS QUADRATIC PROJECTION \ + SGTELIB" , param_names ) ) ) { _out << std::endl << NOMAD::open_block ( "MODEL_SEARCH_PROJ_TO_MESH (developer)" ) << std::endl @@ -10360,7 +11205,7 @@ void NOMAD::Parameters::help ( const std::list<std::string> & pnames,bool develo << " (n+1)-th direction is determined within a truncated " << std::endl << " unit hypercube ]epsilon;1[^n defined by the first " << std::endl << " n-th directions. The truncation is on lower limit " << std::endl - << " and is defined with a single argument (epsilon)." << std::endl + << " and is defined with a single argument (epsilon)." << std::endl << ". argument: real in ]0;1[" << std::endl << ". default: 0.01" << std::endl << NOMAD::close_block(); @@ -10467,7 +11312,7 @@ void NOMAD::Parameters::help ( const std::list<std::string> & pnames,bool develo // OPT_ONLY_SGTE: // -------------- if (developer && ( display_all || NOMAD::string_find ( "OPT_ONLY_SGTES DEVELOPER SURROGATES \ - BLACK-BOXES BLACKBOXES \ + BLACK-BOXES BLACKBOXES \ SGTES" , param_names ) ) ) { @@ -10498,23 +11343,38 @@ void NOMAD::Parameters::help ( const std::list<std::string> & pnames,bool develo << NOMAD::close_block(); chk = true; } - - // MESH_TYPE: + + // ROBUST_MADS // ------------------- - if ( developer && ( display_all || NOMAD::string_find ( "MESH_TYPE XMESH SMESH MESH \ - ANISO" , param_names ) ) ) + if ( developer && ( display_all || NOMAD::string_find ( "ROBUST_MADS ROBUST SMOOTHING" , param_names ) ) ) { _out << std::endl - << NOMAD::open_block ( "MESH_TYPE (developer)" ) << std::endl - << ". forces the use of a specific type of mesh (xmesh, smesh))" << std::endl - << ". arguments: X or S" << std::endl - << ". default: X" << std::endl - << ". example: MESH_TYPE X " << std::endl + << NOMAD::open_block ( "ROBUST_MADS (developer)" ) << std::endl + << ". use the robust mads algorithm for smoothing the objective function" << std::endl + << ". on new evaluated points and cache points." << std::endl + << ". the algorihtm works only on single objective w/o constraints" << std::endl + << ". default: false" << std::endl + << ". example: ROBUST_MADS true " << std::endl << NOMAD::close_block(); chk = true; } + // ROBUST_MADS_STANDARD_DEV_FACTOR + // ------------------- + if ( developer && ( display_all || NOMAD::string_find ( "ROBUST_MADS_STANDARD_DEV_FACTOR STANDARD_DEV SMOOTHING ROBUST" , param_names ) ) ) + { + + _out << std::endl + << NOMAD::open_block ( "ROBUST_MADS_STANDARD_DEV_FACTOR (developer)" ) << std::endl + << ". the standard deviation factor in the robust mads algorithm " << std::endl + << ". controls the weight of the points in the objective function smoothing." << std::endl + << ". default: 2" << std::endl + << ". example: ROBUST_MADS_STANDARD_DEV_FACTOR 2 " << std::endl + << NOMAD::close_block(); + chk = true; + } + // last display: if ( !chk && developer) diff --git a/src/Parameters.hpp b/src/Parameters.hpp index cf8e370c71e6a7435f0cac3e20946abed01b2f29..8fba004015779f2e534f43099115cbd9f0336119 100644 --- a/src/Parameters.hpp +++ b/src/Parameters.hpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Parameters.hpp \brief NOMAD Parameters (headers) @@ -171,8 +173,6 @@ namespace NOMAD { const std::string & s_seed , std::string & file_name ); - - /// Check if a specified direction type is set. /** \param dt The specified direction type -- \b IN. @@ -252,8 +252,8 @@ namespace NOMAD { /// Display parameter help. /** For a list of parameters. - \param param_names_list List of parameter names -- \b IN. - \param developer Bool to request developer help (defaut=false) -- \b IN. + \param param_names_list List of parameter names -- \b IN. + \param developer Bool to request developer help (defaut=false) -- \b IN. */ void help ( const std::list<std::string> & param_names_list , bool developer=false) const; @@ -307,6 +307,13 @@ namespace NOMAD { */ void display ( void ) const { display ( _out ); } + /// Reset the display for warning. + /** + \return void. + */ + static void reset_display_warning ( ){ _warning_has_been_displayed = false ;} + + /*--------------------------------------------------------------*/ /* Attributes and methods listed by categories */ /*--------------------------------------------------------------*/ @@ -319,6 +326,21 @@ namespace NOMAD { int _seed; ///< Seed. int _max_eval; ///< Maximum number of evaluations. int _max_bb_eval; ///< Maximum number of blackbox evaluations. + + // Report blackbox evaluation number for sub-algos (VNS,ExtendedPoll) on display stat + // (if false the number of eval is not reported and a symbol "+" is displayed + bool _report_bbe_value; ///< Parameter \c REPORT_BBE_VALUE + + // Report surrogate evaluation number for sub-algos (VNS,ExtendedPoll) on display stat + // (if false the number of eval is not reported and a symbol "+" is displayed + bool _report_sgte_value; ///< Parameter \c REPORT_SGTE_VALUE + + + // Report block evaluation number for sub-algos (VNS, ExtendedPoll) on display stat + // (if false the number of eval is not reported and a symbol "+" is displayed + bool _report_blk_eva_value; ///< Parameter \c REPORT_BLK_EVA_VALUE + + int _max_block_eval; ///< Maximum number of block evaluations. std::list<std::string> _display_stats; ///< Stats keywords for \c DISPLAY_STATS. bool _display_all_eval; ///< Parameter \c DISPLAY_ALL_EVAL @@ -419,6 +441,12 @@ namespace NOMAD { */ int get_max_bb_eval ( void ) const; + /// Access to the \c MAX_BLOCk_EVAL parameter. + /** + \return The \c MAX_BLOCK_EVAL parameter. + */ + int get_max_block_eval ( void ) const; + /// Access to the \c INTENSITIFICATION_TYPE parameter. /** \return The \c INTENSIFICATION_TYPE parameter. @@ -431,7 +459,6 @@ namespace NOMAD { */ int get_max_eval_intensification ( void ) const { return _max_eval_intensification ; } - /// Access to the \c MAX_TIME parameter. /** \return The \c MAX_TIME parameter. @@ -510,6 +537,27 @@ namespace NOMAD { */ bool get_asynchronous ( void ) const; + + /// Access to the \c REPORT_BBE_VALUE parameter. + /** + \return The \c REPORT_BBE_VALUE parameter. + */ + bool get_report_bbe_value ( void ) const; + + /// Access to the \c REPORT_SGTE_VALUE parameter. + /** + \return The \c REPORT_SGTE_VALUE parameter. + */ + bool get_report_sgte_value ( void ) const; + + + /// Access to the \c REPORT_BLK_EVA_VALUE parameter. + /** + \return The \c REPORT_BLK_EVA_VALUE parameter. + */ + bool get_report_blk_eva_value ( void ) const; + + /// Set the \c POINT_DISPLAY_LIMIT parameter. /** \param dl The \c POINT_DISPLAY_LIMIT parameter -- \b IN. @@ -600,6 +648,12 @@ namespace NOMAD { */ void set_MAX_BB_EVAL ( int bbe ); + /// Set the \c MAX_BLOCK_EVAL parameter. + /** + \param blk The \c MAX_BLOCK__EVAL parameter -- \b IN. + */ + void set_MAX_BLOCK_EVAL ( int blk ); + /// Set the \c MAX_EVAL_INTENSIFICATION parameter. /** \param bbe The \c MAX_EVAL_INTENSIFICATION parameter -- \b IN. @@ -1167,14 +1221,13 @@ namespace NOMAD { // ----- private: - NOMAD::mesh_type _mesh_type; ///< The type of mesh used (xmesh [D], smesh [old] ) - bool _anisotropic_mesh; ///< Anisotropic mesh (xmesh only) + NOMAD::mesh_type _mesh_type; ///< The type of mesh used (xmesh [D], gmesh, smesh [old] ) + bool _anisotropic_mesh; ///< Anisotropic mesh (gmesh, xmesh only) NOMAD::Double _mesh_update_basis; ///< Mesh update basis (tau). NOMAD::Double _poll_update_basis; ///< Poll update basis (beta). int _mesh_coarsening_exponent; ///< Mesh coarsening exponent. int _mesh_refining_exponent; ///< Mesh refining exponent. int _initial_mesh_index; ///< Initial mesh index (ell_0). - int _limit_mesh_index; ///< Limit value of mesh index. NOMAD::Point _initial_mesh_size; ///< Initial (absolute) mesh size (delta^0). NOMAD::Point _min_mesh_size; ///< Minimal (absolute) mesh size (delta_min). NOMAD::Point _initial_poll_size; ///< Initial (absolute) poll size (delta^0). @@ -1190,7 +1243,6 @@ namespace NOMAD { */ bool get_anisotropic_mesh ( void ) const; - /// Access to the \c MESH_TYPE parameter. /** \return The \c MESH_TYPE parameter -- \b IN. @@ -1418,20 +1470,12 @@ namespace NOMAD { */ void set_INITIAL_POLL_SIZE ( const NOMAD::Point & ims , bool relative = false ); - - /// Set the \c LIMIT_MESH_INDEX parameter. - /** - \param lmi Limit mesh index -- \b IN. - */ - void set_LIMIT_MESH_INDEX ( const int & lmi ); - - - + // Granular variables: // ------------------- private: - NOMAD::Point _granularity; ///< Granularity. + NOMAD::Point _granularity; ///< Granularity. public: @@ -2654,6 +2698,206 @@ namespace NOMAD { */ void set_OPPORTUNISTIC_LUCKY_EVAL ( bool opp_lucky_eval ); + // RobustMads parameters + // ---------------------------------- + private: + bool _robust_mads; ///< Run robust mads or regular mads + NOMAD::Double _robust_mads_standard_dev_factor; ///< Parameter for smoothing in robust mads + + public: + /// Access to the \c _robust_mads parameter. + /** + \return The \c robust_mads parameter. + */ + bool get_robust_mads ( void ) const + { + return _robust_mads; + } + + /// Set the \c ROBUST_MADS parameter. + /** + \param robust_mads The \c ROBUST_MADS parameter -- \b IN. + */ + void set_ROBUST_MADS ( bool robust_mads ) + { + _robust_mads = robust_mads; + } + + /// Access to the \c _robust_mads_variance parameter. + /** + \return The \c robust_mads_variance parameter. + */ + NOMAD::Double get_robust_mads_standard_dev_factor ( void ) const + { + return _robust_mads_standard_dev_factor; + } + + /// Set the \c ROBUST_MADS_STANDARD_DEV_FACTOR parameter. + /** + \param beta The \c ROBUST_MADS_STANDARD_DEV_FACTOR parameter -- \b IN. + */ + void set_ROBUST_MADS_STANDARD_DEV_FACTOR ( NOMAD::Double beta ) + { + _robust_mads_standard_dev_factor = beta; + } + + + + // SGTELIB parameters + // ---------------------------------- + private: + + /// Number of evaluation of the model during each sgtelib_model-search step. + int _sgtelib_model_eval_nb; + int _sgtelib_model_candidates_nb; + int _sgtelib_model_trials; + + std::string _sgtelib_model_definition; + + std::string _sgtelib_model_display; + std::string _sgtelib_model_filter; + + /// Coefficient of the diversification term in the surrogate problem. + NOMAD::Double _sgtelib_model_diversification; + + /// Coeff to avoid existing points + NOMAD::Double _sgtelib_model_exclusion_area; + + /// Formulation of the surrogate problem in the sgtelib_model search. + NOMAD::sgtelib_model_formulation_type _sgtelib_model_formulation; + + /// Method to compute the probability of feasibility with sgtelib_model. + NOMAD::sgtelib_model_feasibility_type _sgtelib_model_feasibility; + + + public: + /// Set the \c SGTELIB_MODEL_EVAL_NB parameter. + /** + \param me The \c SGTELIB_MODEL_EVAL_NB parameter -- \b IN. + */ + void set_SGTELIB_MODEL_EVAL_NB ( const int me ); + + /// Access to the \c SGTELIB_MODEL_EVAL_NB parameter. + /** + \return The \c SGTELIB_MODEL_EVAL_NB parameter. + */ + int get_SGTELIB_MODEL_EVAL_NB ( void ) const; + + + /// Set the \c SGTELIB_MODEL_TRIALS parameter. + /** + \param cn The \c SGTELIB_MODEL_TRIALS parameter -- \b IN. + */ + void set_SGTELIB_MODEL_TRIALS ( const int cn ); + + /// Access to the \c SGTELIB_MODEL_TRIALS parameter. + /** + \return The \c SGTELIB_MODEL_TRIALS parameter. + */ + int get_SGTELIB_MODEL_TRIALS ( void ) const; + + + /// Set the \c SGTELIB_MODEL_CANDIDATES_NB parameter. + /** + \param me The \c SGTELIB_MODEL_CANDIDATES_NB parameter -- \b IN. + */ + void set_SGTELIB_MODEL_CANDIDATES_NB ( const int me ); + + /// Access to the \c SGTELIB_MODEL_CANDIDATES_NB parameter. + /** + \return The \c SGTELIB_MODEL_CANDIDATES_NB parameter. + */ + int get_SGTELIB_MODEL_CANDIDATES_NB ( void ) const; + + + /// Set the \c SGTELIB_MODEL_DEFINITION parameter. + /** + \param s The \c SGTELIB_MODEL_DEFINITION parameter -- \b IN. + */ + void set_SGTELIB_MODEL_DEFINITION( const std::string & s ); + + /// Access to the \c SGTELIB_MODEL_DEFINITION parameter. + /** + \return The \c SGTELIB_MODEL_DEFINITION parameter. + */ + std::string get_SGTELIB_MODEL_DEFINITION ( void ) const; + + + /// Set the \c SGTELIB_MODEL_DISPLAY parameter. + /** + \param s The \c SGTELIB_MODEL_DISPLAY parameter -- \b IN. + */ + void set_SGTELIB_MODEL_DISPLAY( const std::string & s ); + + /// Access to the \c SGTELIB_MODEL_DISPLAY parameter. + /** + \return The \c SGTELIB_MODEL_DISPLAY parameter. + */ + std::string get_SGTELIB_MODEL_DISPLAY ( void ) const; + + + /// Set the \c SGTELIB_MODEL_FILTER parameter. + /** + \param s The \c SGTELIB_MODEL_FILTER parameter -- \b IN. + */ + void set_SGTELIB_MODEL_FILTER( const std::string & s ); + + /// Access to the \c SGTELIB_MODEL_FILTER parameter. + /** + \return The \c SGTELIB_MODEL_FILTER parameter. + */ + std::string get_SGTELIB_MODEL_FILTER ( void ) const; + + + /// Set the \c SGTELIB_MODEL_DIVERSIFICATION parameter. + /** + \param dsw The \c SGTELIB_MODEL_DIVERSIFICATION parameter -- \b IN. + */ + void set_SGTELIB_MODEL_DIVERSIFICATION ( const NOMAD::Double dsw ); + + /// Access to the \c SGTELIB_MODEL_DIVERSIFICATION parameter. + /** + \return The \c SGTELIB_MODEL_DIVERSIFICATION parameter. + */ + NOMAD::Double get_SGTELIB_MODEL_DIVERSIFICATION ( void ) const; + + /// Set the \c SGTELIB_MODEL_EXCLUSION_AREA parameter. + /** + \param tc The \c SGTELIB_MODEL_EXCLUSION_AREA parameter -- \b IN. + */ + void set_SGTELIB_MODEL_EXCLUSION_AREA ( const NOMAD::Double tc ); + + /// Access to the \c SGTELIB_MODEL_EXCLUSION_AREA parameter. + /** + \return The \c SGTELIB_MODEL_EXCLUSION_AREA parameter. + */ + NOMAD::Double get_SGTELIB_MODEL_EXCLUSION_AREA ( void ) const; + + + /// Set the \c SGTELIB_MODEL_FORMULATION parameter. + /** + \param dft The \c SGTELIB_MODEL_FORMULATION parameter -- \b IN. + */ + void set_SGTELIB_MODEL_FORMULATION ( const NOMAD::sgtelib_model_formulation_type dft ); + + /// Access to the \c SGTELIB_MODEL_FORMULATION parameter. + /** + \return The \c SGTELIB_MODEL_FORMULATION parameter. + */ + NOMAD::sgtelib_model_formulation_type get_SGTELIB_MODEL_FORMULATION (void) const; + + /// Set the \c SGTELIB_MODEL_FEASIBILITY parameter. + /** + \param dft The \c SGTELIB_MODEL_FEASIBILITY parameter -- \b IN. + */ + void set_SGTELIB_MODEL_FEASIBILITY ( const NOMAD::sgtelib_model_feasibility_type dft ); + + /// Access to the \c SGTELIB_MODEL_FEASIBILITY parameter. + /** + \return The \c SGTELIB_MODEL_FEASIBILITY parameter. + */ + NOMAD::sgtelib_model_feasibility_type get_SGTELIB_MODEL_FEASIBILITY (void) const; + }; @@ -2674,4 +2918,13 @@ namespace NOMAD { } } +typedef NOMAD::Parameters * Params; + +extern "C" Params NewParameters(void); +typedef Params (* Params_creator)(void); + +extern "C" void DeleteParameters(Params p); +typedef void (* Params_disposer)(Params); + + #endif diff --git a/src/Pareto_Front.cpp b/src/Pareto_Front.cpp index c6dc902a628f9805ba12431abd4d616b958d5e8c..25d40fcf52a4145ee0e1a1cdfe15be8bc1801990 100644 --- a/src/Pareto_Front.cpp +++ b/src/Pareto_Front.cpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Pareto_Front.cpp \brief Pareto front (implementation) diff --git a/src/Pareto_Front.hpp b/src/Pareto_Front.hpp index 2c332630cd910d38bd05f9b74e8bb7dbda04e9be..3223bd8c39b236496af785559861afc2cec1f91b 100644 --- a/src/Pareto_Front.hpp +++ b/src/Pareto_Front.hpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Pareto_Front.hpp \brief Pareto front (headers) diff --git a/src/Pareto_Point.cpp b/src/Pareto_Point.cpp index 985d3670124b4cc0a9112c7f855e16877b407e62..31c6a7500aa72c0dc7067a580183853bb8ae2720 100644 --- a/src/Pareto_Point.cpp +++ b/src/Pareto_Point.cpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Pareto_Point.cpp \brief Pareto point (implementation) diff --git a/src/Pareto_Point.hpp b/src/Pareto_Point.hpp index 9503fbb5dcd657a37129ff04086333b1ae49f4d6..5f84d2bf2727c4bac8cd16e095b2e09891d2a5e7 100644 --- a/src/Pareto_Point.hpp +++ b/src/Pareto_Point.hpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Pareto_Point.hpp \brief Pareto point (headers) diff --git a/src/Phase_One_Evaluator.cpp b/src/Phase_One_Evaluator.cpp index ba014d5e3bc740602f96695580ece42be32ada2e..1ec727856850261659da0f6c148878f324ead4b6 100644 --- a/src/Phase_One_Evaluator.cpp +++ b/src/Phase_One_Evaluator.cpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Phase_One_Evaluator.cpp \brief NOMAD::Evaluator subclass for the phase one (implementation) diff --git a/src/Phase_One_Evaluator.hpp b/src/Phase_One_Evaluator.hpp index 0446b24cce9ca05183efd45d220c449e34024753..782168afa8bee302cec5c770be1d67aec0db3bf0 100644 --- a/src/Phase_One_Evaluator.hpp +++ b/src/Phase_One_Evaluator.hpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Phase_One_Evaluator.hpp \brief NOMAD::Evaluator subclass for the phase one (headers) diff --git a/src/Phase_One_Search.cpp b/src/Phase_One_Search.cpp index 19b3fd6b1c7037c232c596862bff4051b8f63684..92ca4a2717838e43a9ee24fc4d5071caca0d9869 100644 --- a/src/Phase_One_Search.cpp +++ b/src/Phase_One_Search.cpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Phase_One_Search.cpp \brief NOMAD::Search subclass for the phase one (implementation) @@ -92,16 +94,17 @@ void NOMAD::Phase_One_Search::search ( NOMAD::Mads & mads // save and modify parameters: std::string old_display_degree; _p.out().get_display_degree ( old_display_degree ); - const std::list<std::string> old_ds = _p.get_display_stats(); - const std::string old_stats_file_name = _p.get_stats_file_name(); - const std::string old_sol_file = _p.get_solution_file(); - const std::list<std::string> old_stats_file = _p.get_stats_file(); - const NOMAD::Point old_f_target = _p.get_f_target(); - NOMAD::Double old_lct = _p.get_L_curve_target(); - bool old_sif = _p.get_stop_if_feasible(); + const std::list<std::string> old_ds = _p.get_display_stats(); + NOMAD::Double old_VNS_trigger = _p.get_VNS_trigger(); + const std::string old_stats_file_name = _p.get_stats_file_name(); + const std::string old_sol_file = _p.get_solution_file(); + const std::list<std::string> old_stats_file = _p.get_stats_file(); + const NOMAD::Point old_f_target = _p.get_f_target(); + NOMAD::Double old_lct = _p.get_L_curve_target(); + bool old_sif = _p.get_stop_if_feasible(); const std::vector<NOMAD::bb_output_type> old_bbot = _p.get_bb_output_type(); std::vector<NOMAD::bb_output_type> p1_bbot = old_bbot; - + NOMAD::multi_formulation_type old_multi_formulation = _p.get_multi_formulation() ; int old_multi_nb_mads_runs = _p.get_multi_nb_mads_runs(); @@ -133,13 +136,12 @@ void NOMAD::Phase_One_Search::search ( NOMAD::Mads & mads return; } - if ( cnt > 1 ) { - // _p.set_LH_SEARCH(100, 0); _p.set_MULTI_FORMULATION( NOMAD::DIST_LINF ); _p.set_MULTI_NB_MADS_RUNS( 1 ); } + _p.set_F_TARGET ( NOMAD::Point ( cnt , 0.0 ) ); _p.set_L_CURVE_TARGET ( NOMAD::Double() ); @@ -190,7 +192,7 @@ void NOMAD::Phase_One_Search::search ( NOMAD::Mads & mads NOMAD::Mads::set_flag_reset_mesh ( false ); NOMAD::Mads::set_flag_p1_active ( true ); NOMAD::Mads::set_flag_reset_barriers ( true ); - + // run: stop_reason = mads.run(); @@ -245,6 +247,7 @@ void NOMAD::Phase_One_Search::search ( NOMAD::Mads & mads _p.set_MULTI_NB_MADS_RUNS( old_multi_nb_mads_runs ); _p.set_MULTI_FORMULATION( old_multi_formulation ); + _p.check ( false , // remove_history_file = false true , // remove_solution_file = true diff --git a/src/Phase_One_Search.hpp b/src/Phase_One_Search.hpp index f82c450a90d1734add06db7815c302cd835ddb41..ac5e230dee8efc986b089d9028fcc2dd27fc7f12 100644 --- a/src/Phase_One_Search.hpp +++ b/src/Phase_One_Search.hpp @@ -1,52 +1,54 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** - \file Phase_One_Search.hpp - \brief NOMAD::Search subclass for the phase one (headers) - \author Sebastien Le Digabel - \date 2010-04-09 - \see Phase_One_Search.cpp - */ + \file Phase_One_Search.hpp + \brief NOMAD::Search subclass for the phase one (headers) + \author Sebastien Le Digabel + \date 2010-04-09 + \see Phase_One_Search.cpp +*/ #ifndef __PHASE_ONE_SEARCH__ #define __PHASE_ONE_SEARCH__ @@ -54,47 +56,47 @@ #include "Mads.hpp" namespace NOMAD { - - /// NOMAD::Search subclass for the phase one. - /** + + /// NOMAD::Search subclass for the phase one. + /** - The phase one occurs when no feasible starting point has been given. - It consists in minimizing the constraint violations and it stops - as soon as a feasible point is found. - */ - class Phase_One_Search : public NOMAD::Search , private NOMAD::Uncopyable { - - public: - - /// Constructor. - /** - \param p Parameters -- \b IN. - */ - Phase_One_Search ( NOMAD::Parameters & p ) - : NOMAD::Search ( p , NOMAD::P1_SEARCH ) {} - - /// Destructor. - virtual ~Phase_One_Search ( void ) {} - - /// The phase one search. - /** - \param mads NOMAD::Mads object invoking this search -- \b IN/OUT. - \param nb_search_pts Number of generated search points -- \b OUT. - \param stop Stop flag -- \b IN/OUT. - \param stop_reason Stop reason -- \b OUT. - \param success Type of success -- \b OUT. - \param count_search Count or not the search -- \b OUT. - \param new_feas_inc New feasible incumbent -- \b IN/OUT. - \param new_infeas_inc New infeasible incumbent -- \b IN/OUT. - */ - virtual void search ( NOMAD::Mads & mads , - int & nb_search_pts , - bool & stop , - NOMAD::stop_type & stop_reason , - NOMAD::success_type & success , - bool & count_search , - const NOMAD::Eval_Point *& new_feas_inc , - const NOMAD::Eval_Point *& new_infeas_inc ); - }; + as soon as a feasible point is found. + */ + class Phase_One_Search : public NOMAD::Search , private NOMAD::Uncopyable { + + public: + + /// Constructor. + /** + \param p Parameters -- \b IN. + */ + Phase_One_Search ( NOMAD::Parameters & p ) + : NOMAD::Search ( p , NOMAD::P1_SEARCH ) {} + + /// Destructor. + virtual ~Phase_One_Search ( void ) {} + + /// The phase one search. + /** + \param mads NOMAD::Mads object invoking this search -- \b IN/OUT. + \param nb_search_pts Number of generated search points -- \b OUT. + \param stop Stop flag -- \b IN/OUT. + \param stop_reason Stop reason -- \b OUT. + \param success Type of success -- \b OUT. + \param count_search Count or not the search -- \b OUT. + \param new_feas_inc New feasible incumbent -- \b IN/OUT. + \param new_infeas_inc New infeasible incumbent -- \b IN/OUT. + */ + virtual void search ( NOMAD::Mads & mads , + int & nb_search_pts , + bool & stop , + NOMAD::stop_type & stop_reason , + NOMAD::success_type & success , + bool & count_search , + const NOMAD::Eval_Point *& new_feas_inc , + const NOMAD::Eval_Point *& new_infeas_inc ); + }; } #endif diff --git a/src/Point.cpp b/src/Point.cpp index fd2ac1350089a2136bc664d9dc3a1e8b8e8d350a..59f81ab4436bc154ae8ccc410b1f4d31f0379c24 100644 --- a/src/Point.cpp +++ b/src/Point.cpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Point.cpp \brief Custom class for points (implementation) @@ -599,7 +601,7 @@ const NOMAD::Double NOMAD::Point::get_coord (int i) const return _coords[i]; } - +// SGTELIB /*-----------------------------------------------------------*/ /* Set the coordinate j to value v */ /*-----------------------------------------------------------*/ diff --git a/src/Point.hpp b/src/Point.hpp index 0a565ae65e0392e63960768692ff5d52eab6a19a..70c65f9c85eb74061ec33780fd2282c4bbdf7959 100644 --- a/src/Point.hpp +++ b/src/Point.hpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Point.hpp \brief Custom class for points (headers) @@ -47,6 +49,12 @@ \date 2010-04-05 \see Point.cpp */ + +// CASE Visual Studio C++ compiler +#ifdef _MSC_VER +#pragma warning(disable:4996) +#endif + #ifndef __POINT__ #define __POINT__ @@ -305,6 +313,22 @@ namespace NOMAD { NOMAD::Double(0.0) , squared_norm_op() ); } + + /// Squared norm of the point. + /** + \return A NOMAD::Double with the squared norm of the point. + */ + const NOMAD::Double infinite_norm ( void ) const + { + Double cur = (*_coords).abs(); + Double * coord = _coords; + for (; coord != _coords + _n ; ++coord) + { + cur = max(cur, (*_coords).abs() ); + } + return cur; + } + /// Norm of the point. /** @@ -441,6 +465,7 @@ namespace NOMAD { int lim = -1 ) const; + // SGTELIB /// Set the coordinate j with a specific value. /** \param j Coordinate to be set -- \b IN. @@ -448,6 +473,7 @@ namespace NOMAD { */ void set_coord ( int j , const NOMAD::Double v ); + // SGTELIB /// get i^th coordinate of the point. /** \param i The index of the coordinate -- \b IN. diff --git a/src/Priority_Eval_Point.cpp b/src/Priority_Eval_Point.cpp index 014a0bf237c285462b498a44de2588c3fb45cc76..2fc414cfaafb36a4aebcc4d8d1ce329fe6eb9e55 100644 --- a/src/Priority_Eval_Point.cpp +++ b/src/Priority_Eval_Point.cpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Priority_Eval_Point.cpp \brief Evaluation point with a priority (implementation) @@ -62,13 +64,16 @@ bool NOMAD::Priority_Eval_Point::dominates ( const NOMAD::Set_Element<NOMAD::Eva { if ( this == &x ) return false; + const NOMAD::Eval_Point * x1 = get_element(); const NOMAD::Eval_Point * x2 = x.get_element(); // criterion 0: lexicographic order - if (_lexicographic_order) + // ------------ + if ( _lexicographic_order ) return NOMAD::Point(*x1) < NOMAD::Point(*x2); - + + // criterion 1: user criterion: // ------------ const NOMAD::Double uep1 = x1->get_user_eval_priority(); diff --git a/src/Priority_Eval_Point.hpp b/src/Priority_Eval_Point.hpp index 0e9861897b06276cf664eed468693f35d3a98322..2dd859ce4789b13b70d39d987dc41bc9b6105cb3 100644 --- a/src/Priority_Eval_Point.hpp +++ b/src/Priority_Eval_Point.hpp @@ -1,52 +1,54 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** - \file Priority_Eval_Point.hpp - \brief Evaluation point with a priority (headers) - \author Sebastien Le Digabel - \date 2010-04-22 - \see Priority_Eval_Point.cpp - */ + \file Priority_Eval_Point.hpp + \brief Evaluation point with a priority (headers) + \author Sebastien Le Digabel + \date 2010-04-22 + \see Priority_Eval_Point.cpp +*/ #ifndef __PRIORITY_EVAL_POINT__ #define __PRIORITY_EVAL_POINT__ @@ -54,181 +56,181 @@ #include "Eval_Point.hpp" namespace NOMAD { - - /// Evaluation point with a priority. - class Priority_Eval_Point : public NOMAD::Set_Element<NOMAD::Eval_Point> { - - private: - - NOMAD::Double _h_min; ///< \c h_min value for comparison operator. - NOMAD::Double _f_sgte; ///< Objective surrogate value. - NOMAD::Double _h_sgte; ///< Feasibility surrogate value. - NOMAD::Double _f_model; ///< Objective model value. - NOMAD::Double _h_model; ///< Feasibility model value. - NOMAD::Double _angle_success_dir; ///< Angle with last successful direction. - NOMAD::Double _angle_simplex_grad; ///< Angle with simplex gradient. - static bool _lexicographic_order; ///< Use lexicographic order for comparison - - /// Affectation operator. - /** - \param x The right-hand side object -- \b IN. - */ - Priority_Eval_Point & operator = ( const Priority_Eval_Point & x ); - - /// Compare the \c h values of two points. - /** - The two points to compare are \c x1 and \c x2. - \param hx1 \c h(x1) -- \b IN. - \param hx2 \c h(x2) -- \b IN. - \return \c h(x1) \c < \c h(x2) - with the following format: - - 1: \c x1 best than \c x2. - - -1: \c x2 best than \c x1. - - 0: undetermined. - */ - int compare_h_values ( const NOMAD::Double & hx1 , - const NOMAD::Double & hx2 ) const; - - /// Compare the \c h and \c f values of two points. - /** - The two points to compare are \c x1 and \c x2. - \param hx1 \c h(x1) -- \b IN. - \param fx1 \c f(x1) -- \b IN. - \param hx2 \c h(x2) -- \b IN. - \param fx2 \c f(x2) -- \b IN. - \return \c (h(x1),f(x1)) \c < \c (h(x2),f(x2)) - with the following format: - - 1: \c x1 best than \c x2. - - -1: \c x2 best than \c x1. - - 0: undetermined. - */ - int compare_hf_values ( const NOMAD::Double & hx1 , - const NOMAD::Double & fx1 , - const NOMAD::Double & hx2 , - const NOMAD::Double & fx2 ) const; - public: - - /// Constructor. - /** - \param x A pointer to the evaluation point -- \b IN. - \param h_min \c h_min value -- \b IN. - */ - explicit Priority_Eval_Point ( const NOMAD::Eval_Point * x , - const NOMAD::Double & h_min ) - : NOMAD::Set_Element<NOMAD::Eval_Point> ( x ) , - _h_min ( h_min ) {} - - /// Copy constructor. - /** - \param pep The copied object -- \b IN. - */ - explicit Priority_Eval_Point ( const Priority_Eval_Point & pep ) - : NOMAD::Set_Element<NOMAD::Eval_Point> ( pep.get_element() ) , - _h_min ( pep._h_min ) , - _f_sgte ( pep._f_sgte ) , - _h_sgte ( pep._h_sgte ) , - _f_model ( pep._f_model ) , - _h_model ( pep._h_model ) , - _angle_success_dir ( pep._angle_success_dir ) , - _angle_simplex_grad ( pep._angle_simplex_grad ) {} - - /// Destructor. - virtual ~Priority_Eval_Point ( void ) {} - - /// Access to specific elements of comparison. - /** - - This method is defined virtual in NOMAD::Set_Element so that + + /// Evaluation point with a priority. + class Priority_Eval_Point : public NOMAD::Set_Element<NOMAD::Eval_Point> { + + private: + + NOMAD::Double _h_min; ///< \c h_min value for comparison operator. + NOMAD::Double _f_sgte; ///< Objective surrogate value. + NOMAD::Double _h_sgte; ///< Feasibility surrogate value. + NOMAD::Double _f_model; ///< Objective model value. + NOMAD::Double _h_model; ///< Feasibility model value. + NOMAD::Double _angle_success_dir; ///< Angle with last successful direction. + NOMAD::Double _angle_simplex_grad; ///< Angle with simplex gradient. + static bool _lexicographic_order; ///< Use lexicographic order for comparison + + /// Affectation operator. + /** + \param x The right-hand side object -- \b IN. + */ + Priority_Eval_Point & operator = ( const Priority_Eval_Point & x ); + + /// Compare the \c h values of two points. + /** + The two points to compare are \c x1 and \c x2. + \param hx1 \c h(x1) -- \b IN. + \param hx2 \c h(x2) -- \b IN. + \return \c h(x1) \c < \c h(x2) + with the following format: + - 1: \c x1 best than \c x2. + - -1: \c x2 best than \c x1. + - 0: undetermined. + */ + int compare_h_values ( const NOMAD::Double & hx1 , + const NOMAD::Double & hx2 ) const; + + /// Compare the \c h and \c f values of two points. + /** + The two points to compare are \c x1 and \c x2. + \param hx1 \c h(x1) -- \b IN. + \param fx1 \c f(x1) -- \b IN. + \param hx2 \c h(x2) -- \b IN. + \param fx2 \c f(x2) -- \b IN. + \return \c (h(x1),f(x1)) \c < \c (h(x2),f(x2)) + with the following format: + - 1: \c x1 best than \c x2. + - -1: \c x2 best than \c x1. + - 0: undetermined. + */ + int compare_hf_values ( const NOMAD::Double & hx1 , + const NOMAD::Double & fx1 , + const NOMAD::Double & hx2 , + const NOMAD::Double & fx2 ) const; + public: + + /// Constructor. + /** + \param x A pointer to the evaluation point -- \b IN. + \param h_min \c h_min value -- \b IN. + */ + explicit Priority_Eval_Point ( const NOMAD::Eval_Point * x , + const NOMAD::Double & h_min ) + : NOMAD::Set_Element<NOMAD::Eval_Point> ( x ) , + _h_min ( h_min ) {} + + /// Copy constructor. + /** + \param pep The copied object -- \b IN. + */ + explicit Priority_Eval_Point ( const Priority_Eval_Point & pep ) + : NOMAD::Set_Element<NOMAD::Eval_Point> ( pep.get_element() ) , + _h_min ( pep._h_min ) , + _f_sgte ( pep._f_sgte ) , + _h_sgte ( pep._h_sgte ) , + _f_model ( pep._f_model ) , + _h_model ( pep._h_model ) , + _angle_success_dir ( pep._angle_success_dir ) , + _angle_simplex_grad ( pep._angle_simplex_grad ) {} + + /// Destructor. + virtual ~Priority_Eval_Point ( void ) {} + + /// Access to specific elements of comparison. + /** + - This method is defined virtual in NOMAD::Set_Element so that \c operator \c < \c (Set_Element x) can invoke it on \c x (which is in fact a \c Priority_Eval_Point). - - This avoids an expensive downcast in \c operator \c < . - \param f_sgte Objective surrogate value -- \b OUT. - \param h_sgte Feasibility surrogate value -- \b OUT. - \param f_model Objective model value -- \b OUT. - \param h_model Feasibility model value -- \b OUT. - \param angle_success_dir Angle with last successful direction -- \b OUT. - \param angle_simplex_grad Angle with simplex gradient -- \b OUT. - */ - virtual void get_priority_criteria ( NOMAD::Double & f_sgte , - NOMAD::Double & h_sgte , - NOMAD::Double & f_model , - NOMAD::Double & h_model , - NOMAD::Double & angle_success_dir , - NOMAD::Double & angle_simplex_grad ) const - { - f_sgte = _f_sgte; - h_sgte = _h_sgte; - f_model = _f_model; - h_model = _h_model; - angle_success_dir = _angle_success_dir; - angle_simplex_grad = _angle_simplex_grad; - } - - /// Comparison operator. - /** - This virtual function directly call \c dominates(). - \param x The right-hand side object -- \b IN. - \return A boolean equal to \c true if \c *this \c < \c x. - */ - virtual bool operator < ( const NOMAD::Set_Element<NOMAD::Eval_Point> & x ) const - { return dominates ( x ); } - - /// Comparison operator. - /** - \param x The right-hand side object -- \b IN. - \return A boolean equal to \c true if \c *this \c < \c x. - */ - bool dominates ( const NOMAD::Set_Element<NOMAD::Eval_Point> & x ) const; - - /// Access to the evaluation point. - /** - \return A pointer to the evaluation point. - */ - const NOMAD::Eval_Point * get_point ( void ) const { return get_element(); } - - /// Set the angle with last successful direction. - /** - \param a The angle with last successful direction -- \b IN. - */ - void set_angle_success_dir ( const NOMAD::Double & a ) { _angle_success_dir = a; } - - /// Set the angle with simplex gradient . - /** - \param a The angle with simplex gradient -- \b IN. - */ - void set_angle_simplex_grad ( const NOMAD::Double & a ) { _angle_simplex_grad = a; } - - - /// Set the objective surrogate value. - /** - \param f The objective surrogate value -- \b IN. - */ - void set_f_sgte ( const NOMAD::Double & f ) { _f_sgte = f; } - - /// Set the feasibility surrogate value. - /** - \param h The feasibility surrogate value -- \b IN. - */ - void set_h_sgte ( const NOMAD::Double & h ) { _h_sgte = h; } - - /// Set the objective model value. - /** - \param f The objective model value -- \b IN. - */ - void set_f_model ( const NOMAD::Double & f ) { _f_model = f; } - - /// Set the feasibility model value. - /** - \param h The feasibility model value -- \b IN. - */ - void set_h_model ( const NOMAD::Double & h ) { _h_model = h; } - - /// Set the lexicographic order for sorting. - /** - */ - static void set_lexicographic_order ( bool order ) { _lexicographic_order = order; } - - - }; + - This avoids an expensive downcast in \c operator \c < . + \param f_sgte Objective surrogate value -- \b OUT. + \param h_sgte Feasibility surrogate value -- \b OUT. + \param f_model Objective model value -- \b OUT. + \param h_model Feasibility model value -- \b OUT. + \param angle_success_dir Angle with last successful direction -- \b OUT. + \param angle_simplex_grad Angle with simplex gradient -- \b OUT. + */ + virtual void get_priority_criteria ( NOMAD::Double & f_sgte , + NOMAD::Double & h_sgte , + NOMAD::Double & f_model , + NOMAD::Double & h_model , + NOMAD::Double & angle_success_dir , + NOMAD::Double & angle_simplex_grad ) const + { + f_sgte = _f_sgte; + h_sgte = _h_sgte; + f_model = _f_model; + h_model = _h_model; + angle_success_dir = _angle_success_dir; + angle_simplex_grad = _angle_simplex_grad; + } + + /// Comparison operator. + /** + This virtual function directly call \c dominates(). + \param x The right-hand side object -- \b IN. + \return A boolean equal to \c true if \c *this \c < \c x. + */ + virtual bool operator < ( const NOMAD::Set_Element<NOMAD::Eval_Point> & x ) const + { return dominates ( x ); } + + /// Comparison operator. + /** + \param x The right-hand side object -- \b IN. + \return A boolean equal to \c true if \c *this \c < \c x. + */ + bool dominates ( const NOMAD::Set_Element<NOMAD::Eval_Point> & x ) const; + + /// Access to the evaluation point. + /** + \return A pointer to the evaluation point. + */ + const NOMAD::Eval_Point * get_point ( void ) const { return get_element(); } + + /// Set the angle with last successful direction. + /** + \param a The angle with last successful direction -- \b IN. + */ + void set_angle_success_dir ( const NOMAD::Double & a ) { _angle_success_dir = a; } + + /// Set the angle with simplex gradient . + /** + \param a The angle with simplex gradient -- \b IN. + */ + void set_angle_simplex_grad ( const NOMAD::Double & a ) { _angle_simplex_grad = a; } + + + /// Set the objective surrogate value. + /** + \param f The objective surrogate value -- \b IN. + */ + void set_f_sgte ( const NOMAD::Double & f ) { _f_sgte = f; } + + /// Set the feasibility surrogate value. + /** + \param h The feasibility surrogate value -- \b IN. + */ + void set_h_sgte ( const NOMAD::Double & h ) { _h_sgte = h; } + + /// Set the objective model value. + /** + \param f The objective model value -- \b IN. + */ + void set_f_model ( const NOMAD::Double & f ) { _f_model = f; } + + /// Set the feasibility model value. + /** + \param h The feasibility model value -- \b IN. + */ + void set_h_model ( const NOMAD::Double & h ) { _h_model = h; } + + /// Set the lexicographic order for sorting. + /** + */ + static void set_lexicographic_order ( bool order ) { _lexicographic_order = order; } + + + }; } #endif diff --git a/src/Quad_Model.cpp b/src/Quad_Model.cpp index 1650b8ec1740cb6f74340af35cad29177fe3e034..e325cf66169893635a72559b7e1bec8e1ec3947b 100644 --- a/src/Quad_Model.cpp +++ b/src/Quad_Model.cpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Quad_Model.cpp \brief Quadratic regression or MFN interpolation model (implementation) @@ -1260,7 +1262,7 @@ void NOMAD::Quad_Model::solve_regression_system ( double ** M , double ** V , int bbo_index , NOMAD::Point & alpha , - double eps ) const + double eps ) const { // resize the alpha vector: if ( alpha.size() != _n_alpha ) @@ -1496,12 +1498,12 @@ bool NOMAD::Quad_Model::construct_MFN_model ( double eps , /* resolution of system F.[mu alpha_L]'=[f(Y) 0]' */ /* for MFN interpolation (private) */ /*--------------------------------------------------*/ -void NOMAD::Quad_Model::solve_MFN_system ( double ** F , +void NOMAD::Quad_Model::solve_MFN_system ( double ** F , double * W , double ** V , int bbo_index , NOMAD::Point & alpha , - double eps ) const + double eps ) const { // resize the alpha vector: if ( alpha.size() != _n_alpha ) diff --git a/src/Quad_Model.hpp b/src/Quad_Model.hpp index da0edf9d90e0618034c659b09dcd04610702b04f..0f9235af5206ab72cd1ec82df52a7304586b7394 100644 --- a/src/Quad_Model.hpp +++ b/src/Quad_Model.hpp @@ -1,52 +1,54 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** - \file Quad_Model.hpp - \brief Quadratic regression or MFN interpolation model (headers) - \author Sebastien Le Digabel - \date 2010-08-31 - \see Quad_Model.cpp - */ + \file Quad_Model.hpp + \brief Quadratic regression or MFN interpolation model (headers) + \author Sebastien Le Digabel + \date 2010-08-31 + \see Quad_Model.cpp +*/ #ifndef __QUAD_MODEL__ #define __QUAD_MODEL__ @@ -55,405 +57,405 @@ #include "Evaluator.hpp" namespace NOMAD { - - /// Class for quadratic regression or MFN interpolation model. - class Quad_Model : private NOMAD::Uncopyable { - - /*-------------------------------------------------------------------------*/ - private: - - const NOMAD::Display & _out; ///< Display. - - std::vector<NOMAD::Eval_Point *> _Y; ///< Interpolation points. - - const std::vector<NOMAD::bb_output_type> & _bbot; ///< Blackbox output types. - - NOMAD::interpolation_type _interpolation_type; ///< Interpolation type. - - int _n; ///< Dimension. - int _nfree; ///< Number of free variables. - int _n_alpha; ///< Number of model coefficients. - bool * _fixed_vars; ///< Fixed variables. - int * _index; ///< Var. indexes with fixed var. - NOMAD::Point ** _alpha; ///< Model coefficients. - NOMAD::Point _center; ///< Model center. - NOMAD::Point _ref; ///< Reference for scaling. - NOMAD::Point _scaling; ///< Scaling. - const NOMAD::Cache & _cache; ///< Cache. - const NOMAD::Signature & _signature; ///< Signature. - bool _error_flag; ///< Error flag. - std::list<NOMAD::Direction> _dirP; ///< Directions used for scaling (may be empty) - NOMAD::Point _delta_m; ///< Mesh size used for scaling - NOMAD::Double _epsilon; ///< Offset for direction scaling - - - NOMAD::Double _cond; ///< Condition number. - - /// Initialize alpha (model parameters). - void init_alpha ( void ); - - /// Check if an unscaled point is in \c B(center,radius) for a given radius. - /** - \param x The unscaled point -- \b IN. - \param radius The radius -- \b IN. - \return \c true is \c x is in \c B(center,radius). - */ - bool is_within_radius ( const NOMAD::Point & x , - const NOMAD::Point & radius ) const; - - /// Check the interpolation set \c Y. - /** - \return \c true if the interpolation set is valid. - */ - bool check_Y ( void ) const; - - /// Check outputs before the integration into \c Y. - /** - \param bbo The outputs -- \b IN. - \param m Number of outputs -- \b IN. - return \c true if the \c m outputs are valid. - */ - bool check_outputs ( const NOMAD::Point & bbo , int m ) const; - - /// Reduce the number of interpolation points. - /** - The points are sorted accorded to their distance to the model center. - \param center Center of the model -- \b IN. - \param max_Y_size Max number of interpolation points -- \b IN. - */ - void reduce_Y ( const NOMAD::Point & center , int max_Y_size ); - - /// Compute condition number. - /** - \param W Matrix W given as a vector -- \b IN. - \param n Size of \c W -- \b IN - \param eps Epsilon -- \b IN. - */ - void compute_cond ( const double * W , int n , double eps ); - - /// Compute the cumulated error of a model for one output. - /** - The errors are computed on the interpolation set \c Y. - \param bbo_index Blackbox output index -- \b IN. - \param error Cumulated error -- \b OUT. - \param min_rel_err Min relative error -- \b OUT. - \param max_rel_err Max relative error -- \b OUT. - \param avg_rel_err Average relative error -- \b OUT. - */ - void compute_model_error ( int bbo_index , - NOMAD::Double & error , - NOMAD::Double & min_rel_err , - NOMAD::Double & max_rel_err , - NOMAD::Double & avg_rel_err ) const; - - /// Compute the maximal relative error of a model. - /** - The error is computed for the interpolation set \c Y. - \return The maximal relative error. - */ - NOMAD::Double compute_max_rel_err ( void ) const; - - /// Compute the element \c (i,j) of the interpolation matrix \c M(phi,Y). - /** - \param i Row index -- \b IN. - \param j Column index -- \b IN. - */ - double compute_M ( int i , int j ) const; - - /// Construct Minimum Frobenius Norm (MFN) model. - /** - - This occurs when \c p+1 \c < \c (n+1)(n+2)/2. - \param eps Epsilon -- \b IN. - \param max_mpn Maximum \c m+n value for SVD matrices -- \b IN. - \param max_Y_size Maximum number of elements in \c Y -- \b IN. - \return \c true if the construction succeeded - */ - bool construct_MFN_model ( double eps , int max_mpn , int max_Y_size ); - - /// Construct regression model. - /** - - This occurs when \c p+1 \c >= \c (n+1)(n+2)/2. - \param eps Epsilon -- \b IN. - \param max_mpn Maximum \c m+n value for SVD matrices -- \b IN. - \param max_Y_size Maximum number of elements in \c Y -- \b IN. - \return \c true if the construction succeeded - */ - bool construct_regression_model ( double eps , - int max_mpn , - int max_Y_size ); - - /// Construct well-poised (WP) model. - /** - \param max_Y_size Maximum number of elements in \c Y -- \b IN. - \return \c true if the construction succeeded - */ - bool construct_WP_model ( int max_Y_size ); - - /// Find interpolation point with max Lagrange polynomial value. - /** - \param li Lagrange polynomial -- \b IN. - \param Y Interpolation points candidates -- \b IN. - \param i1 Initial index in \c Y -- \b IN. - \param i2 Final index in \c Y -- \b IN. - \param max_lix Absolute value of the max value -- \b OUT. - \return Index of interpolation point. - */ - int find_max_lix ( const NOMAD::Point & li , - const std::vector<NOMAD::Eval_Point *> & Y , - int i1 , - int i2 , - NOMAD::Double & max_lix ) const; - - /// Resolution of system \c F.[mu alpha_L]'=[f(Y) 0]' for MFN interpolation. - /** - \param U Matrix \c F=U from the SVD decomposition \c U.W.V' -- \b IN. - \param W Matrix \c W from the SVD decomposition \c U.W.V' -- \b IN. - \param V Matrix \c V from the SVD decomposition \c U.W.V' -- \b IN. - \param bbo_index Blackbox output index -- \b IN. - \param alpha Model parameters -- \b IN. - \param eps Epsilon -- \b IN. - */ - void solve_MFN_system ( double ** U , - double * W , - double ** V , - int bbo_index , - NOMAD::Point & alpha , - double eps ) const; - - /// Resolution of system \c F.alpha=M'.f(Y) for the regression. - /** - \param M Matrix \c M -- \b IN. - \param U Matrix \c F=U from the SVD decomposition \c U.W.V' -- \b IN. - \param W Matrix \c W from the SVD decomposition \c U.W.V' -- \b IN. - \param V Matrix \c V from the SVD decomposition \c U.W.V' -- \b IN. - \param bbo_index Blackbox output index -- \b IN. - \param alpha Model parameters -- \b IN. - \param eps Epsilon -- \b IN. - */ - void solve_regression_system ( double ** M , - double ** U , - double * W , - double ** V , - int bbo_index , - NOMAD::Point & alpha , - double eps ) const; - - /// Display Lagrange polynomials. - /** - \param l Lagrange polynomials -- \b IN. - \param Y Interpolation set -- \b IN. - */ - void display_lagrange_polynomials - ( const std::vector<NOMAD::Point *> & l , - const std::vector<NOMAD::Eval_Point *> & Y ) const; - + + /// Class for quadratic regression or MFN interpolation model. + class Quad_Model : private NOMAD::Uncopyable { + + /*-------------------------------------------------------------------------*/ + private: + + const NOMAD::Display & _out; ///< Display. + + std::vector<NOMAD::Eval_Point *> _Y; ///< Interpolation points. + + const std::vector<NOMAD::bb_output_type> & _bbot; ///< Blackbox output types. + + NOMAD::interpolation_type _interpolation_type; ///< Interpolation type. + + int _n; ///< Dimension. + int _nfree; ///< Number of free variables. + int _n_alpha; ///< Number of model coefficients. + bool * _fixed_vars; ///< Fixed variables. + int * _index; ///< Var. indexes with fixed var. + NOMAD::Point ** _alpha; ///< Model coefficients. + NOMAD::Point _center; ///< Model center. + NOMAD::Point _ref; ///< Reference for scaling. + NOMAD::Point _scaling; ///< Scaling. + const NOMAD::Cache & _cache; ///< Cache. + const NOMAD::Signature & _signature; ///< Signature. + bool _error_flag; ///< Error flag. + std::list<NOMAD::Direction> _dirP; ///< Directions used for scaling (may be empty) + NOMAD::Point _delta_m; ///< Mesh size used for scaling + NOMAD::Double _epsilon; ///< Offset for direction scaling + + + NOMAD::Double _cond; ///< Condition number. + + /// Initialize alpha (model parameters). + void init_alpha ( void ); + + /// Check if an unscaled point is in \c B(center,radius) for a given radius. + /** + \param x The unscaled point -- \b IN. + \param radius The radius -- \b IN. + \return \c true is \c x is in \c B(center,radius). + */ + bool is_within_radius ( const NOMAD::Point & x , + const NOMAD::Point & radius ) const; + + /// Check the interpolation set \c Y. + /** + \return \c true if the interpolation set is valid. + */ + bool check_Y ( void ) const; + + /// Check outputs before the integration into \c Y. + /** + \param bbo The outputs -- \b IN. + \param m Number of outputs -- \b IN. + return \c true if the \c m outputs are valid. + */ + bool check_outputs ( const NOMAD::Point & bbo , int m ) const; + + /// Reduce the number of interpolation points. + /** + The points are sorted accorded to their distance to the model center. + \param center Center of the model -- \b IN. + \param max_Y_size Max number of interpolation points -- \b IN. + */ + void reduce_Y ( const NOMAD::Point & center , int max_Y_size ); + + /// Compute condition number. + /** + \param W Matrix W given as a vector -- \b IN. + \param n Size of \c W -- \b IN + \param eps Epsilon -- \b IN. + */ + void compute_cond ( const double * W , int n , double eps ); + + /// Compute the cumulated error of a model for one output. + /** + The errors are computed on the interpolation set \c Y. + \param bbo_index Blackbox output index -- \b IN. + \param error Cumulated error -- \b OUT. + \param min_rel_err Min relative error -- \b OUT. + \param max_rel_err Max relative error -- \b OUT. + \param avg_rel_err Average relative error -- \b OUT. + */ + void compute_model_error ( int bbo_index , + NOMAD::Double & error , + NOMAD::Double & min_rel_err , + NOMAD::Double & max_rel_err , + NOMAD::Double & avg_rel_err ) const; + + /// Compute the maximal relative error of a model. + /** + The error is computed for the interpolation set \c Y. + \return The maximal relative error. + */ + NOMAD::Double compute_max_rel_err ( void ) const; + + /// Compute the element \c (i,j) of the interpolation matrix \c M(phi,Y). + /** + \param i Row index -- \b IN. + \param j Column index -- \b IN. + */ + double compute_M ( int i , int j ) const; + + /// Construct Minimum Frobenius Norm (MFN) model. + /** + - This occurs when \c p+1 \c < \c (n+1)(n+2)/2. + \param eps Epsilon -- \b IN. + \param max_mpn Maximum \c m+n value for SVD matrices -- \b IN. + \param max_Y_size Maximum number of elements in \c Y -- \b IN. + \return \c true if the construction succeeded + */ + bool construct_MFN_model ( double eps , int max_mpn , int max_Y_size ); + + /// Construct regression model. + /** + - This occurs when \c p+1 \c >= \c (n+1)(n+2)/2. + \param eps Epsilon -- \b IN. + \param max_mpn Maximum \c m+n value for SVD matrices -- \b IN. + \param max_Y_size Maximum number of elements in \c Y -- \b IN. + \return \c true if the construction succeeded + */ + bool construct_regression_model ( double eps , + int max_mpn , + int max_Y_size ); + + /// Construct well-poised (WP) model. + /** + \param max_Y_size Maximum number of elements in \c Y -- \b IN. + \return \c true if the construction succeeded + */ + bool construct_WP_model ( int max_Y_size ); + + /// Find interpolation point with max Lagrange polynomial value. + /** + \param li Lagrange polynomial -- \b IN. + \param Y Interpolation points candidates -- \b IN. + \param i1 Initial index in \c Y -- \b IN. + \param i2 Final index in \c Y -- \b IN. + \param max_lix Absolute value of the max value -- \b OUT. + \return Index of interpolation point. + */ + int find_max_lix ( const NOMAD::Point & li , + const std::vector<NOMAD::Eval_Point *> & Y , + int i1 , + int i2 , + NOMAD::Double & max_lix ) const; + + /// Resolution of system \c F.[mu alpha_L]'=[f(Y) 0]' for MFN interpolation. + /** + \param U Matrix \c F=U from the SVD decomposition \c U.W.V' -- \b IN. + \param W Matrix \c W from the SVD decomposition \c U.W.V' -- \b IN. + \param V Matrix \c V from the SVD decomposition \c U.W.V' -- \b IN. + \param bbo_index Blackbox output index -- \b IN. + \param alpha Model parameters -- \b IN. + \param eps Epsilon -- \b IN. + */ + void solve_MFN_system ( double ** U , + double * W , + double ** V , + int bbo_index , + NOMAD::Point & alpha , + double eps ) const; + + /// Resolution of system \c F.alpha=M'.f(Y) for the regression. + /** + \param M Matrix \c M -- \b IN. + \param U Matrix \c F=U from the SVD decomposition \c U.W.V' -- \b IN. + \param W Matrix \c W from the SVD decomposition \c U.W.V' -- \b IN. + \param V Matrix \c V from the SVD decomposition \c U.W.V' -- \b IN. + \param bbo_index Blackbox output index -- \b IN. + \param alpha Model parameters -- \b IN. + \param eps Epsilon -- \b IN. + */ + void solve_regression_system ( double ** M , + double ** U , + double * W , + double ** V , + int bbo_index , + NOMAD::Point & alpha , + double eps ) const; + + /// Display Lagrange polynomials. + /** + \param l Lagrange polynomials -- \b IN. + \param Y Interpolation set -- \b IN. + */ + void display_lagrange_polynomials + ( const std::vector<NOMAD::Point *> & l , + const std::vector<NOMAD::Eval_Point *> & Y ) const; + #ifdef MODEL_STATS - mutable NOMAD::Double _Yw; ///< Width of the interpolation set \c Y. - - public: - - /// Access to the width of the interpolation set \c X (or \c Y). - /** - \return The width of the interpolation set. - */ - const NOMAD::Double & get_Yw ( void ) const { return _Yw; } + mutable NOMAD::Double _Yw; ///< Width of the interpolation set \c Y. + + public: + + /// Access to the width of the interpolation set \c X (or \c Y). + /** + \return The width of the interpolation set. + */ + const NOMAD::Double & get_Yw ( void ) const { return _Yw; } #endif - - /*-------------------------------------------------------------------------*/ - public: - - /// Constructor. - /** - \param out The NOMAD::Display object -- \b IN. - \param bbot Output types -- \b IN. - \param cache Cache -- \b IN. - \param signature Signature -- \b IN. - */ - Quad_Model ( const NOMAD::Display & out , - const std::vector<NOMAD::bb_output_type> & bbot , - const NOMAD::Cache & cache , - const NOMAD::Signature & signature ); - - /// Destructor. - virtual ~Quad_Model ( void ); - - /// Evaluate a model at a given point. - /** - \param x The point -- \b IN. - \param alpha Model parameters -- \b IN. - \return Model value. - */ - NOMAD::Double eval ( const NOMAD::Point & x , - const NOMAD::Point & alpha ) const; - - /// Compute model \c h and \c f values at a point. - /** - \param x The point -- \b IN. - \param h_min Value of \c h_min -- \b IN.. - \param h_norm Norm used to compute \c h -- \b IN.. - \param h Value of \c h -- \b OUT. - \param f Value of \c f -- \b OUT. - */ - void eval_hf ( const NOMAD::Point & x , - const NOMAD::Double & h_min , - NOMAD::hnorm_type h_norm , - NOMAD::Double & h , - NOMAD::Double & f ) const; - - - /// Access to the interpolation type. - /** - \return The interpolation type. - */ - const NOMAD::interpolation_type & get_interpolation_type ( void ) const - { - return _interpolation_type; - } - - /// Access to the center of the model. - /** - \return The center. - */ - const NOMAD::Point & get_center ( void ) const { return _center; } - - /// Access to the dimension. - /** - \return The dimension \c n. - */ - int get_n ( void ) const { return _n; } - - /// Access to the number of free variables. - /** - \return The number of free variables \c n. - */ - int get_nfree ( void ) const { return _nfree; } - - /// Access to the model parameters. - /** - \return The model parameters \c alpha. - */ - NOMAD::Point ** get_alpha ( void ) const { return _alpha; } - - /// Check if the model is ready for evaluations. - /** - \return A boolean equal to \c true if the model is ready. - */ - bool check ( void ) const; - - /// Access to the fixed variables. - /** - \param i Variable index -- \b IN. - \return \c true if variable \c i is fixed. - */ - bool variable_is_fixed ( int i ) const { return _fixed_vars[i]; } - - /// Access to the number of interpolation points. - /** - \return The number of interpolation points \c nY=p+1. - */ - int get_nY ( void ) const { return static_cast<int> ( _Y.size() ); } - - /// Access to the condition number. - /** - \return The condition number. - */ - const NOMAD::Double & get_cond ( void ) const { return _cond; } - - /// Access to the error flag. - /** - \return The error flag. - */ - bool get_error_flag ( void ) const { return _error_flag; } - - /// Construct the interpolation set \c Y. - /** - \param center Model center -- \b IN. - \param interpolation_radius Interpolation radius -- \b IN. - \param max_Y_size Maximum number of elements in \c Y -- \b IN. - */ - void construct_Y ( const NOMAD::Point & center , - const NOMAD::Point & interpolation_radius , - int max_Y_size ); - - /// Construct \c m models (one by output). - /** - \param use_WP Use or not well-poisedness -- \b IN. - \param eps Epsilon -- \b IN. - \param max_mpn Maximum \c m+n value for SVD matrices -- \b IN. - \param max_Y_size Maximum number of elements in \c Y -- \b IN. - */ - void construct ( bool use_WP , - double eps , - int max_mpn , - int max_Y_size ); - - /// Define scaling to put all coordinates centered in \c [-r;r]. - /** - - Looks also for fixed variables. - \param r The \c r parameter corresponds to \c MODEL_RADIUS_FACTOR -- \b IN. - */ - void define_scaling ( const NOMAD::Double & r ); - - /// Define scaling based on directions. See paper: Reducing the number of function evaluations in Mesh Adaptive Direct Search algorithms, Audet, Ianni, LeDigabel, Tribes, 2014 - /** - - Looks also for fixed variables. - \param dirP The \c dirP parameter corresponds to set of directions formin a hyper-cube centered on poll center -- \b IN. - \param delta_m The \c delta_m parameter is the dimension of the mesh -- \b IN. - \param epsilon The \c epsilon parameter is the hyper-cube offset from the poll center -- \b IN. - */ - void define_scaling_by_directions ( const std::list<NOMAD::Direction> & dirP, const NOMAD::Point & delta_m, const NOMAD::Double &epsilon ); - - - /// Scale a point. - /** - \param x The point to scale -- \b IN/OUT. - \return \c true if the scaling worked. - */ - bool scale ( NOMAD::Point & x ) const; - - /// Unscale a point. - /** - \param x The point to unscale -- \b IN/OUT. - \return \c true if the unscaling worked. - */ - bool unscale ( NOMAD::Point & x ) const; - - /// Unscale the gradient at a point. - /** - \param x The grad to unscale -- \b IN/OUT. - \return \c true if the unscaling worked. - */ - bool unscale_grad ( NOMAD::Point & x ) const; - - - /// Check if a caled point is inside the trust radius. - /** - \param x The scaled point -- \b IN. - \return \c true is \c x is in the trust radius. - */ - bool is_within_trust_radius ( const NOMAD::Point & x ) const; - - /// Display the model coefficients. - /** - \param out The NOMAD::Display object -- \b IN. - */ - void display_model_coeffs ( const NOMAD::Display & out ) const; - - /// Display the interpolation set \c Y. - /** - \param out The NOMAD::Display object -- \b IN. - \param title Title of the display block -- \b IN - --\b optional (default="interpolation set Y"). - */ - void display_Y ( const NOMAD::Display & out , - const std::string & title = "interpolation set Y" ) const; - - /// Display cumulated error on the interpolation points. - /** - \param out The NOMAD::Display object -- \b IN. - */ - void display_Y_error ( const NOMAD::Display & out ) const; - }; + + /*-------------------------------------------------------------------------*/ + public: + + /// Constructor. + /** + \param out The NOMAD::Display object -- \b IN. + \param bbot Output types -- \b IN. + \param cache Cache -- \b IN. + \param signature Signature -- \b IN. + */ + Quad_Model ( const NOMAD::Display & out , + const std::vector<NOMAD::bb_output_type> & bbot , + const NOMAD::Cache & cache , + const NOMAD::Signature & signature ); + + /// Destructor. + virtual ~Quad_Model ( void ); + + /// Evaluate a model at a given point. + /** + \param x The point -- \b IN. + \param alpha Model parameters -- \b IN. + \return Model value. + */ + NOMAD::Double eval ( const NOMAD::Point & x , + const NOMAD::Point & alpha ) const; + + /// Compute model \c h and \c f values at a point. + /** + \param x The point -- \b IN. + \param h_min Value of \c h_min -- \b IN.. + \param h_norm Norm used to compute \c h -- \b IN.. + \param h Value of \c h -- \b OUT. + \param f Value of \c f -- \b OUT. + */ + void eval_hf ( const NOMAD::Point & x , + const NOMAD::Double & h_min , + NOMAD::hnorm_type h_norm , + NOMAD::Double & h , + NOMAD::Double & f ) const; + + + /// Access to the interpolation type. + /** + \return The interpolation type. + */ + const NOMAD::interpolation_type & get_interpolation_type ( void ) const + { + return _interpolation_type; + } + + /// Access to the center of the model. + /** + \return The center. + */ + const NOMAD::Point & get_center ( void ) const { return _center; } + + /// Access to the dimension. + /** + \return The dimension \c n. + */ + int get_n ( void ) const { return _n; } + + /// Access to the number of free variables. + /** + \return The number of free variables \c n. + */ + int get_nfree ( void ) const { return _nfree; } + + /// Access to the model parameters. + /** + \return The model parameters \c alpha. + */ + NOMAD::Point ** get_alpha ( void ) const { return _alpha; } + + /// Check if the model is ready for evaluations. + /** + \return A boolean equal to \c true if the model is ready. + */ + bool check ( void ) const; + + /// Access to the fixed variables. + /** + \param i Variable index -- \b IN. + \return \c true if variable \c i is fixed. + */ + bool variable_is_fixed ( int i ) const { return _fixed_vars[i]; } + + /// Access to the number of interpolation points. + /** + \return The number of interpolation points \c nY=p+1. + */ + int get_nY ( void ) const { return static_cast<int> ( _Y.size() ); } + + /// Access to the condition number. + /** + \return The condition number. + */ + const NOMAD::Double & get_cond ( void ) const { return _cond; } + + /// Access to the error flag. + /** + \return The error flag. + */ + bool get_error_flag ( void ) const { return _error_flag; } + + /// Construct the interpolation set \c Y. + /** + \param center Model center -- \b IN. + \param interpolation_radius Interpolation radius -- \b IN. + \param max_Y_size Maximum number of elements in \c Y -- \b IN. + */ + void construct_Y ( const NOMAD::Point & center , + const NOMAD::Point & interpolation_radius , + int max_Y_size ); + + /// Construct \c m models (one by output). + /** + \param use_WP Use or not well-poisedness -- \b IN. + \param eps Epsilon -- \b IN. + \param max_mpn Maximum \c m+n value for SVD matrices -- \b IN. + \param max_Y_size Maximum number of elements in \c Y -- \b IN. + */ + void construct ( bool use_WP , + double eps , + int max_mpn , + int max_Y_size ); + + /// Define scaling to put all coordinates centered in \c [-r;r]. + /** + - Looks also for fixed variables. + \param r The \c r parameter corresponds to \c MODEL_RADIUS_FACTOR -- \b IN. + */ + void define_scaling ( const NOMAD::Double & r ); + + /// Define scaling based on directions. See paper: Reducing the number of function evaluations in Mesh Adaptive Direct Search algorithms, Audet, Ianni, LeDigabel, Tribes, 2014 + /** + - Looks also for fixed variables. + \param dirP The \c dirP parameter corresponds to set of directions formin a hyper-cube centered on poll center -- \b IN. + \param delta_m The \c delta_m parameter is the dimension of the mesh -- \b IN. + \param epsilon The \c epsilon parameter is the hyper-cube offset from the poll center -- \b IN. + */ + void define_scaling_by_directions ( const std::list<NOMAD::Direction> & dirP, const NOMAD::Point & delta_m, const NOMAD::Double &epsilon ); + + + /// Scale a point. + /** + \param x The point to scale -- \b IN/OUT. + \return \c true if the scaling worked. + */ + bool scale ( NOMAD::Point & x ) const; + + /// Unscale a point. + /** + \param x The point to unscale -- \b IN/OUT. + \return \c true if the unscaling worked. + */ + bool unscale ( NOMAD::Point & x ) const; + + /// Unscale the gradient at a point. + /** + \param x The grad to unscale -- \b IN/OUT. + \return \c true if the unscaling worked. + */ + bool unscale_grad ( NOMAD::Point & x ) const; + + + /// Check if a caled point is inside the trust radius. + /** + \param x The scaled point -- \b IN. + \return \c true is \c x is in the trust radius. + */ + bool is_within_trust_radius ( const NOMAD::Point & x ) const; + + /// Display the model coefficients. + /** + \param out The NOMAD::Display object -- \b IN. + */ + void display_model_coeffs ( const NOMAD::Display & out ) const; + + /// Display the interpolation set \c Y. + /** + \param out The NOMAD::Display object -- \b IN. + \param title Title of the display block -- \b IN + --\b optional (default="interpolation set Y"). + */ + void display_Y ( const NOMAD::Display & out , + const std::string & title = "interpolation set Y" ) const; + + /// Display cumulated error on the interpolation points. + /** + \param out The NOMAD::Display object -- \b IN. + */ + void display_Y_error ( const NOMAD::Display & out ) const; + }; } #endif diff --git a/src/Quad_Model_Evaluator.cpp b/src/Quad_Model_Evaluator.cpp index 17380313b371039e222e32d0c902d2e3e3ec6185..16497f23233c785cf0596cb93f676559673d2092 100644 --- a/src/Quad_Model_Evaluator.cpp +++ b/src/Quad_Model_Evaluator.cpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Quad_Model_Evaluator.cpp \brief NOMAD::Evaluator subclass for quadratic model optimization (implementation) @@ -54,12 +56,12 @@ /*-----------------------------*/ NOMAD::Quad_Model_Evaluator::Quad_Model_Evaluator ( const NOMAD::Parameters & p , const NOMAD::Quad_Model & model ) : -_n ( model.get_n() ) , -_nm1 ( _n-1 ) , -_m ( p.get_bb_nb_outputs() ) , -_x ( NULL ) , -_alpha ( NULL ) , -_model_ready ( model.check() ) +_n ( model.get_n() ) , +_nm1 ( _n-1 ) , +_m ( p.get_bb_nb_outputs() ) , +_x ( NULL ) , +_alpha ( NULL ) , +_model_ready ( model.check() ) { if ( _model_ready ) { @@ -174,14 +176,6 @@ bool NOMAD::Quad_Model_Evaluator::eval_x ( NOMAD::Eval_Point & x , z += alpha[++k] * _x[i] * _x[j]; - // SLD special rounding to 8 decimals in order to improve numerical stability: - // { - // long double prec = 1e-8; - // z = ( z < 0.0 ? - // -floor(-z/prec + .5) : - // floor( z/prec + .5) ) * prec; - // } - x.set_bb_output ( oi , z ); } diff --git a/src/Quad_Model_Evaluator.hpp b/src/Quad_Model_Evaluator.hpp index c99ffe0e53181e45fec9e27933f4907f71a26eee..ad7cae2b20531267ec99b48d864efd3a5d87fd1f 100644 --- a/src/Quad_Model_Evaluator.hpp +++ b/src/Quad_Model_Evaluator.hpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Quad_Model_Evaluator.hpp \brief NOMAD::Evaluator subclass for quadratic model optimization (headers) diff --git a/src/Quad_Model_Search.cpp b/src/Quad_Model_Search.cpp index b4560f04015af0df912d8d1af8ce13ff81484129..694d80bdb5fac24824fb33e7fe85669ff4ec6efc 100644 --- a/src/Quad_Model_Search.cpp +++ b/src/Quad_Model_Search.cpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Quad_Model_Search.cpp \brief Quadratic Model search (implementation) @@ -60,7 +62,7 @@ /* */ /* . MODEL_SEARCH_OPTIMISTIC: if true, the direction from the */ /* model center to the trial point */ -/* is computed and prossibly used */ +/* is computed and possibly used */ /* in the speculative search */ /* default=yes */ /* */ @@ -567,7 +569,7 @@ void NOMAD::Quad_Model_Search::create_trial_point ( NOMAD::Evaluator_Control & e } - // Round for integer and variables: + // Round for integer and binary variables: bool has_integer=false; bool has_binary=false; for (int i=0;i<n;i++) @@ -836,7 +838,7 @@ bool NOMAD::Quad_Model_Search::optimize_model ( const NOMAD::Quad_Model & model flag_reset_barriers , flag_p1_active ); - NOMAD::Mads::set_flag_check_bimads ( false ); + NOMAD::Mads::set_flag_check_bimads (false ); NOMAD::Mads::set_flag_reset_mesh ( true ); NOMAD::Mads::set_flag_reset_barriers ( true ); NOMAD::Mads::set_flag_p1_active ( false ); diff --git a/src/Quad_Model_Search.hpp b/src/Quad_Model_Search.hpp index a00dda51a5a16ff216cee676acfc68a44d4150dc..4f5bd3df9dc43591106aae03c98d317e70023261 100644 --- a/src/Quad_Model_Search.hpp +++ b/src/Quad_Model_Search.hpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Quad_Model_Search.hpp \brief Quadratic Model search (headers) @@ -93,7 +95,7 @@ namespace NOMAD { \param model The model -- \b IN. \param signature Signature -- \b IN. \param mesh_indices Mesh indic -- \b IN. - \param delta Mesh size parameter -- \b IN. + \param delta Mesh size parameter -- \b IN. \param display_degree Display degree -- \b IN. \param out The NOMAD::Display object -- \b IN. */ diff --git a/src/RNG.cpp b/src/RNG.cpp index 6010f3ef43d484758502d474dc7a029a6548e29b..3a08b5e96229737e447b34d830bbe87a49bc7ec8 100644 --- a/src/RNG.cpp +++ b/src/RNG.cpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file RNG.cpp \brief Custom class for random number generator (implementation) @@ -72,7 +74,7 @@ void NOMAD::RNG::set_seed(int s) throw NOMAD::Exception ( "RNG.cpp" , __LINE__ , "NOMAD::RNG::set_seed(): invalid seed. Seed should be in [0,INT_MAX]" ); - reset_seed_to_default(); + reset_private_seed_to_default(); for ( int i=0 ; i<_s ; i++) NOMAD::RNG::rand(); diff --git a/src/RNG.hpp b/src/RNG.hpp index bc3e897efb00bed3f3466f31ac96c2375248dc42..8678cb98b4e587a581583853d04df49b39f080f2 100644 --- a/src/RNG.hpp +++ b/src/RNG.hpp @@ -1,50 +1,51 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + /** \file RNG.hpp \brief Custom class for random number generator - \author Christophe Tribes and Sebastien Le Digabel + \author Christophe Tribes and Sebastien Le Digabel \date 2011-09-28 \see RNG.cpp */ @@ -58,84 +59,89 @@ using namespace std; namespace NOMAD { - + /// Class for random number generator - /** + /** This class is used to set a seed for the random number generator and get a random integer or a random double between two values. - */ - class RNG { + */ + class RNG { + + public: - public: - /// Get current seed - /* - /return An integer in [0,UINT32_MAX]. - */ + /// Get current seed + /* + /return An integer in [0,UINT32_MAX]. + */ static int get_seed ( void ) { return static_cast<int>(_s); } - /// Reset seed to its default value - static void reset_seed_to_default ( void ) - { - _x=x_def; - _y=y_def; - _z=z_def; - } - - /// Set seed - /* - /param s The seed -- \b IN. - */ - static void set_seed(int s); - - - /// Get a random integer as uint32 - /** This function serves to obtain a random number \c - /return An integer in the interval [0,UINT32_MAX]. - */ - static uint32_t rand(); - + /// Set seed + /* + /param s The seed -- \b IN. + */ + static void set_seed(int s); + + + /// Get a random integer as uint32 + /** This function serves to obtain a random number \c + /return An integer in the interval [0,UINT32_MAX]. + */ + static uint32_t rand(); - /// Get a random number having a normal distribution as double - /* + + /// Get a random number having a normal distribution as double + /* /param a Lower bound -- \b IN. /param b Upper bound -- \b IN. /return A double in the interval [a,b]. - */ - static double rand(double a, double b) + */ + static double rand(double a, double b) { return a+((b-a)*NOMAD::RNG::rand())/UINT32_MAX; } - - /// Get a random number approaching a normal distribution (N(0,Var)) as double - // A series of Nsample random numbers Xi in the interval [-sqrt(3*Var);+sqrt(3*Var)] is used -> E[Xi]=0, Var(Xi)=var - // see http://en.wikipedia.org/wiki/Central_limit_theorem - /* - /param Nsample Number of samples for averaging -- \b IN. - /param Var Variance of the target normal distribution -- \b IN. + + /// Get a random number approaching a normal distribution (N(0,Var)) as double + // A series of Nsample random numbers Xi in the interval [-sqrt(3*Var);+sqrt(3*Var)] is used -> E[Xi]=0, Var(Xi)=var + // see http://en.wikipedia.org/wiki/Central_limit_theorem + /* + /param Nsample Number of samples for averaging -- \b IN. + /param Var Variance of the target normal distribution -- \b IN. /return A double in the interval [-sqrt(3*Var);+sqrt(3*Var)]. - */ - static double normal_rand_mean_0( double Var=1 , int Nsample=12 ) ; + */ + static double normal_rand_mean_0( double Var=1 , int Nsample=12 ) ; /// Get a random number approaching a normal distribution ( N(Mean,Var) ) as double - /* - /param Mean Mean of the target normal distribution -- \b IN. - /param Var Variance of the target normal distribution -- \b IN. + /* + /param Mean Mean of the target normal distribution -- \b IN. + /param Var Variance of the target normal distribution -- \b IN. /return A random number. - */ + */ static double normal_rand( double Mean=0 , double Var=1 ) ; + /// Reset seed to its default value + static void reset_private_seed_to_default ( void ) + { + _x=x_def; + _y=y_def; + _z=z_def; + } + + - private: + private: static uint32_t x_def,y_def,z_def,_x,_y,_z; ///< Default parameter value for the random number generator (_s used as the seed). + static int _s; - }; + + + }; } diff --git a/src/Random_Pickup.cpp b/src/Random_Pickup.cpp index 1c26f8322ac17b4a269bba188af2fe954b125004..4e4800cd730088060ae14944e3273dd3d43cb6d9 100644 --- a/src/Random_Pickup.cpp +++ b/src/Random_Pickup.cpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Random_Pickup.cpp \brief Class for randomly pick up integers (implementation) diff --git a/src/Random_Pickup.hpp b/src/Random_Pickup.hpp index 859d61bf1213b327484afa6f717f2433ed0c6a9d..3918c2752fd62ca3507776aef188f8100f45bddc 100644 --- a/src/Random_Pickup.hpp +++ b/src/Random_Pickup.hpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Random_Pickup.hpp \brief Class for randomly pick up integers (headers) diff --git a/src/SMesh.cpp b/src/SMesh.cpp index 3fefbfc55e6b86c581d3e37f1d9b79bee3ff34a7..a459f0321c98dbe02639a2ca2ee2d12cb92e2770 100644 --- a/src/SMesh.cpp +++ b/src/SMesh.cpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file SMesh.cpp \brief Class for the MADS mesh (implementation) @@ -108,7 +110,7 @@ void NOMAD::SMesh::update ( NOMAD::success_type success , /*-----------------------------------------------------------*/ void NOMAD::SMesh::set_mesh_indices ( const NOMAD::Point & r ) { - if ( !r.is_defined() ) + if (!r.is_defined()) _mesh_index=0; else _mesh_index=r[0].NOMAD::Double::round(); // Warning no need to check that the double will convert nicely to an int because mesh_index will range [-50;50] @@ -126,9 +128,7 @@ void NOMAD::SMesh::set_mesh_indices ( const NOMAD::Point & r ) /*-----------------------------------------------------------*/ void NOMAD::SMesh::set_limit_mesh_index ( int l ) { - _limit_mesh_index=l; - } @@ -213,8 +213,8 @@ bool NOMAD::SMesh::check_min_mesh_size_criterion ( ) const } /*----------------------------------------------------------------*/ -/* get delta (mesh size parameter) */ -/* delta^k = delta^0 \tau^{ell_0^+ - ell_k^+} */ +/* get delta (mesh size parameter) */ +/* delta^k = delta^0 \tau^{ell_0^+ - ell_k^+} */ /*----------------------------------------------------------------*/ /* the function also returns true if one value is < delta_min */ /* (stopping criterion MIN_MESH_SIZE) */ @@ -246,8 +246,8 @@ bool NOMAD::SMesh::get_delta ( NOMAD::Point & delta ) const } /*----------------------------------------------------------------*/ -/* get delta (mesh size parameter) */ -/* delta^k = delta^0 \tau^{ell_0^+ - ell_k^+} */ +/* get delta (mesh size parameter) */ +/* delta^k = delta^0 \tau^{ell_0^+ - ell_k^+} */ /*----------------------------------------------------------------*/ NOMAD::Double NOMAD::SMesh::get_delta ( int i ) const { @@ -267,7 +267,7 @@ NOMAD::Double NOMAD::SMesh::get_delta ( int i ) const /*----------------------------------------------------------------*/ -/* get delta_max (the larget mesh size) */ +/* get delta_max (the larget mesh size) */ /*----------------------------------------------------------------*/ NOMAD::Point NOMAD::SMesh::get_delta_max ( ) const { @@ -289,11 +289,11 @@ NOMAD::Point NOMAD::SMesh::get_delta_max ( ) const /*-------------------------------------------------------------------*/ -/* get Delta (poll size parameter) */ -/* Delta^k = Delta^m_k \tau^{ |ell_k|/2 } */ -/* = delta^0 \tau^{ell_0^+ - ell_k^+ + |ell_k|/2} */ +/* get Delta (poll size parameter) */ +/* Delta^k = Delta^m_k \tau^{ |ell_k|/2 } */ +/* = delta^0 \tau^{ell_0^+ - ell_k^+ + |ell_k|/2} */ /*-------------------------------------------------------------------*/ -/* the function also returns true if all values are < Delta_min */ +/* the function also returns true if all values are < Delta_min */ /* (stopping criterion MIN_POLL_SIZE) */ /*-------------------------------------------------------------------*/ bool NOMAD::SMesh::get_Delta ( NOMAD::Point & Delta ) const @@ -324,12 +324,12 @@ bool NOMAD::SMesh::get_Delta ( NOMAD::Point & Delta ) const } /*-------------------------------------------------------------------*/ -/* get Delta (poll size parameter) */ -/* Delta^k = Delta^m_k \tau^{ |ell_k|/2 } */ -/* = delta^0 \tau^{ell_0^+ - ell_k^+ + |ell_k|/2} */ -/*--------------------------------------------------------------*/ -/* the function returns Delta >= Delta_min */ -/*--------------------------------------------------------------*/ +/* get Delta (poll size parameter) */ +/* Delta^k = Delta^m_k \tau^{ |ell_k|/2 } */ +/* = delta^0 \tau^{ell_0^+ - ell_k^+ + |ell_k|/2} */ +/*-------------------------------------------------------------------*/ +/* the function returns Delta >= Delta_min */ +/*-------------------------------------------------------------------*/ NOMAD::Double NOMAD::SMesh::get_Delta ( int i ) const { diff --git a/src/SMesh.hpp b/src/SMesh.hpp index ed18f210ff2d48f91ad545f0fc85e1b71c5dbcd6..ddfd0d4c699f0f944899ba72bd0cbebacab8f4e5 100644 --- a/src/SMesh.hpp +++ b/src/SMesh.hpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file SMesh.hpp \brief Class for the static orthogonal MADS mesh (headers) @@ -72,29 +74,29 @@ namespace NOMAD { (one value for each variable). The scaling is done once based on initial mesh size. - See the MADS papers for more details on the mesh. */ - - class SMesh : public NOMAD::OrthogonalMesh { - - private: - - int _initial_mesh_index; - int _mesh_index; - int _min_mesh_index; ///< Minimal value reached by the mesh index - int _max_mesh_index; ///< Maximal value reached by the mesh index - - /*--------------------------------------------------------------*/ - - /// Private affectation operator. - /** - \param m The right-hand side object -- \b IN. - */ - const SMesh & operator = ( const SMesh & m ); - - /// Check the minimal poll size criterion. - bool check_min_poll_size_criterion ( ) const; - - /// Check the minimal mesh size criterion. - bool check_min_mesh_size_criterion ( ) const; + + class SMesh : public NOMAD::OrthogonalMesh { + + private: + + int _initial_mesh_index; + int _mesh_index; + int _min_mesh_index; ///< Minimal value reached by the mesh index + int _max_mesh_index; ///< Maximal value reached by the mesh index + + /*--------------------------------------------------------------*/ + + /// Private affectation operator. + /** + \param m The right-hand side object -- \b IN. + */ + const SMesh & operator = ( const SMesh & m ); + + /// Check the minimal poll size criterion. + bool check_min_poll_size_criterion ( ) const; + + /// Check the minimal mesh size criterion. + bool check_min_mesh_size_criterion ( ) const; /// Access to the mesh size parameter delta^k. /** @@ -111,42 +113,42 @@ namespace NOMAD { */ NOMAD::Double get_Delta ( int i ) const ; - - - /*--------------------------------------------------------------*/ - - public: - - /// Constructor. - /** - \param delta_0 Initial mesh size delta_0 -- \b IN. - \param Delta_min Minimal poll size Delta_min (may be undefined) -- \b IN. - \param delta_min Minimal mesh size delta_min (may be undefined) -- \b IN. - \param mesh_update_basis Mesh update basis (tau), default=4 -- \b IN. - \param mesh_coarsening_step Mesh coarsening step (w+), default=1 -- \b IN. - \param mesh_refining_step Mesh refining step (w-), default=-1 -- \b IN. - \param initial_mesh_index Initial mesh index ell_0, default=0 -- \b IN. - \param limit_max_mesh_index Limit max of the mesh index, default=L_LIMITS -- \b IN. + + + /*--------------------------------------------------------------*/ + + public: + + /// Constructor. + /** + \param delta_0 Initial mesh size delta_0 -- \b IN. + \param Delta_min Minimal poll size Delta_min (may be undefined) -- \b IN. + \param delta_min Minimal mesh size delta_min (may be undefined) -- \b IN. \param fixed_variables Fixed variables -- \b IN. - */ - SMesh ( const NOMAD::Point& delta_0 , - const NOMAD::Point & Delta_min , - const NOMAD::Point & delta_min , + \param mesh_update_basis Mesh update basis (tau), default=4 -- \b IN. + \param mesh_coarsening_step Mesh coarsening step (w+), default=1 -- \b IN. + \param mesh_refining_step Mesh refining step (w-), default=-1 -- \b IN. + \param initial_mesh_index Initial mesh index ell_0, default=0 -- \b IN. + \param limit_max_mesh_index Limit max of the mesh index, default=L_LIMITS -- \b IN. + */ + SMesh ( const NOMAD::Point & delta_0 , + const NOMAD::Point & Delta_min , + const NOMAD::Point & delta_min , const NOMAD::Point & fixed_variables , - NOMAD::Double mesh_update_basis=4.0, - int mesh_coarsening_step=1, - int mesh_refining_step=-1, - int initial_mesh_index=0, + NOMAD::Double mesh_update_basis=4.0, + int mesh_coarsening_step=1, + int mesh_refining_step=-1, + int initial_mesh_index=0, int limit_max_mesh_index=NOMAD::L_LIMITS) - : NOMAD::OrthogonalMesh ( false, + : NOMAD::OrthogonalMesh ( false, delta_0, - Delta_min, - delta_min, + Delta_min, + delta_min, fixed_variables, NOMAD::Point(), - mesh_update_basis, - mesh_coarsening_step, - mesh_refining_step , + mesh_update_basis, + mesh_coarsening_step, + mesh_refining_step , limit_max_mesh_index ), _initial_mesh_index ( initial_mesh_index ), _mesh_index ( _initial_mesh_index ), @@ -154,19 +156,19 @@ namespace NOMAD { _max_mesh_index ( initial_mesh_index ) {} - /// Copy constructor. - /** - \param m The copied object -- \b IN. - */ - SMesh ( const SMesh & m ) - : OrthogonalMesh(m) , - _initial_mesh_index ( m._initial_mesh_index ), - _mesh_index ( m._initial_mesh_index ), - _min_mesh_index( m._initial_mesh_index ), - _max_mesh_index ( m._initial_mesh_index ) {} - - /// Destructor. - virtual ~SMesh ( void ) + /// Copy constructor. + /** + \param m The copied object -- \b IN. + */ + SMesh ( const SMesh & m ) + : OrthogonalMesh(m) , + _initial_mesh_index ( m._initial_mesh_index ), + _mesh_index ( m._initial_mesh_index ), + _min_mesh_index( m._initial_mesh_index ), + _max_mesh_index ( m._initial_mesh_index ) {} + + /// Destructor. + virtual ~SMesh ( void ) { _delta_0.clear(); _Delta_0.clear(); @@ -174,146 +176,146 @@ namespace NOMAD { _Delta_min.clear(); } - - /// Access to the mesh index. - /** - \return A Point with the mesh index. - */ - const NOMAD::Point get_mesh_indices ( void ) const + + /// Access to the mesh index. + /** + \return A Point with the mesh index. + */ + const NOMAD::Point get_mesh_indices ( void ) const { return NOMAD::Point( 1 , NOMAD::Double(_mesh_index) ); } - /// Access to the min mesh index reached so far. - /** - \return A Point with the mesh index. - */ - const NOMAD::Point get_min_mesh_indices ( void ) const + /// Access to the min mesh index reached so far. + /** + \return A Point with the mesh index. + */ + const NOMAD::Point get_min_mesh_indices ( void ) const { return NOMAD::Point( 1 , NOMAD::Double(_min_mesh_index) ); } + - - /// Access to the max mesh index reached so far. - /** - \return A Point with the mesh index. - */ - const NOMAD::Point get_max_mesh_indices ( void ) const + /// Access to the max mesh index reached so far. + /** + \return A Point with the mesh index. + */ + const NOMAD::Point get_max_mesh_indices ( void ) const { return NOMAD::Point( 1 , NOMAD::Double(_max_mesh_index) ); } + + + /// Manually set the mesh index using a point. (set_mesh_indices for consistency with XMesh) + /** + \param r The mesh index provided as a point -- \b IN. + */ + void set_mesh_indices ( const NOMAD::Point & r ); - - /// Manually set the mesh index using a point. (set_mesh_indices for consistency with XMesh) - /** - \param r The mesh index provided as a point -- \b IN. - */ - void set_mesh_indices ( const NOMAD::Point & r ); - - + /// Manually set the limit mesh index used for termination criterion (max value for SMesh). - /** - \param l The limit mesh index for all coordinates -- \b IN. - */ - void set_limit_mesh_index ( int l ); - - - - /// Test if finest mesh so far. - /** - \return True if mesh index greater or equal to the maximal mesh index; False otherwise. - */ - bool is_finest(void) const {return _mesh_index >= _max_mesh_index; } - - - /// Access to the mesh ratios after a success - /** - \return A point with the ratio for each coordinate - */ - NOMAD::Point get_mesh_ratio_if_success( void ) const; - - - /// Update the provided mesh indices (the Mesh is unchanged). - /** - \param success Type of success of the iteration -- \b IN. - \param mesh_indices The mesh indices before and after the update -- \b IN/OUT. - \param dir The direction that is considered (opt) -- \b IN. - */ - void update ( NOMAD::success_type success , NOMAD::Point & mesh_indices, const NOMAD::Direction *dir=NULL ) const ; - - - /// Update the Mesh. - /** - \param success Type of success of the iteration -- \b IN. - \param dir The direction that is considered (opt) -- \b IN. - */ - void update ( NOMAD::success_type success , const NOMAD::Direction *dir=NULL); - - - /// Reset the mesh to its original size (mesh indices). - void reset ( void ) + /** + \param l The limit mesh index for all coordinates -- \b IN. + */ + void set_limit_mesh_index ( int l ); + + + + /// Test if finest mesh so far. + /** + \return True if mesh index greater or equal to the maximal mesh index; False otherwise. + */ + bool is_finest(void) const {return _mesh_index >= _max_mesh_index; } + + + /// Access to the mesh ratios after a success + /** + \return A point with the ratio for each coordinate + */ + NOMAD::Point get_mesh_ratio_if_success( void ) const; + + + /// Update the provided mesh indices (the Mesh is unchanged). + /** + \param success Type of success of the iteration -- \b IN. + \param mesh_indices The mesh indices before and after the update -- \b IN/OUT. + \param dir The direction that is considered (opt) -- \b IN. + */ + void update ( NOMAD::success_type success , NOMAD::Point & mesh_indices, const NOMAD::Direction *dir=NULL ) const ; + + + /// Update the Mesh. + /** + \param success Type of success of the iteration -- \b IN. + \param dir The direction that is considered (opt) -- \b IN. + */ + void update ( NOMAD::success_type success , const NOMAD::Direction *dir=NULL); + + + /// Reset the mesh to its original size (mesh indices). + void reset ( void ) { set_mesh_indices( NOMAD::Point(1,NOMAD::Double(_initial_mesh_index))) ; - _min_mesh_index=_initial_mesh_index ; - _max_mesh_index=_initial_mesh_index; + _min_mesh_index=_initial_mesh_index ; + _max_mesh_index=_initial_mesh_index; } - - /// Access to the mesh size parameter delta^k. - /** - \param delta The mesh size parameter delta^k -- \b OUT. - \return A boolean equal to \c true if all values are - strictly inferior than the associated minimal - mesh size delta_min - (stopping criterion MIN_MESH_SIZE). - */ - virtual bool get_delta ( NOMAD::Point & delta ) const ; - - + + /// Access to the mesh size parameter delta^k. + /** + \param delta The mesh size parameter delta^k -- \b OUT. + \return A boolean equal to \c true if all values are + strictly inferior than the associated minimal + mesh size delta_min + (stopping criterion MIN_MESH_SIZE). + */ + virtual bool get_delta ( NOMAD::Point & delta ) const ; + + - /// Access to the larget mesh size so far. - /** - \return delta_max The largest mesh size reached so far -- \b OUT. - */ + /// Access to the larget mesh size so far. + /** + \return delta_max The largest mesh size reached so far -- \b OUT. + */ NOMAD::Point get_delta_max ( void ) const ; + + /// Access to the poll size parameter Delta^k. + /** + \param Delta The poll size parameter Delta^k -- \b OUT. + \return A boolean equal to \c true if all values are + strictly inferior than the associated minimal + mesh size Delta_min + (stopping criterion MIN_POLL_SIZE). + */ + virtual bool get_Delta ( NOMAD::Point & Delta ) const ; + - /// Access to the poll size parameter Delta^k. - /** - \param Delta The poll size parameter Delta^k -- \b OUT. - \return A boolean equal to \c true if all values are - strictly inferior than the associated minimal - mesh size Delta_min - (stopping criterion MIN_POLL_SIZE). - */ - virtual bool get_Delta ( NOMAD::Point & Delta ) const ; - - - /// Check the stopping conditions on the minimal poll and mesh sizes. - /** - \param stop Stop flag -- \b IN/OUT. - \param stop_reason Stop reason -- \b OUT. - */ - void check_min_mesh_sizes ( bool & stop , + /// Check the stopping conditions on the minimal poll and mesh sizes. + /** + \param stop Stop flag -- \b IN/OUT. + \param stop_reason Stop reason -- \b OUT. + */ + void check_min_mesh_sizes ( bool & stop , NOMAD::stop_type & stop_reason ) const; - /// Display. - /** - \param out The NOMAD::Display object -- \b IN. - */ - void display ( const NOMAD::Display & out ) const; - - + /// Display. + /** + \param out The NOMAD::Display object -- \b IN. + */ + void display ( const NOMAD::Display & out ) const; + + /// Scale and project the ith component of a vector on the mesh /** - \param i The vector component number -- \b IN. - \param l The vector component value -- \b IN. - \param round_up Flag for rounding up -- \b IN. - \return The ith component of a vector after mesh scaling and projection + \param i The vector component number -- \b IN. + \param l The vector component value -- \b IN. + \param round_up The flag for round up -- \b IN. + \return The ith component of a vector after mesh scaling and projection */ - NOMAD::Double scale_and_project(int i, const NOMAD::Double & l, bool round_up ) const ; - + NOMAD::Double scale_and_project(int i, const NOMAD::Double & l, bool round_up ) const ; - }; + + }; } #endif diff --git a/src/Search.hpp b/src/Search.hpp index 034aed14f708cb24af68d9f135489385e1bb5476..c9e92841c4b1575d8833fcc19508ebd84bc86f69 100644 --- a/src/Search.hpp +++ b/src/Search.hpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Search.hpp \brief Generic class for search strategies (headers) diff --git a/src/Set_Element.hpp b/src/Set_Element.hpp index 510dcf72595c87465875a9bb2cd8098600881be2..bf8c04330cd114b8e40ea853a97b9e8967ee0c37 100644 --- a/src/Set_Element.hpp +++ b/src/Set_Element.hpp @@ -1,172 +1,174 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** - \file Set_Element.hpp - \brief Element of a set (headers) - \author Sebastien Le Digabel - \date 2010-04-12 - */ + \file Set_Element.hpp + \brief Element of a set (headers) + \author Sebastien Le Digabel + \date 2010-04-12 +*/ #ifndef __SET_ELEMENT__ #define __SET_ELEMENT__ namespace NOMAD { - - // forward declarations: - class Double; - class Eval_Point; - - /// Generic class for elements of a \c std::set. - /** + + // forward declarations: + class Double; + class Eval_Point; + + /// Generic class for elements of a \c std::set. + /** This is an abstract class (it is not possible to create NOMAD::Set_Element objects). - */ - template <class T> - class Set_Element { - - private: - -#ifdef MEMORY_DEBUG - static int _cardinality; ///< Number of NOMAD::Set_Element objects in memory. - static int _max_cardinality; ///< Max number of NOMAd::Set_Element objects in memory. -#endif - - const T * _el; ///< A pointer to the element. - - /// Affectation operator. - /** - \param se The right-hand side object -- \b IN. - */ - Set_Element & operator = ( const Set_Element & se ); - - /// Copy constructor. - /** - \param se The copied object -- \b IN. - */ - Set_Element ( const Set_Element & se ); - - public: - - /// Constructor. - /** - \param el A pointer on the element -- \b IN. - */ - explicit Set_Element ( const T * el ) : _el ( el ) - { + */ + template <class T> + class Set_Element { + + private: + #ifdef MEMORY_DEBUG - ++Set_Element::_cardinality; - if ( Set_Element::_cardinality > Set_Element::_max_cardinality ) - ++Set_Element::_max_cardinality; + static int _cardinality; ///< Number of NOMAD::Set_Element objects in memory. + static int _max_cardinality; ///< Max number of NOMAd::Set_Element objects in memory. #endif - } - - /// Destructor. - virtual ~Set_Element ( void ) - { + + const T * _el; ///< A pointer to the element. + + /// Affectation operator. + /** + \param se The right-hand side object -- \b IN. + */ + Set_Element & operator = ( const Set_Element & se ); + + /// Copy constructor. + /** + \param se The copied object -- \b IN. + */ + Set_Element ( const Set_Element & se ); + + public: + + /// Constructor. + /** + \param el A pointer on the element -- \b IN. + */ + explicit Set_Element ( const T * el ) : _el ( el ) + { #ifdef MEMORY_DEBUG - --Set_Element::_cardinality; + ++Set_Element::_cardinality; + if ( Set_Element::_cardinality > Set_Element::_max_cardinality ) + ++Set_Element::_max_cardinality; #endif - } - - /// Specific NOMAD::Priority_Eval_Point elements of comparison. - /** - - Only NOMAD::Priority_Eval_Point::get_priority_criteria() does something. - - \see Priority_Eval_Point.hpp . - \param c1 A real -- \b IN. - \param c2 A real -- \b IN. - \param c3 A real -- \b IN. - \param c4 A real -- \b IN. - \param c5 A real -- \b IN. - \param c6 A real -- \b IN. - */ - virtual void get_priority_criteria ( NOMAD::Double & c1 , - NOMAD::Double & c2 , - NOMAD::Double & c3 , - NOMAD::Double & c4 , - NOMAD::Double & c5 , - NOMAD::Double & c6 ) const {} - /// Comparison operator. - /** - - Has to be implemented by every NOMAD::Set_Element subclass. - - Pure virtual method. - \param se The right-hand side object -- \b IN. - */ - virtual bool operator < ( const Set_Element & se ) const = 0; - - /// Access to the element. - /** - \return A pointer to the element. - */ - const T * get_element ( void ) const { return _el; } - - /// Set an element. - /** - \param el A pointer to the element -- \b IN. - */ - void set_element ( const T * el ) { _el = el; } - + } + + /// Destructor. + virtual ~Set_Element ( void ) + { #ifdef MEMORY_DEBUG - - /// Access to the number of NOMAD::Set_Element objects in memory. - /** - \return Number of NOMAD::Set_Element objects in memory. - */ - static int get_cardinality ( void ) { return Set_Element::_cardinality; } - - /// Access to the max number of NOMAD::Set_Element objects in memory. - /** - \return Max number of NOMAD::Set_Element objects in memory. - */ - static int get_max_cardinality ( void ) { return Set_Element::_max_cardinality; } - + --Set_Element::_cardinality; #endif - }; + } + + /// Specific NOMAD::Priority_Eval_Point elements of comparison. + /** + - Only NOMAD::Priority_Eval_Point::get_priority_criteria() does something. + - \see Priority_Eval_Point.hpp . + \param c1 A real -- \b IN. + \param c2 A real -- \b IN. + \param c3 A real -- \b IN. + \param c4 A real -- \b IN. + \param c5 A real -- \b IN. + \param c6 A real -- \b IN. + */ + virtual void get_priority_criteria ( NOMAD::Double & c1 , + NOMAD::Double & c2 , + NOMAD::Double & c3 , + NOMAD::Double & c4 , + NOMAD::Double & c5 , + NOMAD::Double & c6 ) const {} + /// Comparison operator. + /** + - Has to be implemented by every NOMAD::Set_Element subclass. + - Pure virtual method. + \param se The right-hand side object -- \b IN. + */ + virtual bool operator < ( const Set_Element & se ) const = 0; -#ifdef MEMORY_DEBUG + /// Access to the element. + /** + \return A pointer to the element. + */ + const T * get_element ( void ) const { return _el; } + + /// Set an element. + /** + \param el A pointer to the element -- \b IN. + */ + void set_element ( const T * el ) { _el = el; } - /// Initialization of _cardinality. - template<class T> int NOMAD::Set_Element<T>::_cardinality = 0; +#ifdef MEMORY_DEBUG + + /// Access to the number of NOMAD::Set_Element objects in memory. + /** + \return Number of NOMAD::Set_Element objects in memory. + */ + static int get_cardinality ( void ) { return Set_Element::_cardinality; } + + /// Access to the max number of NOMAD::Set_Element objects in memory. + /** + \return Max number of NOMAD::Set_Element objects in memory. + */ + static int get_max_cardinality ( void ) { return Set_Element::_max_cardinality; } - /// Initialization of _max_cardinality. - template<class T> int NOMAD::Set_Element<T>::_max_cardinality = 0; +#endif + }; + +#ifdef MEMORY_DEBUG + + /// Initialization of _cardinality. + template<class T> int NOMAD::Set_Element<T>::_cardinality = 0; + + /// Initialization of _max_cardinality. + template<class T> int NOMAD::Set_Element<T>::_max_cardinality = 0; #endif } diff --git a/src/Sgtelib_Model_Evaluator.cpp b/src/Sgtelib_Model_Evaluator.cpp new file mode 100644 index 0000000000000000000000000000000000000000..96374f6f321672af49bb80b15088b02f04da3e12 --- /dev/null +++ b/src/Sgtelib_Model_Evaluator.cpp @@ -0,0 +1,48 @@ +/*-------------------------------------------------------------------------------------*/ +/* sgtelib - A surrogate model library for derivative-free optimization */ +/* Version 2.0.1 */ +/* */ +/* Copyright (C) 2012-2016 Sebastien Le Digabel - Ecole Polytechnique, Montreal */ +/* Bastien Talgorn - McGill University, Montreal */ +/* */ +/* Author: Bastien Talgorn */ +/* email: bastientalgorn@fastmail.com */ +/* */ +/* This program is free software: you can redistribute it and/or modify it under the */ +/* terms of the GNU Lesser General Public License as published by the Free Software */ +/* Foundation, either version 3 of the License, or (at your option) any later */ +/* version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ +/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ +/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License along */ +/* with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on sgtelib at https://github.com/bastientalgorn/sgtelib */ +/*-------------------------------------------------------------------------------------*/ +/** + \file Sgtelib_Model_Evaluator.cpp + \brief Interface between nomad evaluator and Sgtelib_Model_Manager. + \author Bastien Talgorn + \date 2013-04-25 + \see Sgtelib_Model_Manager.cpp + */ + +#include "Sgtelib_Model_Evaluator.hpp" + + +/*------------------------------------------------------------------------*/ +/* evaluate the sgtelib_model model at a given trial point */ +/*------------------------------------------------------------------------*/ +bool NOMAD::Sgtelib_Model_Evaluator::eval_x ( NOMAD::Eval_Point & x , + const NOMAD::Double & h_max , + bool & count_eval ) const +{ + return _sgtelib_model_manager->eval_x( &x , + h_max , + count_eval ); +} + + diff --git a/src/Sgtelib_Model_Evaluator.hpp b/src/Sgtelib_Model_Evaluator.hpp new file mode 100644 index 0000000000000000000000000000000000000000..4daf5ff325e7fbe9e628f2cea620e43c8714f68d --- /dev/null +++ b/src/Sgtelib_Model_Evaluator.hpp @@ -0,0 +1,73 @@ +/*-------------------------------------------------------------------------------------*/ +/* sgtelib - A surrogate model library for derivative-free optimization */ +/* Version 2.0.1 */ +/* */ +/* Copyright (C) 2012-2016 Sebastien Le Digabel - Ecole Polytechnique, Montreal */ +/* Bastien Talgorn - McGill University, Montreal */ +/* */ +/* Author: Bastien Talgorn */ +/* email: bastientalgorn@fastmail.com */ +/* */ +/* This program is free software: you can redistribute it and/or modify it under the */ +/* terms of the GNU Lesser General Public License as published by the Free Software */ +/* Foundation, either version 3 of the License, or (at your option) any later */ +/* version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ +/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ +/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License along */ +/* with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on sgtelib at https://github.com/bastientalgorn/sgtelib */ +/*-------------------------------------------------------------------------------------*/ +/** + \file Sgtelib_Model_Evaluator.hpp + \brief Interface between nomad evaluator and Sgtelib_Model_Manager. + \author Bastien Talgorn + \date 2013-04-25 + \see Sgtelib_Model_Manager.cpp + */ + +#ifndef __SGTELIB_MODEL_EVALUATOR__ +#define __SGTELIB_MODEL_EVALUATOR__ + + +#include "Sgtelib_Model_Manager.hpp" +#include "Search.hpp" +#include "Evaluator.hpp" + + +namespace NOMAD { + + /// NOMAD::Evaluator subclass for quadratic model optimization. + class Sgtelib_Model_Evaluator : public NOMAD::Evaluator { + + private: + + NOMAD::Sgtelib_Model_Manager * _sgtelib_model_manager; ///< The sgtelib_model model. + + public: + + /// Constructor. + Sgtelib_Model_Evaluator ( const NOMAD::Parameters & p , + NOMAD::Sgtelib_Model_Manager * sgtelib_model_manager ) + : NOMAD::Evaluator ( p ) , + _sgtelib_model_manager ( sgtelib_model_manager ) {} + + + /// Destructor. + virtual ~Sgtelib_Model_Evaluator ( void ) {} + + /// Evaluate the blackboxes at a given trial point. + virtual bool eval_x ( NOMAD::Eval_Point & x , + const NOMAD::Double & h_max , + bool & count_eval ) const; + + }; +} + +#endif + +// #endif diff --git a/src/Sgtelib_Model_Manager.cpp b/src/Sgtelib_Model_Manager.cpp new file mode 100644 index 0000000000000000000000000000000000000000..8d206b435178220296f2b2d0de1e66d31cda5d64 --- /dev/null +++ b/src/Sgtelib_Model_Manager.cpp @@ -0,0 +1,997 @@ +/*-------------------------------------------------------------------------------------*/ +/* sgtelib - A surrogate model library for derivative-free optimization */ +/* Version 2.0.1 */ +/* */ +/* Copyright (C) 2012-2016 Sebastien Le Digabel - Ecole Polytechnique, Montreal */ +/* Bastien Talgorn - McGill University, Montreal */ +/* */ +/* Author: Bastien Talgorn */ +/* email: bastientalgorn@fastmail.com */ +/* */ +/* This program is free software: you can redistribute it and/or modify it under the */ +/* terms of the GNU Lesser General Public License as published by the Free Software */ +/* Foundation, either version 3 of the License, or (at your option) any later */ +/* version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ +/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ +/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License along */ +/* with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on sgtelib at https://github.com/bastientalgorn/sgtelib */ +/*-------------------------------------------------------------------------------------*/ +/** + \file Sgtelib_Model_Manager.cpp + \brief Handle the sgtelib_model model for the search and the eval_sort. + \author Bastien Talgorn + \date 2013-04-25 + \see Sgtelib_Model_Search.cpp + */ +#include "Sgtelib_Model_Manager.hpp" +#include "Evaluator_Control.hpp" + + +/*---------------------------------------------------------------*/ +/* constructor */ +/*---------------------------------------------------------------*/ +NOMAD::Sgtelib_Model_Manager::Sgtelib_Model_Manager ( NOMAD::Parameters & p , + NOMAD::Evaluator_Control * ev_control ) : +_p ( p ), +_ev_control ( ev_control ), +_highest_tag ( -1 ), +_ready ( false ) +{ + + + // Initialization of model bounds + _model_lb = NOMAD::Point( _p.get_dimension(),+NOMAD::INF ); + _model_ub = NOMAD::Point( _p.get_dimension(),-NOMAD::INF ); + + // Initialisation of best objective + _found_feasible = false; + + // Initialization of statistics + _search_pfi_max = 0.0; + _search_efi_max = 0.0; + _search_obj_min = +NOMAD::INF; + + + // EXTERN SGTE + if ( _p.get_SGTELIB_MODEL_FORMULATION()==NOMAD::SGTELIB_MODEL_FORMULATION_EXTERN ) + return; + + // Check + if ( (_p.get_SGTELIB_MODEL_FORMULATION()==NOMAD::SGTELIB_MODEL_FORMULATION_FS) || + (_p.get_SGTELIB_MODEL_FORMULATION()==NOMAD::SGTELIB_MODEL_FORMULATION_EIS) ) + { + if ( ! (_p.get_SGTELIB_MODEL_FEASIBILITY() == NOMAD::SGTELIB_MODEL_FEASIBILITY_C) ) + { + std::cout << "ERROR : Formulations FS and EIS can only be used with FeasibilityMethod C" << std::endl; + throw SGTELIB::Exception ( __FILE__ , __LINE__ , + "Sgtelib_Model_Manager: SGTELIB_MODEL_FEASIBILITY not valid." ); + } + } + + // Count the number of constraints + int nb_constraints = 0; + const std::vector<NOMAD::bb_output_type> bbot = _p.get_bb_output_type(); + for ( int j=0 ; j<_p.get_bb_nb_outputs() ; j++) + { + if ( bbot_is_constraint(bbot[j]) ) + nb_constraints++; + } + + // Define how many models to build + switch ( _p.get_SGTELIB_MODEL_FEASIBILITY() ) + { + case NOMAD::SGTELIB_MODEL_FEASIBILITY_C: + _nb_models = 1+nb_constraints; + break; + case NOMAD::SGTELIB_MODEL_FEASIBILITY_H: + case NOMAD::SGTELIB_MODEL_FEASIBILITY_B: + case NOMAD::SGTELIB_MODEL_FEASIBILITY_M: + _nb_models = 2; + break; + case NOMAD::SGTELIB_MODEL_FEASIBILITY_UNDEFINED: + std::cout<< "UNDEFINED_SGTELIB_MODEL_FEASIBILITY" << std::endl; + break; + } + + // Init the TrainingSet + SGTELIB::Matrix empty_X ( "empty_X" , 0 , _p.get_dimension() ); + SGTELIB::Matrix empty_Z ( "empty_Z" , 0 , _nb_models ); + _trainingset = new SGTELIB::TrainingSet( empty_X , empty_Z ); + + // Build the Sgtelib Model + std::string model_definition = _p.get_SGTELIB_MODEL_DEFINITION(); + _model = SGTELIB::Surrogate_Factory( *_trainingset , model_definition ); + +}// end of constructor + + + + + +/*---------------------------------------------------------------*/ +/* reset */ +/*---------------------------------------------------------------*/ +void NOMAD::Sgtelib_Model_Manager::reset(void) +{ + _highest_tag = -1; + + if ( _model ) + { + SGTELIB::surrogate_delete( _model ); + _model = NULL; + } + + if ( _trainingset ) + { + delete _trainingset; + _trainingset = NULL; + } + + _ready = false; +} + +/*---------------------------------------------------------------*/ +/* is_ready */ +/* Return a boolean to know if the sgtelib_model model has been */ +/* build and can be called for predictions. */ +/*---------------------------------------------------------------*/ +bool NOMAD::Sgtelib_Model_Manager::is_ready(void) +{ + + if ( _ready ) + return true; + + // EXTERN SGTE + if ( _p.get_SGTELIB_MODEL_FORMULATION()==NOMAD::SGTELIB_MODEL_FORMULATION_EXTERN ) + { + _ready = true; + return _ready; + } + if ( !_trainingset ) + throw NOMAD::Exception ( __FILE__ , __LINE__ , + "Sgtelib_Model_Manager::is_ready : no training set!" ); + + if ( ! _trainingset->is_ready() ) + return false; + + const int pvar = _trainingset->get_pvar(); + _ready = ( ( _highest_tag != -1 ) && ( _model->is_ready() ) && ( pvar > 10 ) ); + return _ready; +} + + +/*---------------------------------------------------------------*/ +/* Reset Search Stats */ +/*---------------------------------------------------------------*/ +void NOMAD::Sgtelib_Model_Manager::reset_search_stats(void) +{ + _search_pfi_max = 0; + _search_efi_max = 0; + _search_obj_min = NOMAD::INF; +}// + +void NOMAD::Sgtelib_Model_Manager::write_search_stats(void) const +{ + // Write the point in memory file + ofstream memory; + memory.open ("memory.txt", ios::app ); + if ( memory.is_open() ) + { + memory.precision(24); + memory << "#SEARCH_STATS" << std::endl; + memory << _search_pfi_max << " " + << _search_efi_max << " " + << _search_obj_min << std::endl; + memory.close(); + } +}// + + + +/*---------------------------------------------------------------*/ +/* info */ +/*---------------------------------------------------------------*/ +void NOMAD::Sgtelib_Model_Manager::info(void) +{ + std::cout << " #===================================================== #" << std::endl; + std::cout << "Sgtelib_Model_Manager::info" << std::endl ; + std::cout << "Sgtelib_Model_Manager : " << this << std::endl; + std::cout << "ev_control : " << _ev_control << std::endl; + std::cout << "Model : " << _model << std::endl; + std::cout << "highest_tag : " << _highest_tag << std::endl; + + NOMAD::Cache & cache = _ev_control->get_cache(); + std::cout << "Cache size : " << cache.size() << std::endl; + std::cout << "found_feasible : " << _found_feasible << std::endl; + + // Display of the model's bounds. + int i; + int n = _p.get_dimension(); + std::cout << "Model Bounds, lb : ( "; + for ( i=0 ; i<n ; i++ ) + std::cout << _model_lb.get_coord(i) << " "; + + std::cout << ") , ub : ( "; + for ( i=0 ; i<n ; i++ ) + std::cout << _model_ub.get_coord(i) << " "; + + std::cout << ")" << std::endl; + + std::cout << "Model Ext Bounds, lb : ( "; + NOMAD::Point ext_lb = get_extended_lb(); + for ( i=0 ; i<n ; i++ ) + std::cout << ext_lb.get_coord(i) << " "; + + std::cout << ") , ub : ( "; + NOMAD::Point ext_ub = get_extended_ub(); + for ( i=0 ; i<n ; i++ ) + std::cout << ext_ub.get_coord(i) << " "; + + std::cout << ")" << std::endl; + + if ( _ready ) + std::cout << "sgtelib_model model is ready" << std::endl; + else + std::cout << "sgtelib_model model is NOT ready" << std::endl; + + + std::cout << " #===================================================== #" << std::endl; +} + + + + +/*------------------------------------------------------------------*/ +/* MODEL UPDATE */ +/*------------------------------------------------------------------*/ +void NOMAD::Sgtelib_Model_Manager::update(void) +{ + const NOMAD::Display & out = _p.out(); + const bool display_update = string_find( _p.get_SGTELIB_MODEL_DISPLAY(),"U") ; + + if ( display_update ) + out.open_block("Update sgtelib model"); + + // EXTERN SGTE + if ( _p.get_SGTELIB_MODEL_FORMULATION() == NOMAD::SGTELIB_MODEL_FORMULATION_EXTERN ) + { + if ( display_update ) out << "FORMULATION: EXTERN." << std::endl; + return; + } + + NOMAD::Cache & cache = _ev_control->get_cache(); + const std::vector<NOMAD::bb_output_type> bbot = _p.get_bb_output_type(); + // row_X et row_Z sont les matrices à une seule ligne + // permettant de stocker le point courant + SGTELIB::Matrix row_X ( "row_X" , 1 , _p.get_dimension() ); + SGTELIB::Matrix row_Z ( "row_Z" , 1 , _nb_models ); + + // Matrices permettant de stocker tous les points à envoyer vers le model + SGTELIB::Matrix add_X ( "add_X" , 0 , _p.get_dimension() ); + SGTELIB::Matrix add_Z ( "add_Z" , 0 , _nb_models ); + + if ( display_update ) + out << "Review of the cache" << std::endl; + + // Parcours des points de la cache + int k; + NOMAD::Double v; + int next_highest_tag = _highest_tag; + const NOMAD::Eval_Point * cur = cache.begin(); + int tag; + bool valid_point; + // Parcours de la cache + while ( cur ) + { + tag = cur->get_tag() ; + if ( tag > _highest_tag ) + { + if ( display_update ) + { + out << "New Tag : " << tag << std::endl; + out << "xNew = ( "; + for ( int i = 0 ; i < _p.get_dimension() ; i++ ) + { + out << cur->get_coord(i).value() << " "; + } + out << ")"; + } + + // Vérification que le point est valide (pas de Nan, pas d'échec, toutes les sorties définies et la fonction cout disponible ) + valid_point = true; + for ( int j=0 ; j < _p.get_bb_nb_outputs() ; j++) + { + if ( ( !cur->get_bb_outputs()[j].is_defined() ) || ( isnan(cur->get_bb_outputs()[j].value()) ) || !cur->is_eval_ok() || !cur->get_f().is_defined() ) + valid_point = false; + } + + if ( display_update ) + { + if ( !valid_point ) out << " (not valid) "; + } + + if ( valid_point ) + { + // X + for ( int j=0 ; j < _p.get_dimension() ; j++ ) + row_X.set( 0, j, cur->get_coord(j).value() ); + + add_X.add_rows(row_X); + + // Objective + row_Z.set(0,0,cur->get_f().value()); // 1st column: constraint model + + // Constraints + switch ( _p.get_SGTELIB_MODEL_FEASIBILITY() ) + { + case NOMAD::SGTELIB_MODEL_FEASIBILITY_C: + k=1; + for ( int j = 0 ; j < _p.get_bb_nb_outputs() ; j++ ) + { + if ( bbot_is_constraint(bbot[j]) ) + { + row_Z.set( 0, k, cur->get_bb_outputs()[j].value() ); + k++; + } + } + break; + + case NOMAD::SGTELIB_MODEL_FEASIBILITY_H: + eval_h(cur->get_bb_outputs(),v); + row_Z.set(0,1,v.value()); // 2nd column: constraint model + break; + + case NOMAD::SGTELIB_MODEL_FEASIBILITY_B: + row_Z.set(0,1,cur->is_feasible(0.)); // 2nd column: constraint model + break; + + case NOMAD::SGTELIB_MODEL_FEASIBILITY_M: + v = -NOMAD::INF; + for ( int j=0 ; j < _p.get_bb_nb_outputs() ; j++) + { + if ( bbot_is_constraint( bbot[j]) ) + { + v = max(v,cur->get_bb_outputs()[j]); + } + } + row_Z.set(0,1,v.value());// 2nd column: constraint model + break; + + case NOMAD::SGTELIB_MODEL_FEASIBILITY_UNDEFINED: + out << "UNDEFINED"; + break; + }// end switch + + add_Z.add_rows(row_Z); + + if ( cur->is_feasible(0.) ) + { + if ( display_update && (!_found_feasible) ) out << " (feasible!)"; + _found_feasible = true; + } + + + }// end if valid_point + next_highest_tag = std::max(next_highest_tag,tag); + + if ( display_update ) + out << std::endl; + + }// end if tag + cur = cache.next(); + }// end boucle cache + + _highest_tag = next_highest_tag; + + if ( display_update ) + { + out << "next_highest_tag: " << next_highest_tag << std::endl; + out << "Current nb of points: " << _trainingset->get_nb_points() << std::endl; + } + + + if ( add_X.get_nb_rows() > 0 ) + { + // Build the model + if ( display_update ) + out << "Add points..."; + + _trainingset->add_points( add_X , add_Z ); + + if ( display_update ) + out << " OK" << std::endl << "Build_model..."; + + _model->build(); + + if ( display_update ) + out << " OK." << std::endl; + } + + // Check if the model is ready + _ready = _model->is_ready(); + + if ( display_update ) + { + out << "New nb of points: " << _trainingset->get_nb_points() << std::endl; + out << "Ready: " << _ready << std::endl; + } + + // Update the bounds of the model + _set_model_bounds(&add_X); + + if ( display_update ) + out.close_block(); + +}// Fin de la methode + + + +/*------------------------------------------------------------------------*/ +/* During the update of the sgtelib_model model, */ +/* update the bounds of the model */ +/*------------------------------------------------------------------------*/ +void NOMAD::Sgtelib_Model_Manager::_set_model_bounds (SGTELIB::Matrix * X) +{ + if ( _p.get_dimension() != X->get_nb_cols() ) + { + throw NOMAD::Exception ( __FILE__ , __LINE__ , + "Sgtelib_Model_Manager::_set_model_bounds() dimension does not match" ); + } + + int nb_dim = X->get_nb_cols(); + int nb_points = X->get_nb_rows(); + + // Build model bounds + NOMAD::Double lb; + NOMAD::Double ub; + + for ( int j=0 ; j<nb_dim ; j++) + { + lb = _model_lb.get_coord(j); + ub = _model_ub.get_coord(j); + for ( int p=0 ; p<nb_points ; p++ ) + { + lb = min( lb , NOMAD::Double(X->get(p,j)) ); + ub = max( ub , NOMAD::Double(X->get(p,j)) ); + } + _model_lb.set_coord(j,lb); + _model_ub.set_coord(j,ub); + } +} + + + +/*------------------------------------------------------------------------*/ +/* Extended Bounds */ +/*------------------------------------------------------------------------*/ + +NOMAD::Point NOMAD::Sgtelib_Model_Manager::get_extended_lb(void) +{ + NOMAD::Point ext_lb = _p.get_lower_bound(); + NOMAD::Double vi; + for ( int i=0 ; i < _p.get_dimension() ; i++ ) + { + vi = _p.get_lower_bound().get_coord(i); + if ( ( ! vi.is_defined() ) || ( isnan(vi.value() ) ) ) + ext_lb[i] = _model_lb[i] - max(Double(10.0),_model_ub[i]-_model_lb[i]); + } + return ext_lb; +}// + +NOMAD::Point NOMAD::Sgtelib_Model_Manager::get_extended_ub(void) +{ + NOMAD::Point ext_ub = _p.get_upper_bound(); + NOMAD::Double vi; + for ( int i = 0 ; i < _p.get_dimension() ; i++ ) + { + vi = _p.get_upper_bound().get_coord(i); + if ( (!vi.is_defined()) || (isnan(vi.value())) ) + ext_ub[i] = _model_ub[i] + max(Double(10.0),_model_ub[i]-_model_lb[i]); + } + return ext_ub; +}// + + +/*----------------------------------------------------------------*/ +/* compute model h and f values given one blackbox output */ +/*----------------------------------------------------------------*/ +void NOMAD::Sgtelib_Model_Manager::eval_h ( const NOMAD::Point & bbo , + NOMAD::Double & h ) const +{ + const NOMAD::Double h_min = _p.get_h_min(); + const NOMAD::hnorm_type h_norm =_p.get_h_norm(); + + h = 0.0; + const int m = bbo.size(); + const std::vector<NOMAD::bb_output_type> bbot = _p.get_bb_output_type(); + + if ( m != static_cast<int>(bbot.size()) ) + { + std::cout << "Sgtelib_Model_Manager::eval_h() called with an invalid bbo argument" << std::endl; + throw NOMAD::Exception ( __FILE__ , __LINE__ , + "Sgtelib_Model_Manager::eval_h() called with an invalid bbo argument" ); + } + NOMAD::Double bboi; + for ( int i = 0 ; i < m ; ++i ) + { + bboi = bbo[i]; + if ( bboi.is_defined() ) + { + if ( bbot[i] == NOMAD::EB || bbot[i] == NOMAD::PEB_E ) + { + if ( bboi > h_min ) + { + h = +INF; + return; + } + } + else if ( ( bbot[i] == NOMAD::FILTER || + bbot[i] == NOMAD::PB || + bbot[i] == NOMAD::PEB_P ) ) + { + if ( bboi > h_min ) + { + switch ( h_norm ) + { + case NOMAD::L1: + h += bboi; + break; + case NOMAD::L2: + h += bboi * bboi; + break; + case NOMAD::LINF: + if ( bboi > h ) + h = bboi; + break; + } + } + } + + } + } + if ( h_norm == NOMAD::L2 ) + h = h.sqrt(); + +}// Fin de la methode + + + +/*------------------------------------------------------------------------*/ +/* Compute which formulation must be used in the eval_x */ +/*------------------------------------------------------------------------*/ +const NOMAD::sgtelib_model_formulation_type NOMAD::Sgtelib_Model_Manager::get_formulation( void ) +{ + + NOMAD::sgtelib_model_formulation_type formulation = _p.get_SGTELIB_MODEL_FORMULATION(); + //std::cout << __FILE__ << __LINE__ << " ready = " << _ready ; + if ( (formulation != NOMAD::SGTELIB_MODEL_FORMULATION_EXTERN) && ( ! _ready) ){ + formulation = NOMAD::SGTELIB_MODEL_FORMULATION_D; + //std::cout << " ... use formulation D"; + } + //std::cout << std::endl; + + return formulation; +} + +/*------------------------------------------------------------------------*/ +/* Check that h & f are defined, and if not, correct it */ +/*------------------------------------------------------------------------*/ +void NOMAD::Sgtelib_Model_Manager::check_hf ( NOMAD::Eval_Point * x ) +{ + + NOMAD::Double f = x->get_f(); + NOMAD::Double h = x->get_h(); + + if ( ! f.is_defined() ) + f = x->get_bb_outputs().get_coord(_p.get_index_obj().front()); + + if ( ! h.is_defined() ) + eval_h ( x->get_bb_outputs() , h ); + + if ( ( ! f.is_defined()) || ( ! h.is_defined()) ) + { + f = INF; + h = INF; + } + x->set_f(f); + x->set_h(h); + +} + + +/*------------------------------------------------------------------------*/ +/* evaluate the sgtelib_model model at a given point */ +/*------------------------------------------------------------------------*/ +bool NOMAD::Sgtelib_Model_Manager::eval_x ( NOMAD::Eval_Point * x , + const NOMAD::Double & h_max , + bool & count_eval ) +{ + int i; + const int dim = _p.get_dimension(); + const int nbbo = _p.get_bb_nb_outputs(); + const NOMAD::Double diversification = _p.get_SGTELIB_MODEL_DIVERSIFICATION(); + const NOMAD::Display & out = _p.out(); + + const bool bool_display = (string_find(_p.get_SGTELIB_MODEL_DISPLAY(),"X")); + + if ( bool_display ) + { + out.open_block("Model evaluation"); + out << "X = ("; + for ( i = 0 ; i < dim ; i++ ) + { + std::cout << x->get_coord(i).value() << " "; + } + out << ")" << std::endl; + } + + + // --------------------- // + // In/Out Initialisation // + // --------------------- // + + // Creation of matrix for input / output of SGTELIB model + SGTELIB::Matrix X_predict ( "X_predict" , 1 , dim ); + + // Set the input matrix + for ( i = 0 ; i < dim ; i++ ) + { + X_predict.set(0,i, x->get_coord(i).value() ); + } + // reset point outputs: + // Par défaut, on met tout à -1 + for ( i = 0 ; i < nbbo ; ++i ) + x->set_bb_output ( i , NOMAD::Double(-1) ); + + + // ------------------------- // + // Objective Prediction // + // ------------------------- // + + + // Declaration of the stastistical measurements + NOMAD::Double pf = 1; // P[x] + NOMAD::Double f = 0; // predicted mean of the objective + NOMAD::Double sigma_f = 0; // predicted variance of the objective + NOMAD::Double pi = 0; // probability of improvement + NOMAD::Double ei = 0; // expected improvement + NOMAD::Double efi = 0; // expected feasible improvement + NOMAD::Double pfi = 0; // probability of feasible improvement + NOMAD::Double mu = 0; // uncertainty on the feasibility + NOMAD::Double penalty = 0; // exclusion area penalty + NOMAD::Double d = 0; // Distance to closest point of the cache + NOMAD::Double h = 0; // Constraint violation + + // FORMULATION USED IN THIS EVAL_X + const NOMAD::sgtelib_model_formulation_type formulation = get_formulation(); + + + // Shall we compute statistical criterias + bool use_statistical_criteria = false; + switch (formulation) + { + case NOMAD::SGTELIB_MODEL_FORMULATION_FS: + use_statistical_criteria = (diversification != 0); + break; + case NOMAD::SGTELIB_MODEL_FORMULATION_FSP: + case NOMAD::SGTELIB_MODEL_FORMULATION_EIS: + case NOMAD::SGTELIB_MODEL_FORMULATION_EFI: + case NOMAD::SGTELIB_MODEL_FORMULATION_EFIS: + case NOMAD::SGTELIB_MODEL_FORMULATION_EFIM: + case NOMAD::SGTELIB_MODEL_FORMULATION_EFIC: + case NOMAD::SGTELIB_MODEL_FORMULATION_PFI: + use_statistical_criteria = true; + break; + case NOMAD::SGTELIB_MODEL_FORMULATION_D: + use_statistical_criteria = false; + break; + case NOMAD::SGTELIB_MODEL_FORMULATION_EXTERN: + case NOMAD::SGTELIB_MODEL_FORMULATION_UNDEFINED: + throw SGTELIB::Exception ( __FILE__ , __LINE__ , "Forbiden formulation" ); + break; + } + if ( bool_display ) + { + out << "Formulation: " + << sgtelib_model_formulation_type_to_string ( formulation ) + << "; compute stat: " << use_statistical_criteria + << "; found_feasible : " << _found_feasible << std::endl; + } + + + // Init the matrices for prediction + SGTELIB::Matrix M_predict ( "M_predict" , 1 , _nb_models ); + SGTELIB::Matrix STD_predict ( "STD_predict" , 1 , _nb_models ); + SGTELIB::Matrix CDF_predict ( "CDF_predict" , 1 , _nb_models ); + SGTELIB::Matrix EI_predict ( "EI_predict" , 1 , _nb_models ); + + // Prediction + if ( formulation == NOMAD::SGTELIB_MODEL_FORMULATION_D ) + { + d = _trainingset->get_distance_to_closest(X_predict).get(0,0); + if ( bool_display ) + { + out << "d = " << d << std::endl; + } + } + else if ( formulation == NOMAD::SGTELIB_MODEL_FORMULATION_EXTERN ) + { + throw SGTELIB::Exception ( __FILE__ , __LINE__ , + "Sgtelib_Model_Manager::eval_x: Formulation Extern should not been called in this context." ); + } + else + { + if ( bool_display ) + { + out << "Predict... "; + } + _model->build(); + _model->check_ready(__FILE__,__FUNCTION__,__LINE__); + if (use_statistical_criteria) + _model->predict( X_predict , &M_predict , &STD_predict , &EI_predict , &CDF_predict ); + else + _model->predict(X_predict,&M_predict); + + if ( bool_display ) + out << "ok" << std::endl; + } + + // Get the prediction from the matrices + f = M_predict.get(0,0); + + if ( use_statistical_criteria ) + { + // If no feasible points is found so far, then sigma_f, ei and pi are bypassed. + if ( _found_feasible ) + { + sigma_f = STD_predict.get(0,0); + pi = CDF_predict.get(0,0); + ei = EI_predict.get(0,0); + } + else + { + sigma_f = 1.0; // This inhibits the exploration term in regard to the objective + pi = 1.0; // This implies that pfi = pf + ei = 1.0; // This implies that efi = pf + } + if ( bool_display ) + out << "F = " << f << " +/- " << sigma_f << std::endl; + + } + else + { + if ( bool_display ) + out << "F = " << f << std::endl; + } + + + // ====================================== // + // Constraints display // + // ====================================== // + + if ( bool_display ) + { + switch ( _p.get_SGTELIB_MODEL_FEASIBILITY() ) + { + case NOMAD::SGTELIB_MODEL_FEASIBILITY_C: + if (use_statistical_criteria){ + for ( i = 1 ; i < _nb_models ; i++ ) + { + out << "C" << i << " = " << M_predict.get(0,i) + << " +/- " << STD_predict.get(0,i) + << " (CDF : " << CDF_predict.get(0,i) << ")" << std::endl; + } + } + else{ + out << "C = [ "; + for ( i = 1 ; i < _nb_models ; i++ ) out << M_predict.get(0,i) << " "; + out << " ]" << std::endl; + } + break; + case NOMAD::SGTELIB_MODEL_FEASIBILITY_H: + out << "Feasibility_Method : H (Aggregate prediction)" << std::endl; + out << "H = " << M_predict.get(0,1) << " +/- " << STD_predict.get(0,1) << " (CDF : " << CDF_predict.get(0,1) << ")" << std::endl; + break; + case NOMAD::SGTELIB_MODEL_FEASIBILITY_B: + out << "Feasibility_Method : B (binary prediction)" << std::endl; + out << "B = " << M_predict.get(0,1) << " (CDF : " << CDF_predict.get(0,1) << ")" << std::endl; + break; + case NOMAD::SGTELIB_MODEL_FEASIBILITY_M: + out << "Feasibility_Method : M (Biggest constraint prediction)" << std::endl; + out << "M = " << M_predict.get(0,1) << " +/- " << STD_predict.get(0,1) << " (CDF : " << CDF_predict.get(0,1) << ")" << std::endl; + break; + case NOMAD::SGTELIB_MODEL_FEASIBILITY_UNDEFINED: + out << "SGTELIB_MODEL_FEASIBILITY_UNDEFINED" << std::endl; + break; + } + } + + + + + // ====================================== // + // Computation of statistical criteria // + // ====================================== // + if ( use_statistical_criteria ) + { + pf = 1; // General probability of feasibility + NOMAD::Double pfj; // Probability of feasibility for constrait cj + NOMAD::Double L2 = 0; + if ( _p.has_constraints() ) + { + // Use the CDF of each output in C + // If there is only one output in C (models B, H and M) then pf = CDF) + for ( i = 1 ; i < _nb_models ; i++ ) + { + pfj = CDF_predict.get(0,i); + L2 += max( 0 , M_predict.get(0,i)).pow2(); + pf *= pfj; + } + } // end (if constraints) + if ( ( !_found_feasible ) && (pf == 0) ) + { + pf = 1.0/(1.0+L2); + if ( bool_display ) + { + out << "pf = 0 and L2 = " << L2 << " => pF = " << pf << std::endl; + } + } + pfi = pi*pf; + efi = ei*pf; + mu = 4*pf*(1-pf); + } + + // ====================================== // + // Application of the formulation // + // ====================================== // + const std::vector<NOMAD::bb_output_type> bbot = _p.get_bb_output_type(); + NOMAD::Double obj; + int obj_index = _p.get_index_obj().front(); + int k; + switch ( formulation ) + { + case NOMAD::SGTELIB_MODEL_FORMULATION_FS: + // Define obj + obj = f - diversification*sigma_f; + // Set constraints + k = 0; + for ( i = 0 ; i < nbbo ; i++ ) + { + if ( bbot[i] != NOMAD::OBJ ) + { + x->set_bb_output( i , M_predict.get(0,k+1) - diversification*STD_predict.get(0,k+1) ); + k++; + } + } + break; + case NOMAD::SGTELIB_MODEL_FORMULATION_FSP: + // Define obj + obj = f - diversification*sigma_f; + // Set constraints + for ( i = 0 ; i < nbbo ; i++ ) + { + if ( bbot[i] != NOMAD::OBJ ) + x->set_bb_output( i , 0.5 - pf ); + } + break; + case NOMAD::SGTELIB_MODEL_FORMULATION_EIS: + // Define obj + obj = - ei - diversification*sigma_f; + // Set constraints + k = 0; + for ( i = 0 ; i < nbbo ; i++ ) + { + if ( bbot[i] != NOMAD::OBJ ) + { + x->set_bb_output( i , M_predict.get(0,k+1) - diversification*STD_predict.get(0,k+1) ); + k++; + } + } + break; + case NOMAD::SGTELIB_MODEL_FORMULATION_EFI: + obj = -efi; + break; + case NOMAD::SGTELIB_MODEL_FORMULATION_EFIS: + obj = -efi - diversification*sigma_f; + break; + case NOMAD::SGTELIB_MODEL_FORMULATION_EFIM: + obj = -efi - diversification*sigma_f*mu; + break; + case NOMAD::SGTELIB_MODEL_FORMULATION_EFIC: + obj = -efi - diversification*( ei*mu + pf*sigma_f); + break; + case NOMAD::SGTELIB_MODEL_FORMULATION_PFI: + obj = -pfi; + break; + case NOMAD::SGTELIB_MODEL_FORMULATION_D: + obj = -d; + break; + case NOMAD::SGTELIB_MODEL_FORMULATION_EXTERN: + out<< "SGTELIB_MODEL_FORMULATION_EXTERN" << std::endl; + break; + case NOMAD::SGTELIB_MODEL_FORMULATION_UNDEFINED: + out<< "SGTELIB_MODEL_FORMULATION_UNDEFINED" << std::endl; + break; + } + + // ------------------------- // + // exclusion area // + // ------------------------- // + + double tc = _p.get_SGTELIB_MODEL_EXCLUSION_AREA().value(); + if ( tc > 0.0 ) + { + penalty = _model->get_exclusion_area_penalty ( X_predict,tc ).get(0,0); + obj += penalty; + } + + + + // ------------------------- // + // Set obj // + // ------------------------- // + x->set_bb_output( obj_index , obj ); + eval_h ( x->get_bb_outputs() , h ); + x->set_f ( obj ); + x->set_h ( h ); + + // ================== // + // DISPLAY // + // ================== // + if ( bool_display ) + { + if ( use_statistical_criteria ) + { + out << "f_min f_min = " << _trainingset->get_f_min() << std::endl; + out << "Probability of Feasibility PF = " << pf << std::endl; + out << "Feasibility Uncertainty mu = " << mu << std::endl; + out << "Probability Improvement PI = " << pi << std::endl; + out << "Exptected Improvement EI = " << ei << std::endl; + out << "Proba. of Feasible Imp. PFI = " << pfi << std::endl; + out << "Expected Feasible Imp. EFI = " << efi << std::endl; + } + out << "Exclusion area penalty = " << penalty << std::endl; + out << "Model Output = (" << x->get_bb_outputs() << ")" << std::endl; + if ( isnan( pf.value() ) || isnan( pi.value() ) ) + { + throw SGTELIB::Exception ( __FILE__ , __LINE__ , + "Sgtelib_Model_Manager::eval_x: nan values in pi or pf." ); + } + out.close_block(); + } + + + // ================== // + // Statut de sortie // + // ================== // + count_eval = true; + x->set_eval_status ( NOMAD::EVAL_OK ); + return true; + + +}// Fin de la methode + + +/*------------------------------------------------------------------------*/ +/* get fmin from the training set */ +/*------------------------------------------------------------------------*/ +NOMAD::Double NOMAD::Sgtelib_Model_Manager::get_f_min (void) +{ + if ( _trainingset->is_ready() ) + { + std::cout << "(get_f_min : is ready!, " << _trainingset->get_nb_points() << ")" << std::endl; + return _trainingset->get_f_min(); + } + else + { + std::cout << "(get_f_min : NOT ready!)" << std::endl; + return NaN; + } +}// + diff --git a/src/Sgtelib_Model_Manager.hpp b/src/Sgtelib_Model_Manager.hpp new file mode 100644 index 0000000000000000000000000000000000000000..67b7d41a1ecd3b1fcec28e8020b8d2dff0556f35 --- /dev/null +++ b/src/Sgtelib_Model_Manager.hpp @@ -0,0 +1,126 @@ +/*-------------------------------------------------------------------------------------*/ +/* sgtelib - A surrogate model library for derivative-free optimization */ +/* Version 2.0.1 */ +/* */ +/* Copyright (C) 2012-2016 Sebastien Le Digabel - Ecole Polytechnique, Montreal */ +/* Bastien Talgorn - McGill University, Montreal */ +/* */ +/* Author: Bastien Talgorn */ +/* email: bastientalgorn@fastmail.com */ +/* */ +/* This program is free software: you can redistribute it and/or modify it under the */ +/* terms of the GNU Lesser General Public License as published by the Free Software */ +/* Foundation, either version 3 of the License, or (at your option) any later */ +/* version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ +/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ +/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License along */ +/* with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on sgtelib at https://github.com/bastientalgorn/sgtelib */ +/*-------------------------------------------------------------------------------------*/ +/** + \file Sgtelib_Model_Manager.hpp + \brief Handle the sgtelib_model model for the search and the eval_sort. + \author Bastien Talgorn + \date 2013-04-25 + \see Sgtelib_Model_Search.cpp + */ + +#ifndef __SGTELIB_MODEL_MANAGER__ +#define __SGTELIB_MODEL_MANAGER__ + +#include "Parameters.hpp" +#include "Evaluator_Control.hpp" + +#include "sgtelib.hpp" + + + +namespace NOMAD { + + + // This class handle the Sgtelib_Model, the calls to this model, the predictions + // and the various parameters (formulation, lambda, etc...) + class Sgtelib_Model_Manager { + + private: + + // General data + const NOMAD::Parameters & _p; ///< Parameters. + NOMAD::Evaluator_Control * _ev_control; ///< Evaluator control. + + // MODEL + SGTELIB::TrainingSet * _trainingset; + SGTELIB::Surrogate * _model; + + // the number of models + int _nb_models; + + int _highest_tag; // Plus haut tag actuellement contenu dans la cache + bool _ready; + bool _found_feasible; // True if a feasible point has been found + NOMAD::Point _model_lb; // lower bound + NOMAD::Point _model_ub; // upper bound + + // information sur la search + NOMAD::Double _search_pfi_max; + NOMAD::Double _search_efi_max; + NOMAD::Double _search_obj_min; + + //void _initialisation(void); + void _set_model_bounds (SGTELIB::Matrix * X); + + public: + + // Constructor + Sgtelib_Model_Manager ( NOMAD::Parameters & p , NOMAD::Evaluator_Control * ev_control ); + + // Destructor. + ~Sgtelib_Model_Manager ( void ) { reset(); }; + + bool is_ready(void); + void update(void); + void reset(void); + void info(void); + + // search_stats + void reset_search_stats(void); + void write_search_stats(void) const; + void update_search_stats( const NOMAD::Double & pfi, + const NOMAD::Double & efi, + const NOMAD::Double & obj); + + // Compute stats measurements from sgtelib_model outputs + + void eval_h ( const NOMAD::Point & bbo , + NOMAD::Double & h ) const; + + bool eval_x ( NOMAD::Eval_Point * x , + const NOMAD::Double & h_max , + bool & count_eval ); + + const sgtelib_model_formulation_type get_formulation( void ); + + void check_hf ( NOMAD::Eval_Point * x ); + + SGTELIB::Surrogate * get_model(void){return _model;} + + NOMAD::Evaluator_Control * get_evaluator_control(void){ return _ev_control;} + + NOMAD::Point get_extended_lb(void); + NOMAD::Point get_extended_ub(void); + + NOMAD::Double get_f_min (void); + + + + };// End of class +}// End of Namespace + +#endif +// #endif + diff --git a/src/Sgtelib_Model_Search.cpp b/src/Sgtelib_Model_Search.cpp new file mode 100644 index 0000000000000000000000000000000000000000..29d17a90292a50dc93b07581f88e162eb784229c --- /dev/null +++ b/src/Sgtelib_Model_Search.cpp @@ -0,0 +1,1913 @@ +/*-------------------------------------------------------------------------------------*/ +/* sgtelib - A surrogate model library for derivative-free optimization */ +/* Version 2.0.1 */ +/* */ +/* Copyright (C) 2012-2016 Sebastien Le Digabel - Ecole Polytechnique, Montreal */ +/* Bastien Talgorn - McGill University, Montreal */ +/* */ +/* Author: Bastien Talgorn */ +/* email: bastientalgorn@fastmail.com */ +/* */ +/* This program is free software: you can redistribute it and/or modify it under the */ +/* terms of the GNU Lesser General Public License as published by the Free Software */ +/* Foundation, either version 3 of the License, or (at your option) any later */ +/* version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ +/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ +/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License along */ +/* with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on sgtelib at https://github.com/bastientalgorn/sgtelib */ +/*-------------------------------------------------------------------------------------*/ +/** + \file Sgtelib_Model_Search.cpp + \brief Model search using the sgtelib_model surrogate library. + \author Bastien Talgorn + \date 2013-04-25 + \see Sgtelib_Model_Manager.cpp + */ + +#include "Sgtelib_Model_Search.hpp" + +/*-----------------------------------*/ +/* reset (virtual) */ +/*-----------------------------------*/ +void NOMAD::Sgtelib_Model_Search::reset ( void ) +{ + delete _start_point_1; + delete _start_point_2; +} + +/*--------------------------------------------------------*/ +/* delete a list of points: one version for points, and */ +/* one version for evaluation points (static, private) */ +/*--------------------------------------------------------*/ +void NOMAD::Sgtelib_Model_Search::clear_pts ( std::vector<NOMAD::Point *> & pts ) +{ + size_t k , n = pts.size(); + for ( k = 0 ; k < n ; ++k ) + delete pts[k]; + pts.clear(); +}// + +void NOMAD::Sgtelib_Model_Search::clear_pts ( std::vector<NOMAD::Eval_Point *> & pts ) +{ + size_t k , n = pts.size(); + for ( k = 0 ; k < n ; ++k ) + delete pts[k]; + pts.clear(); +}// + + +/*------------------------------------------------------------------*/ +/* the search */ +/*------------------------------------------------------------------*/ +/* Search parameters: */ +/* ------------------ */ +/* */ +/* . MODEL_SEARCH: flag to activate the model search (MS) */ +/* (here its value is NOMAD::Sgtelib_Model) */ +/* */ +/* . MODEL_SEARCH_OPTIMISTIC: if true, the direction from the */ +/* model center to the trial point */ +/* is computed and possibly used */ +/* in the speculative search */ +/* default=yes */ +/* */ +/* . MODEL_SEARCH_PROJ_TO_MESH: project or not to mesh */ +/* default=yes */ +/* */ +/* . MODEL_SEARCH_MAX_TRIAL_PTS: limit on the number of trial */ +/* points for one search */ +/* default=10 */ +/* */ +/*------------------------------------------------------------------*/ +void NOMAD::Sgtelib_Model_Search::search ( NOMAD::Mads & mads , + int & nb_search_pts , + bool & stop , + NOMAD::stop_type & stop_reason , + NOMAD::success_type & success , + bool & count_search , + const NOMAD::Eval_Point *& new_feas_inc , + const NOMAD::Eval_Point *& new_infeas_inc ) +{ + new_feas_inc = new_infeas_inc = NULL; + nb_search_pts = 0; + success = NOMAD::UNSUCCESSFUL; + count_search = false; + const NOMAD::Display & out = _p.out(); + const NOMAD::dd_type display_degree = out.get_search_dd(); + //const bool bool_display = ( string_find(_p.get_SGTELIB_MODEL_DISPLAY(),"S") or (display_degree == NOMAD::FULL_DISPLAY) ); + const bool bool_display = ( _p.get_SGTELIB_MODEL_DISPLAY().size() || (display_degree == NOMAD::FULL_DISPLAY) ); + + // initial displays: + if ( bool_display ) + { + std::ostringstream oss; + oss << NOMAD::MODEL_SEARCH << " #" + << _all_searches_stats.get_MS_nb_searches(); + out << std::endl; + out.open_block ( oss.str() ); + } + + + + NOMAD::Double fmin_old; + if (mads.get_best_feasible()) + fmin_old = mads.get_best_feasible()->get_f(); + else + fmin_old = NOMAD::INF; + + _one_search_stats.reset(); + + + int display_lim = 15; + + if ( stop ) + { + if ( bool_display ) + out << "Sgtelib_Model_Search::search(): not performed (stop flag is active)" + << std::endl; + return; + } + + // active cache (we accept only true function evaluations): + const NOMAD::Cache & cache = mads.get_cache(); + if ( cache.get_eval_type() != NOMAD::TRUTH ) + { + if ( bool_display ) + out << "Sgtelib_Model_Search::search(): not performed on surrogates" + << std::endl; + return; + } + + // check that there is one objective exactly: + const std::list<int> & index_obj_list = _p.get_index_obj(); + if ( index_obj_list.empty() ) + { + if ( bool_display ) + out << "Sgtelib_Model_Search::search(): not performed with no objective function" + << std::endl; + return; + } + if ( index_obj_list.size() > 1 ) + { + if ( bool_display ) + out << "Sgtelib_Model_Search::search(): not performed with biobjective" + << std::endl; + return; + } + + // active barrier: + const NOMAD::Barrier & barrier = mads.get_true_barrier(); + + // get the incumbent: + const NOMAD::Eval_Point * incumbent = barrier.get_best_feasible(); + if ( !incumbent ) + incumbent = barrier.get_best_infeasible(); + if ( !incumbent ) + { + if ( bool_display ) + out << "Sgtelib_Model_Search::search(): no incumbent" + << std::endl; + return; + } + + // get and check the signature, and compute the dimension: + NOMAD::Signature * signature = incumbent->get_signature(); + + if ( !signature ) + { + if ( bool_display ) + out << "Sgtelib_Model_Search::search(): no signature" + << std::endl; + return; + } + + int n = signature->get_n(); + + if ( n != incumbent->size() ) + { + if ( bool_display ) + out << "Sgtelib_Model_Search::search(): incompatible signature" + << std::endl; + return; + } + + + + // from this point the search is counted: + count_search = true; + _one_search_stats.add_MS_nb_searches(); + + // mesh: + NOMAD::Point delta_m; + signature->get_mesh()->get_delta(delta_m); + + // initial displays: + if ( bool_display ) + { + out << "number of cache points: " << cache.size() << std::endl; + out << "mesh size parameter: ( " << delta_m << " )" << std::endl; + out << "incumbent: ( "; + incumbent->NOMAD::Point::display( out , " " , 2 , NOMAD::Point::get_display_limit() ); + out << " )" << std::endl; + } + + // Get mads & ev_ctrl + NOMAD::Stats & stats = mads.get_stats(); + NOMAD::Evaluator_Control * ev_control = _sgtelib_model_manager->get_evaluator_control(); + + const int kkmax = _p.get_SGTELIB_MODEL_TRIALS(); + + // MULTIPLE_SEARCH + for (int kk=0 ; kk<kkmax ; kk++) + { + + /*----------------*/ + /* Model update */ + /*----------------*/ + _sgtelib_model_manager->update(); + + /*----------------*/ + /* oracle points */ + /*----------------*/ + + std::vector<NOMAD::Point *> oracle_pts; + if ( ! create_oracle_pts ( mads , + *incumbent , + delta_m , + out , + display_degree , + display_lim , + oracle_pts , + stop , + stop_reason ) && stop ) + { + + if ( bool_display ) + out << "fail: create_oracle_pts" << std::endl; + + + // delete oracle_pts: + NOMAD::Sgtelib_Model_Search::clear_pts ( oracle_pts ); + + // quit: + if ( bool_display ) + out << NOMAD::close_block ( "algorithm stop" ) << std::endl; + + return; + } + + /*------------------*/ + /* Register points */ + /*------------------*/ + + // add the trial points to the evaluator control for evaluation: + int i , nop = static_cast<int>(oracle_pts.size()); + + for ( i = 0 ; i < nop ; ++i ) + register_point ( *oracle_pts[i] , + *signature , + *incumbent , + display_degree ); + + // display the evaluator control list of points: + if ( bool_display ) + { + out.open_block ( "list of trial points" ); + const std::set<NOMAD::Priority_Eval_Point> & lop = ev_control->get_eval_lop(); + std::set<NOMAD::Priority_Eval_Point>::const_iterator it , end = lop.end(); + nop = static_cast<int>(lop.size()); + for ( it = lop.begin() , i = 0 ; it != end ; ++it , ++i ) + { + out << "#"; + out.display_int_w ( i , nop ); + out << " x=( "; + it->get_point()->NOMAD::Point::display ( out , " " , 15 , -1 ); + out << " )" << std::endl; + } + out.close_block(); + } + + // delete the trial points + NOMAD::Sgtelib_Model_Search::clear_pts ( oracle_pts ); + + nb_search_pts = ev_control->get_nb_eval_points(); + + + /*---------------------------*/ + /* Evaluate the trial points */ + /*---------------------------*/ + bool cache_hit = false; + if ( nb_search_pts == 0 ) + { + if ( bool_display ) + out << std::endl << "no trial point" << std::endl; + } + else + { + _one_search_stats.update_MS_max_search_pts ( nb_search_pts ); + int bbe = stats.get_bb_eval(); + int sgte_eval = stats.get_sgte_eval (); + int cache_hits = stats.get_cache_hits(); + + new_feas_inc = new_infeas_inc = NULL; + + ev_control->disable_model_eval_sort(); + + std::list<const NOMAD::Eval_Point *> * evaluated_pts = NULL; + if ( bool_display ) + evaluated_pts = new std::list<const NOMAD::Eval_Point *>; + + ev_control->eval_list_of_points ( _type , + mads.get_true_barrier() , + mads.get_sgte_barrier() , + mads.get_pareto_front() , + stop , + stop_reason , + new_feas_inc , + new_infeas_inc , + success , + evaluated_pts ); + ev_control->enable_model_eval_sort(); + + delete evaluated_pts; + + cache_hit = (cache_hits<stats.get_cache_hits()); + + // update stats: + _one_search_stats.add_MS_bb_eval ( stats.get_bb_eval () - bbe ); + _one_search_stats.add_MS_sgte_eval ( stats.get_sgte_eval () - sgte_eval ); + _one_search_stats.add_MS_cache_hits ( stats.get_cache_hits() - cache_hits ); + _one_search_stats.add_MS_pts ( nb_search_pts ); + + // Success ?? + if ( success >= NOMAD::FULL_SUCCESS ) + { + success = NOMAD::FULL_SUCCESS_STAY; + _one_search_stats.add_MS_success(); + break; + } + } + if ( bool_display ) + { + out << "Trial outcome: "; + if ( cache_hit ) + out << "=> Cache hit" << std::endl; + else if ( nb_search_pts == 0 ) + out << "=> No trial point" << std::endl; + else + out << "=> " << success << std::endl; + } + + } // end loop kk + + // update stats objects: + stats.update_model_stats ( _one_search_stats ); + _all_searches_stats.update ( _one_search_stats ); + + // final display: + if ( bool_display ) + { + const NOMAD::Eval_Point * bf = mads.get_best_feasible(); + + out << "Sgtelib model search: " << success << std::endl; + if ( ( success >= NOMAD::FULL_SUCCESS ) && (bf) ) + { + const double fmin_new = bf->get_f().value(); + out << "fmin (old-->new): " << fmin_old << " --> " << fmin_new << std::endl; + out << "Improvement: " << fmin_old-fmin_new << std::endl; + } + // Close block + std::ostringstream oss; + oss << "end of " << NOMAD::MODEL_SEARCH << " (" << success << ")"; + out << NOMAD::close_block ( oss.str() ) << std::endl; + } + +}// end search + + + + + + + +/*-------------------------------------------------------------------*/ +/* create a list of oracle points, given by the model optimization */ +/* (private) */ +/*-------------------------------------------------------------------*/ +bool NOMAD::Sgtelib_Model_Search::create_oracle_pts +( const NOMAD::Mads & mads , + const NOMAD::Point & incumbent , + const NOMAD::Point & delta_m , + const NOMAD::Display & out , + NOMAD::dd_type display_degree , + int display_lim , + std::vector<NOMAD::Point *> & oracle_pts , + bool & stop , + NOMAD::stop_type & stop_reason ) +{ + int i; + const NOMAD::Cache & cache = mads.get_cache(); + const bool bool_display = (display_degree == NOMAD::FULL_DISPLAY) ; + + + // starting points selection: + //--------------------------- + const NOMAD::Eval_Point * x0s[4]; + x0s[0] = x0s[1] = x0s[2] = x0s[3] = NULL; + + i = 0; + if ( mads.get_best_feasible() ) + { + x0s[i] = new NOMAD::Eval_Point( *mads.get_best_feasible() ); + i++; + } + if ( mads.get_best_infeasible() ) + { + x0s[i] = new NOMAD::Eval_Point( *mads.get_best_infeasible() ); + i++; + } + if ( _start_point_1 ) + { + const int m = _p.get_bb_nb_outputs(); + x0s[i] = new NOMAD::Eval_Point( *_start_point_1 , m ); + i++; + } + if ( _start_point_2 ) + { + const int m = _p.get_bb_nb_outputs(); + x0s[i] = new NOMAD::Eval_Point( *_start_point_2 , m ); + i++; + } + + if ( bool_display ) out.open_block ( "oracle points construction" ); + + // reset oracle points: + NOMAD::Sgtelib_Model_Search::clear_pts ( oracle_pts ); + NOMAD::Double f_model , h_model; + + if ( !x0s[0] && !x0s[1] && !x0s[2] && !x0s[3] ) + { + if ( bool_display ) + out << std::endl + << NOMAD::close_block ( "oracle points error: no model starting point" ) + << std::endl; + return false; + } + + // optimize model: + // --------------- + NOMAD::Clock clock; + + // CALLERXXX + bool optimization_ok = optimize_model ( cache , + incumbent , + delta_m , + x0s , + out , + display_degree , + oracle_pts , + stop , + stop_reason ); + + + + + _one_search_stats.add_optimization_time ( clock.get_CPU_time() ); + + + // Check for errors: + // ----------------- + if ( stop || ! optimization_ok || oracle_pts.size()==0 ) + { + std::string error_str; + if ( oracle_pts.size()==0 ) + error_str = "no model optimization solution"; + else + { + error_str = ( stop ) ? "algorithm stop" : "model optimization error"; + } + if ( bool_display ) + out << std::endl << NOMAD::close_block ( "oracle points error: " + error_str ) << std::endl; + return false; + } + + + // Display: + //--------- + if ( bool_display ) + { + out << std::endl + << NOMAD::close_block ( "end of oracle points construction" ) + << std::endl; + } + + // Delete x0s + for ( i = 0 ; i < 4 ; i++) + if ( x0s[i] ) + delete x0s[i]; + + return true; +}// end create_oracle_points + + +/*------------------------------------------------------*/ +/* filter cache */ +/*------------------------------------------------------*/ +bool NOMAD::Sgtelib_Model_Search::filter_cache ( const NOMAD::Display & out , + const NOMAD::Cache & cache , + const NOMAD::Cache & cache_surrogate, + const int & nb_candidates, + const double & delta_m_norm, + std::vector<NOMAD::Point *> & oracle_pts ) +{ + const bool bool_display = (string_find(_p.get_SGTELIB_MODEL_DISPLAY(),"F")); + const int pp = cache_surrogate.size(); + const int n = _p.get_dimension(); + int i,j,k; + double d,v; + const NOMAD::sgtelib_model_formulation_type formulation = _sgtelib_model_manager->get_formulation(); + + //=========================================== + // Compute objective, aggregate constraint, + // distance to main cache, and copy the search cache. + // ========================================== + // Objective function (prediction) + double * f = new double [pp]; + // Aggregate constraint (prediction) + double * h = new double [pp]; + // Feasibility value (max of cj) + double * hmax = new double [pp]; + // Distance to main cache. + double * DX = new double [pp]; + // Copy of the search point position. + double ** S = new double * [pp]; + + const NOMAD::Eval_Point * cur1; + const NOMAD::Eval_Point * cur2; + NOMAD::Point bbo; + const std::vector<NOMAD::bb_output_type> bbot = _p.get_bb_output_type(); + const int nbbo = _p.get_bb_nb_outputs(); + + cur1 = cache_surrogate.begin(); + i = 0; + + while ( cur1 ) + { + NOMAD::Eval_Point * x = new NOMAD::Eval_Point(*cur1); + _sgtelib_model_manager->check_hf(x); + f[i] = x->get_f().value(); + h[i] = x->get_h().value(); + + if ( x->check_nan() ) + { + f[i] = +INF; + h[i] = +INF; + } + + // hmax(x) = max_j c_j(x) + hmax[i] = -INF; + bbo = x->get_bb_outputs(); + for ( j=0 ; j<nbbo ; j++) + { + if ( bbot_is_constraint(bbot[j]) ) + hmax[i] = std::max(hmax[i],bbo[j].value()); + } + + + // Compute distance to main cache + d = +INF; + cur2 = cache.begin(); + while ( cur2 ) + { + d = std::min(d,((*cur1)-(*cur2)).squared_norm().value()); + cur2 = cache.next(); + } + DX[i] = sqrt(d); + // Copy coordinates in S + S[i] = new double [n]; + for (j=0 ; j<n ; j++) S[i][j] = cur1->get_coord(j).value(); + // Move to next point + cur1 = cache_surrogate.next(); + i++; + } + + + + //======================================================= + // Compute the distance between each pair of points of S + //======================================================= + if ( bool_display ){ + out << "Compute distances" << std::endl; + } + // Allocate DSS + double ** DSS = new double * [pp]; + for (i=0 ; i<pp ; i++) DSS[i] = new double [pp]; + // Compute the distance between each pair of points + for (i=0 ; i<pp ; i++) + { + DSS[i][i] = 0; + for (j=i+1 ; j<pp ; j++) + { + d = 0; + for (k=0 ; k<n ; k++) + { + v = S[i][k]-S[j][k]; + d += v*v; + } + DSS[i][j] = sqrt(d); + DSS[j][i] = DSS[i][j]; + } + } + // delete S + for (i=0 ; i<pp ; i++) + delete [] S[i]; + delete [] S; + + + + //======================================================= + // Compute initial isolation distances + // The isolation of a point i of the surrogate cache, + // is the distance to the closest point that is better than i. + //======================================================= + if ( bool_display ) + { + out << "Compute isolations" << std::endl; + } + double * d_isolation = new double [pp]; + for (i=0 ; i<pp ; i++) + { + d = +INF; + for (j=0 ; j<pp ; j++) + { + // If the point j is better than i + if ( (h[j]<h[i])||( (h[j]==h[i]) && (f[j]<f[i]) ) ) + { + d = std::min(d,DSS[i][j]); + } + } + d_isolation[i] = d; + } + + //==================================================== + // Greedy selection + //=================================================== + + // Boolean for storing the indexes of selected points + bool * keep = new bool [pp]; + int nkeep = 0; + + // Distance between search points and selected points + double * DT = new double [pp]; + double * DTX = new double [pp]; + int * n_isolation = new int [pp]; + int * n_density = new int [pp]; + // Init these values + for (i=0 ; i<pp ; i++) + { + keep[i] = false; + DT[i] = +INF; + DTX[i] = DX[i]; + n_isolation[i] = -1; + n_density[i] = -1; + } + + + // Boolean array of size 10 indicating for each method of index 0 to 9, + // if the method should be used. + const int NB_METHODMAX = 10; + bool use_method[NB_METHODMAX]; + int nb_methods = 0; + for (i=0 ; i<10 ; i++) + { + use_method[i] = (string_find(_p.get_SGTELIB_MODEL_FILTER(),itos(i))); + if (use_method[i]) + { + nb_methods++; + } + } + + if ( bool_display ) + { + out << "Used method: " ; + + // Select method + if ( formulation == NOMAD::SGTELIB_MODEL_FORMULATION_D ) + { + out << "Method override. Use method 1" << std::endl; + } + else + { + for (i=0 ; i<10 ; i++) + { + if (use_method[i]) + { + out << i << " "; + } + } + out << "(total nb methods = " << nb_methods << ")" << std::endl; + } + } + + if (nb_methods==0) + throw NOMAD::Exception ( "Sgtelib_Model_Search.cpp" , + __LINE__ ,"method index non valid" ); + + + + + + + int failure = 0; + int ni, nmax, iselect; + double fmin, hmin, dmax; + int method = 0; + + // initial dmin, for method 2 + double dmin = 0; + // Compute hmax threshold for method 3 + // (Largest strictly negative value of hmax) + double hmax_threshold = -INF; + for (i=0 ; i<pp ; i++) + { + if (hmax[i]<0) + hmax_threshold = std::max(hmax_threshold,hmax[i]); + } + + + + if ( bool_display ) + { + out << "Filter: Start greedy selection" << std::endl; + } + + + while ((nkeep<nb_candidates) && (failure<2*nb_methods)) + { + + // Selected point + iselect = -1; + + // Select method + if ( formulation == NOMAD::SGTELIB_MODEL_FORMULATION_D ){ + method = 1; + } + else + { + // Otherwise, cycle through all the methods + while (true) + { + method++; + if (method==NB_METHODMAX) + method = 0; + if (use_method[method]) + break; + } + } + if ( bool_display ) + { + out << "Method " << method; + } + + switch (method) + { + + + + //---------------------------------------- + case 0: + { + // Method 0 : selects the best point + + // Select + fmin = +INF; + hmin = +INF; + for (i=0 ; i<pp ; i++) + { + if ((!keep[i]) && (DTX[i]>0)) + { + // Check if i is better than iselect + bool bool1 = ( h[i]<hmin ); + bool bool2 = ( (h[i]==hmin) && (f[i]<fmin) ); + if ( bool1||bool2 ) + { + hmin = h[i]; + fmin = f[i]; + iselect = i; + } + } + } + } + break; + + //---------------------------------------- + // Special case for formulation D + case 1: + { + // Method 1 : selects the most distance point + dmax = 0; + for (i=0 ; i<pp ; i++) + { + if ( ( ! keep[i]) && (DTX[i]>=dmax) ) + { + dmax = DTX[i]; + iselect = i; + } + } + } + break; + + + + //---------------------------------------- + case 2: + { + // Method 2, selects the best point but with a minimum distance to points already selected + + // Distance threashold + if ( bool_display ) + { + out << ", dmin = " << dmin << std::endl; + } + + // Select + fmin = +INF; + hmin = +INF; + for (i=0 ; i<pp ; i++) + { + if ( ( ! keep[i] ) && ( DTX[i] >= dmin ) ) + { + // Check if i is better than iselect + bool bool1 = ( h[i]<hmin ); + bool bool2 = ( (h[i]==hmin) && (f[i]<fmin) ); + if ( bool1||bool2 ) + { + hmin = h[i]; + fmin = f[i]; + iselect = i; + } + } + } + if ( bool_display && (iselect != -1) ) + { + out << "d = " << DTX[iselect] << std::endl; + out << "h select = " << hmin << std::endl; + } + if (iselect!=-1) + { + dmin = DTX[iselect] + delta_m_norm; + } + + } + break; + //---------------------------------------- + case 3: + { + // Select the best points with a good enough value of hmax + + // Select + fmin = +INF; + for (i=0 ; i<pp ; i++) + { + if ( (!keep[i]) && (hmax[i]<=hmax_threshold) && (f[i]<fmin) && (DTX[i]>delta_m_norm) ) + { + fmin = f[i]; + iselect = i; + } + } + if ( iselect == -1) + hmax_threshold *= 0.5; + else + hmax_threshold = 2.0*hmax[iselect]; + } + break; + //---------------------------------------- + case 4: + { + // Select point with highest isolation number + + nmax = 0; + for (i=0 ; i<pp ; i++) + { + + if ( ( ! keep[i]) && (d_isolation[i]>0) ) + { + ni = n_isolation[i]; + // If criteria undef, then compute. + if (ni==-1) + { + ni = 0; + for (j=0 ; j<pp ; j++) + { + if ( DSS[i][j]<=d_isolation[i] ) ni++; + } + n_isolation[i] = ni; + } + // Keep biggest + if (ni>nmax) + { + nmax = ni; + iselect = i; + } + } + + }// End for + } + break; + //---------------------------------------- + case 5: + { + // Select point with highest density number + + nmax = 0; + for (i=0 ; i<pp ; i++) + { + if ( ( ! keep[i]) && (DTX[i]>0) ) + { + ni = n_density[i]; + // If criteria undef, then compute. + if (ni==-1) + { + ni = 0; + for (j=0 ; j<pp ; j++) + { + if ( DSS[i][j]<=DTX[i] ) ni++; + } + n_density[i] = ni; + } + // Keep biggest + if (ni>nmax) + { + nmax = ni; + iselect = i; + } + } + }// End for + } + break; + //---------------------------------------- + default: + throw NOMAD::Exception ( "Sgtelib_Model_Search.cpp" , + __LINE__ ,"method index non valid" ); + //---------------------------------------- + }// End switch + + // If a point was selected, + if ( (iselect>-1) & (!keep[iselect]) ) + { + + if ( bool_display ){ + out << "--> Selection of search point "<< iselect << std::endl; + } + // Note as selected + keep[iselect] = true; + nkeep++; + failure = 0; + + // Update DT and d_isolation and, if needed, reset n_isolation. + for (i=0 ; i<pp ; i++) + { + if (DT[i]>DSS[i][iselect]) + { + // Update DT + DT[i] = DSS[i][iselect]; + DTX[i] = std::min(DTX[i],DT[i]); + n_density[i] = -1; + // Update delta + if (d_isolation[i]>DT[i]) + { + // If d_isolation is updated, then n_isolation is reset + d_isolation[i] = DT[i]; + n_isolation[i] = -1; + } + } + } + } + else + { + if ( bool_display ){ + out << "!! Method " << method << " did not return a point." << std::endl; + } + failure++; + } + + }// End while + + + // Free space + delete [] d_isolation; + delete [] n_isolation; + delete [] n_density; + delete [] DX; + delete [] DT; + delete [] DTX; + for (i=0 ; i<pp ; i++) delete [] DSS[i]; + delete [] DSS; + + // Delete f and h + delete [] f; + delete [] h; + + //============================================= + // Add the selected points + //============================================= + i = 0; + NOMAD::Eval_Point * x; + const NOMAD::Eval_Point * cur; + cur = cache_surrogate.begin(); + while ( cur ) + { + if ( keep[i] ) + { + //out << "Selected point : " << *cur << std::endl; + x = new NOMAD::Eval_Point (*cur); + oracle_pts.push_back(x); + } + if (static_cast<int>(oracle_pts.size())>=nb_candidates) + break; + i++; + cur = cache_surrogate.next(); + } + delete [] keep; + + + return true; + +}// + + + + + +/*------------------------------------------------------*/ +/* project and accept or reject an oracle trial point */ +/* (private) */ +/*------------------------------------------------------*/ +bool NOMAD::Sgtelib_Model_Search::check_oracle_point ( const NOMAD::Cache & cache , + const NOMAD::Point & incumbent , + const NOMAD::Point & delta_m , + const NOMAD::Display & out , + NOMAD::dd_type display_degree , + NOMAD::Point & x ) +{ + bool proj_to_mesh = _p.get_model_search_proj_to_mesh(); + + if ( display_degree == NOMAD::FULL_DISPLAY ) + { + out << std::endl << "oracle candidate"; + if ( proj_to_mesh ) + out << " (before projection)"; + out << ": ( " << x << " )" << std::endl; + } + + // projection to mesh: + if ( proj_to_mesh ) + { + x.project_to_mesh ( incumbent , delta_m , _p.get_lb() , _p.get_ub() ); + if ( display_degree == NOMAD::FULL_DISPLAY ) + out << "oracle candidate (after projection): ( " << x << " )" << std::endl; + } + + // compare x and incumbent coordinates: + if ( x == incumbent ) + { + if ( display_degree == NOMAD::FULL_DISPLAY ) + out << "oracle candidate rejected (candidate==incumbent)" << std::endl; + return false; + } + + // two evaluations points are created in order to: + // 1. check if the candidate is in cache + // 2. have a prediction at x and at the incumbent: + int n = x.size() , m = _p.get_bb_nb_outputs(); + + NOMAD::Eval_Point * tk = new NOMAD::Eval_Point ( n , m ); // trial point + tk->Point::operator = ( x ); + + // check if the point is in cache: + if ( cache.find ( *tk ) ) + { + if ( display_degree == NOMAD::FULL_DISPLAY ) + out << "oracle candidate rejected (found in cache)" << std::endl; + delete tk; + return false; + } + else + { + if ( display_degree == NOMAD::FULL_DISPLAY ) + out << "oracle candidate is not in cache" << std::endl; + return true; + } + +} // end check_oracle_points + + + + + + + +/*--------------------------------------------------------*/ +/* insert a trial point in the evaluator control object */ +/* (private) */ +/*--------------------------------------------------------*/ +void NOMAD::Sgtelib_Model_Search::register_point +( NOMAD::Point x , + NOMAD::Signature & signature , + const NOMAD::Point & incumbent , + NOMAD::dd_type display_degree ) const +{ + int n = x.size(); + + NOMAD::Eval_Point * tk = new NOMAD::Eval_Point ( n , _p.get_bb_nb_outputs() ); + NOMAD::Evaluator_Control * ev_control = _sgtelib_model_manager->get_evaluator_control(); + + // if the search is optimistic, a direction is computed (this + // will be used in case of success in the speculative search): + if ( _p.get_model_search_optimistic() ) + { + NOMAD::Direction dir ( n , 0.0 , NOMAD::MODEL_SEARCH_DIR ); + dir.Point::operator = ( x - incumbent ); + tk->set_direction ( &dir ); + } + + tk->set_signature ( &signature ); + tk->Point::operator = ( x ); + + if ( tk->get_bb_outputs().is_defined() ) + { + throw NOMAD::Exception ( "Sgtelib_Model_Search.cpp" , __LINE__ , + "register_point: point should not have defined bbo" ); + } + + // add the new point to the list of search trial points: + ev_control->add_eval_point ( tk , + display_degree , + _p.get_snap_to_bounds() , + NOMAD::Double() , + NOMAD::Double() , + NOMAD::Double() , + NOMAD::Double() ); + +} + + +/*---------------------------------------------------------------*/ +/* optimize a model (private) */ +/*---------------------------------------------------------------*/ +bool NOMAD::Sgtelib_Model_Search::optimize_model ( const NOMAD::Cache & cache , + const NOMAD::Point & incumbent , + const NOMAD::Point & delta_m , + const NOMAD::Eval_Point * x0s[4] , + const NOMAD::Display & out , + NOMAD::dd_type display_degree , + std::vector<NOMAD::Point *> & oracle_pts, + bool & stop , + NOMAD::stop_type & stop_reason ) +{ + + const bool bool_display = ( (string_find(_p.get_SGTELIB_MODEL_DISPLAY(),"O")) || (display_degree == NOMAD::FULL_DISPLAY) ); + + std::string error_str; + bool error = false; + int i , n = _p.get_dimension(); + int clock_start = static_cast<int>(std::clock()); + if ( bool_display ) + { + out.open_block("Sgtelib_Model_Search::optimize_model"); + // Model evaluation budget + out << "MAX_BB_EVAL: " << _p.get_SGTELIB_MODEL_EVAL_NB() << std::endl; + // blackbox outputs: + out << "BBOT: "; + for ( i = 0 ; i < _p.get_bb_nb_outputs() ; i++ ) + out << _p.get_bb_output_type()[i] << " "; + out << std::endl; + // Formulation + out << "Formulation: " + << sgtelib_model_formulation_type_to_string ( _sgtelib_model_manager->get_formulation() ) + << std::endl; + } + // Reset stats + _sgtelib_model_manager->reset_search_stats(); + + // parameters creation: + NOMAD::Parameters model_param ( out ); + + // random seed: + model_param.set_SEED ( _p.get_seed() + 10 * _all_searches_stats.get_MS_nb_searches() ); + // number of variables: + model_param.set_DIMENSION ( n ); + + + model_param.set_BB_OUTPUT_TYPE ( _p.get_bb_output_type() ); + // blackbox inputs: + model_param.set_BB_INPUT_TYPE ( _p.get_bb_input_type() ); + + // barrier parameters: + model_param.set_H_MIN ( _p.get_h_min () ); + model_param.set_H_NORM ( _p.get_h_norm() ); + + model_param.set_DISPLAY_ALL_EVAL (false); + + // starting points: + for ( i = 0 ; i < 4 ; ++i ) + if ( x0s[i] ) + model_param.set_X0 ( *x0s[i] ); + + // fixed variables: + for ( i = 0 ; i < n ; ++i ) + if ( _p.variable_is_fixed(i) ) + model_param.set_FIXED_VARIABLE(i); + + // no model + model_param.set_DISABLE_MODELS(); + + // display: + if (string_find(_p.get_SGTELIB_MODEL_DISPLAY(),"I")) + { + model_param.set_DISPLAY_DEGREE ( NOMAD::NORMAL_DISPLAY ); + model_param.set_DISPLAY_STATS ("model_opt: BBE OBJ"); + } + else + { + model_param.set_DISPLAY_DEGREE ( NOMAD::NO_DISPLAY ); + } + + // mesh: use isotropic mesh + model_param.set_ANISOTROPIC_MESH ( false ); + model_param.set_MESH_UPDATE_BASIS ( 4.0 ); + model_param.set_MESH_COARSENING_EXPONENT ( 1 ); + model_param.set_MESH_REFINING_EXPONENT ( -1 ); + + NOMAD::Point init_mesh_indices = _p.get_signature()->get_mesh()->get_mesh_indices(); + NOMAD::Point init_Delta = _p.get_signature()->get_mesh()->get_Delta(); + NOMAD::Point init_delta = _p.get_signature()->get_mesh()->get_delta(); + + model_param.set_INITIAL_POLL_SIZE ( init_Delta , false ); + model_param.set_INITIAL_MESH_SIZE ( init_delta , false ); + + + + // model_param.set_INITIAL_MESH_INDEX ( 0 ); + + // searches: + model_param.set_LH_SEARCH ( int(_p.get_SGTELIB_MODEL_EVAL_NB()*0.3) , 0 ); + model_param.set_OPPORTUNISTIC_LH ( false ); + model_param.set_VNS_SEARCH ( true ); + model_param.set_SNAP_TO_BOUNDS ( true ); + + // disable user calls: + model_param.set_USER_CALLS_ENABLED ( false ); + + // set flags: + bool flag_check_bimads , flag_reset_mesh , flag_reset_barriers , flag_p1_active; + NOMAD::Mads::get_flags ( flag_check_bimads , + flag_reset_mesh , + flag_reset_barriers , + flag_p1_active ); + + NOMAD::Mads::set_flag_check_bimads ( true ); + NOMAD::Mads::set_flag_reset_mesh ( true ); + NOMAD::Mads::set_flag_reset_barriers ( true ); + NOMAD::Mads::set_flag_p1_active ( false ); + + // bounds: + model_param.set_LOWER_BOUND ( _sgtelib_model_manager->get_extended_lb() ); + model_param.set_UPPER_BOUND ( _sgtelib_model_manager->get_extended_ub() ); + + //out << "Bounds : " << std::endl; + //out << _sgtelib_model_manager->get_extended_lb() << std::endl; + //out << _sgtelib_model_manager->get_extended_ub() << std::endl; + + + // Max eval + model_param.set_MAX_BB_EVAL ( _p.get_SGTELIB_MODEL_EVAL_NB() ); + + // EXTERN SGTE + if ( _p.get_SGTELIB_MODEL_FORMULATION() == NOMAD::SGTELIB_MODEL_FORMULATION_EXTERN ) + model_param.set_BB_EXE( _p.get_SGTELIB_MODEL_DEFINITION() ); + + // Declaration of the evaluator + NOMAD::Evaluator * ev = NULL; + + // Declaration of the inner instance of mads + NOMAD::Mads * mads_surrogate; + + // Best feasible/infeasible + const NOMAD::Eval_Point * best_feas; + const NOMAD::Eval_Point * best_infeas; + + + //============================= + // OPTIMIZATION OF THE MODEL + //============================= + try + { + // parameters validation: + model_param.check(); + // model evaluator creation: + if ( _p.get_SGTELIB_MODEL_FORMULATION() == NOMAD::SGTELIB_MODEL_FORMULATION_EXTERN ) + ev = new NOMAD::Evaluator ( model_param ); + else + ev = new NOMAD::Sgtelib_Model_Evaluator ( model_param , _sgtelib_model_manager ); + // algorithm creation and execution: + mads_surrogate = new NOMAD::Mads( model_param , ev ); + NOMAD::stop_type st = mads_surrogate->run(); + // check the stopping criterion: + if ( st == NOMAD::CTRL_C || st == NOMAD::MAX_CACHE_MEMORY_REACHED ) + { + std::ostringstream oss; + oss << "model optimization: " << st; + error_str = oss.str(); + error = true; + stop = true; + stop_reason = st; + } + else if ( st == NOMAD::MAX_BB_EVAL_REACHED ) + _one_search_stats.add_MS_max_bbe(); + + + // update the stats on the number of model evaluations: + _one_search_stats.update_MS_model_opt ( mads_surrogate->get_stats().get_bb_eval() ); + + + // get the solution(s): + best_feas = mads_surrogate->get_best_feasible (); + best_infeas = mads_surrogate->get_best_infeasible(); + if ( bool_display ) + { + out << "End of Model Optimization" << std::endl; + if ( best_feas ) + { + out << "Best feasible:"; + out << std::endl; + out << "("<< (NOMAD::Point) *best_feas << ")" << std::endl; + out << "f=" << best_feas->get_f() << " ; h=" << best_feas->get_h() << std::endl; + } + else if ( best_infeas ) + { + out << "Best infeasible: "; + out << std::endl; + out << "("<< (NOMAD::Point) *best_infeas << ")" << std::endl; + out << "f=" << best_infeas->get_f() << " ; h=" << best_infeas->get_h() << std::endl; + } + } + + + + } + catch ( std::exception & e ) + { + error = true; + error_str = std::string ( "optimization error: " ) + e.what(); + // out << error_str << std::endl; + return false; + } + + // reset flags: + NOMAD::Mads::set_flag_check_bimads ( flag_check_bimads ); + NOMAD::Mads::set_flag_reset_mesh ( flag_reset_mesh ); + NOMAD::Mads::set_flag_reset_barriers ( flag_reset_barriers ); + NOMAD::Mads::set_flag_p1_active ( flag_p1_active ); + + + + // Check existence of best feasible and best infeasible + NOMAD::Point * xf = NULL , * xi = NULL; + if ( best_feas ) + { + xf = new NOMAD::Point ( *best_feas ); + delete _start_point_1; + _start_point_1 = new NOMAD::Point ( *best_feas ); + } + else if ( best_infeas ) + { + xi = new NOMAD::Point ( *best_infeas ); + } + if ( best_infeas ) + { + delete _start_point_2; + _start_point_2 = new NOMAD::Point ( *best_infeas ); + } + if ( !xf && !xi ) + { + error = true; + error_str = "optimization error: no solution"; + // out << error_str << std::endl; + return false; + } + + //====================================== + // SELECT CANDIDATES OUT OF THE CACHE + //====================================== + + i = _p.get_SGTELIB_MODEL_CANDIDATES_NB(); + const int nb_candidates = (i<=0) ? _p.get_bb_max_block_size() : i; + + + if ( nb_candidates==1 ) + { + if ( xf ) + oracle_pts.push_back(xf); + else if ( xi ) + oracle_pts.push_back(xi); + } + else + { + if ( bool_display ) + out.open_block("Search filter"); + + // Filter Cache_surrogate + const double delta_m_norm = delta_m.norm().value(); + bool filter_ok = filter_cache ( out, + cache, + mads_surrogate->get_cache(), + nb_candidates, + delta_m_norm, + oracle_pts ); + + if ( bool_display ) + { + out << "End of filter" << std::endl; + out.close_block(); + } + + if ( ! filter_ok ) + throw NOMAD::Exception ( "Sgtelib_Model_Search.cpp" , __LINE__ ,"filter_cache failed." ); + } + + //============================== + // PROJECTION + //============================== + if ( _p.get_model_search_proj_to_mesh() ) + { + if ( bool_display && !string_find(_p.get_SGTELIB_MODEL_DISPLAY(),"P") ) + out << "Projection of search candidates" << std::endl; + + std::vector<NOMAD::Point *>::iterator it; + try { + for (it = oracle_pts.begin() ; it != oracle_pts.end(); ++it){ + get_best_projection( cache , + incumbent , + delta_m , + out , + display_degree , + *ev , + *it ); + } + + } + catch ( std::exception & e ) + { + error = true; + error_str = std::string ( "get_best_projection error: " ) + e.what(); + out << error_str << std::endl; + } + + + } + if ( ev ) + delete ev; + if ( mads_surrogate ) + delete mads_surrogate; + + if ( bool_display ) + { + out << "Error: " << error << std::endl; + out << "Clock: " << double(std::clock() - clock_start)/double(CLOCKS_PER_SEC) << "sec" << std::endl; + out.close_block(); + } + + return !error; +} + + + + + + +/*------------------------------------------------------*/ +/* get best projection */ +/*------------------------------------------------------*/ +void NOMAD::Sgtelib_Model_Search::get_best_projection ( const NOMAD::Cache & cache , + const NOMAD::Point & incumbent , + const NOMAD::Point & delta_m , + const NOMAD::Display & out , + NOMAD::dd_type display_degree , + NOMAD::Evaluator & ev , + NOMAD::Point * x ) +{ + if ( !x ) return; + + const bool bool_display = (string_find(_p.get_SGTELIB_MODEL_DISPLAY(),"P")); + + if (bool_display) + out.open_block("Projection"); + + const int n = x->size(); + const int m = _p.get_bb_nb_outputs(); + int i,j; + + + + // Copy of the mesh size + double * dm = new double[n]; + for (j=0 ; j<n ; j++) + dm[j] = delta_m.get_coord(j).value(); + + + // Build the set of trying points + NOMAD::Eval_Point * x_try; // Projection Trial point + NOMAD::Eval_Point * x_best; // Best Trial poin + NOMAD::Double h, f, h_best, f_best; + double dmj; // component i of delta_m; + bool ce; + + + // Non projected point + //-------------------- + x_try = new NOMAD::Eval_Point ( n , m ); // trial point + x_try->Point::operator = ( *x ); + ev.eval_x( *x_try , 0.0 , ce); + _sgtelib_model_manager->check_hf(x_try); + f = x_try->get_f(); + h = x_try->get_h(); + + if ( bool_display ) + { + out << "Non projected point:" << std::endl; + out << "(" << (NOMAD::Point) *x_try << ")" << std::endl; + out << "f=" << f << " ; h=" << h << std::endl; + } + + delete x_try; + x_try = NULL; + + + // STD projected point + //---------------- + x_try = new NOMAD::Eval_Point ( n , m ); + x_try->Point::operator = ( *x ); + // Project the point on the mesh + x_try->project_to_mesh ( incumbent , delta_m , _p.get_lb() , _p.get_ub() ); + ev.eval_x( *x_try , 0.0 , ce); + _sgtelib_model_manager->check_hf(x_try); + f = x_try->get_f(); + h = x_try->get_h(); + + if ( bool_display ) + { + out << "Standard projected point:" << std::endl; + out << "(" << (NOMAD::Point) *x_try << ")" << std::endl; + out << "f=" << f << " ; h=" << h << std::endl; + } + + x_best = x_try; + f_best = f; + h_best = h; + x_try = NULL; + + + // set of indexes for neighboors creation + //---------------------------------------- + std::set<unsigned int> set_index; + const int nb_voisins = static_cast<int>(pow(2.0,n)); + const int nb_proj_trial = 100*n; + // Build the set of indexes + if ( nb_proj_trial < nb_voisins*1.3 ) + { + // Select randomly nb_proj_trial indexes + for (i=0 ; i<nb_proj_trial ; i++) + set_index.insert(NOMAD::RNG::rand()%nb_voisins); + } + else + { + // Use all indexes + for (i=0 ; i<nb_voisins ; i++) + set_index.insert(i); + } + + + + // Build the set of neighboors + //---------------------------- + + std::set<NOMAD::Point> set_try; + set_try.clear(); + + if ( bool_display ) + { + out.open_block("Projection candidates"); + } + + std::set<unsigned int>::iterator it_index; // Iterator in the set of indexes + unsigned int index; // Index of the neighboor + NOMAD::Point perturbation(x->size()); // Perturbation point + + + // Try pertubation + // ---------------------------- + for ( it_index=set_index.begin() ; it_index!=set_index.end() ; it_index++ ) + { + + // Compute perturbation + index = *it_index; + for ( j=0 ; j<x->size() ; j++ ) + { + + dmj = dm[j]; // Get the value of delta_m + // Added 22 octobre 2015 to handle integer variables + if ( (_p.get_bb_input_type())[j] == NOMAD::INTEGER || (_p.get_bb_input_type())[j] == NOMAD::BINARY ) + dmj = 1.0; + + if ( index & 1 ) + dmj *= -1; // Inverse dmi depending on parity of index + + perturbation.set_coord(j,dmj); // Set perturbation + index = (index >> 1); // Right shift (ie: divide by 2); + + }// End of the construction of the perturbation + + + + + // Loop on points of the cache + // ---------------------------- + const NOMAD::Eval_Point * xref = cache.begin(); + while ( xref ) + { + + // Build projection trial point + // trial point + + NOMAD::Point * y = new NOMAD::Point ( n ); + y->Point::operator = ( *x+perturbation ); + y->project_to_mesh ( *xref , delta_m , _p.get_lb() , _p.get_ub() ); + + + + // Rounding for integer and binary... + for ( i=0 ; i<y->size() ; i++ ) + { + if ( (_p.get_bb_input_type())[i] == NOMAD::INTEGER ) + (*y)[i] = (*y)[i].roundd(); + + if ( (_p.get_bb_input_type())[i] == NOMAD::BINARY ) + (*y)[i] = ((*y)[i]>0.5)?1:0; + + } + + + set_try.insert(*y); + delete y; + + xref = cache.next(); + + }// End of loop on the cache + + }// End of the construction of set_try + + + + + if ( bool_display ) + { + out << set_index.size() << " perturbation vectors" << std::endl; + out << cache.size() << " cache pts" << std::endl; + out << set_try.size() << " projection candidates!" << std::endl; + } + + + + + // Greedy selection + //-------------------------------- + const int p = static_cast<int>( set_try.size() ); + bool * keep = new bool [p]; + + if ( p<=nb_proj_trial ) + { + // Not needed + for ( i=0 ; i < p ; i++ ) + keep[i] = true; + } + else + { + // DO the greedy selection + int inew; + double * xnew_d; + double * xref_d = new double [n]; + for ( j = 0 ; j < n ; j++ ) + xref_d[j] = x->get_coord(j).value(); + + // Convert set of trial candidates into an array + //-------------------------------- + double ** X = new double * [p]; + + std::set<NOMAD::Point>::const_iterator it; // Iterator in the set of indexes + i = 0; + for ( it = set_try.begin() ; it != set_try.end() ; it++ ) + { + X[i] = new double [n]; + for (j=0 ; j<n ; j++) + X[i][j] = it->get_coord(j).value(); + + i++; + } + + // Distance to xref + double * Dr = new double [p]; + // Distance to the set of selected (or kept) points + double * Ds = new double [p]; + double * Ds2 = new double [p]; // Square of Ds + + // First selected point + inew = 0; + xnew_d = X[inew]; + double lambda = 3; + + // Buffer for dxj + double dxj; + + + // Initialise the distances + //-------------------------------------- + for ( i = 0 ; i < p ; i++ ) + { + // Compute distance between each point of the set and the point xref + // and also between each point of the set and the selected point xnew + Dr[i] = 0; + Ds[i] = 0; + for ( j = 0 ; j < n ; j++ ) + { + dxj = (xref_d[j]-X[i][j])/dm[j]; + Dr[i] += dxj*dxj; + dxj = (xnew_d[j]-X[i][j])/dm[j]; + Ds[i] += dxj*dxj; + } + Dr[i] = sqrt(Dr[i]); + Ds2[i] = Ds[i]; + Ds[i] = sqrt(Ds[i]); + // Init keep + keep[i] = false; + } + + // Note that we selected the first point + int nb_keep = 1; + keep[inew] = true; + + // Greedy selection + //--------------------------- + + // Q is the selection criteria: Q = Ds-lambda*Dr + double Q_max, Q; + // d is a buffer + double d; + + while ( nb_keep < nb_proj_trial ) + { + // Find the index that maximizes Ds-lambda*Dr + Q_max = -INF; + inew = 1; + for ( i = 0 ; i < p ; i++ ) + { + Q = Ds[i]-lambda*Dr[i]; + if ( Q > Q_max ) + { + inew = i; + Q_max = Q; + } + } + + if ( Ds[inew] == 0 ) + { + // If the point is already in the set, then reduce lambda + lambda*=0.9; + if (lambda<1e-6) + break; + + } + else + { + //Otherwise, add the point to the set + keep[inew] = true; + nb_keep++; + xnew_d = X[inew]; + // Update its distance to the set + Ds[inew] = 0; + // Update the other distances to the set + for ( i = 0 ; i < p ; i++ ) + { + if ( Ds[i] > 0 ) + { + // Compute distance between each point of the set and the point xref + // and also between each point of the set and the selected point xnew + d = 0; + for ( j = 0 ; j < n ; j++ ) + { + dxj = (xnew_d[j]-X[i][j])/dm[j]; + d += dxj*dxj; + } + if ( Ds2[i] > d ) + { + Ds2[i]=d; + Ds[i] = sqrt(d); + } + } + } + } + }// End while + + + if ( bool_display ) + { + out << nb_keep << " projection candidates (after greedy selection)" << std::endl; + } + + delete [] xref_d; + delete [] Ds; + delete [] Ds2; + delete [] Dr; + for ( i = 0 ; i < p ; i++ ) + delete [] X[i]; + delete [] X; + }// End selection + + delete [] dm; + + + // Evaluate projection trial points + // in the surrogate model + //----------------------------------------- + std::set<NOMAD::Point>::const_iterator it_try; // Iterator in the set of indexes + i = 0; + for ( it_try = set_try.begin() ; it_try != set_try.end() ; it_try++ ) + { + if ( keep[i] ) + { + x_try = new NOMAD::Eval_Point ( n , m ); + x_try->Point::operator = ( *it_try ); + + // Eval (with the same evaluator as for the model optimization) + ev.eval_x( *x_try , 0.0 , ce); + _sgtelib_model_manager->check_hf(x_try); + f = x_try->get_f(); + h = x_try->get_h(); + + if ( ( (h>0) && (h<h_best) ) || ( (h==0) && (f<f_best) ) ) + { + + if ( bool_display ) + { + out << "( " << x_try->get_bb_outputs() << " )" << std::endl; + out << "f =" << f << " ; h =" << h << " (new best projection)" << std::endl; + } + + delete x_best; + x_best = x_try; + f_best = f; + h_best = h; + + } + else + delete x_try; + x_try = NULL; + } + i++; + } + + + + x->Point::operator = ( *x_best ); + if ( bool_display ) + { + out.close_block(); + out << "Selected candidate: " << std::endl; + out << "(" << (NOMAD::Point) *x << ")" << std::endl; + out << "f=" << f_best << " ; h=" << h_best << std::endl; + out << "( " << x_best->get_bb_outputs() << " )" << std::endl; + out.close_block(); + + } + + set_index.clear(); + set_try.clear(); + if ( x_best ) + delete x_best; + if ( x_try ) + delete x_try; + delete [] keep; + +}// + + + + + +// #endif diff --git a/src/Sgtelib_Model_Search.hpp b/src/Sgtelib_Model_Search.hpp new file mode 100644 index 0000000000000000000000000000000000000000..3610b8a8dda278f6234a54fcc2915130a4b5a7e0 --- /dev/null +++ b/src/Sgtelib_Model_Search.hpp @@ -0,0 +1,262 @@ +/*-------------------------------------------------------------------------------------*/ +/* sgtelib - A surrogate model library for derivative-free optimization */ +/* Version 2.0.1 */ +/* */ +/* Copyright (C) 2012-2016 Sebastien Le Digabel - Ecole Polytechnique, Montreal */ +/* Bastien Talgorn - McGill University, Montreal */ +/* */ +/* Author: Bastien Talgorn */ +/* email: bastientalgorn@fastmail.com */ +/* */ +/* This program is free software: you can redistribute it and/or modify it under the */ +/* terms of the GNU Lesser General Public License as published by the Free Software */ +/* Foundation, either version 3 of the License, or (at your option) any later */ +/* version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ +/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ +/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License along */ +/* with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on sgtelib at https://github.com/bastientalgorn/sgtelib */ +/*-------------------------------------------------------------------------------------*/ +/** + \file Sgtelib_Model_Search.cpp + \brief Model search using the sgtelib_model surrogate library. + \author Bastien Talgorn + \date 2013-04-25 + \see Sgtelib_Model_Manager.cpp + */ + +#ifndef __SGTELIB_MODEL_SEARCH__ +#define __SGTELIB_MODEL_SEARCH__ + +#include "LH_Search.hpp" +#include "Sgtelib_Model_Evaluator.hpp" +#include "Sgtelib_Model_Manager.hpp" +#include <time.h> + +namespace NOMAD { + + /// Model search. + class Sgtelib_Model_Search : public NOMAD::Search , private NOMAD::Uncopyable { + + private: + + NOMAD::Model_Stats _one_search_stats; ///< Stats for one search. + NOMAD::Model_Stats _all_searches_stats; ///< Stats for all searches. + + NOMAD::Sgtelib_Model_Manager * _sgtelib_model_manager; + + std::vector<NOMAD::bb_output_type> _bbot; ///< Blackbox output types. + + NOMAD::Point * _start_point_1; + NOMAD::Point * _start_point_2; + /// The non projected result of a surrogate model optimization + // is memorized and used as ONE of the starting points in the next surrogate model optim. + + /// Delete a list of points. + /** + \param pts The points -- \b IN/OUT. + */ + static void clear_pts ( std::vector<NOMAD::Point *> & pts ); + + /// Delete a list of evaluation points. + /** + \param pts The points -- \b IN/OUT. + */ + static void clear_pts ( std::vector<NOMAD::Eval_Point *> & pts ); + + /// Create oracle points by optimizing the model. + /** + \param mads The mads instance -- \b IN. + \param incumbent The incumbent -- \b IN. + \param delta_m Mesh size parameter -- \b IN. + \param out The NOMAD::Display object -- \b IN. + \param display_degree Display degree -- \b IN. + \param display_lim Max number of pts when sets are displayed -- \b IN. + \param oracle_pts Oracle candidates points -- \b OUT. + \param stop Stop flag -- \b OUT. + \param stop_reason Stop reason -- \b OUT. + \return A boolean equal to \c true if oracle points are proposed. + */ + bool create_oracle_pts + ( + const NOMAD::Mads & mads , + const NOMAD::Point & incumbent , + const NOMAD::Point & delta_m , + const NOMAD::Display & out , + NOMAD::dd_type display_degree , + int display_lim , + std::vector<NOMAD::Point *> & oracle_pts , + bool & stop , + NOMAD::stop_type & stop_reason ); + + /// Model optimization. + /** + \param cache The cache of points -- \b IN. + \param incumbent The current incumbent -- \b IN. + \param delta_m Mesh size parameter -- \b IN. + \param x0s The three starting points -- \b IN. + \param out The NOMAD::Display object -- \b IN. + \param display_degree Display degree -- \b IN. + \param oracle_pts Oracle candidates points -- \b OUT. + \param stop Stop flag -- \b OUT. + \param stop_reason Stop reason -- \b OUT. + \return A boolean equal to \c true if oracle points are proposed. + */ + bool optimize_model + ( + const NOMAD::Cache & cache , + const NOMAD::Point & incumbent , + const NOMAD::Point & delta_m , + const NOMAD::Eval_Point * x0s[3] , + const NOMAD::Display & out , + NOMAD::dd_type display_degree , + std::vector<NOMAD::Point *> & oracle_pts , + bool & stop , + NOMAD::stop_type & stop_reason ); + + /// Cache filtering. + /** + \param cache The cache of points -- \b IN. + \param cache_surrogate The cache of surrogate points -- \b IN. + \param out The NOMAD::Display object -- \b IN. + \param nb_candidates The number of candidates -- \b IN. + \param delta_m_norm The distance for filtering -- \b IN. + \param oracle_pts Oracle candidates points -- \b OUT. + \return A boolean equal to \c true if oracle points are proposed. + */ + bool filter_cache + ( + const NOMAD::Display & out , + const NOMAD::Cache & cache , + const NOMAD::Cache & cache_surrogate , + const int & nb_candidates , + const double & delta_m_norm , + std::vector<NOMAD::Point *> & oracle_pts ); + + + /// Get best projection + /** + \param cache Cache of true evaluations -- \b IN. + \param incumbent The incumbent -- \b IN. + \param delta_m Mesh size parameter -- \b IN. + \param out The NOMAD::Display object -- \b IN. + \param display_degree Display degree -- \b IN. + \param ev The Evaluator -- \b IN. + \param x The oracle point -- \b IN/OUT. + */ + void get_best_projection + ( + const NOMAD::Cache & cache , + const NOMAD::Point & incumbent , + const NOMAD::Point & delta_m , + const NOMAD::Display & out , + NOMAD::dd_type display_degree , + NOMAD::Evaluator & ev , + NOMAD::Point * x ); + + + /// Project and accept or reject an oracle trial point. + /** + \param cache Cache of true evaluations -- \b IN. + \param incumbent The incumbent -- \b IN. + \param delta_m Mesh size parameter -- \b IN. + \param out The NOMAD::Display object -- \b IN. + \param display_degree Display degree -- \b IN. + \param x The oracle point -- \b IN/OUT. + \return A boolean equal to \c true if the point is accepted. + */ + bool check_oracle_point + ( + const NOMAD::Cache & cache , + const NOMAD::Point & incumbent , + const NOMAD::Point & delta_m , + const NOMAD::Display & out , + NOMAD::dd_type display_degree , + NOMAD::Point & x ); + + + /// Insert a trial point in the evaluator control object. + /** + \param x The point coordinates -- \b IN. + \param signature Signature -- \b IN. + \param incumbent The incumbent -- \b IN. + \param display_degree Display degree -- \b IN. + */ + void register_point + ( + NOMAD::Point x , + NOMAD::Signature & signature , + const NOMAD::Point & incumbent , + NOMAD::dd_type display_degree ) const; + + /*----------------------------------------------------------------------*/ + + public: + + /// Constructor. + /** + \param p Parameters -- \b IN. + */ + Sgtelib_Model_Search ( NOMAD::Parameters & p ) + : NOMAD::Search ( p , NOMAD::MODEL_SEARCH ) , _sgtelib_model_manager (NULL) + { + _bbot = p.get_bb_output_type(); + + } + + /// Destructor. + virtual ~Sgtelib_Model_Search ( void ) { reset(); } + + /// Reset. + virtual void reset ( void ); + + /// Give a link to ev_control + void set_sgtelib_model_manager ( NOMAD::Sgtelib_Model_Manager * sgtelib_model_manager ) + { + _sgtelib_model_manager = sgtelib_model_manager; + _start_point_1 = NULL; + _start_point_2 = NULL; + } + + + /// The sgtelib_model model search. + /** + Based on quadratic regression/MFN interpolation models. + \param mads NOMAD::Mads object invoking this search -- \b IN/OUT. + \param nb_search_pts Number of generated search points -- \b OUT. + \param stop Stop flag -- \b IN/OUT. + \param stop_reason Stop reason -- \b OUT. + \param success Type of success -- \b OUT. + \param count_search Count or not the search -- \b OUT. + \param new_feas_inc New feasible incumbent -- \b IN/OUT. + \param new_infeas_inc New infeasible incumbent -- \b IN/OUT. + */ + virtual void search + ( NOMAD::Mads & mads , + int & nb_search_pts , + bool & stop , + NOMAD::stop_type & stop_reason , + NOMAD::success_type & success , + bool & count_search , + const NOMAD::Eval_Point *& new_feas_inc , + const NOMAD::Eval_Point *& new_infeas_inc ); + + + //// Display stats. + /** + \param out The NOMAD::Display object -- \b IN. + */ + virtual void display ( const NOMAD::Display & out ) const + { + out << _all_searches_stats; + } + }; +} + +#endif +// #endif diff --git a/src/Signature.cpp b/src/Signature.cpp index e2c9288b18a831956a6bbf12b7df0918d1391fc4..233a8fb10ebfcd0ed316fe7d9532f6b3f5db85b1 100644 --- a/src/Signature.cpp +++ b/src/Signature.cpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Signature.cpp \brief Evaluation point signature (implementation) @@ -50,6 +52,7 @@ #include "Signature.hpp" #include "SMesh.hpp" #include "XMesh.hpp" +#include "GMesh.hpp" /*-----------------------------------*/ /* static members initialization */ @@ -64,46 +67,55 @@ bool NOMAD::Signature::_warning_has_been_displayed=false; /*--------------------------------------------------*/ /* constructor 1 */ /*--------------------------------------------------*/ -NOMAD::Signature::Signature ( int n , - const std::vector<NOMAD::bb_input_type> & input_types , - const NOMAD::Point & lb , - const NOMAD::Point & ub , - const NOMAD::mesh_type & mesh_type , - bool anisotropic_mesh , - const NOMAD::Point & granularity , - const NOMAD::Point & initial_poll_size , - const NOMAD::Point & min_poll_size , - const NOMAD::Point & min_mesh_size , - NOMAD::Double & mesh_update_basis , - NOMAD::Double & poll_update_basis , - int & mesh_coarsening_exponent , - int & mesh_refining_exponent , - int initial_mesh_index , - int limit_mesh_index , - const NOMAD::Point & scaling , - const NOMAD::Point & fixed_variables , - const std::vector<bool> & periodic_variables , - std::set<NOMAD::Variable_Group*,NOMAD::VG_Comp> & var_groups , - const NOMAD::Display & out ) +NOMAD::Signature::Signature ( int n , + const std::vector<NOMAD::bb_input_type> & input_types , + const NOMAD::Point & lb , + const NOMAD::Point & ub , + const NOMAD::mesh_type & mesh_type , + bool anisotropic_mesh , + const NOMAD::Point & granularity , + const NOMAD::Point & initial_poll_size , + const NOMAD::Point & min_poll_size , + const NOMAD::Point & min_mesh_size , + NOMAD::Double & mesh_update_basis , + NOMAD::Double & poll_update_basis , + int & mesh_coarsening_exponent, + int & mesh_refining_exponent , + int initial_mesh_index , + const NOMAD::Point & scaling , + const NOMAD::Point & fixed_variables , + const std::vector<bool> & periodic_variables , + std::set<NOMAD::Variable_Group*,NOMAD::VG_Comp> & var_groups , + const NOMAD::Display & out ) : _std ( false ) , _out ( out ) { - // Mesh index starts at 0 for xmesh and decreases as the mesh size decreases + // Mesh index starts at 0 for (x/g)mesh and decreases as the mesh size decreases // The mesh index is reset to 0 as the mesh is reset. - if ( mesh_type == NOMAD::XMESH ) + if ( mesh_type == NOMAD::GMESH ) + _mesh= new NOMAD::GMesh(anisotropic_mesh, + initial_poll_size, + min_poll_size, + min_mesh_size, + fixed_variables, + granularity, + poll_update_basis, // poll update basis and the 2 other parameters are not needed + mesh_coarsening_exponent, + mesh_refining_exponent); + + else if ( mesh_type == NOMAD::XMESH ) _mesh=new NOMAD::XMesh( anisotropic_mesh, - initial_poll_size, - min_poll_size, - min_mesh_size, - fixed_variables, - poll_update_basis, // XMesh sets poll update basis (default 2) - mesh_coarsening_exponent, - mesh_refining_exponent , - limit_mesh_index ); - + initial_poll_size, + min_poll_size, + min_mesh_size, + fixed_variables, + poll_update_basis, // XMesh sets poll update basis (default 2) + mesh_coarsening_exponent, + mesh_refining_exponent); + else if ( mesh_type == NOMAD::SMESH ) - // Mesh index can be provided for isotropic smesh and increases as the mesh size decreases + // Mesh index can be provided for isotropic smesh and increases as the mesh size decreases _mesh=new NOMAD::SMesh(initial_poll_size, // WARNING THIS IS NOT AN ERROR new initial_poll_size ~ old initial mesh size min_poll_size, min_mesh_size, @@ -111,8 +123,7 @@ _out ( out ) mesh_update_basis, // SMesh set mesh update basis (default 4) mesh_coarsening_exponent, mesh_refining_exponent, - initial_mesh_index , - limit_mesh_index ); + initial_mesh_index ); else throw NOMAD::Signature::Signature_Error ( "Signature.cpp" , __LINE__ , *this , "NOMAD::Signature::Signature(): a valid mesh type must be given" ); @@ -137,7 +148,7 @@ _out ( out ) /*--------------------------------------------------*/ /* constructor 2 */ /*--------------------------------------------------*/ -NOMAD::Signature::Signature ( int n , +NOMAD::Signature::Signature ( int n , const std::vector<NOMAD::bb_input_type> & input_types , const NOMAD::Point & initial_poll_size , const NOMAD::Point & lb , @@ -152,8 +163,8 @@ _out ( out ) throw NOMAD::Signature::Signature_Error ( "Signature.cpp" , __LINE__ , *this , "NOMAD::Signature::Signature(): bad argument: input_types" ); - // For this constructor, the default mesh is isotropic xmesh - //------------------------------------------ + // Default mesh is isotropic xmesh for this constructor + //----------------------------------------------------- _mesh=new NOMAD::XMesh (false, initial_poll_size, NOMAD::Point(), @@ -222,18 +233,18 @@ _out ( out ) /*--------------------------------------------------*/ NOMAD::Signature::Signature ( const NOMAD::Signature & s ) : _lb ( s._lb ) , -_ub ( s._ub ) , -_scaling ( s._scaling ) , -_fixed_variables ( s._fixed_variables ) , -_granularity ( s._granularity ) , -_input_types ( s._input_types ) , -_all_continuous ( s._all_continuous ) , -_has_categorical ( s._has_categorical ) , -_periodic_variables ( s._periodic_variables ) , -_std ( false ) , -_feas_success_dir ( s._feas_success_dir ) , -_infeas_success_dir ( s._infeas_success_dir ) , -_out (s._out) + _ub ( s._ub ) , + _scaling ( s._scaling ) , + _fixed_variables ( s._fixed_variables ) , + _granularity ( s._granularity ) , + _input_types ( s._input_types ) , + _all_continuous ( s._all_continuous ) , + _has_categorical ( s._has_categorical ) , + _periodic_variables ( s._periodic_variables ) , + _std ( false ) , + _feas_success_dir ( s._feas_success_dir ) , + _infeas_success_dir ( s._infeas_success_dir ) , + _out (s._out) { @@ -241,6 +252,8 @@ _out (s._out) _mesh = new NOMAD::SMesh (*(static_cast<NOMAD::SMesh*>(s._mesh))); else if ( dynamic_cast<NOMAD::XMesh*> (s._mesh) ) _mesh = new NOMAD::XMesh (*(static_cast<NOMAD::XMesh*>(s._mesh))); + else if ( dynamic_cast<NOMAD::GMesh*> (s._mesh) ) + _mesh = new NOMAD::GMesh (*(static_cast<NOMAD::GMesh*>(s._mesh))); else throw NOMAD::Signature::Signature_Error ( "Signature.cpp" , __LINE__ , *this , "NOMAD::Signature::Signature(): copy constructor needs a valid mesh_type in the copied object" ); @@ -294,7 +307,7 @@ void NOMAD::Signature::clear ( void ) /*--------------------------------------------------*/ void NOMAD::Signature::set_feas_success_dir ( const NOMAD::Direction & d ) { - if ( d.size() != static_cast<int>(_input_types.size()) ) + if ( d.size() != static_cast<int>( _input_types.size() ) ) throw NOMAD::Signature::Signature_Error ( "Signature.cpp" , __LINE__ , *this , "NOMAD::Signature::set_feas_success_dir(): bad direction" ); _feas_success_dir = d; @@ -305,7 +318,7 @@ void NOMAD::Signature::set_feas_success_dir ( const NOMAD::Direction & d ) /*--------------------------------------------------*/ void NOMAD::Signature::set_infeas_success_dir ( const NOMAD::Direction & d ) { - if ( d.size() != static_cast<int>(_input_types.size()) ) + if ( d.size() != static_cast<int>( _input_types.size() ) ) throw NOMAD::Signature::Signature_Error ( "Signature.cpp" , __LINE__ , *this , "NOMAD::Signature::set_infeas_success_dir(): bad direction" ); _infeas_success_dir = d; @@ -315,7 +328,7 @@ void NOMAD::Signature::set_infeas_success_dir ( const NOMAD::Direction & d ) /*--------------------------------------------------*/ /* initializations (private) */ /*--------------------------------------------------*/ -void NOMAD::Signature::init ( int n , +void NOMAD::Signature::init ( int n , const std::vector<NOMAD::bb_input_type> & input_types , const NOMAD::Point & lb , const NOMAD::Point & ub , @@ -372,14 +385,14 @@ void NOMAD::Signature::init ( int n else throw NOMAD::Signature::Signature_Error ( "Signature.cpp" , __LINE__ , *this , "NOMAD::Signature::init(): bad argument: fixed_variables" ); - + // Granularity: if ( granularity.empty() ) _granularity.reset(n,0) ; else if ( granularity.size() == n ) _granularity = granularity; else throw NOMAD::Signature::Signature_Error ( "Signature.cpp" , __LINE__ , *this , - "NOMAD::Signature::init(): bad argument: granularity" ); + "NOMAD::Signature::init(): bad argument: granular_variables" ); // periodic variables: _periodic_variables = periodic_variables; @@ -554,7 +567,7 @@ int NOMAD::Signature::get_max_size_poll_set ( void ) const /*--------------------------------------------------*/ /* reset */ /*--------------------------------------------------*/ -void NOMAD::Signature::reset ( int n , +void NOMAD::Signature::reset ( int n , const std::vector<NOMAD::bb_input_type> & input_types , const NOMAD::Point & lb , const NOMAD::Point & ub , @@ -605,9 +618,9 @@ bool NOMAD::Signature::is_compatible ( const NOMAD::Point & x ) const /*-----------------------------------------------------*/ /* compute the directions */ /*-----------------------------------------------------*/ -void NOMAD::Signature::get_directions ( std::list<NOMAD::Direction> & dirs , - NOMAD::poll_type poll , - const NOMAD::Point & poll_center ) +void NOMAD::Signature::get_directions ( std::list<NOMAD::Direction> & dirs , + NOMAD::poll_type poll , + const NOMAD::Point & poll_center ) { NOMAD::Direction * pd; @@ -621,7 +634,7 @@ void NOMAD::Signature::get_directions ( std::list<NOMAD::Direction> & dirs // Reset dir_group_index. - // For each signature, a variable_group has a unique set of directions generated and a unique dir_group_index starting by zero (-1 if no dirs) + // For each signature, a variable_group has a unique set of directions generated and a unique dir_group_index starting by zero (-1 if no dirs) _dir_group_index=-1; // loop on variable groups: @@ -653,7 +666,7 @@ void NOMAD::Signature::get_directions ( std::list<NOMAD::Direction> & dirs NOMAD::Double normInfPoint=0; for ( it_vi = var_indexes.begin() ; it_vi != end_vi ; ++it_vi ,++i ) { - normInfPoint = std::max( normInfPoint.value() , std::fabs( (*it_dir)[i].value() ) ); + normInfPoint = NOMAD::max( normInfPoint , (*it_dir)[i].abs() ); } @@ -672,9 +685,18 @@ void NOMAD::Signature::get_directions ( std::list<NOMAD::Direction> & dirs (*pd)[*it_vi] = 0.0; else { + + if ( dynamic_cast<NOMAD::GMesh *>(_mesh) ) { + if ( normInfPoint==0 ) + throw NOMAD::Signature::Signature_Error ( "Signature.cpp" , __LINE__ , *this , + "NOMAD::Signature::set_poll_directions: cannot handle an infinite norm of zero" ); - // Pickup 0, -1, 1 for the integer variable when Delta < 1.0 + (*pd)[*it_vi] = _mesh->scale_and_project(*it_vi,(*it_dir)[i] / normInfPoint ); + } + else + { + // Case other than Gmesh: if ( _input_types[*it_vi] == NOMAD::INTEGER && Delta[i] < 1.0 ) { if ( (*it_dir)[i] > 1.0/3.0 ) @@ -698,26 +720,25 @@ void NOMAD::Signature::get_directions ( std::list<NOMAD::Direction> & dirs else if ( (*pd)[*it_vi] <= -Delta[*it_vi]/3.0 ) (*pd)[*it_vi] = (*pd)[*it_vi].floor(); else - (*pd)[*it_vi] = (*pd)[*it_vi].round(); + (*pd)[*it_vi] = (*pd)[*it_vi].roundd(); } } } } - } - } } } /*-----------------------------------------------------------------------------------*/ -/* compute one ORTHO 1 direction for a random group of variable */ +/* compute one ORTHO 1 direction for a random group of variable */ /*-----------------------------------------------------------------------------------*/ -void NOMAD::Signature::get_variable_group_direction ( NOMAD::Direction & dir , - const NOMAD::Point & poll_center ) +void NOMAD::Signature::get_variable_group_direction ( NOMAD::Direction & dir , + const NOMAD::Point & poll_center ) { + int i=0; std::set<int>::const_iterator it_vi , end_vi; NOMAD::Point delta=_mesh->get_delta ( ); @@ -725,7 +746,7 @@ void NOMAD::Signature::get_variable_group_direction ( NOMAD::Direction & dir // Reset dir_group_index. - // For each signature, a variable_group has a unique set of directions generated and a unique dir_group_index starting by zero (-1 if no dirs) + // For each signature, a variable_group has a unique set of directions generated and a unique dir_group_index starting by zero (-1 if no dirs) _dir_group_index=1; size_t n_vg=_var_groups.size(); @@ -755,16 +776,18 @@ void NOMAD::Signature::get_variable_group_direction ( NOMAD::Direction & dir s=NOMAD::RNG::rand(0,1); NOMAD::Double normInfPoint=0; - for ( int i=0; i < static_cast<int>(var_indexes.size()) ; ++i ) + for ( int j=0; j < static_cast<int>(var_indexes.size()) ; ++j ) { - normInfPoint = std::max( normInfPoint.value() , std::fabs( (dir_nc)[i].value() ) ); + normInfPoint = NOMAD::max( normInfPoint , (dir_nc)[i].abs() ); } + + + end_vi = var_indexes.end(); - int i = 0; + i = 0; for ( it_vi = var_indexes.begin() ; it_vi != end_vi ; ++it_vi ,++i) { - if ( _input_types[*it_vi] == NOMAD::BINARY ) { if ( dir_nc[i] < 0 ) @@ -779,9 +802,19 @@ void NOMAD::Signature::get_variable_group_direction ( NOMAD::Direction & dir { // Scaling and projection on the mesh ---> round up to prevent getting the current incumbent (0<s<=1) + + if ( dynamic_cast<NOMAD::GMesh *>(_mesh) ) { + if ( normInfPoint==0 ) + throw NOMAD::Signature::Signature_Error ( "Signature.cpp" , __LINE__ , *this , + "NOMAD::Signature::set_poll_directions: cannot handle an infinite norm of zero" ); - // Pickup 0, -1, 1 for the integer variable when Delta < 1.0 + dir[*it_vi] = _mesh->scale_and_project(*it_vi,dir_nc[i] * s / normInfPoint ); + } + else + { + + // Case other than Gmesh: if ( _input_types[*it_vi] == NOMAD::INTEGER && Delta[i] < 1.0 ) { if ( dir_nc[i] > 1.0/3.0 ) @@ -819,8 +852,9 @@ void NOMAD::Signature::get_variable_group_direction ( NOMAD::Direction & dir /*----------------------------------------------------------------*/ /* get just one direction for a given mesh (used by VNS search) */ /*----------------------------------------------------------------*/ -void NOMAD::Signature::get_one_direction ( NOMAD::Direction & dir , int ell) +void NOMAD::Signature::get_one_direction ( NOMAD::Direction & dir , int ell) { + int i=0; std::set<int>::const_iterator it_vi , end_vi; // get delta_m (mesh size parameter): @@ -848,21 +882,19 @@ void NOMAD::Signature::get_one_direction ( NOMAD::Direction & dir , int ell) // get a direction on a unit nc-sphere if ( (*it_vg)->get_one_direction ( dir_nc ) ) { - - + NOMAD::Double normInfPoint=0; - for ( int i=0; i < static_cast<int>(var_indexes.size()) ; ++i ) + for ( int j=0; j < static_cast<int>(var_indexes.size()) ; ++j ) { - normInfPoint = std::max( normInfPoint.value() , std::fabs( (dir_nc)[i].value() ) ); + normInfPoint = NOMAD::max( normInfPoint , (dir_nc[j]).abs() ); } - + // scale with delta and round integer and binary variables: end_vi = var_indexes.end(); - int i = 0; + i = 0; for ( it_vi = var_indexes.begin() ; it_vi != end_vi ; ++it_vi, ++i ) { - if ( _input_types[*it_vi] == NOMAD::BINARY ) { if ( dir_nc[i] < 0 ) @@ -875,8 +907,16 @@ void NOMAD::Signature::get_one_direction ( NOMAD::Direction & dir , int ell) dir[*it_vi] = 0.0; else { + if ( dynamic_cast<NOMAD::GMesh *>(_mesh) ) { - // Pickup 0, -1, 1 for the integer variable when Delta < 1.0 + if ( normInfPoint==0 ) + throw NOMAD::Signature::Signature_Error ( "Signature.cpp" , __LINE__ , *this , "NOMAD::Signature::set_poll_directions: cannot handle an infinite norm of zero" ); + + dir[*it_vi] = _mesh->scale_and_project(*it_vi , dir_nc[i] / normInfPoint ); + } + else + { + // Case other than Gmesh: if ( _input_types[*it_vi] == NOMAD::INTEGER && Delta[i] < 1.0 ) { if ( dir_nc[i] > 1.0/3.0 ) @@ -1001,7 +1041,7 @@ bool NOMAD::Signature::snap_to_bounds ( NOMAD::Point & x , NOMAD::Direction * di /* treat the periodic variables */ /* returns true if x has been modified */ /*--------------------------------------------------*/ -bool NOMAD::Signature::treat_periodic_variables ( NOMAD::Point & x , +bool NOMAD::Signature::treat_periodic_variables ( NOMAD::Point & x , const NOMAD::Direction * old_dir , NOMAD::Direction *& new_dir ) { @@ -1277,7 +1317,7 @@ bool NOMAD::Signature::operator < ( const NOMAD::Signature & s ) const return true; if ( s._granularity[i].comp_with_undef ( _granularity[i] ) ) return false; - + // mesh: // ----- diff --git a/src/Signature.hpp b/src/Signature.hpp index a779202fd8f4db145f1c441c85b0c7e83437e699..6ca6ba07f8b6707d5b463e82f16a3608c7eb2812 100644 --- a/src/Signature.hpp +++ b/src/Signature.hpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Signature.hpp \brief Evaluation point signature (headers) @@ -57,7 +59,7 @@ namespace NOMAD { /// Evaluation point signature. class Signature { - private: + private: #ifdef MEMORY_DEBUG static int _cardinality; ///< Number of NOMAD::Signature objects in memory. @@ -125,7 +127,7 @@ namespace NOMAD { \param ub Upper bounds -- \b IN. \param scaling Scaling -- \b IN. \param fixed_variables Fixed variables -- \b IN. - \param granularity Min granularity of var -- \b IN. + \param granularity Granularity -- \b IN. \param periodic_variables Periodic variables -- \b IN. \param var_groups Groups of variables -- \b IN. */ @@ -154,13 +156,13 @@ namespace NOMAD { */ const Signature & operator = ( const Signature & s ); - public: + public: /*---------------------------------------------------------------------------*/ /// Exception class for an invalid signature. class Signature_Error : public NOMAD::Exception { - public: + public: /// Constructor. Signature_Error ( const std::string & file , int line , @@ -174,49 +176,47 @@ namespace NOMAD { /// Constructor #1. /** Advanced version. - \param n Number of variables -- \b IN. - \param input_types Types of the variables -- \b IN. - \param mesh_type Type of mesh (SMesh,XMesh,GMesh)-- \b IN. - \param anisotropic_mesh Anisotropy of mesh (XMesh) -- \b IN. - \param granularity Gramularity of variables -- \b IN. - \param initial_poll_size Initial poll size -- \b IN. - \param min_poll_size Minimum poll size -- \b IN. - \param min_mesh_size Minimim mesh size -- \b IN. - \param mesh_update_basis Mesh update basis -- \b IN. - \param poll_update_basis Poll update basis -- \b IN. - \param mesh_coarsening_exponent Mesh coarsening exponent -- \b IN. - \param mesh_refining_exponent Mesh refining exponent -- \b IN. - \param initial_mesh_index Initial mesh index -- \b IN. - \param limit_mesh_index Limit mesh index -- \b IN. - \param lb Lower bounds -- \b IN. - \param ub Upper bounds -- \b IN. - \param scaling Scaling -- \b IN. - \param fixed_variables Fixed variables -- \b IN. - \param periodic_variables Periodic variables -- \b IN. - \param var_groups Groups of variables -- \b IN. - \param out Display -- \b IN. - */ - Signature ( int n , - const std::vector<NOMAD::bb_input_type> & input_types , - const NOMAD::Point & lb , - const NOMAD::Point & ub , - const NOMAD::mesh_type & mesh_type , - bool anisotropic_mesh , - const NOMAD::Point & granularity , - const NOMAD::Point & initial_poll_size , - const NOMAD::Point & min_poll_size , - const NOMAD::Point & min_mesh_size , - NOMAD::Double & mesh_update_basis , - NOMAD::Double & poll_update_basis , - int & mesh_coarsening_exponent, - int & mesh_refining_exponent, - int initial_mesh_index, - int limit_mesh_index , - const NOMAD::Point & scaling , - const NOMAD::Point & fixed_variables , - const std::vector<bool> & periodic_variables, - std::set<NOMAD::Variable_Group*,NOMAD::VG_Comp> & var_groups , - const NOMAD::Display & out=NOMAD::Display() ); + \param n Number of variables -- \b IN. + \param input_types Types of the variables -- \b IN. + \param mesh_type Type of mesh (SMesh,XMesh,GMesh)-- \b IN. + \param anisotropic_mesh Anisotropy of mesh (XMesh) -- \b IN. + \param granularity Gramularity of variables -- \b IN. + \param initial_poll_size Initial poll size -- \b IN. + \param min_poll_size Minimum poll size -- \b IN. + \param min_mesh_size Minimim mesh size -- \b IN. + \param mesh_update_basis Mesh update basis -- \b IN. + \param poll_update_basis Poll update basis -- \b IN. + \param mesh_coarsening_exponent Mesh coarsening exponent -- \b IN. + \param mesh_refining_exponent Mesh refining exponent -- \b IN. + \param initial_mesh_index Initial mesh index -- \b IN. + \param lb Lower bounds -- \b IN. + \param ub Upper bounds -- \b IN. + \param scaling Scaling -- \b IN. + \param fixed_variables Fixed variables -- \b IN. + \param periodic_variables Periodic variables -- \b IN. + \param var_groups Groups of variables -- \b IN. + \param out Display -- \b IN. + */ + Signature ( int n , + const std::vector<NOMAD::bb_input_type> & input_types , + const NOMAD::Point & lb , + const NOMAD::Point & ub , + const NOMAD::mesh_type & mesh_type , + bool anisotropic_mesh , + const NOMAD::Point & granularity , + const NOMAD::Point & initial_poll_size , + const NOMAD::Point & min_poll_size , + const NOMAD::Point & min_mesh_size , + NOMAD::Double & mesh_update_basis , + NOMAD::Double & poll_update_basis , + int & mesh_coarsening_exponent, + int & mesh_refining_exponent, + int initial_mesh_index , + const NOMAD::Point & scaling , + const NOMAD::Point & fixed_variables , + const std::vector<bool> & periodic_variables, + std::set<NOMAD::Variable_Group*,NOMAD::VG_Comp> & var_groups , + const NOMAD::Display & out=NOMAD::Display() ); /// Constructor #2. /** @@ -230,9 +230,9 @@ namespace NOMAD { \param sec_poll_dir_types Types of directions for secondary poll -- \b IN. \param out Display -- \b IN. */ - Signature ( int n , + Signature ( int n , const std::vector<NOMAD::bb_input_type> & input_types , - const NOMAD::Point & initial_poll_size , + const NOMAD::Point & initial_poll_size , const NOMAD::Point & lb , const NOMAD::Point & ub , const std::set<NOMAD::direction_type> & direction_types , @@ -256,8 +256,8 @@ namespace NOMAD { \param ub Upper bounds -- \b IN. \param scaling Scaling -- \b IN. \param fixed_variables Fixed variables -- \b IN. - \param granularity Gramularity of var -- \b IN. \param periodic_variables Periodic variables -- \b IN. + \param granularity Granularity -- \b IN. \param var_groups Groups of variables -- \b IN. */ void reset ( int n , @@ -268,7 +268,7 @@ namespace NOMAD { const NOMAD::Point & fixed_variables , const NOMAD::Point & granularity , const std::vector<bool> & periodic_variables , - std::set<NOMAD::Variable_Group*,NOMAD::VG_Comp> & var_groups ); + std::set<NOMAD::Variable_Group*,NOMAD::VG_Comp> & var_groups ); /// Define a signature to be standard. void set_std ( void ) { _std = true; } @@ -348,7 +348,6 @@ namespace NOMAD { */ const NOMAD::Point & get_granularity ( void ) const { return _granularity; } - /// Access to the mesh. /** \return The orthogonal mesh. @@ -358,8 +357,8 @@ namespace NOMAD { /// Update the Mesh (poll and mesh sizes). /** - \param success Type of success of the iteration -- \b IN. - \param dir Direction of the iteration (optional) -- \b IN. + \param success Type of success of the iteration -- \b IN. + \param dir Direction of the iteration (optional) -- \b IN. */ void update_mesh ( NOMAD::success_type success, const NOMAD::Direction * dir=NULL ) { @@ -399,7 +398,7 @@ namespace NOMAD { */ int get_nb_fixed_variables ( void ) const; - + /// Access to the maximum number points in the poll set. /** \return The maximum number of points in the poll set. @@ -468,6 +467,7 @@ namespace NOMAD { { return _input_types; } + /// Access to the groups of variables. /** @@ -497,9 +497,9 @@ namespace NOMAD { \param poll Type of poll (primary or secondary) -- \b IN. \param poll_center Poll center -- \b IN. */ - void get_directions ( std::list<NOMAD::Direction> & dirs , - NOMAD::poll_type poll , - const NOMAD::Point & poll_center ); + void get_directions ( std::list<NOMAD::Direction> & dirs , + NOMAD::poll_type poll , + const NOMAD::Point & poll_center ); /// Access to a direction for a random variable group. @@ -508,8 +508,8 @@ namespace NOMAD { \param dir The direction -- \b OUT. \param poll_center Poll center -- \b IN. */ - void get_variable_group_direction ( NOMAD::Direction & dir , - const NOMAD::Point & poll_center ); + void get_variable_group_direction ( NOMAD::Direction & dir , + const NOMAD::Point & poll_center ); /// Access to one direction for a given mesh. /** @@ -517,8 +517,8 @@ namespace NOMAD { \param dir The direction -- \b OUT. \param mesh_index Mesh index ell -- \b IN. */ - void get_one_direction ( NOMAD::Direction & dir , - int mesh_index ) ; + void get_one_direction ( NOMAD::Direction & dir , + int mesh_index ) ; /// Comparison operator \c < . diff --git a/src/Signature_Element.hpp b/src/Signature_Element.hpp index c6e1a037b10cd9d07dd018b89ece732469daa47c..1d14b2638bf617f4b21286178971a3fa9f057553 100644 --- a/src/Signature_Element.hpp +++ b/src/Signature_Element.hpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Signature_Element.hpp \brief Signature inside a set (headers) diff --git a/src/Single_Obj_Quad_Model_Evaluator.hpp b/src/Single_Obj_Quad_Model_Evaluator.hpp index af4d42934643450e743abae9fd14a021468c10d7..162f059ee2b4396760da64cb06fee1a105729cc7 100644 --- a/src/Single_Obj_Quad_Model_Evaluator.hpp +++ b/src/Single_Obj_Quad_Model_Evaluator.hpp @@ -1,43 +1,51 @@ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* Copyright (C) 2001-2015 Mark Abramson - Brigham Young University, Provo */ -/* Charles Audet - Ecole Polytechnique, Montreal */ -/* Gilles Couture - Ecole Polytechnique, Montreal */ -/* John Dennis - Rice University, Houston */ -/* Sebastien Le Digabel - Ecole Polytechnique, Montreal */ -/* Christophe Tribes - Ecole Polytechnique, Montreal */ -/* */ -/* funded in part by AFOSR and Exxon Mobil */ -/* */ -/* Author: Sebastien Le Digabel */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ /** \file Single_Obj_Quad_Model_Evaluator.hpp \brief NOMAD::Evaluator subclass for quadratic model optimization (headers) - \author Christophe Tribes + \author Christophe Tribes \date 2014-06-19 \see Single_Obj_Quad_Model_Evaluator.cpp */ @@ -48,37 +56,37 @@ #include "Evaluator.hpp" namespace NOMAD { - - /// Single objective NOMAD::Evaluator subclass for quadratic model. - class Single_Obj_Quad_Model_Evaluator : public NOMAD::Quad_Model_Evaluator, public NOMAD::Evaluator { - - public: - - /// Constructor. - /** - \param p Parameters -- \b IN. - \param model Model -- \b IN. - */ - Single_Obj_Quad_Model_Evaluator ( const NOMAD::Parameters & p , - const NOMAD::Quad_Model & model ) : NOMAD::Quad_Model_Evaluator(p,model),NOMAD::Evaluator(p){_is_model_evaluator=true;} - - /// Destructor. - virtual ~Single_Obj_Quad_Model_Evaluator ( void ){;} - - - /// Evaluate the blackboxes quad model at a given trial point - /** - \param x point to evaluate -- \b IN/OUT. - \param h_max h_max for barrier -- \b IN. - \param count_eval Count eval if true -- \b IN. - */ - virtual bool eval_x ( NOMAD::Eval_Point & x , - const NOMAD::Double & h_max , - bool & count_eval ) const {return Quad_Model_Evaluator::eval_x(x,h_max,count_eval);} - - - - }; + + /// Single objective NOMAD::Evaluator subclass for quadratic model. + class Single_Obj_Quad_Model_Evaluator : public NOMAD::Quad_Model_Evaluator, public NOMAD::Evaluator { + + public: + + /// Constructor. + /** + \param p Parameters -- \b IN. + \param model Model -- \b IN. + */ + Single_Obj_Quad_Model_Evaluator ( const NOMAD::Parameters & p , + const NOMAD::Quad_Model & model ) : NOMAD::Quad_Model_Evaluator(p,model),NOMAD::Evaluator(p){_is_model_evaluator=true;} + + /// Destructor. + virtual ~Single_Obj_Quad_Model_Evaluator ( void ){;} + + + /// Evaluate the blackboxes quad model at a given trial point + /** + \param x point to evaluate -- \b IN/OUT. + \param h_max h_max for barrier -- \b IN. + \param count_eval Count eval if true -- \b IN. + */ + virtual bool eval_x ( NOMAD::Eval_Point & x , + const NOMAD::Double & h_max , + bool & count_eval ) const {return Quad_Model_Evaluator::eval_x(x,h_max,count_eval);} + + + + }; } #endif diff --git a/src/Slave.cpp b/src/Slave.cpp index b9c279926100edc6b669a7ad8688cb9a0fb37f3b..01c7700186b7bd0770dac8a1234be798e9da3c7f 100644 --- a/src/Slave.cpp +++ b/src/Slave.cpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Slave.cpp \brief Slave process (implementation) @@ -322,6 +324,7 @@ void NOMAD::Slave::stop_slaves ( const NOMAD::Display & out ) NOMAD::Slave::receive_data ( &signal , 1 , MPI_CHAR , source , req[source] ); if ( display_degree == NOMAD::FULL_DISPLAY ) out << "." << std::endl; + } // 2. test requests (with a maximal delay of MAX_REQ_WAIT): diff --git a/src/Slave.hpp b/src/Slave.hpp index 62a9d6dfe66e68f21c35558891926053cce6137b..f0f8e81b036e401c30d9bdc49a4eb8e1cc05a242 100644 --- a/src/Slave.hpp +++ b/src/Slave.hpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Slave.hpp \brief Slave process (headers) diff --git a/src/Speculative_Search.cpp b/src/Speculative_Search.cpp index bf9a6f82ee627e313cbe408823dce10818577ead..3918acbf3110ddce00bd5db531754e18f5fd2448 100644 --- a/src/Speculative_Search.cpp +++ b/src/Speculative_Search.cpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Speculative_Search.cpp \brief Speculative search (implementation) @@ -49,6 +51,10 @@ */ #include "Speculative_Search.hpp" +#include "XMesh.hpp" +#include "GMesh.hpp" +#include "SMesh.hpp" + /*-------------------------------------------------------------*/ /* MADS speculative search */ /*-------------------------------------------------------------*/ @@ -131,7 +137,7 @@ void NOMAD::Speculative_Search::search ( NOMAD::Mads & mads if ( factor[k] == 1 ) { // factor determined based on mesh type ( default is 4 = mesh_update_basis = 2* poll_update_basis ) - if ( dynamic_cast<NOMAD::XMesh *> (signature->get_mesh()) ) + if ( dynamic_cast<NOMAD::XMesh *> (signature->get_mesh()) || dynamic_cast<NOMAD::GMesh *> (signature->get_mesh()) ) factor[k] = signature->get_mesh()->get_update_basis()*2.0; else factor[k] = signature->get_mesh()->get_update_basis(); @@ -152,7 +158,7 @@ void NOMAD::Speculative_Search::search ( NOMAD::Mads & mads factor[k]=0; } - + NOMAD::Point mesh_indices_k( x[i]->get_signature()->get_mesh()->get_mesh_indices() ); signature->get_mesh()->update( NOMAD::FULL_SUCCESS, mesh_indices_k , dir ); diff --git a/src/Speculative_Search.hpp b/src/Speculative_Search.hpp index af9946e5b04a3f7b74e4bbd49d661871e50ff344..947c96d39e1d7ccdf3fab88ed87f1a348f27532b 100644 --- a/src/Speculative_Search.hpp +++ b/src/Speculative_Search.hpp @@ -1,52 +1,54 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** - \file Speculative_Search.hpp - \brief Speculative search (headers) - \author Sebastien Le Digabel - \date 2010-04-12 - \see Speculative.cpp - */ + \file Speculative_Search.hpp + \brief Speculative search (headers) + \author Sebastien Le Digabel + \date 2010-04-12 + \see Speculative.cpp +*/ #ifndef __SPECULATIVE_SEARCH__ #define __SPECULATIVE_SEARCH__ @@ -54,57 +56,57 @@ #include "Mads.hpp" namespace NOMAD { - - /// Speculative search. - /** + + /// Speculative search. + /** The speculative search consists in looking further away along the successful direction after an improvement. - */ - class Speculative_Search : public NOMAD::Search , private NOMAD::Uncopyable { - - public: - - /// Constructor. - /** - \param p Parameters -- \b IN. - */ - Speculative_Search ( NOMAD::Parameters & p ) - : NOMAD::Search ( p , NOMAD::SPEC_SEARCH ) {} - - /// Destructor. - virtual ~Speculative_Search ( void ) {} - - /// The speculative search. - /** - - x_k = x_{k-1} + Delta^m_{k-1} d \n + */ + class Speculative_Search : public NOMAD::Search , private NOMAD::Uncopyable { + + public: + + /// Constructor. + /** + \param p Parameters -- \b IN. + */ + Speculative_Search ( NOMAD::Parameters & p ) + : NOMAD::Search ( p , NOMAD::SPEC_SEARCH ) {} + + /// Destructor. + virtual ~Speculative_Search ( void ) {} + + /// The speculative search. + /** + - x_k = x_{k-1} + Delta^m_{k-1} d \n s_k = x_{k-1} + Delta^m_{k-1} d if ell_{k-1} > 0 \n - or tau * Delta^m_{k-1} d otherwise. - - The directions that we use already contain Delta^m: + or tau * Delta^m_{k-1} d otherwise. + - The directions that we use already contain Delta^m: direction = Delta^m_{k-1} d - - The following test + - The following test \code - if ( new_feas_inc || new_infeas_inc ) + if ( new_feas_inc || new_infeas_inc ) \endcode - is equal to \c true and has already been made in \c Mads.cpp. - - \param mads NOMAD::Mads object invoking this search -- \b IN/OUT. - \param nb_search_pts Number of generated search points -- \b OUT. - \param stop Stop flag -- \b IN/OUT. - \param stop_reason Stop reason -- \b OUT. - \param success Type of success -- \b OUT. - \param count_search Count or not the search -- \b OUT. - \param new_feas_inc New feasible incumbent -- \b IN/OUT. - \param new_infeas_inc New infeasible incumbent -- \b IN/OUT. - */ - virtual void search ( NOMAD::Mads & mads , - int & nb_search_pts , - bool & stop , - NOMAD::stop_type & stop_reason , - NOMAD::success_type & success , - bool & count_search , - const NOMAD::Eval_Point *& new_feas_inc , - const NOMAD::Eval_Point *& new_infeas_inc ); - }; + is equal to \c true and has already been made in \c Mads.cpp. + + \param mads NOMAD::Mads object invoking this search -- \b IN/OUT. + \param nb_search_pts Number of generated search points -- \b OUT. + \param stop Stop flag -- \b IN/OUT. + \param stop_reason Stop reason -- \b OUT. + \param success Type of success -- \b OUT. + \param count_search Count or not the search -- \b OUT. + \param new_feas_inc New feasible incumbent -- \b IN/OUT. + \param new_infeas_inc New infeasible incumbent -- \b IN/OUT. + */ + virtual void search ( NOMAD::Mads & mads , + int & nb_search_pts , + bool & stop , + NOMAD::stop_type & stop_reason , + NOMAD::success_type & success , + bool & count_search , + const NOMAD::Eval_Point *& new_feas_inc , + const NOMAD::Eval_Point *& new_infeas_inc ); + }; } #endif diff --git a/src/Stats.cpp b/src/Stats.cpp index 198437691fd0026b672afbe1969ec1f6b5db7659..8df60102c05ccfd22d7de2ad0a0b8abd6e57a9e8 100644 --- a/src/Stats.cpp +++ b/src/Stats.cpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Stats.cpp \brief Algorithm stats (implementation) @@ -374,3 +376,5 @@ void NOMAD::Stats::display ( const NOMAD::Display & out ) const if ( _stat_avg.is_defined() ) out << "stat avg : " << get_stat_avg() << std::endl; } + + diff --git a/src/Stats.hpp b/src/Stats.hpp index f26323d08bfb80aeaa956045680429d7b3a0cd3a..651541f1187c4dc40e552b2e37222d1b02d99212 100644 --- a/src/Stats.hpp +++ b/src/Stats.hpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Stats.hpp \brief Algorithm stats (headers) @@ -76,7 +78,7 @@ namespace NOMAD { int _sgte_eval; ///< Number of surrogate evaluations. int _sgte_cost; ///< Surrogate cost. int _bb_eval; ///< Number of blackbox evaluations. - int _block_eval; ///< Number of block of evaluations. + int _block_eval; ///< Number of block of evaluations. int _failed_eval; ///< Number of failed evaluations. int _cache_hits; ///< Number of cache hits. int _interrupted_eval; ///< Number of interrupted sequence of evaluations. @@ -137,7 +139,7 @@ namespace NOMAD { int _usr_srch_success; ///< Number of user search successes. // Dynamic management of poll directions - int _nb_success_dyn_dir; ///< Number of successfull polling in the direction added dynamically + int _nb_success_dyn_dir; ///< Number of successfull polling in the direction added dynamically public: @@ -158,7 +160,7 @@ namespace NOMAD { _sgte_eval ( s._sgte_eval ) , _sgte_cost ( s._sgte_cost ) , _bb_eval ( s._bb_eval ) , - _block_eval ( s._block_eval ) , + _block_eval ( s._block_eval ) , _failed_eval ( s._failed_eval ) , _cache_hits ( s._cache_hits ) , _interrupted_eval ( s._interrupted_eval ) , @@ -472,6 +474,12 @@ namespace NOMAD { */ int get_VNS_bb_eval ( void ) const { return _VNS_bb_eval; } + /// Access to the stat \c _nb_VNS_SEARCHES. + /** + \return The stat \c _nb_VNS_SEARCHES. + */ + int get_nb_VNS_SEARCHES ( void ) const { return _nb_VNS_searches; } + /// Access to the stat \c _VNS_sgte_eval. /** \return The stat \c _VNS_sgte_eval. @@ -507,7 +515,10 @@ namespace NOMAD { /** \return The \c sum stat. */ - NOMAD::Double get_stat_sum ( void ) const { return _stat_sum; } + NOMAD::Double get_stat_sum ( void ) const + { + return _stat_sum; + } /// Access to the \c avg stat. /** @@ -518,6 +529,15 @@ namespace NOMAD { return ( _cnt_avg > 0 ) ? _stat_avg/_cnt_avg : NOMAD::Double(); } + /// Access to the stat \c _nb_ext_polls. + /** + \return The stat \c _nb_ext_polls. + */ + int get_nb_ext_poll ( void ) const + { + return _nb_ext_polls; + } + /// Access to the model stats. /** \return The model stats. diff --git a/src/Uncopyable.hpp b/src/Uncopyable.hpp index 5b2dc8639b57ca88d7eb0ecf3c488519e5e6ab77..0dcb56e21f30cc923e974b69a74f0abe159fb08c 100644 --- a/src/Uncopyable.hpp +++ b/src/Uncopyable.hpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Uncopyable.hpp \brief Base class for uncopyable classes (headers) diff --git a/src/VNS_Search.cpp b/src/VNS_Search.cpp index 647dd6c4d1b7badaa8050f2cbcdd3ff59106da9d..c84b2763369389f391b568f26b721ed03887d6fa 100644 --- a/src/VNS_Search.cpp +++ b/src/VNS_Search.cpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file VNS_Search.cpp \brief VNS search (implementation) @@ -136,7 +138,7 @@ void NOMAD::VNS_Search::search ( NOMAD::Mads & mads , out.close_block ( "end of VNS search (no signature)" ); return; } - + int n = signature->get_n(); if ( n != x->size() ) { @@ -150,11 +152,10 @@ void NOMAD::VNS_Search::search ( NOMAD::Mads & mads , signature->get_one_direction ( dir , _k - 1); + // shaking: construct x': NOMAD::Point xp(n); for (int i = 0 ; i < n ; ++i ) xp[i] = ( (_p.get_bb_input_type())[i]==NOMAD::BINARY && dir[i]==1.0 && (*x)[i]==1.0 ) ? 0.0 : xp[i] = (*x)[i] + dir[i]; - - // shaking: the perturbation is tried twice with dir and -dir // (in case x == x + dir after snapping) @@ -192,8 +193,6 @@ void NOMAD::VNS_Search::search ( NOMAD::Mads & mads , const NOMAD::Point old_delta_min = signature->get_mesh()->get_min_mesh_size(); // Current min poll size const NOMAD::Point old_Delta_min = signature->get_mesh()->get_min_poll_size(); - - // stats: NOMAD::Stats & stats = mads.get_stats(); @@ -209,17 +208,17 @@ void NOMAD::VNS_Search::search ( NOMAD::Mads & mads , if ( display_degree == NOMAD::FULL_DISPLAY ) { out << " it = " << mads_iterations << std::endl - << " bbe = " << bbe << std::endl - << " blk_eva = " << blk_eva << std::endl; + << " bbe = " << bbe << std::endl + << " blk_eva = " << blk_eva << std::endl; if ( has_sgte ) out << " sgte_eval = " << sgte_eval << std::endl; out << "mesh_indices = ( " << old_mesh_indices << " ) " << std::endl - << " k = " << _k << std::endl - << " kmax = " << _k_max << std::endl - << " x = ( "; + << " k = " << _k << std::endl + << " kmax = " << _k_max << std::endl + << " x = ( "; x->Point::display ( out , " " , 5 , _p.get_point_display_limit() ); out << " ) f=" << x->get_f() << " h=" << x->get_h() << std::endl - << " dir = ( "; + << " dir = ( "; dir.Point::display ( out , " " , 5 , _p.get_point_display_limit() ); out << " ) |dir|="; NOMAD::Double norm = dir.norm(); @@ -228,7 +227,7 @@ void NOMAD::VNS_Search::search ( NOMAD::Mads & mads , xp.display ( out , " " , 5 , _p.get_point_display_limit() ); out << " )" << std::endl << std::endl; out << "bb_eval (before+VNS only) objective_value" - << std::endl << std::endl; + << std::endl << std::endl; } // save parameters that are going to be modified: @@ -236,6 +235,7 @@ void NOMAD::VNS_Search::search ( NOMAD::Mads & mads , std::string old_display_degree; _p.out().get_display_degree ( old_display_degree ); + NOMAD::model_params_type old_mp; _p.get_model_parameters ( old_mp ); @@ -281,7 +281,7 @@ void NOMAD::VNS_Search::search ( NOMAD::Mads & mads , _p.set_DISPLAY_DEGREE ( NOMAD::NORMAL_DISPLAY ); else if ( _p.get_display_degree() == NOMAD::NORMAL_DISPLAY ) _p.set_DISPLAY_DEGREE ( NOMAD::MINIMAL_DISPLAY ); - + // modify parameters: // ------------------ @@ -305,17 +305,42 @@ void NOMAD::VNS_Search::search ( NOMAD::Mads & mads , _p.set_USER_CALLS_ENABLED ( false ); _p.set_EXTENDED_POLL_ENABLED ( false ); + + std::string s_bbe = NOMAD::itos(bbe) + "+"; + std::string s_blk = NOMAD::itos(blk_eva) + "+"; + std::string s_sgte = NOMAD::itos(sgte_eval) + "+"; // DISPLAY_STATS: { + std::list<std::string> ds = old_ds; + std::list<std::string>::iterator it = ds.begin(); + std::list<std::string>::const_iterator end = ds.end(); + if ( has_sgte ) - _p.set_DISPLAY_STATS ( NOMAD::itos(sgte_eval) + "+SGTE OBJ (VNS--surrogate)" ); + { + while ( it != ds.end() ) + { + if ( *it == "BBE" ) + { + it = ds.erase ( it ); + ds.insert ( it , NOMAD::itos(bbe) ); + } + if ( *it == "BLK_EVA" ) + { + it = ds.erase ( it ); + ds.insert ( it , NOMAD::itos(blk_eva) ); + } + if ( *it == "SGTE" ) + ds.insert ( it , s_sgte ); + + ++it; + } + ds.push_back(" "); + ds.push_back ( "(VNS#" + NOMAD::itos(stats.get_nb_VNS_SEARCHES()) + "--surrogate_evals)" ); + _p.set_DISPLAY_STATS ( ds ); + } else { - std::list<std::string> ds = old_ds; - std::list<std::string>::iterator it = ds.begin(); - std::list<std::string>::const_iterator end = ds.end(); - std::string s_bbe = NOMAD::itos(bbe) + "+"; - std::string s_blk = NOMAD::itos(blk_eva) + "+"; + while ( it != end ) { if ( *it == "BBE" ) @@ -324,7 +349,8 @@ void NOMAD::VNS_Search::search ( NOMAD::Mads & mads , ds.insert ( it , s_blk ); ++it; } - ds.push_back ( " (VNS)" ); + ds.push_back(" "); + ds.push_back ( "(VNS#" + NOMAD::itos(stats.get_nb_VNS_SEARCHES()) + ")" ); _p.set_DISPLAY_STATS ( ds ); } } @@ -334,18 +360,44 @@ void NOMAD::VNS_Search::search ( NOMAD::Mads & mads , std::list<std::string> sf = old_stats_file; std::list<std::string>::iterator it = sf.begin(); std::list<std::string>::const_iterator end = sf.end(); - std::string s_bbe = NOMAD::itos(bbe) + "+"; - std::string s_blk = NOMAD::itos(blk_eva) + "+"; - while ( it != end ) + if ( has_sgte ) { - if ( *it == "BBE" ) - sf.insert ( it , s_bbe ); - if ( *it == "BLK_EVA" ) - sf.insert ( it , s_blk ); - ++it; + while ( it != sf.end() ) + { + if ( *it == "BBE" ) + { + it = sf.erase ( it ); + sf.insert ( it , NOMAD::itos(bbe) ); + } + if ( *it == "BLK_EVA" ) + { + it = sf.erase ( it ); + sf.insert ( it , NOMAD::itos(blk_eva) ); + } + if ( *it == "SGTE" ) + sf.insert ( it , s_sgte ); + + ++it; + } + sf.push_back(" "); + sf.push_back ( "(VNS#" + NOMAD::itos(stats.get_nb_VNS_SEARCHES()) + "--surrogate_evals)" ); + _p.set_STATS_FILE ( old_stats_file_name , sf ); + } + else + { + + while ( it != end ) + { + if ( *it == "BBE" ) + sf.insert ( it , s_bbe ); + if ( *it == "BLK_EVA" ) + sf.insert ( it , s_blk ); + ++it; + } + sf.push_back(" "); + sf.push_back ( "(VNS#" + NOMAD::itos(stats.get_nb_VNS_SEARCHES()) + ")" ); + _p.set_STATS_FILE ( old_stats_file_name , sf ); } - sf.push_back ( " (VNS)" ); - _p.set_STATS_FILE ( old_stats_file_name , sf ); } // X0: @@ -378,7 +430,13 @@ void NOMAD::VNS_Search::search ( NOMAD::Mads & mads , // STAT_SUM_TARGET: if ( old_sst.is_defined() ) - _p.set_STAT_SUM_TARGET ( old_sst - stats.get_stat_sum() ); + { + if ( ! stats.get_stat_sum().is_defined() ) + stats.update_stat_sum( Double(0) ); + _p.set_STAT_SUM_TARGET ( old_sst - stats.get_stat_sum() ); + + } + // MAX_TIME: if ( old_max_time > 0 ) @@ -411,7 +469,7 @@ void NOMAD::VNS_Search::search ( NOMAD::Mads & mads , // Modified dimension after extern signature is set int modified_dimension = _p.get_dimension(); - + // Evaluator_Control: NOMAD::Evaluator_Control & ev_control = mads.get_evaluator_control(); @@ -518,7 +576,7 @@ void NOMAD::VNS_Search::search ( NOMAD::Mads & mads , // Needed because mesh reinitialized during p.check() signature->get_mesh()->set_min_mesh_sizes( old_delta_min ); - signature->get_mesh()->set_min_poll_sizes( old_Delta_min ); + signature->get_mesh()->set_min_poll_sizes( old_Delta_min ); signature->get_mesh()->set_mesh_indices( old_mesh_indices ); // surrogate evaluations: perform only one true evaluation: @@ -605,7 +663,7 @@ void NOMAD::VNS_Search::search ( NOMAD::Mads & mads , } // true evaluations (or surrogate evaluations if opt_only_sgte==true): - else + else { // for the update of new_feas_inc and new_infeas_inc (1/2): @@ -650,7 +708,7 @@ void NOMAD::VNS_Search::search ( NOMAD::Mads & mads , nb_search_pts = VNS_mads.get_stats().get_sgte_eval(); success = sgte_succ; } - else + else { nb_search_pts = VNS_mads.get_stats().get_eval(); success = true_succ; @@ -665,7 +723,7 @@ void NOMAD::VNS_Search::search ( NOMAD::Mads & mads , if ( new_feas_inc && display_degree > NOMAD::NO_DISPLAY && display_degree < NOMAD::FULL_DISPLAY ) { std::list<std::string> ds = old_ds; - ds.push_back ( " (VNS)" ); + ds.push_back ( " (VNS#" + NOMAD::itos(stats.get_nb_VNS_SEARCHES()) + ")" ); ev_control.display_stats(false, out, ds , new_feas_inc , true , NULL ); } } diff --git a/src/VNS_Search.hpp b/src/VNS_Search.hpp index e966c3f27628f1b635039b721ce37800824003e4..bc4f2e3a221471ddd70b34968d5022e8177e4447 100644 --- a/src/VNS_Search.hpp +++ b/src/VNS_Search.hpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file VNS_Search.hpp \brief VNS search (headers) diff --git a/src/Variable_Group.cpp b/src/Variable_Group.cpp index 6c198f1900d198532ce645e07641d09a80f62ad1..37fad3772e9b05322355e8726ed7284b2fe9ea43 100644 --- a/src/Variable_Group.cpp +++ b/src/Variable_Group.cpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Variable_Group.cpp \brief Group of variables (implementation) @@ -147,13 +149,13 @@ bool NOMAD::Variable_Group::check( const NOMAD::Point & fix /*---------------------------------------------------------*/ /* compute the directions */ /*---------------------------------------------------------*/ -void NOMAD::Variable_Group::get_directions ( std::list<NOMAD::Direction> & dirs , - NOMAD::poll_type poll , - const NOMAD::OrthogonalMesh & mesh ) +void NOMAD::Variable_Group::get_directions ( std::list<NOMAD::Direction> & dirs , + NOMAD::poll_type poll , + const NOMAD::OrthogonalMesh & mesh ) { // vectors are of size nc : // ------------------------ - _directions->compute ( dirs , + _directions->compute ( dirs , poll , mesh ); return; diff --git a/src/Variable_Group.hpp b/src/Variable_Group.hpp index beee30517ce4d2a04b8bcb6b4d378e10ffc9dba9..a2d857e939ac2d09689d6effa57ffe18d565dfb6 100644 --- a/src/Variable_Group.hpp +++ b/src/Variable_Group.hpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file Variable_Group.hpp \brief Group of variables (headers) @@ -125,7 +127,7 @@ namespace NOMAD { bool check ( const NOMAD::Point & fixed_vars , const std::vector<NOMAD::bb_input_type> & bbit , std::vector<bool> * in_group , - bool & mod ); + bool & mod ); /// Check if the directions are Ortho-MADS directions. /** @@ -160,13 +162,13 @@ namespace NOMAD { /// Access to the directions. /** - \param dirs List of directions -- \b OUT. - \param poll Type of poll (primary or secondary) -- \b IN. - \param mesh Mesh -- \b IN. + \param dirs List of directions -- \b OUT. + \param poll Type of poll (primary or secondary) -- \b IN. + \param mesh Mesh -- \b IN. */ - void get_directions ( std::list<NOMAD::Direction> & dirs , - NOMAD::poll_type poll , - const NOMAD::OrthogonalMesh & mesh ); + void get_directions ( std::list<NOMAD::Direction> & dirs , + NOMAD::poll_type poll , + const NOMAD::OrthogonalMesh & mesh ); /// Access to one direction for a given mesh. diff --git a/src/XMesh.cpp b/src/XMesh.cpp index f19078df3e5870d121207d9ced8b93b8137b9ef0..fffb25f1cc0f19f3170e152c81448743e43e3e6b 100644 --- a/src/XMesh.cpp +++ b/src/XMesh.cpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file XMesh.cpp \brief Class for the MADS xmesh (implementation) @@ -52,7 +54,7 @@ /*-----------------------------------------------------------*/ -/* init the XMesh */ +/* init the XMesh */ /*-----------------------------------------------------------*/ void NOMAD::XMesh::init ( ) { @@ -75,7 +77,6 @@ void NOMAD::XMesh::init ( ) _r[k]=0; _r_max[k]=0; _r_min[k]=0; - } @@ -119,7 +120,7 @@ void NOMAD::XMesh::update ( NOMAD::success_type success , /*-----------------------------------------------------------*/ /* update the XMesh */ /*-----------------------------------------------------------*/ -void NOMAD::XMesh::update ( NOMAD::success_type success , const NOMAD::Direction * dir) // , const NOMAD::OrthogonalMesh *mesh ) +void NOMAD::XMesh::update ( NOMAD::success_type success , const NOMAD::Direction * dir) { // defaults: // full success: r^k_j = r^k_j + 1 if (dir_k != 0 and anistropic_mesh) and r^k_j remains the same if dir_k=0 @@ -199,8 +200,8 @@ void NOMAD::XMesh::update ( NOMAD::success_type success , const NOMAD::Direction /*-----------------------------------------------------------*/ void NOMAD::XMesh::display ( const NOMAD::Display & out ) const { - out << "n : " << _n << std::endl - << "tau : " << _update_basis << std::endl + out << "n : " << _n << std::endl + << "tau : " << _update_basis << std::endl << "poll coarsening exponent: " << _coarsening_step << std::endl << "poll refining exponent : " << _refining_step << std::endl; out << "minimal mesh size : "; @@ -327,12 +328,12 @@ bool NOMAD::XMesh::get_delta ( NOMAD::Point & delta ) const delta.resize(_n); bool delta_min_is_defined=_delta_min.is_defined(); - bool stop = true; // delta^k = power_of_beta * delta^0: for ( int i = 0 ; i < _n ; ++i ) { + delta[i] = get_delta( i ); if ( stop && delta_min_is_defined && _delta_min[i].is_defined() && delta[i] >= _delta_min[i] ) @@ -390,9 +391,8 @@ bool NOMAD::XMesh::get_Delta ( NOMAD::Point & Delta ) const NOMAD::Double NOMAD::XMesh::get_Delta ( int i ) const { NOMAD::Double Delta = _Delta_0[i] * pow( _update_basis.value() , _r[i].value() ); - - return Delta; + return Delta; } @@ -433,7 +433,6 @@ void NOMAD::XMesh::set_mesh_indices ( const NOMAD::Point & r ) /*-----------------------------------------------------------*/ void NOMAD::XMesh::set_limit_mesh_index ( int l ) { - _limit_mesh_index=l; } @@ -445,7 +444,6 @@ void NOMAD::XMesh::set_limit_mesh_index ( int l ) /*-----------------------------------------------------------*/ NOMAD::Double NOMAD::XMesh::scale_and_project(int i, const NOMAD::Double & l, bool round_up) const { - NOMAD::Double delta = get_delta( i ); NOMAD::Double Delta = get_Delta( i ); diff --git a/src/XMesh.hpp b/src/XMesh.hpp index f3450fe40fc920c019db1e607484ba807a954d4f..044adb927f7f3724ebf032dbc1f6e3572cda1d3e 100644 --- a/src/XMesh.hpp +++ b/src/XMesh.hpp @@ -1,38 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* Copyright (C) 2001-2015 Mark Abramson - Brigham Young University, Provo */ -/* Charles Audet - Ecole Polytechnique, Montreal */ -/* Gilles Couture - Ecole Polytechnique, Montreal */ -/* John Dennis - Rice University, Houston */ -/* Sebastien Le Digabel - Ecole Polytechnique, Montreal */ -/* Christophe Tribes - Ecole Polytechnique, Montreal */ -/* */ -/* funded in part by AFOSR and Exxon Mobil */ -/* */ -/* Author: Christophe Tribes */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file XMesh.hpp \brief Class for the xmesh (extensible mesh) (headers) @@ -58,11 +67,12 @@ namespace NOMAD { /*--------------------------------------------------------------*/ private: - NOMAD::Point _r; // Mesh index per coordinate. - NOMAD::Point _r_min; - NOMAD::Point _r_max; + NOMAD::Point _r; // Mesh index per coordinate. + NOMAD::Point _r_min; + NOMAD::Point _r_max; - /*--------------------------------------------------------------*/ + + /*--------------------------------------------------------------*/ /// Private affectation operator. /** @@ -98,13 +108,13 @@ namespace NOMAD { /// Constructor. /** - \param anisotropic_mesh Use anisotropic mesh or not -- \b IN. - \param Delta_0 Initial poll size Delta^0 -- \b IN. - \param Delta_min Minimal poll size Delta^min (may be undefined) -- \b IN. - \param delta_min Minimal mesh size delta^min (may be undefined) -- \b IN. - \param poll_update_basis Poll update basis (b); default=2 -- \b IN. - \param poll_coarsening_step Poll coarsening step (w+); default=1 -- \b IN. - \param poll_refining_step Poll refining step (w-); default=-1 -- \b IN. + \param anisotropic_mesh Use anisotropic mesh or not -- \b IN. + \param Delta_0 Initial poll size Delta^0 -- \b IN. + \param Delta_min Minimal poll size Delta^min (may be undefined) -- \b IN. + \param delta_min Minimal mesh size delta^min (may be undefined) -- \b IN. + \param poll_update_basis Poll update basis (b); default=2 -- \b IN. + \param poll_coarsening_step Poll coarsening step (w+); default=1 -- \b IN. + \param poll_refining_step Poll refining step (w-); default=-1 -- \b IN. \param fixed_variables Fixed variables -- \b IN. \param limit_min_mesh_index Limit mesh index (<0) -- \b IN. */ @@ -113,9 +123,9 @@ namespace NOMAD { const NOMAD::Point & Delta_min , const NOMAD::Point & delta_min , const NOMAD::Point & fixed_variables, - NOMAD::Double poll_update_basis=2.0, - int poll_coarsening_step=1, - int poll_refining_step=-1 , + NOMAD::Double poll_update_basis=2.0, + int poll_coarsening_step=1, + int poll_refining_step=-1 , int limit_min_mesh_index=NOMAD::XL_LIMITS ) : NOMAD::OrthogonalMesh ( anisotropic_mesh, Delta_0, @@ -137,9 +147,9 @@ namespace NOMAD { */ XMesh ( const XMesh & m ) : OrthogonalMesh ( m ) , - _r ( m._r ), - _r_min ( m._r_min ), - _r_max ( m._r_max ) { init(); } + _r ( m._r ), + _r_min ( m._r_min ), + _r_max ( m._r_max ) { init(); } /// Destructor. ~XMesh ( void ) @@ -183,17 +193,17 @@ namespace NOMAD { /// Update the provided mesh indices (the Mesh is unchanged). /** - \param success Type of success of the iteration -- \b IN. - \param mesh_indices The mesh indices before and after the update -- \b IN/OUT. - \param dir The direction that is considered (opt) -- \b IN. + \param success Type of success of the iteration -- \b IN. + \param mesh_indices The mesh indices before and after the update -- \b IN/OUT. + \param dir The direction that is considered (opt) -- \b IN. */ void update ( NOMAD::success_type success , NOMAD::Point & mesh_indices, const NOMAD::Direction *dir=NULL ) const ; /// Update the XMesh (poll and mesh sizes). /** - \param success Type of success of the iteration -- \b IN. - \param dir Direction of the iteration -- \b IN. + \param success Type of success of the iteration -- \b IN. + \param dir Direction of the iteration -- \b IN. */ void update ( NOMAD::success_type success, const NOMAD::Direction * dir=NULL); @@ -216,10 +226,10 @@ namespace NOMAD { /// Scale and project the ith component of a vector on the mesh /** - \param i The vector component number -- \b IN. - \param l The vector component value -- \b IN. - \param round_up A flag to round or not -- \b IN. - \return The ith component of a vector after mesh scaling and projection + \param i The vector component number -- \b IN. + \param l The vector component value -- \b IN. + \param round_up The flag for round-up -- \b IN. + \return The ith component of a vector after mesh scaling and projection */ NOMAD::Double scale_and_project(int i, const NOMAD::Double & l , bool round_up ) const ; @@ -229,8 +239,8 @@ namespace NOMAD { \param stop Stop flag -- \b IN/OUT. \param stop_reason Stop reason -- \b OUT. */ - void check_min_mesh_sizes ( bool & stop , - NOMAD::stop_type & stop_reason ) const; + void check_min_mesh_sizes ( bool & stop , + NOMAD::stop_type & stop_reason ) const; /// Access to the mesh indices per coordinate. /** diff --git a/src/defines.hpp b/src/defines.hpp index d1078f3714c44f1535b0ad02169c949cd0509148..4fbb46730f000d911f621d5f10ddf4ebc477255d 100644 --- a/src/defines.hpp +++ b/src/defines.hpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file defines.hpp \brief Definitions @@ -105,7 +107,7 @@ // For NOMAD random number generator #if !defined(UINT32_MAX) typedef unsigned int uint32_t; -#define UINT32_MAX 0xffffffff +#define UINT32_MAX 0xffffffff #endif // to display model stats for each evaluation at @@ -123,222 +125,231 @@ typedef unsigned int uint32_t; // #define MODEL_STATS namespace NOMAD { - - /// Current version: - const std::string BASE_VERSION = "3.7.3"; - + + /// Current version: + const std::string BASE_VERSION = "3.8.1"; + #ifdef R_VERSION - const std::string VERSION = BASE_VERSION + ".R"; + const std::string VERSION = BASE_VERSION + ".R"; #else #ifdef USE_MPI - const std::string VERSION = BASE_VERSION + ".MPI"; + const std::string VERSION = BASE_VERSION + ".MPI"; #else - const std::string VERSION = BASE_VERSION; + const std::string VERSION = BASE_VERSION; #endif #endif - - // Directory separator, plus LGPL and user guide files + + // Directory separator, plus LGPL and user guide files #ifdef WINDOWS - const char DIR_SEP = '\\'; ///< Directory separator - const std::string HOME = "%NOMAD_HOME%"; ///< Home directory + const char DIR_SEP = '\\'; ///< Directory separator + const std::string HOME = "%NOMAD_HOME%"; ///< Home directory #else - const char DIR_SEP = '/'; ///< Directory separator - const std::string HOME = "$NOMAD_HOME"; ///< Home directory + const char DIR_SEP = '/'; ///< Directory separator + const std::string HOME = "$NOMAD_HOME"; ///< Home directory #endif - - /// Licence file - const std::string LGPL_FILE = HOME+DIR_SEP+"src"+DIR_SEP+"lgpl.txt"; - - /// User guide file - const std::string USER_GUIDE_FILE = HOME+DIR_SEP+"doc"+DIR_SEP+"user_guide.pdf"; - - /// Examples directory - const std::string EXAMPLES_DIR = HOME+DIR_SEP+"examples"; - - /// Tools directory - const std::string TOOLS_DIR = HOME+DIR_SEP+"tools"; - - /// Tag for valid cache files + + /// Licence file + const std::string LGPL_FILE = HOME+DIR_SEP+"src"+DIR_SEP+"lgpl.txt"; + + /// User guide file + const std::string USER_GUIDE_FILE = HOME+DIR_SEP+"doc"+DIR_SEP+"user_guide.pdf"; + + /// Examples directory + const std::string EXAMPLES_DIR = HOME+DIR_SEP+"examples"; + + /// Tools directory + const std::string TOOLS_DIR = HOME+DIR_SEP+"tools"; + + /// Tag for valid cache files #ifdef GCC_X - const int CACHE_FILE_ID = 77041301; + const int CACHE_FILE_ID = 77041301; #else #ifdef GCC_WINDOWS - const int CACHE_FILE_ID = 77041302; + const int CACHE_FILE_ID = 77041302; #else #ifdef _MSC_VER - const int CACHE_FILE_ID = 77041303; + const int CACHE_FILE_ID = 77041303; #else - const int CACHE_FILE_ID = 77041304; + const int CACHE_FILE_ID = 77041304; #endif #endif #endif - + #ifdef USE_MPI - // MPI constants - const int MAX_REQ_WAIT = 3 ; ///< Maximum time to wait for a request - const char STOP_SIGNAL = 'S'; ///< Stop signal - const char EVAL_SIGNAL = 'X'; ///< Evaluation signal - const char READY_SIGNAL = 'R'; ///< Ready signal - const char RESULT_SIGNAL = 'O'; ///< Result signal - const char WAIT_SIGNAL = 'W'; ///< Wait signal + // MPI constants + const int MAX_REQ_WAIT = 3 ; ///< Maximum time to wait for a request + const char STOP_SIGNAL = 'S'; ///< Stop signal + const char EVAL_SIGNAL = 'X'; ///< Evaluation signal + const char READY_SIGNAL = 'R'; ///< Ready signal + const char RESULT_SIGNAL = 'O'; ///< Result signal + const char WAIT_SIGNAL = 'W'; ///< Wait signal #endif - - /// Maximum number of variables. - const int MAX_DIMENSION = 1000; - - // Old static Mesh index constants - const int L_LIMITS = 50; ///< Limits for the smesh index values - const int UNDEFINED_L = L_LIMITS+1; ///< Undefined value for the smesh index + + /// Maximum number of variables. + const int MAX_DIMENSION = 1000; + + // Old static Mesh index constants + const int L_LIMITS = 50; ///< Limits for the smesh index values + const int UNDEFINED_L = L_LIMITS+1; ///< Undefined value for the smesh index // xmesh index constants const int XL_LIMITS = -50; ///< Limits for the xmesh index values - const int UNDEFINED_XL = XL_LIMITS-1; ///< Undefined value for the xmesh index + const int UNDEFINED_XL = XL_LIMITS-1; ///< Undefined value for the xmesh index - /// Default epsilon used by NOMAD::Double - /** Use Parameters::set_EPSILON(), or parameter EPSILON, - or NOMAD::Double::set_epsilon() to change it - */ - const double DEFAULT_EPSILON = 1e-13; - - /// Maximal output value for points used for models. - const double MODEL_MAX_OUTPUT = 1e10; - - /// Default infinity string used by NOMAD::Double - /** Use Parameters::set_INF_STR(), or parameter INF_STR, - or NOMAD::Double::set_inf_str() to change it - */ - const std::string DEFAULT_INF_STR = "inf"; - - /// Default undefined value string used by NOMAD::Double - /** Use Parameters::set_UNDEF_STR(), or parameter UNDEF_STR, - or NOMAD::Double::set_undef_str() to change it - */ - const std::string DEFAULT_UNDEF_STR = "NaN"; - - /// log(10) (for display widths.) - const double LOG10 = 2.30258509299; - - const double INF = std::numeric_limits<double>::max(); ///< Infinity + // gmesh index constants + const int GL_LIMITS = -50; ///< Limits for the gmesh index values + const int UNDEFINED_GL = GL_LIMITS-1; ///< Undefined value for the gmesh index + + + + /// Default epsilon used by NOMAD::Double + /** Use Parameters::set_EPSILON(), or parameter EPSILON, + or NOMAD::Double::set_epsilon() to change it + */ + const double DEFAULT_EPSILON = 1e-13; + + /// Maximal output value for points used for models. + const double MODEL_MAX_OUTPUT = 1e10; + + /// Default infinity string used by NOMAD::Double + /** Use Parameters::set_INF_STR(), or parameter INF_STR, + or NOMAD::Double::set_inf_str() to change it + */ + const std::string DEFAULT_INF_STR = "inf"; + + /// Default undefined value string used by NOMAD::Double + /** Use Parameters::set_UNDEF_STR(), or parameter UNDEF_STR, + or NOMAD::Double::set_undef_str() to change it + */ + const std::string DEFAULT_UNDEF_STR = "NaN"; + + /// log(10) (for display widths.) + const double LOG10 = 2.30258509299; + + const double NaN = std::numeric_limits<double>::quiet_NaN(); ///< Quiet Not-A-Number + const double INF = std::numeric_limits<double>::max(); ///< Infinity const double P_INF_INT = std::numeric_limits<int>::max(); ///< plus infinity for int const double M_INF_INT = std::numeric_limits<int>::min(); ///< minus infinity for int - - const double D_INT_MAX = UINT32_MAX; ///< The UINT32_MAX constant as a \c double - - // Singular Value Decomposition (SVD) constants: - const double SVD_EPS = 1e-13; ///< Epsilon for SVD - const int SVD_MAX_MPN = 1500; ///< Matrix maximal size (\c m+n ) - const double SVD_MAX_COND = NOMAD::INF; ///< Max. acceptable cond. number - - /// Default value for parameter POINT_DISPLAY_LIMIT - /** Use Parameters::set_POINT_DISPLAY_LIMIT() or parameter POINT_DISPLAY_LIMIT - or Point::set_display_limit() to change it */ - const int DEFAULT_POINT_DISPLAY_LIMIT = 20; - - // Display precisions. - const int DISPLAY_PRECISION_STD = 10; ///< Standard display precision - const int DISPLAY_PRECISION_BB = 15; ///< Display precision for blackboxes - - /// Constant for blackbox files #1. - const std::string BLACKBOX_INPUT_FILE_PREFIX = "nomad"; - - /// Constant for blackbox files #2. - const std::string BLACKBOX_INPUT_FILE_EXT = "input"; - - /// Constant for blackbox files #3. - const std::string BLACKBOX_OUTPUT_FILE_PREFIX = "nomad"; - - /// Constant for blackbox files #4. - const std::string BLACKBOX_OUTPUT_FILE_EXT = "output"; - - /// Display degree type. - enum dd_type + + const double D_INT_MAX = UINT32_MAX; ///< The UINT32_MAX constant as a \c double + + // Singular Value Decomposition (SVD) constants: + const double SVD_EPS = 1e-13; ///< Epsilon for SVD + const int SVD_MAX_MPN = 1500; ///< Matrix maximal size (\c m+n ) + const double SVD_MAX_COND = NOMAD::INF; ///< Max. acceptable cond. number + + /// Default value for parameter POINT_DISPLAY_LIMIT + /** Use Parameters::set_POINT_DISPLAY_LIMIT() or parameter POINT_DISPLAY_LIMIT + or Point::set_display_limit() to change it */ + const int DEFAULT_POINT_DISPLAY_LIMIT = 20; + + // Display precisions. + const int DISPLAY_PRECISION_STD = 10; ///< Standard display precision + const int DISPLAY_PRECISION_BB = 15; ///< Display precision for blackboxes + + /// Constant for blackbox files #1. + const std::string BLACKBOX_INPUT_FILE_PREFIX = "nomad"; + + /// Constant for blackbox files #2. + const std::string BLACKBOX_INPUT_FILE_EXT = "input"; + + /// Constant for blackbox files #3. + const std::string BLACKBOX_OUTPUT_FILE_PREFIX = "nomad"; + + /// Constant for blackbox files #4. + const std::string BLACKBOX_OUTPUT_FILE_EXT = "output"; + + /// Display degree type. + enum dd_type { - NO_DISPLAY , ///< No display - MINIMAL_DISPLAY, ///< Minimal dispay - NORMAL_DISPLAY , ///< Normal display - FULL_DISPLAY ///< Full display + NO_DISPLAY , ///< No display + MINIMAL_DISPLAY, ///< Minimal dispay + NORMAL_DISPLAY , ///< Normal display + FULL_DISPLAY ///< Full display }; - + /// Types of the variables - // (do not modify this order) - enum bb_input_type + // (do not modify this order) + enum bb_input_type { - CONTINUOUS , ///< Continuous variable (default) (R) - INTEGER , ///< Integer variable (I) - CATEGORICAL , ///< Categorical variable (C) - BINARY ///< Binary variable (B) + CONTINUOUS , ///< Continuous variable (default) (R) + INTEGER , ///< Integer variable (I) + CATEGORICAL , ///< Categorical variable (C) + BINARY ///< Binary variable (B) }; - - /// Blackbox outputs type - enum bb_output_type + + /// Blackbox outputs type + enum bb_output_type { - OBJ , ///< Objective value - EB , ///< Extreme barrier constraint - PB , ///< progressive barrier constraint - // PEB ///< PB constraint that becomes EB once satisfied - PEB_P , ///< PEB constraint, state P (PB) - PEB_E , ///< PEB constraint, state E (EB) - FILTER , ///< Filter constraint - CNT_EVAL , ///< Output set to 0 or 1 to specify to count or not the - ///< blackbox evaluation - STAT_AVG , ///< Stat (average) - STAT_SUM , ///< Stat (sum) - UNDEFINED_BBO ///< Ignored output + OBJ , ///< Objective value + EB , ///< Extreme barrier constraint + PB , ///< progressive barrier constraint + // PEB ///< PB constraint that becomes EB once satisfied + PEB_P , ///< PEB constraint, state P (PB) + PEB_E , ///< PEB constraint, state E (EB) + FILTER , ///< Filter constraint + CNT_EVAL , ///< Output set to 0 or 1 to specify to count or not the + ///< blackbox evaluation + STAT_AVG , ///< Stat (average) + STAT_SUM , ///< Stat (sum) + UNDEFINED_BBO ///< Ignored output }; - - /// Formulation for multi-objective optimization - enum multi_formulation_type + + /// Formulation for multi-objective optimization + enum multi_formulation_type { - NORMALIZED , ///< Normalized formulation - PRODUCT , ///< Product formulation - DIST_L1 , ///< Distance formulation with norm L1 - DIST_L2 , ///< Distance formulation with norm L2 - DIST_LINF , ///< Distance formulation with norm Linf - UNDEFINED_FORMULATION ///< Undefined formulation + NORMALIZED , ///< Normalized formulation + PRODUCT , ///< Product formulation + DIST_L1 , ///< Distance formulation with norm L1 + DIST_L2 , ///< Distance formulation with norm L2 + DIST_LINF , ///< Distance formulation with norm Linf + UNDEFINED_FORMULATION ///< Undefined formulation }; - - /// Poll type - enum poll_type + + /// Poll type + enum poll_type { - PRIMARY , ///< Primary poll - SECONDARY ///< Secondary poll + PRIMARY , ///< Primary poll + SECONDARY ///< Secondary poll }; - - /// Poll center feasibility type - enum poll_center_type + + /// Poll center feasibility type + enum poll_center_type { - FEASIBLE , ///< Feasible poll center type - INFEASIBLE , ///< Infeasible poll center type - UNDEFINED_POLL_CENTER_TYPE ///< Undefined poll center type + FEASIBLE , ///< Feasible poll center type + INFEASIBLE , ///< Infeasible poll center type + UNDEFINED_POLL_CENTER_TYPE ///< Undefined poll center type }; - - /// Search type - enum search_type + + /// Search type + enum search_type { - X0_EVAL , ///< Starting point evaluation - POLL , ///< Poll - EXTENDED_POLL , ///< Extended poll - SEARCH , ///< Generic search - CACHE_SEARCH , ///< Cache search (does not require evals) - SPEC_SEARCH , ///< MADS speculative search (dynamic order in GPS) - LH_SEARCH , ///< Latin Hypercube (LH) search - LH_SEARCH_P1 , ///< Latin Hypercube (LH) search during phase one - MODEL_SEARCH , ///< Model search - VNS_SEARCH , ///< VNS search - P1_SEARCH , ///< Phase one search - ASYNCHRONOUS , ///< Parallel asynchronous final evaluations - USER_SEARCH , ///< User search - UNDEFINED_SEARCH ///< Undefined search + X0_EVAL , ///< Starting point evaluation + POLL , ///< Poll + EXTENDED_POLL , ///< Extended poll + SEARCH , ///< Generic search + CACHE_SEARCH , ///< Cache search (does not require evals) + SPEC_SEARCH , ///< MADS speculative search (dynamic order in GPS) + LH_SEARCH , ///< Latin Hypercube (LH) search + LH_SEARCH_P1 , ///< Latin Hypercube (LH) search during phase one + MODEL_SEARCH , ///< Model search + VNS_SEARCH , ///< VNS search + P1_SEARCH , ///< Phase one search + ASYNCHRONOUS , ///< Parallel asynchronous final evaluations + USER_SEARCH , ///< User search + UNDEFINED_SEARCH ///< Undefined search }; - - /// Model type - enum model_type + + /// Model type + enum model_type { - QUADRATIC_MODEL , ///< Quadratic model - NO_MODEL ///< No models + QUADRATIC_MODEL , ///< Quadratic model + SGTELIB_MODEL , ///< SGTELIB model + NO_MODEL ///< No models }; + /// intensification type enum intensification_type { NO_INTENSIFICATION , @@ -347,167 +358,209 @@ namespace NOMAD { POLL_AND_SEARCH }; - /// Success type of an iteration - // (do not modify this order) - enum success_type + /// Success type of an iteration + // (do not modify this order) + enum success_type { - UNSUCCESSFUL , ///< Failure - PARTIAL_SUCCESS , ///< Partial success (improving) - FULL_SUCCESS ///< Full success (dominating) + UNSUCCESSFUL , ///< Failure + PARTIAL_SUCCESS , ///< Partial success (improving) + CACHE_UPDATE_SUCCESS, ///< Cache update success (RobustMads only) (dominating) + FULL_SUCCESS, ///< Full success (dominating) + FULL_SUCCESS_ZOOM, ///< Full success (dominating) + FULL_SUCCESS_STAY ///< Full success (dominating) }; - - /// Quadratic interpolation type - enum interpolation_type + + /// Quadratic interpolation type + enum interpolation_type { - MFN , ///< Minimum Frobenius Norm interpolation. - REGRESSION , ///< Regression. - WP_REGRESSION , ///< Well-poised regression. - UNDEFINED_INTERPOLATION_TYPE ///< Undefined. + MFN , ///< Minimum Frobenius Norm interpolation. + REGRESSION , ///< Regression. + WP_REGRESSION , ///< Well-poised regression. + UNDEFINED_INTERPOLATION_TYPE ///< Undefined. }; - - /// Stopping criteria - enum stop_type + + /// Stopping criteria + enum stop_type { - NO_STOP , ///< No stop - ERROR , ///< Error - UNKNOWN_STOP_REASON , ///< Unknown - CTRL_C , ///< Ctrl-C - USER_STOPPED , ///< User-stopped in Evaluator::update_iteration() - MESH_PREC_REACHED , ///< Mesh minimum precision reached - X0_FAIL , ///< Problem with starting point evaluation - P1_FAIL , ///< Problem with phase one - DELTA_M_MIN_REACHED , ///< Min mesh size - DELTA_P_MIN_REACHED , ///< Min poll size - L_MAX_REACHED , ///< Max mesh index + NO_STOP , ///< No stop + ERROR , ///< Error + UNKNOWN_STOP_REASON , ///< Unknown + CTRL_C , ///< Ctrl-C + USER_STOPPED , ///< User-stopped in Evaluator::update_iteration() + MESH_PREC_REACHED , ///< Mesh minimum precision reached + X0_FAIL , ///< Problem with starting point evaluation + P1_FAIL , ///< Problem with phase one + DELTA_M_MIN_REACHED , ///< Min mesh size + DELTA_P_MIN_REACHED , ///< Min poll size + L_MAX_REACHED , ///< Max mesh index L_MIN_REACHED , ///< Min mesh index - L_LIMITS_REACHED , ///< Mesh index limits - XL_LIMITS_REACHED , ///< Mesh index limits - GL_LIMITS_REACHED , ///< Mesh index limits - MAX_TIME_REACHED , ///< Max time - MAX_BB_EVAL_REACHED , ///< Max number of blackbox evaluations - MAX_SGTE_EVAL_REACHED , ///< Max number of surrogate evaluations - MAX_EVAL_REACHED , ///< Max number of evaluations - MAX_SIM_BB_EVAL_REACHED , ///< Max number of sim bb evaluations - MAX_ITER_REACHED , ///< Max number of iterations - MAX_CONS_FAILED_ITER , ///< Max number of consecutive failed iterations - FEAS_REACHED , ///< Feasibility - F_TARGET_REACHED , ///< F_TARGET - STAT_SUM_TARGET_REACHED , ///< STAT_SUM_TARGET - L_CURVE_TARGET_REACHED , ///< L_CURVE_TARGET - MULTI_MAX_BB_REACHED , ///< Max number of blackbox evaluations (multi obj.) - MULTI_NB_MADS_RUNS_REACHED , ///< Max number of MADS runs (multi obj.) - MULTI_STAGNATION , ///< Stagnation criterion (multi obj.) - MULTI_NO_PARETO_PTS , ///< No Pareto points (multi obj.) - MAX_CACHE_MEMORY_REACHED ///< Max cache memory + L_LIMITS_REACHED , ///< Mesh index limits + XL_LIMITS_REACHED , ///< Mesh index limits + GL_LIMITS_REACHED , ///< Mesh index limits + MAX_TIME_REACHED , ///< Max time + MAX_BB_EVAL_REACHED , ///< Max number of blackbox evaluations + MAX_BLOCK_EVAL_REACHED , ///< Max number of block evaluations + MAX_SGTE_EVAL_REACHED , ///< Max number of surrogate evaluations + MAX_EVAL_REACHED , ///< Max number of evaluations + MAX_SIM_BB_EVAL_REACHED , ///< Max number of sim bb evaluations + MAX_ITER_REACHED , ///< Max number of iterations + MAX_CONS_FAILED_ITER , ///< Max number of consecutive failed iterations + FEAS_REACHED , ///< Feasibility + F_TARGET_REACHED , ///< F_TARGET + STAT_SUM_TARGET_REACHED , ///< STAT_SUM_TARGET + L_CURVE_TARGET_REACHED , ///< L_CURVE_TARGET + MULTI_MAX_BB_REACHED , ///< Max number of blackbox evaluations (multi obj.) + MULTI_NB_MADS_RUNS_REACHED , ///< Max number of MADS runs (multi obj.) + MULTI_STAGNATION , ///< Stagnation criterion (multi obj.) + MULTI_NO_PARETO_PTS , ///< No Pareto points (multi obj.) + MAX_CACHE_MEMORY_REACHED ///< Max cache memory }; - - /// Type of norm used for the computation of h - enum hnorm_type + + /// Type of norm used for the computation of h + enum hnorm_type { - L1 , ///< norm L1 - L2 , ///< norm L2 - LINF ///< norm Linf + L1 , ///< norm L1 + L2 , ///< norm L2 + LINF ///< norm Linf }; - - /// Types of directions - // (do not modify this order) - enum direction_type + + /// Types of directions + // (do not modify this order) + enum direction_type { - UNDEFINED_DIRECTION , ///< Undefined direction - MODEL_SEARCH_DIR , ///< Model search direction - NO_DIRECTION , ///< No direction - ORTHO_1 , ///< OrthoMADS 1 - ORTHO_2 , ///< OrthoMADS 2 - ORTHO_NP1_QUAD , ///< OrthoMADS n+1 use Quad model to determine n+1-th direction - ORTHO_NP1_NEG , ///< OrthoMADS n+1 use negative sum of n first directions to determine n+1-th direction + UNDEFINED_DIRECTION , ///< Undefined direction + MODEL_SEARCH_DIR , ///< Model search direction + NO_DIRECTION , ///< No direction + ORTHO_1 , ///< OrthoMADS 1 + ORTHO_2 , ///< OrthoMADS 2 + ORTHO_NP1_QUAD , ///< OrthoMADS n+1 use Quad model to determine n+1-th direction + ORTHO_NP1_NEG , ///< OrthoMADS n+1 use negative sum of n first directions to determine n+1-th direction ORTHO_NP1_UNI , ///< OrthoMADS n+1 uniform directions - DYN_ADDED , ///< Dynamic addition (n+1-th direction added for ORTHO n+1) - ORTHO_2N , ///< OrthoMADS 2n - LT_1 , ///< LT-MADS 1 - LT_2 , ///< LT-MADS 2 - LT_2N , ///< LT-MADS 2n - LT_NP1 , ///< LT-MADS n+1 - GPS_BINARY , ///< GPS for binary variables - GPS_2N_STATIC , ///< GPS 2n static (classic coordinate search) - GPS_2N_RAND , ///< GPS 2n random - GPS_NP1_STATIC_UNIFORM , ///< GPS n+1 static uniform - GPS_NP1_STATIC , ///< GPS n+1 static - GPS_NP1_RAND_UNIFORM , ///< GPS n+1 random uniform - GPS_NP1_RAND , ///< GPS n+1 - PROSPECT_DIR ///< Prospect direction + DYN_ADDED , ///< Dynamic addition (n+1-th direction added for ORTHO n+1) + ORTHO_2N , ///< OrthoMADS 2n + LT_1 , ///< LT-MADS 1 + LT_2 , ///< LT-MADS 2 + LT_2N , ///< LT-MADS 2n + LT_NP1 , ///< LT-MADS n+1 + GPS_BINARY , ///< GPS for binary variables + GPS_2N_STATIC , ///< GPS 2n static (classic coordinate search) + GPS_2N_RAND , ///< GPS 2n random + GPS_NP1_STATIC_UNIFORM , ///< GPS n+1 static uniform + GPS_NP1_STATIC , ///< GPS n+1 static + GPS_NP1_RAND_UNIFORM , ///< GPS n+1 random uniform + GPS_NP1_RAND , ///< GPS n+1 + PROSPECT_DIR ///< Prospect direction }; - - /// Type for Eval_Point::check() failures - enum check_failed_type + + /// Type for Eval_Point::check() failures + enum check_failed_type { - CHECK_OK , ///< Correct check - LB_FAIL , ///< LB failure - UB_FAIL , ///< UB failure - FIX_VAR_FAIL , ///< Fixed variables failure - BIN_FAIL , ///< Binary failure - CAT_FAIL , ///< Categorical failure - INT_FAIL ///< Integer failure + CHECK_OK , ///< Correct check + LB_FAIL , ///< LB failure + UB_FAIL , ///< UB failure + FIX_VAR_FAIL , ///< Fixed variables failure + BIN_FAIL , ///< Binary failure + CAT_FAIL , ///< Categorical failure + INT_FAIL ///< Integer failure }; - - /// Type for cache indexes in Cache: - enum cache_index_type + + /// Type for cache indexes in Cache: + enum cache_index_type + { + CACHE_1 , ///< Cache index #1 + CACHE_2 , ///< Cache index #2 + CACHE_3 , ///< Cache index #3 + UNDEFINED_CACHE ///< Undefined cache index + }; + + /// Type for DISPLAY_STATS parameter + // (do not modify this order): + enum display_stats_type + { + DS_OBJ , ///< Objective (f) value + // (keep in first position) + DS_CONS_H , ///< Infeasibility (h) value + DS_SMOOTH_OBJ , ///< Smoothed objective value (f~) + DS_SIM_BBE , ///< Number of simulated bb evaluations + DS_BBE , ///< Number of bb evaluations + DS_BLK_EVA , ///< Number of block evaluation calls + DS_SGTE , ///< Number of surrogate evaluations + DS_BBO , ///< All blackbox outputs + DS_EVAL , ///< Number of evaluations + DS_TIME , ///< Wall-clock time + DS_MESH_INDEX , ///< Mesh index + DS_MESH_SIZE , ///< Mesh size parameter Delta^m_k + DS_DELTA_M , ///< Same as \c DS_MESH_SIZE + DS_POLL_SIZE , ///< Poll size parameter Delta^p_k + DS_DELTA_P , ///< Same as \c DS_POLL_SIZE + DS_SOL , ///< Solution vector + DS_VAR , ///< One variable + DS_STAT_SUM , ///< Stat sum + DS_STAT_AVG , ///< Stat avg + DS_UNDEFINED ///< Und efined value + // (keep in last position) + }; + + /// Type for evaluation + enum eval_type + { + TRUTH , ///< Truth + SGTE ///< Surrogate + }; + + /// Type for an evaluation status + enum eval_status_type { - CACHE_1 , ///< Cache index #1 - CACHE_2 , ///< Cache index #2 - CACHE_3 , ///< Cache index #3 - UNDEFINED_CACHE ///< Undefined cache index + EVAL_FAIL , ///< Evaluation failure + EVAL_USER_REJECT , ///< Evaluation was rejected by user (not failure -> may submitted again) + EVAL_OK , ///< Correct evaluation + EVAL_IN_PROGRESS , ///< Evaluation in progress + UNDEFINED_STATUS ///< Undefined evaluation status }; - /// Type for DISPLAY_STATS parameter - // (do not modify this order): - enum display_stats_type + enum smoothing_status_type { - DS_OBJ , ///< Objective (f) value - // (keep in first position) - DS_SIM_BBE , ///< Number of simulated bb evaluations - DS_BBE , ///< Number of bb evaluations - DS_BLK_EVA , ///< Number of block evaluation calls - DS_SGTE , ///< Number of surrogate evaluations - DS_BBO , ///< All blackbox outputs - DS_EVAL , ///< Number of evaluations - DS_TIME , ///< Wall-clock time - DS_MESH_INDEX , ///< Mesh index - DS_MESH_SIZE , ///< Mesh size parameter Delta^m_k - DS_DELTA_M , ///< Same as \c DS_MESH_SIZE - DS_POLL_SIZE , ///< Poll size parameter Delta^p_k - DS_DELTA_P , ///< Same as \c DS_POLL_SIZE - DS_SOL , ///< Solution vector - DS_VAR , ///< One variable - DS_STAT_SUM , ///< Stat sum - DS_STAT_AVG , ///< Stat avg - DS_UNDEFINED ///< Undefined value - // (keep in last position) + SMOOTHING_FAIL , ///< Smoothing failure + SMOOTHING_OK , ///< Smoothing success + SMOOTHING_UNDEFINED ///< Undefined smoothing status }; - /// Type for evaluation - enum eval_type + // SGTELIB + /// Formulations for sgtelib_model model Search + enum sgtelib_model_formulation_type { - TRUTH , ///< Truth - SGTE ///< Surrogate + SGTELIB_MODEL_FORMULATION_FS , /// min f-lambda*sigma, st c-lambda*sigma < 0 + SGTELIB_MODEL_FORMULATION_FSP , /// min f-lambda*sigma, st P(x) > 1/2 + SGTELIB_MODEL_FORMULATION_EIS , /// min -EI-lambda*sigma, st c-lambda*sigma < 0 + SGTELIB_MODEL_FORMULATION_EFI , /// min -EFI + SGTELIB_MODEL_FORMULATION_EFIS , /// min -EFI-lambda*sigma + SGTELIB_MODEL_FORMULATION_EFIM , /// min -EFI-lambda*sigma*mu + SGTELIB_MODEL_FORMULATION_EFIC , /// min -EFI-lambda*(EI*sigma+P*mu) + SGTELIB_MODEL_FORMULATION_PFI , /// min -PFI + SGTELIB_MODEL_FORMULATION_D , /// min -distance_to_closest + SGTELIB_MODEL_FORMULATION_EXTERN, /// min f, st c, with extern sgte.exe model + SGTELIB_MODEL_FORMULATION_UNDEFINED /// Undefined }; - /// Type for an evaluation status - enum eval_status_type + // SGTELIB + /// Formulations for sgtelib_model model Search + enum sgtelib_model_feasibility_type { - EVAL_FAIL , ///< Evaluation failure - EVAL_USER_REJECT , ///< Evaluation was rejected by user (not failure -> may submitted again) - EVAL_OK , ///< Correct evaluation - EVAL_IN_PROGRESS , ///< Evaluation in progress - UNDEFINED_STATUS ///< Undefined evaluation status + SGTELIB_MODEL_FEASIBILITY_C , /// one model for each constraint + SGTELIB_MODEL_FEASIBILITY_H , /// one model for H + SGTELIB_MODEL_FEASIBILITY_B , /// one binary model + SGTELIB_MODEL_FEASIBILITY_M , /// one model of the max of (c_j) + SGTELIB_MODEL_FEASIBILITY_UNDEFINED /// Undefined }; enum mesh_type { XMESH , /// Anisotropic (eXtensible) mesh - SMESH , /// Isotropic Standard mesh + GMESH , /// Anisotropic Granular mesh + SMESH , /// Isotropic Standard mesh NO_MESH_TYPE }; - + } #endif diff --git a/src/lgpl.txt b/src/lgpl.txt index cca7fc278f5c81ce23a2687208f0d63a6ea44009..e8bec28dfa14d13a73b1742fccffdc491f15e9df 100644 --- a/src/lgpl.txt +++ b/src/lgpl.txt @@ -1,165 +1,165 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - - This version of the GNU Lesser General Public License incorporates -the terms and conditions of version 3 of the GNU General Public -License, supplemented by the additional permissions listed below. - - 0. Additional Definitions. - - As used herein, "this License" refers to version 3 of the GNU Lesser -General Public License, and the "GNU GPL" refers to version 3 of the GNU -General Public License. - - "The Library" refers to a covered work governed by this License, -other than an Application or a Combined Work as defined below. - - An "Application" is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. - - A "Combined Work" is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the "Linked -Version". - - The "Minimal Corresponding Source" for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. - - The "Corresponding Application Code" for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. - - 1. Exception to Section 3 of the GNU GPL. - - You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. - - 2. Conveying Modified Versions. - - If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: - - a) under this License, provided that you make a good faith effort to - ensure that, in the event an Application does not supply the - function or data, the facility still operates, and performs - whatever part of its purpose remains meaningful, or - - b) under the GNU GPL, with none of the additional permissions of - this License applicable to that copy. - - 3. Object Code Incorporating Material from Library Header Files. - - The object code form of an Application may incorporate material from -a header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following: - - a) Give prominent notice with each copy of the object code that the - Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the object code with a copy of the GNU GPL and this license - document. - - 4. Combined Works. - - You may convey a Combined Work under terms of your choice that, -taken together, effectively do not restrict modification of the -portions of the Library contained in the Combined Work and reverse -engineering for debugging such modifications, if you also do each of -the following: - - a) Give prominent notice with each copy of the Combined Work that - the Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the Combined Work with a copy of the GNU GPL and this license - document. - - c) For a Combined Work that displays copyright notices during - execution, include the copyright notice for the Library among - these notices, as well as a reference directing the user to the - copies of the GNU GPL and this license document. - - d) Do one of the following: - - 0) Convey the Minimal Corresponding Source under the terms of this - License, and the Corresponding Application Code in a form - suitable for, and under terms that permit, the user to - recombine or relink the Application with a modified version of - the Linked Version to produce a modified Combined Work, in the - manner specified by section 6 of the GNU GPL for conveying - Corresponding Source. - - 1) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (a) uses at run time - a copy of the Library already present on the user's computer - system, and (b) will operate properly with a modified version - of the Library that is interface-compatible with the Linked - Version. - - e) Provide Installation Information, but only if you would otherwise - be required to provide such information under section 6 of the - GNU GPL, and only to the extent that such information is - necessary to install and execute a modified version of the - Combined Work produced by recombining or relinking the - Application with a modified version of the Linked Version. (If - you use option 4d0, the Installation Information must accompany - the Minimal Corresponding Source and Corresponding Application - Code. If you use option 4d1, you must provide the Installation - Information in the manner specified by section 6 of the GNU GPL - for conveying Corresponding Source.) - - 5. Combined Libraries. - - You may place library facilities that are a work based on the -Library side by side in a single library together with other library -facilities that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: - - a) Accompany the combined library with a copy of the same work based - on the Library, uncombined with any other library facilities, - conveyed under the terms of this License. - - b) Give prominent notice with the combined library that part of it - is a work based on the Library, and explaining where to find the - accompanying uncombined form of the same work. - - 6. Revised Versions of the GNU Lesser General Public License. - - The Free Software Foundation may publish revised and/or new versions -of the GNU Lesser General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - - Each version is given a distinguishing version number. If the -Library as you received it specifies that a certain numbered version -of the GNU Lesser General Public License "or any later version" -applies to it, you have the option of following the terms and -conditions either of that published version or of any later version -published by the Free Software Foundation. If the Library as you -received it does not specify a version number of the GNU Lesser -General Public License, you may choose any version of the GNU Lesser -General Public License ever published by the Free Software Foundation. - - If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the -Library. + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/src/nomad.cpp b/src/nomad.cpp index e97307cadeb2ac5fce82b40fa59ec7df7132fdf3..ceb8eb591c410a0adc79d961e245343c95d1bfa7 100644 --- a/src/nomad.cpp +++ b/src/nomad.cpp @@ -1,43 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file nomad.cpp \brief NOMAD main file @@ -71,12 +75,11 @@ int main ( int argc , char ** argv ) } // parameters file: - std::string param_file_name = argv[1]; - std::string opt = param_file_name; + std::string opt = argv[1]; NOMAD::toupper ( opt ); - // display version if option '-v' has been specified: - if ( opt == "-U" ) + // display usage if option '-u' has been specified: + if ( opt == "-U" || opt == "-USAGE" || opt == "--USAGE" ) { NOMAD::display_usage ( argv[0], out ); NOMAD::end(); @@ -85,7 +88,7 @@ int main ( int argc , char ** argv ) // display version if option '-v' has been specified: - if ( opt == "-V" || opt =="-VERSION") + if ( opt == "-V" || opt == "-VERSION" || opt == "--VERSION" ) { NOMAD::display_version ( out ); NOMAD::end(); @@ -93,7 +96,7 @@ int main ( int argc , char ** argv ) } // display info if option '-i' has been specified: - if ( opt == "-I" || opt == "-INFO" ) + if ( opt == "-I" || opt == "-INFO" || opt == "--INFO" ) { NOMAD::display_info ( out ); NOMAD::display_usage ( argv[0], out ); @@ -105,7 +108,7 @@ int main ( int argc , char ** argv ) NOMAD::Parameters p ( out ); // display help on parameters if option '-h' has been specified: - if ( opt == "-H" || opt == "-HELP" ) + if ( opt == "-H" || opt == "-HELP" || opt == "--HELP" ) { p.help ( argc , argv ); NOMAD::end(); @@ -113,19 +116,42 @@ int main ( int argc , char ** argv ) } // display developer help on parameters if option '-d' has been specified: - if ( opt == "-D" ) + if ( opt == "-D" || opt == "-DEVELOPER" || opt == "--DEVELOPER" ) { p.help ( argc , argv,true ); NOMAD::end(); return EXIT_SUCCESS; } + if ( opt[0] == '-' ) + { + // Unrecognized flag. Display usage and exit gracefully. + error = std::string("ERROR: Unrecognized option ") + argv[1]; + std::cerr << std::endl << error << std::endl << std::endl; + NOMAD::display_usage ( argv[0], out ); + NOMAD::end(); + return EXIT_FAILURE; + } + + std::string param_file_name = argv[1]; + + // Verify the argument is a file name + if ( !NOMAD::check_read_file(param_file_name) ) + { + // Could not read input file. Display usage and exit gracefully. + error = std::string("ERROR: Could not read file \"") + argv[1] + "\""; + std::cerr << std::endl << error << std::endl << std::endl; + NOMAD::display_usage ( argv[0], out ); + NOMAD::end(); + return EXIT_FAILURE; + } // check the number of processess: #ifdef USE_MPI if ( NOMAD::Slave::get_nb_processes() < 2 ) { - std::cerr << "ERROR: Incorrect command to run with MPI." << std::endl; + error = std::string("ERROR: Incorrect command to run with MPI."); + std::cerr << std::endl << error << std::endl << std::endl; NOMAD::display_usage ( argv[0], std::cerr ); NOMAD::end(); return EXIT_FAILURE; @@ -133,19 +159,17 @@ int main ( int argc , char ** argv ) #endif try { - - + // read parameters file: p.read ( param_file_name ); // parameters check: p.check(); - // display NOMAD info: + // display NOMAD info and Seed: if ( p.get_display_degree() > NOMAD::MINIMAL_DISPLAY) NOMAD::display_info ( out ); - // parameters display: if ( NOMAD::Slave::is_master() && p.get_display_degree() == NOMAD::FULL_DISPLAY ) @@ -161,6 +185,7 @@ int main ( int argc , char ** argv ) else mads.multi_run(); + #ifdef MODEL_STATS mads.display_model_stats ( out ); #endif @@ -170,13 +195,15 @@ int main ( int argc , char ** argv ) { if ( NOMAD::Slave::is_master() ) { - error = std::string ( "NOMAD has been interrupted: " ) + e.what(); + error = std::string ( "ERROR: " ) + e.what(); std::cerr << std::endl << error << std::endl << std::endl; } } + NOMAD::Slave::stop_slaves ( out ); NOMAD::end(); + } #ifdef MEMORY_DEBUG @@ -305,10 +332,14 @@ void NOMAD::display_info ( const NOMAD::Display & out ) << "Sebastien Le Digabel - Ecole Polytechnique de Montreal" << std::endl << "Christophe Tribes - Ecole Polytechnique de Montreal" << std::endl << NOMAD::close_block() - << std::endl << "NOMAD version 3 is a new version of Nomad v1 and v2, it has been funded by AFOSR and Exxon Mobil." << std::endl - << "Nomad v1 and v2 were created and developed by Mark A. Abramson from The Boeing Company, Charles Audet and Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from Rice University, and were funded by AFOSR and Exxon Mobil." << std::endl << std::endl - << "Download : www.gerad.ca/nomad" << std::endl + << "NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto and " << std::endl + << "IVADO." << std::endl + << std::endl + << "NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created" << std::endl + << "and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E." << std::endl + << "Dennis Jr., and were funded by AFOSR and Exxon Mobil." << std::endl + << std::endl << "License : \'" << NOMAD::LGPL_FILE << "\'" << std::endl << "User guide: \'" << NOMAD::USER_GUIDE_FILE << "\'" << std::endl << "Examples : \'" << NOMAD::EXAMPLES_DIR << "\'" << std::endl @@ -316,15 +347,7 @@ void NOMAD::display_info ( const NOMAD::Display & out ) << std::endl << "Please report bugs to nomad@gerad.ca" << std::endl; - out << endl << "Seed: "<< NOMAD::RNG::get_seed()<<endl; -} - - - - - - - + out << endl << "Seed: "<< NOMAD::RNG::get_seed()<<endl;} /*------------------------------------------*/ /* display NOMAD usage */ @@ -341,7 +364,7 @@ void NOMAD::display_usage ( char* exeName, const NOMAD::Display & out ) << "Developer help : " << exeName << " -d keyword(s) (or 'all')" << std::endl << "Version : " << exeName << " -v" << std::endl << "Usage : " << exeName << " -u" << std::endl - << std::endl; + << std::endl; #else out << std::endl << "Run NOMAD : " << exeName << " parameters_file" << std::endl @@ -350,6 +373,6 @@ void NOMAD::display_usage ( char* exeName, const NOMAD::Display & out ) << "Developer help : " << exeName << " -d keyword(s) (or 'all')" << std::endl << "Version : " << exeName << " -v" << std::endl << "Usage : " << exeName << " -u" << std::endl - << std::endl; + << std::endl; #endif } diff --git a/src/nomad.hpp b/src/nomad.hpp index 6b6f9687b808d169e9e544d13c4b14600f818f1b..a38f312b99aa5dd5f0a13b3552089a8e4547938e 100644 --- a/src/nomad.hpp +++ b/src/nomad.hpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file nomad.hpp \brief NOMAD header file @@ -72,7 +74,7 @@ namespace NOMAD { \param out A NOMAD::Display object -- \b IN. */ void display_usage ( char* exeName, const NOMAD::Display & out ); - void display_usage ( const NOMAD::Display & out ); + void display_usage ( const NOMAD::Display & out ); #ifdef MEMORY_DEBUG /// Display NOMAD most important structures in memory. diff --git a/src/utils.cpp b/src/utils.cpp index 1392dfed022f212cf9ec7d73e09bf53943c10a45..f92a81b6b4b0e05450f94e6a610073bdbd63b168 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file utils.cpp \brief Utility functions @@ -171,6 +173,7 @@ std::string NOMAD::itos ( size_t i ) } +// SGTELIB /*-----------------------------------------------------------------*/ /* NOMAD::deblank */ /*-----------------------------------------------------------------*/ @@ -775,12 +778,16 @@ bool NOMAD::string_to_model_type ( const std::string & s , { std::string ss = s; NOMAD::toupper ( ss ); - if ( ss=="QUADRATIC" || ss=="QUADRATIC_MODEL" ) { mt = NOMAD::QUADRATIC_MODEL; return true; } + if ( ss=="SGTELIB" || ss=="SGTELIB_MODEL" ) + { + mt = NOMAD::SGTELIB_MODEL; + return true; + } mt = NOMAD::NO_MODEL; @@ -800,6 +807,11 @@ bool NOMAD::string_to_mesh_type ( const std::string & s , mt = NOMAD::XMESH; return true; } + if ( ss=="GMESH" || ss=="G" ) + { + mt = NOMAD::GMESH; + return true; + } if ( ss=="SMESH" || ss=="S" ) { mt = NOMAD::SMESH; @@ -1009,7 +1021,7 @@ bool NOMAD::SVD_decomposition ( std::string & error_msg , int nm1 = n - 1; bool flag; - int i , j , k , l , its , jj , nm = 0; + int i , j , k , l = 0, its , jj , nm = 0; double s , f , h , tmp , c , x , y , z , absf , absg , absh; const int NITER = 30; @@ -1090,7 +1102,6 @@ bool NOMAD::SVD_decomposition ( std::string & error_msg , } // accumulation of right-hand transformations: - l=0; for ( i = nm1 ; i >= 0 ; --i ) { if ( i < nm1 ) @@ -1286,3 +1297,145 @@ bool NOMAD::SVD_decomposition ( std::string & error_msg , delete [] rv1; return true; } + + + +// SGTELIB +/*-----------------------------------------------------------------*/ +/* convert a string into a sgtelib_model_formulation_type */ +/*-----------------------------------------------------------------*/ +bool NOMAD::string_to_sgtelib_model_formulation_type ( const std::string & s , + NOMAD::sgtelib_model_formulation_type & dft ) +{ + std::string ss = s; + NOMAD::toupper ( ss ); + if ( ss=="FS" ) + { + dft = NOMAD::SGTELIB_MODEL_FORMULATION_FS; + return true; + } + if ( ss=="FSP" ) + { + dft = NOMAD::SGTELIB_MODEL_FORMULATION_FSP; + return true; + } + if ( ss=="EIS" ) + { + dft = NOMAD::SGTELIB_MODEL_FORMULATION_EIS; + return true; + } + if ( ss=="EFI" ) + { + dft = NOMAD::SGTELIB_MODEL_FORMULATION_EFI; + return true; + } + if ( ss=="EFIS" ) + { + dft = NOMAD::SGTELIB_MODEL_FORMULATION_EFIS; + return true; + } + if ( ss=="EFIM" ) + { + dft = NOMAD::SGTELIB_MODEL_FORMULATION_EFIM; + return true; + } + if ( ss=="EFIC" ) + { + dft = NOMAD::SGTELIB_MODEL_FORMULATION_EFIC; + return true; + } + if ( ss=="PFI" ) + { + dft = NOMAD::SGTELIB_MODEL_FORMULATION_PFI; + return true; + } + if ( ss=="D" ) + { + dft = NOMAD::SGTELIB_MODEL_FORMULATION_PFI; + return true; + } + if ( ss=="EXTERN" ) + { + dft = NOMAD::SGTELIB_MODEL_FORMULATION_EXTERN; + return true; + } + dft = NOMAD::SGTELIB_MODEL_FORMULATION_UNDEFINED; + return false; +} + +// SGTELIB +/*-----------------------------------------------------------------*/ +/* convert a string into a sgtelib_model_feasibility */ +/*-----------------------------------------------------------------*/ +bool NOMAD::string_to_sgtelib_model_feasibility_type ( const std::string & s , + NOMAD::sgtelib_model_feasibility_type & dft ) +{ + std::string ss = s; + NOMAD::toupper ( ss ); + if ( ss=="C" ) + { + dft = NOMAD::SGTELIB_MODEL_FEASIBILITY_C; + return true; + } + if ( ss=="H" ) + { + dft = NOMAD::SGTELIB_MODEL_FEASIBILITY_H; + return true; + } + if ( ss=="B" ) + { + dft = NOMAD::SGTELIB_MODEL_FEASIBILITY_B; + return true; + } + if ( ss=="M" ) + { + dft = NOMAD::SGTELIB_MODEL_FEASIBILITY_M; + return true; + } + dft = NOMAD::SGTELIB_MODEL_FEASIBILITY_UNDEFINED; + return false; +} + + + +// SGTELIB +/*-----------------------------------------------------------------*/ +/* convert a sgtelib_model_formulation_type into a string */ +/*-----------------------------------------------------------------*/ +std::string NOMAD::sgtelib_model_feasibility_type_to_string ( const NOMAD::sgtelib_model_feasibility_type dft ) +{ + switch (dft) + { + case NOMAD::SGTELIB_MODEL_FEASIBILITY_C: return "C"; + case NOMAD::SGTELIB_MODEL_FEASIBILITY_H: return "H"; + case NOMAD::SGTELIB_MODEL_FEASIBILITY_B: return "B"; + case NOMAD::SGTELIB_MODEL_FEASIBILITY_M: return "M"; + case NOMAD::SGTELIB_MODEL_FEASIBILITY_UNDEFINED: return "UNDEFINED"; + default: return "UNDEFINED"; + } +} + +// SGTELIB +/*-----------------------------------------------------------------*/ +/* convert a sgtelib_model_formulation_type into a string */ +/*-----------------------------------------------------------------*/ +std::string NOMAD::sgtelib_model_formulation_type_to_string ( const NOMAD::sgtelib_model_formulation_type dft ) +{ + switch (dft) + { + case NOMAD::SGTELIB_MODEL_FORMULATION_FS: return "FS"; + case NOMAD::SGTELIB_MODEL_FORMULATION_FSP: return "FSP"; + case NOMAD::SGTELIB_MODEL_FORMULATION_EIS: return "EIS"; + case NOMAD::SGTELIB_MODEL_FORMULATION_EFI: return "EFI"; + case NOMAD::SGTELIB_MODEL_FORMULATION_EFIS: return "EFIS"; + case NOMAD::SGTELIB_MODEL_FORMULATION_EFIM: return "EFIM"; + case NOMAD::SGTELIB_MODEL_FORMULATION_EFIC: return "EFIC"; + case NOMAD::SGTELIB_MODEL_FORMULATION_PFI: return "PFI"; + case NOMAD::SGTELIB_MODEL_FORMULATION_D: return "D"; + case NOMAD::SGTELIB_MODEL_FORMULATION_EXTERN: return "EXTERN"; + case NOMAD::SGTELIB_MODEL_FORMULATION_UNDEFINED: return "UNDEFINED"; + default: return "UNDEFINED"; + } +} + + diff --git a/src/utils.hpp b/src/utils.hpp index 8496a7074b6a51d93a2968447f79d2e290e7af86..1bc296094832f66f6b6f4adac3b7881e21622a38 100644 --- a/src/utils.hpp +++ b/src/utils.hpp @@ -1,45 +1,47 @@ -/*-------------------------------------------------------------------------------------*/ -/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.3 */ -/* */ -/* */ -/* NOMAD - version 3.7.3 has been created by */ -/* Charles Audet - Ecole Polytechnique de Montreal */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* The copyright of NOMAD - version 3.7.3 is owned by */ -/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ -/* Christophe Tribes - Ecole Polytechnique de Montreal */ -/* */ -/* NOMAD v3 has been funded by AFOSR and Exxon Mobil. */ -/* */ -/* NOMAD v3 is a new version of Nomad v1 and v2. Nomad v1 and v2 were created and */ -/* developed by Mark A. Abramson from The Boeing Company, Charles Audet and */ -/* Gilles Couture from Ecole Polytechnique de Montreal, and John E. Dennis Jr. from */ -/* Rice University, and were funded by AFOSR and Exxon Mobil. */ -/* */ -/* */ -/* Contact information: */ -/* Ecole Polytechnique de Montreal - GERAD */ -/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ -/* e-mail: nomad@gerad.ca */ -/* phone : 1-514-340-6053 #6928 */ -/* fax : 1-514-340-5665 */ -/* */ -/* This program is free software: you can redistribute it and/or modify it under the */ -/* terms of the GNU Lesser General Public License as published by the Free Software */ -/* Foundation, either version 3 of the License, or (at your option) any later */ -/* version. */ -/* */ -/* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ -/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ -/* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License along */ -/* with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* */ -/* You can find information on the NOMAD software at www.gerad.ca/nomad */ -/*-------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ +/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */ +/* version 3.8.1 */ +/* */ +/* NOMAD - version 3.8.1 has been created by */ +/* Charles Audet - Ecole Polytechnique de Montreal */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* The copyright of NOMAD - version 3.8.1 is owned by */ +/* Sebastien Le Digabel - Ecole Polytechnique de Montreal */ +/* Christophe Tribes - Ecole Polytechnique de Montreal */ +/* */ +/* NOMAD v3 has been funded by AFOSR, Exxon Mobil, Hydro Québec, Rio Tinto */ +/* and IVADO. */ +/* */ +/* NOMAD v3 is a new version of NOMAD v1 and v2. NOMAD v1 and v2 were created */ +/* and developed by Mark Abramson, Charles Audet, Gilles Couture, and John E. */ +/* Dennis Jr., and were funded by AFOSR and Exxon Mobil. */ +/* */ +/* Contact information: */ +/* Ecole Polytechnique de Montreal - GERAD */ +/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ +/* e-mail: nomad@gerad.ca */ +/* phone : 1-514-340-6053 #6928 */ +/* fax : 1-514-340-5665 */ +/* */ +/* This program is free software: you can redistribute it and/or modify it */ +/* under the terms of the GNU Lesser General Public License as published by */ +/* the Free Software Foundation, either version 3 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */ +/* for more details. */ +/* */ +/* You should have received a copy of the GNU Lesser General Public License */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* */ +/* You can find information on the NOMAD software at www.gerad.ca/nomad */ +/*------------------------------------------------------------------------------*/ + + /** \file utils.hpp \brief Utility functions (headers) @@ -97,7 +99,7 @@ namespace NOMAD { \return A boolean equal to \c true if the conversion was possible. */ bool string_to_hnorm_type ( const std::string & s , NOMAD::hnorm_type & hn ); - + /// Convert a string into a multi_formulation_type. /** \param s The string -- \b IN. @@ -126,7 +128,7 @@ namespace NOMAD { int * n = NULL , bool check_order = true ); - /// Convert a string in {"QUADRATIC"} to a \c NOMAD::model_type. + /// Convert a string in {"QUADRATIC","SGTELIB"} to a \c NOMAD::model_type. /** \param s The string -- \b IN. \param mt The NOMAD::model_type -- \b OUT. @@ -134,8 +136,7 @@ namespace NOMAD { */ bool string_to_model_type ( const std::string & s , NOMAD::model_type & mt ); - - /// Convert a string in {"XMESH","SMESH"} to a \c NOMAD::mesh_type. + /// Convert a string in {"XMESH","GMESH","SMESH"} to a \c NOMAD::mesh_type. /** \param s The string -- \b IN. \param mt The NOMAD::mesh_type -- \b OUT. @@ -301,14 +302,13 @@ namespace NOMAD { */ std::string itos ( size_t i ); + // SGTELIB /// Remove leading, trailing and double spaces in a string. /** \param s The string -- \b IN/OUT. */ void deblank ( std::string & s ); - - - + /// Put a string into upper cases. /** @@ -388,7 +388,7 @@ namespace NOMAD { // Get rank of a matrix using SVD decomposition /** - The \c mxn \c M matrix is decomposed into \c M=U.W.V'. The rank equals the size of W - \param M The input \c mxn matrix -- \b IN. + \param M The input \c mxn matrix -- \b IN. \param m Number of rows in M -- \b IN. \param n Number of columns in M -- \b IN. \return The rank>0 if the decomposition worked else 0. @@ -397,6 +397,46 @@ namespace NOMAD { size_t m, size_t n); + + // SGTELIB + /// Convert a string into a sgtelib_model_formulation_type. + /** + \param s The string -- \b IN. + \param dft The NOMAD::sgtelib_model_formulation_type -- \b OUT. + \return A boolean equal to \c true if the conversion was possible. + */ + bool string_to_sgtelib_model_formulation_type ( const std::string & s , + NOMAD::sgtelib_model_formulation_type & dft ); + + // SGTELIB + /// Convert a string into a sgtelib_model_feasibility_type. + /** + \param s The string -- \b IN. + \param dft The NOMAD::sgtelib_model_feasibility_type -- \b OUT. + \return A boolean equal to \c true if the conversion was possible. + */ + bool string_to_sgtelib_model_feasibility_type ( const std::string & s , + NOMAD::sgtelib_model_feasibility_type & dft ); + + // SGTELIB + /// Convert a sgtelib_model_feasibility_type into a string. + /** + \param dft The NOMAD::sgtelib_model_feasibility_type -- \b IN. + \return A string. + */ + std::string sgtelib_model_feasibility_type_to_string ( const NOMAD::sgtelib_model_feasibility_type dft ); + + // SGTELIB + /// Convert a sgtelib_model_formulation_type into a string. + /** + \param dft The NOMAD::sgtelib_model_formulation_type -- \b IN. + \return A string. + */ + std::string sgtelib_model_formulation_type_to_string ( const NOMAD::sgtelib_model_formulation_type dft ); + + + + } #endif diff --git a/tools/COOP-MADS/makefile b/tools/COOP-MADS/makefile index 0c3c6f00b21695e42331aa27bcd99e496bcdf55e..f8389827cd4ff5a517326c63cf2cb62ebbde242c 100644 --- a/tools/COOP-MADS/makefile +++ b/tools/COOP-MADS/makefile @@ -16,7 +16,7 @@ endif LDLIBS = -lm -lnomad -lmpi -INCLUDE = -I$(NOMAD_HOME)/src -I. +INCLUDE = -I$(NOMAD_HOME)/src -I$(NOMAD_HOME)/ext/sgtelib/src -I. COMPILE = $(COMPILATOR) $(COMPILATOR_OPTIONS) $(INCLUDE) -c OBJS = main.o Cache_Server.o diff --git a/tools/COOP-MADS/problems/RHEOLOGY/x0.txt b/tools/COOP-MADS/problems/RHEOLOGY/x0.txt index 51fdf048b8ac6b09906d589e385475f2ceae18bf..6597ade3532c5a50bbb32088540316296a7b8cf4 100644 --- a/tools/COOP-MADS/problems/RHEOLOGY/x0.txt +++ b/tools/COOP-MADS/problems/RHEOLOGY/x0.txt @@ -1,3 +1,3 @@ -10 -10 -10 +10 +10 +10 diff --git a/tools/PSD-MADS/Cache_Server.cpp b/tools/PSD-MADS/Cache_Server.cpp index 96d4ff9e826984fbc61d93ff03bb776c9be39488..015553966fa1c8f5aa40d86b96f27b2f9255327a 100644 --- a/tools/PSD-MADS/Cache_Server.cpp +++ b/tools/PSD-MADS/Cache_Server.cpp @@ -30,862 +30,973 @@ char Cache_Server::BF_SIGNAL = 'B'; /* constructor */ /*-----------------------------------*/ Cache_Server::Cache_Server ( const Display & out , - int rank , - int np , - const Double & h_min , - int max_bbe , - bool allow_multiple_evals , - bool debug ) - : Cache ( out , TRUTH ) , - _rank ( rank ) , - _np ( np ) , - _debug ( debug ) , - _h_min ( h_min ) , - _max_bbe ( max_bbe ) , - _bf ( NULL ) , - _bi1 ( NULL ) , - _bi2 ( NULL ) , - _multiple_evals ( 0 ) , - _cache_hits ( 0 ) , - _cache_search_pts ( 0 ) , - _waited_pts ( NULL ) , - _clients_ext_pts ( NULL ) { - - // cache server: - if ( _rank == _np - 1 ) { - - _clients_ext_pts = new list<const Eval_Point*> [_np]; + int rank , + int np , + const Double & h_min , + int max_bbe , + const string & history_file , + bool allow_multiple_evals , + bool debug ) +: Cache ( out , TRUTH ) , +_rank ( rank ) , +_np ( np ) , +_debug ( debug ) , +_h_min ( h_min ) , +_max_bbe ( max_bbe ) , +_history_file ( history_file) , +_bf ( NULL ) , +_bi1 ( NULL ) , +_bi2 ( NULL ) , +_multiple_evals ( 0 ) , +_cache_hits ( 0 ) , +_cache_search_pts ( 0 ) , +_waited_pts ( NULL ) , +_clients_ext_pts ( NULL ) +{ - if ( !allow_multiple_evals ) { - _waited_pts = new Point * [_np]; - for ( int i = 0 ; i < _np ; ++i ) - _waited_pts[i] = NULL; + // cache server: + if ( _rank == _np - 1 ) + { + + _clients_ext_pts = new list<const Eval_Point*> [_np]; + + if ( !allow_multiple_evals ) + { + _waited_pts = new Point * [_np]; + for ( int i = 0 ; i < _np ; ++i ) + _waited_pts[i] = NULL; + } + } - } } /*-----------------------------------*/ /* destructor */ /*-----------------------------------*/ -Cache_Server::~Cache_Server ( void ) { - if ( _waited_pts ) { - for ( int i = 0 ; i < _np ; ++i ) - if ( _waited_pts[i] ) - delete _waited_pts; - delete [] _waited_pts; - } - - if ( _clients_ext_pts ) - delete [] _clients_ext_pts; +Cache_Server::~Cache_Server ( void ) +{ + if ( _waited_pts ) + { + for ( int i = 0 ; i < _np ; ++i ) + if ( _waited_pts[i] ) + delete _waited_pts; + delete [] _waited_pts; + } + + if ( _clients_ext_pts ) + delete [] _clients_ext_pts; } /*-----------------------------------*/ /* start the server (process np-1) */ /*-----------------------------------*/ -void Cache_Server::start ( void ) { - - int npm1 = _np-1; - - if ( _rank != npm1 ) - return; - - MPI_Status status; - int nb_stops = 0; - int source; - char signal; - - /*-------------*/ - /* main loop */ - /*-------------*/ - while ( nb_stops != npm1 ) { - - MPI_Recv ( &signal , 1 , MPI_CHAR , MPI_ANY_SOURCE , - Cache_Server::TAG_SIGNAL , MPI_COMM_WORLD , &status ); - - source = status.MPI_SOURCE; - - // stop signal: - // ------------ - if ( signal == Cache_Server::STOP_SIGNAL ) { - if ( _debug ) - _out << "CACHE SERVER: STOP SIGNAL FROM RANK " << source << endl; - ++nb_stops; - } +void Cache_Server::start ( void ) +{ - // find signal: - // ------------ - else if ( signal == Cache_Server::FIND_SIGNAL ) { - if ( _debug ) - _out << "CACHE SERVER: FIND SIGNAL FROM RANK " << source << endl; - process_find_signal ( source ); - } - - // insert signal: - // -------------- - else if ( signal == Cache_Server::INSERT_SIGNAL ) { - if ( _debug ) { - _out << "CACHE SERVER: INSERT SIGNAL FROM RANK " - << source; - if ( source == 1 ) - _out << " (POLLSTER)"; - _out << endl; - } - process_insert_signal ( source ); - } - - // number of extern points signal: - // ------------------------------- - else if ( signal == Cache_Server::NB_EP_SIGNAL ) { - if ( _debug ) { - _out << "CACHE SERVER: NB EXTERN POINTS SIGNAL FROM RANK " - << source; - if ( source == 1 ) - _out << " (POLLSTER)"; - _out << endl; - } - int nb_client_extern_pts = _clients_ext_pts[source].size(); - MPI_Rsend ( &nb_client_extern_pts , 1 , MPI_INT , source , - Cache_Server::TAG_NB_EP , MPI_COMM_WORLD ); - } - - // extern point signal: - // -------------------- - else if ( signal == Cache_Server::EP_SIGNAL ) { - if ( _debug ) { - _out << "CACHE SERVER: EXTERN POINT SIGNAL FROM RANK " - << source; - if ( source == 1 ) - _out << " (POLLSTER)"; - _out << endl; - } - process_ep_signal ( source ); - } - - // best feasible point signal: - else if ( signal == Cache_Server::BF_SIGNAL ) { - if ( _debug ) { - _out << "CACHE SERVER: BEST FEASIBLE POINT SIGNAL FROM RANK " - << source; - if ( source == 1 ) - _out << " (POLLSTER)"; - } - process_bf_signal ( source ); + int npm1 = _np-1; + + if ( _rank != npm1 ) + return; + + MPI_Status status; + int nb_stops = 0; + int source; + char signal; + + /*-------------*/ + /* main loop */ + /*-------------*/ + while ( nb_stops != npm1 ) + { + + MPI_Recv ( &signal , 1 , MPI_CHAR , MPI_ANY_SOURCE , + Cache_Server::TAG_SIGNAL , MPI_COMM_WORLD , &status ); + + source = status.MPI_SOURCE; + + // stop signal: + // ------------ + if ( signal == Cache_Server::STOP_SIGNAL ) + { + if ( _debug ) + _out << "CACHE SERVER: STOP SIGNAL FROM RANK " << source << endl; + ++nb_stops; + } + + // find signal: + // ------------ + else if ( signal == Cache_Server::FIND_SIGNAL ) + { + if ( _debug ) + _out << "CACHE SERVER: FIND SIGNAL FROM RANK " << source << endl; + process_find_signal ( source ); + } + + // insert signal: + // -------------- + else if ( signal == Cache_Server::INSERT_SIGNAL ) + { + if ( _debug ) + { + _out << "CACHE SERVER: INSERT SIGNAL FROM RANK " + << source; + if ( source == 1 ) + _out << " (POLLSTER)"; + _out << endl; + } + process_insert_signal ( source ); + } + + // number of extern points signal: + // ------------------------------- + else if ( signal == Cache_Server::NB_EP_SIGNAL ) + { + if ( _debug ) + { + _out << "CACHE SERVER: NB EXTERN POINTS SIGNAL FROM RANK " + << source; + if ( source == 1 ) + _out << " (POLLSTER)"; + _out << endl; + } + int nb_client_extern_pts = _clients_ext_pts[source].size(); + MPI_Rsend ( &nb_client_extern_pts , 1 , MPI_INT , source , + Cache_Server::TAG_NB_EP , MPI_COMM_WORLD ); + } + + // extern point signal: + // -------------------- + else if ( signal == Cache_Server::EP_SIGNAL ) + { + if ( _debug ) + { + _out << "CACHE SERVER: EXTERN POINT SIGNAL FROM RANK " + << source; + if ( source == 1 ) + _out << " (POLLSTER)"; + _out << endl; + } + process_ep_signal ( source ); + } + + // best feasible point signal: + else if ( signal == Cache_Server::BF_SIGNAL ) + { + if ( _debug ) + { + _out << "CACHE SERVER: BEST FEASIBLE POINT SIGNAL FROM RANK " + << source; + if ( source == 1 ) + _out << " (POLLSTER)"; + } + process_bf_signal ( source ); + } } - } } /*---------------------------------*/ /* stop the server (clients) */ /*---------------------------------*/ -void Cache_Server::stop ( void ) const { - - int npm1 = _np-1; - - if ( _rank == npm1 ) - return; - - MPI_Send ( &Cache_Server::STOP_SIGNAL , 1 , MPI_CHAR , - npm1 , Cache_Server::TAG_SIGNAL , MPI_COMM_WORLD ); +void Cache_Server::stop ( void ) const +{ + + int npm1 = _np-1; + + if ( _rank == npm1 ) + return; + + MPI_Send ( &Cache_Server::STOP_SIGNAL , 1 , MPI_CHAR , + npm1 , Cache_Server::TAG_SIGNAL , MPI_COMM_WORLD ); } /*----------------------------------------------*/ /* process the best feasible point signal */ /*----------------------------------------------*/ -void Cache_Server::process_bf_signal ( int source ) const { - - char pt_flag = (_bf) ? '1' : '0'; - - MPI_Rsend ( &pt_flag , 1 , MPI_CHAR , source , - Cache_Server::TAG_BF , MPI_COMM_WORLD ); - - if ( _bf ) { - int n = _bf->size(); - double * rtab = new double[n+2]; - for ( int i = 0 ; i < n ; ++i ) - rtab[i] = (*_bf)[i].value(); - rtab[n] = _bf->get_h().value(); - rtab[n+1] = _bf->get_f().value(); - - MPI_Send ( rtab , n+2 , MPI_DOUBLE , source , - Cache_Server::TAG_X7 , MPI_COMM_WORLD ); - - delete [] rtab; - } - +void Cache_Server::process_bf_signal ( int source ) const +{ + + char pt_flag = (_bf) ? '1' : '0'; + + MPI_Rsend ( &pt_flag , 1 , MPI_CHAR , source , + Cache_Server::TAG_BF , MPI_COMM_WORLD ); + + if ( _bf ) + { + int n = _bf->size(); + double * rtab = new double[n+2]; + for ( int i = 0 ; i < n ; ++i ) + rtab[i] = (*_bf)[i].value(); + rtab[n] = _bf->get_h().value(); + rtab[n+1] = _bf->get_f().value(); + + MPI_Send ( rtab , n+2 , MPI_DOUBLE , source , + Cache_Server::TAG_X7 , MPI_COMM_WORLD ); + + delete [] rtab; + } + } /*---------------------------------------*/ /* process the extern point signal */ /*---------------------------------------*/ -void Cache_Server::process_ep_signal ( int source ) const { - - int nb_pt = ( _clients_ext_pts[source].size() > 0 ) ? 1 : 0; - - MPI_Rsend ( &nb_pt , 1 , MPI_INT , source , - Cache_Server::TAG_EP , MPI_COMM_WORLD ); - - // send and remove the extern point: - if ( nb_pt > 0 ) { - - const Eval_Point * x = *(_clients_ext_pts[source].begin()); - - ++_cache_search_pts; - - // send the point : - int i , n = x->size() , m = x->get_m(); - int itab[5]; - itab[0] = n; - itab[1] = m; - itab[2] = ( x->is_eval_ok() ) ? 1 : 0; - - if ( x->get_signature() && (x->get_signature()->get_mesh()->get_mesh_indices())[0].is_defined() ) +void Cache_Server::process_ep_signal ( int source ) const +{ + + int nb_pt = ( _clients_ext_pts[source].size() > 0 ) ? 1 : 0; + + MPI_Rsend ( &nb_pt , 1 , MPI_INT , source , + Cache_Server::TAG_EP , MPI_COMM_WORLD ); + + // send and remove the extern point: + if ( nb_pt > 0 ) { - itab[3]=1; - itab[4]=static_cast<int>((x->get_signature()->get_mesh()->get_mesh_indices())[0].value()); + + const Eval_Point * x = *(_clients_ext_pts[source].begin()); + + ++_cache_search_pts; + + // send the point : + int i , n = x->size() , m = x->get_m(); + int itab[5]; + itab[0] = n; + itab[1] = m; + itab[2] = ( x->is_eval_ok() ) ? 1 : 0; + + if ( x->get_signature() && (x->get_signature()->get_mesh()->get_mesh_indices())[0].is_defined() ) + { + itab[3]=1; + itab[4]=static_cast<int>((x->get_signature()->get_mesh()->get_mesh_indices())[0].value()); + } + else + itab[3] = itab[4] = 0; + + double * rtab = new double[n+2*m]; + for ( i = 0 ; i < n ; ++i ) + rtab[i] = (*x)[i].value(); + + const Point & bbo = x->get_bb_outputs(); + + for ( i = 0 ; i < m ; ++i ) + if ( bbo[i].is_defined() ) + { + rtab[2*i+n ] = 1.0; + rtab[2*i+n+1] = bbo[i].value(); + } + else + rtab[2*i+n] = rtab[2*i+n+1] = -1.0; + + MPI_Send ( itab , 5 , MPI_INT , source , + Cache_Server::TAG_X5 , MPI_COMM_WORLD ); + + MPI_Send ( rtab , n+2*m , MPI_DOUBLE , source , + Cache_Server::TAG_X6 , MPI_COMM_WORLD ); + + // remove the point: + _clients_ext_pts[source].pop_front(); } - else - itab[3] = itab[4] = 0; - - double * rtab = new double[n+2*m]; - for ( i = 0 ; i < n ; ++i ) - rtab[i] = (*x)[i].value(); - - const Point & bbo = x->get_bb_outputs(); - - for ( i = 0 ; i < m ; ++i ) - if ( bbo[i].is_defined() ) { - rtab[2*i+n ] = 1.0; - rtab[2*i+n+1] = bbo[i].value(); - } - else - rtab[2*i+n] = rtab[2*i+n+1] = -1.0; - - MPI_Send ( itab , 5 , MPI_INT , source , - Cache_Server::TAG_X5 , MPI_COMM_WORLD ); - - MPI_Send ( rtab , n+2*m , MPI_DOUBLE , source , - Cache_Server::TAG_X6 , MPI_COMM_WORLD ); - - // remove the point: - _clients_ext_pts[source].pop_front(); - } } /*-------------------------------*/ /* process the find signal */ /*-------------------------------*/ -void Cache_Server::process_find_signal ( int source ) const { - - MPI_Status status; - int i; - - // receive the point coordinates: - int itab[2]; - MPI_Recv ( itab , 2 , MPI_INT , source , - Cache_Server::TAG_X1 , MPI_COMM_WORLD , &status ); - - int n = itab[0]; - int m = itab[1]; - - double * rtab = new double[n]; - - MPI_Recv ( rtab , n , MPI_DOUBLE , source , - Cache_Server::TAG_X2 , MPI_COMM_WORLD , &status ); - - // create the Eval_Point to search: - Eval_Point * x = new Eval_Point ( n , m ); - - for ( i = 0 ; i < n ; ++i ) - (*x)[i] = rtab[i]; - - delete [] rtab; - - // search in cache, or stop the algorithm: - const Eval_Point * cache_x; - - if ( _max_bbe > 0 && size() >= _max_bbe ) { - Eval_Point * stop_point = new Eval_Point ( n , m ); +void Cache_Server::process_find_signal ( int source ) const +{ + + MPI_Status status; + int i; + + // receive the point coordinates: + int itab[2]; + MPI_Recv ( itab , 2 , MPI_INT , source , + Cache_Server::TAG_X1 , MPI_COMM_WORLD , &status ); + + int n = itab[0]; + int m = itab[1]; + + double * rtab = new double[n]; + + MPI_Recv ( rtab , n , MPI_DOUBLE , source , + Cache_Server::TAG_X2 , MPI_COMM_WORLD , &status ); + + // create the Eval_Point to search: + Eval_Point * x = new Eval_Point ( n , m ); + for ( i = 0 ; i < n ; ++i ) - (*stop_point)[i] = (*x)[i]; - stop_point->set_eval_status ( EVAL_FAIL ); - cache_x = stop_point; - } - else - cache_x = Cache::find ( *x ); - - // cache hit signal : - int cache_hit; - - // point in cache : - if ( cache_x ) { - - delete x; - - cache_hit = 1; - - ++_cache_hits; - - MPI_Rsend ( &cache_hit , 1 , MPI_INT , source , - Cache_Server::TAG_CACHE_HIT , MPI_COMM_WORLD ); - - // bb output values, defined values and eval_ok flag: - rtab = new double[m]; - char * ctab = new char [m+1]; - const Point & bbo = cache_x->get_bb_outputs(); - - for ( i = 0 ; i < m ; ++i ) { - if ( bbo[i].is_defined() ) { - rtab[i] = bbo[i].value(); - ctab[i] = '1'; - } - else { - rtab[i] = INF; - ctab[i] = '0'; - } - } - - ctab[m] = ( cache_x->is_eval_ok() ) ? '1' : '0'; - - MPI_Send ( rtab , m , MPI_DOUBLE , source , - Cache_Server::TAG_BBOR , MPI_COMM_WORLD ); + (*x)[i] = rtab[i]; - MPI_Send ( ctab , m+1 , MPI_CHAR , source , - Cache_Server::TAG_BBOC , MPI_COMM_WORLD ); - delete [] rtab; - delete [] ctab; - - // remove this point from _clients_ext_pts: + + // search in cache, or stop the algorithm: + const Eval_Point * cache_x; + + if ( _max_bbe > 0 && size() >= _max_bbe ) { - list<const Eval_Point *>::iterator - it = _clients_ext_pts[source].begin() , - end = _clients_ext_pts[source].end (); - while ( it != end ) { - if ( *it == cache_x ) { - _clients_ext_pts[source].erase(it); - break; - } - ++it; - } + Eval_Point * stop_point = new Eval_Point ( n , m ); + for ( i = 0 ; i < n ; ++i ) + (*stop_point)[i] = (*x)[i]; + stop_point->set_eval_status ( EVAL_FAIL ); + cache_x = stop_point; } - } - - // point not in cache : - else { - - cache_hit = 0; - - // evaluation in progress ? - if ( _waited_pts ) { - - for ( i = 0 ; i < _np ; ++i ) - if ( _waited_pts[i] && *_waited_pts[i] == *x ) { - cache_hit = -1; - break; - } - - if ( cache_hit == 0 ) - _waited_pts[source] = x; - else - delete x; + else + cache_x = Cache::find ( *x ); + + // cache hit signal : + int cache_hit; + + // point in cache : + if ( cache_x ) + { + + delete x; + + cache_hit = 1; + + ++_cache_hits; + + MPI_Rsend ( &cache_hit , 1 , MPI_INT , source , + Cache_Server::TAG_CACHE_HIT , MPI_COMM_WORLD ); + + // bb output values, defined values and eval_ok flag: + rtab = new double[m]; + char * ctab = new char [m+1]; + const Point & bbo = cache_x->get_bb_outputs(); + + for ( i = 0 ; i < m ; ++i ) + { + if ( bbo[i].is_defined() ) + { + rtab[i] = bbo[i].value(); + ctab[i] = '1'; + } + else + { + rtab[i] = INF; + ctab[i] = '0'; + } + } + + ctab[m] = ( cache_x->is_eval_ok() ) ? '1' : '0'; + + MPI_Send ( rtab , m , MPI_DOUBLE , source , + Cache_Server::TAG_BBOR , MPI_COMM_WORLD ); + + MPI_Send ( ctab , m+1 , MPI_CHAR , source , + Cache_Server::TAG_BBOC , MPI_COMM_WORLD ); + + delete [] rtab; + delete [] ctab; + + // remove this point from _clients_ext_pts: + { + list<const Eval_Point *>::iterator + it = _clients_ext_pts[source].begin() , + end = _clients_ext_pts[source].end (); + while ( it != end ) + { + if ( *it == cache_x ) + { + _clients_ext_pts[source].erase(it); + break; + } + ++it; + } + } } + + // point not in cache : else - delete x; - - MPI_Rsend ( &cache_hit , 1 , MPI_INT , source , - Cache_Server::TAG_CACHE_HIT , MPI_COMM_WORLD ); - } + { + + cache_hit = 0; + + // evaluation in progress ? + if ( _waited_pts ) + { + + for ( i = 0 ; i < _np ; ++i ) + if ( _waited_pts[i] && *_waited_pts[i] == *x ) + { + cache_hit = -1; + break; + } + + if ( cache_hit == 0 ) + _waited_pts[source] = x; + else + delete x; + } + else + delete x; + + MPI_Rsend ( &cache_hit , 1 , MPI_INT , source , + Cache_Server::TAG_CACHE_HIT , MPI_COMM_WORLD ); + } } /*--------------------*/ /* find a point */ /*--------------------*/ -const Eval_Point * Cache_Server::find ( const Eval_Point & x ) const { - - int npm1 = _np-1; - - // server: - if ( _rank == npm1 ) - return Cache::find ( x ); - - // A. search in local cache: - const Eval_Point * cache_x = Cache::find ( x ); - if ( cache_x ) - return cache_x; - - // B. ask the server. - int i , n = x.size() , m = x.get_m(); - int itab[2]; - itab[0] = n; - itab[1] = m; - double * rtab = new double[n]; - for ( i = 0 ; i < n ; ++i ) - rtab[i] = x[i].value(); - - int cache_hit = -1; - MPI_Request req = MPI_REQUEST_NULL; - MPI_Status status; - - while ( cache_hit < 0 ) { - - // B1. send a request for cache_hit: - MPI_Irecv ( &cache_hit , 1 , MPI_INT , npm1 , - Cache_Server::TAG_CACHE_HIT , MPI_COMM_WORLD , &req ); - - // B2. send the find signal: - MPI_Send ( &Cache_Server::FIND_SIGNAL , 1 , MPI_CHAR , - npm1 , Cache_Server::TAG_SIGNAL , MPI_COMM_WORLD ); - - // B3. send the point coordinates: - MPI_Send ( itab , 2 , MPI_INT , npm1 , - Cache_Server::TAG_X1 , MPI_COMM_WORLD ); - MPI_Send ( rtab , n , MPI_DOUBLE , npm1 , - Cache_Server::TAG_X2 , MPI_COMM_WORLD ); +const Eval_Point * Cache_Server::find ( const Eval_Point & x ) const +{ - // B4. wait for the cache_hit request: - MPI_Wait ( &req , &status ); - - // cache hit possible values: - // - // -1: point is being evaluated by another process (wait) - // 0: point not in cache server - // 1: point in cache server - } - - delete [] rtab; - - // C. cache hit: receive the point outputs: - if ( cache_hit == 1 ) { - - // C.1. bb output values and eval status: - rtab = new double[m]; - MPI_Recv ( rtab , m , MPI_DOUBLE , npm1 , - Cache_Server::TAG_BBOR , MPI_COMM_WORLD , &status ); - - char * ctab = new char[m+1]; - MPI_Recv ( ctab , m+1 , MPI_CHAR , npm1 , - Cache_Server::TAG_BBOC , MPI_COMM_WORLD , &status ); - - Point bbo(m); - for ( i = 0 ; i < m ; ++i ) - if ( ctab[i]=='1' ) - bbo[i] = rtab[i]; + int npm1 = _np-1; - delete [] rtab; - - // C.2. eval point construction: - Eval_Point * y = new Eval_Point ( n , m ); - y->set_bb_output ( bbo ); + // server: + if ( _rank == npm1 ) + return Cache::find ( x ); + + // A. search in local cache: + const Eval_Point * cache_x = Cache::find ( x ); + if ( cache_x ) + return cache_x; + + // B. ask the server. + int i , n = x.size() , m = x.get_m(); + int itab[2]; + itab[0] = n; + itab[1] = m; + double * rtab = new double[n]; for ( i = 0 ; i < n ; ++i ) - (*y)[i] = x[i]; - - y->set_eval_status ( (ctab[m]=='1') ? EVAL_OK : EVAL_FAIL ); - - y->set_current_run ( x.get_current_run() ); - - delete [] ctab; - - cache_x = y; - - - // C.3. insertion in local cache: - const_cast<Cache_Server*>(this)->Cache::insert ( *cache_x ); - } - - return cache_x; + rtab[i] = x[i].value(); + + int cache_hit = -1; + MPI_Request req = MPI_REQUEST_NULL; + MPI_Status status; + + while ( cache_hit < 0 ) + { + + // B1. send a request for cache_hit: + MPI_Irecv ( &cache_hit , 1 , MPI_INT , npm1 , + Cache_Server::TAG_CACHE_HIT , MPI_COMM_WORLD , &req ); + + // B2. send the find signal: + MPI_Send ( &Cache_Server::FIND_SIGNAL , 1 , MPI_CHAR , + npm1 , Cache_Server::TAG_SIGNAL , MPI_COMM_WORLD ); + + // B3. send the point coordinates: + MPI_Send ( itab , 2 , MPI_INT , npm1 , + Cache_Server::TAG_X1 , MPI_COMM_WORLD ); + MPI_Send ( rtab , n , MPI_DOUBLE , npm1 , + Cache_Server::TAG_X2 , MPI_COMM_WORLD ); + + // B4. wait for the cache_hit request: + MPI_Wait ( &req , &status ); + + // cache hit possible values: + // + // -1: point is being evaluated by another process (wait) + // 0: point not in cache server + // 1: point in cache server + } + + delete [] rtab; + + // C. cache hit: receive the point outputs: + if ( cache_hit == 1 ) + { + + // C.1. bb output values and eval status: + rtab = new double[m]; + MPI_Recv ( rtab , m , MPI_DOUBLE , npm1 , + Cache_Server::TAG_BBOR , MPI_COMM_WORLD , &status ); + + char * ctab = new char[m+1]; + MPI_Recv ( ctab , m+1 , MPI_CHAR , npm1 , + Cache_Server::TAG_BBOC , MPI_COMM_WORLD , &status ); + + Point bbo(m); + for ( i = 0 ; i < m ; ++i ) + if ( ctab[i]=='1' ) + bbo[i] = rtab[i]; + + delete [] rtab; + + // C.2. eval point construction: + Eval_Point * y = new Eval_Point ( n , m ); + y->set_bb_output ( bbo ); + for ( i = 0 ; i < n ; ++i ) + (*y)[i] = x[i]; + + y->set_eval_status ( (ctab[m]=='1') ? EVAL_OK : EVAL_FAIL ); + + y->set_current_run ( x.get_current_run() ); + + delete [] ctab; + + cache_x = y; + + + // C.3. insertion in local cache: + const_cast<Cache_Server*>(this)->Cache::insert ( *cache_x ); + } + + return cache_x; } /*------------------------------------*/ /* process the insertion signal */ /*------------------------------------*/ -void Cache_Server::process_insert_signal ( int source ) { - - if ( _waited_pts && _waited_pts[source] ) { - delete _waited_pts[source]; - _waited_pts[source] = NULL; - } - - MPI_Status status; - - // receive the evaluation point: - int itab[7]; - MPI_Recv ( itab , 7 , MPI_INT , source , - Cache_Server::TAG_X3 , MPI_COMM_WORLD , &status ); - - int n = itab[0]; - int m = itab[1]; - - double * rtab = new double[n+2*m+2]; - - MPI_Recv ( rtab , n+2*m+2 , MPI_DOUBLE , source , - Cache_Server::TAG_X4 , MPI_COMM_WORLD , &status ); - - // create the Eval_Point to insert: - Eval_Point * x = new Eval_Point ( n , m ); - - int i; - for ( i = 0 ; i < n ; ++i ) - (*x)[i] = rtab[i]; - - for ( i = 0 ; i < m ; ++i ) - if ( rtab[2*i+n] > 0 ) - x->set_bb_output ( i , rtab[2*i+n+1] ); - - if ( itab[5] == 1 ) - x->set_f ( rtab[n+2*m ] ); - - if ( itab[6] == 1 ) - x->set_h ( rtab[n+2*m+1] ); - - delete [] rtab; - - x->set_eval_status ( ( itab[2] == 1 ) ? EVAL_OK : EVAL_FAIL ); - - // Eval_Point insertion in cache and multiple_evals detection: - const Eval_Point * cache_x = Cache::find ( *x ); - if ( cache_x ) { - ++_multiple_evals; - delete x; - x = const_cast<Eval_Point *>(cache_x); - } - else - Cache::insert ( *x ); - - // update the best points: - update_best_points ( *x , source ); +void Cache_Server::process_insert_signal ( int source ) +{ + + if ( _waited_pts && _waited_pts[source] ) + { + delete _waited_pts[source]; + _waited_pts[source] = NULL; + } + + MPI_Status status; + + // receive the evaluation point: + int itab[7]; + MPI_Recv ( itab , 7 , MPI_INT , source , + Cache_Server::TAG_X3 , MPI_COMM_WORLD , &status ); + + int n = itab[0]; + int m = itab[1]; + + double * rtab = new double[n+2*m+2]; + + MPI_Recv ( rtab , n+2*m+2 , MPI_DOUBLE , source , + Cache_Server::TAG_X4 , MPI_COMM_WORLD , &status ); + + // create the Eval_Point to insert: + Eval_Point * x = new Eval_Point ( n , m ); + + int i; + for ( i = 0 ; i < n ; ++i ) + (*x)[i] = rtab[i]; + + for ( i = 0 ; i < m ; ++i ) + if ( rtab[2*i+n] > 0 ) + x->set_bb_output ( i , rtab[2*i+n+1] ); + + if ( itab[5] == 1 ) + x->set_f ( rtab[n+2*m ] ); + + if ( itab[6] == 1 ) + x->set_h ( rtab[n+2*m+1] ); + + delete [] rtab; + + x->set_eval_status ( ( itab[2] == 1 ) ? EVAL_OK : EVAL_FAIL ); + + // Eval_Point insertion in cache and multiple_evals detection: + const Eval_Point * cache_x = Cache::find ( *x ); + if ( cache_x ) + { + ++_multiple_evals; + delete x; + x = const_cast<Eval_Point *>(cache_x); + } + else + { + Cache::insert ( *x ); + write_his_file ( *x ); + } + + // update the best points: + update_best_points ( *x , source ); } /*--------------------*/ /* insert a point */ /*--------------------*/ -void Cache_Server::insert ( const NOMAD::Eval_Point & x ) { - - // insertion in local cache : - Cache::insert ( x ); - - int npm1 = _np-1; - if ( _rank == npm1 ) - return; - - // insert signal : - MPI_Send ( &Cache_Server::INSERT_SIGNAL , 1 , MPI_CHAR , - npm1 , Cache_Server::TAG_SIGNAL , MPI_COMM_WORLD ); - - // send the point : - int i , n = x.size() , m = x.get_m(); - int itab[7]; - itab[0] = n; - itab[1] = m; - itab[2] = ( x.is_eval_ok() ) ? 1 : 0; - - if ( x.get_signature() && (x.get_signature()->get_mesh()->get_mesh_indices())[0].is_defined() ) +void Cache_Server::insert ( const NOMAD::Eval_Point & x ) +{ + + // insertion in local cache : + Cache::insert ( x ); + + int npm1 = _np-1; + if ( _rank == npm1 ) + return; + + // insert signal : + MPI_Send ( &Cache_Server::INSERT_SIGNAL , 1 , MPI_CHAR , + npm1 , Cache_Server::TAG_SIGNAL , MPI_COMM_WORLD ); + + // send the point : + int i , n = x.size() , m = x.get_m(); + int itab[7]; + itab[0] = n; + itab[1] = m; + itab[2] = ( x.is_eval_ok() ) ? 1 : 0; + + if ( x.get_signature() && (x.get_signature()->get_mesh()->get_mesh_indices())[0].is_defined() ) { itab[3]=1; itab[4]=static_cast<int>((x.get_signature()->get_mesh()->get_mesh_indices())[0].value()); } - else - itab[3] = itab[4] = 0; - - double * rtab = new double[n+2*m+2]; - for ( i = 0 ; i < n ; ++i ) - rtab[i] = x[i].value(); - - const Point & bbo = x.get_bb_outputs(); - - for ( i = 0 ; i < m ; ++i ) - if ( bbo[i].is_defined() ) { - rtab[2*i+n ] = 1.0; - rtab[2*i+n+1] = bbo[i].value(); + else + itab[3] = itab[4] = 0; + + double * rtab = new double[n+2*m+2]; + for ( i = 0 ; i < n ; ++i ) + rtab[i] = x[i].value(); + + const Point & bbo = x.get_bb_outputs(); + + for ( i = 0 ; i < m ; ++i ) + if ( bbo[i].is_defined() ) + { + rtab[2*i+n ] = 1.0; + rtab[2*i+n+1] = bbo[i].value(); + } + else + rtab[2*i+n] = rtab[2*i+n+1] = -1.0; + + // f and h values: + if ( x.get_f().is_defined() ) + { + itab[5 ] = 1; + rtab[n+2*m] = x.get_f().value(); } else - rtab[2*i+n] = rtab[2*i+n+1] = -1.0; - - // f and h values: - if ( x.get_f().is_defined() ) { - itab[5 ] = 1; - rtab[n+2*m] = x.get_f().value(); - } - else { - itab[5 ] = 0; - rtab[n+2*m] = INF; - } - if ( x.get_h().is_defined() ) { - itab[6 ] = 1; - rtab[n+2*m+1] = x.get_h().value(); - } - else { - itab[6 ] = 0; - rtab[n+2*m+1] = INF; - } - - MPI_Send ( itab , 7 , MPI_INT , npm1 , - Cache_Server::TAG_X3 , MPI_COMM_WORLD ); - - MPI_Send ( rtab , n+2*m+2 , MPI_DOUBLE , npm1 , - Cache_Server::TAG_X4 , MPI_COMM_WORLD ); - - delete [] rtab; + { + itab[5 ] = 0; + rtab[n+2*m] = INF; + } + if ( x.get_h().is_defined() ) + { + itab[6 ] = 1; + rtab[n+2*m+1] = x.get_h().value(); + } + else + { + itab[6 ] = 0; + rtab[n+2*m+1] = INF; + } + + MPI_Send ( itab , 7 , MPI_INT , npm1 , + Cache_Server::TAG_X3 , MPI_COMM_WORLD ); + + MPI_Send ( rtab , n+2*m+2 , MPI_DOUBLE , npm1 , + Cache_Server::TAG_X4 , MPI_COMM_WORLD ); + + delete [] rtab; } /*--------------------------------------*/ /* get and remove an extern point */ /*--------------------------------------*/ -const Eval_Point * Cache_Server::get_and_remove_extern_point ( void ) const { - - int npm1 = _np-1; - - if ( _rank == npm1 ) - return NULL; - - // extern point from the client: - // ----------------------------- - if ( Cache::get_nb_extern_points() > 0 ) - return Cache::get_and_remove_extern_point(); - - // extern point from the server: - // ----------------------------- - - int nb_pt; - - // send a request for an extern point: - MPI_Request req; - MPI_Irecv ( &nb_pt , 1 , MPI_INT , npm1 , - Cache_Server::TAG_EP , MPI_COMM_WORLD , &req ); - - // extern points signal : - MPI_Send ( &Cache_Server::EP_SIGNAL , 1 , MPI_CHAR , - npm1 , Cache_Server::TAG_SIGNAL , MPI_COMM_WORLD ); - - // wait for the request: - MPI_Status status; - MPI_Wait ( &req , &status ); - - if ( nb_pt == 0 ) - return NULL; - - // receive the extern point: - int itab[5]; - MPI_Recv ( itab , 5 , MPI_INT , npm1 , - Cache_Server::TAG_X5 , MPI_COMM_WORLD , &status ); - - int n = itab[0]; - int m = itab[1]; - - double * rtab = new double[n+2*m]; - - MPI_Recv ( rtab , n+2*m , MPI_DOUBLE , npm1 , - Cache_Server::TAG_X6 , MPI_COMM_WORLD , &status ); - - // create the Eval_Point: - Eval_Point * x = new Eval_Point ( n , m ); - - int i; - for ( i = 0 ; i < n ; ++i ) - (*x)[i] = rtab[i]; - - for ( i = 0 ; i < m ; ++i ) - if ( rtab[2*i+n] > 0 ) - x->set_bb_output ( i , rtab[2*i+n+1] ); - - delete [] rtab; - - x->set_eval_status ( ( itab[2] == 1 ) ? EVAL_OK : EVAL_FAIL ); - - // insert the point in local cache: - const Eval_Point * cache_x = Cache::find ( *x ); - if ( cache_x ) { - delete x; - return cache_x; - } - - x->set_current_run ( true ); - const_cast<Cache_Server*>(this)->Cache::insert ( *x ); - x->set_current_run ( false ); - - return x; -} - -/*---------------------------------------*/ -/* get the number of extern points */ -/*---------------------------------------*/ -int Cache_Server::get_nb_extern_points ( void ) const { - - int nb_client_extern_pts = Cache::get_nb_extern_points(); - int nb_server_extern_pts = 0; - int npm1 = _np-1; - - if ( _rank != npm1 ) { - - // send a request for the number of extern points: +const Eval_Point * Cache_Server::get_and_remove_extern_point ( void ) const +{ + + int npm1 = _np-1; + + if ( _rank == npm1 ) + return NULL; + + // extern point from the client: + // ----------------------------- + if ( Cache::get_nb_extern_points() > 0 ) + return Cache::get_and_remove_extern_point(); + + // extern point from the server: + // ----------------------------- + + int nb_pt; + + // send a request for an extern point: MPI_Request req; - MPI_Irecv ( &nb_server_extern_pts , 1 , MPI_INT , npm1 , - Cache_Server::TAG_NB_EP , MPI_COMM_WORLD , &req ); - - // number of extern points signal : - MPI_Send ( &Cache_Server::NB_EP_SIGNAL , 1 , MPI_CHAR , - npm1 , Cache_Server::TAG_SIGNAL , MPI_COMM_WORLD ); - + MPI_Irecv ( &nb_pt , 1 , MPI_INT , npm1 , + Cache_Server::TAG_EP , MPI_COMM_WORLD , &req ); + + // extern points signal : + MPI_Send ( &Cache_Server::EP_SIGNAL , 1 , MPI_CHAR , + npm1 , Cache_Server::TAG_SIGNAL , MPI_COMM_WORLD ); + // wait for the request: MPI_Status status; MPI_Wait ( &req , &status ); - } + + if ( nb_pt == 0 ) + return NULL; + + // receive the extern point: + int itab[5]; + MPI_Recv ( itab , 5 , MPI_INT , npm1 , + Cache_Server::TAG_X5 , MPI_COMM_WORLD , &status ); + + int n = itab[0]; + int m = itab[1]; + + double * rtab = new double[n+2*m]; + + MPI_Recv ( rtab , n+2*m , MPI_DOUBLE , npm1 , + Cache_Server::TAG_X6 , MPI_COMM_WORLD , &status ); + + // create the Eval_Point: + Eval_Point * x = new Eval_Point ( n , m ); + + int i; + for ( i = 0 ; i < n ; ++i ) + (*x)[i] = rtab[i]; + + for ( i = 0 ; i < m ; ++i ) + if ( rtab[2*i+n] > 0 ) + x->set_bb_output ( i , rtab[2*i+n+1] ); + + delete [] rtab; + + x->set_eval_status ( ( itab[2] == 1 ) ? EVAL_OK : EVAL_FAIL ); + + // insert the point in local cache: + const Eval_Point * cache_x = Cache::find ( *x ); + if ( cache_x ) + { + delete x; + return cache_x; + } + + x->set_current_run ( true ); + const_cast<Cache_Server*>(this)->Cache::insert ( *x ); + x->set_current_run ( false ); + + return x; +} - return nb_client_extern_pts + nb_server_extern_pts; +/*---------------------------------------*/ +/* get the number of extern points */ +/*---------------------------------------*/ +int Cache_Server::get_nb_extern_points ( void ) const +{ + + int nb_client_extern_pts = Cache::get_nb_extern_points(); + int nb_server_extern_pts = 0; + int npm1 = _np-1; + + if ( _rank != npm1 ) + { + + // send a request for the number of extern points: + MPI_Request req; + MPI_Irecv ( &nb_server_extern_pts , 1 , MPI_INT , npm1 , + Cache_Server::TAG_NB_EP , MPI_COMM_WORLD , &req ); + + // number of extern points signal : + MPI_Send ( &Cache_Server::NB_EP_SIGNAL , 1 , MPI_CHAR , + npm1 , Cache_Server::TAG_SIGNAL , MPI_COMM_WORLD ); + + // wait for the request: + MPI_Status status; + MPI_Wait ( &req , &status ); + } + + return nb_client_extern_pts + nb_server_extern_pts; } /*---------------------------------*/ /* display the extern points */ /*---------------------------------*/ -void Cache_Server::display_extern_pts ( const Display & out ) const { - - int npm1 = _np-1; - - // server: - // ------- - if ( _rank == npm1 ) { - - list<const Eval_Point*>::const_iterator it; - out << endl << open_block ("Clients extern points"); - - for ( int i = 0 ; i < npm1 ; ++i ) { - out.open_block ( "client #"+itos(i) ); - for ( it = _clients_ext_pts[i].begin() ; - it != _clients_ext_pts[i].end () ; - ++it ) { - out << "#" << (*it)->get_tag() << " ( "; - (*it)->Point::display ( out ); - out << " ) " << " [" - << (*it)->get_bb_outputs() << " ] f=" - << (*it)->get_f() << " h=" - << (*it)->get_h() << endl; - } - out.close_block(); +void Cache_Server::display_extern_pts ( const Display & out ) const +{ + + int npm1 = _np-1; + + // server: + // ------- + if ( _rank == npm1 ) + { + + list<const Eval_Point*>::const_iterator it; + out << endl << open_block ("Clients extern points"); + + for ( int i = 0 ; i < npm1 ; ++i ) + { + out.open_block ( "client #"+itos(i) ); + for ( it = _clients_ext_pts[i].begin() ; + it != _clients_ext_pts[i].end () ; + ++it ) + { + out << "#" << (*it)->get_tag() << " ( "; + (*it)->Point::display ( out ); + out << " ) " << " [" + << (*it)->get_bb_outputs() << " ] f=" + << (*it)->get_f() << " h=" + << (*it)->get_h() << endl; + } + out.close_block(); + } } - } - - // clients: - else { - - out << endl - << open_block ( "Process #" + itos(_rank) + ": extern points" ); - - out << "number of points = " - << get_nb_extern_points() << endl; - - const Eval_Point * extern_pt = get_and_remove_extern_point(); - - while ( extern_pt ) { - - out << "#" << extern_pt->get_tag() << " ( "; - extern_pt->Point::display ( out ); - out << " ) " << " [" - << extern_pt->get_bb_outputs() << " ] f=" - << extern_pt->get_f() << " h=" - << extern_pt->get_h() << endl; - - extern_pt = get_and_remove_extern_point(); + + // clients: + else + { + + out << endl + << open_block ( "Process #" + itos(_rank) + ": extern points" ); + + out << "number of points = " + << get_nb_extern_points() << endl; + + const Eval_Point * extern_pt = get_and_remove_extern_point(); + + while ( extern_pt ) + { + + out << "#" << extern_pt->get_tag() << " ( "; + extern_pt->Point::display ( out ); + out << " ) " << " [" + << extern_pt->get_bb_outputs() << " ] f=" + << extern_pt->get_f() << " h=" + << extern_pt->get_h() << endl; + + extern_pt = get_and_remove_extern_point(); + } } - } - out << close_block() << endl; + out << close_block() << endl; } /*--------------------------------------*/ /* update and display the best points */ /*--------------------------------------*/ void Cache_Server::update_best_points ( const Eval_Point & x , - int source ) { - const Double & f = x.get_f(); - const Double & h = x.get_h(); - - if ( !f.is_defined() || !h.is_defined() ) - return; - - int i; - bool add_x = false; - - // feasible: - if ( h <= _h_min ) { - - // new best feasible point: - if ( !_bf || f < _bf->get_f() ) { - _bf = &x; - add_x = true; - display_current_solution(); - } - } - - // infeasible: - else { - if ( !_bi1 || h < _bi1->get_h() ) { - _bi1 = &x; - add_x = true; + int source ) +{ + const Double & f = x.get_f(); + const Double & h = x.get_h(); + + if ( !f.is_defined() || !h.is_defined() ) + return; + + int i; + bool add_x = false; + + // feasible: + if ( h <= _h_min ) + { + + // new best feasible point: + if ( !_bf || f < _bf->get_f() ) + { + _bf = &x; + add_x = true; + display_current_solution(); + } } - if ( !_bi2 || f < _bi2->get_f() ) { - _bi2 = &x; - add_x = true; + + // infeasible: + else + { + if ( !_bi1 || h < _bi1->get_h() ) + { + _bi1 = &x; + add_x = true; + } + if ( !_bi2 || f < _bi2->get_f() ) + { + _bi2 = &x; + add_x = true; + } } - } - - if ( add_x ) - for ( i = 0 ; i < _np-1 ; ++i ) - if ( i != source ) - _clients_ext_pts[i].push_front ( &x ); + + if ( add_x ) + for ( i = 0 ; i < _np-1 ; ++i ) + if ( i != source ) + _clients_ext_pts[i].push_front ( &x ); } /*-----------------------------------------*/ /* display the current best solution */ /*-----------------------------------------*/ -void Cache_Server::display_current_solution ( void ) const { - if ( _rank != _np-1 || !_bf ) - return; - if ( _debug ) - _out << "CACHE SERVER: CURRENT SOLUTION: \t"; - _out << _clock.get_real_time() << "\t" - << size() << "\t" << _bf->get_f() << endl; +void Cache_Server::display_current_solution ( void ) const +{ + if ( _rank != _np-1 || !_bf ) + return; + if ( _debug ) + _out << "CACHE SERVER: CURRENT SOLUTION: \t"; + _out << _clock.get_real_time() << "\t" + << size() << "\t" << _bf->get_f() << endl; } /*-------------------------------*/ /* display the best points */ /*-------------------------------*/ -void Cache_Server::display_best_points ( const Display & out ) const { - if ( _rank != _np-1 ) - return; - - // display the last solution: - display_current_solution(); - - // stats: - out << "evaluations: " << size() << endl - << "cache hits : " << _cache_hits << endl; - - // best feasible solution: - out << "best feasible solution: "; - if ( _bf ) { - out << "x=( "; - _bf->Point::display(out); - out << " )" - << " F(x)=[ " << _bf->get_bb_outputs() << " ] h=" - << _bf->get_h() << " f=" << _bf->get_f() << endl; - } - else { +void Cache_Server::display_best_points ( const Display & out ) const +{ + if ( _rank != _np-1 ) + return; + + // display the last solution: + display_current_solution(); + + // stats: + out << "evaluations: " << size() << endl + << "cache hits : " << _cache_hits << endl; + + // best feasible solution: + out << "best feasible solution: "; + if ( _bf ) + { + out << "x=( "; + _bf->Point::display(out); + out << " )" + << " F(x)=[ " << _bf->get_bb_outputs() << " ] h=" + << _bf->get_h() << " f=" << _bf->get_f() << endl; + } + else + { + + out << "NULL" << endl; + + // best infeasible solutions: + if ( _bi1 ) + { + out << "best infeas. sol. #1 : x=( "; + _bi1->Point::display(out); + out << " )" + << " F(x)=[ " << _bi1->get_bb_outputs() << " ] h=" + << _bi1->get_h() << " f=" << _bi1->get_f() << endl; + } + + if ( _bi2 && _bi2 != _bi1 ) + { + out << "best infeas. sol. #2 : x=( "; + _bi2->Point::display(out); + out << " )" + << " F(x)=[ " << _bi2->get_bb_outputs() << " ] h=" + << _bi2->get_h() << " f=" << _bi2->get_f() << endl; + } + } +} - out << "NULL" << endl; - // best infeasible solutions: - if ( _bi1 ) { - out << "best infeas. sol. #1 : x=( "; - _bi1->Point::display(out); - out << " )" - << " F(x)=[ " << _bi1->get_bb_outputs() << " ] h=" - << _bi1->get_h() << " f=" << _bi1->get_f() << endl; - } +void Cache_Server::write_his_file ( const NOMAD::Eval_Point & x ) const +{ - if ( _bi2 && _bi2 != _bi1 ) { - out << "best infeas. sol. #2 : x=( "; - _bi2->Point::display(out); - out << " )" - << " F(x)=[ " << _bi2->get_bb_outputs() << " ] h=" - << _bi2->get_h() << " f=" << _bi2->get_f() << endl; + if ( ! _history_file.empty() ) + { + std::ofstream fout; + + fout.open ( _history_file.c_str() , std::ios::app ); + + cout << "about to write in history file ..." ; + + if ( !fout.fail() ) + { + fout.setf ( std::ios::fixed ); + fout.precision ( NOMAD::DISPLAY_PRECISION_BB ); + + x.Point::display ( fout , " " , -1 , -1 ); + fout << " "; + x.get_bb_outputs().Point::display ( fout , " " , -1 , -1 ); + fout << std::endl; + + cout << " done" <<endl; + fout.close(); + } + else + { + cout << "Warning ( Cache_Server.cpp, line " << __LINE__ + << "): could not update the history" + << " in \'" + << _history_file << "\'" << std::endl << std::endl; + } + } - } + } diff --git a/tools/PSD-MADS/Cache_Server.hpp b/tools/PSD-MADS/Cache_Server.hpp index 7de0e0f7f52bb8426b01cbeee93aa35f020ccd0f..aff140cff12227204bbeaed7204c06accef25a9c 100644 --- a/tools/PSD-MADS/Cache_Server.hpp +++ b/tools/PSD-MADS/Cache_Server.hpp @@ -8,112 +8,119 @@ using namespace NOMAD; using namespace std; // Cache server: -class Cache_Server : public Cache { - +class Cache_Server : public Cache +{ + private: - - int _rank; // process rank - int _np; // number of processes - - bool _debug; // debug display flag - - Clock _clock; // clock - - Double _h_min; // h_min (min feasibility) - int _max_bbe; // max number of bb evaluations - - const Eval_Point * _bf; // best points - const Eval_Point * _bi1; - const Eval_Point * _bi2; - - Eval_Point * _stop_point; // stopping point - - mutable int _multiple_evals; // number of multiple evaluations - mutable int _cache_hits; // number of cache hits - mutable int _cache_search_pts; // number of cache search points - - Point ** _waited_pts; // list of points beeing evaluated - list<const Eval_Point*> * _clients_ext_pts; // replaces _extern_pts - - // process the best feasible point signal: - void process_bf_signal ( int source ) const; - - // process the extern point signal: - void process_ep_signal ( int source ) const; - - // process the find signal: - void process_find_signal ( int source ) const; - - // process the insertion signal: - void process_insert_signal ( int source ); - - // update and display the best points: - void update_best_points ( const Eval_Point & x , int source ); - + + int _rank; // process rank + int _np; // number of processes + + bool _debug; // debug display flag + + Clock _clock; // clock + + Double _h_min; // h_min (min feasibility) + int _max_bbe; // max number of bb evaluations + + const Eval_Point * _bf; // best points + const Eval_Point * _bi1; + const Eval_Point * _bi2; + + Eval_Point * _stop_point; // stopping point + + mutable int _multiple_evals; // number of multiple evaluations + mutable int _cache_hits; // number of cache hits + mutable int _cache_search_pts; // number of cache search points + + Point ** _waited_pts; // list of points beeing evaluated + list<const Eval_Point*> * _clients_ext_pts; // replaces _extern_pts + + string _history_file; + + // process the best feasible point signal: + void process_bf_signal ( int source ) const; + + // process the extern point signal: + void process_ep_signal ( int source ) const; + + // process the find signal: + void process_find_signal ( int source ) const; + + // process the insertion signal: + void process_insert_signal ( int source ); + + // update and display the best points: + void update_best_points ( const Eval_Point & x , int source ); + public: - - static const int TAG_SIGNAL; - static const int TAG_CACHE_HIT; - static const int TAG_X1; - static const int TAG_X2; - static const int TAG_X3; - static const int TAG_X4; - static const int TAG_X5; - static const int TAG_X6; - static const int TAG_X7; - static const int TAG_BBOR; - static const int TAG_BBOC; - static const int TAG_NB_EP; - static const int TAG_EP; - static const int TAG_BF; - static char STOP_SIGNAL; - static char FIND_SIGNAL; - static char INSERT_SIGNAL; - static char NB_EP_SIGNAL; - static char EP_SIGNAL; - static char BF_SIGNAL; - - // Constructor: - Cache_Server ( const Display & out , - int rank , - int np , - const Double & h_min , - int max_bbe , - bool allow_multiple_evals , - bool debug ); - - // Destructor: - virtual ~Cache_Server ( void ); - - // Start the server: - void start ( void ); - - // Stop the server: - void stop ( void ) const; - - // Display the clients extern points: - void display_extern_pts ( void ) const { display_extern_pts(_out); } - void display_extern_pts ( const Display & out ) const; - - // Display the best points: - void display_best_points ( void ) const { display_best_points(_out); } - void display_best_points ( const Display & out ) const; - - // Display the current best solution: - void display_current_solution ( void ) const; - - // Find a point: - virtual const Eval_Point * find ( const Eval_Point & x ) const; - - // Insert a point: - virtual void insert ( const NOMAD::Eval_Point & x ); - - // Get the number of extern points: - virtual int get_nb_extern_points ( void ) const; - - // Get and remove an extern point: - virtual const Eval_Point * get_and_remove_extern_point ( void ) const; - + + static const int TAG_SIGNAL; + static const int TAG_CACHE_HIT; + static const int TAG_X1; + static const int TAG_X2; + static const int TAG_X3; + static const int TAG_X4; + static const int TAG_X5; + static const int TAG_X6; + static const int TAG_X7; + static const int TAG_BBOR; + static const int TAG_BBOC; + static const int TAG_NB_EP; + static const int TAG_EP; + static const int TAG_BF; + static char STOP_SIGNAL; + static char FIND_SIGNAL; + static char INSERT_SIGNAL; + static char NB_EP_SIGNAL; + static char EP_SIGNAL; + static char BF_SIGNAL; + + // Constructor: + Cache_Server ( const Display & out , + int rank , + int np , + const Double & h_min , + int max_bbe , + const string & history_file , + bool allow_multiple_evals , + bool debug ); + + // Destructor: + virtual ~Cache_Server ( void ); + + // Start the server: + void start ( void ); + + // Stop the server: + void stop ( void ) const; + + // Display the clients extern points: + void display_extern_pts ( void ) const { display_extern_pts(_out); } + void display_extern_pts ( const Display & out ) const; + + // Display the best points: + void display_best_points ( void ) const { display_best_points(_out); } + void display_best_points ( const Display & out ) const; + + // Write the history file + void write_his_file ( const NOMAD::Eval_Point & x ) const; + + // Display the current best solution: + void display_current_solution ( void ) const; + + // Find a point: + virtual const Eval_Point * find ( const Eval_Point & x ) const; + + // Insert a point: + virtual void insert ( const NOMAD::Eval_Point & x ); + + // Get the number of extern points: + virtual int get_nb_extern_points ( void ) const; + + // Get and remove an extern point: + virtual const Eval_Point * get_and_remove_extern_point ( void ) const; + }; diff --git a/tools/PSD-MADS/Master_Slaves.cpp b/tools/PSD-MADS/Master_Slaves.cpp index 52c5901c64b641f0d230b497955ebd7d58d610cc..08677610a90bdf730f93d88e27acb78487628010 100644 --- a/tools/PSD-MADS/Master_Slaves.cpp +++ b/tools/PSD-MADS/Master_Slaves.cpp @@ -18,7 +18,8 @@ char Master_Slaves::OPTI_DATA_SIGNAL = 'D'; /*--------------------------------*/ /* start the master (process 0) */ /*--------------------------------*/ -void Master_Slaves::start ( void ) const { +void Master_Slaves::start ( void ) const +{ if ( _rank != 0 ) return; @@ -31,19 +32,22 @@ void Master_Slaves::start ( void ) const { int pollster_mesh_index = 0; bool stop_algo = false; double * best_feasible = NULL; + double * best_infeasible = new double [n+2]; // the first best infeasible point is initialized with x0: - double * best_infeasible = new double [n+2]; const Point * x0 = (_p.get_x0s())[0]; for ( int i = 0 ; i < n ; ++i ) best_infeasible[i] = (*x0)[i].value(); + best_infeasible[n ] = INF; best_infeasible[n+1] = INF; + /*-------------*/ /* main loop */ /*-------------*/ - while ( nb_stops != _np-2 ) { + while ( nb_stops != _np-2 ) + { MPI_Recv ( &signal , 1 , MPI_CHAR , MPI_ANY_SOURCE , Master_Slaves::TAG_SIGNAL , MPI_COMM_WORLD , &status ); @@ -52,8 +56,10 @@ void Master_Slaves::start ( void ) const { // stop signal: // ------------ - if ( signal == Master_Slaves::STOP_SIGNAL ) { - if ( _debug ) { + if ( signal == Master_Slaves::STOP_SIGNAL ) + { + if ( _debug ) + { _p.out() << "MASTER: STOP SIGNAL FROM RANK " << source; if ( source == 1 ) _p.out() << " (POLLSTER)"; @@ -64,8 +70,10 @@ void Master_Slaves::start ( void ) const { // optimization data signal: // ------------------------- - else if ( signal == Master_Slaves::OPTI_DATA_SIGNAL ) { - if ( _debug ) { + else if ( signal == Master_Slaves::OPTI_DATA_SIGNAL ) + { + if ( _debug ) + { _p.out() << "MASTER: receive optimization data request from slave " << source; if ( source == 1 ) @@ -82,25 +90,30 @@ void Master_Slaves::start ( void ) const { // optimization result signal: // --------------------------- - else if ( signal == Master_Slaves::OPTI_RES_SIGNAL ) { - if ( _debug ) { + else if ( signal == Master_Slaves::OPTI_RES_SIGNAL ) + { + if ( _debug ) + { _p.out() << "MASTER: receive optimization result from slave " << source; - if ( source == 1 ) - _p.out() << " (POLLSTER)"; - _p.out() << endl; + } // pollster: if ( source == 1 ) + { receive_optimization_result ( pollster_mesh_index , stop_algo , best_feasible , best_infeasible , source ); + if ( _debug && best_feasible ) + _p.out() << "(POLLSTER): NEW_F" << best_feasible[n+1] <<endl; + } // other slaves: - else { + else + { int tmp1; bool tmp2; receive_optimization_result ( tmp1 , @@ -108,7 +121,13 @@ void Master_Slaves::start ( void ) const { best_feasible , best_infeasible , source ); + if ( _debug && best_feasible ) + _p.out() << ": NEW_F" << best_feasible[n+1] <<endl; + } + if ( _debug ) + _p.out() << endl; + } } @@ -121,7 +140,8 @@ void Master_Slaves::start ( void ) const { /*------------------------------------------*/ /* stop the master (processes 1 to _np-2) */ /*------------------------------------------*/ -void Master_Slaves::stop ( void ) const { +void Master_Slaves::stop ( void ) const +{ if ( _rank == 0 || _rank == _np-1 ) return; @@ -132,7 +152,8 @@ void Master_Slaves::stop ( void ) const { /*----------------------------------------*/ /* MADS run */ /*----------------------------------------*/ -void Master_Slaves::mads_run ( Cache & cache ) { +void Master_Slaves::mads_run ( Cache & cache , Cache & init_cache ) +{ const Eval_Point * best_feasible = NULL; const Eval_Point * best_infeasible = NULL; @@ -148,16 +169,18 @@ void Master_Slaves::mads_run ( Cache & cache ) { /*---------------------*/ /* main loop */ /*---------------------*/ - while ( !stop_algo ) { + while ( !stop_algo ) + { best_feasible = NULL; best_infeasible = NULL; // Seed: - _p.set_SEED ( 99 * _rank + 20 * run_index ); + RNG::set_seed ( 99 * _rank + 20 * run_index ); // first run: - if ( run_index == 0 ) { + if ( run_index == 0 ) + { // max number of evaluations for regular slaves: if ( _rank != 1 ) @@ -175,16 +198,18 @@ void Master_Slaves::mads_run ( Cache & cache ) { /*------------------*/ /* pollster slave */ /*------------------*/ - if ( _rank == 1 ) { + if ( _rank == 1 ) + { + + bool cache_file_init_success = false; stop_type stop_reason = UNKNOWN_STOP_REASON; - + _p.check(); // must do check to get a valid signature _p.get_signature()->get_mesh()->set_mesh_indices( NOMAD::Point( n,mesh_index ) ); delta_0=_p.get_signature()->get_mesh()->get_delta ( ); - // we set a very small epsilon in order to accept // very small initial mesh sizes: Double::set_epsilon ( 1e-16 ); @@ -192,25 +217,105 @@ void Master_Slaves::mads_run ( Cache & cache ) { if ( !check_delta ( delta_0 ) ) stop_algo = true; - else { + else + { // first run: - if ( run_index == 0 ) { + if ( run_index == 0 ) + { - // directions: + if ( init_cache.size() > 0 ) { - bool use_orthomads = _p.has_orthomads_directions(); - _p.reset_directions ( ); - _p.set_DIRECTION_TYPE ( (use_orthomads) ? ORTHO_1 : LT_1 ); + + NOMAD::Mads mads ( _p , NULL , NULL , &cache , NULL ); + + const NOMAD::Eval_Point * x; + NOMAD::Eval_Point * pt; + + // we copy all the temporary cache points + // into the list of points to be evaluated: + x = init_cache.begin(); + + while ( x ) + { + // Points will be inserted in cache + pt = new NOMAD::Eval_Point ( *x ); + pt->set_signature ( _p.get_signature() ); + + mads.get_evaluator_control().add_eval_point ( pt , + NOMAD::NO_DISPLAY , + false , + NOMAD::Double() , + NOMAD::Double() , + NOMAD::Double() , + NOMAD::Double() ); + + x = init_cache.next(); + } + + + // Eval objective and constraints from points in the cache + // ------------------------- + NOMAD::success_type success; + NOMAD::stop_type stop_reason; + bool stop=false; + mads.get_evaluator_control().eval_list_of_points ( NOMAD::X0_EVAL , + mads.get_true_barrier() , + mads.get_sgte_barrier() , + mads.get_pareto_front() , + stop , + stop_reason , + best_feasible , + best_infeasible , + success ); + + + + if ( best_feasible ) + { + + if ( _debug ) + _p.out() << "POLLSTER: new feasible incumbent from init cache file NEW_F=" << best_feasible->get_f() << endl ; + + cache_file_init_success = true; + + } + else if ( best_infeasible ) + { + if ( _debug ) + _p.out() << "MASTER: new infeasible incumbent from init cache file NEW_F=" << best_infeasible->get_f() << endl ; + + cache_file_init_success = true; + + } + } + + + if ( ! cache_file_init_success ) + { + // directions: + { + bool use_orthomads = _p.has_orthomads_directions(); + _p.reset_directions ( ); + _p.set_DIRECTION_TYPE ( (use_orthomads) ? ORTHO_1 : LT_1 ); + } + + // cache search: + _p.set_CACHE_SEARCH ( true ); + _p.set_OPPORTUNISTIC_CACHE_SEARCH ( false ); + } + else + { + _p.check(); + stop_algo = false; + stop_reason = NOMAD::NO_STOP; } - // cache search: - _p.set_CACHE_SEARCH ( true ); - _p.set_OPPORTUNISTIC_CACHE_SEARCH ( false ); } // other runs: - else { + else + { // stop_algo may be set to 'false' here: receive_optimization_data ( stop_algo , x0 , old_f ); @@ -220,9 +325,11 @@ void Master_Slaves::mads_run ( Cache & cache ) { _p.set_X0 ( x0 ); } - if ( !stop_algo ) { + if ( !stop_algo && !cache_file_init_success ) + { // check the parameters: + _p.set_DISPLAY_DEGREE(NOMAD::NO_DISPLAY); _p.check(); _p.get_signature()->get_mesh()->set_min_mesh_sizes( delta_0 ); @@ -231,6 +338,7 @@ void Master_Slaves::mads_run ( Cache & cache ) { _p.get_signature()->get_mesh()->set_limit_mesh_index ( mesh_index ); else _p.get_signature()->get_mesh()->set_limit_mesh_index ( 0 ); + Double::set_epsilon ( default_eps ); @@ -241,7 +349,8 @@ void Master_Slaves::mads_run ( Cache & cache ) { bool success = false; - if ( best_feasible ) { + if ( best_feasible ) + { success = (best_feasible->get_f() < old_f); @@ -253,12 +362,12 @@ void Master_Slaves::mads_run ( Cache & cache ) { << best_feasible->get_f() << " SUCCESS=" << success << endl; } - + // pollster mesh update: if ( success ) - ++mesh_index; - else - --mesh_index; + ++mesh_index; + else + --mesh_index; } } @@ -273,7 +382,8 @@ void Master_Slaves::mads_run ( Cache & cache ) { /*------------------*/ /* regular slaves */ /*------------------*/ - else { + else + { int i , j , pollster_mesh_index; @@ -283,7 +393,8 @@ void Master_Slaves::mads_run ( Cache & cache ) { pollster_mesh_index , free_vars ); - if ( _debug ) { + if ( _debug ) + { _p.out() << "SLAVE #" << _rank << ": OPTIM. DATA: [STOP=" << stop_algo << "] [POLLSTER_MESH_INDEX=" << pollster_mesh_index @@ -294,7 +405,8 @@ void Master_Slaves::mads_run ( Cache & cache ) { _p.out() << " ]" << endl; } - if ( !stop_algo ) { + if ( !stop_algo ) + { // starting point: _p.reset_X0(); @@ -308,28 +420,30 @@ void Master_Slaves::mads_run ( Cache & cache ) { _p.check(); // Must do check to access signature _p.get_signature()->get_mesh()->set_mesh_indices( NOMAD::Point( n,ell_0 ) ); delta_0=_p.get_signature()->get_mesh()->get_delta(); - + _p.get_signature()->get_mesh()->set_mesh_indices( NOMAD::Point( n ,pollster_mesh_index ) ); delta_min=_p.get_signature()->get_mesh()->get_delta(); - + Double::set_epsilon ( 1e-16 ); if ( !check_delta ( delta_0 ) || !check_delta ( delta_min ) ) stop_algo = true; - else { - + else + { // free variables: { _p.reset_fixed_variables(); bool fix_var; - for ( i = 0 ; i < n ; ++i ) { + for ( i = 0 ; i < n ; ++i ) + { fix_var = true; for ( j = 0 ; j < _ns ; ++j ) - if ( free_vars[j] == i ) { + if ( free_vars[j] == i ) + { fix_var = false; break; } @@ -341,6 +455,7 @@ void Master_Slaves::mads_run ( Cache & cache ) { // check the parameters: _p.check(); + // modify mesh termination criterions _p.get_signature()->get_mesh()->set_mesh_indices( NOMAD::Point( n,ell_0 ) ); @@ -351,7 +466,7 @@ void Master_Slaves::mads_run ( Cache & cache ) { _p.get_signature()->get_mesh()->set_min_mesh_sizes( delta_min ); _p.get_signature()->get_mesh()->set_delta_0 ( delta_0 ); - + Double::set_epsilon ( default_eps ); @@ -362,7 +477,8 @@ void Master_Slaves::mads_run ( Cache & cache ) { best_feasible = mads.get_best_feasible(); best_infeasible = mads.get_best_infeasible(); - if ( _debug && best_feasible ) { + if ( _debug && best_feasible ) + { _p.out() << "RANK #" << _rank << ": POLLSTER_ELL=" << pollster_mesh_index << " VARS = ["; for ( i = 0 ; i < _ns ; ++i ) @@ -405,7 +521,8 @@ void Master_Slaves::receive_optimization_result bool & stop_algo , double *& best_feasible , double *& best_infeasible , - int source ) const { + int source ) const +{ int itab[5]; MPI_Status status; @@ -418,11 +535,13 @@ void Master_Slaves::receive_optimization_result // stop the algorithm ? stop_algo = ( itab[4] == 1 ); - if ( !stop_algo ) { + if ( !stop_algo ) + { stop_type stop_reason = static_cast<stop_type>(itab[1]); - switch ( stop_reason ) { + switch ( stop_reason ) + { case ERROR: case UNKNOWN_STOP_REASON: case CTRL_C: @@ -461,7 +580,8 @@ void Master_Slaves::receive_optimization_result // itab[2] == 1 --> bf != NULL // itab[3] == 1 --> bi != NULL - if ( nb_pts > 0 ) { + if ( nb_pts > 0 ) + { int n = _p.get_dimension(); double * rtab = new double [(n+2)*nb_pts]; @@ -469,23 +589,27 @@ void Master_Slaves::receive_optimization_result MPI_Recv ( rtab , (n+2)*nb_pts , MPI_DOUBLE , source , Master_Slaves::TAG_R1 , MPI_COMM_WORLD , &status ); - if ( nb_pts == 2 ) { + if ( nb_pts == 2 ) + { // best feasible and infeasible updates: bool update = false; - if ( best_feasible ) { + if ( best_feasible ) + { Double old_f = best_feasible[n+1]; Double new_f = rtab [n+1]; if ( new_f < old_f ) update = true; } - else { + else + { best_feasible = new double[n+2]; update = true; } - if ( update ) { + if ( update ) + { for ( i = 0 ; i < n ; ++i ) best_feasible[i] = rtab[i]; best_feasible[n ] = rtab[n]; @@ -494,19 +618,22 @@ void Master_Slaves::receive_optimization_result update = false; - if ( best_infeasible ) { + if ( best_infeasible ) + { Double old_h = best_infeasible[n]; Double new_h = rtab [2*n+2]; if ( new_h < old_h ) update = true; } - else { + else + { best_infeasible = new double[n+2]; update = true; } - if ( update ) { + if ( update ) + { int cur = n+2; for ( i = 0 ; i < n ; ++i ) best_infeasible[i] = rtab[cur++]; @@ -515,14 +642,18 @@ void Master_Slaves::receive_optimization_result } delete [] rtab; } - else { + else + { // best feasible update: - if ( itab[2] == 1 ) { - if ( best_feasible ) { + if ( itab[2] == 1 ) + { + if ( best_feasible ) + { Double old_f = best_feasible[n+1]; Double new_f = rtab [n+1]; - if ( new_f < old_f ) { + if ( new_f < old_f ) + { delete [] best_feasible; best_feasible = rtab; } @@ -534,11 +665,14 @@ void Master_Slaves::receive_optimization_result } // best infeasible update: - else { - if ( best_infeasible ) { + else + { + if ( best_infeasible ) + { Double old_h = best_infeasible[n]; Double new_h = rtab [n]; - if ( new_h < old_h ) { + if ( new_h < old_h ) + { delete [] best_infeasible; best_infeasible = rtab; } @@ -561,7 +695,8 @@ void Master_Slaves::send_optimization_result bool stop_algo , const Eval_Point * bf , const Eval_Point * bi , - stop_type st ) const { + stop_type st ) const +{ // send a signal to the master: MPI_Send ( &Master_Slaves::OPTI_RES_SIGNAL , 1 , MPI_CHAR , @@ -574,14 +709,16 @@ void Master_Slaves::send_optimization_result itab[1] = static_cast<int>(st); int nb_pts = 0; - if ( bf ) { + if ( bf ) + { ++nb_pts; itab[2] = 1; } else itab[2] = 0; - if ( bi ) { + if ( bi ) + { ++nb_pts; itab[3] = 1; } @@ -593,20 +730,23 @@ void Master_Slaves::send_optimization_result MPI_Send ( itab , 5 , MPI_INT , 0 , Master_Slaves::TAG_I1 , MPI_COMM_WORLD ); - if ( nb_pts > 0 ) { + if ( nb_pts > 0 ) + { int n = _p.get_dimension(); - double * rtab = new double [(n+2)*nb_pts]; + double * rtab = new double [(n+2)*nb_pts]; int i , cur = 0; - if ( bf ) { + if ( bf ) + { for ( i = 0 ; i < n ; ++i ) rtab[cur++] = (*bf)[i].value(); rtab[cur++] = bf->get_h().value(); rtab[cur++] = bf->get_f().value(); } - if ( bi ) { + if ( bi ) + { for ( i = 0 ; i < n ; ++i ) rtab[cur++] = (*bi)[i].value(); rtab[cur++] = bi->get_h().value(); @@ -629,7 +769,8 @@ void Master_Slaves::receive_optimization_data Point & x0 , Double & fx0 , int & pollster_mesh_index , - int * free_vars ) const { + int * free_vars ) const +{ // step 1/2: receive common pollster data: receive_optimization_data ( stop_algo , x0 , fx0 ); @@ -637,7 +778,8 @@ void Master_Slaves::receive_optimization_data int i; // step 2/2: receive additional data for regular slaves: - if ( !stop_algo ) { + if ( !stop_algo ) + { int * itab = new int [_ns+1]; MPI_Status status; @@ -652,7 +794,8 @@ void Master_Slaves::receive_optimization_data delete [] itab; } - else { + else + { pollster_mesh_index = 1; for ( i = 0 ; i < _ns ; ++i ) free_vars[i] = -1; @@ -665,7 +808,8 @@ void Master_Slaves::receive_optimization_data /*---------------------------------------------*/ void Master_Slaves::receive_optimization_data ( bool & stop_algo , Point & x0 , - Double & fx0 ) const { + Double & fx0 ) const +{ char c_stop; MPI_Status status; MPI_Request req = MPI_REQUEST_NULL; @@ -682,13 +826,15 @@ void Master_Slaves::receive_optimization_data ( bool & stop_algo , MPI_Wait ( &req , &status ); // stop: - if ( c_stop == '1' ) { + if ( c_stop == '1' ) + { stop_algo = true; x0.reset(); } // continue: - else { + else + { stop_algo = false; double * rtab = new double [n+2]; @@ -714,7 +860,8 @@ void Master_Slaves::receive_optimization_data ( bool & stop_algo , MPI_Wait ( &req , &status ); - if ( pt_flag == '1' ) { + if ( pt_flag == '1' ) + { MPI_Recv ( rtab , n+2 , MPI_DOUBLE , npm1 , Cache_Server::TAG_X7 , MPI_COMM_WORLD , &status ); @@ -733,7 +880,8 @@ void Master_Slaves::receive_optimization_data ( bool & stop_algo , const Point & lb = _p.get_lb(); const Point & ub = _p.get_ub(); - for ( i = 0 ; i < n ; ++i ) { + for ( i = 0 ; i < n ; ++i ) + { if ( lb[i].is_defined() && x0[i].value() < lb[i].value() ) x0[i] = lb[i]; if ( ub[i].is_defined() && x0[i].value() > ub[i].value() ) @@ -751,7 +899,8 @@ void Master_Slaves::send_optimization_data bool stop_algo , const double * best_feasible , const double * best_infeasible , - int source ) const { + int source ) const +{ char c_stop = (stop_algo) ? '1' : '0'; @@ -759,7 +908,8 @@ void Master_Slaves::send_optimization_data Master_Slaves::TAG_CSTOP , MPI_COMM_WORLD ); // continue: - if ( !stop_algo ) { + if ( !stop_algo ) + { int n = _p.get_dimension(); @@ -772,7 +922,8 @@ void Master_Slaves::send_optimization_data source , Master_Slaves::TAG_D1 , MPI_COMM_WORLD ); // additional data for regular slaves: - if ( source != 1 ) { + if ( source != 1 ) + { int * itab = new int [_ns+1]; @@ -797,7 +948,8 @@ void Master_Slaves::send_optimization_data /*-----------------------------------------------*/ /* check the initial mesh size values */ /*-----------------------------------------------*/ -bool Master_Slaves::check_delta ( const Point & delta ) { +bool Master_Slaves::check_delta ( const Point & delta ) +{ int n = delta.size(); for ( int i = 0 ; i < n ; ++i ) if ( delta[i].value() < Double::get_epsilon() || diff --git a/tools/PSD-MADS/Master_Slaves.hpp b/tools/PSD-MADS/Master_Slaves.hpp index 33eb386b212f33aa3161b668da57cdfddd51e517..e4dc694020b798a6d100c5a2a48176d3e70a55e6 100644 --- a/tools/PSD-MADS/Master_Slaves.hpp +++ b/tools/PSD-MADS/Master_Slaves.hpp @@ -8,90 +8,92 @@ using namespace std; // Cache server: class Master_Slaves { - + private: - - int _rank; // process rank - int _np; // number of processes - - int _bbe; // max number of evaluations for each process - int _ns; // number of free variables for each process - - Parameters & _p; // parameters - bool _debug; // debug display flag - - static const int TAG_SIGNAL; - static const int TAG_I1; - static const int TAG_I2; - static const int TAG_R1; - static const int TAG_D1; - static const int TAG_CSTOP; - static char STOP_SIGNAL; - static char OPTI_RES_SIGNAL; - static char OPTI_DATA_SIGNAL; - - // Receive an optimization result from the pollster: - void receive_optimization_result ( int & pollster_mesh_index , - bool & stop_algo , - double *& best_feasible , - double *& best_infeasible , - int source ) const; - - // Send an optimization result to the master: - void send_optimization_result ( int pollster_mesh_index , - bool stop_algo , - const Eval_Point * bf , - const Eval_Point * bi , - stop_type st ) const; - - // Send optimization data from the master to a slave: - void send_optimization_data ( int pollster_mesh_index , - bool stop_algo , - const double * best_feasible , - const double * best_infeasible , - int source ) const; - - // Receive optimization data from the master: - void receive_optimization_data ( bool & stop_algo , - Point & x0 , - Double & fx0 ) const; - - void receive_optimization_data ( bool & stop_algo , - Point & x0 , - Double & fx0 , - int & pollster_mesh_index , - int * free_vars ) const; - - // Check the initial mesh size values: - static bool check_delta ( const Point & delta ); - + + int _rank; // process rank + int _np; // number of processes + + int _bbe; // max number of evaluations for each process + int _ns; // number of free variables for each process + + Parameters & _p; // parameters + bool _debug; // debug display flag + + + static const int TAG_SIGNAL; + static const int TAG_I1; + static const int TAG_I2; + static const int TAG_R1; + static const int TAG_D1; + static const int TAG_CSTOP; + static char STOP_SIGNAL; + static char OPTI_RES_SIGNAL; + static char OPTI_DATA_SIGNAL; + + // Receive an optimization result from the pollster: + void receive_optimization_result ( int & pollster_mesh_index , + bool & stop_algo , + double *& best_feasible , + double *& best_infeasible , + int source ) const; + + // Send an optimization result to the master: + void send_optimization_result ( int pollster_mesh_index , + bool stop_algo , + const Eval_Point * bf , + const Eval_Point * bi , + stop_type st ) const; + + // Send optimization data from the master to a slave: + void send_optimization_data ( int pollster_mesh_index , + bool stop_algo , + const double * best_feasible , + const double * best_infeasible , + int source ) const; + + // Receive optimization data from the master: + void receive_optimization_data ( bool & stop_algo , + Point & x0 , + Double & fx0 ) const; + + void receive_optimization_data ( bool & stop_algo , + Point & x0 , + Double & fx0 , + int & pollster_mesh_index , + int * free_vars ) const; + + // Check the initial mesh size values: + static bool check_delta ( const Point & delta ); + public: - - // Constructor: - Master_Slaves ( int rank , - int np , - int bbe , - int ns , - Parameters & p , - bool debug ) + + // Constructor: + Master_Slaves ( int rank , + int np , + int bbe , + int ns , + Parameters & p , + bool debug ) : _rank ( rank ) , - _np ( np ) , - _bbe ( bbe ) , - _ns ( ns ) , - _p ( p ) , + _np ( np ) , + _bbe ( bbe ) , + _ns ( ns ) , + _p ( p ) , _debug ( debug ) {} - - // Destructor: - virtual ~Master_Slaves ( void ) {} - - // Start the master: - void start ( void ) const; - - // Stop the master: - void stop ( void ) const; - - // MADS run: - void mads_run ( Cache & cache ); + + // Destructor: + virtual ~Master_Slaves ( void ) {} + + + // Start the master: + void start ( void ) const; + + // Stop the master: + void stop ( void ) const; + + // MADS run: + void mads_run ( Cache & cache , Cache & init_cache ); }; diff --git a/tools/PSD-MADS/main.cpp b/tools/PSD-MADS/main.cpp index 5d9122bc8599c4af058fcde376097626c5a926c8..5ade69981bd702864961826aabe6bb1f7cbb2d97 100644 --- a/tools/PSD-MADS/main.cpp +++ b/tools/PSD-MADS/main.cpp @@ -33,100 +33,191 @@ const bool DEBUG = false; /*-----------------------------------*/ /* main function */ /*-----------------------------------*/ -int main ( int argc , char ** argv ) { - - // MPI initialization: - MPI_Init ( &argc , &argv ); - int rank , np; - MPI_Comm_rank ( MPI_COMM_WORLD, &rank ); - MPI_Comm_size ( MPI_COMM_WORLD, &np ); - - // check the arguments and the number of processes: - if ( np <= 2 || argc != 4 ) { - if ( rank == 0 ) - cerr << "usage: mpirun -np p " << argv[0] - << " param_file bbe ns, with p>2," - << " bbe>1, and 1<=ns<=n." - << endl; - MPI_Finalize(); - return 1; - } - - // display: - Display out ( cout ); - out.precision ( 16 ); - - // parameters: - NOMAD::Parameters p ( out ); - int bbe = atoi ( argv[2] ); - int ns = atoi ( argv[3] ); - - try { - - // read the parameters file: - p.read ( argv[1] ); - - - // Force anisotropy(false) to have a single mesh_index (XMesh) - p.set_ANISOTROPIC_MESH ( false ); - - - // check the parameters: - p.check(); - - if ( ns < 1 || ns > p.get_dimension() ) - throw Exception ( __FILE__ , __LINE__ , - "Bad value for ns the number of free variables for each process" ); - - if ( p.get_nb_obj() > 1 ) - throw Exception ( __FILE__ , __LINE__ , - "PSD-MADS is not designed for multi-objective optimization" ); - } - catch ( exception & e ) { - if ( rank == 0 ) - cerr << "error with parameters" << endl; +int main ( int argc , char ** argv ) +{ + + // MPI initialization: + MPI_Init ( &argc , &argv ); + int rank , np; + MPI_Comm_rank ( MPI_COMM_WORLD, &rank ); + MPI_Comm_size ( MPI_COMM_WORLD, &np ); + + // check the arguments and the number of processes: + if ( np <= 2 || argc < 4 || argc > 5 ) + { + if ( rank == 0 ) + cerr << "usage: mpirun -np p " << argv[0] + << " param_file bbe ns [history_file(txt)], with p>2," + << " bbe>1, and 1<=ns<=n." + << endl; + MPI_Finalize(); + return 1; + } + + // display: + Display out ( cout ); + out.precision ( 16 ); + + // parameters: + NOMAD::Parameters p ( out ); + int bbe = atoi ( argv[2] ); + int ns = atoi ( argv[3] ); + + // The history file is handled by the cache server only (rank==np-1) + string history_file; + if ( argc == 5 && rank ==np-1 ) + { + + history_file = argv[5]; + + std::ofstream fout; + fout.open ( history_file.c_str() ); + + if ( !fout.fail() ) + { + fout << std::endl; + fout.close(); + } + else + { + cout << "Warning ( main.cpp, line " << __LINE__ + << "): could not open the history" + << " in \'" + << history_file << "\'" << std::endl << std::endl; + + history_file.clear(); + } + + } + + string init_cache_file,save_cache_file; + bool success_load_init_cache = false; + Cache init_cache( out ); + + try + { + + // read the parameters file: + p.read ( argv[1] ); + + // Force anisotropy(false) to have a single mesh_index (XMesh) + p.set_ANISOTROPIC_MESH ( false ); + + // check the parameters: + p.check(); + + // manage the cache file for initialization + init_cache_file = p.get_x0_cache_file(); + + if ( ! init_cache_file.empty() ) + throw Exception ( __FILE__ , __LINE__ , + "PSDMADS cannot accept a X0 cache file. Set a regular cache file to be used for initialization instead." ); + + + init_cache_file = p.get_cache_file(); + + // The init cache file is handled by the pollster (rank==1) + if ( ! init_cache_file.empty() ) + { + if ( rank == 1 ) + { + success_load_init_cache = init_cache.load ( init_cache_file , NULL , DEBUG ); + + cout << "Warning ( main.cpp, line " << __LINE__ << "): " << init_cache_file << " is used for initialization in addition of X0." << std::endl << std::endl; + + if ( ! success_load_init_cache || init_cache.size()==0 ) + { + init_cache_file.clear(); + } + } + + // The cache file is not loaded by others than pollster + p.set_CACHE_FILE(""); + p.check(); + } + + + if ( ns < 1 || ns > p.get_dimension() ) + throw Exception ( __FILE__ , __LINE__ , + "Bad value for ns the number of free variables for each process" ); + + if ( p.get_nb_obj() > 1 ) + throw Exception ( __FILE__ , __LINE__ , + "PSD-MADS is not designed for multi-objective optimization" ); + } + catch ( exception & e ) + { + if ( rank == 0 ) + cerr << "error with parameter: " << e.what()<< endl; + MPI_Finalize(); + return 1; + } + + + // start the master: + Master_Slaves master_slaves ( rank , np , bbe , ns , p , DEBUG ); + + // cache server: + Cache_Server cache ( out , + rank , + np , + p.get_h_min() , + p.get_max_bb_eval() , + history_file , + false , // ALLOW_MULTIPLE_EVALS + DEBUG ); + + + master_slaves.start( ); + + + // Cache server: + if ( rank == np-1 ) + { + if ( !DEBUG ) + out << endl << "TIME\tBBE\tOBJ" << endl << endl; + + // Start the cache server + cache.start(); + + // Save the cache when done (after start is completed) + if ( ! init_cache_file.empty() ) + { + bool success_load_cache_file = cache.load ( init_cache_file , NULL , DEBUG ); + + if ( ! success_load_cache_file ) + { + cout << "Warning ( main.cpp, line " << __LINE__ + << "): cannot load the cache file " << init_cache_file << " for saving." << std::endl << std::endl; + + } + else + cache.save( true , DEBUG ); + } + } + + // slaves: algorithm creation and execution: + if ( rank != 0 && rank != np-1 ) + { + // MADS run: + master_slaves.mads_run ( cache , init_cache ); + + // stop the master: + master_slaves.stop(); + } + + + + // stop the cache server: + cache.stop(); + + // display the final solution: + if ( !DEBUG && rank == np-1 ) + { + cache.display_best_points ( out ); + } + + // MPI finalization: MPI_Finalize(); - return 1; - } - - // start the master: - Master_Slaves master_slaves ( rank , np , bbe , ns , p , DEBUG ); - master_slaves.start(); - - // cache server: - Cache_Server cache ( out , - rank , - np , - p.get_h_min() , - p.get_max_bb_eval() , - false , // ALLOW_MULTIPLE_EVALS - DEBUG ); - - // start the cache server: - if ( rank == np-1 ) { - if ( !DEBUG ) - out << endl << "TIME\tBBE\tOBJ" << endl << endl; - cache.start(); - } - - // slaves: algorithm creation and execution: - if ( rank != 0 && rank != np-1 ) { - - // MADS run: - master_slaves.mads_run ( cache ); - - // stop the master: - master_slaves.stop(); - } - - // stop the cache server: - cache.stop(); - - // display the final solution: - if ( !DEBUG && rank == np-1 ) - cache.display_best_points ( out ); - - // MPI finalization: - MPI_Finalize(); - return 0; + return 0; } diff --git a/tools/PSD-MADS/makefile b/tools/PSD-MADS/makefile index ab23da419da28885beec4717a9704220d94be3c0..d24fb7359127fd3cddd63ebf2b83be576cf81f95 100644 --- a/tools/PSD-MADS/makefile +++ b/tools/PSD-MADS/makefile @@ -14,10 +14,13 @@ CXXFLAGS += -Wl,-rpath,'$(LIB_DIR)' CXXFLAGS += -ansi endif +ifeq ($(UNAME), Darwin) +CXXFLAGS += -headerpad_max_install_names +endif LDLIBS = -lm -lnomad -lmpi -INCLUDE = -I$(NOMAD_HOME)/src -I. +INCLUDE = -I$(NOMAD_HOME)/ext/sgtelib/src -I$(NOMAD_HOME)/src -I. COMPILE = $(COMPILATOR) $(COMPILATOR_OPTIONS) $(INCLUDE) -c OBJS = main.o Cache_Server.o Master_Slaves.o diff --git a/tools/PSD-MADS/readme.txt b/tools/PSD-MADS/readme.txt index fc125f1652e20ce6aa03745f9ae90611dfce1f31..52020aa6c3c8111434abfcadfb2f8e65698111b3 100644 --- a/tools/PSD-MADS/readme.txt +++ b/tools/PSD-MADS/readme.txt @@ -1,7 +1,18 @@ -Procedure for Unix/Linux/mac OSX - -1- Set the NOMAD_HOME environment variable -2- Compile with the command make -3- Go to one of the problem directory -4- Compile the black box (g++ -o bb.exe bb.cpp) -5- Run psdmads (mpirun -np 3 ../../psdmads.exe param.txt) +Procedure for Unix/Linux/mac OSX + +1- Set the NOMAD_HOME environment variable +2- Compile with the command make +3- Go to one of the problem directory +4- Compile the black box (g++ -o bb.exe bb.cpp) +5- Run psdmads (mpirun -np 3 ../../psdmads.exe param.txt) + +Procedure for Windows + +1- Open de nomad MicrosoftVisualStudio solution located in %NOMAD_EXAMPLES%\VisualStudio +2- Build the solution +3- In VisualStudio, add to the solution the existing project %NOMAD_EXAMPLES%\VisualStudio\psdmads.vcxproj +4- Build this new project +5- Open a VisualStudio command shell +6- Change the directory to %NOMAD_EXAMPLES%\examples\PSD-MADS\problems\G2_10 +7- Build the blackbox executable with the command: cl bb.cpp +8- Start the optimization: mpiexec -n 4 ..\..\psdmads.exe param.txt 20 3 \ No newline at end of file diff --git a/tools/PSD-MADS_library_mode/makefile b/tools/PSD-MADS_library_mode/makefile index 29093ff34ef10379669beb941518f254a3a30874..29df1d62faab5d038b937963cf96a377de14fae3 100644 --- a/tools/PSD-MADS_library_mode/makefile +++ b/tools/PSD-MADS_library_mode/makefile @@ -16,7 +16,7 @@ endif LDLIBS = -lm -lnomad -INCLUDE = -I$(NOMAD_HOME)/src -I. +INCLUDE = -I$(NOMAD_HOME)/src -I$(NOMAD_HOME)/ext/sgtelib/src -I. COMPILE = $(COMPILATOR) $(COMPILATOR_OPTIONS) $(INCLUDE) -c OBJS = main.o Cache_Server.o Master_Slaves.o diff --git a/tools/SENSITIVITY/cache_inspect/makefile b/tools/SENSITIVITY/cache_inspect/makefile index 87af1472a2ee18be03de2f9ea6185171378c0d8f..8821d184f185f0cde2e8834e45095966b9878df2 100644 --- a/tools/SENSITIVITY/cache_inspect/makefile +++ b/tools/SENSITIVITY/cache_inspect/makefile @@ -15,7 +15,7 @@ endif LDLIBS = -lm -lnomad -INCLUDE = -I$(NOMAD_HOME)/src -I. +INCLUDE = -I$(NOMAD_HOME)/src -I. -I$(NOMAD_HOME)/ext/sgtelib/src COMPILE = $(COMPILATOR) $(COMPILATOR_OPTIONS) $(INCLUDE) -c OBJS = cache_inspect.o diff --git a/tools/SENSITIVITY/detailed_analysis/makefile b/tools/SENSITIVITY/detailed_analysis/makefile index a9115acedecd7b91c53651b7be75e761e6b0fd8c..f2bc71f4b2616dff8f57823c307b9a95c82843c8 100644 --- a/tools/SENSITIVITY/detailed_analysis/makefile +++ b/tools/SENSITIVITY/detailed_analysis/makefile @@ -16,7 +16,7 @@ endif LDLIBS = -lm -lnomad -INCLUDE = -I$(NOMAD_HOME)/src -I. +INCLUDE = -I$(NOMAD_HOME)/src -I$(NOMAD_HOME)/ext/sgtelib/src -I. COMPILE = $(COMPILATOR) $(COMPILATOR_OPTIONS) $(INCLUDE) -c diff --git a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/RungeKutta.cpp b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/RungeKutta.cpp index 53236ea0bb9c3c23ad0a8c0d8f0881519f55445b..e9112bd383cc8f19e2d76ae272c24ef8887def36 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/RungeKutta.cpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/RungeKutta.cpp @@ -1,80 +1,80 @@ -#include "RungeKutta.hpp" - -#include <iomanip> - -using namespace std; - -template <class E> -RungeKutta<E>::RungeKutta(int dim) -{ - m = dim; - k1 = new double[m]; - k2 = new double[m]; - k3 = new double[m]; - k4 = new double[m]; - y = new double[m]; - y_tmp = new double[m]; -} - -template <class E> -RungeKutta<E>::~RungeKutta() -{ - delete [] k1; - delete [] k2; - delete [] k3; - delete [] k4; - delete [] y; - delete [] y_tmp; -} - -template <class E> -void RungeKutta<E>::set ( E * tmp , double * y0 , double beg , double end ) -{ - unit=tmp; - x0=beg; xn=end; - x=x0; - h=double(xn-x0)/double(N_INTER); - for (i=0;i<m;i++) {y[i]=y0[i];} - success=true; -} - -template <class E> -bool RungeKutta<E>::run() { - for(j=0;j<MAX_ITER_RK;j++) { - //Avoid going out of x interval - if (x+h >xn) { - h = xn-x; - j = MAX_ITER_RK; - } - - //Compute k1, k2, k3, k4 - for(i=0;i<m;i++) - k1[i] = h*unit->f(i, x, y); - for(i=0;i<m;i++) - y_tmp[i] = y[i]+k1[i]/2.0; - for(i=0;i<m;i++) - k2[i] = h*unit->f(i, x+h/2.0, y_tmp); - for(i=0;i<m;i++) - y_tmp[i] = y[i]+k2[i]/2.0; - for(i=0;i<m;i++) - k3[i] = h*unit->f(i, x+h/2.0, y_tmp); - for(i=0;i<m;i++) - y_tmp[i] = y[i]+k3[i]; - for ( i = 0 ; i < m ; i++ ) - k4[i] = h*unit->f ( i , x+h , y_tmp ); - //Compute the new y - for(i=0;i<m;i++) - y[i]+=(k1[i]+2*k2[i]+2*k3[i]+k4[i])/6.0; - x += h; - } - - if ( x < xn-EPS ) {// MODIF SEB (le EPS) - success=false; - - // cout.setf(ios::fixed); - // cout << setprecision(12); - // cout << "x=" << x << " < xn=" << xn << " diff=" << xn-x << endl; - } - - return success; -} +#include "RungeKutta.hpp" + +#include <iomanip> + +using namespace std; + +template <class E> +RungeKutta<E>::RungeKutta(int dim) +{ + m = dim; + k1 = new double[m]; + k2 = new double[m]; + k3 = new double[m]; + k4 = new double[m]; + y = new double[m]; + y_tmp = new double[m]; +} + +template <class E> +RungeKutta<E>::~RungeKutta() +{ + delete [] k1; + delete [] k2; + delete [] k3; + delete [] k4; + delete [] y; + delete [] y_tmp; +} + +template <class E> +void RungeKutta<E>::set ( E * tmp , double * y0 , double beg , double end ) +{ + unit=tmp; + x0=beg; xn=end; + x=x0; + h=double(xn-x0)/double(N_INTER); + for (i=0;i<m;i++) {y[i]=y0[i];} + success=true; +} + +template <class E> +bool RungeKutta<E>::run() { + for(j=0;j<MAX_ITER_RK;j++) { + //Avoid going out of x interval + if (x+h >xn) { + h = xn-x; + j = MAX_ITER_RK; + } + + //Compute k1, k2, k3, k4 + for(i=0;i<m;i++) + k1[i] = h*unit->f(i, x, y); + for(i=0;i<m;i++) + y_tmp[i] = y[i]+k1[i]/2.0; + for(i=0;i<m;i++) + k2[i] = h*unit->f(i, x+h/2.0, y_tmp); + for(i=0;i<m;i++) + y_tmp[i] = y[i]+k2[i]/2.0; + for(i=0;i<m;i++) + k3[i] = h*unit->f(i, x+h/2.0, y_tmp); + for(i=0;i<m;i++) + y_tmp[i] = y[i]+k3[i]; + for ( i = 0 ; i < m ; i++ ) + k4[i] = h*unit->f ( i , x+h , y_tmp ); + //Compute the new y + for(i=0;i<m;i++) + y[i]+=(k1[i]+2*k2[i]+2*k3[i]+k4[i])/6.0; + x += h; + } + + if ( x < xn-EPS ) {// MODIF SEB (le EPS) + success=false; + + // cout.setf(ios::fixed); + // cout << setprecision(12); + // cout << "x=" << x << " < xn=" << xn << " diff=" << xn-x << endl; + } + + return success; +} diff --git a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/RungeKutta.hpp b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/RungeKutta.hpp index 240075371d9f76c61faa9f0865ace58c090acd41..db2b3c22d5b1c897238f65d8a961be5d6fadfaf7 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/RungeKutta.hpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/RungeKutta.hpp @@ -1,37 +1,37 @@ -/* -To use the Runge-Kutta solver for systems of first order differential equations, - (the parametric object E must have public function such as E->f(i,x,y), - where i is the index of the function to evaluate, x is the time and - y is a point such as y(x), returns values of differential equation i) - - 1- construct the solver : solver = new RungeKutta<objet>(int); //the integer is the dimension of x - 2- set the solver : solver->set(unit, y0, x0, xn); //unit is usually the pointer *this, y0 are the initial conditions, and x0 and xn is the time interval - 3- launch the solver : bool = solver->run(); //will return true is success, false if the solver failed???????????????????????????? - 4- delete the solver : delete solver; -(ref :Fortin) -*/ -#ifndef RUNGEKUTTA_H -#define RUNGEKUTTA_H - -#include "defines.hpp" -using namespace std; - -template <class E> -class RungeKutta -{ -private: - double *k1, *k2, *k3, *k4, *y_tmp, *y; - // double k1[MAX_DIM], k2[MAX_DIM], k3[MAX_DIM], k4[MAX_DIM], y_tmp[MAX_DIM], y[MAX_DIM]; - double h, x0, xn, x; - int i, j, m; - bool success; - E *unit; - -public: - RungeKutta(int); - ~RungeKutta(); - void set(E*, double*, double, double); - double dx(){return h;} - bool run(); -}; -#endif +/* +To use the Runge-Kutta solver for systems of first order differential equations, + (the parametric object E must have public function such as E->f(i,x,y), + where i is the index of the function to evaluate, x is the time and + y is a point such as y(x), returns values of differential equation i) + + 1- construct the solver : solver = new RungeKutta<objet>(int); //the integer is the dimension of x + 2- set the solver : solver->set(unit, y0, x0, xn); //unit is usually the pointer *this, y0 are the initial conditions, and x0 and xn is the time interval + 3- launch the solver : bool = solver->run(); //will return true is success, false if the solver failed???????????????????????????? + 4- delete the solver : delete solver; +(ref :Fortin) +*/ +#ifndef RUNGEKUTTA_H +#define RUNGEKUTTA_H + +#include "defines.hpp" +using namespace std; + +template <class E> +class RungeKutta +{ +private: + double *k1, *k2, *k3, *k4, *y_tmp, *y; + // double k1[MAX_DIM], k2[MAX_DIM], k3[MAX_DIM], k4[MAX_DIM], y_tmp[MAX_DIM], y[MAX_DIM]; + double h, x0, xn, x; + int i, j, m; + bool success; + E *unit; + +public: + RungeKutta(int); + ~RungeKutta(); + void set(E*, double*, double, double); + double dx(){return h;} + bool run(); +}; +#endif diff --git a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/bissection.cpp b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/bissection.cpp index d23a93996575be1c12c1d6a882367d2444a7fd60..60e3d3883204076214d950171deff58a7ccc7809 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/bissection.cpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/bissection.cpp @@ -1,27 +1,27 @@ -#include "bissection.hpp" -using namespace std; - -template <class E> -bool bissection<E>::run() -{ - for (i=1; i<MAX_ITER_BISSECTION; i++) - { - xm=(x1+x2)/2; - // if(DEBUG) cout<<endl<<x1<<" "<<xm<<" "<<x2; - if (fabs(x1-x2)/fabs(xm) < TOL_BISSECTION) - { - i=MAX_ITER_BISSECTION; - OK=true; - } - else - { - f1 = unit->f(x1); - fm = unit->f(xm); - f2 = unit->f(x2); - if (f1*fm < 0.0) x2 = xm; - if (fm*f2 < 0.0) x1 = xm; - } - } - // if (DEBUG) system("pause"); - return OK; -} +#include "bissection.hpp" +using namespace std; + +template <class E> +bool bissection<E>::run() +{ + for (i=1; i<MAX_ITER_BISSECTION; i++) + { + xm=(x1+x2)/2; + // if(DEBUG) cout<<endl<<x1<<" "<<xm<<" "<<x2; + if (fabs(x1-x2)/fabs(xm) < TOL_BISSECTION) + { + i=MAX_ITER_BISSECTION; + OK=true; + } + else + { + f1 = unit->f(x1); + fm = unit->f(xm); + f2 = unit->f(x2); + if (f1*fm < 0.0) x2 = xm; + if (fm*f2 < 0.0) x1 = xm; + } + } + // if (DEBUG) system("pause"); + return OK; +} diff --git a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/bissection.hpp b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/bissection.hpp index 18d4ee6b1cd2949f7b3e8206a5c88629006bca25..c277e299792392a6a4331b44dfd49b60a7f53e16 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/bissection.hpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/bissection.hpp @@ -1,31 +1,31 @@ -/* -To use the bissection solver to find the root of a scalar function -when the secant solver fails. - (the parametric object E must have public function such as E->f(x), - where x is the point at which evaluate f.) - 1- construct the solver : solver = new bissect<E>(); - 2- set the solver : solver->set(unit, x0, x1); //unit is usually the pointer *this, and x0 and x1 are the interval's bounds - 3- launch the solver : bool = solver->run(); //will return true is success, false if the solver failed -*/ -#ifndef BISSECTION_H -#define BISSECTION_H - -#include "defines.hpp" -using namespace std; - -template <class E> -class bissection { -private: - double x1, xm, x2; - double f1, fm, f2; - int i; - bool OK; - E *unit; - -public: - bissection(){x1=xm=x2=f1=fm=f2=0; OK=false;} - void set(E* tmp, double xx1, double xx2) {unit=tmp; x1=xx1; x2=xx2;} - bool run(); - ~bissection(){} -}; -#endif +/* +To use the bissection solver to find the root of a scalar function +when the secant solver fails. + (the parametric object E must have public function such as E->f(x), + where x is the point at which evaluate f.) + 1- construct the solver : solver = new bissect<E>(); + 2- set the solver : solver->set(unit, x0, x1); //unit is usually the pointer *this, and x0 and x1 are the interval's bounds + 3- launch the solver : bool = solver->run(); //will return true is success, false if the solver failed +*/ +#ifndef BISSECTION_H +#define BISSECTION_H + +#include "defines.hpp" +using namespace std; + +template <class E> +class bissection { +private: + double x1, xm, x2; + double f1, fm, f2; + int i; + bool OK; + E *unit; + +public: + bissection(){x1=xm=x2=f1=fm=f2=0; OK=false;} + void set(E* tmp, double xx1, double xx2) {unit=tmp; x1=xx1; x2=xx2;} + bool run(); + ~bissection(){} +}; +#endif diff --git a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/burner.cpp b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/burner.cpp index 1b6f36b09550b2585fa78071983f0f77fc9d4576..eb8a223bf429389fe9ad4b3d8b59b914331d7cc6 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/burner.cpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/burner.cpp @@ -1,287 +1,287 @@ -#include "burner.hpp" -using namespace std; - -/*----------------------------------------------------------*/ -/* arrondi pour ne conserver que n chiffres significatifs */ -/*----------------------------------------------------------*/ -double arrondi ( double x , int n ) { - if (fabs(x) < EPS) - return 0.0; - double m = pow ( 10 , ceil(-log10(x)) + n - 1 ); - return round(m*x)/m; -} - -/*---------------------------------------------------------------*/ -burner::burner ( int nb , chemical ** chem ) { - - rem_nb = nb; - - NO=NO2=N2O=CO=0.0; - m = new double[nb]; - can_burn = new bool[nb]; - - // combustion.prop : - // ----------------- - // 64-17-5 3 2 3 - // 74-82-8 2 1 2 - // 1333-74-0 0.5 0 1 - // 100-42-5 10 8 4 - // 74-85-1 3 2 2 - // 108-88-3 9 7 4 - // 100-41-4 10.5 8 5 - // 71-43-2 7.5 6 3 - - for ( i = 0 ; i < nb ; i++ ) { - - can_burn[i] = false; - - if ( chem[i]->CAS == "64-17-5" || - chem[i]->CAS == "74-82-8" || - chem[i]->CAS == "1333-74-0" || - chem[i]->CAS == "100-42-5" || - chem[i]->CAS == "74-85-1" || - chem[i]->CAS == "108-88-3" || - chem[i]->CAS == "100-41-4" || - chem[i]->CAS == "71-43-2" ) - can_burn[i] = true; - } - - O2 = new chemical ("7782-44-7"); - N2 = new chemical ("7727-37-9"); - CO2 = new chemical ("124-38-9"); - H2O = new chemical ("7732-18-5"); - - // Construct the rx array; - rx = new combrx * [nb]; - for ( i = 0 ; i < nb ; i++ ) { - if ( can_burn[i] ) - rx[i] = new combrx ( chem[i]->CAS ); - else - rx[i] = NULL; - } -} - -/*---------------------------------------------------------------*/ -burner::~burner ( void ) { - - delete [] m; - delete [] can_burn; - - for ( i = 0 ; i < rem_nb ; i++ ) - if (rx[i]) - delete rx[i]; - delete [] rx; - - delete O2; - delete N2; - delete CO2; - delete H2O; -} - -/*---------------------------------------------------------------*/ -bool burner::solve(double * y) -{ - OK=true; - //perform mass balance (neglect pollutants flows) - out->m = 0.0; - for(i=0;i<in->nb;i++) - { - if (!can_burn[i]) { - out->chem[i]->m = in->chem[i]->m; - out->m+=out->chem[i]->m; - } - else { - out->chem[i]->m=0.0; - O2->m+=rx[i]->O2_flow()*in->chem[i]->n(); - N2->m+=rx[i]->N2_flow()*in->chem[i]->n(); - CO2->m+=rx[i]->CO2_flow()*in->chem[i]->n(); - H2O->m+=rx[i]->H2O_flow()*in->chem[i]->n(); - } - } - N2->m*=(1.0+eta); - O2->m*=(1.0+eta); - //perform energy balance to find Tout - T = in->T; - - step=10; - Q=1; - // find temperature - while (fabs(step)>TOL_BURN && fabs(Q)>TOL_BURN && T<MAX_TEMP) - { - T+=step; - - if(T>MAX_TEMP) - T=MAX_TEMP; - Q = 0.0; - for ( i = 0 ; i < in->nb ; i++ ) - Q += in->chem[i]->dH ( in->T , T , in->P ) * in->chem[i]->n(); - - for ( i = 0 ; i < in->nb ; i++ ) - if ( can_burn[i] ) - Q += rx[i]->Hcomb(T) * in->chem[i]->n(); - - Q += O2->dH ( 293 , T , in->P ) * O2->n(); - Q += N2->dH ( 293 , T , in->P ) * N2->n(); - - - if (step/fabs(step)*Q >0) - step*= -0.1; - else if (fabs(Q)<10) - step*=0.25; - - } - - - - out->set_thermo(in->thermo); - // out->thermo = in->thermo; - - out->set(in->P, T); - O2->P=in->P; O2->T=T; O2->state=1; O2->find_v(); - N2->P=in->P; N2->T=T; N2->state=1; N2->find_v(); - CO2->P=in->P; CO2->T=T; CO2->state=1; CO2->find_v(); - H2O->P=in->P; H2O->T=T; H2O->state=1; H2O->find_v(); - //check if mixture can burn - m_can_burn = 0.0; - for(i=0;i<in->nb;i++) if(can_burn[i]) m_can_burn+=in->chem[i]->n(); - LFLmix=0.0; - for(i=0;i<in->nb;i++) if(can_burn[i]) LFLmix+=in->chem[i]->n()/m_can_burn*rx[i]->LFL(in->P,T); - UFLmix=0.0; - for(i=0;i<in->nb;i++) if(can_burn[i]) UFLmix+=in->chem[i]->n()/m_can_burn*rx[i]->UFL(in->P,T); - num = 0.0; - buff=in->T; in->set(in->P, T); - for(i=0;i<in->nb;i++) if(can_burn[i]) num+=in->chem[i]->n()/in->n()*in->v; - in->set(in->P, buff); - den = O2->v+N2->v+out->v; - composition = num/den; - if(!(LFLmix<=composition && composition<=UFLmix) || T==MAX_TEMP) - { -// logf.open(MESSAGES,ios::app); -// logf<<" --> Warning <-- Mixture in "<<name<<" can't burn (LFL="<<LFLmix -// <<" UFL="<<UFLmix<<" x="<<composition<<").\n"; -// logf.close(); - T=in->T; - filename = out->name; - *out=*in; - out->set(filename); - // out->write(); // WRITE TOTO - OK=false; - } - else - { - O2->P=in->P; O2->T=T; O2->state=1; O2->find_v(); - N2->P=in->P; N2->T=T; N2->state=1; N2->find_v(); - // out->write(); // WRITE TOTO - } - if(OK) //compute the pollutants production - { - fill_K_array(); - NO = 1e6*sqrt(K[0]*(N2->n()/den)*(O2->n()/den))*den*0.03/(O2->m+N2->m+out->m+H2O->m+CO2->m); - N2O = 1e6*K[1]*(N2->n()/den)*sqrt(O2->n()/den)*den*0.044/(O2->m+N2->m+out->m+H2O->m+CO2->m); - NO2 = 1e6*K[2]*sqrt(N2->n()/den)*(O2->n()/den)*den*0.046/(O2->m+N2->m+out->m+H2O->m+CO2->m); - CO = 1e6*K[3]*(CO2->n()/den)*den/sqrt(O2->n()/den)*0.028/(O2->m+N2->m+out->m+H2O->m+CO2->m); - } -// logf.open(MESSAGES,ios::app); - if (NO>EPS && NO2>EPS && N2O>EPS) { - // logf<<" --> Warning <-- Presence of NOx: "<<(NO+NO2+N2O)<<" ppm in "<<name<<".\n"; - y[7] = NO+NO2+N2O; - - if (ARRONDI) - y[7] = arrondi ( y[7] , 6 ); - - } - if (CO>EPS) { - // logf<<" --> Warning <-- Presence of CO: "<<CO<<" ppm in "<<name<<".\n"; - y[8] = CO; - if (ARRONDI) - y[8] = arrondi ( y[8] , 6 ); - - } -// logf.close(); - return OK; -} - -void burner::fill_K_array() -{ - a[0]=1.0; a[1]=1.0; a[2]=0.5; a[3]=1.0; - b[0]=1.0; b[1]=0.5; b[2]=1.0; b[3]=-0.5; - c[0]=2.0; c[1]=1.0; c[2]=1.0; c[3]=1.0; - K[0] = exp(-120.27*(173.38-T*0.012)/T); - K[1] = exp(-120.27*(103.64+T*0.074)/T); - K[2] = exp(-120.27*(51.96+T*0.061)/T); - K[3] = exp(-120.27*(283.84-T*0.087)/T); - for(i=0;i<4;i++) - K[i]*=pow(1000, c[i]-a[i]-b[i]); -} - -void burner::write() { - - cout << setprecision(6); - - cout << "WRITE FILE " << RUNTIME << name << ".unit" << " :\n\tBEGIN\n"; - cout << "\t>> " << name; - cout << endl << "\t>> stream in : " << in->name; - cout << endl << "\t>> streams out : " << out->name; - cout << endl << "\t>> P = " << in->P << " atm, T(in) = " << in->T - << " T(out) = " << T << " K"; - O2->P = 1; - O2->T = 293; - O2->state = 1; - O2->find_v(); - N2->P=1; - N2->T=293; - N2->state=1; - N2->find_v(); - cout << endl << "\t>> Required air flow = " - << (O2->m+N2->m) << " kg/s (" << (O2->v+N2->v) << " m3/s)"; - O2->P=in->P; - O2->T=T; - O2->state=1; - O2->find_v(); - N2->P=in->P; - N2->T=T; - N2->state=1; - N2->find_v(); - step=(eta*O2->v/(1+eta)+N2->v+H2O->v+CO2->v+out->v); - cout << endl << "\t>> Total flue gases = " - << (out->m+CO2->m+H2O->m+N2->m+eta*O2->m/(1+eta)) - <<" kg/s (" << step << " m3/s)"; - cout << "\n\tEND\n\n"; - cost(); -} - - -double burner::get_cost ( void ) { - - - O2->P = 1; - O2->T = 293; - O2->state = 1; - O2->find_v(); - N2->P=1; - N2->T=293; - N2->state=1; - N2->find_v(); - O2->P=in->P; - O2->T=T; - O2->state=1; - O2->find_v(); - N2->P=in->P; - N2->T=T; - N2->state=1; - N2->find_v(); - step=(eta*O2->v/(1+eta)+N2->v+H2O->v+CO2->v+out->v); - - buff = 3.1761-0.1373*log10(step) + 0.3414*pow(log10(step),2); - buff = 2.7*pow(10, buff); - buff = buff*MS_YEAR/MS_2001; - - return buff; -} - - -void burner::cost ( void ) { - cout << "WRITE FILE " << RUNTIME << name << ".cost" << " :\n\tBEGIN\n"; - cout << "\t>>" << get_cost(); - cout << "\n\tEND\n\n"; -} +#include "burner.hpp" +using namespace std; + +/*----------------------------------------------------------*/ +/* arrondi pour ne conserver que n chiffres significatifs */ +/*----------------------------------------------------------*/ +double arrondi ( double x , int n ) { + if (fabs(x) < EPS) + return 0.0; + double m = pow ( 10 , ceil(-log10(x)) + n - 1 ); + return round(m*x)/m; +} + +/*---------------------------------------------------------------*/ +burner::burner ( int nb , chemical ** chem ) { + + rem_nb = nb; + + NO=NO2=N2O=CO=0.0; + m = new double[nb]; + can_burn = new bool[nb]; + + // combustion.prop : + // ----------------- + // 64-17-5 3 2 3 + // 74-82-8 2 1 2 + // 1333-74-0 0.5 0 1 + // 100-42-5 10 8 4 + // 74-85-1 3 2 2 + // 108-88-3 9 7 4 + // 100-41-4 10.5 8 5 + // 71-43-2 7.5 6 3 + + for ( i = 0 ; i < nb ; i++ ) { + + can_burn[i] = false; + + if ( chem[i]->CAS == "64-17-5" || + chem[i]->CAS == "74-82-8" || + chem[i]->CAS == "1333-74-0" || + chem[i]->CAS == "100-42-5" || + chem[i]->CAS == "74-85-1" || + chem[i]->CAS == "108-88-3" || + chem[i]->CAS == "100-41-4" || + chem[i]->CAS == "71-43-2" ) + can_burn[i] = true; + } + + O2 = new chemical ("7782-44-7"); + N2 = new chemical ("7727-37-9"); + CO2 = new chemical ("124-38-9"); + H2O = new chemical ("7732-18-5"); + + // Construct the rx array; + rx = new combrx * [nb]; + for ( i = 0 ; i < nb ; i++ ) { + if ( can_burn[i] ) + rx[i] = new combrx ( chem[i]->CAS ); + else + rx[i] = NULL; + } +} + +/*---------------------------------------------------------------*/ +burner::~burner ( void ) { + + delete [] m; + delete [] can_burn; + + for ( i = 0 ; i < rem_nb ; i++ ) + if (rx[i]) + delete rx[i]; + delete [] rx; + + delete O2; + delete N2; + delete CO2; + delete H2O; +} + +/*---------------------------------------------------------------*/ +bool burner::solve(double * y) +{ + OK=true; + //perform mass balance (neglect pollutants flows) + out->m = 0.0; + for(i=0;i<in->nb;i++) + { + if (!can_burn[i]) { + out->chem[i]->m = in->chem[i]->m; + out->m+=out->chem[i]->m; + } + else { + out->chem[i]->m=0.0; + O2->m+=rx[i]->O2_flow()*in->chem[i]->n(); + N2->m+=rx[i]->N2_flow()*in->chem[i]->n(); + CO2->m+=rx[i]->CO2_flow()*in->chem[i]->n(); + H2O->m+=rx[i]->H2O_flow()*in->chem[i]->n(); + } + } + N2->m*=(1.0+eta); + O2->m*=(1.0+eta); + //perform energy balance to find Tout + T = in->T; + + step=10; + Q=1; + // find temperature + while (fabs(step)>TOL_BURN && fabs(Q)>TOL_BURN && T<MAX_TEMP) + { + T+=step; + + if(T>MAX_TEMP) + T=MAX_TEMP; + Q = 0.0; + for ( i = 0 ; i < in->nb ; i++ ) + Q += in->chem[i]->dH ( in->T , T , in->P ) * in->chem[i]->n(); + + for ( i = 0 ; i < in->nb ; i++ ) + if ( can_burn[i] ) + Q += rx[i]->Hcomb(T) * in->chem[i]->n(); + + Q += O2->dH ( 293 , T , in->P ) * O2->n(); + Q += N2->dH ( 293 , T , in->P ) * N2->n(); + + + if (step/fabs(step)*Q >0) + step*= -0.1; + else if (fabs(Q)<10) + step*=0.25; + + } + + + + out->set_thermo(in->thermo); + // out->thermo = in->thermo; + + out->set(in->P, T); + O2->P=in->P; O2->T=T; O2->state=1; O2->find_v(); + N2->P=in->P; N2->T=T; N2->state=1; N2->find_v(); + CO2->P=in->P; CO2->T=T; CO2->state=1; CO2->find_v(); + H2O->P=in->P; H2O->T=T; H2O->state=1; H2O->find_v(); + //check if mixture can burn + m_can_burn = 0.0; + for(i=0;i<in->nb;i++) if(can_burn[i]) m_can_burn+=in->chem[i]->n(); + LFLmix=0.0; + for(i=0;i<in->nb;i++) if(can_burn[i]) LFLmix+=in->chem[i]->n()/m_can_burn*rx[i]->LFL(in->P,T); + UFLmix=0.0; + for(i=0;i<in->nb;i++) if(can_burn[i]) UFLmix+=in->chem[i]->n()/m_can_burn*rx[i]->UFL(in->P,T); + num = 0.0; + buff=in->T; in->set(in->P, T); + for(i=0;i<in->nb;i++) if(can_burn[i]) num+=in->chem[i]->n()/in->n()*in->v; + in->set(in->P, buff); + den = O2->v+N2->v+out->v; + composition = num/den; + if(!(LFLmix<=composition && composition<=UFLmix) || T==MAX_TEMP) + { +// logf.open(MESSAGES,ios::app); +// logf<<" --> Warning <-- Mixture in "<<name<<" can't burn (LFL="<<LFLmix +// <<" UFL="<<UFLmix<<" x="<<composition<<").\n"; +// logf.close(); + T=in->T; + filename = out->name; + *out=*in; + out->set(filename); + // out->write(); // WRITE TOTO + OK=false; + } + else + { + O2->P=in->P; O2->T=T; O2->state=1; O2->find_v(); + N2->P=in->P; N2->T=T; N2->state=1; N2->find_v(); + // out->write(); // WRITE TOTO + } + if(OK) //compute the pollutants production + { + fill_K_array(); + NO = 1e6*sqrt(K[0]*(N2->n()/den)*(O2->n()/den))*den*0.03/(O2->m+N2->m+out->m+H2O->m+CO2->m); + N2O = 1e6*K[1]*(N2->n()/den)*sqrt(O2->n()/den)*den*0.044/(O2->m+N2->m+out->m+H2O->m+CO2->m); + NO2 = 1e6*K[2]*sqrt(N2->n()/den)*(O2->n()/den)*den*0.046/(O2->m+N2->m+out->m+H2O->m+CO2->m); + CO = 1e6*K[3]*(CO2->n()/den)*den/sqrt(O2->n()/den)*0.028/(O2->m+N2->m+out->m+H2O->m+CO2->m); + } +// logf.open(MESSAGES,ios::app); + if (NO>EPS && NO2>EPS && N2O>EPS) { + // logf<<" --> Warning <-- Presence of NOx: "<<(NO+NO2+N2O)<<" ppm in "<<name<<".\n"; + y[7] = NO+NO2+N2O; + + if (ARRONDI) + y[7] = arrondi ( y[7] , 6 ); + + } + if (CO>EPS) { + // logf<<" --> Warning <-- Presence of CO: "<<CO<<" ppm in "<<name<<".\n"; + y[8] = CO; + if (ARRONDI) + y[8] = arrondi ( y[8] , 6 ); + + } +// logf.close(); + return OK; +} + +void burner::fill_K_array() +{ + a[0]=1.0; a[1]=1.0; a[2]=0.5; a[3]=1.0; + b[0]=1.0; b[1]=0.5; b[2]=1.0; b[3]=-0.5; + c[0]=2.0; c[1]=1.0; c[2]=1.0; c[3]=1.0; + K[0] = exp(-120.27*(173.38-T*0.012)/T); + K[1] = exp(-120.27*(103.64+T*0.074)/T); + K[2] = exp(-120.27*(51.96+T*0.061)/T); + K[3] = exp(-120.27*(283.84-T*0.087)/T); + for(i=0;i<4;i++) + K[i]*=pow(1000, c[i]-a[i]-b[i]); +} + +void burner::write() { + + cout << setprecision(6); + + cout << "WRITE FILE " << RUNTIME << name << ".unit" << " :\n\tBEGIN\n"; + cout << "\t>> " << name; + cout << endl << "\t>> stream in : " << in->name; + cout << endl << "\t>> streams out : " << out->name; + cout << endl << "\t>> P = " << in->P << " atm, T(in) = " << in->T + << " T(out) = " << T << " K"; + O2->P = 1; + O2->T = 293; + O2->state = 1; + O2->find_v(); + N2->P=1; + N2->T=293; + N2->state=1; + N2->find_v(); + cout << endl << "\t>> Required air flow = " + << (O2->m+N2->m) << " kg/s (" << (O2->v+N2->v) << " m3/s)"; + O2->P=in->P; + O2->T=T; + O2->state=1; + O2->find_v(); + N2->P=in->P; + N2->T=T; + N2->state=1; + N2->find_v(); + step=(eta*O2->v/(1+eta)+N2->v+H2O->v+CO2->v+out->v); + cout << endl << "\t>> Total flue gases = " + << (out->m+CO2->m+H2O->m+N2->m+eta*O2->m/(1+eta)) + <<" kg/s (" << step << " m3/s)"; + cout << "\n\tEND\n\n"; + cost(); +} + + +double burner::get_cost ( void ) { + + + O2->P = 1; + O2->T = 293; + O2->state = 1; + O2->find_v(); + N2->P=1; + N2->T=293; + N2->state=1; + N2->find_v(); + O2->P=in->P; + O2->T=T; + O2->state=1; + O2->find_v(); + N2->P=in->P; + N2->T=T; + N2->state=1; + N2->find_v(); + step=(eta*O2->v/(1+eta)+N2->v+H2O->v+CO2->v+out->v); + + buff = 3.1761-0.1373*log10(step) + 0.3414*pow(log10(step),2); + buff = 2.7*pow(10, buff); + buff = buff*MS_YEAR/MS_2001; + + return buff; +} + + +void burner::cost ( void ) { + cout << "WRITE FILE " << RUNTIME << name << ".cost" << " :\n\tBEGIN\n"; + cout << "\t>>" << get_cost(); + cout << "\n\tEND\n\n"; +} diff --git a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/burner.hpp b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/burner.hpp index 310df0d78663669e1536c1f38750c21102828ee6..3d834032e5fc8480aa17f95b94b71a9d9fc9cf98 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/burner.hpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/burner.hpp @@ -1,59 +1,59 @@ -/* -This unit simulates a burner. The user must provide the air excess -and all combustion data as defined in data\\combustion.prop : - CAS nb_moles_O2 nb_moles_CO2 nb_moles_H2O -Then, mass and energy balances are performed and flows of common -combustion pollutants are estimated. -(reference : Crowl & Louvar) - -Structure in the .process file: -burner {name} {index of input stream} {index of output stream} {air excess >0 (ex.: 1.2 is a 120% excess)} - -How to use: - 1- Call the constructor: burn = new burner(in, out); burner(nb_in, chem_list) - ->set(in, out) - 2- Set the air excess : burn->set(excess); - 3- Set the name of the unit: burn->set(name); - 4- Solve: bool=burn->solve(); -*/ -#ifndef BURNER_H -#define BURNER_H -#include "stream.hpp" -#include "combrx.hpp" -using namespace std; - -class burner -{ -private: - - string filename; - int rem_nb; - stream *in, *out; - chemical *O2, *N2, *CO2, *H2O; - combrx **rx; - bool *can_burn, stop, OK; - double eta, NO, NO2, N2O, CO; - double T, LFLmix, UFLmix, composition; - string name; - double * m; - double a[4], b[4], c[4], K[4]; - int i; - double buff, Q, m_can_burn, step, num, den; - ifstream data; - // ofstream logf, results; - // terminator *end; - void fill_K_array(); - -public: - // burner(){}; - burner ( int , chemical ** ); - void set ( stream * s1 , stream * s2 ) { in=s1; out=s2; for(i=0;i<in->nb;i++) m[i] = in->chem[i]->m;} - void set ( const string & n ) { name = n; } - void set(double e) {eta = e;} - bool solve(double * y); - void write(); - void cost(); - double get_cost ( void ); - ~burner(); -}; -#endif +/* +This unit simulates a burner. The user must provide the air excess +and all combustion data as defined in data\\combustion.prop : + CAS nb_moles_O2 nb_moles_CO2 nb_moles_H2O +Then, mass and energy balances are performed and flows of common +combustion pollutants are estimated. +(reference : Crowl & Louvar) + +Structure in the .process file: +burner {name} {index of input stream} {index of output stream} {air excess >0 (ex.: 1.2 is a 120% excess)} + +How to use: + 1- Call the constructor: burn = new burner(in, out); burner(nb_in, chem_list) + ->set(in, out) + 2- Set the air excess : burn->set(excess); + 3- Set the name of the unit: burn->set(name); + 4- Solve: bool=burn->solve(); +*/ +#ifndef BURNER_H +#define BURNER_H +#include "stream.hpp" +#include "combrx.hpp" +using namespace std; + +class burner +{ +private: + + string filename; + int rem_nb; + stream *in, *out; + chemical *O2, *N2, *CO2, *H2O; + combrx **rx; + bool *can_burn, stop, OK; + double eta, NO, NO2, N2O, CO; + double T, LFLmix, UFLmix, composition; + string name; + double * m; + double a[4], b[4], c[4], K[4]; + int i; + double buff, Q, m_can_burn, step, num, den; + ifstream data; + // ofstream logf, results; + // terminator *end; + void fill_K_array(); + +public: + // burner(){}; + burner ( int , chemical ** ); + void set ( stream * s1 , stream * s2 ) { in=s1; out=s2; for(i=0;i<in->nb;i++) m[i] = in->chem[i]->m;} + void set ( const string & n ) { name = n; } + void set(double e) {eta = e;} + bool solve(double * y); + void write(); + void cost(); + double get_cost ( void ); + ~burner(); +}; +#endif diff --git a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/cashflow.cpp b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/cashflow.cpp index a35a767865f7f1761450f84acf60c65e996d8311..c7174f643dda84b2d8082bb6f4ba55135f405d52 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/cashflow.cpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/cashflow.cpp @@ -1,114 +1,114 @@ -#include "cashflow.hpp" -using namespace std; - -cashflow::cashflow(int n) -{ - N=n+1; - Inv = new double[N]; - Coper = new double[N]; - Amort = new double[N]; - Rev = new double[N]; - Flow = new double[N]; - Flowact = new double[N]; - Itot=Ctot=Rtot=i_rate=a_rate=0.0; - - - yield_tab[ 0] = 0.515; - yield_tab[ 1] = 0.778; - yield_tab[ 2] = 0.812; - yield_tab[ 3] = 0.893; - yield_tab[ 4] = 0.985; - yield_tab[ 5] = 0.837; - yield_tab[ 6] = 0.849; - yield_tab[ 7] = 0.746; - yield_tab[ 8] = 0.812; - yield_tab[ 9] = 0.954; - yield_tab[10] = 0.999; - yield_tab[11] = 0.961; - yield_tab[12] = 0.815; - yield_tab[13] = 0.886; - yield_tab[14] = 0.922; - -} - -cashflow::~cashflow ( void ) { - delete [] Inv; - delete [] Coper; - delete [] Amort; - delete [] Rev; - delete [] Flow; - delete [] Flowact; -} - -bool cashflow::run() -{ - if(Itot<EPS || Ctot<EPS || Rtot<EPS || i_rate<EPS || a_rate<EPS) - OK=false; - else - { - //if(!MUTE)cout<<endl<<" investments flow... OK"; - set_Inv(); - //if(!MUTE)cout<<endl<<" depreciation flow... OK"; - set_Amort(); - set_C_R(); - //if(!MUTE)cout<<endl<<" costs flow... OK"; - //if(!MUTE)cout<<endl<<" revenus flow... OK"; - for(i=0;i<N;i++) - { - Flow[i] = (Rev[i]-Coper[i])*(1.0-a_rate)-(Inv[i]-a_rate*Amort[i]); - Flowact[i] = Flow[i]/pow(1.0+i_rate, i); - } - //if(!MUTE)cout<<endl<<" cash flow... OK"; - //if(!MUTE)cout<<endl<<" actualizing cash flow... OK"; - OK=true; - -// cout<<endl<<endl<<" CASH FLOW DETAILS"<<endl; -// cout<<endl<<" "<<setfill('-')<<setw(76)<<" "; -// cout<<endl<<" "<<" i "<<" Investment "<<" Deprec. " -// <<" Expenses "<<" Revenus "<<" Cash flow "<<" Act. flow "; -// cout<<endl<<" "<<setfill('-')<<setw(76)<<" "; -// cout<<setfill(' ')<<setiosflags(ios::fixed)<<setprecision(0); -// for(i=0;i<N;i++) -// cout<<endl -// <<" "<<setw(2)<<i<<" "<<setw(11) -// <<Inv[i]<<" "<<setw(11)<<Amort[i]<<" " -// <<setw(11)<<Coper[i]<<" "<<setw(11)<<Rev[i]<<" "<<setw(11)<<Flow[i]<<" "<<setw(11)<<Flowact[i]; -// cout<<endl<<" "<<setfill('-')<<setw(76)<<" "; - } - return OK; -} - -void cashflow::set_Amort() -{ - Amort[0] = 0.0; - temp=Itot; - for(i=1;i<N-1;i++) - { - temp+=Inv[i]; - Amort[i] = temp/double(N-i); - temp-=Amort[i]; - } - Amort[N-1]=Amort[N-2]; -} - -void cashflow::set_Inv() -{ - Inv[0] = Itot; - for(i=1;i<N-1;i++) - { - if((i)%5==0) Inv[i]=0.1*Itot; - else Inv[i]=0.0; - } - Inv[N-1]=0.0; - for(i=0;i<N-1;i++) Inv[N-1]-=0.1*Inv[i]; -} - -void cashflow::set_C_R() -{ - Coper[0] = Rev[0] = 0.0; - for(i=1;i<N;i++) - { - Coper[i] = yield(i)*Ctot; - Rev[i] = yield(i)*Rtot; - } -} +#include "cashflow.hpp" +using namespace std; + +cashflow::cashflow(int n) +{ + N=n+1; + Inv = new double[N]; + Coper = new double[N]; + Amort = new double[N]; + Rev = new double[N]; + Flow = new double[N]; + Flowact = new double[N]; + Itot=Ctot=Rtot=i_rate=a_rate=0.0; + + + yield_tab[ 0] = 0.515; + yield_tab[ 1] = 0.778; + yield_tab[ 2] = 0.812; + yield_tab[ 3] = 0.893; + yield_tab[ 4] = 0.985; + yield_tab[ 5] = 0.837; + yield_tab[ 6] = 0.849; + yield_tab[ 7] = 0.746; + yield_tab[ 8] = 0.812; + yield_tab[ 9] = 0.954; + yield_tab[10] = 0.999; + yield_tab[11] = 0.961; + yield_tab[12] = 0.815; + yield_tab[13] = 0.886; + yield_tab[14] = 0.922; + +} + +cashflow::~cashflow ( void ) { + delete [] Inv; + delete [] Coper; + delete [] Amort; + delete [] Rev; + delete [] Flow; + delete [] Flowact; +} + +bool cashflow::run() +{ + if(Itot<EPS || Ctot<EPS || Rtot<EPS || i_rate<EPS || a_rate<EPS) + OK=false; + else + { + //if(!MUTE)cout<<endl<<" investments flow... OK"; + set_Inv(); + //if(!MUTE)cout<<endl<<" depreciation flow... OK"; + set_Amort(); + set_C_R(); + //if(!MUTE)cout<<endl<<" costs flow... OK"; + //if(!MUTE)cout<<endl<<" revenus flow... OK"; + for(i=0;i<N;i++) + { + Flow[i] = (Rev[i]-Coper[i])*(1.0-a_rate)-(Inv[i]-a_rate*Amort[i]); + Flowact[i] = Flow[i]/pow(1.0+i_rate, i); + } + //if(!MUTE)cout<<endl<<" cash flow... OK"; + //if(!MUTE)cout<<endl<<" actualizing cash flow... OK"; + OK=true; + +// cout<<endl<<endl<<" CASH FLOW DETAILS"<<endl; +// cout<<endl<<" "<<setfill('-')<<setw(76)<<" "; +// cout<<endl<<" "<<" i "<<" Investment "<<" Deprec. " +// <<" Expenses "<<" Revenus "<<" Cash flow "<<" Act. flow "; +// cout<<endl<<" "<<setfill('-')<<setw(76)<<" "; +// cout<<setfill(' ')<<setiosflags(ios::fixed)<<setprecision(0); +// for(i=0;i<N;i++) +// cout<<endl +// <<" "<<setw(2)<<i<<" "<<setw(11) +// <<Inv[i]<<" "<<setw(11)<<Amort[i]<<" " +// <<setw(11)<<Coper[i]<<" "<<setw(11)<<Rev[i]<<" "<<setw(11)<<Flow[i]<<" "<<setw(11)<<Flowact[i]; +// cout<<endl<<" "<<setfill('-')<<setw(76)<<" "; + } + return OK; +} + +void cashflow::set_Amort() +{ + Amort[0] = 0.0; + temp=Itot; + for(i=1;i<N-1;i++) + { + temp+=Inv[i]; + Amort[i] = temp/double(N-i); + temp-=Amort[i]; + } + Amort[N-1]=Amort[N-2]; +} + +void cashflow::set_Inv() +{ + Inv[0] = Itot; + for(i=1;i<N-1;i++) + { + if((i)%5==0) Inv[i]=0.1*Itot; + else Inv[i]=0.0; + } + Inv[N-1]=0.0; + for(i=0;i<N-1;i++) Inv[N-1]-=0.1*Inv[i]; +} + +void cashflow::set_C_R() +{ + Coper[0] = Rev[0] = 0.0; + for(i=1;i<N;i++) + { + Coper[i] = yield(i)*Ctot; + Rev[i] = yield(i)*Rtot; + } +} diff --git a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/cashflow.hpp b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/cashflow.hpp index 5aa5f70ead6aa4bf754d8175e1dbe9358b458352..a71b7abf72e7322f1ed2c25256e1bedcd5a610f9 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/cashflow.hpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/cashflow.hpp @@ -1,33 +1,33 @@ -#ifndef CASHFLOW_H -#define CASHFLOW_H -#include "defines.hpp" -// #include <iomanip> -using namespace std; - -class cashflow -{ - private: - // char name[31], filename[41]; - // ifstream in; - // ofstream out; - double Itot, Ctot, Rtot; - void set_Inv(), set_Amort(), set_C_R(); - double temp; - int i, j, counter; - bool OK; - double yield_tab[15]; - - double yield ( int k ) const { return yield_tab[(k==15) ? 14 : k%15]; } - -public: - double *Inv, *Coper, *Amort, *Rev, *Flow, *Flowact; - double i_rate, a_rate; - int N; - cashflow(int); - ~cashflow(); - // void set(char n[31]) {strcpy(name, n);} - void set_rates(double d1, double d2){i_rate=d1; a_rate=d2;} - void set_basics(double d1, double d2, double d3){Itot=d1; Ctot=d2; Rtot=d3;} - bool run(); -}; -#endif +#ifndef CASHFLOW_H +#define CASHFLOW_H +#include "defines.hpp" +// #include <iomanip> +using namespace std; + +class cashflow +{ + private: + // char name[31], filename[41]; + // ifstream in; + // ofstream out; + double Itot, Ctot, Rtot; + void set_Inv(), set_Amort(), set_C_R(); + double temp; + int i, j, counter; + bool OK; + double yield_tab[15]; + + double yield ( int k ) const { return yield_tab[(k==15) ? 14 : k%15]; } + +public: + double *Inv, *Coper, *Amort, *Rev, *Flow, *Flowact; + double i_rate, a_rate; + int N; + cashflow(int); + ~cashflow(); + // void set(char n[31]) {strcpy(name, n);} + void set_rates(double d1, double d2){i_rate=d1; a_rate=d2;} + void set_basics(double d1, double d2, double d3){Itot=d1; Ctot=d2; Rtot=d3;} + bool run(); +}; +#endif diff --git a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/chemical.cpp b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/chemical.cpp index ad29297014d461b8355574e2129aa39760f4f545..3c155a15a133f26f879eb326abe88654bf9f89d1 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/chemical.cpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/chemical.cpp @@ -1,529 +1,529 @@ -#include "chemical.hpp" -using namespace std; - -void chemical::check_error ( void ) { - if (error>MAX_ERROR) { - cout << "ERROR 2\n\n"; - exit(0); - } - if (warning>MAX_WARNING) { - cout << "ERROR 3\n\n"; - exit(0); - } -} - -// copy-constr. : -chemical::chemical ( const chemical & chem ) { - - CAS = chem.CAS; - name = chem.name; - M = chem.M; - - state = chem.state; - Tm = chem.Tm; - Tb = chem.Tb; - Tc = chem.Tc; - Pc = chem.Pc; - Ho = chem.Ho; - rho_liq = chem.rho_liq; - dHvap = chem.dHvap; - - mu_param[0] = chem.mu_param[0]; - mu_param[1] = chem.mu_param[1]; - Cp_param[0] = chem.Cp_param[0]; - Cp_param[1] = chem.Cp_param[1]; - Cp_param[2] = chem.Cp_param[2]; - Cp_param[3] = chem.Cp_param[3]; - Cp_liq = chem.Cp_liq; - Psat_param[0] = chem.Psat_param[0]; - Psat_param[1] = chem.Psat_param[1]; - Psat_param[2] = chem.Psat_param[2]; - - thermo = new thermolib(); - thermo->send(Pc,Tc, omega()); - - P = chem.P; - T = chem.T; - m = chem.m; - v = chem.v; - - warning = chem.warning; - error = chem.error; - tmp = chem.tmp; -} - -chemical::chemical ( const string & chem_name ) { - - CAS = chem_name; - - // C. Tribes add initialization for more robustness (variables may be initialized uncorrectly dependent on the execution) - P=T=m=v=0.0; - - // 1/12 : - if (CAS=="100-41-4") { - name = "ethylbenzene"; - M = 106.17; - state = 0; - Tm = 178.2; - Tb = 409.3; - Tc = 617.1; - Pc = 35.6; - Ho = 29.79; - rho_liq = 867.0; - dHvap = 35.56; - mu_param[0] = 472.82; - mu_param[1] = 264.22; - Cp_param[0] = -43.069; - Cp_param[1] = 7.067e-01; - Cp_param[2] = -4.807e-04; - Cp_param[3] = 1.30e-07; - Cp_liq = 190.23; - Psat_param[0] = 16.0195; - Psat_param[1] = 3279.47; - Psat_param[2] = -59.95; - } - - // 2/12 : - else if (CAS=="1333-74-0") { - name = "hydrogen"; - M = 2.02; - state = 1; - Tm = 14.0; - Tb = 20.4; - Tc = 33.2; - Pc = 12.8; - Ho = 0.0; - rho_liq = 71.0; - dHvap = 0.9; - mu_param[0] = 13.82; - mu_param[1] = 5.39; - Cp_param[0] = 27.124; - Cp_param[1] = 9.267e-03; - Cp_param[2] = -1.380e-05; - Cp_param[3] = 7.64e-09; - Cp_liq = 0.0; - Psat_param[0] = 13.6333; - Psat_param[1] = 164.90; - Psat_param[2] = 3.19; - } - - // 3/12 : - else if (CAS=="108-88-3") { - name = "toluene"; - M =92.14; - state = 0; - Tm = 178.0; - Tb = 383.8; - Tc = 591.7; - Pc = 40.6; - Ho = 50.0; - rho_liq = 867; - dHvap = 33.18; - mu_param[0] = 467.33; - mu_param[1] = 255.24; - Cp_param[0] = -24.338; - Cp_param[1] = 5.121e-1; - Cp_param[2] = -2.763e-4; - Cp_param[3] = 4.91e-8; - Cp_liq = 159.85; - Psat_param[0] = 16.0137; - Psat_param[1] = 3096.52; - Psat_param[2] = -53.67; - } - - // 4/12 : - else if (CAS=="74-82-8") { - name = "methane"; - M =16.04; - state =1; - Tm = 90.7; - Tb = 111.7; - Tc = 190.6; - Pc = 45.4; - Ho = -74.85; - rho_liq = 425; - dHvap = 8.18; - mu_param[0] = 114.14; - mu_param[1] = 57.60; - Cp_param[0] = 19.238; - Cp_param[1] = 5.209e-02; - Cp_param[2] = 1.197e-05; - Cp_param[3] = -1.13e-08; - Cp_liq = 0.0; - Psat_param[0] = 15.2243; - Psat_param[1] = 897.84; - Psat_param[2] = -7.16; - } - - // 5/12 : - else if (CAS=="71-43-2") { - name = "benzene"; - M = 78.11; - state = 0; - Tm = 278.7; - Tb = 353.3; - Tc = 562.1; - Pc = 48.3; - Ho = 82.93; - rho_liq = 885; - dHvap = 30.76; - mu_param[0] = 545.64; - mu_param[1] = 265.24; - Cp_param[0] = 33.894; - Cp_param[1] = 4.74e-1; - Cp_param[2] = -3.015e-4; - Cp_param[3] = 7.13e-8; - Cp_liq = 116.03; - Psat_param[0] = 15.9008; - Psat_param[1] = 2788.51; - Psat_param[2] = -52.36; - } - - // 6/12 : - else if (CAS=="74-85-1") { - name = "ethylene"; - M = 28.05; - state =1; - Tm = 104.0; - Tb = 169.4; - Tc = 282.4; - Pc = 49.7; - Ho =52.3; - rho_liq = 577.0; - dHvap = 13.54; - mu_param[0] = 168.98; - mu_param[1] = 93.94; - Cp_param[0] = 3.803; - Cp_param[1] = 1.565e-01; - Cp_param[2] = -8.343e-05; - Cp_param[3] = 1.75e-08; - Cp_liq = 0.0; - Psat_param[0] =15.5368; - Psat_param[1] = 1347.01; - Psat_param[2] = -18.15; - } - - // 7/12 : - else if (CAS=="100-42-5") { - name = "styrene"; - M =104.15; - state = 0; - Tm = 242.5; - Tb = 418.3; - Tc =647.0; - Pc =39.4; - Ho =147.36; - rho_liq =906.0; - dHvap = 36.82; - mu_param[0] = 528.64; - mu_param[1] = 276.71; - Cp_param[0] =-28.229; - Cp_param[1] =6.155e-01; - Cp_param[2] = -4.020e-04; - Cp_param[3] = 9.93e-08; - Cp_liq =166.13; - Psat_param[0] = 16.0193; - Psat_param[1] = 3328.57; - Psat_param[2] =-63.72; - } - - // 8/12 : - else if (CAS=="7782-44-7") { - name = "oxygen"; - M = 32.00; - state = 1; - Tm = 54.4; - Tb = 90.2; - Tc = 154.6; - Pc = 49.8; - Ho =0.0 ; - rho_liq =1149.1 ; - dHvap =6.82 ; - mu_param[0] = 85.68; - mu_param[1] = 51.50; - Cp_param[0] = 28.087; - Cp_param[1] = -3.678e-06 ; - Cp_param[2] = 1.745e-05; - Cp_param[3] = -1.06e-08; - Cp_liq =0.0 ; - Psat_param[0] = 15.4075; - Psat_param[1] = 734.55 ; - Psat_param[2] =-6.45 ; - } - - // 9/12 : - else if (CAS=="7727-37-9") { - name = "nitrogen"; - M = 28.01; - state = 1; - Tm = 63.3; - Tb = 77.4; - Tc = 126.2; - Pc = 33.5; - Ho = 0.0; - rho_liq = 804.0; - dHvap = 5.58; - mu_param[0] = 90.30; - mu_param[1] = 46.41; - Cp_param[0] = 31.128; - Cp_param[1] = -1.356e-02 ; - Cp_param[2] = 2.678e-05; - Cp_param[3] =-1.17e-08 ; - Cp_liq = 0.0; - Psat_param[0] = 14.9342; - Psat_param[1] = 588.72; - Psat_param[2] = -6.60; - } - - // 10/12 : - else if (CAS=="124-38-9") { - name = "carbon-dioxide"; - M =44.01; - state = 1; - Tm = 216.6; - Tb = 194.4; - Tc = 304.2; - Pc = 72.8; - Ho = -393.41; - rho_liq = 777.0; - dHvap = 17.15; - mu_param[0] = 578.08; - mu_param[1] = 185.24 ; - Cp_param[0] = 19.782; - Cp_param[1] = 7.339e-02; - Cp_param[2] = -5.598e-05; - Cp_param[3] = 1.71e-08; - Cp_liq = 0.0; - Psat_param[0] = 22.5898; - Psat_param[1] =3103.39 ; - Psat_param[2] = -0.16; - } - - // 11/12 : - else if (CAS=="7732-18-5") { - name = "water"; - M =18.02; - state = 0; - Tm = 273.15; - Tb = 373.15; - Tc = 647.4; - Pc = 217.6; - Ho = -241.83; - rho_liq = 998 ; - dHvap = 40.66; - mu_param[0] = 658.25; - mu_param[1] = 283.16; - Cp_param[0] = 32.220; - Cp_param[1] = 1.923e-03 ; - Cp_param[2] = 1.055e-05; - Cp_param[3] = -3.59e-09; - Cp_liq = 75.24; - Psat_param[0] = 18.3036; - Psat_param[1] = 3816.44; - Psat_param[2] = -46.13; - } - - // 12/12 : - else if (CAS=="64-17-5") { - name = "ethanol"; - M =46.07; - state =0 ; - Tm =159.1 ; - Tb = 351.5; - Tc = 516.2; - Pc =63.0 ; - Ho = -234.8; - rho_liq = 789.0; - dHvap =38.74 ; - mu_param[0] = 686.64; - mu_param[1] = 300.88; - Cp_param[0] = 9.008; - Cp_param[1] = 2.139e-01; - Cp_param[2] = -8.385e-05 ; - Cp_param[3] = 1.37e-09; - Cp_liq = 2.22; - Psat_param[0] = 18.9119; - Psat_param[1] = 3803.98; - Psat_param[2] = -41.68; - } - - else { - cout << "ERROR 1\n\n"; - exit(0); - } - - thermo = new thermolib(); - thermo->send(Pc,Tc, omega()); - - -} - -double chemical::K() -{ - thermo->set(P,T,v,n()); - return thermo->K(); -} - -double chemical::mu() -{ - // Returns the fluid's viscosity in Pa.s - if (Tm<=T && T<=Tboil(P)) - return pow(10,(mu_param[0]*(1.0/T-1.0/mu_param[1])-3)); - else - { - ofstream logf; - logf.open(MESSAGES, ios::app); - logf<<" --> Warning <-- Cannot compute viscosity of "<<name<<".\n"; - logf.close(); - warning++; - check_error(); - return 1.0; - } -} - -double chemical::rho() -{ - // Returns the fluid's density in kg/m3, wether it's liquid or gas - if(state==0) tmp= rho_liq; - if(state==1) - { - find_v(); - if (v>EPS) tmp= m/v; - else tmp= 0.0; - } - return tmp; -} - -double chemical::Cp() { - // cout<<endl<<"Cp de "<<name<<" a "<<T; - // Returns the fluid's Cp in J/mol.K - if(state==0) { - - // tmp = Cp_liq; // BUG : boucle infinie !!! - return Cp_liq; // SEB - - } - if(state==1 || T>Tboil(P)) { - tmp=0; - for (int i=0;i<4;i++) - tmp+=Cp_param[i]*pow(T,i); - } - else { - T=Tb; - - tmp = Cp(); // ici boucle infinie si state==0 !!! - - } - return tmp; -} - -double chemical::Cp(bool q) -{ - // Returns the fluid's Cp in J/mol.K - if(q==0) tmp=Cp_liq; - if(q==1) - { - tmp=0; - for (int i=0;i<4;i++) tmp+=Cp_param[i]*pow(T,i); - } - return tmp; -} - -double chemical::Psat() -{ - // Returns the fluid's vapor pressure in atm, using Antoine's equation - if(Tm<=T && T<=Tc) - return (exp(Psat_param[0]-Psat_param[1]/(T+Psat_param[2]))/760.01); - else - { - - return Psat(Tb); - } -} -double chemical::Psat(double t) -{ - // Returns the fluid's vapor pressure in atm, using Antoine's equation - return (exp(Psat_param[0]-Psat_param[1]/(t+Psat_param[2]))/760.01); -} - -double chemical::dH(double T1,double T2, double pres) -{ - //Enthalpy variation in kJ/mol. Does not affect any attributes of current object. - double energy=0, TT=Tboil(pres), vap=Hvap(TT); - int sign=1, i; - if (T2<T1) {sign = -1; energy=T1; T1=T2; T2=energy; energy=0;} - if (T1==T2) energy = 0.0; - if (T2<TT) energy = Cp_liq*(T2-T1)/1000; - if (TT<T1) for (i=1;i<=4;i++) energy+=Cp_param[i-1]*(pow(T2,i)-pow(T1,i))/i/1000; - if(T1<=TT && TT<=T2) - { - energy=Cp_liq*(TT-T1)/1000; - energy+=vap; - for (i=1;i<=4;i++) energy+=Cp_param[i-1]*(pow(T2,i)-pow(TT,i))/i/1000; - } - return energy*sign; -} - -void chemical::find_T() -{ - if(n()>EPS && P>EPS) - { - thermo->set(P,T,v,n()); - T=thermo->T(); - } - else - { - ofstream logf; - logf.open(MESSAGES, ios::app); - logf<<" --> Warning <-- Cannot find T of "<<name<<".\n"; - logf.close(); - warning++; - } - check_error(); -} - -void chemical::find_P() -{ - if(n()>EPS && T>EPS) - { - thermo->set(P,T,v,n()); - P=thermo->P(); - } - else - { - ofstream logf; - logf.open(MESSAGES, ios::app); - logf<<" --> Warning <-- Cannot find P of "<<name<<".\n"; - logf.close(); - warning++; - } - check_error(); -} - -void chemical::find_v() -{ - - if(state==0) v=m/rho_liq; - if(state==1 && P>EPS && T>EPS && m>EPS) - { - thermo->set(P,T,v,n()); - v=thermo->v(); - } -} - -void chemical::find_state() -{ - ofstream logf; - if (T>Tc || P>Pc) state = 1; //T or P is bigger than Tc or Pc - if (T<=Tm) //T is smaller than melting point - { - ofstream logf; - logf.open(MESSAGES, ios::app); - logf<<" --> Warning <-- The chemical "<<name<<" is solid.\n"; - logf.close(); - warning++; - } - check_error(); - if (T<Tboil(P)) state=0; - else state=1; -} +#include "chemical.hpp" +using namespace std; + +void chemical::check_error ( void ) { + if (error>MAX_ERROR) { + cout << "ERROR 2\n\n"; + exit(0); + } + if (warning>MAX_WARNING) { + cout << "ERROR 3\n\n"; + exit(0); + } +} + +// copy-constr. : +chemical::chemical ( const chemical & chem ) { + + CAS = chem.CAS; + name = chem.name; + M = chem.M; + + state = chem.state; + Tm = chem.Tm; + Tb = chem.Tb; + Tc = chem.Tc; + Pc = chem.Pc; + Ho = chem.Ho; + rho_liq = chem.rho_liq; + dHvap = chem.dHvap; + + mu_param[0] = chem.mu_param[0]; + mu_param[1] = chem.mu_param[1]; + Cp_param[0] = chem.Cp_param[0]; + Cp_param[1] = chem.Cp_param[1]; + Cp_param[2] = chem.Cp_param[2]; + Cp_param[3] = chem.Cp_param[3]; + Cp_liq = chem.Cp_liq; + Psat_param[0] = chem.Psat_param[0]; + Psat_param[1] = chem.Psat_param[1]; + Psat_param[2] = chem.Psat_param[2]; + + thermo = new thermolib(); + thermo->send(Pc,Tc, omega()); + + P = chem.P; + T = chem.T; + m = chem.m; + v = chem.v; + + warning = chem.warning; + error = chem.error; + tmp = chem.tmp; +} + +chemical::chemical ( const string & chem_name ) { + + CAS = chem_name; + + // C. Tribes add initialization for more robustness (variables may be initialized uncorrectly dependent on the execution) + P=T=m=v=0.0; + + // 1/12 : + if (CAS=="100-41-4") { + name = "ethylbenzene"; + M = 106.17; + state = 0; + Tm = 178.2; + Tb = 409.3; + Tc = 617.1; + Pc = 35.6; + Ho = 29.79; + rho_liq = 867.0; + dHvap = 35.56; + mu_param[0] = 472.82; + mu_param[1] = 264.22; + Cp_param[0] = -43.069; + Cp_param[1] = 7.067e-01; + Cp_param[2] = -4.807e-04; + Cp_param[3] = 1.30e-07; + Cp_liq = 190.23; + Psat_param[0] = 16.0195; + Psat_param[1] = 3279.47; + Psat_param[2] = -59.95; + } + + // 2/12 : + else if (CAS=="1333-74-0") { + name = "hydrogen"; + M = 2.02; + state = 1; + Tm = 14.0; + Tb = 20.4; + Tc = 33.2; + Pc = 12.8; + Ho = 0.0; + rho_liq = 71.0; + dHvap = 0.9; + mu_param[0] = 13.82; + mu_param[1] = 5.39; + Cp_param[0] = 27.124; + Cp_param[1] = 9.267e-03; + Cp_param[2] = -1.380e-05; + Cp_param[3] = 7.64e-09; + Cp_liq = 0.0; + Psat_param[0] = 13.6333; + Psat_param[1] = 164.90; + Psat_param[2] = 3.19; + } + + // 3/12 : + else if (CAS=="108-88-3") { + name = "toluene"; + M =92.14; + state = 0; + Tm = 178.0; + Tb = 383.8; + Tc = 591.7; + Pc = 40.6; + Ho = 50.0; + rho_liq = 867; + dHvap = 33.18; + mu_param[0] = 467.33; + mu_param[1] = 255.24; + Cp_param[0] = -24.338; + Cp_param[1] = 5.121e-1; + Cp_param[2] = -2.763e-4; + Cp_param[3] = 4.91e-8; + Cp_liq = 159.85; + Psat_param[0] = 16.0137; + Psat_param[1] = 3096.52; + Psat_param[2] = -53.67; + } + + // 4/12 : + else if (CAS=="74-82-8") { + name = "methane"; + M =16.04; + state =1; + Tm = 90.7; + Tb = 111.7; + Tc = 190.6; + Pc = 45.4; + Ho = -74.85; + rho_liq = 425; + dHvap = 8.18; + mu_param[0] = 114.14; + mu_param[1] = 57.60; + Cp_param[0] = 19.238; + Cp_param[1] = 5.209e-02; + Cp_param[2] = 1.197e-05; + Cp_param[3] = -1.13e-08; + Cp_liq = 0.0; + Psat_param[0] = 15.2243; + Psat_param[1] = 897.84; + Psat_param[2] = -7.16; + } + + // 5/12 : + else if (CAS=="71-43-2") { + name = "benzene"; + M = 78.11; + state = 0; + Tm = 278.7; + Tb = 353.3; + Tc = 562.1; + Pc = 48.3; + Ho = 82.93; + rho_liq = 885; + dHvap = 30.76; + mu_param[0] = 545.64; + mu_param[1] = 265.24; + Cp_param[0] = 33.894; + Cp_param[1] = 4.74e-1; + Cp_param[2] = -3.015e-4; + Cp_param[3] = 7.13e-8; + Cp_liq = 116.03; + Psat_param[0] = 15.9008; + Psat_param[1] = 2788.51; + Psat_param[2] = -52.36; + } + + // 6/12 : + else if (CAS=="74-85-1") { + name = "ethylene"; + M = 28.05; + state =1; + Tm = 104.0; + Tb = 169.4; + Tc = 282.4; + Pc = 49.7; + Ho =52.3; + rho_liq = 577.0; + dHvap = 13.54; + mu_param[0] = 168.98; + mu_param[1] = 93.94; + Cp_param[0] = 3.803; + Cp_param[1] = 1.565e-01; + Cp_param[2] = -8.343e-05; + Cp_param[3] = 1.75e-08; + Cp_liq = 0.0; + Psat_param[0] =15.5368; + Psat_param[1] = 1347.01; + Psat_param[2] = -18.15; + } + + // 7/12 : + else if (CAS=="100-42-5") { + name = "styrene"; + M =104.15; + state = 0; + Tm = 242.5; + Tb = 418.3; + Tc =647.0; + Pc =39.4; + Ho =147.36; + rho_liq =906.0; + dHvap = 36.82; + mu_param[0] = 528.64; + mu_param[1] = 276.71; + Cp_param[0] =-28.229; + Cp_param[1] =6.155e-01; + Cp_param[2] = -4.020e-04; + Cp_param[3] = 9.93e-08; + Cp_liq =166.13; + Psat_param[0] = 16.0193; + Psat_param[1] = 3328.57; + Psat_param[2] =-63.72; + } + + // 8/12 : + else if (CAS=="7782-44-7") { + name = "oxygen"; + M = 32.00; + state = 1; + Tm = 54.4; + Tb = 90.2; + Tc = 154.6; + Pc = 49.8; + Ho =0.0 ; + rho_liq =1149.1 ; + dHvap =6.82 ; + mu_param[0] = 85.68; + mu_param[1] = 51.50; + Cp_param[0] = 28.087; + Cp_param[1] = -3.678e-06 ; + Cp_param[2] = 1.745e-05; + Cp_param[3] = -1.06e-08; + Cp_liq =0.0 ; + Psat_param[0] = 15.4075; + Psat_param[1] = 734.55 ; + Psat_param[2] =-6.45 ; + } + + // 9/12 : + else if (CAS=="7727-37-9") { + name = "nitrogen"; + M = 28.01; + state = 1; + Tm = 63.3; + Tb = 77.4; + Tc = 126.2; + Pc = 33.5; + Ho = 0.0; + rho_liq = 804.0; + dHvap = 5.58; + mu_param[0] = 90.30; + mu_param[1] = 46.41; + Cp_param[0] = 31.128; + Cp_param[1] = -1.356e-02 ; + Cp_param[2] = 2.678e-05; + Cp_param[3] =-1.17e-08 ; + Cp_liq = 0.0; + Psat_param[0] = 14.9342; + Psat_param[1] = 588.72; + Psat_param[2] = -6.60; + } + + // 10/12 : + else if (CAS=="124-38-9") { + name = "carbon-dioxide"; + M =44.01; + state = 1; + Tm = 216.6; + Tb = 194.4; + Tc = 304.2; + Pc = 72.8; + Ho = -393.41; + rho_liq = 777.0; + dHvap = 17.15; + mu_param[0] = 578.08; + mu_param[1] = 185.24 ; + Cp_param[0] = 19.782; + Cp_param[1] = 7.339e-02; + Cp_param[2] = -5.598e-05; + Cp_param[3] = 1.71e-08; + Cp_liq = 0.0; + Psat_param[0] = 22.5898; + Psat_param[1] =3103.39 ; + Psat_param[2] = -0.16; + } + + // 11/12 : + else if (CAS=="7732-18-5") { + name = "water"; + M =18.02; + state = 0; + Tm = 273.15; + Tb = 373.15; + Tc = 647.4; + Pc = 217.6; + Ho = -241.83; + rho_liq = 998 ; + dHvap = 40.66; + mu_param[0] = 658.25; + mu_param[1] = 283.16; + Cp_param[0] = 32.220; + Cp_param[1] = 1.923e-03 ; + Cp_param[2] = 1.055e-05; + Cp_param[3] = -3.59e-09; + Cp_liq = 75.24; + Psat_param[0] = 18.3036; + Psat_param[1] = 3816.44; + Psat_param[2] = -46.13; + } + + // 12/12 : + else if (CAS=="64-17-5") { + name = "ethanol"; + M =46.07; + state =0 ; + Tm =159.1 ; + Tb = 351.5; + Tc = 516.2; + Pc =63.0 ; + Ho = -234.8; + rho_liq = 789.0; + dHvap =38.74 ; + mu_param[0] = 686.64; + mu_param[1] = 300.88; + Cp_param[0] = 9.008; + Cp_param[1] = 2.139e-01; + Cp_param[2] = -8.385e-05 ; + Cp_param[3] = 1.37e-09; + Cp_liq = 2.22; + Psat_param[0] = 18.9119; + Psat_param[1] = 3803.98; + Psat_param[2] = -41.68; + } + + else { + cout << "ERROR 1\n\n"; + exit(0); + } + + thermo = new thermolib(); + thermo->send(Pc,Tc, omega()); + + +} + +double chemical::K() +{ + thermo->set(P,T,v,n()); + return thermo->K(); +} + +double chemical::mu() +{ + // Returns the fluid's viscosity in Pa.s + if (Tm<=T && T<=Tboil(P)) + return pow(10,(mu_param[0]*(1.0/T-1.0/mu_param[1])-3)); + else + { + ofstream logf; + logf.open(MESSAGES, ios::app); + logf<<" --> Warning <-- Cannot compute viscosity of "<<name<<".\n"; + logf.close(); + warning++; + check_error(); + return 1.0; + } +} + +double chemical::rho() +{ + // Returns the fluid's density in kg/m3, wether it's liquid or gas + if(state==0) tmp= rho_liq; + if(state==1) + { + find_v(); + if (v>EPS) tmp= m/v; + else tmp= 0.0; + } + return tmp; +} + +double chemical::Cp() { + // cout<<endl<<"Cp de "<<name<<" a "<<T; + // Returns the fluid's Cp in J/mol.K + if(state==0) { + + // tmp = Cp_liq; // BUG : boucle infinie !!! + return Cp_liq; // SEB + + } + if(state==1 || T>Tboil(P)) { + tmp=0; + for (int i=0;i<4;i++) + tmp+=Cp_param[i]*pow(T,i); + } + else { + T=Tb; + + tmp = Cp(); // ici boucle infinie si state==0 !!! + + } + return tmp; +} + +double chemical::Cp(bool q) +{ + // Returns the fluid's Cp in J/mol.K + if(q==0) tmp=Cp_liq; + if(q==1) + { + tmp=0; + for (int i=0;i<4;i++) tmp+=Cp_param[i]*pow(T,i); + } + return tmp; +} + +double chemical::Psat() +{ + // Returns the fluid's vapor pressure in atm, using Antoine's equation + if(Tm<=T && T<=Tc) + return (exp(Psat_param[0]-Psat_param[1]/(T+Psat_param[2]))/760.01); + else + { + + return Psat(Tb); + } +} +double chemical::Psat(double t) +{ + // Returns the fluid's vapor pressure in atm, using Antoine's equation + return (exp(Psat_param[0]-Psat_param[1]/(t+Psat_param[2]))/760.01); +} + +double chemical::dH(double T1,double T2, double pres) +{ + //Enthalpy variation in kJ/mol. Does not affect any attributes of current object. + double energy=0, TT=Tboil(pres), vap=Hvap(TT); + int sign=1, i; + if (T2<T1) {sign = -1; energy=T1; T1=T2; T2=energy; energy=0;} + if (T1==T2) energy = 0.0; + if (T2<TT) energy = Cp_liq*(T2-T1)/1000; + if (TT<T1) for (i=1;i<=4;i++) energy+=Cp_param[i-1]*(pow(T2,i)-pow(T1,i))/i/1000; + if(T1<=TT && TT<=T2) + { + energy=Cp_liq*(TT-T1)/1000; + energy+=vap; + for (i=1;i<=4;i++) energy+=Cp_param[i-1]*(pow(T2,i)-pow(TT,i))/i/1000; + } + return energy*sign; +} + +void chemical::find_T() +{ + if(n()>EPS && P>EPS) + { + thermo->set(P,T,v,n()); + T=thermo->T(); + } + else + { + ofstream logf; + logf.open(MESSAGES, ios::app); + logf<<" --> Warning <-- Cannot find T of "<<name<<".\n"; + logf.close(); + warning++; + } + check_error(); +} + +void chemical::find_P() +{ + if(n()>EPS && T>EPS) + { + thermo->set(P,T,v,n()); + P=thermo->P(); + } + else + { + ofstream logf; + logf.open(MESSAGES, ios::app); + logf<<" --> Warning <-- Cannot find P of "<<name<<".\n"; + logf.close(); + warning++; + } + check_error(); +} + +void chemical::find_v() +{ + + if(state==0) v=m/rho_liq; + if(state==1 && P>EPS && T>EPS && m>EPS) + { + thermo->set(P,T,v,n()); + v=thermo->v(); + } +} + +void chemical::find_state() +{ + ofstream logf; + if (T>Tc || P>Pc) state = 1; //T or P is bigger than Tc or Pc + if (T<=Tm) //T is smaller than melting point + { + ofstream logf; + logf.open(MESSAGES, ios::app); + logf<<" --> Warning <-- The chemical "<<name<<" is solid.\n"; + logf.close(); + warning++; + } + check_error(); + if (T<Tboil(P)) state=0; + else state=1; +} diff --git a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/chemical.hpp b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/chemical.hpp index 344bd010651aa1f3e1229bc32e714752c22b628a..71b28a956e9a81d399e78c777bb896601170e64c 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/chemical.hpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/chemical.hpp @@ -1,48 +1,48 @@ -#ifndef CHEMICAL_H -#define CHEMICAL_H - -#include "thermolib.hpp" -#include <string> -using namespace std; - -class chemical -{ - public: - string name; - string CAS; - double M; //molar weight, in g/mol - bool state; //current state : 0=liquid 1=gas - double P, T, m, v; //current values : P in atm, T in K, m in kg/s, v in m3/s - - double n() {return 1000.0*m/M;} //mole flow in mol/s - double Hvap(double t) {return dHvap*pow((Tc-t)/(Tc-Tb),0.38);} //vaporization heat at specific T (Watson correlation) - double omega() {return ((-1.0)*log10(Psat(0.7*Tc)/Pc) -1.0);} //Pitzer acentric factor - double Tboil(double p) {return (Psat_param[1]/(Psat_param[0]-log(760.01*p))-Psat_param[2]);} //boiling tempararure at specific P - double mu(), rho(), Cp(), Cp(bool), Psat(), Psat(double); //T-dependant properties - double K(); //liquid-vapor equilibrium constant - double gamma(){return Cp(true)/(Cp(true)-8.3144);}//compressibility ratio =Cp/Cv - double dH(double, double, double); //enthalpy variation kJ/mol - void find_T(), find_P(), find_v(), find_state(); //for gases only - double Tm, Tb, Tc, Pc; //melting, boiling and critical temp. (K); critical pressure (atm) - double Ho;//standard formation heat in kJ/mol - - //private: - int warning, error; - void check_error(); - double dHvap, tmp; //vaporization heat (kJ/mol) - double mu_param[2], Cp_param[4], Cp_liq, Psat_param[3], rho_liq; //correlations parameters - thermolib *thermo; - - // public: - // chemical() {}; - - // copy-constr. : - chemical ( const chemical & chem ); - - chemical ( const string & chem_name ); //Contructor : initializes fields and reads CAS in the data file - void purge() {P=T=m=v=0.0; state=false;} - ~chemical(){delete thermo;}; -}; - -#endif - +#ifndef CHEMICAL_H +#define CHEMICAL_H + +#include "thermolib.hpp" +#include <string> +using namespace std; + +class chemical +{ + public: + string name; + string CAS; + double M; //molar weight, in g/mol + bool state; //current state : 0=liquid 1=gas + double P, T, m, v; //current values : P in atm, T in K, m in kg/s, v in m3/s + + double n() {return 1000.0*m/M;} //mole flow in mol/s + double Hvap(double t) {return dHvap*pow((Tc-t)/(Tc-Tb),0.38);} //vaporization heat at specific T (Watson correlation) + double omega() {return ((-1.0)*log10(Psat(0.7*Tc)/Pc) -1.0);} //Pitzer acentric factor + double Tboil(double p) {return (Psat_param[1]/(Psat_param[0]-log(760.01*p))-Psat_param[2]);} //boiling tempararure at specific P + double mu(), rho(), Cp(), Cp(bool), Psat(), Psat(double); //T-dependant properties + double K(); //liquid-vapor equilibrium constant + double gamma(){return Cp(true)/(Cp(true)-8.3144);}//compressibility ratio =Cp/Cv + double dH(double, double, double); //enthalpy variation kJ/mol + void find_T(), find_P(), find_v(), find_state(); //for gases only + double Tm, Tb, Tc, Pc; //melting, boiling and critical temp. (K); critical pressure (atm) + double Ho;//standard formation heat in kJ/mol + + //private: + int warning, error; + void check_error(); + double dHvap, tmp; //vaporization heat (kJ/mol) + double mu_param[2], Cp_param[4], Cp_liq, Psat_param[3], rho_liq; //correlations parameters + thermolib *thermo; + + // public: + // chemical() {}; + + // copy-constr. : + chemical ( const chemical & chem ); + + chemical ( const string & chem_name ); //Contructor : initializes fields and reads CAS in the data file + void purge() {P=T=m=v=0.0; state=false;} + ~chemical(){delete thermo;}; +}; + +#endif + diff --git a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/column.cpp b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/column.cpp index f4a35c181e862b1a9b1eafdaf1190ff41abe19d8..85ab3e0b27bf8f9ab868d5792401fe63d4e0bbbd 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/column.cpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/column.cpp @@ -1,290 +1,290 @@ -#include "column.hpp" -using namespace std; - -column::column(stream* in, stream* out_B, stream* out_D) -{ - F = in; - B = out_B; - D = out_D; - L=new stream("columnL", F->nb, F->chem); - V=new stream("columnV", F->nb, F->chem); - flasher = new flash(F, L, V); - alpha_1 = new double[F->nb]; - alpha_f = new double[F->nb]; - alpha_N = new double[F->nb]; - alpha_m = new double[F->nb]; - T_d=0; T_b=0; T_f=F->T; -// for(i=0;i<F->nb;i++) -// if(F->chem[i]->Tc<F->T && F->chem[i]->m>EPS) -// { -// logf.open(MESSAGES,ios::app); -// logf<<" --> Warning <-- Presence of gas in column.\n"; -// logf.close(); -// i=F->nb; -// } -} - -column::~column() -{ - delete L; delete V; delete flasher; - delete [] alpha_1; - delete [] alpha_f; - delete [] alpha_N; - delete [] alpha_m; -} - -void column::set(double p, int lk, double xd, int hk, double xb) -{ - P=p; - HK=hk-1; x_B=xb; - LK=lk-1; x_D=xd; - //logf.open(MESSAGES, ios::app); - // F->write(); system("pause"); - // if (F->chem[LK]->m<EPS) logf<<" ==> Error <== Flow of light key in column "<<name<<" is zero.\n"; -// if (F->chem[HK]->m<EPS) logf<<" ==> Error <== Flow of heavy key in column "<<name<<" is zero.\n"; - //logf.close(); -} - -bool column::solve() -{ - - OK=true; - // B->thermo=F->thermo; D->thermo=F->thermo; - //flash once the feed stream - - - - flasher->set(P,F->T); - - flasher->adiabatic(); - - - T_f=flasher->T; - L->set(P, T_f); V->set(P, T_f); - // L->write(); V->write(); TOTO - //check if a column is needed; if not, bypass block - if(F->chem[LK]->n()/F->n()<0.001) OK=false; - if(F->chem[HK]->n()/F->n()<0.001) OK=false; - if(!OK) - return false; -// { -// strcpy(filename, B->name); *B=*L; B->set(filename); B->write(); -// strcpy(filename, D->name); *D=*V; D->set(filename); D->write(); -// } - else - { - - - - - - //apply the FUG method - first_split(); - Nmin = Fenske(); - N=Nmin+1; - while (fabs(N-Nmin)>0.1) - { - N=Nmin; - D->set(P, T_f); T_d=D->bp; - B->set(P, T_f); T_b=B->bp; - set_alpha(); - distribute(); - Nmin = Fenske(); - if (Nmin<1) Nmin=1; - } - D->set(P, T_d); - B->set(P, T_b); - if(fabs(Nmin)<=MIN_PLATES || fabs(Nmin)>MAX_PLATES) OK=false; - else - { - Rmin = Underwood(); - if(Rmin>100) Rmin=100; - if(L->chem[HK]->m+L->chem[LK]->m<EPS) Rmin=10.0; - if (Nmin<5) Ract = 1.5*Rmin; - if (5<Nmin && Nmin<15) Ract = 1.3*Rmin; - if (15<=Nmin) Ract = 1.1*Rmin; - N = Gilliland(); - feed = Kirkbride(); - condense(); - reboil(); - } - // B->write(); TOTO - // D->write(); TOTO - } - return OK; -} - -void column::first_split() -{ - B->purge(); D->purge(); - set_alpha(); - //Check if LK is really lighter than HK - if (alpha_m[LK]<1) - { -// logf.open(MESSAGES,ios::app); -// logf<<" --> Warning <-- Swapping keys in column "<<name<<".\n"; -// logf.close(); - feed=LK; LK=HK; HK=feed; set_alpha(); - } - for(i=0;i<F->nb;i++) - { - if (i!=LK && i!=HK && F->chem[i]->m>EPS) - { - if(alpha_f[i] > alpha_f[LK]) //volatile - { - D->chem[i]->m = (alpha_f[i]-alpha_f[LK])/alpha_f[i]*F->chem[i]->m; - D->m += D->chem[i]->m; - B->chem[i]->m = F->chem[i]->m-D->chem[i]->m; - B->m+=B->chem[i]->m; - } - if(alpha_f[i] < 1) //not volatile - { - B->chem[i]->m = (alpha_f[HK]-alpha_f[i])/alpha_f[i]*F->chem[i]->m; - B->m += B->chem[i]->m; - D->chem[i]->m = F->chem[i]->m-B->chem[i]->m; - D->m+=D->chem[i]->m; - } - if(1 <= alpha_f[i] && alpha_f[i]<=alpha_f[LK]) //ambiguous volatility - { - D->chem[i]->m = (alpha_f[i]-1)/(alpha_f[LK]-1)*F->chem[i]->m; - B->chem[i]->m = F->chem[i]->m-D->chem[i]->m; - D->m+=D->chem[i]->m; - B->m+=B->chem[i]->m; - } - } - } - D->chem[HK]->m = D->n()*x_D/(1-x_D)*D->chem[HK]->M/1000.0; - if(D->chem[HK]->m<EPS) D->chem[HK]->m=0.01*F->chem[HK]->m; - B->chem[LK]->m = B->n()*x_B/(1-x_B)*B->chem[LK]->M/1000.0; - if(B->chem[LK]->m<EPS) B->chem[LK]->m=0.01*F->chem[LK]->m; - B->chem[HK]->m = F->chem[HK]->m - D->chem[HK]->m; - D->chem[LK]->m = F->chem[LK]->m - B->chem[LK]->m; - D->m += (D->chem[LK]->m + D->chem[HK]->m); - B->m += (B->chem[LK]->m + B->chem[HK]->m); -} -void column::distribute() -{ - D->m=0; B->m=0; - for(i=0;i<F->nb;i++) - { - if (i!=LK && i!=HK && F->chem[i]->m>EPS) - { - if(alpha_m[i] > 1) //volatile and ambiguous - { - B->chem[i]->m = F->chem[i]->m/(1+D->chem[HK]->n()/B->chem[HK]->n()*pow(alpha_m[i], Nmin)); - D->chem[i]->m = F->chem[i]->m - B->chem[i]->m; - } - if(alpha_m[i] <= 1) //not volatile - { - D->chem[i]->m = F->chem[i]->m*(D->chem[HK]->n()/B->chem[HK]->n()*pow(alpha_m[i], Nmin))/(1+D->chem[HK]->n()/B->chem[HK]->n()*pow(alpha_m[i], Nmin)); - B->chem[i]->m = F->chem[i]->m - D->chem[i]->m; - } - D->m+=D->chem[i]->m; - B->m+=B->chem[i]->m; - } - } - D->m += (D->chem[LK]->m + D->chem[HK]->m); - B->m += (B->chem[LK]->m + B->chem[HK]->m); -} - -void column::set_alpha() -{ - for(i=0;i<F->nb; i++) - { - if (T_b>EPS && F->chem[i]->m>EPS) alpha_1[i] = F->chem[i]->Psat(T_b)/F->chem[HK]->Psat(T_b); - else alpha_1[i]=0; - if (T_d>EPS&& F->chem[i]->m>EPS) alpha_N[i] = F->chem[i]->Psat(T_d)/F->chem[HK]->Psat(T_d); - else alpha_N[i]=0; - if (T_f>EPS&& F->chem[i]->m>EPS) alpha_f[i] = F->chem[i]->Psat(T_f)/F->chem[HK]->Psat(T_f); - else alpha_f[i]=0; - alpha_m[i] = pow(alpha_1[i]*alpha_f[i]*alpha_N[i], 1.0/3.0); - } - for(i=0;i<F->nb;i++) if(alpha_m[i]<EPS&& F->chem[i]->m>EPS) alpha_m[i] = alpha_f[i]; -} - -void column::reboil() -{ - Q_reboil = 0.0; - for (i=0;i<F->nb;i++) if(F->chem[i]->m>EPS) - { - Q_reboil += B->chem[i]->Cp(false)*(T_b-T_f)*B->chem[i]->n()/1000.0; //energy to go from input to bottoms T - Q_reboil += D->chem[i]->Cp(false)*(T_f-T_d)*D->chem[i]->n()/1000.0; //energy to go from input to tops T - } - Q_reboil += Q_condens; -} - -void column::condense() -{ - Q_condens = 0.0; - for (i=0;i<F->nb;i++) if(F->chem[i]->m>EPS) - { - Q_condens += D->chem[i]->Hvap(T_d)*(1+Ract)*D->chem[i]->n(); - } -} - -void column::write() -{ - cout << setprecision(11); - - cout << "WRITE FILE " << RUNTIME << name << ".unit" << " :\n\tBEGIN\n"; - cout <<"\t>> "<<name; - cout <<endl<<"\t>> stream in: "<<F->name; - cout <<endl<<"\t>> streams out: "<<B->name<<" (bot.) "<<D->name<<" (top.)"; - cout <<endl<<"\t>> P = "<<P<<" atm, T(0) = "<<T_b<<", T("<<feed<<") = "<<T_f<<", T("<<int(N)<<") = "<<T_d<<" K"; - cout <<endl<<"\t>> Number of stages: "<<int(N)<<" (feeding at stage "<<feed<<")"; - cout <<endl<<setiosflags(ios::fixed|ios::showpoint)<<setprecision(5)<<"\t>> LK purity = "<<D->chem[LK]->n()/D->n()<<" HK purity = "<<B->chem[HK]->n()/B->n(); - cout <<endl<<"\t>> Reboiler duty: "<<Q_reboil<<" kW Condenser duty: "<<(-1)*Q_condens<<" kW"; - cout << "\n\tEND\n\n"; - cost(); water(); power(); -} - -double column::get_cost() -{ - //cost of vessel - vol=(0.45*N)*(pow(300*D->v, 1.5)/2.4/sqrt(B->v))*sqrt(D->m/B->m); - if(vol<0.3) vol=0.3; if(vol>520)vol=520; - money = 3.4974+0.4485*log10(vol)+0.1074*pow(log10(vol),2); - money = pow(10, money); - P= (P-1)*101.325/100; - diam=sqrt(4.0*vol/pi/N/0.45); - vol=(P+1)*diam/(317.46*(850-0.6*(P+1)))+0.0315; - money *=(2.25+ 1.82*vol*2.2); - //cost of trays - vol = (pow(300*D->v, 1.5)/2.4/sqrt(B->v))*sqrt(D->m/B->m); - diam = 2.9949+0.4465*log10(vol)+0.3961*pow(log10(vol),2); - money+=1.5*pow(10, diam); - //cost of reboiler U=5250W/m2.K - vol=fabs(Q_reboil)/0.85/5.25/15.0; - if(vol<10) vol=10; if(vol>100) vol=100; - vol = 4.4646-0.5277*log10(vol)+0.3955*pow(log10(vol),2); - money += (1.63+1.66*2.5)*pow(10, vol); - //cost of condenser U=1850W/m2.K - vol=fabs(Q_condens)/0.85/1.85/(0.5*(T_d-298)); - if(vol<1) vol=1; if(vol>100) vol=100; - vol = 3.9912+0.0668*log10(vol)+0.243*pow(log10(vol),2); - money += (1.74+1.55*2.5)*pow(10, vol); - money = money*MS_YEAR/MS_2001; - return money; -} - - -void column::cost() -{ - cout << "WRITE FILE " << RUNTIME << name << ".cost" << " :\n\tBEGIN\n"; - cout << "\t>>" << get_cost(); - cout << "\n\tEND\n\n"; -} -void column::power() -{ - cout << "WRITE FILE " << RUNTIME << name << ".power" << " :\n\tBEGIN\n"; - money =(Q_reboil/0.85-Q_condens); - cout << "\t>>" << money; - cout << "\n\tEND\n\n"; -} -void column::water() -{ - cout << "WRITE FILE " << RUNTIME << name << ".water" << " :\n\tBEGIN\n"; - money = (fabs(Q_condens)/(4.185*0.85*0.25*fabs(T_d-298))); - cout << "\t>>" << money; - cout << "\n\tEND\n\n"; -} +#include "column.hpp" +using namespace std; + +column::column(stream* in, stream* out_B, stream* out_D) +{ + F = in; + B = out_B; + D = out_D; + L=new stream("columnL", F->nb, F->chem); + V=new stream("columnV", F->nb, F->chem); + flasher = new flash(F, L, V); + alpha_1 = new double[F->nb]; + alpha_f = new double[F->nb]; + alpha_N = new double[F->nb]; + alpha_m = new double[F->nb]; + T_d=0; T_b=0; T_f=F->T; +// for(i=0;i<F->nb;i++) +// if(F->chem[i]->Tc<F->T && F->chem[i]->m>EPS) +// { +// logf.open(MESSAGES,ios::app); +// logf<<" --> Warning <-- Presence of gas in column.\n"; +// logf.close(); +// i=F->nb; +// } +} + +column::~column() +{ + delete L; delete V; delete flasher; + delete [] alpha_1; + delete [] alpha_f; + delete [] alpha_N; + delete [] alpha_m; +} + +void column::set(double p, int lk, double xd, int hk, double xb) +{ + P=p; + HK=hk-1; x_B=xb; + LK=lk-1; x_D=xd; + //logf.open(MESSAGES, ios::app); + // F->write(); system("pause"); + // if (F->chem[LK]->m<EPS) logf<<" ==> Error <== Flow of light key in column "<<name<<" is zero.\n"; +// if (F->chem[HK]->m<EPS) logf<<" ==> Error <== Flow of heavy key in column "<<name<<" is zero.\n"; + //logf.close(); +} + +bool column::solve() +{ + + OK=true; + // B->thermo=F->thermo; D->thermo=F->thermo; + //flash once the feed stream + + + + flasher->set(P,F->T); + + flasher->adiabatic(); + + + T_f=flasher->T; + L->set(P, T_f); V->set(P, T_f); + // L->write(); V->write(); TOTO + //check if a column is needed; if not, bypass block + if(F->chem[LK]->n()/F->n()<0.001) OK=false; + if(F->chem[HK]->n()/F->n()<0.001) OK=false; + if(!OK) + return false; +// { +// strcpy(filename, B->name); *B=*L; B->set(filename); B->write(); +// strcpy(filename, D->name); *D=*V; D->set(filename); D->write(); +// } + else + { + + + + + + //apply the FUG method + first_split(); + Nmin = Fenske(); + N=Nmin+1; + while (fabs(N-Nmin)>0.1) + { + N=Nmin; + D->set(P, T_f); T_d=D->bp; + B->set(P, T_f); T_b=B->bp; + set_alpha(); + distribute(); + Nmin = Fenske(); + if (Nmin<1) Nmin=1; + } + D->set(P, T_d); + B->set(P, T_b); + if(fabs(Nmin)<=MIN_PLATES || fabs(Nmin)>MAX_PLATES) OK=false; + else + { + Rmin = Underwood(); + if(Rmin>100) Rmin=100; + if(L->chem[HK]->m+L->chem[LK]->m<EPS) Rmin=10.0; + if (Nmin<5) Ract = 1.5*Rmin; + if (5<Nmin && Nmin<15) Ract = 1.3*Rmin; + if (15<=Nmin) Ract = 1.1*Rmin; + N = Gilliland(); + feed = Kirkbride(); + condense(); + reboil(); + } + // B->write(); TOTO + // D->write(); TOTO + } + return OK; +} + +void column::first_split() +{ + B->purge(); D->purge(); + set_alpha(); + //Check if LK is really lighter than HK + if (alpha_m[LK]<1) + { +// logf.open(MESSAGES,ios::app); +// logf<<" --> Warning <-- Swapping keys in column "<<name<<".\n"; +// logf.close(); + feed=LK; LK=HK; HK=feed; set_alpha(); + } + for(i=0;i<F->nb;i++) + { + if (i!=LK && i!=HK && F->chem[i]->m>EPS) + { + if(alpha_f[i] > alpha_f[LK]) //volatile + { + D->chem[i]->m = (alpha_f[i]-alpha_f[LK])/alpha_f[i]*F->chem[i]->m; + D->m += D->chem[i]->m; + B->chem[i]->m = F->chem[i]->m-D->chem[i]->m; + B->m+=B->chem[i]->m; + } + if(alpha_f[i] < 1) //not volatile + { + B->chem[i]->m = (alpha_f[HK]-alpha_f[i])/alpha_f[i]*F->chem[i]->m; + B->m += B->chem[i]->m; + D->chem[i]->m = F->chem[i]->m-B->chem[i]->m; + D->m+=D->chem[i]->m; + } + if(1 <= alpha_f[i] && alpha_f[i]<=alpha_f[LK]) //ambiguous volatility + { + D->chem[i]->m = (alpha_f[i]-1)/(alpha_f[LK]-1)*F->chem[i]->m; + B->chem[i]->m = F->chem[i]->m-D->chem[i]->m; + D->m+=D->chem[i]->m; + B->m+=B->chem[i]->m; + } + } + } + D->chem[HK]->m = D->n()*x_D/(1-x_D)*D->chem[HK]->M/1000.0; + if(D->chem[HK]->m<EPS) D->chem[HK]->m=0.01*F->chem[HK]->m; + B->chem[LK]->m = B->n()*x_B/(1-x_B)*B->chem[LK]->M/1000.0; + if(B->chem[LK]->m<EPS) B->chem[LK]->m=0.01*F->chem[LK]->m; + B->chem[HK]->m = F->chem[HK]->m - D->chem[HK]->m; + D->chem[LK]->m = F->chem[LK]->m - B->chem[LK]->m; + D->m += (D->chem[LK]->m + D->chem[HK]->m); + B->m += (B->chem[LK]->m + B->chem[HK]->m); +} +void column::distribute() +{ + D->m=0; B->m=0; + for(i=0;i<F->nb;i++) + { + if (i!=LK && i!=HK && F->chem[i]->m>EPS) + { + if(alpha_m[i] > 1) //volatile and ambiguous + { + B->chem[i]->m = F->chem[i]->m/(1+D->chem[HK]->n()/B->chem[HK]->n()*pow(alpha_m[i], Nmin)); + D->chem[i]->m = F->chem[i]->m - B->chem[i]->m; + } + if(alpha_m[i] <= 1) //not volatile + { + D->chem[i]->m = F->chem[i]->m*(D->chem[HK]->n()/B->chem[HK]->n()*pow(alpha_m[i], Nmin))/(1+D->chem[HK]->n()/B->chem[HK]->n()*pow(alpha_m[i], Nmin)); + B->chem[i]->m = F->chem[i]->m - D->chem[i]->m; + } + D->m+=D->chem[i]->m; + B->m+=B->chem[i]->m; + } + } + D->m += (D->chem[LK]->m + D->chem[HK]->m); + B->m += (B->chem[LK]->m + B->chem[HK]->m); +} + +void column::set_alpha() +{ + for(i=0;i<F->nb; i++) + { + if (T_b>EPS && F->chem[i]->m>EPS) alpha_1[i] = F->chem[i]->Psat(T_b)/F->chem[HK]->Psat(T_b); + else alpha_1[i]=0; + if (T_d>EPS&& F->chem[i]->m>EPS) alpha_N[i] = F->chem[i]->Psat(T_d)/F->chem[HK]->Psat(T_d); + else alpha_N[i]=0; + if (T_f>EPS&& F->chem[i]->m>EPS) alpha_f[i] = F->chem[i]->Psat(T_f)/F->chem[HK]->Psat(T_f); + else alpha_f[i]=0; + alpha_m[i] = pow(alpha_1[i]*alpha_f[i]*alpha_N[i], 1.0/3.0); + } + for(i=0;i<F->nb;i++) if(alpha_m[i]<EPS&& F->chem[i]->m>EPS) alpha_m[i] = alpha_f[i]; +} + +void column::reboil() +{ + Q_reboil = 0.0; + for (i=0;i<F->nb;i++) if(F->chem[i]->m>EPS) + { + Q_reboil += B->chem[i]->Cp(false)*(T_b-T_f)*B->chem[i]->n()/1000.0; //energy to go from input to bottoms T + Q_reboil += D->chem[i]->Cp(false)*(T_f-T_d)*D->chem[i]->n()/1000.0; //energy to go from input to tops T + } + Q_reboil += Q_condens; +} + +void column::condense() +{ + Q_condens = 0.0; + for (i=0;i<F->nb;i++) if(F->chem[i]->m>EPS) + { + Q_condens += D->chem[i]->Hvap(T_d)*(1+Ract)*D->chem[i]->n(); + } +} + +void column::write() +{ + cout << setprecision(11); + + cout << "WRITE FILE " << RUNTIME << name << ".unit" << " :\n\tBEGIN\n"; + cout <<"\t>> "<<name; + cout <<endl<<"\t>> stream in: "<<F->name; + cout <<endl<<"\t>> streams out: "<<B->name<<" (bot.) "<<D->name<<" (top.)"; + cout <<endl<<"\t>> P = "<<P<<" atm, T(0) = "<<T_b<<", T("<<feed<<") = "<<T_f<<", T("<<int(N)<<") = "<<T_d<<" K"; + cout <<endl<<"\t>> Number of stages: "<<int(N)<<" (feeding at stage "<<feed<<")"; + cout <<endl<<setiosflags(ios::fixed|ios::showpoint)<<setprecision(5)<<"\t>> LK purity = "<<D->chem[LK]->n()/D->n()<<" HK purity = "<<B->chem[HK]->n()/B->n(); + cout <<endl<<"\t>> Reboiler duty: "<<Q_reboil<<" kW Condenser duty: "<<(-1)*Q_condens<<" kW"; + cout << "\n\tEND\n\n"; + cost(); water(); power(); +} + +double column::get_cost() +{ + //cost of vessel + vol=(0.45*N)*(pow(300*D->v, 1.5)/2.4/sqrt(B->v))*sqrt(D->m/B->m); + if(vol<0.3) vol=0.3; if(vol>520)vol=520; + money = 3.4974+0.4485*log10(vol)+0.1074*pow(log10(vol),2); + money = pow(10, money); + P= (P-1)*101.325/100; + diam=sqrt(4.0*vol/pi/N/0.45); + vol=(P+1)*diam/(317.46*(850-0.6*(P+1)))+0.0315; + money *=(2.25+ 1.82*vol*2.2); + //cost of trays + vol = (pow(300*D->v, 1.5)/2.4/sqrt(B->v))*sqrt(D->m/B->m); + diam = 2.9949+0.4465*log10(vol)+0.3961*pow(log10(vol),2); + money+=1.5*pow(10, diam); + //cost of reboiler U=5250W/m2.K + vol=fabs(Q_reboil)/0.85/5.25/15.0; + if(vol<10) vol=10; if(vol>100) vol=100; + vol = 4.4646-0.5277*log10(vol)+0.3955*pow(log10(vol),2); + money += (1.63+1.66*2.5)*pow(10, vol); + //cost of condenser U=1850W/m2.K + vol=fabs(Q_condens)/0.85/1.85/(0.5*(T_d-298)); + if(vol<1) vol=1; if(vol>100) vol=100; + vol = 3.9912+0.0668*log10(vol)+0.243*pow(log10(vol),2); + money += (1.74+1.55*2.5)*pow(10, vol); + money = money*MS_YEAR/MS_2001; + return money; +} + + +void column::cost() +{ + cout << "WRITE FILE " << RUNTIME << name << ".cost" << " :\n\tBEGIN\n"; + cout << "\t>>" << get_cost(); + cout << "\n\tEND\n\n"; +} +void column::power() +{ + cout << "WRITE FILE " << RUNTIME << name << ".power" << " :\n\tBEGIN\n"; + money =(Q_reboil/0.85-Q_condens); + cout << "\t>>" << money; + cout << "\n\tEND\n\n"; +} +void column::water() +{ + cout << "WRITE FILE " << RUNTIME << name << ".water" << " :\n\tBEGIN\n"; + money = (fabs(Q_condens)/(4.185*0.85*0.25*fabs(T_d-298))); + cout << "\t>>" << money; + cout << "\n\tEND\n\n"; +} diff --git a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/column.hpp b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/column.hpp index 8dedb5a82bd85f4c6cf6b5d6a0dde55c8d56f299..cfd1daf16270b9ae30ba6500da2b75d7a576eb41 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/column.hpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/column.hpp @@ -1,61 +1,61 @@ -/* -This unit simulates a distillation column, using -the FUG method. -(ref : Seader & Henley). - -Structure in the .process file: -column {name} {pressure} {index of input stream} {index of bottoms and heads} {indexes of light key and heavy key} {x_LK and x_HK} - -How to use: - 1- Call the constructor : col = new column(in, out_B, out_D); //in is F, out_B is B, out_D is D column(nb, chem_list) - set(in, out_B, out_D) - 2- Set operating conditions : col->set(pressure, LK, x_LK, HK, x_HK); // LK and HK and integer indexes, x_LK is the undesired mole fraction of LK in B, x_HK... - 3- Set the name : col->set(name); - 4- Run the model: col->solve(); -*/ -#ifndef COLUMN_H -#define COLUMN_H - -#include "flash.hpp" -using namespace std; - -class column -{ -private: - // ofstream results, logf; - bool OK; - string name; - stream *F, *B, *D, *L, *V ; - int LK, HK, feed, i; - double x_B, x_D, T_b, T_d, T_f, vol, money, diam; - double Nmin, N, Rmin, Ract, tmp, Q_condens, Q_reboil; - double *alpha_1, *alpha_f, *alpha_N, *alpha_m; - flash *flasher; - void set_alpha(), first_split(), distribute(), condense(), reboil(); - double Fenske() { return log10(D->chem[LK]->n()*B->chem[HK]->n()/D->chem[HK]->n()/B->chem[LK]->n())/log10(alpha_m[LK]);} - double Underwood() {return L->n()*(D->chem[LK]->n()/L->chem[LK]->n()-alpha_m[LK]*D->chem[HK]->n()/L->chem[HK]->n())/(D->n()*(alpha_m[LK]-1));} - double Gilliland(){N=(Ract-Rmin)/(Ract+1); tmp=1-exp((1+54.4*N)*(N-1)/(11+117.2*N)/pow(N, 0.5)); return (tmp+Nmin)/(1-tmp);} - int Kirkbride() {tmp=pow(B->n()*F->chem[HK]->n()*pow(x_B/x_D,2)/F->chem[LK]->n()/D->n(), 0.206); return int(N/(tmp+1));} - -public: - // column(){P=0.0;} - // column(int, chemical*); - // void set(stream*&, stream*&, stream*&); - column(stream*, stream*, stream*); - ~column(); - double P; - void set(double, int, double, int, double); - void set( const string & n ) { name = n; } - bool solve(); - void write(); - void cost(), water(), power(); - - double get_cost ( void ); - double get_power ( void ) const { return Q_reboil/0.85-Q_condens; } - - double get_water ( void ) const { return fabs(Q_condens)/(4.185*0.85*0.25*fabs(T_d-298)); } - - int get_N ( void ) const { return (int) N; } - -}; -#endif +/* +This unit simulates a distillation column, using +the FUG method. +(ref : Seader & Henley). + +Structure in the .process file: +column {name} {pressure} {index of input stream} {index of bottoms and heads} {indexes of light key and heavy key} {x_LK and x_HK} + +How to use: + 1- Call the constructor : col = new column(in, out_B, out_D); //in is F, out_B is B, out_D is D column(nb, chem_list) + set(in, out_B, out_D) + 2- Set operating conditions : col->set(pressure, LK, x_LK, HK, x_HK); // LK and HK and integer indexes, x_LK is the undesired mole fraction of LK in B, x_HK... + 3- Set the name : col->set(name); + 4- Run the model: col->solve(); +*/ +#ifndef COLUMN_H +#define COLUMN_H + +#include "flash.hpp" +using namespace std; + +class column +{ +private: + // ofstream results, logf; + bool OK; + string name; + stream *F, *B, *D, *L, *V ; + int LK, HK, feed, i; + double x_B, x_D, T_b, T_d, T_f, vol, money, diam; + double Nmin, N, Rmin, Ract, tmp, Q_condens, Q_reboil; + double *alpha_1, *alpha_f, *alpha_N, *alpha_m; + flash *flasher; + void set_alpha(), first_split(), distribute(), condense(), reboil(); + double Fenske() { return log10(D->chem[LK]->n()*B->chem[HK]->n()/D->chem[HK]->n()/B->chem[LK]->n())/log10(alpha_m[LK]);} + double Underwood() {return L->n()*(D->chem[LK]->n()/L->chem[LK]->n()-alpha_m[LK]*D->chem[HK]->n()/L->chem[HK]->n())/(D->n()*(alpha_m[LK]-1));} + double Gilliland(){N=(Ract-Rmin)/(Ract+1); tmp=1-exp((1+54.4*N)*(N-1)/(11+117.2*N)/pow(N, 0.5)); return (tmp+Nmin)/(1-tmp);} + int Kirkbride() {tmp=pow(B->n()*F->chem[HK]->n()*pow(x_B/x_D,2)/F->chem[LK]->n()/D->n(), 0.206); return int(N/(tmp+1));} + +public: + // column(){P=0.0;} + // column(int, chemical*); + // void set(stream*&, stream*&, stream*&); + column(stream*, stream*, stream*); + ~column(); + double P; + void set(double, int, double, int, double); + void set( const string & n ) { name = n; } + bool solve(); + void write(); + void cost(), water(), power(); + + double get_cost ( void ); + double get_power ( void ) const { return Q_reboil/0.85-Q_condens; } + + double get_water ( void ) const { return fabs(Q_condens)/(4.185*0.85*0.25*fabs(T_d-298)); } + + int get_N ( void ) const { return (int) N; } + +}; +#endif diff --git a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/combrx.cpp b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/combrx.cpp index 0f30f1af32b99e3b5521dede45a6bde5aa7cbe57..83ad673825887cc0696981505fa884bb9c1a9c5d 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/combrx.cpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/combrx.cpp @@ -1,66 +1,66 @@ -#include "combrx.hpp" -using namespace std; - -combrx::combrx ( const string & cas ) { - - // combustion.prop : - // ----------------- - CAS = cas; - - if (CAS=="64-17-5") { - nO2 = 3; - nCO2 = 2; - nH2O = 3; - } - else if (CAS=="74-82-8") { - nO2 = 2; - nCO2 = 1; - nH2O = 2; - } - else if (CAS=="1333-74-0") { - nO2 = 0.5; - nCO2 = 0; - nH2O = 1; - } - else if (CAS=="100-42-5") { - nO2 = 10; - nCO2 = 8; - nH2O = 4; - } - else if (CAS=="74-85-1") { - nO2 = 3; - nCO2 = 2; - nH2O = 2; - } - else if (CAS=="108-88-3") { - nO2 = 9; - nCO2 = 7; - nH2O = 4; - } - else if (CAS=="100-41-4") { - nO2 = 10.5; - nCO2 = 8; - nH2O = 5; - } - else if (CAS=="71-43-2") { - nO2 = 7.5; - nCO2 = 6; - nH2O = 3; - } - else { - cout << "ERROR 21" << endl; - exit(0); - } - - COMB = new chemical(CAS); - O2 = new chemical("7782-44-7"); - N2 = new chemical("7727-37-9"); - CO2 = new chemical("124-38-9"); - H2O = new chemical("7732-18-5"); - Hro = CO2->Ho*nCO2 + nH2O*(H2O->Ho - H2O->dHvap) - COMB->Ho; - LFLo = -3420.0/Hro + 0.569e-3*Hro + 0.0538e-6*pow(Hro,2) + 1.8; - LFLo = LFLo/100.0; - UFLo = 0.0063*Hro + 0.567e-6*pow(Hro, 2) + 23.5; - UFLo = UFLo/100.0; - -} +#include "combrx.hpp" +using namespace std; + +combrx::combrx ( const string & cas ) { + + // combustion.prop : + // ----------------- + CAS = cas; + + if (CAS=="64-17-5") { + nO2 = 3; + nCO2 = 2; + nH2O = 3; + } + else if (CAS=="74-82-8") { + nO2 = 2; + nCO2 = 1; + nH2O = 2; + } + else if (CAS=="1333-74-0") { + nO2 = 0.5; + nCO2 = 0; + nH2O = 1; + } + else if (CAS=="100-42-5") { + nO2 = 10; + nCO2 = 8; + nH2O = 4; + } + else if (CAS=="74-85-1") { + nO2 = 3; + nCO2 = 2; + nH2O = 2; + } + else if (CAS=="108-88-3") { + nO2 = 9; + nCO2 = 7; + nH2O = 4; + } + else if (CAS=="100-41-4") { + nO2 = 10.5; + nCO2 = 8; + nH2O = 5; + } + else if (CAS=="71-43-2") { + nO2 = 7.5; + nCO2 = 6; + nH2O = 3; + } + else { + cout << "ERROR 21" << endl; + exit(0); + } + + COMB = new chemical(CAS); + O2 = new chemical("7782-44-7"); + N2 = new chemical("7727-37-9"); + CO2 = new chemical("124-38-9"); + H2O = new chemical("7732-18-5"); + Hro = CO2->Ho*nCO2 + nH2O*(H2O->Ho - H2O->dHvap) - COMB->Ho; + LFLo = -3420.0/Hro + 0.569e-3*Hro + 0.0538e-6*pow(Hro,2) + 1.8; + LFLo = LFLo/100.0; + UFLo = 0.0063*Hro + 0.567e-6*pow(Hro, 2) + 23.5; + UFLo = UFLo/100.0; + +} diff --git a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/combrx.hpp b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/combrx.hpp index 02e098bb96d4fbd6ece10fb1ef45e50803768425..b57e643762d2dbcc59dfdf040e503d580416b4ca 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/combrx.hpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/combrx.hpp @@ -1,29 +1,29 @@ -#ifndef COMBRX_H -#define COMBRX_H -#include "chemical.hpp" -#include "defines.hpp" -using namespace std; - -class combrx { - -private : - ifstream data; - bool stop; - double nO2, nCO2, nH2O; - char tmp[41]; - string CAS; - chemical *H2O, *N2, *O2, *CO2, *COMB; - double LFLo, UFLo, Hro, sum; - -public: - combrx( const string & cas ); - double O2_flow() { return (O2->M*nO2/1000.0); } //theoritical O2 flow, in kg/mol of COMB - double N2_flow(){return (0.79*O2_flow()/0.21);} //theoritical N2 flow, in kg/mol of COMB - double CO2_flow() {return (nCO2*CO2->M/1000.0);} //theoritical CO2 flow, in kg/mol of COMB - double H2O_flow() {return (nH2O*H2O->M/1000.0);} //theoritical H2O flow, in kg/mol of COMB - double LFL(double P, double T) {sum=LFLo + 0.03139/Hro*(T-298); if(sum<EPS) return EPS; else return sum;} //in %vol - double UFL(double P, double T) {sum=UFLo - 0.03139/Hro*(T-298) + 0.206*(log10(0.101325*P)+1); if(sum>1) return (1-EPS); else return sum;} //in %vol - double Hcomb(double T) {return (nCO2*CO2->dH(298,T,1)+ nH2O*H2O->dH(298,T,1)-nO2*O2->dH(298,T,1)-COMB->dH(298,T,1)+Hro);} //in kJ/mol - ~combrx(){delete H2O; delete N2; delete O2; delete CO2; delete COMB;} -}; -#endif +#ifndef COMBRX_H +#define COMBRX_H +#include "chemical.hpp" +#include "defines.hpp" +using namespace std; + +class combrx { + +private : + ifstream data; + bool stop; + double nO2, nCO2, nH2O; + char tmp[41]; + string CAS; + chemical *H2O, *N2, *O2, *CO2, *COMB; + double LFLo, UFLo, Hro, sum; + +public: + combrx( const string & cas ); + double O2_flow() { return (O2->M*nO2/1000.0); } //theoritical O2 flow, in kg/mol of COMB + double N2_flow(){return (0.79*O2_flow()/0.21);} //theoritical N2 flow, in kg/mol of COMB + double CO2_flow() {return (nCO2*CO2->M/1000.0);} //theoritical CO2 flow, in kg/mol of COMB + double H2O_flow() {return (nH2O*H2O->M/1000.0);} //theoritical H2O flow, in kg/mol of COMB + double LFL(double P, double T) {sum=LFLo + 0.03139/Hro*(T-298); if(sum<EPS) return EPS; else return sum;} //in %vol + double UFL(double P, double T) {sum=UFLo - 0.03139/Hro*(T-298) + 0.206*(log10(0.101325*P)+1); if(sum>1) return (1-EPS); else return sum;} //in %vol + double Hcomb(double T) {return (nCO2*CO2->dH(298,T,1)+ nH2O*H2O->dH(298,T,1)-nO2*O2->dH(298,T,1)-COMB->dH(298,T,1)+Hro);} //in kJ/mol + ~combrx(){delete H2O; delete N2; delete O2; delete CO2; delete COMB;} +}; +#endif diff --git a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/flash.cpp b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/flash.cpp index 027ad0e7dd937f8f0eb8a52d9401d2d00d78f2c2..930ea8f58ac00b78b1aea1b6933d286eafb9bae0 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/flash.cpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/flash.cpp @@ -1,220 +1,220 @@ -#include "flash.hpp" -#include "bissection.cpp" -using namespace std; - -flash::flash ( stream * in , stream * out_L , stream * out_V ) { - F = in; - Fcopy = new stream("Fcopy", F->nb, F->chem); - Tin = F->T; - z = new double[F->nb]; - for ( i = 0 ; i < F->nb ; i++ ) - z[i] = F->chem[i]->n()/F->n(); - - L = out_L; - V = out_V; - success = true; - K = new double[F->nb]; - task=0; - solver = new bissection<flash>(); -} - -void flash::set(double p, double t) -{ - P=p; - T=t; - for (i=0;i<F->nb;i++) - { - if(F->chem[i]->Tc<T) K[i] = F->chem[i]->Psat(T)/P; - else K[i]=1; - } - F->set(P,T); -} - -bool flash::solve() -{ - L->purge(); - V->purge(); - f_x=F->quality(); - - if( 0.0 < f_x && f_x < 1.0) - { - - // TOTO - for ( i = 0 ; i < F->nb ; i++ ) { - if ( F->chem[i]->Tc < T ) { - F->m -= F->chem[i]->m; - F->chem[i]->m = 0; - } - } - - for ( i = 0 ; i < F->nb ; i++ ) - z[i] = F->chem[i]->n()/F->n(); - - solver->set(this, 0.0, 1.0); - - success=solver->run(); - - if (!success) - { -// if(task==0){ -// log.open(MESSAGES, ios::app); -// log<<" --> Warning <-- Solver of FLASH "<<name<<" did not converge.\n"; -// log.close();} - for (i=0;i<F->nb;i++) - { - if (T<F->chem[i]->Tc && T>F->chem[i]->Tboil(P)) {V->chem[i]->m=F->chem[i]->m; V->m+=V->chem[i]->m;} - if (T<F->chem[i]->Tc && T<=F->chem[i]->Tboil(P)) {L->chem[i]->m=F->chem[i]->m; L->m+=L->chem[i]->m;} - } - } - else - { - - V->m = x*F->n(); - L->m = F->n() - V->m; - //Distribute liquid components - for (i=0;i<L->nb;i++) - { - L->chem[i]->m = (L->m*z[i])/(1+x*(K[i]-1))*L->chem[i]->M/1000.0; - L->chem[i]->state=0; - } - - - L->m=0.0; for(i=0;i<L->nb;i++) L->m+=L->chem[i]->m; - //Distribute vapor components - for (i=0;i<V->nb;i++) - { - V->chem[i]->m = V->m*L->chem[i]->n()*K[i]/L->n()*V->chem[i]->M/1000.0; - V->chem[i]->state=1; - } - V->m=0.0; for(i=0;i<V->nb;i++) V->m+=V->chem[i]->m; - } - for(i=0;i<F->nb;i++) - if(F->chem[i]->Tc<T){V->chem[i]->m=Fcopy->chem[i]->m; V->m+=Fcopy->chem[i]->m;} - - } - else - { - /* if(task==0) - { - log.open("runtime\\messages.r", ios::app); - if (T<F->dp) log<<" --> Warning <-- Mixture in "<<name<<" can't be flashed (bp="<<F->bp<<" dp="<<F->dp<<").\n"; - log.close(); - } */ - for (i=0;i<F->nb;i++) - { - if (F->chem[i]->Tc<T || f_x>=1) {V->chem[i]->m=Fcopy->chem[i]->m; V->m+=V->chem[i]->m; } - else {L->chem[i]->m=Fcopy->chem[i]->m; L->m+=L->chem[i]->m;} - - } - success = true; - } - L->set(P,T); - V->set(P,T); - Q = 0.0; - for (i=0;i<F->nb;i++) - { - Q += L->chem[i]->dH(Tin, T, P)*L->chem[i]->n(); - Q += V->chem[i]->dH(Tin, T, P)*V->chem[i]->n(); - } - F->m=0; - for(i=0;i<Fcopy->nb;i++) {F->chem[i]->m = Fcopy->chem[i]->m; F->m+=F->chem[i]->m;} - F->set(F->P,Tin); -// if(fabs(V->m+L->m-F->m)>sqrt(EPS)) -// { -// log.open(MESSAGES, ios::app); -// log<<" --> Warning <-- Block "<<name<<" is not in mass balance ("<<fabs(V->m+L->m-F->m)/F->m<<").\n"; -// log.close(); -// } -// V->write();// TOTO - // L->write(); // TOTO - - return success; -} - -double flash::f(double psy) -{ - x=psy; - f_x=0.0; - for(i=0;i<F->nb;i++) f_x += (z[i]*(1-K[i]))/(1+psy*(K[i]-1)); - return f_x; -} - -bool flash::adiabatic() -{ - task=1; - F->set(P,T); T=F->dp; - step=-5; - Q=1; - - - while (fabs(step)>0.01 && fabs(Q)>0.1) - { - T+=step; - F->set(P,T); - - for (i=0;i<F->nb;i++) - K[i] = F->chem[i]->Psat(T)/P; - - success=solve(); - - - if (Q<0 && step<0) step*=-0.5; - if (Q>0 && step>0) step*=-0.5; - } - if (fabs(Q)<0.1) return true; - else return false; -} - -void flash::write() { - cout << "WRITE FILE " << RUNTIME << name << ".unit" << " :\n\tBEGIN\n"; - cout << "\t>> "<<name; - cout << endl << "\t>> stream in : "<<F->name; - cout <<endl<<"\t>> streams out : "<<L->name<<" (liq.) "<<V->name<<" (vap.)"; - cout <<endl<<"\t>> P = "<<P<<" atm, T = "<<T<<" K"; - cout <<endl<<"\t>> Heat duty = "<<Q; - if (success==true) cout <<" kW (converge normally)"; - cout << "\n\tEND\n\n"; - cost(); - power(); - water(); -} - - -double flash::get_cost ( void ) { - vol=15.0*(L->v+V->v); - if(vol<0.3) vol=0.3; if(vol>520)vol=520; - step = 3.4974+0.4485*log10(vol)+0.1074*pow(log10(vol),2); - step = pow(10, step); - P= (P-1)*101.325/100; - f_x=pow(2.0*vol/pi, 1.0/3.0); - vol=(P+1)*f_x/(317.46*(850-0.6*(P+1)))+0.0315; - step *=(2.25+ 1.82*vol*2.2); - step = step*MS_YEAR/MS_2001; - return step; -} - -void flash::cost() { - cout << "WRITE FILE " << RUNTIME << name << ".cost" << " :\n\tBEGIN\n"; - cout << "\t>>" << get_cost(); - cout << "\n\tEND\n\n"; -} -void flash::power() { - cout << "WRITE FILE " << RUNTIME << name << ".power" << " :\n\tBEGIN\n"; - cout << "\t>>" << Q; - cout << "\n\tEND\n\n"; -} - -double flash::get_water ( void ) { - step = (Q<0.0) ? fabs(Q)/(4.185*0.10*(Tin-298)) : 0.0; - return step; -} - -void flash::water() { - cout << "WRITE FILE " << RUNTIME << name << ".water" << " :\n\tBEGIN\n"; - if(Q<0.0) - step= (fabs(Q)/(4.185*0.10*(Tin-298))); - else - step= 0.0; - cout << "\t>>" << step; - cout << "\n\tEND\n\n"; -} +#include "flash.hpp" +#include "bissection.cpp" +using namespace std; + +flash::flash ( stream * in , stream * out_L , stream * out_V ) { + F = in; + Fcopy = new stream("Fcopy", F->nb, F->chem); + Tin = F->T; + z = new double[F->nb]; + for ( i = 0 ; i < F->nb ; i++ ) + z[i] = F->chem[i]->n()/F->n(); + + L = out_L; + V = out_V; + success = true; + K = new double[F->nb]; + task=0; + solver = new bissection<flash>(); +} + +void flash::set(double p, double t) +{ + P=p; + T=t; + for (i=0;i<F->nb;i++) + { + if(F->chem[i]->Tc<T) K[i] = F->chem[i]->Psat(T)/P; + else K[i]=1; + } + F->set(P,T); +} + +bool flash::solve() +{ + L->purge(); + V->purge(); + f_x=F->quality(); + + if( 0.0 < f_x && f_x < 1.0) + { + + // TOTO + for ( i = 0 ; i < F->nb ; i++ ) { + if ( F->chem[i]->Tc < T ) { + F->m -= F->chem[i]->m; + F->chem[i]->m = 0; + } + } + + for ( i = 0 ; i < F->nb ; i++ ) + z[i] = F->chem[i]->n()/F->n(); + + solver->set(this, 0.0, 1.0); + + success=solver->run(); + + if (!success) + { +// if(task==0){ +// log.open(MESSAGES, ios::app); +// log<<" --> Warning <-- Solver of FLASH "<<name<<" did not converge.\n"; +// log.close();} + for (i=0;i<F->nb;i++) + { + if (T<F->chem[i]->Tc && T>F->chem[i]->Tboil(P)) {V->chem[i]->m=F->chem[i]->m; V->m+=V->chem[i]->m;} + if (T<F->chem[i]->Tc && T<=F->chem[i]->Tboil(P)) {L->chem[i]->m=F->chem[i]->m; L->m+=L->chem[i]->m;} + } + } + else + { + + V->m = x*F->n(); + L->m = F->n() - V->m; + //Distribute liquid components + for (i=0;i<L->nb;i++) + { + L->chem[i]->m = (L->m*z[i])/(1+x*(K[i]-1))*L->chem[i]->M/1000.0; + L->chem[i]->state=0; + } + + + L->m=0.0; for(i=0;i<L->nb;i++) L->m+=L->chem[i]->m; + //Distribute vapor components + for (i=0;i<V->nb;i++) + { + V->chem[i]->m = V->m*L->chem[i]->n()*K[i]/L->n()*V->chem[i]->M/1000.0; + V->chem[i]->state=1; + } + V->m=0.0; for(i=0;i<V->nb;i++) V->m+=V->chem[i]->m; + } + for(i=0;i<F->nb;i++) + if(F->chem[i]->Tc<T){V->chem[i]->m=Fcopy->chem[i]->m; V->m+=Fcopy->chem[i]->m;} + + } + else + { + /* if(task==0) + { + log.open("runtime\\messages.r", ios::app); + if (T<F->dp) log<<" --> Warning <-- Mixture in "<<name<<" can't be flashed (bp="<<F->bp<<" dp="<<F->dp<<").\n"; + log.close(); + } */ + for (i=0;i<F->nb;i++) + { + if (F->chem[i]->Tc<T || f_x>=1) {V->chem[i]->m=Fcopy->chem[i]->m; V->m+=V->chem[i]->m; } + else {L->chem[i]->m=Fcopy->chem[i]->m; L->m+=L->chem[i]->m;} + + } + success = true; + } + L->set(P,T); + V->set(P,T); + Q = 0.0; + for (i=0;i<F->nb;i++) + { + Q += L->chem[i]->dH(Tin, T, P)*L->chem[i]->n(); + Q += V->chem[i]->dH(Tin, T, P)*V->chem[i]->n(); + } + F->m=0; + for(i=0;i<Fcopy->nb;i++) {F->chem[i]->m = Fcopy->chem[i]->m; F->m+=F->chem[i]->m;} + F->set(F->P,Tin); +// if(fabs(V->m+L->m-F->m)>sqrt(EPS)) +// { +// log.open(MESSAGES, ios::app); +// log<<" --> Warning <-- Block "<<name<<" is not in mass balance ("<<fabs(V->m+L->m-F->m)/F->m<<").\n"; +// log.close(); +// } +// V->write();// TOTO + // L->write(); // TOTO + + return success; +} + +double flash::f(double psy) +{ + x=psy; + f_x=0.0; + for(i=0;i<F->nb;i++) f_x += (z[i]*(1-K[i]))/(1+psy*(K[i]-1)); + return f_x; +} + +bool flash::adiabatic() +{ + task=1; + F->set(P,T); T=F->dp; + step=-5; + Q=1; + + + while (fabs(step)>0.01 && fabs(Q)>0.1) + { + T+=step; + F->set(P,T); + + for (i=0;i<F->nb;i++) + K[i] = F->chem[i]->Psat(T)/P; + + success=solve(); + + + if (Q<0 && step<0) step*=-0.5; + if (Q>0 && step>0) step*=-0.5; + } + if (fabs(Q)<0.1) return true; + else return false; +} + +void flash::write() { + cout << "WRITE FILE " << RUNTIME << name << ".unit" << " :\n\tBEGIN\n"; + cout << "\t>> "<<name; + cout << endl << "\t>> stream in : "<<F->name; + cout <<endl<<"\t>> streams out : "<<L->name<<" (liq.) "<<V->name<<" (vap.)"; + cout <<endl<<"\t>> P = "<<P<<" atm, T = "<<T<<" K"; + cout <<endl<<"\t>> Heat duty = "<<Q; + if (success==true) cout <<" kW (converge normally)"; + cout << "\n\tEND\n\n"; + cost(); + power(); + water(); +} + + +double flash::get_cost ( void ) { + vol=15.0*(L->v+V->v); + if(vol<0.3) vol=0.3; if(vol>520)vol=520; + step = 3.4974+0.4485*log10(vol)+0.1074*pow(log10(vol),2); + step = pow(10, step); + P= (P-1)*101.325/100; + f_x=pow(2.0*vol/pi, 1.0/3.0); + vol=(P+1)*f_x/(317.46*(850-0.6*(P+1)))+0.0315; + step *=(2.25+ 1.82*vol*2.2); + step = step*MS_YEAR/MS_2001; + return step; +} + +void flash::cost() { + cout << "WRITE FILE " << RUNTIME << name << ".cost" << " :\n\tBEGIN\n"; + cout << "\t>>" << get_cost(); + cout << "\n\tEND\n\n"; +} +void flash::power() { + cout << "WRITE FILE " << RUNTIME << name << ".power" << " :\n\tBEGIN\n"; + cout << "\t>>" << Q; + cout << "\n\tEND\n\n"; +} + +double flash::get_water ( void ) { + step = (Q<0.0) ? fabs(Q)/(4.185*0.10*(Tin-298)) : 0.0; + return step; +} + +void flash::water() { + cout << "WRITE FILE " << RUNTIME << name << ".water" << " :\n\tBEGIN\n"; + if(Q<0.0) + step= (fabs(Q)/(4.185*0.10*(Tin-298))); + else + step= 0.0; + cout << "\t>>" << step; + cout << "\n\tEND\n\n"; +} diff --git a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/flash.hpp b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/flash.hpp index b6cdb41b3b5c556d848c01ec23b40b0ba0f4356e..29bc250c316f150c5f2880ab5696b5601867009d 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/flash.hpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/flash.hpp @@ -1,55 +1,55 @@ -/* -This unit takes operating P and T, and indexes of streams. It applies -the Rachford-Rice procedure to solve the isothermal flash problem -(ref : Seader & Henley). - -Structure in the .process file: -flash {name} {pressure} {temperature} {index of input stream} {index of output liquid and output vapor} - -How to use: - 1- Call the constructor : flash1 = new flash(in, out_L, out_V); //in is the feed, out_L is the liquid output and out_V is the vapor output - 2- Set P and T: flash1->set(P,T); - 3- Set the name: flash1->set(name); - 4a- Perform an isothermal flash : flash1->solve(); - 4b- Perform an adiabatic flash: flash1->adiabatic(); -*/ -#ifndef FLASH_H -#define FLASH_H - -#include "stream.hpp" -#include "bissection.hpp" -using namespace std; - -class flash { -private: - bool success; - bissection<flash> *solver; - // ofstream log, results; -// char name[31], filename[41]; //name of the unit - - string name; - - int i, task; //task=0: isothermal flash; task=1:adiabatic flash - stream *F, *Fcopy; //pointer to the input stream - stream *L, *V; //pointers to liquid and vapor output streams - double f_x, x, *K, *z; //pressure (given) and temperature (given) - double Q, Tin, step, vol; //required power, in kW - -public: - flash(){P=0.0; T=0.0;} - flash(stream*, stream*, stream*); //defines the connectivities of this unit - ~flash(){delete Fcopy; delete [] K; delete [] z; delete solver;} - double P ,T; - void set(double, double); - void set( const string & n ) { name = n; } - bool solve(); //applies the Rachford-Rice procedure - bool adiabatic(); //adiabatic isobaric flash - double f(double); //returns the function to the solver - void write(); - double get_water ( void ); - double get_cost ( void ); - - double get_power ( void ) const { return Q; } - void cost(), water(), power(); -}; -#endif +/* +This unit takes operating P and T, and indexes of streams. It applies +the Rachford-Rice procedure to solve the isothermal flash problem +(ref : Seader & Henley). + +Structure in the .process file: +flash {name} {pressure} {temperature} {index of input stream} {index of output liquid and output vapor} + +How to use: + 1- Call the constructor : flash1 = new flash(in, out_L, out_V); //in is the feed, out_L is the liquid output and out_V is the vapor output + 2- Set P and T: flash1->set(P,T); + 3- Set the name: flash1->set(name); + 4a- Perform an isothermal flash : flash1->solve(); + 4b- Perform an adiabatic flash: flash1->adiabatic(); +*/ +#ifndef FLASH_H +#define FLASH_H + +#include "stream.hpp" +#include "bissection.hpp" +using namespace std; + +class flash { +private: + bool success; + bissection<flash> *solver; + // ofstream log, results; +// char name[31], filename[41]; //name of the unit + + string name; + + int i, task; //task=0: isothermal flash; task=1:adiabatic flash + stream *F, *Fcopy; //pointer to the input stream + stream *L, *V; //pointers to liquid and vapor output streams + double f_x, x, *K, *z; //pressure (given) and temperature (given) + double Q, Tin, step, vol; //required power, in kW + +public: + flash(){P=0.0; T=0.0;} + flash(stream*, stream*, stream*); //defines the connectivities of this unit + ~flash(){delete Fcopy; delete [] K; delete [] z; delete solver;} + double P ,T; + void set(double, double); + void set( const string & n ) { name = n; } + bool solve(); //applies the Rachford-Rice procedure + bool adiabatic(); //adiabatic isobaric flash + double f(double); //returns the function to the solver + void write(); + double get_water ( void ); + double get_cost ( void ); + + double get_power ( void ) const { return Q; } + void cost(), water(), power(); +}; +#endif diff --git a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/heatx.cpp b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/heatx.cpp index 3c23822ae8f89a1971ec24d0d35b218e13ebbf40..fd8942e30cbea0202a6a60ed31b1a3f0b03974a4 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/heatx.cpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/heatx.cpp @@ -1,146 +1,146 @@ -#include "heatx.hpp" -#include "bissection.cpp" - -heatx::heatx(bool m, stream* s1, stream* s2) -{ - in = s1; - out = s2; - out->m=0; - for(i=0;i<in->nb;i++) - { - out->chem[i]->m=in->chem[i]->m; - out->m+=out->chem[i]->m; - } - solver = new bissection<heatx>(); - mode = m; - success = true; -} - -void heatx::set(double d1, double d2) -{ - if(mode==0) T=d1; - if(mode==1) Q=d1; - eta = d2; -} - -bool heatx::solve() -{ - if(mode==0) - { - Q = 0.0; - out->set(in->P, T); - // out->write(); // WRITE TOTO - for(i=0;i<in->nb;i++) - Q+=out->chem[i]->dH(in->T, out->T, in->P)*out->chem[i]->n(); - if(eta>EPS) - Qreal = Q/eta; - else { - Qreal=Q; - success=false; - } - } - if(mode==1) - { - Qreal = eta*Q; - min = in->T; - max = 2000; - solver->set(this, min, max); - success = solver->run(); - out->set(in->P, T); - //out->write(); // WRITE TOTO - } - return success; -} - - -double heatx::f(double x) -{ - T=x; - max = Qreal; - for(i=0;i<in->nb;i++) - max -= out->chem[i]->dH(in->T, T, in->P)*out->chem[i]->n(); - return max; -} - -void heatx::write() -{ - - cout << "WRITE FILE " << RUNTIME << name << ".unit" << " :\n\tBEGIN\n"; - cout << "\t>> " << name; - cout << endl << "\t>> stream in: " << in->name << " T = " << in->T <<" K"; - cout << endl << "\t>> stream out: " << out->name << " T = " << out->T <<" K"; - if (mode==0) - cout<<endl<<"\t>> Heat duty : "<<Qreal<<" kW"; - if (mode==1) - cout<<endl<<"\t>> Heat duty : "<<Q<<" kW"; - if (success) - cout<<endl<<"\t>> Heat losses "<<fabs(Qreal-Q)<<" kW (converged normally)"; - cout << "\n\tEND\n\n"; - - cost(); - power(); - water(); -} - - - -double heatx::get_cost ( void ) { - if(mode==1) min=fabs(Q)/0.225/(eta)/fabs(out->T-in->T); - if(mode==0) min=fabs(Qreal)/0.25/(eta)/fabs(out->T-in->T); - if(min<10) min=10; if(min>1000) min=1000; - max = 4.3247-0.303*log10(min)+0.1634*pow(log10(min),2); - T=in->P; - T = (T-1)*1.01325; - if (fabs(T)<EPS) T=0.1; if(T>100) T=100; - min=0.03881-0.11272*log10(T)+0.08183*pow(log10(T),2); - min=pow(10, min); - max = (1.63+1.66*2.5*min)*pow(10, max); - max = max*MS_YEAR/MS_2001; - return max; -} - - -void heatx::cost() -{ - cout << setprecision(5); - cout << "WRITE FILE " << RUNTIME << name << ".cost" << " :\n\tBEGIN\n"; - cout << "\t>>" << get_cost(); - cout << "\n\tEND\n\n"; -} - - - -double heatx::get_water ( void ) -{ - max = (Q<0.0) ? fabs(Q)/(4.185*0.10*(out->T-298)) : 0.0; - return max; -} - - -void heatx::water() -{ - if(Q<0.0) max = fabs(Q)/(4.185*0.10*(out->T-298)); - else max = 0.0; - cout << "WRITE FILE " << RUNTIME << name << ".water" << " :\n\tBEGIN\n"; - cout << "\t>>" << max; - cout << "\n\tEND\n\n"; - -} - -double heatx::get_power ( void ) { - max = (mode) ? Q : Qreal; - if (max>EPS) - return max; - return 0.0; -} - -void heatx::power() -{ - if(mode==0) max = Qreal; - if(mode==1) max = Q; - - cout << "WRITE FILE " << RUNTIME << name << ".power" << " :\n\tBEGIN\n"; - if(max>EPS) cout<< "\t>>" << max; - else cout<< "\t>>" << 0; - cout << "\n\tEND\n\n"; -} +#include "heatx.hpp" +#include "bissection.cpp" + +heatx::heatx(bool m, stream* s1, stream* s2) +{ + in = s1; + out = s2; + out->m=0; + for(i=0;i<in->nb;i++) + { + out->chem[i]->m=in->chem[i]->m; + out->m+=out->chem[i]->m; + } + solver = new bissection<heatx>(); + mode = m; + success = true; +} + +void heatx::set(double d1, double d2) +{ + if(mode==0) T=d1; + if(mode==1) Q=d1; + eta = d2; +} + +bool heatx::solve() +{ + if(mode==0) + { + Q = 0.0; + out->set(in->P, T); + // out->write(); // WRITE TOTO + for(i=0;i<in->nb;i++) + Q+=out->chem[i]->dH(in->T, out->T, in->P)*out->chem[i]->n(); + if(eta>EPS) + Qreal = Q/eta; + else { + Qreal=Q; + success=false; + } + } + if(mode==1) + { + Qreal = eta*Q; + min = in->T; + max = 2000; + solver->set(this, min, max); + success = solver->run(); + out->set(in->P, T); + //out->write(); // WRITE TOTO + } + return success; +} + + +double heatx::f(double x) +{ + T=x; + max = Qreal; + for(i=0;i<in->nb;i++) + max -= out->chem[i]->dH(in->T, T, in->P)*out->chem[i]->n(); + return max; +} + +void heatx::write() +{ + + cout << "WRITE FILE " << RUNTIME << name << ".unit" << " :\n\tBEGIN\n"; + cout << "\t>> " << name; + cout << endl << "\t>> stream in: " << in->name << " T = " << in->T <<" K"; + cout << endl << "\t>> stream out: " << out->name << " T = " << out->T <<" K"; + if (mode==0) + cout<<endl<<"\t>> Heat duty : "<<Qreal<<" kW"; + if (mode==1) + cout<<endl<<"\t>> Heat duty : "<<Q<<" kW"; + if (success) + cout<<endl<<"\t>> Heat losses "<<fabs(Qreal-Q)<<" kW (converged normally)"; + cout << "\n\tEND\n\n"; + + cost(); + power(); + water(); +} + + + +double heatx::get_cost ( void ) { + if(mode==1) min=fabs(Q)/0.225/(eta)/fabs(out->T-in->T); + if(mode==0) min=fabs(Qreal)/0.25/(eta)/fabs(out->T-in->T); + if(min<10) min=10; if(min>1000) min=1000; + max = 4.3247-0.303*log10(min)+0.1634*pow(log10(min),2); + T=in->P; + T = (T-1)*1.01325; + if (fabs(T)<EPS) T=0.1; if(T>100) T=100; + min=0.03881-0.11272*log10(T)+0.08183*pow(log10(T),2); + min=pow(10, min); + max = (1.63+1.66*2.5*min)*pow(10, max); + max = max*MS_YEAR/MS_2001; + return max; +} + + +void heatx::cost() +{ + cout << setprecision(5); + cout << "WRITE FILE " << RUNTIME << name << ".cost" << " :\n\tBEGIN\n"; + cout << "\t>>" << get_cost(); + cout << "\n\tEND\n\n"; +} + + + +double heatx::get_water ( void ) +{ + max = (Q<0.0) ? fabs(Q)/(4.185*0.10*(out->T-298)) : 0.0; + return max; +} + + +void heatx::water() +{ + if(Q<0.0) max = fabs(Q)/(4.185*0.10*(out->T-298)); + else max = 0.0; + cout << "WRITE FILE " << RUNTIME << name << ".water" << " :\n\tBEGIN\n"; + cout << "\t>>" << max; + cout << "\n\tEND\n\n"; + +} + +double heatx::get_power ( void ) { + max = (mode) ? Q : Qreal; + if (max>EPS) + return max; + return 0.0; +} + +void heatx::power() +{ + if(mode==0) max = Qreal; + if(mode==1) max = Q; + + cout << "WRITE FILE " << RUNTIME << name << ".power" << " :\n\tBEGIN\n"; + if(max>EPS) cout<< "\t>>" << max; + else cout<< "\t>>" << 0; + cout << "\n\tEND\n\n"; +} diff --git a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/heatx.hpp b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/heatx.hpp index f9854adf318b541dcac49e2466d35cc69683cd2d..d3b7dffa4dd8771694a77c52ad38a6aba478e821 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/heatx.hpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/heatx.hpp @@ -1,49 +1,49 @@ -/* -This unit performs the heating of a stream (mode 0) or the heat -exchange to a stream (mode 1). -(ref : McCabe, Smith & Harriott) - -Structure in the .process file: -mode 0 : heatx {name} 0 {index of input stream} {index of output stream} {T out} {efficiency} //efficiency is a fraction between 0 and 1 -mode 1 : heatx {name} 1 {index of input stream} {index of output stream} {Q} {efficiency} //Q is the heat flow in kW -How to use: - 1- Call the constructor: heat = new heatx(mode, in, out); - 2- Set the operating conditions : heat->set(T_out, eta); //mode 0 - or : heat->set(Q, eta); //mode 1 - 3- Set the name of the unit: heat->set(name); - 4- Solve: bool=heat->solve(); -*/ -#ifndef HEATX_H -#define HEATX_H - -#include "stream.hpp" -#include "bissection.hpp" -using namespace std; - -class heatx -{ -private: - int i; - bool success, mode; - bissection<heatx> *solver; - // ofstream logf, results; - double min, max; - string name; - stream *in, *out; //streams of the unit - double eta, Q, Qreal, T; - -public: - heatx(){} - heatx(bool, stream*, stream*); //defines the connectivities of this unit - ~heatx(){delete solver;} - void set(double, double); - void set(const string & n) { name = n; } - double f(double); - bool solve(); - void write(); - void power(), water(), cost(); - double get_cost(); - double get_power(); - double get_water(); -}; -#endif +/* +This unit performs the heating of a stream (mode 0) or the heat +exchange to a stream (mode 1). +(ref : McCabe, Smith & Harriott) + +Structure in the .process file: +mode 0 : heatx {name} 0 {index of input stream} {index of output stream} {T out} {efficiency} //efficiency is a fraction between 0 and 1 +mode 1 : heatx {name} 1 {index of input stream} {index of output stream} {Q} {efficiency} //Q is the heat flow in kW +How to use: + 1- Call the constructor: heat = new heatx(mode, in, out); + 2- Set the operating conditions : heat->set(T_out, eta); //mode 0 + or : heat->set(Q, eta); //mode 1 + 3- Set the name of the unit: heat->set(name); + 4- Solve: bool=heat->solve(); +*/ +#ifndef HEATX_H +#define HEATX_H + +#include "stream.hpp" +#include "bissection.hpp" +using namespace std; + +class heatx +{ +private: + int i; + bool success, mode; + bissection<heatx> *solver; + // ofstream logf, results; + double min, max; + string name; + stream *in, *out; //streams of the unit + double eta, Q, Qreal, T; + +public: + heatx(){} + heatx(bool, stream*, stream*); //defines the connectivities of this unit + ~heatx(){delete solver;} + void set(double, double); + void set(const string & n) { name = n; } + double f(double); + bool solve(); + void write(); + void power(), water(), cost(); + double get_cost(); + double get_power(); + double get_water(); +}; +#endif diff --git a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/mix.cpp b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/mix.cpp index 00202a2af2f1ce299966b7b44e1fe85c060950d0..dc02dc7e4b82f42e8631fadcb4d4b2d8500fec32 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/mix.cpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/mix.cpp @@ -1,80 +1,80 @@ -#include "mix.hpp" -#include "bissection.cpp" -using namespace std; - -mix::mix ( int n , stream ** s1 , stream * s2 ) { - nb_in=n; - in = s1; - out= s2; - success = true; - solver = new bissection<mix>(); -} - -bool mix::solve() -{ - //Mass balance - out->m=0; - out->purge(); - for (j=0; j<out->nb;j++) - for (i=0;i<nb_in;i++) if(in[i]->chem[j]->m>EPS) - { - out->chem[j]->m+=in[i]->chem[j]->m; - out->m+=in[i]->chem[j]->m; - } - //Find the temperature - double max=0.0; double min=1e6; - for(i=0;i<nb_in;i++) - for(j=0;j<out->nb;j++) - { - if(in[i]->chem[j]->T>max && in[i]->chem[j]->m>EPS) max=in[i]->chem[j]->T; - if(in[i]->chem[j]->T<min && in[i]->chem[j]->m>EPS) min=in[i]->chem[j]->T; - } - if(fabs(max-min)<EPS) T=max; - else - { - solver->set(this, min, max); - success = solver->run(); - } - out->set(P,T); - // if (success==false) - // { - // log.open(MESSAGES, ios::app); - // log<<" --> Warning <-- Solver of "<<name<<" did not converge.\n"; - // log.close(); - // } - // min = 0; - // for(i=0;i<nb_in;i++) - // min+=in[i]->m; - // if(fabs(min-out->m)>sqrt(EPS)) - // { - // log.open(MESSAGES, ios::app); - // log<<" --> Warning <-- Block "<<name<<" is not in mass balance ("<<fabs(min-out->m)/min<<").\n"; - // log.close(); - // } - - // out->write(); // WRITE TOTO - return success; -} - -double mix::f(double x) -{ - T=x; - double energy=0.0; //in kW - for (j=0; j<out->nb;j++) - for (i=0;i<nb_in;i++) - energy += in[i]->chem[j]->dH(in[i]->T, T, P)*in[i]->chem[j]->n()/1000; - return energy; -} - -void mix::write() { - cout << "WRITE FILE " << RUNTIME << name << ".unit" << " :\n\tBEGIN\n"; - cout << "\t>> " << name - << endl << "\t>> streams in: "; - for ( int i = 0 ; i < nb_in ; i++ ) - cout << in[i]->name << " "; - cout << endl << "\t>> stream out: " << out->name; - cout <<endl << "\t>> P = " << P << " atm, T = " << T; - if (success) - cout << " K (converged normally)"; - cout << "\n\tEND\n\n"; -} +#include "mix.hpp" +#include "bissection.cpp" +using namespace std; + +mix::mix ( int n , stream ** s1 , stream * s2 ) { + nb_in=n; + in = s1; + out= s2; + success = true; + solver = new bissection<mix>(); +} + +bool mix::solve() +{ + //Mass balance + out->m=0; + out->purge(); + for (j=0; j<out->nb;j++) + for (i=0;i<nb_in;i++) if(in[i]->chem[j]->m>EPS) + { + out->chem[j]->m+=in[i]->chem[j]->m; + out->m+=in[i]->chem[j]->m; + } + //Find the temperature + double max=0.0; double min=1e6; + for(i=0;i<nb_in;i++) + for(j=0;j<out->nb;j++) + { + if(in[i]->chem[j]->T>max && in[i]->chem[j]->m>EPS) max=in[i]->chem[j]->T; + if(in[i]->chem[j]->T<min && in[i]->chem[j]->m>EPS) min=in[i]->chem[j]->T; + } + if(fabs(max-min)<EPS) T=max; + else + { + solver->set(this, min, max); + success = solver->run(); + } + out->set(P,T); + // if (success==false) + // { + // log.open(MESSAGES, ios::app); + // log<<" --> Warning <-- Solver of "<<name<<" did not converge.\n"; + // log.close(); + // } + // min = 0; + // for(i=0;i<nb_in;i++) + // min+=in[i]->m; + // if(fabs(min-out->m)>sqrt(EPS)) + // { + // log.open(MESSAGES, ios::app); + // log<<" --> Warning <-- Block "<<name<<" is not in mass balance ("<<fabs(min-out->m)/min<<").\n"; + // log.close(); + // } + + // out->write(); // WRITE TOTO + return success; +} + +double mix::f(double x) +{ + T=x; + double energy=0.0; //in kW + for (j=0; j<out->nb;j++) + for (i=0;i<nb_in;i++) + energy += in[i]->chem[j]->dH(in[i]->T, T, P)*in[i]->chem[j]->n()/1000; + return energy; +} + +void mix::write() { + cout << "WRITE FILE " << RUNTIME << name << ".unit" << " :\n\tBEGIN\n"; + cout << "\t>> " << name + << endl << "\t>> streams in: "; + for ( int i = 0 ; i < nb_in ; i++ ) + cout << in[i]->name << " "; + cout << endl << "\t>> stream out: " << out->name; + cout <<endl << "\t>> P = " << P << " atm, T = " << T; + if (success) + cout << " K (converged normally)"; + cout << "\n\tEND\n\n"; +} diff --git a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/mix.hpp b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/mix.hpp index 85b8d771f173ba66deb363e2586bb42d7cd74854..6d4ee0f28d6696616e803fdfe89e6689b3001d69 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/mix.hpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/mix.hpp @@ -1,44 +1,44 @@ -/* -This unit takes more than two input streams and merge them in one -output stream. The pressure must be specified by the user, and the -temperature of the output stream is computed. - -Structure in the .process file: -mix {name} {pressure} {nb_in} {indexes of input streams} {index of output stream} - -How to use: - 1- Call the constructor: mix1 = new mix(nb_in, list1_in, out); - 2- Set the operating pressure : mix1->set(P); - 3- Set the name of the unit: mix1->set(name); - 4- Solve: bool=mix1->solve(); -*/ -#ifndef MIX_H -#define MIX_H - -#include "stream.hpp" -#include "bissection.hpp" -using namespace std; - -class mix { - private: - int i, j; - bool success; - bissection<mix> *solver; - string name; - int nb_in; //number of input streams - stream **in; //list pointers to input streams - stream *out; //pointer to output stream - // double min, max; - - public: - double P, T; //pressure (given) and temperature (unknown) - mix(){P=0.0;} - mix(int, stream**, stream*); //defines the connectivities of this unit - ~mix(){delete solver;} - void set(double p) {P=p;} - void set ( const string & n ) { name = n; } - double f(double); //returns the function to the solver - bool solve(); //finds the temperature and computes mass balance - void write(); -}; -#endif +/* +This unit takes more than two input streams and merge them in one +output stream. The pressure must be specified by the user, and the +temperature of the output stream is computed. + +Structure in the .process file: +mix {name} {pressure} {nb_in} {indexes of input streams} {index of output stream} + +How to use: + 1- Call the constructor: mix1 = new mix(nb_in, list1_in, out); + 2- Set the operating pressure : mix1->set(P); + 3- Set the name of the unit: mix1->set(name); + 4- Solve: bool=mix1->solve(); +*/ +#ifndef MIX_H +#define MIX_H + +#include "stream.hpp" +#include "bissection.hpp" +using namespace std; + +class mix { + private: + int i, j; + bool success; + bissection<mix> *solver; + string name; + int nb_in; //number of input streams + stream **in; //list pointers to input streams + stream *out; //pointer to output stream + // double min, max; + + public: + double P, T; //pressure (given) and temperature (unknown) + mix(){P=0.0;} + mix(int, stream**, stream*); //defines the connectivities of this unit + ~mix(){delete solver;} + void set(double p) {P=p;} + void set ( const string & n ) { name = n; } + double f(double); //returns the function to the solver + bool solve(); //finds the temperature and computes mass balance + void write(); +}; +#endif diff --git a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/pfr.cpp b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/pfr.cpp index 54694511705078ad9e5954a1610d97e22f00169f..bcb7ccff69f72da99964d64e56481b4db3c2ece4 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/pfr.cpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/pfr.cpp @@ -1,174 +1,174 @@ -#include "pfr.hpp" -#include "RungeKutta.cpp" -using namespace std; - -pfr::pfr ( stream * s1 , stream * s2 , double ** t , int nb_r , reaction ** rr , double u , double ta ) { - - F = s2; - F->m=0; - P=s1->P; - for ( i = 0 ; i < s1->nb ; i++ ) { - F->chem[i]->m = s1->chem[i]->m; - F->m+=F->chem[i]->m; - } - F->set(s1->P, s1->T); - m_in=F->m; - a = t; - rx = rr; - n=nb_r; - m= F->nb; - U=u; - Ta=ta; - T = F->T; - C = new double[m]; - y = new double[m+1]; - r=new double[n]; - OK=true; - explode=true; - solver = new RungeKutta<pfr>(m+1); -} - -pfr::~pfr() { - delete [] r; - delete [] C; - delete [] y; - delete solver; -} - -bool pfr::run() { - - for ( i = 0 ; i < m ; i++ ) - y[i]=F->chem[i]->n(); - - y[m]=T; - - solver->set ( this , y , 0.0 , L ); - - dL=solver->dx(); - - OK=solver->run(); - - sum = F->m; - F->m = 0; - - for ( i = 0 ; i < m ; i++ ) - F->m+=F->chem[i]->m; - for ( i = 0 ; i < m ; i++ ) - F->chem[i]->m *= sum/F->m; - // if (OK) - //mass balance! - if ( fabs(m_in-F->m) > EPS || !explode ) - OK=false; - - return OK; -} - -double pfr::f ( int eq , double l , double * y ) { - - - sum=F->m; - F->m=0; - for(i=0; i<m;i++) - { - if(y[i]<0) y[i]=0; - F->chem[i]->m = y[i]*F->chem[i]->M/1000.0; - F->m+=F->chem[i]->m; - } - - - for(i=0; i<m;i++) - F->chem[i]->m *= sum/F->m; - - - F->m=sum; - T=y[m]; - if(T>MAX_TEMP) - { - cout << "ERROR 11\n\n"; - exit(0); - } - - - for(i=0; i<m;i++) - C[i]=F->chem[i]->n()/F->v; - - for(j=0;j<n;j++) - r[j] = rx[j]->rate(T,C); - - if(0<=eq && eq<m) //return dFi/dL - { - tmp=0.0; - for(j=0;j<n;j++) tmp+=a[eq][j]*r[j]; - tmp *= (pi*D*D/4.0); - } - - - - if(eq==m) //return dT/dL - { - - - F->set(F->P,T); - - tmp=0.0; - for(j=0;j<n;j++) - tmp -= r[j]*rx[j]->dHr(T); - - - tmp *= (pi*D*D/4.0); - - - tmp += (pi*D)*U*(Ta-T); - - - tmp1=0.0; - for(i=0;i<m;i++) - tmp1+= y[i]*F->chem[i]->Cp()*0.001; - tmp /= tmp1; - - - if(fabs(tmp*dL)>500.0) - { - cout << "ERROR 13\n\n"; - exit(0); - } - } - - - - - return tmp; -} - - - -double pfr::get_cost ( void ) { - dL=L*pi*pow(D,2)/4.0; - if(dL<0.3) dL=0.3; if(dL>520) dL=520; - sum = 3.4974+0.4485*log10(dL)+0.1074*pow(log10(dL),2); - sum = pow(10, sum); - P= (P-1)*101.325/100; - dL=(P+1)*D/(317.46*(850-0.6*(P+1)))+0.0315; - sum *=(2.25+ 1.82*dL*4.2); - sum = sum*MS_YEAR/MS_2001; - return sum; -} - -double pfr::get_water() { - sum = (U>EPS && T>Ta) ? U*L*pi*pow(D,2)/4*(T-Ta)/4.185/25.0 : 0.0; - return sum; -} - -void pfr::cost() { - cout << "WRITE FILE " << RUNTIME << name << ".cost" << " :\n\tBEGIN\n"; - cout << "\t>>" << get_cost(); - cout << "\n\tEND\n\n"; -} - -void pfr::water() { - cout << "WRITE FILE " << RUNTIME << name << ".water" << " :\n\tBEGIN\n"; - if (U>EPS && T>Ta) sum = (U*L*pi*pow(D,2)/4*(T-Ta)/4.185/25.0); - else sum = 0.0; - cout << "\t>>" << sum; - cout << "\n\tEND\n\n"; -} +#include "pfr.hpp" +#include "RungeKutta.cpp" +using namespace std; + +pfr::pfr ( stream * s1 , stream * s2 , double ** t , int nb_r , reaction ** rr , double u , double ta ) { + + F = s2; + F->m=0; + P=s1->P; + for ( i = 0 ; i < s1->nb ; i++ ) { + F->chem[i]->m = s1->chem[i]->m; + F->m+=F->chem[i]->m; + } + F->set(s1->P, s1->T); + m_in=F->m; + a = t; + rx = rr; + n=nb_r; + m= F->nb; + U=u; + Ta=ta; + T = F->T; + C = new double[m]; + y = new double[m+1]; + r=new double[n]; + OK=true; + explode=true; + solver = new RungeKutta<pfr>(m+1); +} + +pfr::~pfr() { + delete [] r; + delete [] C; + delete [] y; + delete solver; +} + +bool pfr::run() { + + for ( i = 0 ; i < m ; i++ ) + y[i]=F->chem[i]->n(); + + y[m]=T; + + solver->set ( this , y , 0.0 , L ); + + dL=solver->dx(); + + OK=solver->run(); + + sum = F->m; + F->m = 0; + + for ( i = 0 ; i < m ; i++ ) + F->m+=F->chem[i]->m; + for ( i = 0 ; i < m ; i++ ) + F->chem[i]->m *= sum/F->m; + // if (OK) + //mass balance! + if ( fabs(m_in-F->m) > EPS || !explode ) + OK=false; + + return OK; +} + +double pfr::f ( int eq , double l , double * y ) { + + + sum=F->m; + F->m=0; + for(i=0; i<m;i++) + { + if(y[i]<0) y[i]=0; + F->chem[i]->m = y[i]*F->chem[i]->M/1000.0; + F->m+=F->chem[i]->m; + } + + + for(i=0; i<m;i++) + F->chem[i]->m *= sum/F->m; + + + F->m=sum; + T=y[m]; + if(T>MAX_TEMP) + { + cout << "ERROR 11\n\n"; + exit(0); + } + + + for(i=0; i<m;i++) + C[i]=F->chem[i]->n()/F->v; + + for(j=0;j<n;j++) + r[j] = rx[j]->rate(T,C); + + if(0<=eq && eq<m) //return dFi/dL + { + tmp=0.0; + for(j=0;j<n;j++) tmp+=a[eq][j]*r[j]; + tmp *= (pi*D*D/4.0); + } + + + + if(eq==m) //return dT/dL + { + + + F->set(F->P,T); + + tmp=0.0; + for(j=0;j<n;j++) + tmp -= r[j]*rx[j]->dHr(T); + + + tmp *= (pi*D*D/4.0); + + + tmp += (pi*D)*U*(Ta-T); + + + tmp1=0.0; + for(i=0;i<m;i++) + tmp1+= y[i]*F->chem[i]->Cp()*0.001; + tmp /= tmp1; + + + if(fabs(tmp*dL)>500.0) + { + cout << "ERROR 13\n\n"; + exit(0); + } + } + + + + + return tmp; +} + + + +double pfr::get_cost ( void ) { + dL=L*pi*pow(D,2)/4.0; + if(dL<0.3) dL=0.3; if(dL>520) dL=520; + sum = 3.4974+0.4485*log10(dL)+0.1074*pow(log10(dL),2); + sum = pow(10, sum); + P= (P-1)*101.325/100; + dL=(P+1)*D/(317.46*(850-0.6*(P+1)))+0.0315; + sum *=(2.25+ 1.82*dL*4.2); + sum = sum*MS_YEAR/MS_2001; + return sum; +} + +double pfr::get_water() { + sum = (U>EPS && T>Ta) ? U*L*pi*pow(D,2)/4*(T-Ta)/4.185/25.0 : 0.0; + return sum; +} + +void pfr::cost() { + cout << "WRITE FILE " << RUNTIME << name << ".cost" << " :\n\tBEGIN\n"; + cout << "\t>>" << get_cost(); + cout << "\n\tEND\n\n"; +} + +void pfr::water() { + cout << "WRITE FILE " << RUNTIME << name << ".water" << " :\n\tBEGIN\n"; + if (U>EPS && T>Ta) sum = (U*L*pi*pow(D,2)/4*(T-Ta)/4.185/25.0); + else sum = 0.0; + cout << "\t>>" << sum; + cout << "\n\tEND\n\n"; +} diff --git a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/pfr.hpp b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/pfr.hpp index a8f49a71415ecc208c6ed692e7a4c6b99351ce49..9746a504839af042f2f0584c37708be715bbbbb4 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/pfr.hpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/pfr.hpp @@ -1,36 +1,36 @@ -#ifndef PFR_H -#define PFR_H - -#include "reaction.hpp" -#include "RungeKutta.hpp" -#include "stream.hpp" -using namespace std; - -class pfr { -private: - // terminator *term; - // ofstream results; - string name; - bool OK, explode; - int i ,j, n, m; - double L,D,dL, U, Ta, m_in, sum, P; - stream *F; - double **a, *C, T, *y, *r, tmp, tmp1; - reaction **rx; - RungeKutta<pfr> *solver; - -public: - // pfr(){}; - pfr ( stream * , stream * , double ** , int , reaction ** , double , double ); - void set ( const string & n ) { name = n; } - void set(double l, double d) {L=l; D=d;} - bool run(); - void water(); - void cost(); - double get_cost ( void ); - double get_water ( void ); - - double f(int, double, double*); - ~pfr(); -}; -#endif +#ifndef PFR_H +#define PFR_H + +#include "reaction.hpp" +#include "RungeKutta.hpp" +#include "stream.hpp" +using namespace std; + +class pfr { +private: + // terminator *term; + // ofstream results; + string name; + bool OK, explode; + int i ,j, n, m; + double L,D,dL, U, Ta, m_in, sum, P; + stream *F; + double **a, *C, T, *y, *r, tmp, tmp1; + reaction **rx; + RungeKutta<pfr> *solver; + +public: + // pfr(){}; + pfr ( stream * , stream * , double ** , int , reaction ** , double , double ); + void set ( const string & n ) { name = n; } + void set(double l, double d) {L=l; D=d;} + bool run(); + void water(); + void cost(); + double get_cost ( void ); + double get_water ( void ); + + double f(int, double, double*); + ~pfr(); +}; +#endif diff --git a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/profitability.cpp b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/profitability.cpp index 3617b30317dac940d299770d5afe8f8ec4a67c31..902f30dcfd2091ddbd5395997e010cb446546243 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/profitability.cpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/profitability.cpp @@ -1,138 +1,138 @@ -#include "profitability.hpp" -#include "secant.cpp" -using namespace std; - -bool profitability::run ( double * y ) -{ - OK=true; - - // cout<<setiosflags(ios::fixed); - // cout<<endl<<endl<<" PROFITABILITY ANALYSIS"<<endl; - // cout<<endl<<setprecision(1)<<" Return on investment (%)= "<<ROI()*100.0; - // cout<<endl<<" Rate of return (%)= "<<RR()*100.0; // y[10] - - y[10] = RR()*100.0; // y[10] - - ROI(); - RR(); - - // cout<<endl<<" Discounted flow rate (%)= "<<DFR()*100.0; - - DFR(); - - // cout<<endl<<endl<<" Payout time (y)= "<<PT(); // y[ 9] - y[9] = PT(); - - // cout<<endl<<setprecision(0)<<" Annual equivalent cost ($)= "<<AEC(); // y[12] - y[12] = AEC(); - - // cout<<endl<<" Net present value ($)= "<<NPV()<<endl; // y[13] - y[13] = NPV(); - - return OK; -} - -double profitability::ROI() -{ - // if(!MUTE)cout<<endl<<" return on investment..."; - num=den=0.0; - for(i=0;i<C->N;i++) - { - if(C->Inv[i]>EPS) den+=C->Inv[i]; - num+=(C->Rev[i]-C->Coper[i]-C->Amort[i]); - } - if (num>EPS && den>EPS && C->N>0) { - // if(!MUTE)cout<<" OK"; - return num/C->N/den; - } - else return 0.0; -} - -double profitability::RR() -{ - // if(!MUTE)cout<<endl<<" rate of return..."; - num=den=0.0; - for(i=0;i<C->N;i++) - { - num+=(C->Rev[i]-C->Coper[i])/pow(1.0+C->i_rate, i); - den+=C->Inv[i]/pow(1.0+C->i_rate, i); - } - if(num>EPS && den>EPS) { - // if(!MUTE)cout<<" OK"; - return num/den; - } - else return 0.0; -} - -double profitability::DFR() -{ - //if(!MUTE)cout<<endl<<" discounted cash flow rate..."; - solver = new secant<profitability>(); - solver->set(this, 0.0, 0.01); - OK = solver->run(); - - if ( OK && num>EPS && num < 1e20 ) { - // if(!MUTE)cout<<" OK"; - return num; - } - else return 0.0; -} - -double profitability::f(double x) -{ - num=x; - sum=0.0; - for(i=0;i<C->N;i++) - sum += C->Flow[i]/pow(1.0+x, i); - return sum; -} - -double profitability::PT() -{ - // if(!MUTE)cout<<endl<<" payout time..."; - sum=0.0; - for(i=0;i<C->N;i++) - { - if((sum+C->Flow[i])>0.0) - { - den=0.0; - while(sum+den*C->Flow[i]<=0.0) den+=0.001; - den+=double(i-1); - i=C->N; - } - else sum+=C->Flow[i]; - } - - if(den>EPS) { - // if(!MUTE)cout<<" OK"; - return den; - } - else return 0.0; -} - -double profitability::AEC() -{ - //if(!MUTE)cout<<endl<<" annual equivalent cost..."; - sum=0.0; - for(i=0;i<C->N;i++) sum+=(C->Coper[i]+C->Inv[i])/pow(1.0+C->i_rate, i); - if (sum>EPS) { -// if(!MUTE) -// cout<<" OK"; - return sum*(C->i_rate*pow(1.0+C->i_rate,C->N))/(pow(1.0+C->i_rate,C->N)-1.0); - } - else return 0.0; -} - -double profitability::NPV() -{ - // if(!MUTE)cout<<endl<<" net present value..."; - sum=0.0; - for ( i = 0 ; i < C->N ; i++ ) - sum += C->Flowact[i]; - if ( sum > EPS ) { -// if(!MUTE) -// cout<<" OK"; - return sum; - } - return 0.0; -} +#include "profitability.hpp" +#include "secant.cpp" +using namespace std; + +bool profitability::run ( double * y ) +{ + OK=true; + + // cout<<setiosflags(ios::fixed); + // cout<<endl<<endl<<" PROFITABILITY ANALYSIS"<<endl; + // cout<<endl<<setprecision(1)<<" Return on investment (%)= "<<ROI()*100.0; + // cout<<endl<<" Rate of return (%)= "<<RR()*100.0; // y[10] + + y[10] = RR()*100.0; // y[10] + + ROI(); + RR(); + + // cout<<endl<<" Discounted flow rate (%)= "<<DFR()*100.0; + + DFR(); + + // cout<<endl<<endl<<" Payout time (y)= "<<PT(); // y[ 9] + y[9] = PT(); + + // cout<<endl<<setprecision(0)<<" Annual equivalent cost ($)= "<<AEC(); // y[12] + y[12] = AEC(); + + // cout<<endl<<" Net present value ($)= "<<NPV()<<endl; // y[13] + y[13] = NPV(); + + return OK; +} + +double profitability::ROI() +{ + // if(!MUTE)cout<<endl<<" return on investment..."; + num=den=0.0; + for(i=0;i<C->N;i++) + { + if(C->Inv[i]>EPS) den+=C->Inv[i]; + num+=(C->Rev[i]-C->Coper[i]-C->Amort[i]); + } + if (num>EPS && den>EPS && C->N>0) { + // if(!MUTE)cout<<" OK"; + return num/C->N/den; + } + else return 0.0; +} + +double profitability::RR() +{ + // if(!MUTE)cout<<endl<<" rate of return..."; + num=den=0.0; + for(i=0;i<C->N;i++) + { + num+=(C->Rev[i]-C->Coper[i])/pow(1.0+C->i_rate, i); + den+=C->Inv[i]/pow(1.0+C->i_rate, i); + } + if(num>EPS && den>EPS) { + // if(!MUTE)cout<<" OK"; + return num/den; + } + else return 0.0; +} + +double profitability::DFR() +{ + //if(!MUTE)cout<<endl<<" discounted cash flow rate..."; + solver = new secant<profitability>(); + solver->set(this, 0.0, 0.01); + OK = solver->run(); + + if ( OK && num>EPS && num < 1e20 ) { + // if(!MUTE)cout<<" OK"; + return num; + } + else return 0.0; +} + +double profitability::f(double x) +{ + num=x; + sum=0.0; + for(i=0;i<C->N;i++) + sum += C->Flow[i]/pow(1.0+x, i); + return sum; +} + +double profitability::PT() +{ + // if(!MUTE)cout<<endl<<" payout time..."; + sum=0.0; + for(i=0;i<C->N;i++) + { + if((sum+C->Flow[i])>0.0) + { + den=0.0; + while(sum+den*C->Flow[i]<=0.0) den+=0.001; + den+=double(i-1); + i=C->N; + } + else sum+=C->Flow[i]; + } + + if(den>EPS) { + // if(!MUTE)cout<<" OK"; + return den; + } + else return 0.0; +} + +double profitability::AEC() +{ + //if(!MUTE)cout<<endl<<" annual equivalent cost..."; + sum=0.0; + for(i=0;i<C->N;i++) sum+=(C->Coper[i]+C->Inv[i])/pow(1.0+C->i_rate, i); + if (sum>EPS) { +// if(!MUTE) +// cout<<" OK"; + return sum*(C->i_rate*pow(1.0+C->i_rate,C->N))/(pow(1.0+C->i_rate,C->N)-1.0); + } + else return 0.0; +} + +double profitability::NPV() +{ + // if(!MUTE)cout<<endl<<" net present value..."; + sum=0.0; + for ( i = 0 ; i < C->N ; i++ ) + sum += C->Flowact[i]; + if ( sum > EPS ) { +// if(!MUTE) +// cout<<" OK"; + return sum; + } + return 0.0; +} diff --git a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/profitability.hpp b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/profitability.hpp index 194102c797e5dc33436d923e0b2b883da4a85979..03f85c57c5454c84d5be1f6d6d35a42a45839c1f 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/profitability.hpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/profitability.hpp @@ -1,30 +1,30 @@ -#ifndef PROFITABILITY_H -#define PROFITABILITY_H -#include "cashflow.hpp" -#include "secant.hpp" - -#include <iomanip> - -using namespace std; - -class profitability -{ -private: - cashflow *C; -// ofstream out; -// char name[41]; - bool OK; - double ROI(), RR(), DFR(); - double PT(), AEC(), NPV(); - int i; - double den, num, sum; - secant<profitability> *solver; - -public: - profitability(cashflow* c){C=c;} - ~profitability(){delete solver;}; - // void set(char n[31]) {strcpy(name, n); strcat(name, ".econo");} - bool run ( double * y ); - double f(double); -}; -#endif +#ifndef PROFITABILITY_H +#define PROFITABILITY_H +#include "cashflow.hpp" +#include "secant.hpp" + +#include <iomanip> + +using namespace std; + +class profitability +{ +private: + cashflow *C; +// ofstream out; +// char name[41]; + bool OK; + double ROI(), RR(), DFR(); + double PT(), AEC(), NPV(); + int i; + double den, num, sum; + secant<profitability> *solver; + +public: + profitability(cashflow* c){C=c;} + ~profitability(){delete solver;}; + // void set(char n[31]) {strcpy(name, n); strcat(name, ".econo");} + bool run ( double * y ); + double f(double); +}; +#endif diff --git a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/pump.cpp b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/pump.cpp index 685a0bef39991b6383b7ec874dbe9d695504bf08..166123fcc5c2a010b33059419d072a6a5b28882c 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/pump.cpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/pump.cpp @@ -1,94 +1,94 @@ -#include "pump.hpp" -using namespace std; - -bool pump::solve() { - - // out->chem = in->chem; - out->set ( in->nb , in->chem ); - out->m = in->m; - - - in->set(in->P,in->T); - for ( i = 0 ; i < in->nb ; i++ ) - if(in->chem[i]->m>EPS) { - in->chem[i]->find_v(); - if(in->chem[i]->state==1) { - W+=in->chem[i]->gamma()*in->T*0.0083144*in->chem[i]->n()/ - (in->chem[i]->gamma()-1.0)*(pow(P/in->P, 1.0-1.0/in->chem[i]->gamma())-1.0); - tmp += in->chem[i]->gamma(); - n++; - } - if(in->chem[i]->state==0) - W+=in->chem[i]->v*(P-in->P)*101.325; - } - if (fabs(state-1)<EPS) //compressing gases - out->T = in->T*pow(P/in->P, 1.0-1.0/(tmp/n)); - else //compressing liquids - out->T=in->T; - out->set(P, out->T); - if(eta>EPS) - W /= eta; - else - success=false; - // out->write(); // WRITE TOTO - return success; -} - -void pump::write() { - - cout << setprecision(6); - - string file_name = RUNTIME + name + ".unit"; - cout << "WRITE FILE " << file_name << " :\n\tBEGIN\n"; - cout <<"\t>> " << name; - cout << endl << "\t>> stream in: "<<in->name<<" out: "<<out->name; - cout << endl << "\t>> P(in) = "<<in->P<<" P(out) = "<<out->P<<" atm"; - cout << endl << "\t>> T(in) = "<<in->T<<" T(out) = "<<out->T<<" K"; - cout << endl << "\t>> Shaft work = "<<W; - if (success) - cout <<" kW (converge normally)"; - cout << "\n\tEND\n\n"; - - power(); - cost(); -} - - -double pump::get_cost ( void ) { - - if ( fabs(state-1) < EPS ) { - if(W<450) W=450; if(W>3000)W=3000; - tmp=2.2891+1.3604*log10(W)-0.1027*pow(log10(W),2); - tmp=3.2*pow(10.0, tmp); - tmp1=2.4604+1.4191*log10(W)-0.1798*pow(log10(W),2); - tmp1=1.5*pow(10.0, tmp1); - tmp+=tmp1; - } - else { - if(W<1) W=1; if(W>300)W=300; - tmp=3.3892+0.0536*log10(W)+0.1538*pow(log10(W),2); - tmp=pow(10.0, tmp); - P=(P-1.0)*101.325/100.0; - if (P<EPS) P=1; if(P>100) P=100; - W = -0.3925+0.3957*log10(P)-0.00226*pow(log10(P),2); - W=pow(10.0, W); if(W<1) W=1; - tmp*=(1.89+1.35*W*1.8); - } - tmp = tmp*MS_YEAR/MS_2001; - return tmp; -} - - -void pump::cost() { - string file_name = RUNTIME + name + ".cost"; - cout << "WRITE FILE " << file_name << " :\n\tBEGIN\n"; - cout << "\t>>" << get_cost(); - cout << "\n\tEND\n\n"; -} - -void pump::power() { - string file_name = RUNTIME + name + ".power"; - cout << "WRITE FILE " << file_name << " :\n\tBEGIN\n"; - cout << "\t>>" << W; - cout << "\n\tEND\n\n"; -} +#include "pump.hpp" +using namespace std; + +bool pump::solve() { + + // out->chem = in->chem; + out->set ( in->nb , in->chem ); + out->m = in->m; + + + in->set(in->P,in->T); + for ( i = 0 ; i < in->nb ; i++ ) + if(in->chem[i]->m>EPS) { + in->chem[i]->find_v(); + if(in->chem[i]->state==1) { + W+=in->chem[i]->gamma()*in->T*0.0083144*in->chem[i]->n()/ + (in->chem[i]->gamma()-1.0)*(pow(P/in->P, 1.0-1.0/in->chem[i]->gamma())-1.0); + tmp += in->chem[i]->gamma(); + n++; + } + if(in->chem[i]->state==0) + W+=in->chem[i]->v*(P-in->P)*101.325; + } + if (fabs(state-1)<EPS) //compressing gases + out->T = in->T*pow(P/in->P, 1.0-1.0/(tmp/n)); + else //compressing liquids + out->T=in->T; + out->set(P, out->T); + if(eta>EPS) + W /= eta; + else + success=false; + // out->write(); // WRITE TOTO + return success; +} + +void pump::write() { + + cout << setprecision(6); + + string file_name = RUNTIME + name + ".unit"; + cout << "WRITE FILE " << file_name << " :\n\tBEGIN\n"; + cout <<"\t>> " << name; + cout << endl << "\t>> stream in: "<<in->name<<" out: "<<out->name; + cout << endl << "\t>> P(in) = "<<in->P<<" P(out) = "<<out->P<<" atm"; + cout << endl << "\t>> T(in) = "<<in->T<<" T(out) = "<<out->T<<" K"; + cout << endl << "\t>> Shaft work = "<<W; + if (success) + cout <<" kW (converge normally)"; + cout << "\n\tEND\n\n"; + + power(); + cost(); +} + + +double pump::get_cost ( void ) { + + if ( fabs(state-1) < EPS ) { + if(W<450) W=450; if(W>3000)W=3000; + tmp=2.2891+1.3604*log10(W)-0.1027*pow(log10(W),2); + tmp=3.2*pow(10.0, tmp); + tmp1=2.4604+1.4191*log10(W)-0.1798*pow(log10(W),2); + tmp1=1.5*pow(10.0, tmp1); + tmp+=tmp1; + } + else { + if(W<1) W=1; if(W>300)W=300; + tmp=3.3892+0.0536*log10(W)+0.1538*pow(log10(W),2); + tmp=pow(10.0, tmp); + P=(P-1.0)*101.325/100.0; + if (P<EPS) P=1; if(P>100) P=100; + W = -0.3925+0.3957*log10(P)-0.00226*pow(log10(P),2); + W=pow(10.0, W); if(W<1) W=1; + tmp*=(1.89+1.35*W*1.8); + } + tmp = tmp*MS_YEAR/MS_2001; + return tmp; +} + + +void pump::cost() { + string file_name = RUNTIME + name + ".cost"; + cout << "WRITE FILE " << file_name << " :\n\tBEGIN\n"; + cout << "\t>>" << get_cost(); + cout << "\n\tEND\n\n"; +} + +void pump::power() { + string file_name = RUNTIME + name + ".power"; + cout << "WRITE FILE " << file_name << " :\n\tBEGIN\n"; + cout << "\t>>" << W; + cout << "\n\tEND\n\n"; +} diff --git a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/pump.hpp b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/pump.hpp index aac9e6bea209a0cf9177dcdcc7f3bdd63d9030e6..dbcacfd5005ca04ff4cc2f45b02d8ef3bd55af37 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/pump.hpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/pump.hpp @@ -1,46 +1,46 @@ -/* -This unit takes one input stream and divides in two or more -output streams. The pressure and temparature of output streams -are the same as the input's. -(ref : McCabe, Smith & Harriott) - -Structure in the .process file: -pump {name} {index of input stream} {index of output stream} {output pressure in atm} {efficiency, between 0 and 1} - -How to use: - 1- Call the constructor: pump1 = new pump(in, out); - 2- Set conditions: pump1->set(P_output, efficiency); - 3- Set the name: pump1->set(name); - 4- Solve: pump1->solve(); -*/ -#ifndef PUMP_H -#define PUMP_H - -#include "stream.hpp" -using namespace std; - -class pump -{ -private: - int i, j, n; - double state, tmp, tmp1; - bool success; - string name; - stream *in; //pointer to input stream - stream *out; //pointer to output stream - -public: - double P, W, eta; //output presure in atm, work in kW and efficiency - pump(stream* s1, stream* s2) {in=s1; out=s2; success=true; W=0.0; n=0; tmp=0.0;} - ~pump(){} - void set(double p, double e){P = p; eta = e; state=in->quality();} - void set(const string & n) { name = n; } - bool solve(); //finds the temperature and computes mass balance - void write(); - void cost(); - double get_cost(); // calcule W aussi - double get_power() const { return W; } - - void power(); -}; -#endif +/* +This unit takes one input stream and divides in two or more +output streams. The pressure and temparature of output streams +are the same as the input's. +(ref : McCabe, Smith & Harriott) + +Structure in the .process file: +pump {name} {index of input stream} {index of output stream} {output pressure in atm} {efficiency, between 0 and 1} + +How to use: + 1- Call the constructor: pump1 = new pump(in, out); + 2- Set conditions: pump1->set(P_output, efficiency); + 3- Set the name: pump1->set(name); + 4- Solve: pump1->solve(); +*/ +#ifndef PUMP_H +#define PUMP_H + +#include "stream.hpp" +using namespace std; + +class pump +{ +private: + int i, j, n; + double state, tmp, tmp1; + bool success; + string name; + stream *in; //pointer to input stream + stream *out; //pointer to output stream + +public: + double P, W, eta; //output presure in atm, work in kW and efficiency + pump(stream* s1, stream* s2) {in=s1; out=s2; success=true; W=0.0; n=0; tmp=0.0;} + ~pump(){} + void set(double p, double e){P = p; eta = e; state=in->quality();} + void set(const string & n) { name = n; } + bool solve(); //finds the temperature and computes mass balance + void write(); + void cost(); + double get_cost(); // calcule W aussi + double get_power() const { return W; } + + void power(); +}; +#endif diff --git a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/reaction.cpp b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/reaction.cpp index 9eaafc1a52eb29cacd9e13768a770b8b28d8465c..ee658e5b654b82ee3560805b5a519f44cbc97a14 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/reaction.cpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/reaction.cpp @@ -1,204 +1,204 @@ -#include "reaction.hpp" -using namespace std; - - -int reaction::find_chemical ( const string & chem_name ) const { - for ( int i = 0 ; i < m ; i++ ) - if ( list[i]->CAS == chem_name ) - return i; - return -1; -} - -// donnees hardcodees -reaction::reaction ( const string & in1 , int dim , chemical ** in2 ) { - - m = dim; // nbre de chemicals - list = in2; // liste des chemicals - - n = new double[m]; - safe_n = new double[m]; - safe_a = new double[m]; - a = new double[m]; - - int i , j; - for ( i = 0 ; i < m ; i++ ) { - a[i]=0.0; - n[i]=0.0; - } - - // 1/5 : - if ( in1 == "eb2sty" ) { - k0 = 3.525e5; - E = 90.85; - if ( (j = find_chemical ("100-41-4")) < 0 ) { - cout << "ERROR 10a\n\n"; - exit(0); - } - a[j] = -1; - n[j] = 1; - if ( (j = find_chemical ("1333-74-0")) < 0 ) { - cout << "ERROR 10b\n\n"; - exit(0); - } - a[j] = 1; - n[j] = 0; - if ( (j = find_chemical ("100-42-5")) < 0 ) { - cout << "ERROR 10c\n\n"; - exit(0); - } - a[j] = 1; - n[j] = 0; - } - - // 2/5 : - else if ( in1 == "sty2eb" ) { - k0 = 2.754e-4; - E = -18.653; - if ( (j = find_chemical ("100-41-4")) < 0 ) { - cout << "ERROR 10d\n\n"; - exit(0); - } - a[j] = 1; - n[j] = 0; - if ( (j = find_chemical ("1333-74-0")) < 0 ) { - cout << "ERROR 10e\n\n"; - exit(0); - } - a[j] = -1; - n[j] = 1; - if ( (j = find_chemical ("100-42-5")) < 0 ) { - cout << "ERROR 10f\n\n"; - exit(0); - } - a[j] = -1; - n[j] = 1; - } - - // 3/5 : - else if ( in1 == "eb2bz" ) { - k0 = 9.577e4; - E = 111.375; - if ( (j = find_chemical ("100-41-4")) < 0 ) { - cout << "ERROR 10g\n\n"; - exit(0); - } - a[j] = -1; - n[j] = 1; - if ( (j = find_chemical ("71-43-2")) < 0 ) { - cout << "ERROR 10h\n\n"; - exit(0); - } - a[j] = 1; - n[j] = 0; - if ( (j = find_chemical ("74-85-1")) < 0 ) { - cout << "ERROR 10i\n\n"; - exit(0); - } - a[j] = 1; - n[j] = 0; - } - - // 4/5 : - else if ( in1 == "eb2tol" ) { - k0 = 6.077e8; - E = 207.850; - if ( (j = find_chemical ("100-41-4")) < 0 ) { - cout << "ERROR 10j\n\n"; - exit(0); - } - a[j] = -1; - n[j] = 1; - if ( (j = find_chemical ("1333-74-0")) < 0 ) { - cout << "ERROR 10k\n\n"; - exit(0); - } - a[j] = -1; - n[j] = 1; - if ( (j = find_chemical ("108-88-3")) < 0 ) { - cout << "ERROR 10l\n\n"; - exit(0); - } - a[j] = 1; - n[j] = 0; - if ( (j = find_chemical ("74-82-8")) < 0 ) { - cout << "ERROR 10m\n\n"; - exit(0); - } - a[j] = 1; - n[j] = 0; - } - - // 5/5 : - else if ( in1 == "tol2bz" ) { - k0 = 1; - E = 19.038; - if ( (j = find_chemical ("1333-74-0")) < 0 ) { - cout << "ERROR 10n\n\n"; - exit(0); - } - a[j] = -1; - n[j] = 0.5; - if ( (j = find_chemical ("108-88-3")) < 0 ) { - cout << "ERROR 10o\n\n"; - exit(0); - } - a[j] = -1; - n[j] = 1; - if ( (j = find_chemical ("71-43-2")) < 0 ) { - cout << "ERROR 10p\n\n"; - exit(0); - } - a[j] = 1; - n[j] = 0; - if ( (j = find_chemical ("74-82-8")) < 0 ) { - cout << "ERROR 10q\n\n"; - exit(0); - } - a[j] = 1; - n[j] = 0; - } - else { - cout << "ERROR 12\n\n"; - exit(0); - } - - for ( i = 0 ; i < m ; i++ ) { - safe_n[i]=n[i]; - safe_a[i]=a[i]; - } -} - -reaction::~reaction() { - delete [] a; - delete [] n; - delete [] safe_n; - delete [] safe_a; -} - -double reaction::dHr(double T) -{ - int i , j; - for (i=0;i<m;i++) - if(safe_a[i]!=a[i]) - { - if(a[i]>safe_a[i]) a[i]=safe_a[i]; - else safe_a[i]=a[i]; - } - double tmp=0.0; - for (i=0;i<m;i++) tmp += a[i]*list[i]->Ho; - if(fabs(T-298)>EPS) - for (i=0;i<m;i++) - for (j=1;j<=4;j++) tmp += a[i]*list[i]->Cp_param[j-1]*(pow(T,j)-pow(298.0,j))/j/1000.0; - return tmp; -} - -double reaction::rate(double T, double* C) -{ - double tmp = k0*exp(-1000*E/8.3144/T); - for ( int i=0;i<m;i++) - { - if(safe_n[i]!=n[i]) n[i]=safe_n[i]; - if(C[i]>EPS && fabs(n[i])>EPS) tmp *= pow(C[i], n[i]); - } - return tmp; -} +#include "reaction.hpp" +using namespace std; + + +int reaction::find_chemical ( const string & chem_name ) const { + for ( int i = 0 ; i < m ; i++ ) + if ( list[i]->CAS == chem_name ) + return i; + return -1; +} + +// donnees hardcodees +reaction::reaction ( const string & in1 , int dim , chemical ** in2 ) { + + m = dim; // nbre de chemicals + list = in2; // liste des chemicals + + n = new double[m]; + safe_n = new double[m]; + safe_a = new double[m]; + a = new double[m]; + + int i , j; + for ( i = 0 ; i < m ; i++ ) { + a[i]=0.0; + n[i]=0.0; + } + + // 1/5 : + if ( in1 == "eb2sty" ) { + k0 = 3.525e5; + E = 90.85; + if ( (j = find_chemical ("100-41-4")) < 0 ) { + cout << "ERROR 10a\n\n"; + exit(0); + } + a[j] = -1; + n[j] = 1; + if ( (j = find_chemical ("1333-74-0")) < 0 ) { + cout << "ERROR 10b\n\n"; + exit(0); + } + a[j] = 1; + n[j] = 0; + if ( (j = find_chemical ("100-42-5")) < 0 ) { + cout << "ERROR 10c\n\n"; + exit(0); + } + a[j] = 1; + n[j] = 0; + } + + // 2/5 : + else if ( in1 == "sty2eb" ) { + k0 = 2.754e-4; + E = -18.653; + if ( (j = find_chemical ("100-41-4")) < 0 ) { + cout << "ERROR 10d\n\n"; + exit(0); + } + a[j] = 1; + n[j] = 0; + if ( (j = find_chemical ("1333-74-0")) < 0 ) { + cout << "ERROR 10e\n\n"; + exit(0); + } + a[j] = -1; + n[j] = 1; + if ( (j = find_chemical ("100-42-5")) < 0 ) { + cout << "ERROR 10f\n\n"; + exit(0); + } + a[j] = -1; + n[j] = 1; + } + + // 3/5 : + else if ( in1 == "eb2bz" ) { + k0 = 9.577e4; + E = 111.375; + if ( (j = find_chemical ("100-41-4")) < 0 ) { + cout << "ERROR 10g\n\n"; + exit(0); + } + a[j] = -1; + n[j] = 1; + if ( (j = find_chemical ("71-43-2")) < 0 ) { + cout << "ERROR 10h\n\n"; + exit(0); + } + a[j] = 1; + n[j] = 0; + if ( (j = find_chemical ("74-85-1")) < 0 ) { + cout << "ERROR 10i\n\n"; + exit(0); + } + a[j] = 1; + n[j] = 0; + } + + // 4/5 : + else if ( in1 == "eb2tol" ) { + k0 = 6.077e8; + E = 207.850; + if ( (j = find_chemical ("100-41-4")) < 0 ) { + cout << "ERROR 10j\n\n"; + exit(0); + } + a[j] = -1; + n[j] = 1; + if ( (j = find_chemical ("1333-74-0")) < 0 ) { + cout << "ERROR 10k\n\n"; + exit(0); + } + a[j] = -1; + n[j] = 1; + if ( (j = find_chemical ("108-88-3")) < 0 ) { + cout << "ERROR 10l\n\n"; + exit(0); + } + a[j] = 1; + n[j] = 0; + if ( (j = find_chemical ("74-82-8")) < 0 ) { + cout << "ERROR 10m\n\n"; + exit(0); + } + a[j] = 1; + n[j] = 0; + } + + // 5/5 : + else if ( in1 == "tol2bz" ) { + k0 = 1; + E = 19.038; + if ( (j = find_chemical ("1333-74-0")) < 0 ) { + cout << "ERROR 10n\n\n"; + exit(0); + } + a[j] = -1; + n[j] = 0.5; + if ( (j = find_chemical ("108-88-3")) < 0 ) { + cout << "ERROR 10o\n\n"; + exit(0); + } + a[j] = -1; + n[j] = 1; + if ( (j = find_chemical ("71-43-2")) < 0 ) { + cout << "ERROR 10p\n\n"; + exit(0); + } + a[j] = 1; + n[j] = 0; + if ( (j = find_chemical ("74-82-8")) < 0 ) { + cout << "ERROR 10q\n\n"; + exit(0); + } + a[j] = 1; + n[j] = 0; + } + else { + cout << "ERROR 12\n\n"; + exit(0); + } + + for ( i = 0 ; i < m ; i++ ) { + safe_n[i]=n[i]; + safe_a[i]=a[i]; + } +} + +reaction::~reaction() { + delete [] a; + delete [] n; + delete [] safe_n; + delete [] safe_a; +} + +double reaction::dHr(double T) +{ + int i , j; + for (i=0;i<m;i++) + if(safe_a[i]!=a[i]) + { + if(a[i]>safe_a[i]) a[i]=safe_a[i]; + else safe_a[i]=a[i]; + } + double tmp=0.0; + for (i=0;i<m;i++) tmp += a[i]*list[i]->Ho; + if(fabs(T-298)>EPS) + for (i=0;i<m;i++) + for (j=1;j<=4;j++) tmp += a[i]*list[i]->Cp_param[j-1]*(pow(T,j)-pow(298.0,j))/j/1000.0; + return tmp; +} + +double reaction::rate(double T, double* C) +{ + double tmp = k0*exp(-1000*E/8.3144/T); + for ( int i=0;i<m;i++) + { + if(safe_n[i]!=n[i]) n[i]=safe_n[i]; + if(C[i]>EPS && fabs(n[i])>EPS) tmp *= pow(C[i], n[i]); + } + return tmp; +} diff --git a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/reaction.hpp b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/reaction.hpp index 1456e0d2bf24b59b66a76788fd8fdfa7ed5d6672..f05b27e4589a1e0443a3911532d8f8b4e7f6caeb 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/reaction.hpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/reaction.hpp @@ -1,32 +1,32 @@ -#ifndef REACTION_H -#define REACTION_H - -#include "chemical.hpp" -using namespace std; - -class reaction { -private: - - int m; - double *n, k0, E, Hr, *safe_n, *safe_a; - // double tmp; -// char file[41], line[31]; - chemical ** list; -// ifstream in; - // ofstream logf; - // terminator *end; - - int find_chemical ( const string & chem_name ) const; - -public: - // reaction(){}; - reaction ( const string & , int , chemical ** ); - ~reaction(); - double *a; //contains the molar coefficients - double dHr(double); //returns heat of rection at T, in kJ/mol - double rate(double, double*); //returns rate of reaction aT and C[], in mol/s.m3 - -// void show_name(){cout<<name;} -}; - -#endif +#ifndef REACTION_H +#define REACTION_H + +#include "chemical.hpp" +using namespace std; + +class reaction { +private: + + int m; + double *n, k0, E, Hr, *safe_n, *safe_a; + // double tmp; +// char file[41], line[31]; + chemical ** list; +// ifstream in; + // ofstream logf; + // terminator *end; + + int find_chemical ( const string & chem_name ) const; + +public: + // reaction(){}; + reaction ( const string & , int , chemical ** ); + ~reaction(); + double *a; //contains the molar coefficients + double dHr(double); //returns heat of rection at T, in kJ/mol + double rate(double, double*); //returns rate of reaction aT and C[], in mol/s.m3 + +// void show_name(){cout<<name;} +}; + +#endif diff --git a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/reactor.cpp b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/reactor.cpp index 7f6e3a9455b13cecce0397ef8540e84a8a3d46f7..0f0ddae03673fe3ccd6ad46ef92158393d835e32 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/reactor.cpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/reactor.cpp @@ -1,100 +1,100 @@ -#include "reactor.hpp" -using namespace std; - -template<class TYPE> -reactor<TYPE>::reactor(stream* s1, stream* s2) -{ - in = s1; - out = s2; - - model = NULL; -} - -template<class TYPE> -reactor<TYPE>::~reactor() { - for ( i = 0 ; i < n ; i++ ) - delete rx[i]; - delete [] rx; - for ( i = 0 ; i < m ; i++ ) - delete table[i]; - delete [] table; - - if (model) - delete model; -} - -template<class TYPE> -void reactor<TYPE>::set ( double l , double d , int nb , const string * list_rx ) { - m = in->nb; - n = nb; - L = l; - D = d; - V = pi*pow(D/2.0, 2)*L; - - double * yields = new double [n]; - - rx = new reaction * [n]; - for ( j = 0 ; j < n ; j++ ) - rx[j] = new reaction ( list_rx[j] , m , in->chem ); - - table = new double * [m]; - for ( i = 0 ; i < m ; i++ ) - table[i] = new double[n]; - for ( j = 0 ; j < n ; j++ ) - for ( i = 0 ; i < m ; i++ ) - table[i][j] = rx[j]->a[i]; - for ( j = 0 ; j < n ; j++ ) { - yields[j]=0.0; - for ( i = 0 ; i < m ; i++ ) - if ( table[i][j] < 0 ) { - yields[j]=in->chem[i]->n(); - i=m; - } - } - - delete [] yields; - -} - -template<class TYPE> -bool reactor<TYPE>::solve() { - - if (model) - delete model; - model = new TYPE(in, out, table, n, rx, U, Ta); - model->set(name); - model->set(L,D); - - success = model->run(); - - // if(fabs(in->m-out->m)>sqrt(EPS)) - // { - // log.open(MESSAGES, ios::app); - // log<<" --> Warning <-- Block "<<name<<" is not in mass balance ("<<fabs(in->m-out->m)/in->m<<").\n"; - // log.close(); - // } - - - // out->write(); // WRITE TOTO - - return success; -} - -template<class TYPE> -void reactor<TYPE>::write ( void ) { - - cout << setprecision(6); - - cout << "WRITE FILE " << RUNTIME << name << ".unit" << " :\n\tBEGIN\n"; - cout << "\t>> " << name; - cout << endl << "\t>> stream in : " << in->name; - cout << endl << "\t>> stream out : " << out->name; - cout << endl << "\t>> P = " << in->P - << " atm, T(in) = " << in->T << ", T(out) = " << out->T << " K"; - cout << endl << "\t>> L = " << L << ", D = " << D << " m"; - if (success) - cout << " (converge normally)"; - cout << "\n\tEND\n\n"; - model->cost(); - model->water(); -} +#include "reactor.hpp" +using namespace std; + +template<class TYPE> +reactor<TYPE>::reactor(stream* s1, stream* s2) +{ + in = s1; + out = s2; + + model = NULL; +} + +template<class TYPE> +reactor<TYPE>::~reactor() { + for ( i = 0 ; i < n ; i++ ) + delete rx[i]; + delete [] rx; + for ( i = 0 ; i < m ; i++ ) + delete table[i]; + delete [] table; + + if (model) + delete model; +} + +template<class TYPE> +void reactor<TYPE>::set ( double l , double d , int nb , const string * list_rx ) { + m = in->nb; + n = nb; + L = l; + D = d; + V = pi*pow(D/2.0, 2)*L; + + double * yields = new double [n]; + + rx = new reaction * [n]; + for ( j = 0 ; j < n ; j++ ) + rx[j] = new reaction ( list_rx[j] , m , in->chem ); + + table = new double * [m]; + for ( i = 0 ; i < m ; i++ ) + table[i] = new double[n]; + for ( j = 0 ; j < n ; j++ ) + for ( i = 0 ; i < m ; i++ ) + table[i][j] = rx[j]->a[i]; + for ( j = 0 ; j < n ; j++ ) { + yields[j]=0.0; + for ( i = 0 ; i < m ; i++ ) + if ( table[i][j] < 0 ) { + yields[j]=in->chem[i]->n(); + i=m; + } + } + + delete [] yields; + +} + +template<class TYPE> +bool reactor<TYPE>::solve() { + + if (model) + delete model; + model = new TYPE(in, out, table, n, rx, U, Ta); + model->set(name); + model->set(L,D); + + success = model->run(); + + // if(fabs(in->m-out->m)>sqrt(EPS)) + // { + // log.open(MESSAGES, ios::app); + // log<<" --> Warning <-- Block "<<name<<" is not in mass balance ("<<fabs(in->m-out->m)/in->m<<").\n"; + // log.close(); + // } + + + // out->write(); // WRITE TOTO + + return success; +} + +template<class TYPE> +void reactor<TYPE>::write ( void ) { + + cout << setprecision(6); + + cout << "WRITE FILE " << RUNTIME << name << ".unit" << " :\n\tBEGIN\n"; + cout << "\t>> " << name; + cout << endl << "\t>> stream in : " << in->name; + cout << endl << "\t>> stream out : " << out->name; + cout << endl << "\t>> P = " << in->P + << " atm, T(in) = " << in->T << ", T(out) = " << out->T << " K"; + cout << endl << "\t>> L = " << L << ", D = " << D << " m"; + if (success) + cout << " (converge normally)"; + cout << "\n\tEND\n\n"; + model->cost(); + model->water(); +} diff --git a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/reactor.hpp b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/reactor.hpp index af0d2810711e78ab8b2a3dcee4cde090396f2c58..78f936fe00e0bf1fd35f0487f3e8eb8e295a84a5 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/reactor.hpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/reactor.hpp @@ -1,48 +1,48 @@ -/* -This unit simulates a chemical reactor. Actually, only the pfr can be used. -(ref : Fogler). - -Structure in the .process file: -reactor {name} {pfr or cstr} {index of input stream} {index of output stream} {length in m} {diameter in m} {nb_react, list of reactions occuring} {U in kW/m2.K}{Ta in K} - -How to use: - 1- Call the constructor : react = new reactor<pfr or cstr>(in, out); - 2- Set dimensions and reactions : react->set(length, diameter, nb_react, list_react); //list_react is the list of reactions names - 3- Set cooling parameters : react->set(U, Ta); - 4- Set the name : react->set(name); - 5- Run the model: react->solve(); -*/ -#ifndef REACTOR_H -#define REACTOR_H - -#include "pfr.hpp" -using namespace std; - -template<class TYPE> -class reactor { -private: - // ofstream log; - bool success; - string name; - int i ,j, m, n; - double V, L, D, U, Ta; - stream *in, *out; - TYPE *model; - reaction ** rx; - double ** table; - -public: - // reactor(){}; - reactor(stream*, stream*); - void set( const string & n) { name = n; } - void set(double, double, int, const string * ); - void set(double u, double ta) {U=u;Ta=ta;} - bool solve(); - void write(); - - double get_cost ( void ) const { return model->get_cost() ; } - double get_water ( void ) const { return model->get_water(); } - - ~reactor(); -}; -#endif +/* +This unit simulates a chemical reactor. Actually, only the pfr can be used. +(ref : Fogler). + +Structure in the .process file: +reactor {name} {pfr or cstr} {index of input stream} {index of output stream} {length in m} {diameter in m} {nb_react, list of reactions occuring} {U in kW/m2.K}{Ta in K} + +How to use: + 1- Call the constructor : react = new reactor<pfr or cstr>(in, out); + 2- Set dimensions and reactions : react->set(length, diameter, nb_react, list_react); //list_react is the list of reactions names + 3- Set cooling parameters : react->set(U, Ta); + 4- Set the name : react->set(name); + 5- Run the model: react->solve(); +*/ +#ifndef REACTOR_H +#define REACTOR_H + +#include "pfr.hpp" +using namespace std; + +template<class TYPE> +class reactor { +private: + // ofstream log; + bool success; + string name; + int i ,j, m, n; + double V, L, D, U, Ta; + stream *in, *out; + TYPE *model; + reaction ** rx; + double ** table; + +public: + // reactor(){}; + reactor(stream*, stream*); + void set( const string & n) { name = n; } + void set(double, double, int, const string * ); + void set(double u, double ta) {U=u;Ta=ta;} + bool solve(); + void write(); + + double get_cost ( void ) const { return model->get_cost() ; } + double get_water ( void ) const { return model->get_water(); } + + ~reactor(); +}; +#endif diff --git a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/secant.cpp b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/secant.cpp index e8582e03da28e148ba43074dbff9b4e4a5ad4069..79e5d049cd839cf672a3eb71e48c6d976119c25f 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/secant.cpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/secant.cpp @@ -1,47 +1,47 @@ -#include "secant.hpp" -using namespace std; - -template <class E> -secant<E>::secant() -{ - x_last=0; - x_now=0; - x_next=0; - f_last=0; - f_now=0; - OK=false; -} - -template <class E> -void secant<E>::set(E* tmp, double x1, double x2) -{ - unit=tmp; - x_last=x1; - x_now=x2; - OK=false; -} - -template <class E> -bool secant<E>::run() -{ - // if(DEBUG) cout<<endl<<"begin solve secant"; - f_last = unit->f(x_last); - for (i=1; i<MAX_ITER_SECANT; i++) - { - f_now = unit->f(x_now); - // if(DEBUG) cout<<endl<<" x = "<<x_now<<" f(x) = "<<f_now; - x_next = x_now - (f_now*(x_now-x_last)/(f_now-f_last)); - if (fabs((x_next-x_now)/x_now)<=TOL_SECANT) - { - i=MAX_ITER_SECANT; - OK=true; - } - else - { - x_last=x_now; - f_last=f_now; - x_now=x_next; - } - } - return OK; -} +#include "secant.hpp" +using namespace std; + +template <class E> +secant<E>::secant() +{ + x_last=0; + x_now=0; + x_next=0; + f_last=0; + f_now=0; + OK=false; +} + +template <class E> +void secant<E>::set(E* tmp, double x1, double x2) +{ + unit=tmp; + x_last=x1; + x_now=x2; + OK=false; +} + +template <class E> +bool secant<E>::run() +{ + // if(DEBUG) cout<<endl<<"begin solve secant"; + f_last = unit->f(x_last); + for (i=1; i<MAX_ITER_SECANT; i++) + { + f_now = unit->f(x_now); + // if(DEBUG) cout<<endl<<" x = "<<x_now<<" f(x) = "<<f_now; + x_next = x_now - (f_now*(x_now-x_last)/(f_now-f_last)); + if (fabs((x_next-x_now)/x_now)<=TOL_SECANT) + { + i=MAX_ITER_SECANT; + OK=true; + } + else + { + x_last=x_now; + f_last=f_now; + x_now=x_next; + } + } + return OK; +} diff --git a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/secant.hpp b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/secant.hpp index a04cbc542af177484e56bbaa924df887a2c2cdc4..d1bb096e5c0267e24add5f95f58caa6523caa3ee 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/secant.hpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/secant.hpp @@ -1,31 +1,31 @@ -/* -To use the secant solver to find the root of a scalar function: - (the parametric object E must have public function such as E->f(x), - where x is the point at which evaluate f.) - 1- construct the solver : solver = new secant<E>(); - 2- set the solver : solver->set(unit, x0, x1); //unit is usually the pointer *this, and x0 and x1 are two required initial points - 3- launch the solver : bool = solver->run(); //will return true is success, false if the solver failed -*/ -#ifndef SECANT_H -#define SECANT_H - -#include "defines.hpp" -using namespace std; - - -template <class E> -class secant { -private: - double x_last, x_now, x_next; - double f_last, f_now, error; - int i; - bool OK; - E *unit; - -public: - secant(); - void set(E*, double, double); - bool run(); - ~secant(){} -}; -#endif +/* +To use the secant solver to find the root of a scalar function: + (the parametric object E must have public function such as E->f(x), + where x is the point at which evaluate f.) + 1- construct the solver : solver = new secant<E>(); + 2- set the solver : solver->set(unit, x0, x1); //unit is usually the pointer *this, and x0 and x1 are two required initial points + 3- launch the solver : bool = solver->run(); //will return true is success, false if the solver failed +*/ +#ifndef SECANT_H +#define SECANT_H + +#include "defines.hpp" +using namespace std; + + +template <class E> +class secant { +private: + double x_last, x_now, x_next; + double f_last, f_now, error; + int i; + bool OK; + E *unit; + +public: + secant(); + void set(E*, double, double); + bool run(); + ~secant(){} +}; +#endif diff --git a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/servor.cpp b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/servor.cpp index 75216ae65c7d270cc5ec7d40495dd7eac8e31163..0b2df2008515f202bf61bc495dc205e53d345e4d 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/servor.cpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/servor.cpp @@ -1,538 +1,538 @@ -#include "servor.hpp" -#include "reactor.cpp" -using namespace std; - -/*---------------------------------------------------------------------*/ -servor::servor ( int nb_u , int n2 , stream ** streams ) { - nb = nb_u; - nb_s = n2; - type = new string[nb]; - name = new string[nb]; - s = streams; - - -// for (int i=0; i<nb; i++) -// { -// type[i]=new char[31]; -// name[i]=new char[31]; -// } -// cursor=0; -// s = s_list; -// // end = new terminator("\0"); -// mix1=NULL; -// split1=NULL; -// flash1=NULL; -// pump1=NULL; -// col=NULL; -// react_pfr=NULL; -// react_cstr=NULL; -// heat=NULL; - - burn = new burner ( s[0]->nb , s[0]->chem ); -} - -/*---------------------------------------------------------------------*/ -servor::~servor() { - delete [] type; - delete [] name; - delete burn; -} - -/*---------------------------------------------------------------------*/ -bool servor::solve_process ( const double * x , double * y ) { - - - for ( i = 0 ; i < 8 ; i++ ) - costs[i] = 0.0; - - k = 0; - norm = 1.0 / TOL_WEGSTEIN; - - for ( cursor = 0 ; cursor < nb ; cursor++ ) { - - if (type[cursor] == "mix" ) { - do_mix_process(x); - } - else if ( type[cursor] == "split" ) { - do_split_process(x); - } - else if ( type[cursor] == "flash" ) { - do_flash_process(x); - } - else if ( type[cursor] == "pump" ) { - do_pump_process(x); - } - else if ( type[cursor] == "heatx") { - do_heatx_process(x); - } - else if ( type[cursor] == "burner" ) { - do_burner_process(x,y); - } - else if ( type[cursor] == "column" ) { - do_column_process(x,y); - } - else if ( type[cursor] == "reactor" ) { - do_reactor_process(x); - } - else if ( type[cursor] == "loop" ) { - - recycle = 10; - end_recycle = 0; - do_loop_process(x); - } - else { - cout << "ERROR 18\n\n"; - exit(0); - } - - } - - return true; -} - - -/*---------------------------------------------------------------------*/ -void servor::do_loop_process ( const double * x ) { - - // structure in the input file : - // loop - // name : "looping" - // index of recycle stream : 11 - // index of stream's beginning block : 7 - // index of stream's end block : 1 - - // TOTO -// if (k==0) -// cout << endl << " -> Wegstein iterations "; -// else if ( k <= 2 ) -// cout << endl << " -> loop " << setw(3) << k; -// else -// cout << endl << " -> loop " << setw(3) << k << " > error " << norm; - - // Get the two fisrst points - if ( k==0 ) { - for ( i = 0 ; i < s[0]->nb ; i++ ) - x_last[i] = s[recycle]->chem[i]->m; - end_loop = false; - } - - if ( k==1 ) { - for ( i = 0 ; i < s[0]->nb ; i++ ) { - x_now [i] = s[recycle]->chem[i]->m; - g_last[i] = s[recycle]->chem[i]->m; - } - - end_loop = false; - } - - if ( k == 2 ) { - for ( i = 0 ; i < s[0]->nb ; i++ ) - g_now[i] = s[recycle]->chem[i]->m; - end_loop=false; - } - k++; - - - // run the Wegstein algorithm - if ( k > 2 ) { - for ( i = 0 ; i < s[0]->nb ; i++ ) { - g_now[i] = s[recycle]->chem[i]->m; - - if ( fabs (x_now[i]-x_last[i]) > EPS ) - slope[i] = ( g_now[i] - g_last[i] ) / ( x_now[i] - x_last[i] ); - else - slope[i] = 0; - - theta[i] = 1.0 / (1.0-slope[i]); - if ( theta[i] < MIN_THETA ) - theta[i] = MIN_THETA; - if ( theta[i] > MAX_THETA ) - theta[i] = MAX_THETA; - x_next[i] = (1.0-theta[i])*x_now[i] + theta[i]*g_now[i]; - } - norm = 0.0; - for ( i = 0 ; i < s[0]->nb ; i++ ) - if ( fabs(x_now[i]) > EPS ) - norm += fabs (x_next[i]-x_now[i]) / fabs(x_now[i]); - - if ( norm > TOL_WEGSTEIN && k < MAX_ITER_WEGSTEIN ) { - s[recycle]->m = 0.0; - for ( i = 0 ; i < s[0]->nb ; i++ ) { - s[recycle]->chem[i]->m = x_next[i]; - s[recycle]->m += x_next[i]; - x_last[i] = x_now[i]; - g_last[i] = g_now[i]; - x_now[i] = x_next[i]; - } - end_loop=false; - } - if ( norm <= TOL_WEGSTEIN && k < MAX_ITER_WEGSTEIN ) - end_loop = true; - - } - - - if ( end_loop ) { - if ( k < MAX_ITER_WEGSTEIN && k > 3 ) { - // cout<<" OK"; // TOTO - // s[recycle]->write(); // WRITE TOTO - -// // WRITE TOTO : -// cout << "WRITE FILE " << RUNTIME << name[cursor] << ".unit" << " :\n\tBEGIN\n"; -// cout << "\t>> " << name[cursor]; -// cout << endl << "\t>> from block " << cursor+1 << " to block " << end_recycle+1; -// cout << endl << "\t>> Wegstein converged in " -// << k << " iterations (rel. err. " << norm << ")."; -// cout << "\n\tEND\n\n"; - - k = 0; - norm = 1.0/TOL_WEGSTEIN; - } -// else { -// log.open(MESSAGES, ios::app); -// log<<" ==> Error <== Wegstein algorithm did not converge.\n"; -// log.close(); -// } - } - - - if ( !end_loop && k < MAX_ITER_WEGSTEIN ) - cursor = end_recycle-1; - if ( !end_loop && k==MAX_ITER_WEGSTEIN ) { -// log.open(MESSAGES, ios::app); -// log<<" ==> Error <== Wegstein algorithm did not converge.\n"; -// log.close(); - k=0; - norm = 1.0/TOL_WEGSTEIN; - cursor=nb; - } - -} - -/*---------------------------------------------------------------------*/ -void servor::do_burner_process ( const double * x , double * y ) { - - // cout << endl << " -- " << name[cursor] << "... "; // TOTO - - // read parameters : - int i1 = 8; - int i2 = 13; - double f = x[6]; - - burn->set ( s[i1-1] , s[i2-1] ); - burn->set(f); - burn->set(name[cursor]); - - if ( burn->solve(y) ) { - // cout << "OK"; // TOTO - // burn->write(); // WRITE TOTO - costs[7] = burn->get_cost(); - } - else { - cout << "ERROR 20\n\n"; - exit(0); - } -} - -/*---------------------------------------------------------------------*/ -void servor::do_split_process ( const double * x ) -{ - // cout<<endl<<" -- "<<name[cursor]<<"... "; // TOTO - - //Read parameters - int i1 = 9; - int i2 = 2; - int i_tab[2] = { 10 , 11 }; - double f_tab[2]; - f_tab[0] = x[5]; - f_tab[1] = 1-x[5]; - - stream * list1[2]; - list1[0] = s[i_tab[0]-1]; - list1[1] = s[i_tab[1]-1]; - - split * split1 = new split ( i2 , s[i1-1] , list1 ); - - split1->set(f_tab); - split1->set(name[cursor]); - if ( split1->solve() ) { - // cout<<"OK"; // TOTO - // split1->write(); // WRITE TOTO - } - else { - cout << "ERROR 19\n\n"; - exit(0); - } - delete split1; -} - -/*---------------------------------------------------------------------*/ -void servor::do_column_process ( const double * x , double * y ) { - // cout<<endl<<" -- "<<name[cursor]<<"... "; // TOTO - - //Read parameters - double f1 , f2; - int i , i1 , i2; - int i_tab[2]; - double f = 1.0; - - if (name[cursor]=="sep-sty") { - i = 7; - i1 = 15; - i2 = 9; - i_tab[0] = 1; - i_tab[1] = 7; - f1 = f2 = x[2]; - } - else if (name[cursor]=="sep-bz") { - i = 10; - i1 = 12; - i2 = 14; - i_tab[0] = 5; - i_tab[1] = 1; - f1 = f2 = x[3]; - } - else { - cout << "ERROR 17\n\n"; - exit(0); - } - - column * col = new column ( s[i-1] , s[i1-1] , s[i2-1] ); - col->set ( f , i_tab[0] , f1 , i_tab[1] , f2 ); - col->set(name[cursor]); - if ( col->solve() ) { - //cout<<"OK"; // TOTO - //col->write(); // WRITE TOTO - - if (name[cursor]=="sep-sty") { - y[4] = col->get_N(); - costs[5] = col->get_cost(); - power[5] = col->get_power(); - water[5] = col->get_water(); - } - else { - y[5] = col->get_N(); - costs[6] = col->get_cost(); - power[4] = col->get_power(); - water[4] = col->get_water(); - } - } - else { - cout << "ERROR 15\n\n"; - exit(0); - } - delete col; -} - -/*---------------------------------------------------------------------*/ -void servor::do_flash_process ( const double * x ) { - // cout<<endl<<" -- "<<name[cursor]<<"... "; // TOTO - - //Read parameters - double f1 = 1.0; - double f2 = x[7]; - // int i_tab [3] = { 6 , 7 , 8 }; - // flash * flash1 = new flash ( s[i_tab[0]-1] , s[i_tab[1]-1] , s[i_tab[2]-1] ); - flash * flash1 = new flash ( s[5] , s[6] , s[7] ); - - flash1->set(f1, f2); - flash1->set(name[cursor]); - if ( flash1->solve() ) { - // cout<<"OK"; // TOTO - // flash1->write(); // WRITE TOTO - costs[4] = flash1->get_cost(); - power[2] = flash1->get_power(); - water[1] = flash1->get_water(); - } - else { - cout << "ERROR 14\n\n"; - exit(0); - } - delete flash1; -} - - -/*---------------------------------------------------------------------*/ -void servor::do_mix_process ( const double * x ) { - - // cout << endl << " -- " << name[cursor] << "... "; // TOTO - - // Read parameters (hardcode avec eb2sty.process) : - double f1 = 1.0; - int i1 = 3; - int i_tab[3] = { 1 , 12 , 11 }; - int i2 = 2; - - // We can solve the unit - stream * list2 = s[i2-1] , ** list1 = new stream * [i1]; - for ( int i = 0 ; i < i1 ; i++ ) - list1[i] = s[i_tab[i]-1]; - mix * mix1 = new mix ( i1 , list1 , list2 ); - mix1->set(f1); - mix1->set(name[cursor]); - if (mix1->solve()) { - // cout<<"OK"; // TOTO - // mix1->write(); // WRITE TOTO - } - else { - cout << "ERROR 6\n\n"; - exit(0); - } - delete mix1; - delete [] list1; -} - - -/*---------------------------------------------------------------------*/ -void servor::do_pump_process ( const double * x ) { - - // cout<<endl<<" -- "<<name[cursor]<<"... "; // TOTO - - //Read parameters (hardcode avec eb2sty.process) : - int i1 = 2; - int i2 = 3; - double f1 = x[4]; - double f2 = 0.75; - - pump * pump1 = new pump ( s[i1-1] , s[i2-1] ); - pump1->set(f1,f2); - pump1->set(name[cursor]); - - - - // solve : - if ( pump1->solve() ) { - // cout<<"OK"; // TOTO - // pump1->write(); // WRITE TOTO - - power[0] = pump1->get_power(); - costs[0] = pump1->get_cost(); - } - else { - cout << "ERROR 7\n\n"; - exit(0); - } - - delete pump1; -} - -/*---------------------------------------------------------------------*/ -void servor::do_heatx_process ( const double * x ) { - - // cout << endl << " -- " << name[cursor] << "... "; // TOTO - - //Read parameters (idem) : - - bool b = false; - - // heater : - int i1; - int i2; - double f1; - - // heater : - if (name[cursor]=="heater") { - i1 = 3; - i2 = 4; - f1 = x[0]; - } - - // cooler : - else if (name[cursor]=="cooler") { - i1 = 5; - i2 = 6; - f1 = x[7]; - } - else { - cout << "ERROR 16\n\n"; - exit(0); - } - - double f2 = 0.85; - - // solve : - heatx * heat = new heatx ( b , s[i1-1] , s[i2-1] ); - heat->set(f1,f2); - heat->set(name[cursor]); - if (heat->solve()) { - // cout<<"OK"; // TOTO - // heat->write(); // WRITE TOTO - if (name[cursor]=="heater") { - costs[1] = heat->get_cost(); - power[3] = heat->get_power(); - water[2] = heat->get_water(); - } - else { - costs[3] = heat->get_cost(); - power[1] = heat->get_power(); - water[0] = heat->get_water(); - } - } - else { - cout << "ERROR 8\n\n"; - exit(0); - } - delete heat; -} - -/*---------------------------------------------------------------------*/ -void servor::do_reactor_process ( const double * x ) { - - // cout<<endl<<" -- "<<name[cursor]<<"... "; // TOTO - - // Read parameters (idem) : - int i1 = 4; - int i2 = 5; - - reactor<pfr> * react_pfr = new reactor<pfr> ( s[i1-1] , s[i2-1] ); - - react_pfr->set(name[cursor]); - - double f1 = x[1]; - double f2 = 0.5; - - string list[5] = { "eb2sty" , "sty2eb" , "eb2bz" , "eb2tol" , "tol2bz" }; - - i1 = 5; - - react_pfr->set(f1,f2,i1,list); - - f1 = 0.0; - f2 = 300.0; - - react_pfr->set(f1,f2); - - if ( react_pfr->solve() ) { - // cout<<"OK"; // TOTO - // react_pfr->write(); // WRITE TOTO - costs[2] = react_pfr->get_cost(); - water[3] = react_pfr->get_water(); - } - else { - cout << "ERROR 9\n\n"; - exit(0); - } - delete react_pfr; -} - - -double servor::get_costs_sum ( void ) const { - double sum = 0.0; - for ( int i = 0 ; i < 8 ; i++ ) - sum += ( (ARRONDI) ? arrondi(costs[i],6) : costs[i] ); - return sum; -} - -double servor::get_power_sum ( void ) const { - double sum = 0.0; - for ( int i = 0 ; i < 6 ; i++ ) - sum += ( (ARRONDI) ? arrondi(power[i],6) : power[i] ); - return sum; -} - -double servor::get_water_sum ( void ) const { - double sum = 0.0; - for ( int i = 0 ; i < 6 ; i++ ) - sum += ( (ARRONDI) ? arrondi(water[i],6) : water[i] ); - return sum; -} +#include "servor.hpp" +#include "reactor.cpp" +using namespace std; + +/*---------------------------------------------------------------------*/ +servor::servor ( int nb_u , int n2 , stream ** streams ) { + nb = nb_u; + nb_s = n2; + type = new string[nb]; + name = new string[nb]; + s = streams; + + +// for (int i=0; i<nb; i++) +// { +// type[i]=new char[31]; +// name[i]=new char[31]; +// } +// cursor=0; +// s = s_list; +// // end = new terminator("\0"); +// mix1=NULL; +// split1=NULL; +// flash1=NULL; +// pump1=NULL; +// col=NULL; +// react_pfr=NULL; +// react_cstr=NULL; +// heat=NULL; + + burn = new burner ( s[0]->nb , s[0]->chem ); +} + +/*---------------------------------------------------------------------*/ +servor::~servor() { + delete [] type; + delete [] name; + delete burn; +} + +/*---------------------------------------------------------------------*/ +bool servor::solve_process ( const double * x , double * y ) { + + + for ( i = 0 ; i < 8 ; i++ ) + costs[i] = 0.0; + + k = 0; + norm = 1.0 / TOL_WEGSTEIN; + + for ( cursor = 0 ; cursor < nb ; cursor++ ) { + + if (type[cursor] == "mix" ) { + do_mix_process(x); + } + else if ( type[cursor] == "split" ) { + do_split_process(x); + } + else if ( type[cursor] == "flash" ) { + do_flash_process(x); + } + else if ( type[cursor] == "pump" ) { + do_pump_process(x); + } + else if ( type[cursor] == "heatx") { + do_heatx_process(x); + } + else if ( type[cursor] == "burner" ) { + do_burner_process(x,y); + } + else if ( type[cursor] == "column" ) { + do_column_process(x,y); + } + else if ( type[cursor] == "reactor" ) { + do_reactor_process(x); + } + else if ( type[cursor] == "loop" ) { + + recycle = 10; + end_recycle = 0; + do_loop_process(x); + } + else { + cout << "ERROR 18\n\n"; + exit(0); + } + + } + + return true; +} + + +/*---------------------------------------------------------------------*/ +void servor::do_loop_process ( const double * x ) { + + // structure in the input file : + // loop + // name : "looping" + // index of recycle stream : 11 + // index of stream's beginning block : 7 + // index of stream's end block : 1 + + // TOTO +// if (k==0) +// cout << endl << " -> Wegstein iterations "; +// else if ( k <= 2 ) +// cout << endl << " -> loop " << setw(3) << k; +// else +// cout << endl << " -> loop " << setw(3) << k << " > error " << norm; + + // Get the two fisrst points + if ( k==0 ) { + for ( i = 0 ; i < s[0]->nb ; i++ ) + x_last[i] = s[recycle]->chem[i]->m; + end_loop = false; + } + + if ( k==1 ) { + for ( i = 0 ; i < s[0]->nb ; i++ ) { + x_now [i] = s[recycle]->chem[i]->m; + g_last[i] = s[recycle]->chem[i]->m; + } + + end_loop = false; + } + + if ( k == 2 ) { + for ( i = 0 ; i < s[0]->nb ; i++ ) + g_now[i] = s[recycle]->chem[i]->m; + end_loop=false; + } + k++; + + + // run the Wegstein algorithm + if ( k > 2 ) { + for ( i = 0 ; i < s[0]->nb ; i++ ) { + g_now[i] = s[recycle]->chem[i]->m; + + if ( fabs (x_now[i]-x_last[i]) > EPS ) + slope[i] = ( g_now[i] - g_last[i] ) / ( x_now[i] - x_last[i] ); + else + slope[i] = 0; + + theta[i] = 1.0 / (1.0-slope[i]); + if ( theta[i] < MIN_THETA ) + theta[i] = MIN_THETA; + if ( theta[i] > MAX_THETA ) + theta[i] = MAX_THETA; + x_next[i] = (1.0-theta[i])*x_now[i] + theta[i]*g_now[i]; + } + norm = 0.0; + for ( i = 0 ; i < s[0]->nb ; i++ ) + if ( fabs(x_now[i]) > EPS ) + norm += fabs (x_next[i]-x_now[i]) / fabs(x_now[i]); + + if ( norm > TOL_WEGSTEIN && k < MAX_ITER_WEGSTEIN ) { + s[recycle]->m = 0.0; + for ( i = 0 ; i < s[0]->nb ; i++ ) { + s[recycle]->chem[i]->m = x_next[i]; + s[recycle]->m += x_next[i]; + x_last[i] = x_now[i]; + g_last[i] = g_now[i]; + x_now[i] = x_next[i]; + } + end_loop=false; + } + if ( norm <= TOL_WEGSTEIN && k < MAX_ITER_WEGSTEIN ) + end_loop = true; + + } + + + if ( end_loop ) { + if ( k < MAX_ITER_WEGSTEIN && k > 3 ) { + // cout<<" OK"; // TOTO + // s[recycle]->write(); // WRITE TOTO + +// // WRITE TOTO : +// cout << "WRITE FILE " << RUNTIME << name[cursor] << ".unit" << " :\n\tBEGIN\n"; +// cout << "\t>> " << name[cursor]; +// cout << endl << "\t>> from block " << cursor+1 << " to block " << end_recycle+1; +// cout << endl << "\t>> Wegstein converged in " +// << k << " iterations (rel. err. " << norm << ")."; +// cout << "\n\tEND\n\n"; + + k = 0; + norm = 1.0/TOL_WEGSTEIN; + } +// else { +// log.open(MESSAGES, ios::app); +// log<<" ==> Error <== Wegstein algorithm did not converge.\n"; +// log.close(); +// } + } + + + if ( !end_loop && k < MAX_ITER_WEGSTEIN ) + cursor = end_recycle-1; + if ( !end_loop && k==MAX_ITER_WEGSTEIN ) { +// log.open(MESSAGES, ios::app); +// log<<" ==> Error <== Wegstein algorithm did not converge.\n"; +// log.close(); + k=0; + norm = 1.0/TOL_WEGSTEIN; + cursor=nb; + } + +} + +/*---------------------------------------------------------------------*/ +void servor::do_burner_process ( const double * x , double * y ) { + + // cout << endl << " -- " << name[cursor] << "... "; // TOTO + + // read parameters : + int i1 = 8; + int i2 = 13; + double f = x[6]; + + burn->set ( s[i1-1] , s[i2-1] ); + burn->set(f); + burn->set(name[cursor]); + + if ( burn->solve(y) ) { + // cout << "OK"; // TOTO + // burn->write(); // WRITE TOTO + costs[7] = burn->get_cost(); + } + else { + cout << "ERROR 20\n\n"; + exit(0); + } +} + +/*---------------------------------------------------------------------*/ +void servor::do_split_process ( const double * x ) +{ + // cout<<endl<<" -- "<<name[cursor]<<"... "; // TOTO + + //Read parameters + int i1 = 9; + int i2 = 2; + int i_tab[2] = { 10 , 11 }; + double f_tab[2]; + f_tab[0] = x[5]; + f_tab[1] = 1-x[5]; + + stream * list1[2]; + list1[0] = s[i_tab[0]-1]; + list1[1] = s[i_tab[1]-1]; + + split * split1 = new split ( i2 , s[i1-1] , list1 ); + + split1->set(f_tab); + split1->set(name[cursor]); + if ( split1->solve() ) { + // cout<<"OK"; // TOTO + // split1->write(); // WRITE TOTO + } + else { + cout << "ERROR 19\n\n"; + exit(0); + } + delete split1; +} + +/*---------------------------------------------------------------------*/ +void servor::do_column_process ( const double * x , double * y ) { + // cout<<endl<<" -- "<<name[cursor]<<"... "; // TOTO + + //Read parameters + double f1 , f2; + int i , i1 , i2; + int i_tab[2]; + double f = 1.0; + + if (name[cursor]=="sep-sty") { + i = 7; + i1 = 15; + i2 = 9; + i_tab[0] = 1; + i_tab[1] = 7; + f1 = f2 = x[2]; + } + else if (name[cursor]=="sep-bz") { + i = 10; + i1 = 12; + i2 = 14; + i_tab[0] = 5; + i_tab[1] = 1; + f1 = f2 = x[3]; + } + else { + cout << "ERROR 17\n\n"; + exit(0); + } + + column * col = new column ( s[i-1] , s[i1-1] , s[i2-1] ); + col->set ( f , i_tab[0] , f1 , i_tab[1] , f2 ); + col->set(name[cursor]); + if ( col->solve() ) { + //cout<<"OK"; // TOTO + //col->write(); // WRITE TOTO + + if (name[cursor]=="sep-sty") { + y[4] = col->get_N(); + costs[5] = col->get_cost(); + power[5] = col->get_power(); + water[5] = col->get_water(); + } + else { + y[5] = col->get_N(); + costs[6] = col->get_cost(); + power[4] = col->get_power(); + water[4] = col->get_water(); + } + } + else { + cout << "ERROR 15\n\n"; + exit(0); + } + delete col; +} + +/*---------------------------------------------------------------------*/ +void servor::do_flash_process ( const double * x ) { + // cout<<endl<<" -- "<<name[cursor]<<"... "; // TOTO + + //Read parameters + double f1 = 1.0; + double f2 = x[7]; + // int i_tab [3] = { 6 , 7 , 8 }; + // flash * flash1 = new flash ( s[i_tab[0]-1] , s[i_tab[1]-1] , s[i_tab[2]-1] ); + flash * flash1 = new flash ( s[5] , s[6] , s[7] ); + + flash1->set(f1, f2); + flash1->set(name[cursor]); + if ( flash1->solve() ) { + // cout<<"OK"; // TOTO + // flash1->write(); // WRITE TOTO + costs[4] = flash1->get_cost(); + power[2] = flash1->get_power(); + water[1] = flash1->get_water(); + } + else { + cout << "ERROR 14\n\n"; + exit(0); + } + delete flash1; +} + + +/*---------------------------------------------------------------------*/ +void servor::do_mix_process ( const double * x ) { + + // cout << endl << " -- " << name[cursor] << "... "; // TOTO + + // Read parameters (hardcode avec eb2sty.process) : + double f1 = 1.0; + int i1 = 3; + int i_tab[3] = { 1 , 12 , 11 }; + int i2 = 2; + + // We can solve the unit + stream * list2 = s[i2-1] , ** list1 = new stream * [i1]; + for ( int i = 0 ; i < i1 ; i++ ) + list1[i] = s[i_tab[i]-1]; + mix * mix1 = new mix ( i1 , list1 , list2 ); + mix1->set(f1); + mix1->set(name[cursor]); + if (mix1->solve()) { + // cout<<"OK"; // TOTO + // mix1->write(); // WRITE TOTO + } + else { + cout << "ERROR 6\n\n"; + exit(0); + } + delete mix1; + delete [] list1; +} + + +/*---------------------------------------------------------------------*/ +void servor::do_pump_process ( const double * x ) { + + // cout<<endl<<" -- "<<name[cursor]<<"... "; // TOTO + + //Read parameters (hardcode avec eb2sty.process) : + int i1 = 2; + int i2 = 3; + double f1 = x[4]; + double f2 = 0.75; + + pump * pump1 = new pump ( s[i1-1] , s[i2-1] ); + pump1->set(f1,f2); + pump1->set(name[cursor]); + + + + // solve : + if ( pump1->solve() ) { + // cout<<"OK"; // TOTO + // pump1->write(); // WRITE TOTO + + power[0] = pump1->get_power(); + costs[0] = pump1->get_cost(); + } + else { + cout << "ERROR 7\n\n"; + exit(0); + } + + delete pump1; +} + +/*---------------------------------------------------------------------*/ +void servor::do_heatx_process ( const double * x ) { + + // cout << endl << " -- " << name[cursor] << "... "; // TOTO + + //Read parameters (idem) : + + bool b = false; + + // heater : + int i1; + int i2; + double f1; + + // heater : + if (name[cursor]=="heater") { + i1 = 3; + i2 = 4; + f1 = x[0]; + } + + // cooler : + else if (name[cursor]=="cooler") { + i1 = 5; + i2 = 6; + f1 = x[7]; + } + else { + cout << "ERROR 16\n\n"; + exit(0); + } + + double f2 = 0.85; + + // solve : + heatx * heat = new heatx ( b , s[i1-1] , s[i2-1] ); + heat->set(f1,f2); + heat->set(name[cursor]); + if (heat->solve()) { + // cout<<"OK"; // TOTO + // heat->write(); // WRITE TOTO + if (name[cursor]=="heater") { + costs[1] = heat->get_cost(); + power[3] = heat->get_power(); + water[2] = heat->get_water(); + } + else { + costs[3] = heat->get_cost(); + power[1] = heat->get_power(); + water[0] = heat->get_water(); + } + } + else { + cout << "ERROR 8\n\n"; + exit(0); + } + delete heat; +} + +/*---------------------------------------------------------------------*/ +void servor::do_reactor_process ( const double * x ) { + + // cout<<endl<<" -- "<<name[cursor]<<"... "; // TOTO + + // Read parameters (idem) : + int i1 = 4; + int i2 = 5; + + reactor<pfr> * react_pfr = new reactor<pfr> ( s[i1-1] , s[i2-1] ); + + react_pfr->set(name[cursor]); + + double f1 = x[1]; + double f2 = 0.5; + + string list[5] = { "eb2sty" , "sty2eb" , "eb2bz" , "eb2tol" , "tol2bz" }; + + i1 = 5; + + react_pfr->set(f1,f2,i1,list); + + f1 = 0.0; + f2 = 300.0; + + react_pfr->set(f1,f2); + + if ( react_pfr->solve() ) { + // cout<<"OK"; // TOTO + // react_pfr->write(); // WRITE TOTO + costs[2] = react_pfr->get_cost(); + water[3] = react_pfr->get_water(); + } + else { + cout << "ERROR 9\n\n"; + exit(0); + } + delete react_pfr; +} + + +double servor::get_costs_sum ( void ) const { + double sum = 0.0; + for ( int i = 0 ; i < 8 ; i++ ) + sum += ( (ARRONDI) ? arrondi(costs[i],6) : costs[i] ); + return sum; +} + +double servor::get_power_sum ( void ) const { + double sum = 0.0; + for ( int i = 0 ; i < 6 ; i++ ) + sum += ( (ARRONDI) ? arrondi(power[i],6) : power[i] ); + return sum; +} + +double servor::get_water_sum ( void ) const { + double sum = 0.0; + for ( int i = 0 ; i < 6 ; i++ ) + sum += ( (ARRONDI) ? arrondi(water[i],6) : water[i] ); + return sum; +} diff --git a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/servor.hpp b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/servor.hpp index 73b1cd2ef8efb77cae3833eff494a03b00db71d8..e048542375b8df2942bfd10dd2117cfe6622b53c 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/servor.hpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/servor.hpp @@ -1,101 +1,101 @@ -#ifndef SERVOR_H -#define SERVOR_H - -//Possible units -#include "mix.hpp" -#include "split.hpp" -#include "pump.hpp" -#include "column.hpp" -#include "reactor.hpp" -#include "heatx.hpp" -#include "burner.hpp" - -using namespace std; - -class servor { - -public: - - double norm; - int k; - int nb; - int nb_s; - string * type; - string * name; - int cursor; - stream ** s; - - int recycle; - int end_recycle; - int i; - bool end_loop; - - double x_last[MAX_DIM]; - double x_now [MAX_DIM]; - double x_next[MAX_DIM]; - double g_last[MAX_DIM]; - double g_now [MAX_DIM]; - double slope [MAX_DIM]; - double theta [MAX_DIM]; - - double costs[8]; - double power[6]; - double water[6]; - - - // clock_t beg_time, end_time; - // bool OK, b, solve_OK; - // char filename[31], kind[10], **list, process_name[31]; - // double f, f1, f2, f_tab[10], t; - // int i, i1, i2, i_tab[10], time; - // stream *list2; - -// double theta[MAX_DIM], slope[MAX_DIM], norm; -// bool end_loop; -// int k, recycle, end_recycle; -// char loop_name[31]; - -// mix *mix1; void do_mix(); -// split *split1; -// flash *flash1; void do_flash(); -// pump *pump1; void do_pump(); -// column *col; void do_column(); -// reactor<pfr> *react_pfr; void do_reactor(); -// reactor<cstr> *react_cstr; -// heatx *heat; void do_heatx(); - burner * burn; - -// stream *s; //list of streams -// friend void out_of_memory(void){exit(0);} - - - // constructeur : - servor ( int , int , stream ** ); - - // destructeur : - ~servor(); - - -// void set(int t) {time=t;} -// void set(char n[31]) {strcpy(process_name, n);} - void do_split_process ( const double * x ); - void do_column_process ( const double * x , double * y ); - void do_flash_process ( const double * x ); - void do_mix_process ( const double * x ); - void do_pump_process ( const double * x ); - void do_heatx_process ( const double * x ); - void do_reactor_process ( const double * x ); - void do_burner_process ( const double * x , double * y ); - void do_loop_process ( const double * x ); - - bool solve_process ( const double * x , double * y ); //main solver of the software. - - double get_costs_sum ( void ) const; - - double get_power_sum ( void ) const; - - double get_water_sum ( void ) const; - - -}; -#endif +#ifndef SERVOR_H +#define SERVOR_H + +//Possible units +#include "mix.hpp" +#include "split.hpp" +#include "pump.hpp" +#include "column.hpp" +#include "reactor.hpp" +#include "heatx.hpp" +#include "burner.hpp" + +using namespace std; + +class servor { + +public: + + double norm; + int k; + int nb; + int nb_s; + string * type; + string * name; + int cursor; + stream ** s; + + int recycle; + int end_recycle; + int i; + bool end_loop; + + double x_last[MAX_DIM]; + double x_now [MAX_DIM]; + double x_next[MAX_DIM]; + double g_last[MAX_DIM]; + double g_now [MAX_DIM]; + double slope [MAX_DIM]; + double theta [MAX_DIM]; + + double costs[8]; + double power[6]; + double water[6]; + + + // clock_t beg_time, end_time; + // bool OK, b, solve_OK; + // char filename[31], kind[10], **list, process_name[31]; + // double f, f1, f2, f_tab[10], t; + // int i, i1, i2, i_tab[10], time; + // stream *list2; + +// double theta[MAX_DIM], slope[MAX_DIM], norm; +// bool end_loop; +// int k, recycle, end_recycle; +// char loop_name[31]; + +// mix *mix1; void do_mix(); +// split *split1; +// flash *flash1; void do_flash(); +// pump *pump1; void do_pump(); +// column *col; void do_column(); +// reactor<pfr> *react_pfr; void do_reactor(); +// reactor<cstr> *react_cstr; +// heatx *heat; void do_heatx(); + burner * burn; + +// stream *s; //list of streams +// friend void out_of_memory(void){exit(0);} + + + // constructeur : + servor ( int , int , stream ** ); + + // destructeur : + ~servor(); + + +// void set(int t) {time=t;} +// void set(char n[31]) {strcpy(process_name, n);} + void do_split_process ( const double * x ); + void do_column_process ( const double * x , double * y ); + void do_flash_process ( const double * x ); + void do_mix_process ( const double * x ); + void do_pump_process ( const double * x ); + void do_heatx_process ( const double * x ); + void do_reactor_process ( const double * x ); + void do_burner_process ( const double * x , double * y ); + void do_loop_process ( const double * x ); + + bool solve_process ( const double * x , double * y ); //main solver of the software. + + double get_costs_sum ( void ) const; + + double get_power_sum ( void ) const; + + double get_water_sum ( void ) const; + + +}; +#endif diff --git a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/split.cpp b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/split.cpp index d14c519c6794b52ae69162e2455e248636ce0adc..d3f48c90fb149e1ebdd627f3fa28b56c0f331bff 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/split.cpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/split.cpp @@ -1,53 +1,53 @@ -#include "split.hpp" -using namespace std; - -split::split(int n, stream* s1, stream** s2) -{ - nb_out=n; - in = s1; - out= s2; - success = true; -} - -bool split::solve() -{ - tmp=0; - for (i=0;i<nb_out; i++) tmp+=frac[i]; - if(fabs(1-tmp)<=EPS) - { - success = true; - for (i=0; i<nb_out;i++) - { - out[i]->m=0; - for (j=0;j<in->nb;j++) - { - - out[i]->chem[j]->m = frac[i]*in->chem[j]->m; - out[i]->m += out[i]->chem[j]->m; - } - out[i]->set(in->P, in->T); - // out[i]->write(); // TOTO - } - } - tmp=0; for(i=0;i<nb_out;i++) tmp+=out[i]->m; - if(fabs(tmp-in->m)>EPS) - { -// logf.open(MESSAGES, ios::app); -// logf<<" --> Warning <-- Block "<<name<<" is not in mass balance ("<<fabs(tmp-in->m)/tmp<<").\n"; -// logf.close(); - success = false; - } - else success = true; - return success; -} - -void split::write() -{ - cout << "WRITE FILE " << RUNTIME << name << ".unit" << " :\n\tBEGIN\n"; - cout <<"\t>> "<<name; - cout << endl<<"\t>> stream in: "<<in->name;; - cout<<endl<<"\t>> streams out: "<<setprecision(3); - for ( i = 0 ; i < nb_out ; i++ ) - cout << out[i]->name<<" ("<<frac[i]<<") "; - cout << "\n\tEND\n\n"; -} +#include "split.hpp" +using namespace std; + +split::split(int n, stream* s1, stream** s2) +{ + nb_out=n; + in = s1; + out= s2; + success = true; +} + +bool split::solve() +{ + tmp=0; + for (i=0;i<nb_out; i++) tmp+=frac[i]; + if(fabs(1-tmp)<=EPS) + { + success = true; + for (i=0; i<nb_out;i++) + { + out[i]->m=0; + for (j=0;j<in->nb;j++) + { + + out[i]->chem[j]->m = frac[i]*in->chem[j]->m; + out[i]->m += out[i]->chem[j]->m; + } + out[i]->set(in->P, in->T); + // out[i]->write(); // TOTO + } + } + tmp=0; for(i=0;i<nb_out;i++) tmp+=out[i]->m; + if(fabs(tmp-in->m)>EPS) + { +// logf.open(MESSAGES, ios::app); +// logf<<" --> Warning <-- Block "<<name<<" is not in mass balance ("<<fabs(tmp-in->m)/tmp<<").\n"; +// logf.close(); + success = false; + } + else success = true; + return success; +} + +void split::write() +{ + cout << "WRITE FILE " << RUNTIME << name << ".unit" << " :\n\tBEGIN\n"; + cout <<"\t>> "<<name; + cout << endl<<"\t>> stream in: "<<in->name;; + cout<<endl<<"\t>> streams out: "<<setprecision(3); + for ( i = 0 ; i < nb_out ; i++ ) + cout << out[i]->name<<" ("<<frac[i]<<") "; + cout << "\n\tEND\n\n"; +} diff --git a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/split.hpp b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/split.hpp index 7634f470e968c8cda76ed0f9642e7bce2ff1a195..2c75638072d6ed52d32f8d48d0c4970069655230 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/split.hpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/split.hpp @@ -1,43 +1,43 @@ -/* -This unit takes one input stream and divides in two or more -output streams. The pressure and temparature of output streams -are the same as the input's. - -Structure in the .process file: -split {name} {index of input stream} {nb_out} {indexes of output streams and fractions of input} - -How to use: - 1- Call the constructor: split1 = new split(nb_out, in, list_out); - 2- Set split fractions: split1->set(fractions); - 3- Set the name: split1->set(name); - 4- Solve: split1->solve(); -*/ -#ifndef SPLIT_H -#define SPLIT_H - -#include "stream.hpp" -using namespace std; - -class split -{ -private: - - int i, j; - bool success; - double tmp; - string name; - int nb_out; //number of input streams - stream *in; //pointer to input stream - stream **out; //list of pointers to output streams - double *frac; //list of split fractions - -public: - split(int, stream*, stream**); //defines the connectivities of this unit - ~split(){} - void set(double* f) {frac=f;} - void set(const string & n) { name = n;} - bool solve(); //finds the temperature and computes mass balance - void write(); -}; - -#endif +/* +This unit takes one input stream and divides in two or more +output streams. The pressure and temparature of output streams +are the same as the input's. + +Structure in the .process file: +split {name} {index of input stream} {nb_out} {indexes of output streams and fractions of input} + +How to use: + 1- Call the constructor: split1 = new split(nb_out, in, list_out); + 2- Set split fractions: split1->set(fractions); + 3- Set the name: split1->set(name); + 4- Solve: split1->solve(); +*/ +#ifndef SPLIT_H +#define SPLIT_H + +#include "stream.hpp" +using namespace std; + +class split +{ +private: + + int i, j; + bool success; + double tmp; + string name; + int nb_out; //number of input streams + stream *in; //pointer to input stream + stream **out; //list of pointers to output streams + double *frac; //list of split fractions + +public: + split(int, stream*, stream**); //defines the connectivities of this unit + ~split(){} + void set(double* f) {frac=f;} + void set(const string & n) { name = n;} + bool solve(); //finds the temperature and computes mass balance + void write(); +}; + +#endif diff --git a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/stream.cpp b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/stream.cpp index 408c1cb21e949286b9cb58cc2e25801db61a1480..8854441ea39a4a547414299b8725c623b9042192 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/stream.cpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/stream.cpp @@ -1,265 +1,265 @@ -#include "stream.hpp" -using namespace std; - -// destructor : -stream::~stream ( void ) { - delete thermo; - delete [] tab1; - delete [] tab2; - delete [] tab3; - delete [] tab4; - for ( i = 0 ; i < nb ; i++ ) - delete chem[i]; - delete [] chem; -} - -void stream::check_error() -{ - - if (error>MAX_ERROR) { - cout << "ERROR 4\n\n"; - exit(0); - } - if (warning>MAX_WARNING) { - cout << "ERROR 5\n\n"; - exit(0); - } -} - -void stream::set ( int _nb , chemical ** _chem) { - int i; - for ( i = 0 ; i < nb ; i++ ) - delete chem[i]; - delete [] chem; - nb = _nb; - chem = new chemical * [nb]; - for ( i = 0 ; i < nb ; i++ ) - chem[i] = new chemical(*_chem[i]); -} - -void stream::set(double pres, double temp) //set P, T, find state and resulting v -{ - if(thermo->get_dim()!=nb) - { - delete thermo; - thermo = new thermolib(nb); - } - P=pres; - T=temp; - for (i=0;i<nb;i++) {chem[i]->P=pres; chem[i]->T=temp;} - if(n()>EPS) - { - v=quality(); - tmp1=0; - for (i=0;i<nb;i++) - { - if (T>chem[i]->Tc || v==1) chem[i]->state=1; - else chem[i]->state=0; - } - v=0; - for (i=0;i<nb;i++) - { - if (chem[i]->state==0) {if (chem[i]->m>EPS) v+= chem[i]->m/chem[i]->rho(); tab4[i]=0;} - if (chem[i]->state==1) {tab4[i] = chem[i]->n(); tmp1+=tab4[i];} - } - if (tmp1>EPS) - { - for (i=0;i<nb;i++) - { - tab1[i] = chem[i]->Pc; //cout<<endl<<tab1[i]; - tab2[i] = chem[i]->Tc; // cout<<" "<<tab2[i]; - tab3[i] = chem[i]->omega(); //cout<<" "<<tab3[i]; - tab4[i]/=tmp1; // cout<<" "<<tab4[i]; - } - thermo->send(tab1,tab2,tab3, tab4); - thermo->set(P,T,0.0,tmp1); - v+=thermo->v(); - } - } - else v= 0.0; -} - -void stream::set(double *list) -{ - m=0; - for (i=0; i<nb; i++) - { - chem[i]->m=list[i]; - m+=list[i]; - } -} - -void stream::bubble() -{ - bp=1.1e6; - for(i=0;i<nb;i++) if(T<chem[i]->Tc && chem[i]->Tboil(P)<bp && chem[i]->m>EPS) bp=chem[i]->Tboil(P); - if (bp==1.1e6) bp=0.0; - else - { - step=2; - while (fabs(step)>TOL_BP && fabs(tmp1-1)>TOL_BP) - { - //if(DEBUG) cout<<endl<<bp; - bp+=step; - tmp1=tmp2=0; - for (i=0;i<nb;i++) if(T<chem[i]->Tc) {tmp2+=chem[i]->n(); tmp1+=chem[i]->n()*chem[i]->Psat(bp)/P;} - tmp1/=tmp2; - step=10*(1.0-tmp1); - } - } -} - -void stream::dew() -{ - dp=0.0; - tmp1=10; - for(i=0;i<nb;i++) if(T<chem[i]->Tc && chem[i]->Tboil(P)>dp && chem[i]->m>EPS) dp=chem[i]->Tboil(P); - if (dp>EPS) - { - dp=bp; - step=1; - while (fabs(step)>TOL_DP && fabs(tmp1/tmp2-1)>TOL_DP) - { - dp+=step; - if(dp<bp) dp=bp; - //if(DEBUG) cout<<endl<<dp; - tmp1=tmp2=0; - for (i=0;i<nb;i++) if(T<chem[i]->Tc) {tmp2+=chem[i]->n(); tmp1+=chem[i]->n()/chem[i]->Psat(dp)*P; } - if (step/fabs(step)*tmp2/tmp1 >1 || step/fabs(step)*tmp1/tmp2 <-1) step*= -0.1; - } - } -} - -double stream::quality() -{ - if(T>EPS) - { - bubble(); - dew(); - //if(DEBUG) cout<<endl<<name<<" bp="<<bp<<" dp="<<dp<<" T="<<T; system("pause"); - if (bp < dp) - { - if (bp < T && T< dp) tmp= (T-bp)/(dp-bp); - if (T<= bp) tmp= 0.0; - if (T >= dp) tmp= 1.0; - } - } - else tmp= 0.0; - return tmp; -} - -double stream::K(int i) -{ - for (j=0;j<nb;j++) - tab4[j] = chem[j]->n()/n(); - thermo->send(tab1,tab2,tab3, tab4); - if (T>EPS && P>EPS) - { - thermo->set(P,T,v,n()); - return thermo->K(i); - } - else - { - ofstream logf; - logf.open(MESSAGES, ios::app); - logf<<" --> Warning <-- Cannot compute K of "<<chem[i]->name<<" in stream "<<name<<".\n"; - logf.close(); - warning++; - check_error(); - return 1.0; - } -} - -double stream::n() -{ - tmp=0.0; - for ( k = 0 ; k < nb ; k++ ) - tmp+=chem[k]->n(); - return tmp; -} - - -// affectation : -stream & stream::operator = ( const stream & s ) { - - (*thermo) = *(s.thermo); - - delete [] tab1; - delete [] tab2; - delete [] tab3; - delete [] tab4; - for ( i = 0 ; i < nb ; i++ ) - delete chem[i]; - delete [] chem; - - P = s.P; - T = s.T; - m = s.m; - v = s.v; - i = s.i; - j = s.j; - k = s.k; - error = s.error; - warning = s.warning; - name = s.name; - nb = s.nb; - chem = new chemical *[nb]; - - tab1 = new double[nb]; - tab2 = new double[nb]; - tab3 = new double[nb]; - tab4 = new double[nb]; - - step = s.step; - - for ( i = 0 ; i < nb ; i++ ) { - chem[i] = new chemical(*s.chem[i]); - tab1[i] = s.tab1[i]; - tab2[i] = s.tab2[i]; - tab3[i] = s.tab3[i]; - tab4[i] = s.tab4[i]; - } - - tmp = s.tmp; - tmp1 = s.tmp1; - tmp2 = s.tmp2; - - return *this; -} - - -void stream::write() { - - string file_name = RUNTIME + name + ".stream"; - - cout << "WRITE FILE " << file_name << " :\n\tBEGIN\n"; - - cout.unsetf(ios::scientific); - cout << setiosflags(ios::showpoint | ios::fixed)<<setprecision(1); - - cout << "\t>>" << setw(8) << P << " " << setw(9) << T <<" "; - - cout << resetiosflags(ios::fixed) << setiosflags(ios::scientific) << setprecision(3); - - if (m>EPS) - cout << setw(11) << m << setw(11) << v; - else - cout << " x x "; - for ( i = 0 ; i < nb ; i++ ) { - if ( chem[i]->m <= EPS ) - cout << " x "; - else - cout << setw(11) << chem[i]->m; - } - cout << "\n\tEND\n\n"; - - cout.setf(ios::scientific); - -} - -void stream::purge() -{ - P=T=m=v=0.0; - for(i=0;i<nb;i++) - chem[i]->purge(); -} +#include "stream.hpp" +using namespace std; + +// destructor : +stream::~stream ( void ) { + delete thermo; + delete [] tab1; + delete [] tab2; + delete [] tab3; + delete [] tab4; + for ( i = 0 ; i < nb ; i++ ) + delete chem[i]; + delete [] chem; +} + +void stream::check_error() +{ + + if (error>MAX_ERROR) { + cout << "ERROR 4\n\n"; + exit(0); + } + if (warning>MAX_WARNING) { + cout << "ERROR 5\n\n"; + exit(0); + } +} + +void stream::set ( int _nb , chemical ** _chem) { + int i; + for ( i = 0 ; i < nb ; i++ ) + delete chem[i]; + delete [] chem; + nb = _nb; + chem = new chemical * [nb]; + for ( i = 0 ; i < nb ; i++ ) + chem[i] = new chemical(*_chem[i]); +} + +void stream::set(double pres, double temp) //set P, T, find state and resulting v +{ + if(thermo->get_dim()!=nb) + { + delete thermo; + thermo = new thermolib(nb); + } + P=pres; + T=temp; + for (i=0;i<nb;i++) {chem[i]->P=pres; chem[i]->T=temp;} + if(n()>EPS) + { + v=quality(); + tmp1=0; + for (i=0;i<nb;i++) + { + if (T>chem[i]->Tc || v==1) chem[i]->state=1; + else chem[i]->state=0; + } + v=0; + for (i=0;i<nb;i++) + { + if (chem[i]->state==0) {if (chem[i]->m>EPS) v+= chem[i]->m/chem[i]->rho(); tab4[i]=0;} + if (chem[i]->state==1) {tab4[i] = chem[i]->n(); tmp1+=tab4[i];} + } + if (tmp1>EPS) + { + for (i=0;i<nb;i++) + { + tab1[i] = chem[i]->Pc; //cout<<endl<<tab1[i]; + tab2[i] = chem[i]->Tc; // cout<<" "<<tab2[i]; + tab3[i] = chem[i]->omega(); //cout<<" "<<tab3[i]; + tab4[i]/=tmp1; // cout<<" "<<tab4[i]; + } + thermo->send(tab1,tab2,tab3, tab4); + thermo->set(P,T,0.0,tmp1); + v+=thermo->v(); + } + } + else v= 0.0; +} + +void stream::set(double *list) +{ + m=0; + for (i=0; i<nb; i++) + { + chem[i]->m=list[i]; + m+=list[i]; + } +} + +void stream::bubble() +{ + bp=1.1e6; + for(i=0;i<nb;i++) if(T<chem[i]->Tc && chem[i]->Tboil(P)<bp && chem[i]->m>EPS) bp=chem[i]->Tboil(P); + if (bp==1.1e6) bp=0.0; + else + { + step=2; + while (fabs(step)>TOL_BP && fabs(tmp1-1)>TOL_BP) + { + //if(DEBUG) cout<<endl<<bp; + bp+=step; + tmp1=tmp2=0; + for (i=0;i<nb;i++) if(T<chem[i]->Tc) {tmp2+=chem[i]->n(); tmp1+=chem[i]->n()*chem[i]->Psat(bp)/P;} + tmp1/=tmp2; + step=10*(1.0-tmp1); + } + } +} + +void stream::dew() +{ + dp=0.0; + tmp1=10; + for(i=0;i<nb;i++) if(T<chem[i]->Tc && chem[i]->Tboil(P)>dp && chem[i]->m>EPS) dp=chem[i]->Tboil(P); + if (dp>EPS) + { + dp=bp; + step=1; + while (fabs(step)>TOL_DP && fabs(tmp1/tmp2-1)>TOL_DP) + { + dp+=step; + if(dp<bp) dp=bp; + //if(DEBUG) cout<<endl<<dp; + tmp1=tmp2=0; + for (i=0;i<nb;i++) if(T<chem[i]->Tc) {tmp2+=chem[i]->n(); tmp1+=chem[i]->n()/chem[i]->Psat(dp)*P; } + if (step/fabs(step)*tmp2/tmp1 >1 || step/fabs(step)*tmp1/tmp2 <-1) step*= -0.1; + } + } +} + +double stream::quality() +{ + if(T>EPS) + { + bubble(); + dew(); + //if(DEBUG) cout<<endl<<name<<" bp="<<bp<<" dp="<<dp<<" T="<<T; system("pause"); + if (bp < dp) + { + if (bp < T && T< dp) tmp= (T-bp)/(dp-bp); + if (T<= bp) tmp= 0.0; + if (T >= dp) tmp= 1.0; + } + } + else tmp= 0.0; + return tmp; +} + +double stream::K(int i) +{ + for (j=0;j<nb;j++) + tab4[j] = chem[j]->n()/n(); + thermo->send(tab1,tab2,tab3, tab4); + if (T>EPS && P>EPS) + { + thermo->set(P,T,v,n()); + return thermo->K(i); + } + else + { + ofstream logf; + logf.open(MESSAGES, ios::app); + logf<<" --> Warning <-- Cannot compute K of "<<chem[i]->name<<" in stream "<<name<<".\n"; + logf.close(); + warning++; + check_error(); + return 1.0; + } +} + +double stream::n() +{ + tmp=0.0; + for ( k = 0 ; k < nb ; k++ ) + tmp+=chem[k]->n(); + return tmp; +} + + +// affectation : +stream & stream::operator = ( const stream & s ) { + + (*thermo) = *(s.thermo); + + delete [] tab1; + delete [] tab2; + delete [] tab3; + delete [] tab4; + for ( i = 0 ; i < nb ; i++ ) + delete chem[i]; + delete [] chem; + + P = s.P; + T = s.T; + m = s.m; + v = s.v; + i = s.i; + j = s.j; + k = s.k; + error = s.error; + warning = s.warning; + name = s.name; + nb = s.nb; + chem = new chemical *[nb]; + + tab1 = new double[nb]; + tab2 = new double[nb]; + tab3 = new double[nb]; + tab4 = new double[nb]; + + step = s.step; + + for ( i = 0 ; i < nb ; i++ ) { + chem[i] = new chemical(*s.chem[i]); + tab1[i] = s.tab1[i]; + tab2[i] = s.tab2[i]; + tab3[i] = s.tab3[i]; + tab4[i] = s.tab4[i]; + } + + tmp = s.tmp; + tmp1 = s.tmp1; + tmp2 = s.tmp2; + + return *this; +} + + +void stream::write() { + + string file_name = RUNTIME + name + ".stream"; + + cout << "WRITE FILE " << file_name << " :\n\tBEGIN\n"; + + cout.unsetf(ios::scientific); + cout << setiosflags(ios::showpoint | ios::fixed)<<setprecision(1); + + cout << "\t>>" << setw(8) << P << " " << setw(9) << T <<" "; + + cout << resetiosflags(ios::fixed) << setiosflags(ios::scientific) << setprecision(3); + + if (m>EPS) + cout << setw(11) << m << setw(11) << v; + else + cout << " x x "; + for ( i = 0 ; i < nb ; i++ ) { + if ( chem[i]->m <= EPS ) + cout << " x "; + else + cout << setw(11) << chem[i]->m; + } + cout << "\n\tEND\n\n"; + + cout.setf(ios::scientific); + +} + +void stream::purge() +{ + P=T=m=v=0.0; + for(i=0;i<nb;i++) + chem[i]->purge(); +} diff --git a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/stream.hpp b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/stream.hpp index 895ef3d6b8fcd99dee13564f66d71932a2c009c5..94b21025cc190e1bc0783d172737cd72bef2e889 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/stream.hpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/stream.hpp @@ -1,86 +1,86 @@ -#ifndef STREAM_H -#define STREAM_H -#include "chemical.hpp" -#include <iomanip> -using namespace std; - -class stream { - -private: - - stream ( void ) {} - stream ( const stream & s ) {} - -public: - void check_error(); - - double P, T, m, v; // Pressure in atm, temperature in K, - // total mass flow in kg/s, total volume flow in m3/s - - int i, j, k, error, warning; - - string name; - - int nb; // number of chemicals to store; - - chemical ** chem; // list of stored chemicals - - thermolib *thermo; - - double tmp, tmp1,tmp2, *tab1, *tab2, *tab3, *tab4; - double step; - void bubble(), dew(); - -public: - - - - - - double dp, bp; - double rho() {if(v!=0) return m/v; else exit(0);} // Apparent density in kg/m3 - double n(); // total mole flow (mol/s) - double quality(); // returns the vapor fraction of stream (1=all vapor, 0 = all liquid) - double K(int); // returns the vapor-liquid equilibrium constant of compound i - - // constructor : - stream ( const string _name , int n , chemical ** list ) : P (0 ) , - T (0 ) , - m (0 ) , - v (0 ) , - error (0 ) , - warning(0 ) , - name (_name ) , - nb (n ) , - chem (new chemical *[nb]) , - thermo (new thermolib (nb)) , - tab1 (new double [nb]) , - tab2 (new double [nb]) , - tab3 (new double [nb]) , - tab4 (new double [nb]) { - for ( i = 0 ; i < nb ; i++ ) - chem[i] = new chemical(*list[i]); - } - - - // affectation : - stream & operator = ( const stream & s ); - - void set_thermo ( thermolib * t ) { (*thermo) = *t; } - - - void set(double, double); // Sets P and T - void set(double*); // Sets mass flows - void set( const string & n ) { name = n;} - void set ( int _nb , chemical ** _chem); - - - // destructor : - ~stream ( void ); - - void write(); - void purge(); -}; - - -#endif +#ifndef STREAM_H +#define STREAM_H +#include "chemical.hpp" +#include <iomanip> +using namespace std; + +class stream { + +private: + + stream ( void ) {} + stream ( const stream & s ) {} + +public: + void check_error(); + + double P, T, m, v; // Pressure in atm, temperature in K, + // total mass flow in kg/s, total volume flow in m3/s + + int i, j, k, error, warning; + + string name; + + int nb; // number of chemicals to store; + + chemical ** chem; // list of stored chemicals + + thermolib *thermo; + + double tmp, tmp1,tmp2, *tab1, *tab2, *tab3, *tab4; + double step; + void bubble(), dew(); + +public: + + + + + + double dp, bp; + double rho() {if(v!=0) return m/v; else exit(0);} // Apparent density in kg/m3 + double n(); // total mole flow (mol/s) + double quality(); // returns the vapor fraction of stream (1=all vapor, 0 = all liquid) + double K(int); // returns the vapor-liquid equilibrium constant of compound i + + // constructor : + stream ( const string _name , int n , chemical ** list ) : P (0 ) , + T (0 ) , + m (0 ) , + v (0 ) , + error (0 ) , + warning(0 ) , + name (_name ) , + nb (n ) , + chem (new chemical *[nb]) , + thermo (new thermolib (nb)) , + tab1 (new double [nb]) , + tab2 (new double [nb]) , + tab3 (new double [nb]) , + tab4 (new double [nb]) { + for ( i = 0 ; i < nb ; i++ ) + chem[i] = new chemical(*list[i]); + } + + + // affectation : + stream & operator = ( const stream & s ); + + void set_thermo ( thermolib * t ) { (*thermo) = *t; } + + + void set(double, double); // Sets P and T + void set(double*); // Sets mass flows + void set( const string & n ) { name = n;} + void set ( int _nb , chemical ** _chem); + + + // destructor : + ~stream ( void ); + + void write(); + void purge(); +}; + + +#endif diff --git a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/thermolib.cpp b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/thermolib.cpp index 5113bca59ee704135d5d363d31d39243ef145601..51e3fbb903cd0b64921ea3f0e84cc9e8826bd101 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/thermolib.cpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/thermolib.cpp @@ -1,175 +1,175 @@ -#include "thermolib.hpp" -#include "defines.hpp" -#include "secant.cpp" -using namespace std; - - - - -// affectation : -thermolib & thermolib::operator = ( const thermolib & t ) { - - if (dim!=t.dim) - reset(t.dim); - - for ( i = 0 ; i < dim ; i++ ) { - Pc[i] = t.Pc[i]; - Tc[i] = t.Tc[i]; - omega[i] = t.omega[i]; - molefrac[i] = t.molefrac[i]; - } - - return *this; -} - -thermolib::~thermolib() { - delete solver; - delete [] Pc; - delete [] Tc; - delete [] omega; - delete [] molefrac; -} - -void thermolib::construct ( void ) { - molefrac = new double[dim]; - Pc = new double[dim]; - Tc = new double[dim]; - omega = new double[dim]; - - // C. Tribes add this for more robustness (variables may be initialized uncorrectly dependent on the execution) - for ( i = 0 ; i < dim ; i++ ) - { - Pc[i] = 0.0; - Tc[i] = 0.0; - omega[i] = 0.0; - molefrac[i] = 0.0; - } - - - solver = new secant<thermolib>(); -} - -void thermolib::reset(int b) -{ - delete [] molefrac; - delete [] Pc; - delete [] Tc; - delete [] omega; - delete solver; - dim = b; - construct(); -} - -double thermolib::a_mix() -{ - if (dim>1) - { - tmp=0; - for (i=0;i<dim;i++) - for (j=0;j<dim;j++) - tmp += molefrac[i]*molefrac[j]*sqrt(a(i)*a(j)); - return tmp; - } - else return a(0); -} - -double thermolib::b_mix() -{ - if (dim>1) - { - tmp=0; - for (i=0;i<dim;i++) - tmp += molefrac[i]*b(i); - return tmp; - } - else return b(0); -} - -void thermolib::send(double* pc, double* tc, double* w, double* y) -{ - for (i=0;i<dim;i++) - { - Pc[i] = pc[i]*101.325; - Tc[i] = tc[i]; - omega[i] = w[i]; - molefrac[i] = y[i]; - } -} - -double thermolib::P() -{ - task=0; - pressure = 8.3144*temperature/molevolume; - solver->set(this, pressure, 1.001*pressure); - success=solver->run(); - return pressure/101.325; -} - -double thermolib::T() -{ - task=1; - temperature = pressure*molevolume/8.144; - solver->set(this, temperature, 1.001*temperature); - success=solver->run(); - return temperature; -} - -double thermolib::v() -{ - if (mole>EPS) - { - task=2; - molevolume = 8.3144*temperature/pressure; - solver->set(this, molevolume, 1.001*molevolume); - success=solver->run(); - return 0.001*mole*molevolume; - } - else return 0.0; -} - -double thermolib::Zv() -{ - task=4; - solver->set(this, 1.0, 0.99); - success=solver->run(); - return Z; -} - -double thermolib::phiV(int i) -{ - return exp((Z-1)*B(i)/B() - log(Z-B()) - A()/B()*(2*sqrt(A(i)/A())-B(i)/B())*log(1+B()/Z)); -} - -double thermolib::phiL(int i) -{ - Pr = pressure/Pc[i]; - Tr = temperature/Tc[i]; - tmp = 2.05135 - 2.10899/Tr - 0.19396*pow(Tr,2) + 0.02282*pow(Tr,3) + (0.08852 - 0.00872*pow(Tr,2))*Pr + (-0.00353 - 0.00203*Tr)*pow(Pr,2) - log10(Pr); - tmp += omega[i]*(-4.23893 + 8.65808*Tr - 1.2206/Tr - 3.15224*pow(Tr,3) - 0.025*(Pr-0.6)); - return pow(10, tmp); -} - -double thermolib::f(double x) -{ - if (task==0) - { - pressure=x; - x= 8.3144*temperature/(molevolume-b_mix()) - a_mix()/(pow(molevolume,2)+b_mix()*molevolume) - x; - } - if (task==1) - { - temperature=x; - x= 8.3144*x/(molevolume-b_mix()) - a_mix()/(pow(molevolume,2)+b_mix()*molevolume) - pressure; - } - if (task==2) - { - molevolume=x; - x= 8.3144*temperature/(x-b_mix()) - a_mix()/(pow(x,2)+b_mix()*x) - pressure; - } - if(task==4) - { - Z=x; - x= (pow(x,3)-pow(x,2)+(A()-B()-pow(B(),2))*x-A()*B()); - } - return x; -} +#include "thermolib.hpp" +#include "defines.hpp" +#include "secant.cpp" +using namespace std; + + + + +// affectation : +thermolib & thermolib::operator = ( const thermolib & t ) { + + if (dim!=t.dim) + reset(t.dim); + + for ( i = 0 ; i < dim ; i++ ) { + Pc[i] = t.Pc[i]; + Tc[i] = t.Tc[i]; + omega[i] = t.omega[i]; + molefrac[i] = t.molefrac[i]; + } + + return *this; +} + +thermolib::~thermolib() { + delete solver; + delete [] Pc; + delete [] Tc; + delete [] omega; + delete [] molefrac; +} + +void thermolib::construct ( void ) { + molefrac = new double[dim]; + Pc = new double[dim]; + Tc = new double[dim]; + omega = new double[dim]; + + // C. Tribes add this for more robustness (variables may be initialized uncorrectly dependent on the execution) + for ( i = 0 ; i < dim ; i++ ) + { + Pc[i] = 0.0; + Tc[i] = 0.0; + omega[i] = 0.0; + molefrac[i] = 0.0; + } + + + solver = new secant<thermolib>(); +} + +void thermolib::reset(int b) +{ + delete [] molefrac; + delete [] Pc; + delete [] Tc; + delete [] omega; + delete solver; + dim = b; + construct(); +} + +double thermolib::a_mix() +{ + if (dim>1) + { + tmp=0; + for (i=0;i<dim;i++) + for (j=0;j<dim;j++) + tmp += molefrac[i]*molefrac[j]*sqrt(a(i)*a(j)); + return tmp; + } + else return a(0); +} + +double thermolib::b_mix() +{ + if (dim>1) + { + tmp=0; + for (i=0;i<dim;i++) + tmp += molefrac[i]*b(i); + return tmp; + } + else return b(0); +} + +void thermolib::send(double* pc, double* tc, double* w, double* y) +{ + for (i=0;i<dim;i++) + { + Pc[i] = pc[i]*101.325; + Tc[i] = tc[i]; + omega[i] = w[i]; + molefrac[i] = y[i]; + } +} + +double thermolib::P() +{ + task=0; + pressure = 8.3144*temperature/molevolume; + solver->set(this, pressure, 1.001*pressure); + success=solver->run(); + return pressure/101.325; +} + +double thermolib::T() +{ + task=1; + temperature = pressure*molevolume/8.144; + solver->set(this, temperature, 1.001*temperature); + success=solver->run(); + return temperature; +} + +double thermolib::v() +{ + if (mole>EPS) + { + task=2; + molevolume = 8.3144*temperature/pressure; + solver->set(this, molevolume, 1.001*molevolume); + success=solver->run(); + return 0.001*mole*molevolume; + } + else return 0.0; +} + +double thermolib::Zv() +{ + task=4; + solver->set(this, 1.0, 0.99); + success=solver->run(); + return Z; +} + +double thermolib::phiV(int i) +{ + return exp((Z-1)*B(i)/B() - log(Z-B()) - A()/B()*(2*sqrt(A(i)/A())-B(i)/B())*log(1+B()/Z)); +} + +double thermolib::phiL(int i) +{ + Pr = pressure/Pc[i]; + Tr = temperature/Tc[i]; + tmp = 2.05135 - 2.10899/Tr - 0.19396*pow(Tr,2) + 0.02282*pow(Tr,3) + (0.08852 - 0.00872*pow(Tr,2))*Pr + (-0.00353 - 0.00203*Tr)*pow(Pr,2) - log10(Pr); + tmp += omega[i]*(-4.23893 + 8.65808*Tr - 1.2206/Tr - 3.15224*pow(Tr,3) - 0.025*(Pr-0.6)); + return pow(10, tmp); +} + +double thermolib::f(double x) +{ + if (task==0) + { + pressure=x; + x= 8.3144*temperature/(molevolume-b_mix()) - a_mix()/(pow(molevolume,2)+b_mix()*molevolume) - x; + } + if (task==1) + { + temperature=x; + x= 8.3144*x/(molevolume-b_mix()) - a_mix()/(pow(molevolume,2)+b_mix()*molevolume) - pressure; + } + if (task==2) + { + molevolume=x; + x= 8.3144*temperature/(x-b_mix()) - a_mix()/(pow(x,2)+b_mix()*x) - pressure; + } + if(task==4) + { + Z=x; + x= (pow(x,3)-pow(x,2)+(A()-B()-pow(B(),2))*x-A()*B()); + } + return x; +} diff --git a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/thermolib.hpp b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/thermolib.hpp index 3d39c8c7664d3be918c45978344f86a89d681550..3440270ab02d6575023747971b89e9725da31061 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/surrogate/thermolib.hpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/surrogate/thermolib.hpp @@ -1,50 +1,50 @@ -#ifndef THERMOLIB_H -#define THERMOLIB_H -#include "secant.hpp" -using namespace std; - -class thermolib -{ - private: - bool success; - int dim, i, j; - double pressure, temperature, molevolume, mole,*molefrac; - double *Pc, *Tc, *omega, Z, tmp, Tr, Pr; - void construct(); - double a(int i) {return (0.42748*pow(8.8144,2)*pow(Tc[i],2)*pow(1.0+f_omega(i)*(1.0-sqrt(temperature/Tc[i])), 2)/Pc[i]);} - double a_mix(); - double b(int i) {return (0.08664*8.3144*Tc[i]/Pc[i]);} - double b_mix(); - double A(int i) {return (a(i)*pressure/pow(8.3144, 2)/pow(temperature, 2));} - double A() {return (a_mix()*pressure/pow(8.3144, 2)/pow(temperature, 2));} - double B(int i) {return (b(i)*pressure/8.3144/temperature);} - double B(){return (b_mix()*pressure/8.3144/temperature);} - double Zv(), phiV(int), phiL(int); - double f_omega(int i) {return (0.48 + 1.574*omega[i] - 0.176*pow(omega[i], 2));} - int task; //0=find P 1=find T 2=find v 3= find K 4=find Zv - secant<thermolib> *solver; - - public: - double P(); //retruns pressure at T and v, in atm - double T(); //returns temperature at P and v, in K - double v(); //returns volume flow at P, T, n(), in m3/s - double K() {Z = Zv(); return phiL(0)/phiV(0);} //returns the vapor-liquid equilibirum constant - double K(int i) {return phiL(i)/phiV(i);} - double compres_coeff(){return 1.0;}; - - -// affectation : - thermolib & operator = ( const thermolib & t ); - - thermolib ( int d = 1 ) { dim=d; construct();} - - void send(double pc, double tc, double w) { Pc[0] = pc*101.325; Tc[0] = tc; omega[0]=w;} - void send(double*, double*, double*, double*); - void set(double p, double t, double v, double n) {pressure=p*101.325; temperature=t; molevolume=0.001*n/v; mole=n;} - double f(double); - int get_dim() {return dim;} - ~thermolib(); - void reset(int); -}; -#endif - +#ifndef THERMOLIB_H +#define THERMOLIB_H +#include "secant.hpp" +using namespace std; + +class thermolib +{ + private: + bool success; + int dim, i, j; + double pressure, temperature, molevolume, mole,*molefrac; + double *Pc, *Tc, *omega, Z, tmp, Tr, Pr; + void construct(); + double a(int i) {return (0.42748*pow(8.8144,2)*pow(Tc[i],2)*pow(1.0+f_omega(i)*(1.0-sqrt(temperature/Tc[i])), 2)/Pc[i]);} + double a_mix(); + double b(int i) {return (0.08664*8.3144*Tc[i]/Pc[i]);} + double b_mix(); + double A(int i) {return (a(i)*pressure/pow(8.3144, 2)/pow(temperature, 2));} + double A() {return (a_mix()*pressure/pow(8.3144, 2)/pow(temperature, 2));} + double B(int i) {return (b(i)*pressure/8.3144/temperature);} + double B(){return (b_mix()*pressure/8.3144/temperature);} + double Zv(), phiV(int), phiL(int); + double f_omega(int i) {return (0.48 + 1.574*omega[i] - 0.176*pow(omega[i], 2));} + int task; //0=find P 1=find T 2=find v 3= find K 4=find Zv + secant<thermolib> *solver; + + public: + double P(); //retruns pressure at T and v, in atm + double T(); //returns temperature at P and v, in K + double v(); //returns volume flow at P, T, n(), in m3/s + double K() {Z = Zv(); return phiL(0)/phiV(0);} //returns the vapor-liquid equilibirum constant + double K(int i) {return phiL(i)/phiV(i);} + double compres_coeff(){return 1.0;}; + + +// affectation : + thermolib & operator = ( const thermolib & t ); + + thermolib ( int d = 1 ) { dim=d; construct();} + + void send(double pc, double tc, double w) { Pc[0] = pc*101.325; Tc[0] = tc; omega[0]=w;} + void send(double*, double*, double*, double*); + void set(double p, double t, double v, double n) {pressure=p*101.325; temperature=t; molevolume=0.001*n/v; mole=n;} + double f(double); + int get_dim() {return dim;} + ~thermolib(); + void reset(int); +}; +#endif + diff --git a/tools/SENSITIVITY/problems/styrene/black-box/truth/RungeKutta.cpp b/tools/SENSITIVITY/problems/styrene/black-box/truth/RungeKutta.cpp index dbc37f4c7eb11d8439b38c4ca1c0ebcad406603d..175e64bb507e1c6dfe6a5956a0d5be4f8e09bfec 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/truth/RungeKutta.cpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/truth/RungeKutta.cpp @@ -1,80 +1,80 @@ -#include "RungeKutta.hpp" - -#include <iomanip> - -using namespace std; - -template <class E> -RungeKutta<E>::RungeKutta(int dim) -{ - m = dim; - k1 = new double[m]; - k2 = new double[m]; - k3 = new double[m]; - k4 = new double[m]; - y = new double[m]; - y_tmp = new double[m]; -} - -template <class E> -RungeKutta<E>::~RungeKutta() -{ - delete [] k1; - delete [] k2; - delete [] k3; - delete [] k4; - delete [] y; - delete [] y_tmp; -} - -template <class E> -void RungeKutta<E>::set ( E * tmp , double * y0 , double beg , double end ) -{ - unit=tmp; - x0=beg; xn=end; - x=x0; - h=double(xn-x0)/double(N_INTER); - for (i=0;i<m;i++) {y[i]=y0[i];} - success=true; -} - -template <class E> -bool RungeKutta<E>::run() { - for(j=0;j<MAX_ITER_RK;j++) { - //Avoid going out of x interval - if (x+h >xn) { - h = xn-x; - j = MAX_ITER_RK; - } - - //Compute k1, k2, k3, k4 - for(i=0;i<m;i++) - k1[i] = h*unit->f(i, x, y); - for(i=0;i<m;i++) - y_tmp[i] = y[i]+k1[i]/2.0; - for(i=0;i<m;i++) - k2[i] = h*unit->f(i, x+h/2.0, y_tmp); - for(i=0;i<m;i++) - y_tmp[i] = y[i]+k2[i]/2.0; - for(i=0;i<m;i++) - k3[i] = h*unit->f(i, x+h/2.0, y_tmp); - for(i=0;i<m;i++) - y_tmp[i] = y[i]+k3[i]; - for ( i = 0 ; i < m ; i++ ) - k4[i] = h*unit->f ( i , x+h , y_tmp ); - //Compute the new y - for(i=0;i<m;i++) - y[i]+=(k1[i]+2*k2[i]+2*k3[i]+k4[i])/6.0; - x += h; - } - - if ( x < xn-EPS ) {// MODIF SEB (le EPS) - success=false; - - // cout.setf(ios::fixed); - // cout << setprecision(12); - // cout << "x=" << x << " < xn=" << xn << " diff=" << xn-x << endl; - } - - return success; -} +#include "RungeKutta.hpp" + +#include <iomanip> + +using namespace std; + +template <class E> +RungeKutta<E>::RungeKutta(int dim) +{ + m = dim; + k1 = new double[m]; + k2 = new double[m]; + k3 = new double[m]; + k4 = new double[m]; + y = new double[m]; + y_tmp = new double[m]; +} + +template <class E> +RungeKutta<E>::~RungeKutta() +{ + delete [] k1; + delete [] k2; + delete [] k3; + delete [] k4; + delete [] y; + delete [] y_tmp; +} + +template <class E> +void RungeKutta<E>::set ( E * tmp , double * y0 , double beg , double end ) +{ + unit=tmp; + x0=beg; xn=end; + x=x0; + h=double(xn-x0)/double(N_INTER); + for (i=0;i<m;i++) {y[i]=y0[i];} + success=true; +} + +template <class E> +bool RungeKutta<E>::run() { + for(j=0;j<MAX_ITER_RK;j++) { + //Avoid going out of x interval + if (x+h >xn) { + h = xn-x; + j = MAX_ITER_RK; + } + + //Compute k1, k2, k3, k4 + for(i=0;i<m;i++) + k1[i] = h*unit->f(i, x, y); + for(i=0;i<m;i++) + y_tmp[i] = y[i]+k1[i]/2.0; + for(i=0;i<m;i++) + k2[i] = h*unit->f(i, x+h/2.0, y_tmp); + for(i=0;i<m;i++) + y_tmp[i] = y[i]+k2[i]/2.0; + for(i=0;i<m;i++) + k3[i] = h*unit->f(i, x+h/2.0, y_tmp); + for(i=0;i<m;i++) + y_tmp[i] = y[i]+k3[i]; + for ( i = 0 ; i < m ; i++ ) + k4[i] = h*unit->f ( i , x+h , y_tmp ); + //Compute the new y + for(i=0;i<m;i++) + y[i]+=(k1[i]+2*k2[i]+2*k3[i]+k4[i])/6.0; + x += h; + } + + if ( x < xn-EPS ) {// MODIF SEB (le EPS) + success=false; + + // cout.setf(ios::fixed); + // cout << setprecision(12); + // cout << "x=" << x << " < xn=" << xn << " diff=" << xn-x << endl; + } + + return success; +} diff --git a/tools/SENSITIVITY/problems/styrene/black-box/truth/RungeKutta.hpp b/tools/SENSITIVITY/problems/styrene/black-box/truth/RungeKutta.hpp index 240075371d9f76c61faa9f0865ace58c090acd41..db2b3c22d5b1c897238f65d8a961be5d6fadfaf7 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/truth/RungeKutta.hpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/truth/RungeKutta.hpp @@ -1,37 +1,37 @@ -/* -To use the Runge-Kutta solver for systems of first order differential equations, - (the parametric object E must have public function such as E->f(i,x,y), - where i is the index of the function to evaluate, x is the time and - y is a point such as y(x), returns values of differential equation i) - - 1- construct the solver : solver = new RungeKutta<objet>(int); //the integer is the dimension of x - 2- set the solver : solver->set(unit, y0, x0, xn); //unit is usually the pointer *this, y0 are the initial conditions, and x0 and xn is the time interval - 3- launch the solver : bool = solver->run(); //will return true is success, false if the solver failed???????????????????????????? - 4- delete the solver : delete solver; -(ref :Fortin) -*/ -#ifndef RUNGEKUTTA_H -#define RUNGEKUTTA_H - -#include "defines.hpp" -using namespace std; - -template <class E> -class RungeKutta -{ -private: - double *k1, *k2, *k3, *k4, *y_tmp, *y; - // double k1[MAX_DIM], k2[MAX_DIM], k3[MAX_DIM], k4[MAX_DIM], y_tmp[MAX_DIM], y[MAX_DIM]; - double h, x0, xn, x; - int i, j, m; - bool success; - E *unit; - -public: - RungeKutta(int); - ~RungeKutta(); - void set(E*, double*, double, double); - double dx(){return h;} - bool run(); -}; -#endif +/* +To use the Runge-Kutta solver for systems of first order differential equations, + (the parametric object E must have public function such as E->f(i,x,y), + where i is the index of the function to evaluate, x is the time and + y is a point such as y(x), returns values of differential equation i) + + 1- construct the solver : solver = new RungeKutta<objet>(int); //the integer is the dimension of x + 2- set the solver : solver->set(unit, y0, x0, xn); //unit is usually the pointer *this, y0 are the initial conditions, and x0 and xn is the time interval + 3- launch the solver : bool = solver->run(); //will return true is success, false if the solver failed???????????????????????????? + 4- delete the solver : delete solver; +(ref :Fortin) +*/ +#ifndef RUNGEKUTTA_H +#define RUNGEKUTTA_H + +#include "defines.hpp" +using namespace std; + +template <class E> +class RungeKutta +{ +private: + double *k1, *k2, *k3, *k4, *y_tmp, *y; + // double k1[MAX_DIM], k2[MAX_DIM], k3[MAX_DIM], k4[MAX_DIM], y_tmp[MAX_DIM], y[MAX_DIM]; + double h, x0, xn, x; + int i, j, m; + bool success; + E *unit; + +public: + RungeKutta(int); + ~RungeKutta(); + void set(E*, double*, double, double); + double dx(){return h;} + bool run(); +}; +#endif diff --git a/tools/SENSITIVITY/problems/styrene/black-box/truth/bb.cpp b/tools/SENSITIVITY/problems/styrene/black-box/truth/bb.cpp index 4e348d76434f0668bd0b1fece84123a0ac35190a..151727d5c5e3129f1c289e10a40185b8e9de1bfd 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/truth/bb.cpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/truth/bb.cpp @@ -1,361 +1,361 @@ -#include "servor.hpp" -#include "profitability.hpp" -using namespace std; - -/*------------------------------------------------------------------------*/ -/* fonction principale */ -/*------------------------------------------------------------------------*/ -int main ( int argc , char ** argv ) { - - double g0 = 1e+20; - double g1 = 1e+20; - double g2 = 1e+20; - double g3 = 1e+20; - double g4 = 1e+20; - double g5 = 1e+20; - double g6 = 1e+20; - double g7 = 1e+20; - double g8 = 1e+20; - double g9 = 1e+20; - double g10 = 1e+20; - double f = 1e+20; - - bool OK; - ifstream in; - double d; - int i; - int i_stream , i_chem; - double x [8]; - long double tmp[8]; - double raw_cost; - double util_cost; - double Itot; - double Coper; - double Rtot; - double max; - double mtot; - double m; - double purity; - int nb_chem = 7; - int nb_s = 15; - int nb_u = 11; - int n = 8; - double l [8] = { 600 , 2 , 0.0001 , 0.0001 , 2 , 0.01 , 0.1 , 300 }; - double u [8] = { 1100 , 20 , 0.1 , 0.1 , 20 , 0.5 , 5 , 500 }; - double list [7] = { 0.5 , 0 , 0 , 0 , 0 , 0 , 0 }; - double price[7] = { 0 , 0 , 0 , 0 , 0 , 0 , 0 }; - profitability * P = NULL; - cashflow * F = NULL; - chemical ** chem = NULL; - stream ** s = NULL; - servor * units = NULL; - string * safe = NULL; - - // verif. du nombre d'arguments : - if (argc!=2) { - // cout << "\nargc != 2\n\n"; - goto TERMINATE; - } - - // lecture et scaling de x : - // ------------------------- - in.open (argv[1]); - - for ( i = 0 ; i < n ; i++ ) - in >> tmp[i]; - - in.close(); - - if (in.fail()) { - // cout << "\nin.fail (1)\n\n"; - goto TERMINATE; - } - - //for ( i = 0 ; i < n ; i++ ) - // cout << "tmp[" << i << "] = " << tmp[i] << endl; - // cout << endl; - - for ( i = 0 ; i < n ; i++ ) - x[i] = (u[i]-l[i])*((double)tmp[i]/100.0) + l[i]; - - //for ( i = 0 ; i < n ; i++ ) - // cout << "x[" << i << "] = " << x[i] << endl; - - // verifs de x (j'ai pris ca dans checkup et c'est tout ce dont - // ca a besoin de checker ici) : - if ( x[6] < EPS || x[2] < 0 || x[2] > 1 || x[3] < 0 || x[3] > 1 ) - goto TERMINATE; - - // chemicals : - // ----------- - chem = new chemical * [nb_chem]; - chem[0] = new chemical ("100-41-4" ); - chem[1] = new chemical ("1333-74-0"); - chem[2] = new chemical ("108-88-3" ); - chem[3] = new chemical ("74-82-8" ); - chem[4] = new chemical ("71-43-2" ); - chem[5] = new chemical ("74-85-1" ); - chem[6] = new chemical ("100-42-5" ); - - price[6] = 1.39; - price[2] = 0.64; - price[0] = 0.11; - price[4] = 1.19; - - // streams : - // --------- - s = new stream * [nb_s]; - s[ 0] = new stream ( "feed" , nb_chem , chem ); - s[ 1] = new stream ( "2" , nb_chem , chem ); - s[ 2] = new stream ( "3" , nb_chem , chem ); - s[ 3] = new stream ( "4" , nb_chem , chem ); - s[ 4] = new stream ( "5" , nb_chem , chem ); - s[ 5] = new stream ( "6" , nb_chem , chem ); - s[ 6] = new stream ( "7" , nb_chem , chem ); - s[ 7] = new stream ( "8" , nb_chem , chem ); - s[ 8] = new stream ( "9" , nb_chem , chem ); - s[ 9] = new stream ( "10" , nb_chem , chem ); - s[10] = new stream ( "back" , nb_chem , chem ); - s[11] = new stream ( "12" , nb_chem , chem ); - s[12] = new stream ( "stack" , nb_chem , chem ); - s[13] = new stream ( "out-bz" , nb_chem , chem ); - s[14] = new stream ( "out-sty" , nb_chem , chem ); - - // initial conditions on streams : - // ------------------------------- - s[0]->P = 1.0; - s[0]->T = 298; - s[0]->set(list); - - // units settings and calculation sequence : - // ----------------------------------------- - units = new servor ( nb_u , nb_s , s ); - safe = new string[nb_u]; - - units->type[ 0] = "mix"; - units->name[ 0] = safe[ 0] = "mixfeed"; - units->type[ 1] = "pump"; - units->name[ 1] = safe[ 1] = "pump"; - units->type[ 2] = "heatx"; - units->name[ 2] = safe[ 2] = "heater"; - units->type[ 3] = "reactor"; - units->name[ 3] = safe[ 3] = "pfr"; - units->type[ 4] = "heatx"; - units->name[ 4] = safe[ 4] = "cooler"; - units->type[ 5] = "flash"; - units->name[ 5] = safe[ 5] = "degasor"; - units->type[ 6] = "column"; - units->name[ 6] = safe[ 6] = "sep-sty"; - units->type[ 7] = "split"; - units->name[ 7] = safe[ 7] = "spliter"; - units->type[ 8] = "column"; - units->name[ 8] = safe[ 8] = "sep-bz"; - units->type[ 9] = "loop"; - units->name[ 9] = safe[ 9] = "looping"; - units->type[10] = "burner"; - units->name[10] = safe[10] = "fire"; - - - // executing the calculation sequence : - //------------------------------------- - double y[14]; - y[7] = y[8] = 1000.0; - - if (!units->solve_process(x,y)) - goto TERMINATE; - - // on recupere les resultats : - // --------------------------- - y[6] = s[0]->m; - y[3] = s[13]->m; - y[2] = s[13]->chem[4]->m; - y[1] = s[14]->m; - y[0] = s[14]->chem[6]->m; - - y[9 ] = 1e20; - y[10] = 1e20; - y[11] = units->get_costs_sum() * 6.192; - y[12] = 1e20; - y[13] = 1e20; - - // arrondis : - if (ARRONDI) { - y[ 6] = arrondi ( y[ 6] , 4 ); - y[ 3] = arrondi ( y[ 3] , 4 ); - y[ 2] = arrondi ( y[ 2] , 4 ); - y[ 1] = arrondi ( y[ 1] , 4 ); - y[ 0] = arrondi ( y[ 0] , 4 ); - y[11] = arrondi ( y[11] , 6 ); - } - - g0 = ( y[0] > 0 && y[0] < 1e+20 ) ? 0.0 : 1e20; - g1 = ( y[4] <= 80 ) ? 0.0 : 1.0; - g2 = ( y[5] <= 80 ) ? 0.0 : 1.0; - g3 = ( y[7] <= 200 && y[8] <= 8 ) ? 0.0 : 1.0; - g4 = ( y[1] > 0 && y[1] < 1e20 ) ? (0.99-y[0]/y[1])/0.99 : 1e20; - g5 = ( y[3] > 0 && y[3] < 1e20 ) ? (0.99-y[2]/y[3])/0.99 : 1e20; - g6 = ( y[6] > 0 && y[6] < 1e20 ) ? (0.6-y[0]/y[6])/0.6 : 1e20; - - - // bloc econo : - // ------------ - - // raw_cost : - raw_cost = 0.0; - if ( s[0]->m > EPS ) { - if ( s[0]->chem[6]->m > EPS ) { - d = (ARRONDI) ? arrondi ( s[0]->chem[6]->m , 4 ) : s[0]->chem[6]->m; - raw_cost += d * 1.39; - } - if ( s[0]->chem[2]->m > EPS ) { - d = (ARRONDI) ? arrondi ( s[0]->chem[2]->m , 4 ) : s[0]->chem[2]->m; - raw_cost += d * 0.64; - } - if ( s[0]->chem[0]->m > EPS ) { - d = (ARRONDI) ? arrondi ( s[0]->chem[0]->m , 4 ) : s[0]->chem[0]->m; - raw_cost += d * 0.11; - } - if ( s[0]->chem[4]->m > EPS ) { - d = (ARRONDI) ? arrondi ( s[0]->chem[4]->m , 4 ) : s[0]->chem[4]->m; - raw_cost += d * 1.19; - } - } - // raw_cost = raw_cost*3600.0*nb_h*nb_d : - raw_cost *= 25920000; - - // util_cost : - util_cost = (units->get_power_sum() * 0.000125 + units->get_water_sum() * 0.00008) * 25920000; - - // Coper : - Itot = y[11]; - Coper = 0.16 * Itot + 2.26 * raw_cost + util_cost; - - - // Rtot : - Rtot = 0.0; - for ( i_stream = 13 ; i_stream < 15 ; i_stream++ ) { - i_chem = 0; - max = 0.0; - mtot = 0.0; - for ( i = 0 ; i < nb_chem ; i++ ) { - m = (ARRONDI) ? arrondi ( s[i_stream]->chem[i]->m , 4 ) : s[i_stream]->chem[i]->m; - - if ( m > EPS ) { - mtot += m; - if ( m > max ) { - max = m; - i_chem = i; - } - } - } - if (mtot > EPS ) { - purity = max/mtot; - d = price[i_chem] * max; - if ( purity < 0.5 ) - d = 0.0; - else if ( purity < 0.6 ) - d *= 0.05; - else if ( purity < 0.7 ) - d *= 0.1; - else if ( purity < 0.8 ) - d *= 0.15; - else if ( purity < 0.9 ) - d *= 0.3; - else if ( purity < 0.95 ) - d *= 0.5; - else if ( purity < 0.98 ) - d *= 0.6; - else if ( purity < 0.99 ) - d *= 0.8; - else if ( purity > 0.995 ) - d *= 1.1; - Rtot += d*25920000; - } - } - - // cash flows : - F = new cashflow(15); - F->set_rates(0.1,0.4); - F->set_basics(Itot, Coper, Rtot); - OK = F->run(); - - // calculating profitability indicators : - if(OK) { - P = new profitability(F); - OK = P->run(y); - delete P; - } - - delete F; - - // arrondis : - if (ARRONDI) { - y[12] = round(y[12]); - y[13] = round(y[13]); - y[ 9] = round(y[ 9]*10)/10.0; - y[10] = round(y[10]*10)/10.0; - } - - g7 = ( y[ 9] < 1e20 ) ? ( y[9] - 4.0 ) / 4.0 : 1e20; - g8 = ( y[10] < 1e20 ) ? (0.2-y[10])/0.2 : 1e20; - g9 = ( y[11] < 1e20 ) ? (y[11]-10e6)/10e6 : 1e20; - g10 = ( y[12] > 0 && y[12] < 1e20 ) ? (y[12]-15e6) / 15e6 : 1e20; - - f = ( y[13] > 0 && y[13] < 1e20 ) ? -y[13] : 1e20; - -// cout << setprecision(10); -// cout << "\n\n"; -// for ( int i = 0 ; i < 14 ; i++ ) -// cout << "y[" << i << "] = " << y[i] << endl; - - - // menage et affichage du resultat de la boite noire : - TERMINATE: - - // cout << "\n\n"; - // cout << " g0 = " << g0 << endl - // << " g1 = " << g1 << endl - // << " g2 = " << g2 << endl - // << " g3 = " << g3 << endl - // << " g4 = " << g4 << endl - // << " g5 = " << g5 << endl - // << " g6 = " << g6 << endl - // << " g7 = " << g7 << endl - // << " g8 = " << g8 << endl - // << " g9 = " << g9 << endl - // << "g10 = " << g10 << endl - // << " f = " << f << endl; - - - cout << g0 << " " - << g1 << " " - << g2 << " " - << g3 << " " - << g4 << " " - << g5 << " " - << g6 << " " - << g7 << " " - << g8 << " " - << g9 << " " - << g10 << " " - << f << endl; - - if (units) - delete units; - if (safe) - delete [] safe; - - if (chem) { - for ( i = 0 ; i < nb_chem ; i++ ) - delete chem[i]; - delete [] chem; - } - - if (s) { - for ( i = 0 ; i < nb_s ; i++ ) - delete s[i]; - delete [] s; - } - - return 0; -} +#include "servor.hpp" +#include "profitability.hpp" +using namespace std; + +/*------------------------------------------------------------------------*/ +/* fonction principale */ +/*------------------------------------------------------------------------*/ +int main ( int argc , char ** argv ) { + + double g0 = 1e+20; + double g1 = 1e+20; + double g2 = 1e+20; + double g3 = 1e+20; + double g4 = 1e+20; + double g5 = 1e+20; + double g6 = 1e+20; + double g7 = 1e+20; + double g8 = 1e+20; + double g9 = 1e+20; + double g10 = 1e+20; + double f = 1e+20; + + bool OK; + ifstream in; + double d; + int i; + int i_stream , i_chem; + double x [8]; + long double tmp[8]; + double raw_cost; + double util_cost; + double Itot; + double Coper; + double Rtot; + double max; + double mtot; + double m; + double purity; + int nb_chem = 7; + int nb_s = 15; + int nb_u = 11; + int n = 8; + double l [8] = { 600 , 2 , 0.0001 , 0.0001 , 2 , 0.01 , 0.1 , 300 }; + double u [8] = { 1100 , 20 , 0.1 , 0.1 , 20 , 0.5 , 5 , 500 }; + double list [7] = { 0.5 , 0 , 0 , 0 , 0 , 0 , 0 }; + double price[7] = { 0 , 0 , 0 , 0 , 0 , 0 , 0 }; + profitability * P = NULL; + cashflow * F = NULL; + chemical ** chem = NULL; + stream ** s = NULL; + servor * units = NULL; + string * safe = NULL; + + // verif. du nombre d'arguments : + if (argc!=2) { + // cout << "\nargc != 2\n\n"; + goto TERMINATE; + } + + // lecture et scaling de x : + // ------------------------- + in.open (argv[1]); + + for ( i = 0 ; i < n ; i++ ) + in >> tmp[i]; + + in.close(); + + if (in.fail()) { + // cout << "\nin.fail (1)\n\n"; + goto TERMINATE; + } + + //for ( i = 0 ; i < n ; i++ ) + // cout << "tmp[" << i << "] = " << tmp[i] << endl; + // cout << endl; + + for ( i = 0 ; i < n ; i++ ) + x[i] = (u[i]-l[i])*((double)tmp[i]/100.0) + l[i]; + + //for ( i = 0 ; i < n ; i++ ) + // cout << "x[" << i << "] = " << x[i] << endl; + + // verifs de x (j'ai pris ca dans checkup et c'est tout ce dont + // ca a besoin de checker ici) : + if ( x[6] < EPS || x[2] < 0 || x[2] > 1 || x[3] < 0 || x[3] > 1 ) + goto TERMINATE; + + // chemicals : + // ----------- + chem = new chemical * [nb_chem]; + chem[0] = new chemical ("100-41-4" ); + chem[1] = new chemical ("1333-74-0"); + chem[2] = new chemical ("108-88-3" ); + chem[3] = new chemical ("74-82-8" ); + chem[4] = new chemical ("71-43-2" ); + chem[5] = new chemical ("74-85-1" ); + chem[6] = new chemical ("100-42-5" ); + + price[6] = 1.39; + price[2] = 0.64; + price[0] = 0.11; + price[4] = 1.19; + + // streams : + // --------- + s = new stream * [nb_s]; + s[ 0] = new stream ( "feed" , nb_chem , chem ); + s[ 1] = new stream ( "2" , nb_chem , chem ); + s[ 2] = new stream ( "3" , nb_chem , chem ); + s[ 3] = new stream ( "4" , nb_chem , chem ); + s[ 4] = new stream ( "5" , nb_chem , chem ); + s[ 5] = new stream ( "6" , nb_chem , chem ); + s[ 6] = new stream ( "7" , nb_chem , chem ); + s[ 7] = new stream ( "8" , nb_chem , chem ); + s[ 8] = new stream ( "9" , nb_chem , chem ); + s[ 9] = new stream ( "10" , nb_chem , chem ); + s[10] = new stream ( "back" , nb_chem , chem ); + s[11] = new stream ( "12" , nb_chem , chem ); + s[12] = new stream ( "stack" , nb_chem , chem ); + s[13] = new stream ( "out-bz" , nb_chem , chem ); + s[14] = new stream ( "out-sty" , nb_chem , chem ); + + // initial conditions on streams : + // ------------------------------- + s[0]->P = 1.0; + s[0]->T = 298; + s[0]->set(list); + + // units settings and calculation sequence : + // ----------------------------------------- + units = new servor ( nb_u , nb_s , s ); + safe = new string[nb_u]; + + units->type[ 0] = "mix"; + units->name[ 0] = safe[ 0] = "mixfeed"; + units->type[ 1] = "pump"; + units->name[ 1] = safe[ 1] = "pump"; + units->type[ 2] = "heatx"; + units->name[ 2] = safe[ 2] = "heater"; + units->type[ 3] = "reactor"; + units->name[ 3] = safe[ 3] = "pfr"; + units->type[ 4] = "heatx"; + units->name[ 4] = safe[ 4] = "cooler"; + units->type[ 5] = "flash"; + units->name[ 5] = safe[ 5] = "degasor"; + units->type[ 6] = "column"; + units->name[ 6] = safe[ 6] = "sep-sty"; + units->type[ 7] = "split"; + units->name[ 7] = safe[ 7] = "spliter"; + units->type[ 8] = "column"; + units->name[ 8] = safe[ 8] = "sep-bz"; + units->type[ 9] = "loop"; + units->name[ 9] = safe[ 9] = "looping"; + units->type[10] = "burner"; + units->name[10] = safe[10] = "fire"; + + + // executing the calculation sequence : + //------------------------------------- + double y[14]; + y[7] = y[8] = 1000.0; + + if (!units->solve_process(x,y)) + goto TERMINATE; + + // on recupere les resultats : + // --------------------------- + y[6] = s[0]->m; + y[3] = s[13]->m; + y[2] = s[13]->chem[4]->m; + y[1] = s[14]->m; + y[0] = s[14]->chem[6]->m; + + y[9 ] = 1e20; + y[10] = 1e20; + y[11] = units->get_costs_sum() * 6.192; + y[12] = 1e20; + y[13] = 1e20; + + // arrondis : + if (ARRONDI) { + y[ 6] = arrondi ( y[ 6] , 4 ); + y[ 3] = arrondi ( y[ 3] , 4 ); + y[ 2] = arrondi ( y[ 2] , 4 ); + y[ 1] = arrondi ( y[ 1] , 4 ); + y[ 0] = arrondi ( y[ 0] , 4 ); + y[11] = arrondi ( y[11] , 6 ); + } + + g0 = ( y[0] > 0 && y[0] < 1e+20 ) ? 0.0 : 1e20; + g1 = ( y[4] <= 80 ) ? 0.0 : 1.0; + g2 = ( y[5] <= 80 ) ? 0.0 : 1.0; + g3 = ( y[7] <= 200 && y[8] <= 8 ) ? 0.0 : 1.0; + g4 = ( y[1] > 0 && y[1] < 1e20 ) ? (0.99-y[0]/y[1])/0.99 : 1e20; + g5 = ( y[3] > 0 && y[3] < 1e20 ) ? (0.99-y[2]/y[3])/0.99 : 1e20; + g6 = ( y[6] > 0 && y[6] < 1e20 ) ? (0.6-y[0]/y[6])/0.6 : 1e20; + + + // bloc econo : + // ------------ + + // raw_cost : + raw_cost = 0.0; + if ( s[0]->m > EPS ) { + if ( s[0]->chem[6]->m > EPS ) { + d = (ARRONDI) ? arrondi ( s[0]->chem[6]->m , 4 ) : s[0]->chem[6]->m; + raw_cost += d * 1.39; + } + if ( s[0]->chem[2]->m > EPS ) { + d = (ARRONDI) ? arrondi ( s[0]->chem[2]->m , 4 ) : s[0]->chem[2]->m; + raw_cost += d * 0.64; + } + if ( s[0]->chem[0]->m > EPS ) { + d = (ARRONDI) ? arrondi ( s[0]->chem[0]->m , 4 ) : s[0]->chem[0]->m; + raw_cost += d * 0.11; + } + if ( s[0]->chem[4]->m > EPS ) { + d = (ARRONDI) ? arrondi ( s[0]->chem[4]->m , 4 ) : s[0]->chem[4]->m; + raw_cost += d * 1.19; + } + } + // raw_cost = raw_cost*3600.0*nb_h*nb_d : + raw_cost *= 25920000; + + // util_cost : + util_cost = (units->get_power_sum() * 0.000125 + units->get_water_sum() * 0.00008) * 25920000; + + // Coper : + Itot = y[11]; + Coper = 0.16 * Itot + 2.26 * raw_cost + util_cost; + + + // Rtot : + Rtot = 0.0; + for ( i_stream = 13 ; i_stream < 15 ; i_stream++ ) { + i_chem = 0; + max = 0.0; + mtot = 0.0; + for ( i = 0 ; i < nb_chem ; i++ ) { + m = (ARRONDI) ? arrondi ( s[i_stream]->chem[i]->m , 4 ) : s[i_stream]->chem[i]->m; + + if ( m > EPS ) { + mtot += m; + if ( m > max ) { + max = m; + i_chem = i; + } + } + } + if (mtot > EPS ) { + purity = max/mtot; + d = price[i_chem] * max; + if ( purity < 0.5 ) + d = 0.0; + else if ( purity < 0.6 ) + d *= 0.05; + else if ( purity < 0.7 ) + d *= 0.1; + else if ( purity < 0.8 ) + d *= 0.15; + else if ( purity < 0.9 ) + d *= 0.3; + else if ( purity < 0.95 ) + d *= 0.5; + else if ( purity < 0.98 ) + d *= 0.6; + else if ( purity < 0.99 ) + d *= 0.8; + else if ( purity > 0.995 ) + d *= 1.1; + Rtot += d*25920000; + } + } + + // cash flows : + F = new cashflow(15); + F->set_rates(0.1,0.4); + F->set_basics(Itot, Coper, Rtot); + OK = F->run(); + + // calculating profitability indicators : + if(OK) { + P = new profitability(F); + OK = P->run(y); + delete P; + } + + delete F; + + // arrondis : + if (ARRONDI) { + y[12] = round(y[12]); + y[13] = round(y[13]); + y[ 9] = round(y[ 9]*10)/10.0; + y[10] = round(y[10]*10)/10.0; + } + + g7 = ( y[ 9] < 1e20 ) ? ( y[9] - 4.0 ) / 4.0 : 1e20; + g8 = ( y[10] < 1e20 ) ? (0.2-y[10])/0.2 : 1e20; + g9 = ( y[11] < 1e20 ) ? (y[11]-10e6)/10e6 : 1e20; + g10 = ( y[12] > 0 && y[12] < 1e20 ) ? (y[12]-15e6) / 15e6 : 1e20; + + f = ( y[13] > 0 && y[13] < 1e20 ) ? -y[13] : 1e20; + +// cout << setprecision(10); +// cout << "\n\n"; +// for ( int i = 0 ; i < 14 ; i++ ) +// cout << "y[" << i << "] = " << y[i] << endl; + + + // menage et affichage du resultat de la boite noire : + TERMINATE: + + // cout << "\n\n"; + // cout << " g0 = " << g0 << endl + // << " g1 = " << g1 << endl + // << " g2 = " << g2 << endl + // << " g3 = " << g3 << endl + // << " g4 = " << g4 << endl + // << " g5 = " << g5 << endl + // << " g6 = " << g6 << endl + // << " g7 = " << g7 << endl + // << " g8 = " << g8 << endl + // << " g9 = " << g9 << endl + // << "g10 = " << g10 << endl + // << " f = " << f << endl; + + + cout << g0 << " " + << g1 << " " + << g2 << " " + << g3 << " " + << g4 << " " + << g5 << " " + << g6 << " " + << g7 << " " + << g8 << " " + << g9 << " " + << g10 << " " + << f << endl; + + if (units) + delete units; + if (safe) + delete [] safe; + + if (chem) { + for ( i = 0 ; i < nb_chem ; i++ ) + delete chem[i]; + delete [] chem; + } + + if (s) { + for ( i = 0 ; i < nb_s ; i++ ) + delete s[i]; + delete [] s; + } + + return 0; +} diff --git a/tools/SENSITIVITY/problems/styrene/black-box/truth/bissection.cpp b/tools/SENSITIVITY/problems/styrene/black-box/truth/bissection.cpp index d23a93996575be1c12c1d6a882367d2444a7fd60..60e3d3883204076214d950171deff58a7ccc7809 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/truth/bissection.cpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/truth/bissection.cpp @@ -1,27 +1,27 @@ -#include "bissection.hpp" -using namespace std; - -template <class E> -bool bissection<E>::run() -{ - for (i=1; i<MAX_ITER_BISSECTION; i++) - { - xm=(x1+x2)/2; - // if(DEBUG) cout<<endl<<x1<<" "<<xm<<" "<<x2; - if (fabs(x1-x2)/fabs(xm) < TOL_BISSECTION) - { - i=MAX_ITER_BISSECTION; - OK=true; - } - else - { - f1 = unit->f(x1); - fm = unit->f(xm); - f2 = unit->f(x2); - if (f1*fm < 0.0) x2 = xm; - if (fm*f2 < 0.0) x1 = xm; - } - } - // if (DEBUG) system("pause"); - return OK; -} +#include "bissection.hpp" +using namespace std; + +template <class E> +bool bissection<E>::run() +{ + for (i=1; i<MAX_ITER_BISSECTION; i++) + { + xm=(x1+x2)/2; + // if(DEBUG) cout<<endl<<x1<<" "<<xm<<" "<<x2; + if (fabs(x1-x2)/fabs(xm) < TOL_BISSECTION) + { + i=MAX_ITER_BISSECTION; + OK=true; + } + else + { + f1 = unit->f(x1); + fm = unit->f(xm); + f2 = unit->f(x2); + if (f1*fm < 0.0) x2 = xm; + if (fm*f2 < 0.0) x1 = xm; + } + } + // if (DEBUG) system("pause"); + return OK; +} diff --git a/tools/SENSITIVITY/problems/styrene/black-box/truth/bissection.hpp b/tools/SENSITIVITY/problems/styrene/black-box/truth/bissection.hpp index 18d4ee6b1cd2949f7b3e8206a5c88629006bca25..c277e299792392a6a4331b44dfd49b60a7f53e16 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/truth/bissection.hpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/truth/bissection.hpp @@ -1,31 +1,31 @@ -/* -To use the bissection solver to find the root of a scalar function -when the secant solver fails. - (the parametric object E must have public function such as E->f(x), - where x is the point at which evaluate f.) - 1- construct the solver : solver = new bissect<E>(); - 2- set the solver : solver->set(unit, x0, x1); //unit is usually the pointer *this, and x0 and x1 are the interval's bounds - 3- launch the solver : bool = solver->run(); //will return true is success, false if the solver failed -*/ -#ifndef BISSECTION_H -#define BISSECTION_H - -#include "defines.hpp" -using namespace std; - -template <class E> -class bissection { -private: - double x1, xm, x2; - double f1, fm, f2; - int i; - bool OK; - E *unit; - -public: - bissection(){x1=xm=x2=f1=fm=f2=0; OK=false;} - void set(E* tmp, double xx1, double xx2) {unit=tmp; x1=xx1; x2=xx2;} - bool run(); - ~bissection(){} -}; -#endif +/* +To use the bissection solver to find the root of a scalar function +when the secant solver fails. + (the parametric object E must have public function such as E->f(x), + where x is the point at which evaluate f.) + 1- construct the solver : solver = new bissect<E>(); + 2- set the solver : solver->set(unit, x0, x1); //unit is usually the pointer *this, and x0 and x1 are the interval's bounds + 3- launch the solver : bool = solver->run(); //will return true is success, false if the solver failed +*/ +#ifndef BISSECTION_H +#define BISSECTION_H + +#include "defines.hpp" +using namespace std; + +template <class E> +class bissection { +private: + double x1, xm, x2; + double f1, fm, f2; + int i; + bool OK; + E *unit; + +public: + bissection(){x1=xm=x2=f1=fm=f2=0; OK=false;} + void set(E* tmp, double xx1, double xx2) {unit=tmp; x1=xx1; x2=xx2;} + bool run(); + ~bissection(){} +}; +#endif diff --git a/tools/SENSITIVITY/problems/styrene/black-box/truth/burner.cpp b/tools/SENSITIVITY/problems/styrene/black-box/truth/burner.cpp index 1b6f36b09550b2585fa78071983f0f77fc9d4576..eb8a223bf429389fe9ad4b3d8b59b914331d7cc6 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/truth/burner.cpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/truth/burner.cpp @@ -1,287 +1,287 @@ -#include "burner.hpp" -using namespace std; - -/*----------------------------------------------------------*/ -/* arrondi pour ne conserver que n chiffres significatifs */ -/*----------------------------------------------------------*/ -double arrondi ( double x , int n ) { - if (fabs(x) < EPS) - return 0.0; - double m = pow ( 10 , ceil(-log10(x)) + n - 1 ); - return round(m*x)/m; -} - -/*---------------------------------------------------------------*/ -burner::burner ( int nb , chemical ** chem ) { - - rem_nb = nb; - - NO=NO2=N2O=CO=0.0; - m = new double[nb]; - can_burn = new bool[nb]; - - // combustion.prop : - // ----------------- - // 64-17-5 3 2 3 - // 74-82-8 2 1 2 - // 1333-74-0 0.5 0 1 - // 100-42-5 10 8 4 - // 74-85-1 3 2 2 - // 108-88-3 9 7 4 - // 100-41-4 10.5 8 5 - // 71-43-2 7.5 6 3 - - for ( i = 0 ; i < nb ; i++ ) { - - can_burn[i] = false; - - if ( chem[i]->CAS == "64-17-5" || - chem[i]->CAS == "74-82-8" || - chem[i]->CAS == "1333-74-0" || - chem[i]->CAS == "100-42-5" || - chem[i]->CAS == "74-85-1" || - chem[i]->CAS == "108-88-3" || - chem[i]->CAS == "100-41-4" || - chem[i]->CAS == "71-43-2" ) - can_burn[i] = true; - } - - O2 = new chemical ("7782-44-7"); - N2 = new chemical ("7727-37-9"); - CO2 = new chemical ("124-38-9"); - H2O = new chemical ("7732-18-5"); - - // Construct the rx array; - rx = new combrx * [nb]; - for ( i = 0 ; i < nb ; i++ ) { - if ( can_burn[i] ) - rx[i] = new combrx ( chem[i]->CAS ); - else - rx[i] = NULL; - } -} - -/*---------------------------------------------------------------*/ -burner::~burner ( void ) { - - delete [] m; - delete [] can_burn; - - for ( i = 0 ; i < rem_nb ; i++ ) - if (rx[i]) - delete rx[i]; - delete [] rx; - - delete O2; - delete N2; - delete CO2; - delete H2O; -} - -/*---------------------------------------------------------------*/ -bool burner::solve(double * y) -{ - OK=true; - //perform mass balance (neglect pollutants flows) - out->m = 0.0; - for(i=0;i<in->nb;i++) - { - if (!can_burn[i]) { - out->chem[i]->m = in->chem[i]->m; - out->m+=out->chem[i]->m; - } - else { - out->chem[i]->m=0.0; - O2->m+=rx[i]->O2_flow()*in->chem[i]->n(); - N2->m+=rx[i]->N2_flow()*in->chem[i]->n(); - CO2->m+=rx[i]->CO2_flow()*in->chem[i]->n(); - H2O->m+=rx[i]->H2O_flow()*in->chem[i]->n(); - } - } - N2->m*=(1.0+eta); - O2->m*=(1.0+eta); - //perform energy balance to find Tout - T = in->T; - - step=10; - Q=1; - // find temperature - while (fabs(step)>TOL_BURN && fabs(Q)>TOL_BURN && T<MAX_TEMP) - { - T+=step; - - if(T>MAX_TEMP) - T=MAX_TEMP; - Q = 0.0; - for ( i = 0 ; i < in->nb ; i++ ) - Q += in->chem[i]->dH ( in->T , T , in->P ) * in->chem[i]->n(); - - for ( i = 0 ; i < in->nb ; i++ ) - if ( can_burn[i] ) - Q += rx[i]->Hcomb(T) * in->chem[i]->n(); - - Q += O2->dH ( 293 , T , in->P ) * O2->n(); - Q += N2->dH ( 293 , T , in->P ) * N2->n(); - - - if (step/fabs(step)*Q >0) - step*= -0.1; - else if (fabs(Q)<10) - step*=0.25; - - } - - - - out->set_thermo(in->thermo); - // out->thermo = in->thermo; - - out->set(in->P, T); - O2->P=in->P; O2->T=T; O2->state=1; O2->find_v(); - N2->P=in->P; N2->T=T; N2->state=1; N2->find_v(); - CO2->P=in->P; CO2->T=T; CO2->state=1; CO2->find_v(); - H2O->P=in->P; H2O->T=T; H2O->state=1; H2O->find_v(); - //check if mixture can burn - m_can_burn = 0.0; - for(i=0;i<in->nb;i++) if(can_burn[i]) m_can_burn+=in->chem[i]->n(); - LFLmix=0.0; - for(i=0;i<in->nb;i++) if(can_burn[i]) LFLmix+=in->chem[i]->n()/m_can_burn*rx[i]->LFL(in->P,T); - UFLmix=0.0; - for(i=0;i<in->nb;i++) if(can_burn[i]) UFLmix+=in->chem[i]->n()/m_can_burn*rx[i]->UFL(in->P,T); - num = 0.0; - buff=in->T; in->set(in->P, T); - for(i=0;i<in->nb;i++) if(can_burn[i]) num+=in->chem[i]->n()/in->n()*in->v; - in->set(in->P, buff); - den = O2->v+N2->v+out->v; - composition = num/den; - if(!(LFLmix<=composition && composition<=UFLmix) || T==MAX_TEMP) - { -// logf.open(MESSAGES,ios::app); -// logf<<" --> Warning <-- Mixture in "<<name<<" can't burn (LFL="<<LFLmix -// <<" UFL="<<UFLmix<<" x="<<composition<<").\n"; -// logf.close(); - T=in->T; - filename = out->name; - *out=*in; - out->set(filename); - // out->write(); // WRITE TOTO - OK=false; - } - else - { - O2->P=in->P; O2->T=T; O2->state=1; O2->find_v(); - N2->P=in->P; N2->T=T; N2->state=1; N2->find_v(); - // out->write(); // WRITE TOTO - } - if(OK) //compute the pollutants production - { - fill_K_array(); - NO = 1e6*sqrt(K[0]*(N2->n()/den)*(O2->n()/den))*den*0.03/(O2->m+N2->m+out->m+H2O->m+CO2->m); - N2O = 1e6*K[1]*(N2->n()/den)*sqrt(O2->n()/den)*den*0.044/(O2->m+N2->m+out->m+H2O->m+CO2->m); - NO2 = 1e6*K[2]*sqrt(N2->n()/den)*(O2->n()/den)*den*0.046/(O2->m+N2->m+out->m+H2O->m+CO2->m); - CO = 1e6*K[3]*(CO2->n()/den)*den/sqrt(O2->n()/den)*0.028/(O2->m+N2->m+out->m+H2O->m+CO2->m); - } -// logf.open(MESSAGES,ios::app); - if (NO>EPS && NO2>EPS && N2O>EPS) { - // logf<<" --> Warning <-- Presence of NOx: "<<(NO+NO2+N2O)<<" ppm in "<<name<<".\n"; - y[7] = NO+NO2+N2O; - - if (ARRONDI) - y[7] = arrondi ( y[7] , 6 ); - - } - if (CO>EPS) { - // logf<<" --> Warning <-- Presence of CO: "<<CO<<" ppm in "<<name<<".\n"; - y[8] = CO; - if (ARRONDI) - y[8] = arrondi ( y[8] , 6 ); - - } -// logf.close(); - return OK; -} - -void burner::fill_K_array() -{ - a[0]=1.0; a[1]=1.0; a[2]=0.5; a[3]=1.0; - b[0]=1.0; b[1]=0.5; b[2]=1.0; b[3]=-0.5; - c[0]=2.0; c[1]=1.0; c[2]=1.0; c[3]=1.0; - K[0] = exp(-120.27*(173.38-T*0.012)/T); - K[1] = exp(-120.27*(103.64+T*0.074)/T); - K[2] = exp(-120.27*(51.96+T*0.061)/T); - K[3] = exp(-120.27*(283.84-T*0.087)/T); - for(i=0;i<4;i++) - K[i]*=pow(1000, c[i]-a[i]-b[i]); -} - -void burner::write() { - - cout << setprecision(6); - - cout << "WRITE FILE " << RUNTIME << name << ".unit" << " :\n\tBEGIN\n"; - cout << "\t>> " << name; - cout << endl << "\t>> stream in : " << in->name; - cout << endl << "\t>> streams out : " << out->name; - cout << endl << "\t>> P = " << in->P << " atm, T(in) = " << in->T - << " T(out) = " << T << " K"; - O2->P = 1; - O2->T = 293; - O2->state = 1; - O2->find_v(); - N2->P=1; - N2->T=293; - N2->state=1; - N2->find_v(); - cout << endl << "\t>> Required air flow = " - << (O2->m+N2->m) << " kg/s (" << (O2->v+N2->v) << " m3/s)"; - O2->P=in->P; - O2->T=T; - O2->state=1; - O2->find_v(); - N2->P=in->P; - N2->T=T; - N2->state=1; - N2->find_v(); - step=(eta*O2->v/(1+eta)+N2->v+H2O->v+CO2->v+out->v); - cout << endl << "\t>> Total flue gases = " - << (out->m+CO2->m+H2O->m+N2->m+eta*O2->m/(1+eta)) - <<" kg/s (" << step << " m3/s)"; - cout << "\n\tEND\n\n"; - cost(); -} - - -double burner::get_cost ( void ) { - - - O2->P = 1; - O2->T = 293; - O2->state = 1; - O2->find_v(); - N2->P=1; - N2->T=293; - N2->state=1; - N2->find_v(); - O2->P=in->P; - O2->T=T; - O2->state=1; - O2->find_v(); - N2->P=in->P; - N2->T=T; - N2->state=1; - N2->find_v(); - step=(eta*O2->v/(1+eta)+N2->v+H2O->v+CO2->v+out->v); - - buff = 3.1761-0.1373*log10(step) + 0.3414*pow(log10(step),2); - buff = 2.7*pow(10, buff); - buff = buff*MS_YEAR/MS_2001; - - return buff; -} - - -void burner::cost ( void ) { - cout << "WRITE FILE " << RUNTIME << name << ".cost" << " :\n\tBEGIN\n"; - cout << "\t>>" << get_cost(); - cout << "\n\tEND\n\n"; -} +#include "burner.hpp" +using namespace std; + +/*----------------------------------------------------------*/ +/* arrondi pour ne conserver que n chiffres significatifs */ +/*----------------------------------------------------------*/ +double arrondi ( double x , int n ) { + if (fabs(x) < EPS) + return 0.0; + double m = pow ( 10 , ceil(-log10(x)) + n - 1 ); + return round(m*x)/m; +} + +/*---------------------------------------------------------------*/ +burner::burner ( int nb , chemical ** chem ) { + + rem_nb = nb; + + NO=NO2=N2O=CO=0.0; + m = new double[nb]; + can_burn = new bool[nb]; + + // combustion.prop : + // ----------------- + // 64-17-5 3 2 3 + // 74-82-8 2 1 2 + // 1333-74-0 0.5 0 1 + // 100-42-5 10 8 4 + // 74-85-1 3 2 2 + // 108-88-3 9 7 4 + // 100-41-4 10.5 8 5 + // 71-43-2 7.5 6 3 + + for ( i = 0 ; i < nb ; i++ ) { + + can_burn[i] = false; + + if ( chem[i]->CAS == "64-17-5" || + chem[i]->CAS == "74-82-8" || + chem[i]->CAS == "1333-74-0" || + chem[i]->CAS == "100-42-5" || + chem[i]->CAS == "74-85-1" || + chem[i]->CAS == "108-88-3" || + chem[i]->CAS == "100-41-4" || + chem[i]->CAS == "71-43-2" ) + can_burn[i] = true; + } + + O2 = new chemical ("7782-44-7"); + N2 = new chemical ("7727-37-9"); + CO2 = new chemical ("124-38-9"); + H2O = new chemical ("7732-18-5"); + + // Construct the rx array; + rx = new combrx * [nb]; + for ( i = 0 ; i < nb ; i++ ) { + if ( can_burn[i] ) + rx[i] = new combrx ( chem[i]->CAS ); + else + rx[i] = NULL; + } +} + +/*---------------------------------------------------------------*/ +burner::~burner ( void ) { + + delete [] m; + delete [] can_burn; + + for ( i = 0 ; i < rem_nb ; i++ ) + if (rx[i]) + delete rx[i]; + delete [] rx; + + delete O2; + delete N2; + delete CO2; + delete H2O; +} + +/*---------------------------------------------------------------*/ +bool burner::solve(double * y) +{ + OK=true; + //perform mass balance (neglect pollutants flows) + out->m = 0.0; + for(i=0;i<in->nb;i++) + { + if (!can_burn[i]) { + out->chem[i]->m = in->chem[i]->m; + out->m+=out->chem[i]->m; + } + else { + out->chem[i]->m=0.0; + O2->m+=rx[i]->O2_flow()*in->chem[i]->n(); + N2->m+=rx[i]->N2_flow()*in->chem[i]->n(); + CO2->m+=rx[i]->CO2_flow()*in->chem[i]->n(); + H2O->m+=rx[i]->H2O_flow()*in->chem[i]->n(); + } + } + N2->m*=(1.0+eta); + O2->m*=(1.0+eta); + //perform energy balance to find Tout + T = in->T; + + step=10; + Q=1; + // find temperature + while (fabs(step)>TOL_BURN && fabs(Q)>TOL_BURN && T<MAX_TEMP) + { + T+=step; + + if(T>MAX_TEMP) + T=MAX_TEMP; + Q = 0.0; + for ( i = 0 ; i < in->nb ; i++ ) + Q += in->chem[i]->dH ( in->T , T , in->P ) * in->chem[i]->n(); + + for ( i = 0 ; i < in->nb ; i++ ) + if ( can_burn[i] ) + Q += rx[i]->Hcomb(T) * in->chem[i]->n(); + + Q += O2->dH ( 293 , T , in->P ) * O2->n(); + Q += N2->dH ( 293 , T , in->P ) * N2->n(); + + + if (step/fabs(step)*Q >0) + step*= -0.1; + else if (fabs(Q)<10) + step*=0.25; + + } + + + + out->set_thermo(in->thermo); + // out->thermo = in->thermo; + + out->set(in->P, T); + O2->P=in->P; O2->T=T; O2->state=1; O2->find_v(); + N2->P=in->P; N2->T=T; N2->state=1; N2->find_v(); + CO2->P=in->P; CO2->T=T; CO2->state=1; CO2->find_v(); + H2O->P=in->P; H2O->T=T; H2O->state=1; H2O->find_v(); + //check if mixture can burn + m_can_burn = 0.0; + for(i=0;i<in->nb;i++) if(can_burn[i]) m_can_burn+=in->chem[i]->n(); + LFLmix=0.0; + for(i=0;i<in->nb;i++) if(can_burn[i]) LFLmix+=in->chem[i]->n()/m_can_burn*rx[i]->LFL(in->P,T); + UFLmix=0.0; + for(i=0;i<in->nb;i++) if(can_burn[i]) UFLmix+=in->chem[i]->n()/m_can_burn*rx[i]->UFL(in->P,T); + num = 0.0; + buff=in->T; in->set(in->P, T); + for(i=0;i<in->nb;i++) if(can_burn[i]) num+=in->chem[i]->n()/in->n()*in->v; + in->set(in->P, buff); + den = O2->v+N2->v+out->v; + composition = num/den; + if(!(LFLmix<=composition && composition<=UFLmix) || T==MAX_TEMP) + { +// logf.open(MESSAGES,ios::app); +// logf<<" --> Warning <-- Mixture in "<<name<<" can't burn (LFL="<<LFLmix +// <<" UFL="<<UFLmix<<" x="<<composition<<").\n"; +// logf.close(); + T=in->T; + filename = out->name; + *out=*in; + out->set(filename); + // out->write(); // WRITE TOTO + OK=false; + } + else + { + O2->P=in->P; O2->T=T; O2->state=1; O2->find_v(); + N2->P=in->P; N2->T=T; N2->state=1; N2->find_v(); + // out->write(); // WRITE TOTO + } + if(OK) //compute the pollutants production + { + fill_K_array(); + NO = 1e6*sqrt(K[0]*(N2->n()/den)*(O2->n()/den))*den*0.03/(O2->m+N2->m+out->m+H2O->m+CO2->m); + N2O = 1e6*K[1]*(N2->n()/den)*sqrt(O2->n()/den)*den*0.044/(O2->m+N2->m+out->m+H2O->m+CO2->m); + NO2 = 1e6*K[2]*sqrt(N2->n()/den)*(O2->n()/den)*den*0.046/(O2->m+N2->m+out->m+H2O->m+CO2->m); + CO = 1e6*K[3]*(CO2->n()/den)*den/sqrt(O2->n()/den)*0.028/(O2->m+N2->m+out->m+H2O->m+CO2->m); + } +// logf.open(MESSAGES,ios::app); + if (NO>EPS && NO2>EPS && N2O>EPS) { + // logf<<" --> Warning <-- Presence of NOx: "<<(NO+NO2+N2O)<<" ppm in "<<name<<".\n"; + y[7] = NO+NO2+N2O; + + if (ARRONDI) + y[7] = arrondi ( y[7] , 6 ); + + } + if (CO>EPS) { + // logf<<" --> Warning <-- Presence of CO: "<<CO<<" ppm in "<<name<<".\n"; + y[8] = CO; + if (ARRONDI) + y[8] = arrondi ( y[8] , 6 ); + + } +// logf.close(); + return OK; +} + +void burner::fill_K_array() +{ + a[0]=1.0; a[1]=1.0; a[2]=0.5; a[3]=1.0; + b[0]=1.0; b[1]=0.5; b[2]=1.0; b[3]=-0.5; + c[0]=2.0; c[1]=1.0; c[2]=1.0; c[3]=1.0; + K[0] = exp(-120.27*(173.38-T*0.012)/T); + K[1] = exp(-120.27*(103.64+T*0.074)/T); + K[2] = exp(-120.27*(51.96+T*0.061)/T); + K[3] = exp(-120.27*(283.84-T*0.087)/T); + for(i=0;i<4;i++) + K[i]*=pow(1000, c[i]-a[i]-b[i]); +} + +void burner::write() { + + cout << setprecision(6); + + cout << "WRITE FILE " << RUNTIME << name << ".unit" << " :\n\tBEGIN\n"; + cout << "\t>> " << name; + cout << endl << "\t>> stream in : " << in->name; + cout << endl << "\t>> streams out : " << out->name; + cout << endl << "\t>> P = " << in->P << " atm, T(in) = " << in->T + << " T(out) = " << T << " K"; + O2->P = 1; + O2->T = 293; + O2->state = 1; + O2->find_v(); + N2->P=1; + N2->T=293; + N2->state=1; + N2->find_v(); + cout << endl << "\t>> Required air flow = " + << (O2->m+N2->m) << " kg/s (" << (O2->v+N2->v) << " m3/s)"; + O2->P=in->P; + O2->T=T; + O2->state=1; + O2->find_v(); + N2->P=in->P; + N2->T=T; + N2->state=1; + N2->find_v(); + step=(eta*O2->v/(1+eta)+N2->v+H2O->v+CO2->v+out->v); + cout << endl << "\t>> Total flue gases = " + << (out->m+CO2->m+H2O->m+N2->m+eta*O2->m/(1+eta)) + <<" kg/s (" << step << " m3/s)"; + cout << "\n\tEND\n\n"; + cost(); +} + + +double burner::get_cost ( void ) { + + + O2->P = 1; + O2->T = 293; + O2->state = 1; + O2->find_v(); + N2->P=1; + N2->T=293; + N2->state=1; + N2->find_v(); + O2->P=in->P; + O2->T=T; + O2->state=1; + O2->find_v(); + N2->P=in->P; + N2->T=T; + N2->state=1; + N2->find_v(); + step=(eta*O2->v/(1+eta)+N2->v+H2O->v+CO2->v+out->v); + + buff = 3.1761-0.1373*log10(step) + 0.3414*pow(log10(step),2); + buff = 2.7*pow(10, buff); + buff = buff*MS_YEAR/MS_2001; + + return buff; +} + + +void burner::cost ( void ) { + cout << "WRITE FILE " << RUNTIME << name << ".cost" << " :\n\tBEGIN\n"; + cout << "\t>>" << get_cost(); + cout << "\n\tEND\n\n"; +} diff --git a/tools/SENSITIVITY/problems/styrene/black-box/truth/burner.hpp b/tools/SENSITIVITY/problems/styrene/black-box/truth/burner.hpp index 310df0d78663669e1536c1f38750c21102828ee6..3d834032e5fc8480aa17f95b94b71a9d9fc9cf98 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/truth/burner.hpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/truth/burner.hpp @@ -1,59 +1,59 @@ -/* -This unit simulates a burner. The user must provide the air excess -and all combustion data as defined in data\\combustion.prop : - CAS nb_moles_O2 nb_moles_CO2 nb_moles_H2O -Then, mass and energy balances are performed and flows of common -combustion pollutants are estimated. -(reference : Crowl & Louvar) - -Structure in the .process file: -burner {name} {index of input stream} {index of output stream} {air excess >0 (ex.: 1.2 is a 120% excess)} - -How to use: - 1- Call the constructor: burn = new burner(in, out); burner(nb_in, chem_list) - ->set(in, out) - 2- Set the air excess : burn->set(excess); - 3- Set the name of the unit: burn->set(name); - 4- Solve: bool=burn->solve(); -*/ -#ifndef BURNER_H -#define BURNER_H -#include "stream.hpp" -#include "combrx.hpp" -using namespace std; - -class burner -{ -private: - - string filename; - int rem_nb; - stream *in, *out; - chemical *O2, *N2, *CO2, *H2O; - combrx **rx; - bool *can_burn, stop, OK; - double eta, NO, NO2, N2O, CO; - double T, LFLmix, UFLmix, composition; - string name; - double * m; - double a[4], b[4], c[4], K[4]; - int i; - double buff, Q, m_can_burn, step, num, den; - ifstream data; - // ofstream logf, results; - // terminator *end; - void fill_K_array(); - -public: - // burner(){}; - burner ( int , chemical ** ); - void set ( stream * s1 , stream * s2 ) { in=s1; out=s2; for(i=0;i<in->nb;i++) m[i] = in->chem[i]->m;} - void set ( const string & n ) { name = n; } - void set(double e) {eta = e;} - bool solve(double * y); - void write(); - void cost(); - double get_cost ( void ); - ~burner(); -}; -#endif +/* +This unit simulates a burner. The user must provide the air excess +and all combustion data as defined in data\\combustion.prop : + CAS nb_moles_O2 nb_moles_CO2 nb_moles_H2O +Then, mass and energy balances are performed and flows of common +combustion pollutants are estimated. +(reference : Crowl & Louvar) + +Structure in the .process file: +burner {name} {index of input stream} {index of output stream} {air excess >0 (ex.: 1.2 is a 120% excess)} + +How to use: + 1- Call the constructor: burn = new burner(in, out); burner(nb_in, chem_list) + ->set(in, out) + 2- Set the air excess : burn->set(excess); + 3- Set the name of the unit: burn->set(name); + 4- Solve: bool=burn->solve(); +*/ +#ifndef BURNER_H +#define BURNER_H +#include "stream.hpp" +#include "combrx.hpp" +using namespace std; + +class burner +{ +private: + + string filename; + int rem_nb; + stream *in, *out; + chemical *O2, *N2, *CO2, *H2O; + combrx **rx; + bool *can_burn, stop, OK; + double eta, NO, NO2, N2O, CO; + double T, LFLmix, UFLmix, composition; + string name; + double * m; + double a[4], b[4], c[4], K[4]; + int i; + double buff, Q, m_can_burn, step, num, den; + ifstream data; + // ofstream logf, results; + // terminator *end; + void fill_K_array(); + +public: + // burner(){}; + burner ( int , chemical ** ); + void set ( stream * s1 , stream * s2 ) { in=s1; out=s2; for(i=0;i<in->nb;i++) m[i] = in->chem[i]->m;} + void set ( const string & n ) { name = n; } + void set(double e) {eta = e;} + bool solve(double * y); + void write(); + void cost(); + double get_cost ( void ); + ~burner(); +}; +#endif diff --git a/tools/SENSITIVITY/problems/styrene/black-box/truth/cashflow.cpp b/tools/SENSITIVITY/problems/styrene/black-box/truth/cashflow.cpp index a35a767865f7f1761450f84acf60c65e996d8311..c7174f643dda84b2d8082bb6f4ba55135f405d52 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/truth/cashflow.cpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/truth/cashflow.cpp @@ -1,114 +1,114 @@ -#include "cashflow.hpp" -using namespace std; - -cashflow::cashflow(int n) -{ - N=n+1; - Inv = new double[N]; - Coper = new double[N]; - Amort = new double[N]; - Rev = new double[N]; - Flow = new double[N]; - Flowact = new double[N]; - Itot=Ctot=Rtot=i_rate=a_rate=0.0; - - - yield_tab[ 0] = 0.515; - yield_tab[ 1] = 0.778; - yield_tab[ 2] = 0.812; - yield_tab[ 3] = 0.893; - yield_tab[ 4] = 0.985; - yield_tab[ 5] = 0.837; - yield_tab[ 6] = 0.849; - yield_tab[ 7] = 0.746; - yield_tab[ 8] = 0.812; - yield_tab[ 9] = 0.954; - yield_tab[10] = 0.999; - yield_tab[11] = 0.961; - yield_tab[12] = 0.815; - yield_tab[13] = 0.886; - yield_tab[14] = 0.922; - -} - -cashflow::~cashflow ( void ) { - delete [] Inv; - delete [] Coper; - delete [] Amort; - delete [] Rev; - delete [] Flow; - delete [] Flowact; -} - -bool cashflow::run() -{ - if(Itot<EPS || Ctot<EPS || Rtot<EPS || i_rate<EPS || a_rate<EPS) - OK=false; - else - { - //if(!MUTE)cout<<endl<<" investments flow... OK"; - set_Inv(); - //if(!MUTE)cout<<endl<<" depreciation flow... OK"; - set_Amort(); - set_C_R(); - //if(!MUTE)cout<<endl<<" costs flow... OK"; - //if(!MUTE)cout<<endl<<" revenus flow... OK"; - for(i=0;i<N;i++) - { - Flow[i] = (Rev[i]-Coper[i])*(1.0-a_rate)-(Inv[i]-a_rate*Amort[i]); - Flowact[i] = Flow[i]/pow(1.0+i_rate, i); - } - //if(!MUTE)cout<<endl<<" cash flow... OK"; - //if(!MUTE)cout<<endl<<" actualizing cash flow... OK"; - OK=true; - -// cout<<endl<<endl<<" CASH FLOW DETAILS"<<endl; -// cout<<endl<<" "<<setfill('-')<<setw(76)<<" "; -// cout<<endl<<" "<<" i "<<" Investment "<<" Deprec. " -// <<" Expenses "<<" Revenus "<<" Cash flow "<<" Act. flow "; -// cout<<endl<<" "<<setfill('-')<<setw(76)<<" "; -// cout<<setfill(' ')<<setiosflags(ios::fixed)<<setprecision(0); -// for(i=0;i<N;i++) -// cout<<endl -// <<" "<<setw(2)<<i<<" "<<setw(11) -// <<Inv[i]<<" "<<setw(11)<<Amort[i]<<" " -// <<setw(11)<<Coper[i]<<" "<<setw(11)<<Rev[i]<<" "<<setw(11)<<Flow[i]<<" "<<setw(11)<<Flowact[i]; -// cout<<endl<<" "<<setfill('-')<<setw(76)<<" "; - } - return OK; -} - -void cashflow::set_Amort() -{ - Amort[0] = 0.0; - temp=Itot; - for(i=1;i<N-1;i++) - { - temp+=Inv[i]; - Amort[i] = temp/double(N-i); - temp-=Amort[i]; - } - Amort[N-1]=Amort[N-2]; -} - -void cashflow::set_Inv() -{ - Inv[0] = Itot; - for(i=1;i<N-1;i++) - { - if((i)%5==0) Inv[i]=0.1*Itot; - else Inv[i]=0.0; - } - Inv[N-1]=0.0; - for(i=0;i<N-1;i++) Inv[N-1]-=0.1*Inv[i]; -} - -void cashflow::set_C_R() -{ - Coper[0] = Rev[0] = 0.0; - for(i=1;i<N;i++) - { - Coper[i] = yield(i)*Ctot; - Rev[i] = yield(i)*Rtot; - } -} +#include "cashflow.hpp" +using namespace std; + +cashflow::cashflow(int n) +{ + N=n+1; + Inv = new double[N]; + Coper = new double[N]; + Amort = new double[N]; + Rev = new double[N]; + Flow = new double[N]; + Flowact = new double[N]; + Itot=Ctot=Rtot=i_rate=a_rate=0.0; + + + yield_tab[ 0] = 0.515; + yield_tab[ 1] = 0.778; + yield_tab[ 2] = 0.812; + yield_tab[ 3] = 0.893; + yield_tab[ 4] = 0.985; + yield_tab[ 5] = 0.837; + yield_tab[ 6] = 0.849; + yield_tab[ 7] = 0.746; + yield_tab[ 8] = 0.812; + yield_tab[ 9] = 0.954; + yield_tab[10] = 0.999; + yield_tab[11] = 0.961; + yield_tab[12] = 0.815; + yield_tab[13] = 0.886; + yield_tab[14] = 0.922; + +} + +cashflow::~cashflow ( void ) { + delete [] Inv; + delete [] Coper; + delete [] Amort; + delete [] Rev; + delete [] Flow; + delete [] Flowact; +} + +bool cashflow::run() +{ + if(Itot<EPS || Ctot<EPS || Rtot<EPS || i_rate<EPS || a_rate<EPS) + OK=false; + else + { + //if(!MUTE)cout<<endl<<" investments flow... OK"; + set_Inv(); + //if(!MUTE)cout<<endl<<" depreciation flow... OK"; + set_Amort(); + set_C_R(); + //if(!MUTE)cout<<endl<<" costs flow... OK"; + //if(!MUTE)cout<<endl<<" revenus flow... OK"; + for(i=0;i<N;i++) + { + Flow[i] = (Rev[i]-Coper[i])*(1.0-a_rate)-(Inv[i]-a_rate*Amort[i]); + Flowact[i] = Flow[i]/pow(1.0+i_rate, i); + } + //if(!MUTE)cout<<endl<<" cash flow... OK"; + //if(!MUTE)cout<<endl<<" actualizing cash flow... OK"; + OK=true; + +// cout<<endl<<endl<<" CASH FLOW DETAILS"<<endl; +// cout<<endl<<" "<<setfill('-')<<setw(76)<<" "; +// cout<<endl<<" "<<" i "<<" Investment "<<" Deprec. " +// <<" Expenses "<<" Revenus "<<" Cash flow "<<" Act. flow "; +// cout<<endl<<" "<<setfill('-')<<setw(76)<<" "; +// cout<<setfill(' ')<<setiosflags(ios::fixed)<<setprecision(0); +// for(i=0;i<N;i++) +// cout<<endl +// <<" "<<setw(2)<<i<<" "<<setw(11) +// <<Inv[i]<<" "<<setw(11)<<Amort[i]<<" " +// <<setw(11)<<Coper[i]<<" "<<setw(11)<<Rev[i]<<" "<<setw(11)<<Flow[i]<<" "<<setw(11)<<Flowact[i]; +// cout<<endl<<" "<<setfill('-')<<setw(76)<<" "; + } + return OK; +} + +void cashflow::set_Amort() +{ + Amort[0] = 0.0; + temp=Itot; + for(i=1;i<N-1;i++) + { + temp+=Inv[i]; + Amort[i] = temp/double(N-i); + temp-=Amort[i]; + } + Amort[N-1]=Amort[N-2]; +} + +void cashflow::set_Inv() +{ + Inv[0] = Itot; + for(i=1;i<N-1;i++) + { + if((i)%5==0) Inv[i]=0.1*Itot; + else Inv[i]=0.0; + } + Inv[N-1]=0.0; + for(i=0;i<N-1;i++) Inv[N-1]-=0.1*Inv[i]; +} + +void cashflow::set_C_R() +{ + Coper[0] = Rev[0] = 0.0; + for(i=1;i<N;i++) + { + Coper[i] = yield(i)*Ctot; + Rev[i] = yield(i)*Rtot; + } +} diff --git a/tools/SENSITIVITY/problems/styrene/black-box/truth/cashflow.hpp b/tools/SENSITIVITY/problems/styrene/black-box/truth/cashflow.hpp index 5aa5f70ead6aa4bf754d8175e1dbe9358b458352..a71b7abf72e7322f1ed2c25256e1bedcd5a610f9 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/truth/cashflow.hpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/truth/cashflow.hpp @@ -1,33 +1,33 @@ -#ifndef CASHFLOW_H -#define CASHFLOW_H -#include "defines.hpp" -// #include <iomanip> -using namespace std; - -class cashflow -{ - private: - // char name[31], filename[41]; - // ifstream in; - // ofstream out; - double Itot, Ctot, Rtot; - void set_Inv(), set_Amort(), set_C_R(); - double temp; - int i, j, counter; - bool OK; - double yield_tab[15]; - - double yield ( int k ) const { return yield_tab[(k==15) ? 14 : k%15]; } - -public: - double *Inv, *Coper, *Amort, *Rev, *Flow, *Flowact; - double i_rate, a_rate; - int N; - cashflow(int); - ~cashflow(); - // void set(char n[31]) {strcpy(name, n);} - void set_rates(double d1, double d2){i_rate=d1; a_rate=d2;} - void set_basics(double d1, double d2, double d3){Itot=d1; Ctot=d2; Rtot=d3;} - bool run(); -}; -#endif +#ifndef CASHFLOW_H +#define CASHFLOW_H +#include "defines.hpp" +// #include <iomanip> +using namespace std; + +class cashflow +{ + private: + // char name[31], filename[41]; + // ifstream in; + // ofstream out; + double Itot, Ctot, Rtot; + void set_Inv(), set_Amort(), set_C_R(); + double temp; + int i, j, counter; + bool OK; + double yield_tab[15]; + + double yield ( int k ) const { return yield_tab[(k==15) ? 14 : k%15]; } + +public: + double *Inv, *Coper, *Amort, *Rev, *Flow, *Flowact; + double i_rate, a_rate; + int N; + cashflow(int); + ~cashflow(); + // void set(char n[31]) {strcpy(name, n);} + void set_rates(double d1, double d2){i_rate=d1; a_rate=d2;} + void set_basics(double d1, double d2, double d3){Itot=d1; Ctot=d2; Rtot=d3;} + bool run(); +}; +#endif diff --git a/tools/SENSITIVITY/problems/styrene/black-box/truth/chemical.cpp b/tools/SENSITIVITY/problems/styrene/black-box/truth/chemical.cpp index 2fb1052a36b84c7e0fa6b83e1db77a60086018cb..af4d12aa7ee6ff9924b960263d7296fa9451abef 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/truth/chemical.cpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/truth/chemical.cpp @@ -1,529 +1,529 @@ -#include "chemical.hpp" -using namespace std; - -void chemical::check_error ( void ) { - if (error>MAX_ERROR) { - cout << "ERROR 2\n\n"; - exit(0); - } - if (warning>MAX_WARNING) { - cout << "ERROR 3\n\n"; - exit(0); - } -} - -// copy-constr. : -chemical::chemical ( const chemical & chem ) { - - CAS = chem.CAS; - name = chem.name; - M = chem.M; - - state = chem.state; - Tm = chem.Tm; - Tb = chem.Tb; - Tc = chem.Tc; - Pc = chem.Pc; - Ho = chem.Ho; - rho_liq = chem.rho_liq; - dHvap = chem.dHvap; - - mu_param[0] = chem.mu_param[0]; - mu_param[1] = chem.mu_param[1]; - Cp_param[0] = chem.Cp_param[0]; - Cp_param[1] = chem.Cp_param[1]; - Cp_param[2] = chem.Cp_param[2]; - Cp_param[3] = chem.Cp_param[3]; - Cp_liq = chem.Cp_liq; - Psat_param[0] = chem.Psat_param[0]; - Psat_param[1] = chem.Psat_param[1]; - Psat_param[2] = chem.Psat_param[2]; - - thermo = new thermolib(); - thermo->send(Pc,Tc, omega()); - - P = chem.P; - T = chem.T; - m = chem.m; - v = chem.v; - - warning = chem.warning; - error = chem.error; - tmp = chem.tmp; -} - -chemical::chemical ( const string & chem_name ) { - - CAS = chem_name; - - // C. Tribes add initialization for more robustness (variables may be initialized uncorrectly dependent on the execution) - P=T=m=v=0.0; - - // 1/12 : - if (CAS=="100-41-4") { - name = "ethylbenzene"; - M = 106.17; - state = 0; - Tm = 178.2; - Tb = 409.3; - Tc = 617.1; - Pc = 35.6; - Ho = 29.79; - rho_liq = 867.0; - dHvap = 35.56; - mu_param[0] = 472.82; - mu_param[1] = 264.22; - Cp_param[0] = -43.069; - Cp_param[1] = 7.067e-01; - Cp_param[2] = -4.807e-04; - Cp_param[3] = 1.30e-07; - Cp_liq = 190.23; - Psat_param[0] = 16.0195; - Psat_param[1] = 3279.47; - Psat_param[2] = -59.95; - } - - // 2/12 : - else if (CAS=="1333-74-0") { - name = "hydrogen"; - M = 2.02; - state = 1; - Tm = 14.0; - Tb = 20.4; - Tc = 33.2; - Pc = 12.8; - Ho = 0.0; - rho_liq = 71.0; - dHvap = 0.9; - mu_param[0] = 13.82; - mu_param[1] = 5.39; - Cp_param[0] = 27.124; - Cp_param[1] = 9.267e-03; - Cp_param[2] = -1.380e-05; - Cp_param[3] = 7.64e-09; - Cp_liq = 0.0; - Psat_param[0] = 13.6333; - Psat_param[1] = 164.90; - Psat_param[2] = 3.19; - } - - // 3/12 : - else if (CAS=="108-88-3") { - name = "toluene"; - M =92.14; - state = 0; - Tm = 178.0; - Tb = 383.8; - Tc = 591.7; - Pc = 40.6; - Ho = 50.0; - rho_liq = 867; - dHvap = 33.18; - mu_param[0] = 467.33; - mu_param[1] = 255.24; - Cp_param[0] = -24.338; - Cp_param[1] = 5.121e-1; - Cp_param[2] = -2.763e-4; - Cp_param[3] = 4.91e-8; - Cp_liq = 159.85; - Psat_param[0] = 16.0137; - Psat_param[1] = 3096.52; - Psat_param[2] = -53.67; - } - - // 4/12 : - else if (CAS=="74-82-8") { - name = "methane"; - M =16.04; - state =1; - Tm = 90.7; - Tb = 111.7; - Tc = 190.6; - Pc = 45.4; - Ho = -74.85; - rho_liq = 425; - dHvap = 8.18; - mu_param[0] = 114.14; - mu_param[1] = 57.60; - Cp_param[0] = 19.238; - Cp_param[1] = 5.209e-02; - Cp_param[2] = 1.197e-05; - Cp_param[3] = -1.13e-08; - Cp_liq = 0.0; - Psat_param[0] = 15.2243; - Psat_param[1] = 897.84; - Psat_param[2] = -7.16; - } - - // 5/12 : - else if (CAS=="71-43-2") { - name = "benzene"; - M = 78.11; - state = 0; - Tm = 278.7; - Tb = 353.3; - Tc = 562.1; - Pc = 48.3; - Ho = 82.93; - rho_liq = 885; - dHvap = 30.76; - mu_param[0] = 545.64; - mu_param[1] = 265.24; - Cp_param[0] = 33.894; - Cp_param[1] = 4.74e-1; - Cp_param[2] = -3.015e-4; - Cp_param[3] = 7.13e-8; - Cp_liq = 116.03; - Psat_param[0] = 15.9008; - Psat_param[1] = 2788.51; - Psat_param[2] = -52.36; - } - - // 6/12 : - else if (CAS=="74-85-1") { - name = "ethylene"; - M = 28.05; - state =1; - Tm = 104.0; - Tb = 169.4; - Tc = 282.4; - Pc = 49.7; - Ho =52.3; - rho_liq = 577.0; - dHvap = 13.54; - mu_param[0] = 168.98; - mu_param[1] = 93.94; - Cp_param[0] = 3.803; - Cp_param[1] = 1.565e-01; - Cp_param[2] = -8.343e-05; - Cp_param[3] = 1.75e-08; - Cp_liq = 0.0; - Psat_param[0] =15.5368; - Psat_param[1] = 1347.01; - Psat_param[2] = -18.15; - } - - // 7/12 : - else if (CAS=="100-42-5") { - name = "styrene"; - M =104.15; - state = 0; - Tm = 242.5; - Tb = 418.3; - Tc =647.0; - Pc =39.4; - Ho =147.36; - rho_liq =906.0; - dHvap = 36.82; - mu_param[0] = 528.64; - mu_param[1] = 276.71; - Cp_param[0] =-28.229; - Cp_param[1] =6.155e-01; - Cp_param[2] = -4.020e-04; - Cp_param[3] = 9.93e-08; - Cp_liq =166.13; - Psat_param[0] = 16.0193; - Psat_param[1] = 3328.57; - Psat_param[2] =-63.72; - } - - // 8/12 : - else if (CAS=="7782-44-7") { - name = "oxygen"; - M = 32.00; - state = 1; - Tm = 54.4; - Tb = 90.2; - Tc = 154.6; - Pc = 49.8; - Ho =0.0 ; - rho_liq =1149.1 ; - dHvap =6.82 ; - mu_param[0] = 85.68; - mu_param[1] = 51.50; - Cp_param[0] = 28.087; - Cp_param[1] = -3.678e-06 ; - Cp_param[2] = 1.745e-05; - Cp_param[3] = -1.06e-08; - Cp_liq =0.0 ; - Psat_param[0] = 15.4075; - Psat_param[1] = 734.55 ; - Psat_param[2] =-6.45 ; - } - - // 9/12 : - else if (CAS=="7727-37-9") { - name = "nitrogen"; - M = 28.01; - state = 1; - Tm = 63.3; - Tb = 77.4; - Tc = 126.2; - Pc = 33.5; - Ho = 0.0; - rho_liq = 804.0; - dHvap = 5.58; - mu_param[0] = 90.30; - mu_param[1] = 46.41; - Cp_param[0] = 31.128; - Cp_param[1] = -1.356e-02 ; - Cp_param[2] = 2.678e-05; - Cp_param[3] =-1.17e-08 ; - Cp_liq = 0.0; - Psat_param[0] = 14.9342; - Psat_param[1] = 588.72; - Psat_param[2] = -6.60; - } - - // 10/12 : - else if (CAS=="124-38-9") { - name = "carbon-dioxide"; - M =44.01; - state = 1; - Tm = 216.6; - Tb = 194.4; - Tc = 304.2; - Pc = 72.8; - Ho = -393.41; - rho_liq = 777.0; - dHvap = 17.15; - mu_param[0] = 578.08; - mu_param[1] = 185.24 ; - Cp_param[0] = 19.782; - Cp_param[1] = 7.339e-02; - Cp_param[2] = -5.598e-05; - Cp_param[3] = 1.71e-08; - Cp_liq = 0.0; - Psat_param[0] = 22.5898; - Psat_param[1] =3103.39 ; - Psat_param[2] = -0.16; - } - - // 11/12 : - else if (CAS=="7732-18-5") { - name = "water"; - M =18.02; - state = 0; - Tm = 273.15; - Tb = 373.15; - Tc = 647.4; - Pc = 217.6; - Ho = -241.83; - rho_liq = 998 ; - dHvap = 40.66; - mu_param[0] = 658.25; - mu_param[1] = 283.16; - Cp_param[0] = 32.220; - Cp_param[1] = 1.923e-03 ; - Cp_param[2] = 1.055e-05; - Cp_param[3] = -3.59e-09; - Cp_liq = 75.24; - Psat_param[0] = 18.3036; - Psat_param[1] = 3816.44; - Psat_param[2] = -46.13; - } - - // 12/12 : - else if (CAS=="64-17-5") { - name = "ethanol"; - M =46.07; - state =0 ; - Tm =159.1 ; - Tb = 351.5; - Tc = 516.2; - Pc =63.0 ; - Ho = -234.8; - rho_liq = 789.0; - dHvap =38.74 ; - mu_param[0] = 686.64; - mu_param[1] = 300.88; - Cp_param[0] = 9.008; - Cp_param[1] = 2.139e-01; - Cp_param[2] = -8.385e-05 ; - Cp_param[3] = 1.37e-09; - Cp_liq = 2.22; - Psat_param[0] = 18.9119; - Psat_param[1] = 3803.98; - Psat_param[2] = -41.68; - } - - else { - cout << "ERROR 1\n\n"; - exit(0); - } - - thermo = new thermolib(); - thermo->send(Pc,Tc, omega()); - - -} - -double chemical::K() -{ - thermo->set(P,T,v,n()); - return thermo->K(); -} - -double chemical::mu() -{ - // Returns the fluid's viscosity in Pa.s - if (Tm<=T && T<=Tboil(P)) - return pow(10,(mu_param[0]*(1.0/T-1.0/mu_param[1])-3)); - else - { - ofstream logf; - logf.open(MESSAGES, ios::app); - logf<<" --> Warning <-- Cannot compute viscosity of "<<name<<".\n"; - logf.close(); - warning++; - check_error(); - return 1.0; - } -} - -double chemical::rho() -{ - // Returns the fluid's density in kg/m3, wether it's liquid or gas - if(state==0) tmp= rho_liq; - if(state==1) - { - find_v(); - if (v>EPS) tmp= m/v; - else tmp= 0.0; - } - return tmp; -} - -double chemical::Cp() { - // cout<<endl<<"Cp de "<<name<<" a "<<T; - // Returns the fluid's Cp in J/mol.K - if(state==0) { - - // tmp = Cp_liq; // BUG : boucle infinie !!! - return Cp_liq; // SEB - - } - if(state==1 || T>Tboil(P)) { - tmp=0; - for (int i=0;i<4;i++) - tmp+=Cp_param[i]*pow(T,i); - } - else { - T=Tb; - - tmp = Cp(); // ici boucle infinie si state==0 !!! - - } - return tmp; -} - -double chemical::Cp(bool q) -{ - // Returns the fluid's Cp in J/mol.K - if(q==0) tmp=Cp_liq; - if(q==1) - { - tmp=0; - for (int i=0;i<4;i++) tmp+=Cp_param[i]*pow(T,i); - } - return tmp; -} - -double chemical::Psat() -{ - // Returns the fluid's vapor pressure in atm, using Antoine's equation - if(Tm<=T && T<=Tc) - return (exp(Psat_param[0]-Psat_param[1]/(T+Psat_param[2]))/760.01); - else - { - - return Psat(Tb); - } -} -double chemical::Psat(double t) -{ - // Returns the fluid's vapor pressure in atm, using Antoine's equation - return (exp(Psat_param[0]-Psat_param[1]/(t+Psat_param[2]))/760.01); -} - -double chemical::dH(double T1,double T2, double pres) -{ - //Enthalpy variation in kJ/mol. Does not affect any attributes of current object. - double energy=0, TT=Tboil(pres), vap=Hvap(TT); - int sign=1, i; - if (T2<T1) {sign = -1; energy=T1; T1=T2; T2=energy; energy=0;} - if (T1==T2) energy = 0.0; - if (T2<TT) energy = Cp_liq*(T2-T1)/1000; - if (TT<T1) for (i=1;i<=4;i++) energy+=Cp_param[i-1]*(pow(T2,i)-pow(T1,i))/i/1000; - if(T1<=TT && TT<=T2) - { - energy=Cp_liq*(TT-T1)/1000; - energy+=vap; - for (i=1;i<=4;i++) energy+=Cp_param[i-1]*(pow(T2,i)-pow(TT,i))/i/1000; - } - return energy*sign; -} - -void chemical::find_T() -{ - if(n()>EPS && P>EPS) - { - thermo->set(P,T,v,n()); - T=thermo->T(); - } - else - { - ofstream logf; - logf.open(MESSAGES, ios::app); - logf<<" --> Warning <-- Cannot find T of "<<name<<".\n"; - logf.close(); - warning++; - } - check_error(); -} - -void chemical::find_P() -{ - if(n()>EPS && T>EPS) - { - thermo->set(P,T,v,n()); - P=thermo->P(); - } - else - { - ofstream logf; - logf.open(MESSAGES, ios::app); - logf<<" --> Warning <-- Cannot find P of "<<name<<".\n"; - logf.close(); - warning++; - } - check_error(); -} - -void chemical::find_v() -{ - - if(state==0) v=m/rho_liq; - if(state==1 && P>EPS && T>EPS && m>EPS) - { - thermo->set(P,T,v,n()); - v=thermo->v(); - } -} - -void chemical::find_state() -{ - ofstream logf; - if (T>Tc || P>Pc) state = 1; //T or P is bigger than Tc or Pc - if (T<=Tm) //T is smaller than melting point - { - ofstream logf; - logf.open(MESSAGES, ios::app); - logf<<" --> Warning <-- The chemical "<<name<<" is solid.\n"; - logf.close(); - warning++; - } - check_error(); - if (T<Tboil(P)) state=0; - else state=1; -} +#include "chemical.hpp" +using namespace std; + +void chemical::check_error ( void ) { + if (error>MAX_ERROR) { + cout << "ERROR 2\n\n"; + exit(0); + } + if (warning>MAX_WARNING) { + cout << "ERROR 3\n\n"; + exit(0); + } +} + +// copy-constr. : +chemical::chemical ( const chemical & chem ) { + + CAS = chem.CAS; + name = chem.name; + M = chem.M; + + state = chem.state; + Tm = chem.Tm; + Tb = chem.Tb; + Tc = chem.Tc; + Pc = chem.Pc; + Ho = chem.Ho; + rho_liq = chem.rho_liq; + dHvap = chem.dHvap; + + mu_param[0] = chem.mu_param[0]; + mu_param[1] = chem.mu_param[1]; + Cp_param[0] = chem.Cp_param[0]; + Cp_param[1] = chem.Cp_param[1]; + Cp_param[2] = chem.Cp_param[2]; + Cp_param[3] = chem.Cp_param[3]; + Cp_liq = chem.Cp_liq; + Psat_param[0] = chem.Psat_param[0]; + Psat_param[1] = chem.Psat_param[1]; + Psat_param[2] = chem.Psat_param[2]; + + thermo = new thermolib(); + thermo->send(Pc,Tc, omega()); + + P = chem.P; + T = chem.T; + m = chem.m; + v = chem.v; + + warning = chem.warning; + error = chem.error; + tmp = chem.tmp; +} + +chemical::chemical ( const string & chem_name ) { + + CAS = chem_name; + + // C. Tribes add initialization for more robustness (variables may be initialized uncorrectly dependent on the execution) + P=T=m=v=0.0; + + // 1/12 : + if (CAS=="100-41-4") { + name = "ethylbenzene"; + M = 106.17; + state = 0; + Tm = 178.2; + Tb = 409.3; + Tc = 617.1; + Pc = 35.6; + Ho = 29.79; + rho_liq = 867.0; + dHvap = 35.56; + mu_param[0] = 472.82; + mu_param[1] = 264.22; + Cp_param[0] = -43.069; + Cp_param[1] = 7.067e-01; + Cp_param[2] = -4.807e-04; + Cp_param[3] = 1.30e-07; + Cp_liq = 190.23; + Psat_param[0] = 16.0195; + Psat_param[1] = 3279.47; + Psat_param[2] = -59.95; + } + + // 2/12 : + else if (CAS=="1333-74-0") { + name = "hydrogen"; + M = 2.02; + state = 1; + Tm = 14.0; + Tb = 20.4; + Tc = 33.2; + Pc = 12.8; + Ho = 0.0; + rho_liq = 71.0; + dHvap = 0.9; + mu_param[0] = 13.82; + mu_param[1] = 5.39; + Cp_param[0] = 27.124; + Cp_param[1] = 9.267e-03; + Cp_param[2] = -1.380e-05; + Cp_param[3] = 7.64e-09; + Cp_liq = 0.0; + Psat_param[0] = 13.6333; + Psat_param[1] = 164.90; + Psat_param[2] = 3.19; + } + + // 3/12 : + else if (CAS=="108-88-3") { + name = "toluene"; + M =92.14; + state = 0; + Tm = 178.0; + Tb = 383.8; + Tc = 591.7; + Pc = 40.6; + Ho = 50.0; + rho_liq = 867; + dHvap = 33.18; + mu_param[0] = 467.33; + mu_param[1] = 255.24; + Cp_param[0] = -24.338; + Cp_param[1] = 5.121e-1; + Cp_param[2] = -2.763e-4; + Cp_param[3] = 4.91e-8; + Cp_liq = 159.85; + Psat_param[0] = 16.0137; + Psat_param[1] = 3096.52; + Psat_param[2] = -53.67; + } + + // 4/12 : + else if (CAS=="74-82-8") { + name = "methane"; + M =16.04; + state =1; + Tm = 90.7; + Tb = 111.7; + Tc = 190.6; + Pc = 45.4; + Ho = -74.85; + rho_liq = 425; + dHvap = 8.18; + mu_param[0] = 114.14; + mu_param[1] = 57.60; + Cp_param[0] = 19.238; + Cp_param[1] = 5.209e-02; + Cp_param[2] = 1.197e-05; + Cp_param[3] = -1.13e-08; + Cp_liq = 0.0; + Psat_param[0] = 15.2243; + Psat_param[1] = 897.84; + Psat_param[2] = -7.16; + } + + // 5/12 : + else if (CAS=="71-43-2") { + name = "benzene"; + M = 78.11; + state = 0; + Tm = 278.7; + Tb = 353.3; + Tc = 562.1; + Pc = 48.3; + Ho = 82.93; + rho_liq = 885; + dHvap = 30.76; + mu_param[0] = 545.64; + mu_param[1] = 265.24; + Cp_param[0] = 33.894; + Cp_param[1] = 4.74e-1; + Cp_param[2] = -3.015e-4; + Cp_param[3] = 7.13e-8; + Cp_liq = 116.03; + Psat_param[0] = 15.9008; + Psat_param[1] = 2788.51; + Psat_param[2] = -52.36; + } + + // 6/12 : + else if (CAS=="74-85-1") { + name = "ethylene"; + M = 28.05; + state =1; + Tm = 104.0; + Tb = 169.4; + Tc = 282.4; + Pc = 49.7; + Ho =52.3; + rho_liq = 577.0; + dHvap = 13.54; + mu_param[0] = 168.98; + mu_param[1] = 93.94; + Cp_param[0] = 3.803; + Cp_param[1] = 1.565e-01; + Cp_param[2] = -8.343e-05; + Cp_param[3] = 1.75e-08; + Cp_liq = 0.0; + Psat_param[0] =15.5368; + Psat_param[1] = 1347.01; + Psat_param[2] = -18.15; + } + + // 7/12 : + else if (CAS=="100-42-5") { + name = "styrene"; + M =104.15; + state = 0; + Tm = 242.5; + Tb = 418.3; + Tc =647.0; + Pc =39.4; + Ho =147.36; + rho_liq =906.0; + dHvap = 36.82; + mu_param[0] = 528.64; + mu_param[1] = 276.71; + Cp_param[0] =-28.229; + Cp_param[1] =6.155e-01; + Cp_param[2] = -4.020e-04; + Cp_param[3] = 9.93e-08; + Cp_liq =166.13; + Psat_param[0] = 16.0193; + Psat_param[1] = 3328.57; + Psat_param[2] =-63.72; + } + + // 8/12 : + else if (CAS=="7782-44-7") { + name = "oxygen"; + M = 32.00; + state = 1; + Tm = 54.4; + Tb = 90.2; + Tc = 154.6; + Pc = 49.8; + Ho =0.0 ; + rho_liq =1149.1 ; + dHvap =6.82 ; + mu_param[0] = 85.68; + mu_param[1] = 51.50; + Cp_param[0] = 28.087; + Cp_param[1] = -3.678e-06 ; + Cp_param[2] = 1.745e-05; + Cp_param[3] = -1.06e-08; + Cp_liq =0.0 ; + Psat_param[0] = 15.4075; + Psat_param[1] = 734.55 ; + Psat_param[2] =-6.45 ; + } + + // 9/12 : + else if (CAS=="7727-37-9") { + name = "nitrogen"; + M = 28.01; + state = 1; + Tm = 63.3; + Tb = 77.4; + Tc = 126.2; + Pc = 33.5; + Ho = 0.0; + rho_liq = 804.0; + dHvap = 5.58; + mu_param[0] = 90.30; + mu_param[1] = 46.41; + Cp_param[0] = 31.128; + Cp_param[1] = -1.356e-02 ; + Cp_param[2] = 2.678e-05; + Cp_param[3] =-1.17e-08 ; + Cp_liq = 0.0; + Psat_param[0] = 14.9342; + Psat_param[1] = 588.72; + Psat_param[2] = -6.60; + } + + // 10/12 : + else if (CAS=="124-38-9") { + name = "carbon-dioxide"; + M =44.01; + state = 1; + Tm = 216.6; + Tb = 194.4; + Tc = 304.2; + Pc = 72.8; + Ho = -393.41; + rho_liq = 777.0; + dHvap = 17.15; + mu_param[0] = 578.08; + mu_param[1] = 185.24 ; + Cp_param[0] = 19.782; + Cp_param[1] = 7.339e-02; + Cp_param[2] = -5.598e-05; + Cp_param[3] = 1.71e-08; + Cp_liq = 0.0; + Psat_param[0] = 22.5898; + Psat_param[1] =3103.39 ; + Psat_param[2] = -0.16; + } + + // 11/12 : + else if (CAS=="7732-18-5") { + name = "water"; + M =18.02; + state = 0; + Tm = 273.15; + Tb = 373.15; + Tc = 647.4; + Pc = 217.6; + Ho = -241.83; + rho_liq = 998 ; + dHvap = 40.66; + mu_param[0] = 658.25; + mu_param[1] = 283.16; + Cp_param[0] = 32.220; + Cp_param[1] = 1.923e-03 ; + Cp_param[2] = 1.055e-05; + Cp_param[3] = -3.59e-09; + Cp_liq = 75.24; + Psat_param[0] = 18.3036; + Psat_param[1] = 3816.44; + Psat_param[2] = -46.13; + } + + // 12/12 : + else if (CAS=="64-17-5") { + name = "ethanol"; + M =46.07; + state =0 ; + Tm =159.1 ; + Tb = 351.5; + Tc = 516.2; + Pc =63.0 ; + Ho = -234.8; + rho_liq = 789.0; + dHvap =38.74 ; + mu_param[0] = 686.64; + mu_param[1] = 300.88; + Cp_param[0] = 9.008; + Cp_param[1] = 2.139e-01; + Cp_param[2] = -8.385e-05 ; + Cp_param[3] = 1.37e-09; + Cp_liq = 2.22; + Psat_param[0] = 18.9119; + Psat_param[1] = 3803.98; + Psat_param[2] = -41.68; + } + + else { + cout << "ERROR 1\n\n"; + exit(0); + } + + thermo = new thermolib(); + thermo->send(Pc,Tc, omega()); + + +} + +double chemical::K() +{ + thermo->set(P,T,v,n()); + return thermo->K(); +} + +double chemical::mu() +{ + // Returns the fluid's viscosity in Pa.s + if (Tm<=T && T<=Tboil(P)) + return pow(10,(mu_param[0]*(1.0/T-1.0/mu_param[1])-3)); + else + { + ofstream logf; + logf.open(MESSAGES, ios::app); + logf<<" --> Warning <-- Cannot compute viscosity of "<<name<<".\n"; + logf.close(); + warning++; + check_error(); + return 1.0; + } +} + +double chemical::rho() +{ + // Returns the fluid's density in kg/m3, wether it's liquid or gas + if(state==0) tmp= rho_liq; + if(state==1) + { + find_v(); + if (v>EPS) tmp= m/v; + else tmp= 0.0; + } + return tmp; +} + +double chemical::Cp() { + // cout<<endl<<"Cp de "<<name<<" a "<<T; + // Returns the fluid's Cp in J/mol.K + if(state==0) { + + // tmp = Cp_liq; // BUG : boucle infinie !!! + return Cp_liq; // SEB + + } + if(state==1 || T>Tboil(P)) { + tmp=0; + for (int i=0;i<4;i++) + tmp+=Cp_param[i]*pow(T,i); + } + else { + T=Tb; + + tmp = Cp(); // ici boucle infinie si state==0 !!! + + } + return tmp; +} + +double chemical::Cp(bool q) +{ + // Returns the fluid's Cp in J/mol.K + if(q==0) tmp=Cp_liq; + if(q==1) + { + tmp=0; + for (int i=0;i<4;i++) tmp+=Cp_param[i]*pow(T,i); + } + return tmp; +} + +double chemical::Psat() +{ + // Returns the fluid's vapor pressure in atm, using Antoine's equation + if(Tm<=T && T<=Tc) + return (exp(Psat_param[0]-Psat_param[1]/(T+Psat_param[2]))/760.01); + else + { + + return Psat(Tb); + } +} +double chemical::Psat(double t) +{ + // Returns the fluid's vapor pressure in atm, using Antoine's equation + return (exp(Psat_param[0]-Psat_param[1]/(t+Psat_param[2]))/760.01); +} + +double chemical::dH(double T1,double T2, double pres) +{ + //Enthalpy variation in kJ/mol. Does not affect any attributes of current object. + double energy=0, TT=Tboil(pres), vap=Hvap(TT); + int sign=1, i; + if (T2<T1) {sign = -1; energy=T1; T1=T2; T2=energy; energy=0;} + if (T1==T2) energy = 0.0; + if (T2<TT) energy = Cp_liq*(T2-T1)/1000; + if (TT<T1) for (i=1;i<=4;i++) energy+=Cp_param[i-1]*(pow(T2,i)-pow(T1,i))/i/1000; + if(T1<=TT && TT<=T2) + { + energy=Cp_liq*(TT-T1)/1000; + energy+=vap; + for (i=1;i<=4;i++) energy+=Cp_param[i-1]*(pow(T2,i)-pow(TT,i))/i/1000; + } + return energy*sign; +} + +void chemical::find_T() +{ + if(n()>EPS && P>EPS) + { + thermo->set(P,T,v,n()); + T=thermo->T(); + } + else + { + ofstream logf; + logf.open(MESSAGES, ios::app); + logf<<" --> Warning <-- Cannot find T of "<<name<<".\n"; + logf.close(); + warning++; + } + check_error(); +} + +void chemical::find_P() +{ + if(n()>EPS && T>EPS) + { + thermo->set(P,T,v,n()); + P=thermo->P(); + } + else + { + ofstream logf; + logf.open(MESSAGES, ios::app); + logf<<" --> Warning <-- Cannot find P of "<<name<<".\n"; + logf.close(); + warning++; + } + check_error(); +} + +void chemical::find_v() +{ + + if(state==0) v=m/rho_liq; + if(state==1 && P>EPS && T>EPS && m>EPS) + { + thermo->set(P,T,v,n()); + v=thermo->v(); + } +} + +void chemical::find_state() +{ + ofstream logf; + if (T>Tc || P>Pc) state = 1; //T or P is bigger than Tc or Pc + if (T<=Tm) //T is smaller than melting point + { + ofstream logf; + logf.open(MESSAGES, ios::app); + logf<<" --> Warning <-- The chemical "<<name<<" is solid.\n"; + logf.close(); + warning++; + } + check_error(); + if (T<Tboil(P)) state=0; + else state=1; +} diff --git a/tools/SENSITIVITY/problems/styrene/black-box/truth/chemical.hpp b/tools/SENSITIVITY/problems/styrene/black-box/truth/chemical.hpp index 344bd010651aa1f3e1229bc32e714752c22b628a..71b28a956e9a81d399e78c777bb896601170e64c 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/truth/chemical.hpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/truth/chemical.hpp @@ -1,48 +1,48 @@ -#ifndef CHEMICAL_H -#define CHEMICAL_H - -#include "thermolib.hpp" -#include <string> -using namespace std; - -class chemical -{ - public: - string name; - string CAS; - double M; //molar weight, in g/mol - bool state; //current state : 0=liquid 1=gas - double P, T, m, v; //current values : P in atm, T in K, m in kg/s, v in m3/s - - double n() {return 1000.0*m/M;} //mole flow in mol/s - double Hvap(double t) {return dHvap*pow((Tc-t)/(Tc-Tb),0.38);} //vaporization heat at specific T (Watson correlation) - double omega() {return ((-1.0)*log10(Psat(0.7*Tc)/Pc) -1.0);} //Pitzer acentric factor - double Tboil(double p) {return (Psat_param[1]/(Psat_param[0]-log(760.01*p))-Psat_param[2]);} //boiling tempararure at specific P - double mu(), rho(), Cp(), Cp(bool), Psat(), Psat(double); //T-dependant properties - double K(); //liquid-vapor equilibrium constant - double gamma(){return Cp(true)/(Cp(true)-8.3144);}//compressibility ratio =Cp/Cv - double dH(double, double, double); //enthalpy variation kJ/mol - void find_T(), find_P(), find_v(), find_state(); //for gases only - double Tm, Tb, Tc, Pc; //melting, boiling and critical temp. (K); critical pressure (atm) - double Ho;//standard formation heat in kJ/mol - - //private: - int warning, error; - void check_error(); - double dHvap, tmp; //vaporization heat (kJ/mol) - double mu_param[2], Cp_param[4], Cp_liq, Psat_param[3], rho_liq; //correlations parameters - thermolib *thermo; - - // public: - // chemical() {}; - - // copy-constr. : - chemical ( const chemical & chem ); - - chemical ( const string & chem_name ); //Contructor : initializes fields and reads CAS in the data file - void purge() {P=T=m=v=0.0; state=false;} - ~chemical(){delete thermo;}; -}; - -#endif - +#ifndef CHEMICAL_H +#define CHEMICAL_H + +#include "thermolib.hpp" +#include <string> +using namespace std; + +class chemical +{ + public: + string name; + string CAS; + double M; //molar weight, in g/mol + bool state; //current state : 0=liquid 1=gas + double P, T, m, v; //current values : P in atm, T in K, m in kg/s, v in m3/s + + double n() {return 1000.0*m/M;} //mole flow in mol/s + double Hvap(double t) {return dHvap*pow((Tc-t)/(Tc-Tb),0.38);} //vaporization heat at specific T (Watson correlation) + double omega() {return ((-1.0)*log10(Psat(0.7*Tc)/Pc) -1.0);} //Pitzer acentric factor + double Tboil(double p) {return (Psat_param[1]/(Psat_param[0]-log(760.01*p))-Psat_param[2]);} //boiling tempararure at specific P + double mu(), rho(), Cp(), Cp(bool), Psat(), Psat(double); //T-dependant properties + double K(); //liquid-vapor equilibrium constant + double gamma(){return Cp(true)/(Cp(true)-8.3144);}//compressibility ratio =Cp/Cv + double dH(double, double, double); //enthalpy variation kJ/mol + void find_T(), find_P(), find_v(), find_state(); //for gases only + double Tm, Tb, Tc, Pc; //melting, boiling and critical temp. (K); critical pressure (atm) + double Ho;//standard formation heat in kJ/mol + + //private: + int warning, error; + void check_error(); + double dHvap, tmp; //vaporization heat (kJ/mol) + double mu_param[2], Cp_param[4], Cp_liq, Psat_param[3], rho_liq; //correlations parameters + thermolib *thermo; + + // public: + // chemical() {}; + + // copy-constr. : + chemical ( const chemical & chem ); + + chemical ( const string & chem_name ); //Contructor : initializes fields and reads CAS in the data file + void purge() {P=T=m=v=0.0; state=false;} + ~chemical(){delete thermo;}; +}; + +#endif + diff --git a/tools/SENSITIVITY/problems/styrene/black-box/truth/column.cpp b/tools/SENSITIVITY/problems/styrene/black-box/truth/column.cpp index f4a35c181e862b1a9b1eafdaf1190ff41abe19d8..85ab3e0b27bf8f9ab868d5792401fe63d4e0bbbd 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/truth/column.cpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/truth/column.cpp @@ -1,290 +1,290 @@ -#include "column.hpp" -using namespace std; - -column::column(stream* in, stream* out_B, stream* out_D) -{ - F = in; - B = out_B; - D = out_D; - L=new stream("columnL", F->nb, F->chem); - V=new stream("columnV", F->nb, F->chem); - flasher = new flash(F, L, V); - alpha_1 = new double[F->nb]; - alpha_f = new double[F->nb]; - alpha_N = new double[F->nb]; - alpha_m = new double[F->nb]; - T_d=0; T_b=0; T_f=F->T; -// for(i=0;i<F->nb;i++) -// if(F->chem[i]->Tc<F->T && F->chem[i]->m>EPS) -// { -// logf.open(MESSAGES,ios::app); -// logf<<" --> Warning <-- Presence of gas in column.\n"; -// logf.close(); -// i=F->nb; -// } -} - -column::~column() -{ - delete L; delete V; delete flasher; - delete [] alpha_1; - delete [] alpha_f; - delete [] alpha_N; - delete [] alpha_m; -} - -void column::set(double p, int lk, double xd, int hk, double xb) -{ - P=p; - HK=hk-1; x_B=xb; - LK=lk-1; x_D=xd; - //logf.open(MESSAGES, ios::app); - // F->write(); system("pause"); - // if (F->chem[LK]->m<EPS) logf<<" ==> Error <== Flow of light key in column "<<name<<" is zero.\n"; -// if (F->chem[HK]->m<EPS) logf<<" ==> Error <== Flow of heavy key in column "<<name<<" is zero.\n"; - //logf.close(); -} - -bool column::solve() -{ - - OK=true; - // B->thermo=F->thermo; D->thermo=F->thermo; - //flash once the feed stream - - - - flasher->set(P,F->T); - - flasher->adiabatic(); - - - T_f=flasher->T; - L->set(P, T_f); V->set(P, T_f); - // L->write(); V->write(); TOTO - //check if a column is needed; if not, bypass block - if(F->chem[LK]->n()/F->n()<0.001) OK=false; - if(F->chem[HK]->n()/F->n()<0.001) OK=false; - if(!OK) - return false; -// { -// strcpy(filename, B->name); *B=*L; B->set(filename); B->write(); -// strcpy(filename, D->name); *D=*V; D->set(filename); D->write(); -// } - else - { - - - - - - //apply the FUG method - first_split(); - Nmin = Fenske(); - N=Nmin+1; - while (fabs(N-Nmin)>0.1) - { - N=Nmin; - D->set(P, T_f); T_d=D->bp; - B->set(P, T_f); T_b=B->bp; - set_alpha(); - distribute(); - Nmin = Fenske(); - if (Nmin<1) Nmin=1; - } - D->set(P, T_d); - B->set(P, T_b); - if(fabs(Nmin)<=MIN_PLATES || fabs(Nmin)>MAX_PLATES) OK=false; - else - { - Rmin = Underwood(); - if(Rmin>100) Rmin=100; - if(L->chem[HK]->m+L->chem[LK]->m<EPS) Rmin=10.0; - if (Nmin<5) Ract = 1.5*Rmin; - if (5<Nmin && Nmin<15) Ract = 1.3*Rmin; - if (15<=Nmin) Ract = 1.1*Rmin; - N = Gilliland(); - feed = Kirkbride(); - condense(); - reboil(); - } - // B->write(); TOTO - // D->write(); TOTO - } - return OK; -} - -void column::first_split() -{ - B->purge(); D->purge(); - set_alpha(); - //Check if LK is really lighter than HK - if (alpha_m[LK]<1) - { -// logf.open(MESSAGES,ios::app); -// logf<<" --> Warning <-- Swapping keys in column "<<name<<".\n"; -// logf.close(); - feed=LK; LK=HK; HK=feed; set_alpha(); - } - for(i=0;i<F->nb;i++) - { - if (i!=LK && i!=HK && F->chem[i]->m>EPS) - { - if(alpha_f[i] > alpha_f[LK]) //volatile - { - D->chem[i]->m = (alpha_f[i]-alpha_f[LK])/alpha_f[i]*F->chem[i]->m; - D->m += D->chem[i]->m; - B->chem[i]->m = F->chem[i]->m-D->chem[i]->m; - B->m+=B->chem[i]->m; - } - if(alpha_f[i] < 1) //not volatile - { - B->chem[i]->m = (alpha_f[HK]-alpha_f[i])/alpha_f[i]*F->chem[i]->m; - B->m += B->chem[i]->m; - D->chem[i]->m = F->chem[i]->m-B->chem[i]->m; - D->m+=D->chem[i]->m; - } - if(1 <= alpha_f[i] && alpha_f[i]<=alpha_f[LK]) //ambiguous volatility - { - D->chem[i]->m = (alpha_f[i]-1)/(alpha_f[LK]-1)*F->chem[i]->m; - B->chem[i]->m = F->chem[i]->m-D->chem[i]->m; - D->m+=D->chem[i]->m; - B->m+=B->chem[i]->m; - } - } - } - D->chem[HK]->m = D->n()*x_D/(1-x_D)*D->chem[HK]->M/1000.0; - if(D->chem[HK]->m<EPS) D->chem[HK]->m=0.01*F->chem[HK]->m; - B->chem[LK]->m = B->n()*x_B/(1-x_B)*B->chem[LK]->M/1000.0; - if(B->chem[LK]->m<EPS) B->chem[LK]->m=0.01*F->chem[LK]->m; - B->chem[HK]->m = F->chem[HK]->m - D->chem[HK]->m; - D->chem[LK]->m = F->chem[LK]->m - B->chem[LK]->m; - D->m += (D->chem[LK]->m + D->chem[HK]->m); - B->m += (B->chem[LK]->m + B->chem[HK]->m); -} -void column::distribute() -{ - D->m=0; B->m=0; - for(i=0;i<F->nb;i++) - { - if (i!=LK && i!=HK && F->chem[i]->m>EPS) - { - if(alpha_m[i] > 1) //volatile and ambiguous - { - B->chem[i]->m = F->chem[i]->m/(1+D->chem[HK]->n()/B->chem[HK]->n()*pow(alpha_m[i], Nmin)); - D->chem[i]->m = F->chem[i]->m - B->chem[i]->m; - } - if(alpha_m[i] <= 1) //not volatile - { - D->chem[i]->m = F->chem[i]->m*(D->chem[HK]->n()/B->chem[HK]->n()*pow(alpha_m[i], Nmin))/(1+D->chem[HK]->n()/B->chem[HK]->n()*pow(alpha_m[i], Nmin)); - B->chem[i]->m = F->chem[i]->m - D->chem[i]->m; - } - D->m+=D->chem[i]->m; - B->m+=B->chem[i]->m; - } - } - D->m += (D->chem[LK]->m + D->chem[HK]->m); - B->m += (B->chem[LK]->m + B->chem[HK]->m); -} - -void column::set_alpha() -{ - for(i=0;i<F->nb; i++) - { - if (T_b>EPS && F->chem[i]->m>EPS) alpha_1[i] = F->chem[i]->Psat(T_b)/F->chem[HK]->Psat(T_b); - else alpha_1[i]=0; - if (T_d>EPS&& F->chem[i]->m>EPS) alpha_N[i] = F->chem[i]->Psat(T_d)/F->chem[HK]->Psat(T_d); - else alpha_N[i]=0; - if (T_f>EPS&& F->chem[i]->m>EPS) alpha_f[i] = F->chem[i]->Psat(T_f)/F->chem[HK]->Psat(T_f); - else alpha_f[i]=0; - alpha_m[i] = pow(alpha_1[i]*alpha_f[i]*alpha_N[i], 1.0/3.0); - } - for(i=0;i<F->nb;i++) if(alpha_m[i]<EPS&& F->chem[i]->m>EPS) alpha_m[i] = alpha_f[i]; -} - -void column::reboil() -{ - Q_reboil = 0.0; - for (i=0;i<F->nb;i++) if(F->chem[i]->m>EPS) - { - Q_reboil += B->chem[i]->Cp(false)*(T_b-T_f)*B->chem[i]->n()/1000.0; //energy to go from input to bottoms T - Q_reboil += D->chem[i]->Cp(false)*(T_f-T_d)*D->chem[i]->n()/1000.0; //energy to go from input to tops T - } - Q_reboil += Q_condens; -} - -void column::condense() -{ - Q_condens = 0.0; - for (i=0;i<F->nb;i++) if(F->chem[i]->m>EPS) - { - Q_condens += D->chem[i]->Hvap(T_d)*(1+Ract)*D->chem[i]->n(); - } -} - -void column::write() -{ - cout << setprecision(11); - - cout << "WRITE FILE " << RUNTIME << name << ".unit" << " :\n\tBEGIN\n"; - cout <<"\t>> "<<name; - cout <<endl<<"\t>> stream in: "<<F->name; - cout <<endl<<"\t>> streams out: "<<B->name<<" (bot.) "<<D->name<<" (top.)"; - cout <<endl<<"\t>> P = "<<P<<" atm, T(0) = "<<T_b<<", T("<<feed<<") = "<<T_f<<", T("<<int(N)<<") = "<<T_d<<" K"; - cout <<endl<<"\t>> Number of stages: "<<int(N)<<" (feeding at stage "<<feed<<")"; - cout <<endl<<setiosflags(ios::fixed|ios::showpoint)<<setprecision(5)<<"\t>> LK purity = "<<D->chem[LK]->n()/D->n()<<" HK purity = "<<B->chem[HK]->n()/B->n(); - cout <<endl<<"\t>> Reboiler duty: "<<Q_reboil<<" kW Condenser duty: "<<(-1)*Q_condens<<" kW"; - cout << "\n\tEND\n\n"; - cost(); water(); power(); -} - -double column::get_cost() -{ - //cost of vessel - vol=(0.45*N)*(pow(300*D->v, 1.5)/2.4/sqrt(B->v))*sqrt(D->m/B->m); - if(vol<0.3) vol=0.3; if(vol>520)vol=520; - money = 3.4974+0.4485*log10(vol)+0.1074*pow(log10(vol),2); - money = pow(10, money); - P= (P-1)*101.325/100; - diam=sqrt(4.0*vol/pi/N/0.45); - vol=(P+1)*diam/(317.46*(850-0.6*(P+1)))+0.0315; - money *=(2.25+ 1.82*vol*2.2); - //cost of trays - vol = (pow(300*D->v, 1.5)/2.4/sqrt(B->v))*sqrt(D->m/B->m); - diam = 2.9949+0.4465*log10(vol)+0.3961*pow(log10(vol),2); - money+=1.5*pow(10, diam); - //cost of reboiler U=5250W/m2.K - vol=fabs(Q_reboil)/0.85/5.25/15.0; - if(vol<10) vol=10; if(vol>100) vol=100; - vol = 4.4646-0.5277*log10(vol)+0.3955*pow(log10(vol),2); - money += (1.63+1.66*2.5)*pow(10, vol); - //cost of condenser U=1850W/m2.K - vol=fabs(Q_condens)/0.85/1.85/(0.5*(T_d-298)); - if(vol<1) vol=1; if(vol>100) vol=100; - vol = 3.9912+0.0668*log10(vol)+0.243*pow(log10(vol),2); - money += (1.74+1.55*2.5)*pow(10, vol); - money = money*MS_YEAR/MS_2001; - return money; -} - - -void column::cost() -{ - cout << "WRITE FILE " << RUNTIME << name << ".cost" << " :\n\tBEGIN\n"; - cout << "\t>>" << get_cost(); - cout << "\n\tEND\n\n"; -} -void column::power() -{ - cout << "WRITE FILE " << RUNTIME << name << ".power" << " :\n\tBEGIN\n"; - money =(Q_reboil/0.85-Q_condens); - cout << "\t>>" << money; - cout << "\n\tEND\n\n"; -} -void column::water() -{ - cout << "WRITE FILE " << RUNTIME << name << ".water" << " :\n\tBEGIN\n"; - money = (fabs(Q_condens)/(4.185*0.85*0.25*fabs(T_d-298))); - cout << "\t>>" << money; - cout << "\n\tEND\n\n"; -} +#include "column.hpp" +using namespace std; + +column::column(stream* in, stream* out_B, stream* out_D) +{ + F = in; + B = out_B; + D = out_D; + L=new stream("columnL", F->nb, F->chem); + V=new stream("columnV", F->nb, F->chem); + flasher = new flash(F, L, V); + alpha_1 = new double[F->nb]; + alpha_f = new double[F->nb]; + alpha_N = new double[F->nb]; + alpha_m = new double[F->nb]; + T_d=0; T_b=0; T_f=F->T; +// for(i=0;i<F->nb;i++) +// if(F->chem[i]->Tc<F->T && F->chem[i]->m>EPS) +// { +// logf.open(MESSAGES,ios::app); +// logf<<" --> Warning <-- Presence of gas in column.\n"; +// logf.close(); +// i=F->nb; +// } +} + +column::~column() +{ + delete L; delete V; delete flasher; + delete [] alpha_1; + delete [] alpha_f; + delete [] alpha_N; + delete [] alpha_m; +} + +void column::set(double p, int lk, double xd, int hk, double xb) +{ + P=p; + HK=hk-1; x_B=xb; + LK=lk-1; x_D=xd; + //logf.open(MESSAGES, ios::app); + // F->write(); system("pause"); + // if (F->chem[LK]->m<EPS) logf<<" ==> Error <== Flow of light key in column "<<name<<" is zero.\n"; +// if (F->chem[HK]->m<EPS) logf<<" ==> Error <== Flow of heavy key in column "<<name<<" is zero.\n"; + //logf.close(); +} + +bool column::solve() +{ + + OK=true; + // B->thermo=F->thermo; D->thermo=F->thermo; + //flash once the feed stream + + + + flasher->set(P,F->T); + + flasher->adiabatic(); + + + T_f=flasher->T; + L->set(P, T_f); V->set(P, T_f); + // L->write(); V->write(); TOTO + //check if a column is needed; if not, bypass block + if(F->chem[LK]->n()/F->n()<0.001) OK=false; + if(F->chem[HK]->n()/F->n()<0.001) OK=false; + if(!OK) + return false; +// { +// strcpy(filename, B->name); *B=*L; B->set(filename); B->write(); +// strcpy(filename, D->name); *D=*V; D->set(filename); D->write(); +// } + else + { + + + + + + //apply the FUG method + first_split(); + Nmin = Fenske(); + N=Nmin+1; + while (fabs(N-Nmin)>0.1) + { + N=Nmin; + D->set(P, T_f); T_d=D->bp; + B->set(P, T_f); T_b=B->bp; + set_alpha(); + distribute(); + Nmin = Fenske(); + if (Nmin<1) Nmin=1; + } + D->set(P, T_d); + B->set(P, T_b); + if(fabs(Nmin)<=MIN_PLATES || fabs(Nmin)>MAX_PLATES) OK=false; + else + { + Rmin = Underwood(); + if(Rmin>100) Rmin=100; + if(L->chem[HK]->m+L->chem[LK]->m<EPS) Rmin=10.0; + if (Nmin<5) Ract = 1.5*Rmin; + if (5<Nmin && Nmin<15) Ract = 1.3*Rmin; + if (15<=Nmin) Ract = 1.1*Rmin; + N = Gilliland(); + feed = Kirkbride(); + condense(); + reboil(); + } + // B->write(); TOTO + // D->write(); TOTO + } + return OK; +} + +void column::first_split() +{ + B->purge(); D->purge(); + set_alpha(); + //Check if LK is really lighter than HK + if (alpha_m[LK]<1) + { +// logf.open(MESSAGES,ios::app); +// logf<<" --> Warning <-- Swapping keys in column "<<name<<".\n"; +// logf.close(); + feed=LK; LK=HK; HK=feed; set_alpha(); + } + for(i=0;i<F->nb;i++) + { + if (i!=LK && i!=HK && F->chem[i]->m>EPS) + { + if(alpha_f[i] > alpha_f[LK]) //volatile + { + D->chem[i]->m = (alpha_f[i]-alpha_f[LK])/alpha_f[i]*F->chem[i]->m; + D->m += D->chem[i]->m; + B->chem[i]->m = F->chem[i]->m-D->chem[i]->m; + B->m+=B->chem[i]->m; + } + if(alpha_f[i] < 1) //not volatile + { + B->chem[i]->m = (alpha_f[HK]-alpha_f[i])/alpha_f[i]*F->chem[i]->m; + B->m += B->chem[i]->m; + D->chem[i]->m = F->chem[i]->m-B->chem[i]->m; + D->m+=D->chem[i]->m; + } + if(1 <= alpha_f[i] && alpha_f[i]<=alpha_f[LK]) //ambiguous volatility + { + D->chem[i]->m = (alpha_f[i]-1)/(alpha_f[LK]-1)*F->chem[i]->m; + B->chem[i]->m = F->chem[i]->m-D->chem[i]->m; + D->m+=D->chem[i]->m; + B->m+=B->chem[i]->m; + } + } + } + D->chem[HK]->m = D->n()*x_D/(1-x_D)*D->chem[HK]->M/1000.0; + if(D->chem[HK]->m<EPS) D->chem[HK]->m=0.01*F->chem[HK]->m; + B->chem[LK]->m = B->n()*x_B/(1-x_B)*B->chem[LK]->M/1000.0; + if(B->chem[LK]->m<EPS) B->chem[LK]->m=0.01*F->chem[LK]->m; + B->chem[HK]->m = F->chem[HK]->m - D->chem[HK]->m; + D->chem[LK]->m = F->chem[LK]->m - B->chem[LK]->m; + D->m += (D->chem[LK]->m + D->chem[HK]->m); + B->m += (B->chem[LK]->m + B->chem[HK]->m); +} +void column::distribute() +{ + D->m=0; B->m=0; + for(i=0;i<F->nb;i++) + { + if (i!=LK && i!=HK && F->chem[i]->m>EPS) + { + if(alpha_m[i] > 1) //volatile and ambiguous + { + B->chem[i]->m = F->chem[i]->m/(1+D->chem[HK]->n()/B->chem[HK]->n()*pow(alpha_m[i], Nmin)); + D->chem[i]->m = F->chem[i]->m - B->chem[i]->m; + } + if(alpha_m[i] <= 1) //not volatile + { + D->chem[i]->m = F->chem[i]->m*(D->chem[HK]->n()/B->chem[HK]->n()*pow(alpha_m[i], Nmin))/(1+D->chem[HK]->n()/B->chem[HK]->n()*pow(alpha_m[i], Nmin)); + B->chem[i]->m = F->chem[i]->m - D->chem[i]->m; + } + D->m+=D->chem[i]->m; + B->m+=B->chem[i]->m; + } + } + D->m += (D->chem[LK]->m + D->chem[HK]->m); + B->m += (B->chem[LK]->m + B->chem[HK]->m); +} + +void column::set_alpha() +{ + for(i=0;i<F->nb; i++) + { + if (T_b>EPS && F->chem[i]->m>EPS) alpha_1[i] = F->chem[i]->Psat(T_b)/F->chem[HK]->Psat(T_b); + else alpha_1[i]=0; + if (T_d>EPS&& F->chem[i]->m>EPS) alpha_N[i] = F->chem[i]->Psat(T_d)/F->chem[HK]->Psat(T_d); + else alpha_N[i]=0; + if (T_f>EPS&& F->chem[i]->m>EPS) alpha_f[i] = F->chem[i]->Psat(T_f)/F->chem[HK]->Psat(T_f); + else alpha_f[i]=0; + alpha_m[i] = pow(alpha_1[i]*alpha_f[i]*alpha_N[i], 1.0/3.0); + } + for(i=0;i<F->nb;i++) if(alpha_m[i]<EPS&& F->chem[i]->m>EPS) alpha_m[i] = alpha_f[i]; +} + +void column::reboil() +{ + Q_reboil = 0.0; + for (i=0;i<F->nb;i++) if(F->chem[i]->m>EPS) + { + Q_reboil += B->chem[i]->Cp(false)*(T_b-T_f)*B->chem[i]->n()/1000.0; //energy to go from input to bottoms T + Q_reboil += D->chem[i]->Cp(false)*(T_f-T_d)*D->chem[i]->n()/1000.0; //energy to go from input to tops T + } + Q_reboil += Q_condens; +} + +void column::condense() +{ + Q_condens = 0.0; + for (i=0;i<F->nb;i++) if(F->chem[i]->m>EPS) + { + Q_condens += D->chem[i]->Hvap(T_d)*(1+Ract)*D->chem[i]->n(); + } +} + +void column::write() +{ + cout << setprecision(11); + + cout << "WRITE FILE " << RUNTIME << name << ".unit" << " :\n\tBEGIN\n"; + cout <<"\t>> "<<name; + cout <<endl<<"\t>> stream in: "<<F->name; + cout <<endl<<"\t>> streams out: "<<B->name<<" (bot.) "<<D->name<<" (top.)"; + cout <<endl<<"\t>> P = "<<P<<" atm, T(0) = "<<T_b<<", T("<<feed<<") = "<<T_f<<", T("<<int(N)<<") = "<<T_d<<" K"; + cout <<endl<<"\t>> Number of stages: "<<int(N)<<" (feeding at stage "<<feed<<")"; + cout <<endl<<setiosflags(ios::fixed|ios::showpoint)<<setprecision(5)<<"\t>> LK purity = "<<D->chem[LK]->n()/D->n()<<" HK purity = "<<B->chem[HK]->n()/B->n(); + cout <<endl<<"\t>> Reboiler duty: "<<Q_reboil<<" kW Condenser duty: "<<(-1)*Q_condens<<" kW"; + cout << "\n\tEND\n\n"; + cost(); water(); power(); +} + +double column::get_cost() +{ + //cost of vessel + vol=(0.45*N)*(pow(300*D->v, 1.5)/2.4/sqrt(B->v))*sqrt(D->m/B->m); + if(vol<0.3) vol=0.3; if(vol>520)vol=520; + money = 3.4974+0.4485*log10(vol)+0.1074*pow(log10(vol),2); + money = pow(10, money); + P= (P-1)*101.325/100; + diam=sqrt(4.0*vol/pi/N/0.45); + vol=(P+1)*diam/(317.46*(850-0.6*(P+1)))+0.0315; + money *=(2.25+ 1.82*vol*2.2); + //cost of trays + vol = (pow(300*D->v, 1.5)/2.4/sqrt(B->v))*sqrt(D->m/B->m); + diam = 2.9949+0.4465*log10(vol)+0.3961*pow(log10(vol),2); + money+=1.5*pow(10, diam); + //cost of reboiler U=5250W/m2.K + vol=fabs(Q_reboil)/0.85/5.25/15.0; + if(vol<10) vol=10; if(vol>100) vol=100; + vol = 4.4646-0.5277*log10(vol)+0.3955*pow(log10(vol),2); + money += (1.63+1.66*2.5)*pow(10, vol); + //cost of condenser U=1850W/m2.K + vol=fabs(Q_condens)/0.85/1.85/(0.5*(T_d-298)); + if(vol<1) vol=1; if(vol>100) vol=100; + vol = 3.9912+0.0668*log10(vol)+0.243*pow(log10(vol),2); + money += (1.74+1.55*2.5)*pow(10, vol); + money = money*MS_YEAR/MS_2001; + return money; +} + + +void column::cost() +{ + cout << "WRITE FILE " << RUNTIME << name << ".cost" << " :\n\tBEGIN\n"; + cout << "\t>>" << get_cost(); + cout << "\n\tEND\n\n"; +} +void column::power() +{ + cout << "WRITE FILE " << RUNTIME << name << ".power" << " :\n\tBEGIN\n"; + money =(Q_reboil/0.85-Q_condens); + cout << "\t>>" << money; + cout << "\n\tEND\n\n"; +} +void column::water() +{ + cout << "WRITE FILE " << RUNTIME << name << ".water" << " :\n\tBEGIN\n"; + money = (fabs(Q_condens)/(4.185*0.85*0.25*fabs(T_d-298))); + cout << "\t>>" << money; + cout << "\n\tEND\n\n"; +} diff --git a/tools/SENSITIVITY/problems/styrene/black-box/truth/column.hpp b/tools/SENSITIVITY/problems/styrene/black-box/truth/column.hpp index 8dedb5a82bd85f4c6cf6b5d6a0dde55c8d56f299..cfd1daf16270b9ae30ba6500da2b75d7a576eb41 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/truth/column.hpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/truth/column.hpp @@ -1,61 +1,61 @@ -/* -This unit simulates a distillation column, using -the FUG method. -(ref : Seader & Henley). - -Structure in the .process file: -column {name} {pressure} {index of input stream} {index of bottoms and heads} {indexes of light key and heavy key} {x_LK and x_HK} - -How to use: - 1- Call the constructor : col = new column(in, out_B, out_D); //in is F, out_B is B, out_D is D column(nb, chem_list) - set(in, out_B, out_D) - 2- Set operating conditions : col->set(pressure, LK, x_LK, HK, x_HK); // LK and HK and integer indexes, x_LK is the undesired mole fraction of LK in B, x_HK... - 3- Set the name : col->set(name); - 4- Run the model: col->solve(); -*/ -#ifndef COLUMN_H -#define COLUMN_H - -#include "flash.hpp" -using namespace std; - -class column -{ -private: - // ofstream results, logf; - bool OK; - string name; - stream *F, *B, *D, *L, *V ; - int LK, HK, feed, i; - double x_B, x_D, T_b, T_d, T_f, vol, money, diam; - double Nmin, N, Rmin, Ract, tmp, Q_condens, Q_reboil; - double *alpha_1, *alpha_f, *alpha_N, *alpha_m; - flash *flasher; - void set_alpha(), first_split(), distribute(), condense(), reboil(); - double Fenske() { return log10(D->chem[LK]->n()*B->chem[HK]->n()/D->chem[HK]->n()/B->chem[LK]->n())/log10(alpha_m[LK]);} - double Underwood() {return L->n()*(D->chem[LK]->n()/L->chem[LK]->n()-alpha_m[LK]*D->chem[HK]->n()/L->chem[HK]->n())/(D->n()*(alpha_m[LK]-1));} - double Gilliland(){N=(Ract-Rmin)/(Ract+1); tmp=1-exp((1+54.4*N)*(N-1)/(11+117.2*N)/pow(N, 0.5)); return (tmp+Nmin)/(1-tmp);} - int Kirkbride() {tmp=pow(B->n()*F->chem[HK]->n()*pow(x_B/x_D,2)/F->chem[LK]->n()/D->n(), 0.206); return int(N/(tmp+1));} - -public: - // column(){P=0.0;} - // column(int, chemical*); - // void set(stream*&, stream*&, stream*&); - column(stream*, stream*, stream*); - ~column(); - double P; - void set(double, int, double, int, double); - void set( const string & n ) { name = n; } - bool solve(); - void write(); - void cost(), water(), power(); - - double get_cost ( void ); - double get_power ( void ) const { return Q_reboil/0.85-Q_condens; } - - double get_water ( void ) const { return fabs(Q_condens)/(4.185*0.85*0.25*fabs(T_d-298)); } - - int get_N ( void ) const { return (int) N; } - -}; -#endif +/* +This unit simulates a distillation column, using +the FUG method. +(ref : Seader & Henley). + +Structure in the .process file: +column {name} {pressure} {index of input stream} {index of bottoms and heads} {indexes of light key and heavy key} {x_LK and x_HK} + +How to use: + 1- Call the constructor : col = new column(in, out_B, out_D); //in is F, out_B is B, out_D is D column(nb, chem_list) + set(in, out_B, out_D) + 2- Set operating conditions : col->set(pressure, LK, x_LK, HK, x_HK); // LK and HK and integer indexes, x_LK is the undesired mole fraction of LK in B, x_HK... + 3- Set the name : col->set(name); + 4- Run the model: col->solve(); +*/ +#ifndef COLUMN_H +#define COLUMN_H + +#include "flash.hpp" +using namespace std; + +class column +{ +private: + // ofstream results, logf; + bool OK; + string name; + stream *F, *B, *D, *L, *V ; + int LK, HK, feed, i; + double x_B, x_D, T_b, T_d, T_f, vol, money, diam; + double Nmin, N, Rmin, Ract, tmp, Q_condens, Q_reboil; + double *alpha_1, *alpha_f, *alpha_N, *alpha_m; + flash *flasher; + void set_alpha(), first_split(), distribute(), condense(), reboil(); + double Fenske() { return log10(D->chem[LK]->n()*B->chem[HK]->n()/D->chem[HK]->n()/B->chem[LK]->n())/log10(alpha_m[LK]);} + double Underwood() {return L->n()*(D->chem[LK]->n()/L->chem[LK]->n()-alpha_m[LK]*D->chem[HK]->n()/L->chem[HK]->n())/(D->n()*(alpha_m[LK]-1));} + double Gilliland(){N=(Ract-Rmin)/(Ract+1); tmp=1-exp((1+54.4*N)*(N-1)/(11+117.2*N)/pow(N, 0.5)); return (tmp+Nmin)/(1-tmp);} + int Kirkbride() {tmp=pow(B->n()*F->chem[HK]->n()*pow(x_B/x_D,2)/F->chem[LK]->n()/D->n(), 0.206); return int(N/(tmp+1));} + +public: + // column(){P=0.0;} + // column(int, chemical*); + // void set(stream*&, stream*&, stream*&); + column(stream*, stream*, stream*); + ~column(); + double P; + void set(double, int, double, int, double); + void set( const string & n ) { name = n; } + bool solve(); + void write(); + void cost(), water(), power(); + + double get_cost ( void ); + double get_power ( void ) const { return Q_reboil/0.85-Q_condens; } + + double get_water ( void ) const { return fabs(Q_condens)/(4.185*0.85*0.25*fabs(T_d-298)); } + + int get_N ( void ) const { return (int) N; } + +}; +#endif diff --git a/tools/SENSITIVITY/problems/styrene/black-box/truth/combrx.cpp b/tools/SENSITIVITY/problems/styrene/black-box/truth/combrx.cpp index 0f30f1af32b99e3b5521dede45a6bde5aa7cbe57..83ad673825887cc0696981505fa884bb9c1a9c5d 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/truth/combrx.cpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/truth/combrx.cpp @@ -1,66 +1,66 @@ -#include "combrx.hpp" -using namespace std; - -combrx::combrx ( const string & cas ) { - - // combustion.prop : - // ----------------- - CAS = cas; - - if (CAS=="64-17-5") { - nO2 = 3; - nCO2 = 2; - nH2O = 3; - } - else if (CAS=="74-82-8") { - nO2 = 2; - nCO2 = 1; - nH2O = 2; - } - else if (CAS=="1333-74-0") { - nO2 = 0.5; - nCO2 = 0; - nH2O = 1; - } - else if (CAS=="100-42-5") { - nO2 = 10; - nCO2 = 8; - nH2O = 4; - } - else if (CAS=="74-85-1") { - nO2 = 3; - nCO2 = 2; - nH2O = 2; - } - else if (CAS=="108-88-3") { - nO2 = 9; - nCO2 = 7; - nH2O = 4; - } - else if (CAS=="100-41-4") { - nO2 = 10.5; - nCO2 = 8; - nH2O = 5; - } - else if (CAS=="71-43-2") { - nO2 = 7.5; - nCO2 = 6; - nH2O = 3; - } - else { - cout << "ERROR 21" << endl; - exit(0); - } - - COMB = new chemical(CAS); - O2 = new chemical("7782-44-7"); - N2 = new chemical("7727-37-9"); - CO2 = new chemical("124-38-9"); - H2O = new chemical("7732-18-5"); - Hro = CO2->Ho*nCO2 + nH2O*(H2O->Ho - H2O->dHvap) - COMB->Ho; - LFLo = -3420.0/Hro + 0.569e-3*Hro + 0.0538e-6*pow(Hro,2) + 1.8; - LFLo = LFLo/100.0; - UFLo = 0.0063*Hro + 0.567e-6*pow(Hro, 2) + 23.5; - UFLo = UFLo/100.0; - -} +#include "combrx.hpp" +using namespace std; + +combrx::combrx ( const string & cas ) { + + // combustion.prop : + // ----------------- + CAS = cas; + + if (CAS=="64-17-5") { + nO2 = 3; + nCO2 = 2; + nH2O = 3; + } + else if (CAS=="74-82-8") { + nO2 = 2; + nCO2 = 1; + nH2O = 2; + } + else if (CAS=="1333-74-0") { + nO2 = 0.5; + nCO2 = 0; + nH2O = 1; + } + else if (CAS=="100-42-5") { + nO2 = 10; + nCO2 = 8; + nH2O = 4; + } + else if (CAS=="74-85-1") { + nO2 = 3; + nCO2 = 2; + nH2O = 2; + } + else if (CAS=="108-88-3") { + nO2 = 9; + nCO2 = 7; + nH2O = 4; + } + else if (CAS=="100-41-4") { + nO2 = 10.5; + nCO2 = 8; + nH2O = 5; + } + else if (CAS=="71-43-2") { + nO2 = 7.5; + nCO2 = 6; + nH2O = 3; + } + else { + cout << "ERROR 21" << endl; + exit(0); + } + + COMB = new chemical(CAS); + O2 = new chemical("7782-44-7"); + N2 = new chemical("7727-37-9"); + CO2 = new chemical("124-38-9"); + H2O = new chemical("7732-18-5"); + Hro = CO2->Ho*nCO2 + nH2O*(H2O->Ho - H2O->dHvap) - COMB->Ho; + LFLo = -3420.0/Hro + 0.569e-3*Hro + 0.0538e-6*pow(Hro,2) + 1.8; + LFLo = LFLo/100.0; + UFLo = 0.0063*Hro + 0.567e-6*pow(Hro, 2) + 23.5; + UFLo = UFLo/100.0; + +} diff --git a/tools/SENSITIVITY/problems/styrene/black-box/truth/combrx.hpp b/tools/SENSITIVITY/problems/styrene/black-box/truth/combrx.hpp index 02e098bb96d4fbd6ece10fb1ef45e50803768425..b57e643762d2dbcc59dfdf040e503d580416b4ca 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/truth/combrx.hpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/truth/combrx.hpp @@ -1,29 +1,29 @@ -#ifndef COMBRX_H -#define COMBRX_H -#include "chemical.hpp" -#include "defines.hpp" -using namespace std; - -class combrx { - -private : - ifstream data; - bool stop; - double nO2, nCO2, nH2O; - char tmp[41]; - string CAS; - chemical *H2O, *N2, *O2, *CO2, *COMB; - double LFLo, UFLo, Hro, sum; - -public: - combrx( const string & cas ); - double O2_flow() { return (O2->M*nO2/1000.0); } //theoritical O2 flow, in kg/mol of COMB - double N2_flow(){return (0.79*O2_flow()/0.21);} //theoritical N2 flow, in kg/mol of COMB - double CO2_flow() {return (nCO2*CO2->M/1000.0);} //theoritical CO2 flow, in kg/mol of COMB - double H2O_flow() {return (nH2O*H2O->M/1000.0);} //theoritical H2O flow, in kg/mol of COMB - double LFL(double P, double T) {sum=LFLo + 0.03139/Hro*(T-298); if(sum<EPS) return EPS; else return sum;} //in %vol - double UFL(double P, double T) {sum=UFLo - 0.03139/Hro*(T-298) + 0.206*(log10(0.101325*P)+1); if(sum>1) return (1-EPS); else return sum;} //in %vol - double Hcomb(double T) {return (nCO2*CO2->dH(298,T,1)+ nH2O*H2O->dH(298,T,1)-nO2*O2->dH(298,T,1)-COMB->dH(298,T,1)+Hro);} //in kJ/mol - ~combrx(){delete H2O; delete N2; delete O2; delete CO2; delete COMB;} -}; -#endif +#ifndef COMBRX_H +#define COMBRX_H +#include "chemical.hpp" +#include "defines.hpp" +using namespace std; + +class combrx { + +private : + ifstream data; + bool stop; + double nO2, nCO2, nH2O; + char tmp[41]; + string CAS; + chemical *H2O, *N2, *O2, *CO2, *COMB; + double LFLo, UFLo, Hro, sum; + +public: + combrx( const string & cas ); + double O2_flow() { return (O2->M*nO2/1000.0); } //theoritical O2 flow, in kg/mol of COMB + double N2_flow(){return (0.79*O2_flow()/0.21);} //theoritical N2 flow, in kg/mol of COMB + double CO2_flow() {return (nCO2*CO2->M/1000.0);} //theoritical CO2 flow, in kg/mol of COMB + double H2O_flow() {return (nH2O*H2O->M/1000.0);} //theoritical H2O flow, in kg/mol of COMB + double LFL(double P, double T) {sum=LFLo + 0.03139/Hro*(T-298); if(sum<EPS) return EPS; else return sum;} //in %vol + double UFL(double P, double T) {sum=UFLo - 0.03139/Hro*(T-298) + 0.206*(log10(0.101325*P)+1); if(sum>1) return (1-EPS); else return sum;} //in %vol + double Hcomb(double T) {return (nCO2*CO2->dH(298,T,1)+ nH2O*H2O->dH(298,T,1)-nO2*O2->dH(298,T,1)-COMB->dH(298,T,1)+Hro);} //in kJ/mol + ~combrx(){delete H2O; delete N2; delete O2; delete CO2; delete COMB;} +}; +#endif diff --git a/tools/SENSITIVITY/problems/styrene/black-box/truth/defines.hpp b/tools/SENSITIVITY/problems/styrene/black-box/truth/defines.hpp index 5f6ad7e229d36d09449792bc7b4e73ab82251154..76a08babf8c7f46e0e043d78f0ae084fb8a5a617 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/truth/defines.hpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/truth/defines.hpp @@ -1,89 +1,89 @@ -/***************************************************************************/ -/* CONFIGURATION OF THE OPERATING SYSTEM */ -/* */ -/* If Windows platform, put a "0" */ -/* If Linux, Unix or Mac platform, put a "1" */ -/* */ -#define PLATFORM 1 /* */ -/***************************************************************************/ - -#include <iostream> -#include <fstream> -#include <cmath> - -// #include <iomanip> -// #include <cstring> -// #include <cctype> -#include <cstdlib> -// #include <ctime> -using namespace std; - - -double arrondi ( double x , int n ); - - -#define ARRONDI 1 // arrondir ou pas - -#define DEBUG 0 //choose the debug (1) or normal (0) mode -#define MUTE 0 //choose 1 to avoid all screen output, 0 to have the normal display -#define EPS 1e-10 //the software "0" - -// Platform-dependant declarations -#define WIN 0 /* all versions */ -#define OTHER 1 /* Unix, Linux, SunOS, MacIntosh */ -#define MESSAGES "runtime/messages.r" -#define RUNTIME "runtime/" -#define DATA "data/" - -//useful constants -#define R 0.0821 //ideal gas constant in atm.l/mol.K -#define MAX_TEMP 3000.0 //Maximal temperature in the process -#define pi 3.14159265358979323846 //the pi number -#define MAX_DIM 30 -#define MAX_STREAM 30 -#define MAX_UNIT 30 - -//For the chemical class -#define MAX_ERROR 0 -#define MAX_WARNING 10 - -//For the secant solver -#define TOL_SECANT 1e-8 -#define MAX_ITER_SECANT 250 - -//For the bissection solver -#define TOL_BISSECTION 1e-8 -#define MAX_ITER_BISSECTION 250 - -//For the Newton solver -#define TOL_NEWTON 1e-6 -#define MAX_ITER_NEWTON 250 -#define STEP_NEWTON 1e-3 - -//For the Runge-Kutta solver -#define N_INTER 250 -#define MAX_ITER_RK N_INTER+1 - -//For the Wegstein solver -#define MIN_THETA -3.0 -#define MAX_THETA 1.0 -#define TOL_WEGSTEIN 1e-3 -#define MAX_ITER_WEGSTEIN 50 - -//For the stream flashing -#define TOL_BP 1e-3 -#define TOL_DP 1e-3 - -//For the burner -#define TOL_BURN 1e-4 - -//For the column -#define MAX_PLATES 500 -#define MIN_PLATES 1 - -//For the flash -#define TOL_FLASH 1e-2 - -//For the cost estimtiors -#define MS_2001 1094.0 -#define MS_YEAR 1139.0 +/***************************************************************************/ +/* CONFIGURATION OF THE OPERATING SYSTEM */ +/* */ +/* If Windows platform, put a "0" */ +/* If Linux, Unix or Mac platform, put a "1" */ +/* */ +#define PLATFORM 1 /* */ +/***************************************************************************/ + +#include <iostream> +#include <fstream> +#include <cmath> + +// #include <iomanip> +// #include <cstring> +// #include <cctype> +#include <cstdlib> +// #include <ctime> +using namespace std; + + +double arrondi ( double x , int n ); + + +#define ARRONDI 1 // arrondir ou pas + +#define DEBUG 0 //choose the debug (1) or normal (0) mode +#define MUTE 0 //choose 1 to avoid all screen output, 0 to have the normal display +#define EPS 1e-10 //the software "0" + +// Platform-dependant declarations +#define WIN 0 /* all versions */ +#define OTHER 1 /* Unix, Linux, SunOS, MacIntosh */ +#define MESSAGES "runtime/messages.r" +#define RUNTIME "runtime/" +#define DATA "data/" + +//useful constants +#define R 0.0821 //ideal gas constant in atm.l/mol.K +#define MAX_TEMP 3000.0 //Maximal temperature in the process +#define pi 3.14159265358979323846 //the pi number +#define MAX_DIM 30 +#define MAX_STREAM 30 +#define MAX_UNIT 30 + +//For the chemical class +#define MAX_ERROR 0 +#define MAX_WARNING 10 + +//For the secant solver +#define TOL_SECANT 1e-8 +#define MAX_ITER_SECANT 250 + +//For the bissection solver +#define TOL_BISSECTION 1e-8 +#define MAX_ITER_BISSECTION 250 + +//For the Newton solver +#define TOL_NEWTON 1e-6 +#define MAX_ITER_NEWTON 250 +#define STEP_NEWTON 1e-3 + +//For the Runge-Kutta solver +#define N_INTER 250 +#define MAX_ITER_RK N_INTER+1 + +//For the Wegstein solver +#define MIN_THETA -3.0 +#define MAX_THETA 1.0 +#define TOL_WEGSTEIN 1e-3 +#define MAX_ITER_WEGSTEIN 50 + +//For the stream flashing +#define TOL_BP 1e-3 +#define TOL_DP 1e-3 + +//For the burner +#define TOL_BURN 1e-4 + +//For the column +#define MAX_PLATES 500 +#define MIN_PLATES 1 + +//For the flash +#define TOL_FLASH 1e-2 + +//For the cost estimtiors +#define MS_2001 1094.0 +#define MS_YEAR 1139.0 diff --git a/tools/SENSITIVITY/problems/styrene/black-box/truth/flash.cpp b/tools/SENSITIVITY/problems/styrene/black-box/truth/flash.cpp index 027ad0e7dd937f8f0eb8a52d9401d2d00d78f2c2..930ea8f58ac00b78b1aea1b6933d286eafb9bae0 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/truth/flash.cpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/truth/flash.cpp @@ -1,220 +1,220 @@ -#include "flash.hpp" -#include "bissection.cpp" -using namespace std; - -flash::flash ( stream * in , stream * out_L , stream * out_V ) { - F = in; - Fcopy = new stream("Fcopy", F->nb, F->chem); - Tin = F->T; - z = new double[F->nb]; - for ( i = 0 ; i < F->nb ; i++ ) - z[i] = F->chem[i]->n()/F->n(); - - L = out_L; - V = out_V; - success = true; - K = new double[F->nb]; - task=0; - solver = new bissection<flash>(); -} - -void flash::set(double p, double t) -{ - P=p; - T=t; - for (i=0;i<F->nb;i++) - { - if(F->chem[i]->Tc<T) K[i] = F->chem[i]->Psat(T)/P; - else K[i]=1; - } - F->set(P,T); -} - -bool flash::solve() -{ - L->purge(); - V->purge(); - f_x=F->quality(); - - if( 0.0 < f_x && f_x < 1.0) - { - - // TOTO - for ( i = 0 ; i < F->nb ; i++ ) { - if ( F->chem[i]->Tc < T ) { - F->m -= F->chem[i]->m; - F->chem[i]->m = 0; - } - } - - for ( i = 0 ; i < F->nb ; i++ ) - z[i] = F->chem[i]->n()/F->n(); - - solver->set(this, 0.0, 1.0); - - success=solver->run(); - - if (!success) - { -// if(task==0){ -// log.open(MESSAGES, ios::app); -// log<<" --> Warning <-- Solver of FLASH "<<name<<" did not converge.\n"; -// log.close();} - for (i=0;i<F->nb;i++) - { - if (T<F->chem[i]->Tc && T>F->chem[i]->Tboil(P)) {V->chem[i]->m=F->chem[i]->m; V->m+=V->chem[i]->m;} - if (T<F->chem[i]->Tc && T<=F->chem[i]->Tboil(P)) {L->chem[i]->m=F->chem[i]->m; L->m+=L->chem[i]->m;} - } - } - else - { - - V->m = x*F->n(); - L->m = F->n() - V->m; - //Distribute liquid components - for (i=0;i<L->nb;i++) - { - L->chem[i]->m = (L->m*z[i])/(1+x*(K[i]-1))*L->chem[i]->M/1000.0; - L->chem[i]->state=0; - } - - - L->m=0.0; for(i=0;i<L->nb;i++) L->m+=L->chem[i]->m; - //Distribute vapor components - for (i=0;i<V->nb;i++) - { - V->chem[i]->m = V->m*L->chem[i]->n()*K[i]/L->n()*V->chem[i]->M/1000.0; - V->chem[i]->state=1; - } - V->m=0.0; for(i=0;i<V->nb;i++) V->m+=V->chem[i]->m; - } - for(i=0;i<F->nb;i++) - if(F->chem[i]->Tc<T){V->chem[i]->m=Fcopy->chem[i]->m; V->m+=Fcopy->chem[i]->m;} - - } - else - { - /* if(task==0) - { - log.open("runtime\\messages.r", ios::app); - if (T<F->dp) log<<" --> Warning <-- Mixture in "<<name<<" can't be flashed (bp="<<F->bp<<" dp="<<F->dp<<").\n"; - log.close(); - } */ - for (i=0;i<F->nb;i++) - { - if (F->chem[i]->Tc<T || f_x>=1) {V->chem[i]->m=Fcopy->chem[i]->m; V->m+=V->chem[i]->m; } - else {L->chem[i]->m=Fcopy->chem[i]->m; L->m+=L->chem[i]->m;} - - } - success = true; - } - L->set(P,T); - V->set(P,T); - Q = 0.0; - for (i=0;i<F->nb;i++) - { - Q += L->chem[i]->dH(Tin, T, P)*L->chem[i]->n(); - Q += V->chem[i]->dH(Tin, T, P)*V->chem[i]->n(); - } - F->m=0; - for(i=0;i<Fcopy->nb;i++) {F->chem[i]->m = Fcopy->chem[i]->m; F->m+=F->chem[i]->m;} - F->set(F->P,Tin); -// if(fabs(V->m+L->m-F->m)>sqrt(EPS)) -// { -// log.open(MESSAGES, ios::app); -// log<<" --> Warning <-- Block "<<name<<" is not in mass balance ("<<fabs(V->m+L->m-F->m)/F->m<<").\n"; -// log.close(); -// } -// V->write();// TOTO - // L->write(); // TOTO - - return success; -} - -double flash::f(double psy) -{ - x=psy; - f_x=0.0; - for(i=0;i<F->nb;i++) f_x += (z[i]*(1-K[i]))/(1+psy*(K[i]-1)); - return f_x; -} - -bool flash::adiabatic() -{ - task=1; - F->set(P,T); T=F->dp; - step=-5; - Q=1; - - - while (fabs(step)>0.01 && fabs(Q)>0.1) - { - T+=step; - F->set(P,T); - - for (i=0;i<F->nb;i++) - K[i] = F->chem[i]->Psat(T)/P; - - success=solve(); - - - if (Q<0 && step<0) step*=-0.5; - if (Q>0 && step>0) step*=-0.5; - } - if (fabs(Q)<0.1) return true; - else return false; -} - -void flash::write() { - cout << "WRITE FILE " << RUNTIME << name << ".unit" << " :\n\tBEGIN\n"; - cout << "\t>> "<<name; - cout << endl << "\t>> stream in : "<<F->name; - cout <<endl<<"\t>> streams out : "<<L->name<<" (liq.) "<<V->name<<" (vap.)"; - cout <<endl<<"\t>> P = "<<P<<" atm, T = "<<T<<" K"; - cout <<endl<<"\t>> Heat duty = "<<Q; - if (success==true) cout <<" kW (converge normally)"; - cout << "\n\tEND\n\n"; - cost(); - power(); - water(); -} - - -double flash::get_cost ( void ) { - vol=15.0*(L->v+V->v); - if(vol<0.3) vol=0.3; if(vol>520)vol=520; - step = 3.4974+0.4485*log10(vol)+0.1074*pow(log10(vol),2); - step = pow(10, step); - P= (P-1)*101.325/100; - f_x=pow(2.0*vol/pi, 1.0/3.0); - vol=(P+1)*f_x/(317.46*(850-0.6*(P+1)))+0.0315; - step *=(2.25+ 1.82*vol*2.2); - step = step*MS_YEAR/MS_2001; - return step; -} - -void flash::cost() { - cout << "WRITE FILE " << RUNTIME << name << ".cost" << " :\n\tBEGIN\n"; - cout << "\t>>" << get_cost(); - cout << "\n\tEND\n\n"; -} -void flash::power() { - cout << "WRITE FILE " << RUNTIME << name << ".power" << " :\n\tBEGIN\n"; - cout << "\t>>" << Q; - cout << "\n\tEND\n\n"; -} - -double flash::get_water ( void ) { - step = (Q<0.0) ? fabs(Q)/(4.185*0.10*(Tin-298)) : 0.0; - return step; -} - -void flash::water() { - cout << "WRITE FILE " << RUNTIME << name << ".water" << " :\n\tBEGIN\n"; - if(Q<0.0) - step= (fabs(Q)/(4.185*0.10*(Tin-298))); - else - step= 0.0; - cout << "\t>>" << step; - cout << "\n\tEND\n\n"; -} +#include "flash.hpp" +#include "bissection.cpp" +using namespace std; + +flash::flash ( stream * in , stream * out_L , stream * out_V ) { + F = in; + Fcopy = new stream("Fcopy", F->nb, F->chem); + Tin = F->T; + z = new double[F->nb]; + for ( i = 0 ; i < F->nb ; i++ ) + z[i] = F->chem[i]->n()/F->n(); + + L = out_L; + V = out_V; + success = true; + K = new double[F->nb]; + task=0; + solver = new bissection<flash>(); +} + +void flash::set(double p, double t) +{ + P=p; + T=t; + for (i=0;i<F->nb;i++) + { + if(F->chem[i]->Tc<T) K[i] = F->chem[i]->Psat(T)/P; + else K[i]=1; + } + F->set(P,T); +} + +bool flash::solve() +{ + L->purge(); + V->purge(); + f_x=F->quality(); + + if( 0.0 < f_x && f_x < 1.0) + { + + // TOTO + for ( i = 0 ; i < F->nb ; i++ ) { + if ( F->chem[i]->Tc < T ) { + F->m -= F->chem[i]->m; + F->chem[i]->m = 0; + } + } + + for ( i = 0 ; i < F->nb ; i++ ) + z[i] = F->chem[i]->n()/F->n(); + + solver->set(this, 0.0, 1.0); + + success=solver->run(); + + if (!success) + { +// if(task==0){ +// log.open(MESSAGES, ios::app); +// log<<" --> Warning <-- Solver of FLASH "<<name<<" did not converge.\n"; +// log.close();} + for (i=0;i<F->nb;i++) + { + if (T<F->chem[i]->Tc && T>F->chem[i]->Tboil(P)) {V->chem[i]->m=F->chem[i]->m; V->m+=V->chem[i]->m;} + if (T<F->chem[i]->Tc && T<=F->chem[i]->Tboil(P)) {L->chem[i]->m=F->chem[i]->m; L->m+=L->chem[i]->m;} + } + } + else + { + + V->m = x*F->n(); + L->m = F->n() - V->m; + //Distribute liquid components + for (i=0;i<L->nb;i++) + { + L->chem[i]->m = (L->m*z[i])/(1+x*(K[i]-1))*L->chem[i]->M/1000.0; + L->chem[i]->state=0; + } + + + L->m=0.0; for(i=0;i<L->nb;i++) L->m+=L->chem[i]->m; + //Distribute vapor components + for (i=0;i<V->nb;i++) + { + V->chem[i]->m = V->m*L->chem[i]->n()*K[i]/L->n()*V->chem[i]->M/1000.0; + V->chem[i]->state=1; + } + V->m=0.0; for(i=0;i<V->nb;i++) V->m+=V->chem[i]->m; + } + for(i=0;i<F->nb;i++) + if(F->chem[i]->Tc<T){V->chem[i]->m=Fcopy->chem[i]->m; V->m+=Fcopy->chem[i]->m;} + + } + else + { + /* if(task==0) + { + log.open("runtime\\messages.r", ios::app); + if (T<F->dp) log<<" --> Warning <-- Mixture in "<<name<<" can't be flashed (bp="<<F->bp<<" dp="<<F->dp<<").\n"; + log.close(); + } */ + for (i=0;i<F->nb;i++) + { + if (F->chem[i]->Tc<T || f_x>=1) {V->chem[i]->m=Fcopy->chem[i]->m; V->m+=V->chem[i]->m; } + else {L->chem[i]->m=Fcopy->chem[i]->m; L->m+=L->chem[i]->m;} + + } + success = true; + } + L->set(P,T); + V->set(P,T); + Q = 0.0; + for (i=0;i<F->nb;i++) + { + Q += L->chem[i]->dH(Tin, T, P)*L->chem[i]->n(); + Q += V->chem[i]->dH(Tin, T, P)*V->chem[i]->n(); + } + F->m=0; + for(i=0;i<Fcopy->nb;i++) {F->chem[i]->m = Fcopy->chem[i]->m; F->m+=F->chem[i]->m;} + F->set(F->P,Tin); +// if(fabs(V->m+L->m-F->m)>sqrt(EPS)) +// { +// log.open(MESSAGES, ios::app); +// log<<" --> Warning <-- Block "<<name<<" is not in mass balance ("<<fabs(V->m+L->m-F->m)/F->m<<").\n"; +// log.close(); +// } +// V->write();// TOTO + // L->write(); // TOTO + + return success; +} + +double flash::f(double psy) +{ + x=psy; + f_x=0.0; + for(i=0;i<F->nb;i++) f_x += (z[i]*(1-K[i]))/(1+psy*(K[i]-1)); + return f_x; +} + +bool flash::adiabatic() +{ + task=1; + F->set(P,T); T=F->dp; + step=-5; + Q=1; + + + while (fabs(step)>0.01 && fabs(Q)>0.1) + { + T+=step; + F->set(P,T); + + for (i=0;i<F->nb;i++) + K[i] = F->chem[i]->Psat(T)/P; + + success=solve(); + + + if (Q<0 && step<0) step*=-0.5; + if (Q>0 && step>0) step*=-0.5; + } + if (fabs(Q)<0.1) return true; + else return false; +} + +void flash::write() { + cout << "WRITE FILE " << RUNTIME << name << ".unit" << " :\n\tBEGIN\n"; + cout << "\t>> "<<name; + cout << endl << "\t>> stream in : "<<F->name; + cout <<endl<<"\t>> streams out : "<<L->name<<" (liq.) "<<V->name<<" (vap.)"; + cout <<endl<<"\t>> P = "<<P<<" atm, T = "<<T<<" K"; + cout <<endl<<"\t>> Heat duty = "<<Q; + if (success==true) cout <<" kW (converge normally)"; + cout << "\n\tEND\n\n"; + cost(); + power(); + water(); +} + + +double flash::get_cost ( void ) { + vol=15.0*(L->v+V->v); + if(vol<0.3) vol=0.3; if(vol>520)vol=520; + step = 3.4974+0.4485*log10(vol)+0.1074*pow(log10(vol),2); + step = pow(10, step); + P= (P-1)*101.325/100; + f_x=pow(2.0*vol/pi, 1.0/3.0); + vol=(P+1)*f_x/(317.46*(850-0.6*(P+1)))+0.0315; + step *=(2.25+ 1.82*vol*2.2); + step = step*MS_YEAR/MS_2001; + return step; +} + +void flash::cost() { + cout << "WRITE FILE " << RUNTIME << name << ".cost" << " :\n\tBEGIN\n"; + cout << "\t>>" << get_cost(); + cout << "\n\tEND\n\n"; +} +void flash::power() { + cout << "WRITE FILE " << RUNTIME << name << ".power" << " :\n\tBEGIN\n"; + cout << "\t>>" << Q; + cout << "\n\tEND\n\n"; +} + +double flash::get_water ( void ) { + step = (Q<0.0) ? fabs(Q)/(4.185*0.10*(Tin-298)) : 0.0; + return step; +} + +void flash::water() { + cout << "WRITE FILE " << RUNTIME << name << ".water" << " :\n\tBEGIN\n"; + if(Q<0.0) + step= (fabs(Q)/(4.185*0.10*(Tin-298))); + else + step= 0.0; + cout << "\t>>" << step; + cout << "\n\tEND\n\n"; +} diff --git a/tools/SENSITIVITY/problems/styrene/black-box/truth/flash.hpp b/tools/SENSITIVITY/problems/styrene/black-box/truth/flash.hpp index b6cdb41b3b5c556d848c01ec23b40b0ba0f4356e..29bc250c316f150c5f2880ab5696b5601867009d 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/truth/flash.hpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/truth/flash.hpp @@ -1,55 +1,55 @@ -/* -This unit takes operating P and T, and indexes of streams. It applies -the Rachford-Rice procedure to solve the isothermal flash problem -(ref : Seader & Henley). - -Structure in the .process file: -flash {name} {pressure} {temperature} {index of input stream} {index of output liquid and output vapor} - -How to use: - 1- Call the constructor : flash1 = new flash(in, out_L, out_V); //in is the feed, out_L is the liquid output and out_V is the vapor output - 2- Set P and T: flash1->set(P,T); - 3- Set the name: flash1->set(name); - 4a- Perform an isothermal flash : flash1->solve(); - 4b- Perform an adiabatic flash: flash1->adiabatic(); -*/ -#ifndef FLASH_H -#define FLASH_H - -#include "stream.hpp" -#include "bissection.hpp" -using namespace std; - -class flash { -private: - bool success; - bissection<flash> *solver; - // ofstream log, results; -// char name[31], filename[41]; //name of the unit - - string name; - - int i, task; //task=0: isothermal flash; task=1:adiabatic flash - stream *F, *Fcopy; //pointer to the input stream - stream *L, *V; //pointers to liquid and vapor output streams - double f_x, x, *K, *z; //pressure (given) and temperature (given) - double Q, Tin, step, vol; //required power, in kW - -public: - flash(){P=0.0; T=0.0;} - flash(stream*, stream*, stream*); //defines the connectivities of this unit - ~flash(){delete Fcopy; delete [] K; delete [] z; delete solver;} - double P ,T; - void set(double, double); - void set( const string & n ) { name = n; } - bool solve(); //applies the Rachford-Rice procedure - bool adiabatic(); //adiabatic isobaric flash - double f(double); //returns the function to the solver - void write(); - double get_water ( void ); - double get_cost ( void ); - - double get_power ( void ) const { return Q; } - void cost(), water(), power(); -}; -#endif +/* +This unit takes operating P and T, and indexes of streams. It applies +the Rachford-Rice procedure to solve the isothermal flash problem +(ref : Seader & Henley). + +Structure in the .process file: +flash {name} {pressure} {temperature} {index of input stream} {index of output liquid and output vapor} + +How to use: + 1- Call the constructor : flash1 = new flash(in, out_L, out_V); //in is the feed, out_L is the liquid output and out_V is the vapor output + 2- Set P and T: flash1->set(P,T); + 3- Set the name: flash1->set(name); + 4a- Perform an isothermal flash : flash1->solve(); + 4b- Perform an adiabatic flash: flash1->adiabatic(); +*/ +#ifndef FLASH_H +#define FLASH_H + +#include "stream.hpp" +#include "bissection.hpp" +using namespace std; + +class flash { +private: + bool success; + bissection<flash> *solver; + // ofstream log, results; +// char name[31], filename[41]; //name of the unit + + string name; + + int i, task; //task=0: isothermal flash; task=1:adiabatic flash + stream *F, *Fcopy; //pointer to the input stream + stream *L, *V; //pointers to liquid and vapor output streams + double f_x, x, *K, *z; //pressure (given) and temperature (given) + double Q, Tin, step, vol; //required power, in kW + +public: + flash(){P=0.0; T=0.0;} + flash(stream*, stream*, stream*); //defines the connectivities of this unit + ~flash(){delete Fcopy; delete [] K; delete [] z; delete solver;} + double P ,T; + void set(double, double); + void set( const string & n ) { name = n; } + bool solve(); //applies the Rachford-Rice procedure + bool adiabatic(); //adiabatic isobaric flash + double f(double); //returns the function to the solver + void write(); + double get_water ( void ); + double get_cost ( void ); + + double get_power ( void ) const { return Q; } + void cost(), water(), power(); +}; +#endif diff --git a/tools/SENSITIVITY/problems/styrene/black-box/truth/heatx.cpp b/tools/SENSITIVITY/problems/styrene/black-box/truth/heatx.cpp index 3c23822ae8f89a1971ec24d0d35b218e13ebbf40..fd8942e30cbea0202a6a60ed31b1a3f0b03974a4 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/truth/heatx.cpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/truth/heatx.cpp @@ -1,146 +1,146 @@ -#include "heatx.hpp" -#include "bissection.cpp" - -heatx::heatx(bool m, stream* s1, stream* s2) -{ - in = s1; - out = s2; - out->m=0; - for(i=0;i<in->nb;i++) - { - out->chem[i]->m=in->chem[i]->m; - out->m+=out->chem[i]->m; - } - solver = new bissection<heatx>(); - mode = m; - success = true; -} - -void heatx::set(double d1, double d2) -{ - if(mode==0) T=d1; - if(mode==1) Q=d1; - eta = d2; -} - -bool heatx::solve() -{ - if(mode==0) - { - Q = 0.0; - out->set(in->P, T); - // out->write(); // WRITE TOTO - for(i=0;i<in->nb;i++) - Q+=out->chem[i]->dH(in->T, out->T, in->P)*out->chem[i]->n(); - if(eta>EPS) - Qreal = Q/eta; - else { - Qreal=Q; - success=false; - } - } - if(mode==1) - { - Qreal = eta*Q; - min = in->T; - max = 2000; - solver->set(this, min, max); - success = solver->run(); - out->set(in->P, T); - //out->write(); // WRITE TOTO - } - return success; -} - - -double heatx::f(double x) -{ - T=x; - max = Qreal; - for(i=0;i<in->nb;i++) - max -= out->chem[i]->dH(in->T, T, in->P)*out->chem[i]->n(); - return max; -} - -void heatx::write() -{ - - cout << "WRITE FILE " << RUNTIME << name << ".unit" << " :\n\tBEGIN\n"; - cout << "\t>> " << name; - cout << endl << "\t>> stream in: " << in->name << " T = " << in->T <<" K"; - cout << endl << "\t>> stream out: " << out->name << " T = " << out->T <<" K"; - if (mode==0) - cout<<endl<<"\t>> Heat duty : "<<Qreal<<" kW"; - if (mode==1) - cout<<endl<<"\t>> Heat duty : "<<Q<<" kW"; - if (success) - cout<<endl<<"\t>> Heat losses "<<fabs(Qreal-Q)<<" kW (converged normally)"; - cout << "\n\tEND\n\n"; - - cost(); - power(); - water(); -} - - - -double heatx::get_cost ( void ) { - if(mode==1) min=fabs(Q)/0.225/(eta)/fabs(out->T-in->T); - if(mode==0) min=fabs(Qreal)/0.25/(eta)/fabs(out->T-in->T); - if(min<10) min=10; if(min>1000) min=1000; - max = 4.3247-0.303*log10(min)+0.1634*pow(log10(min),2); - T=in->P; - T = (T-1)*1.01325; - if (fabs(T)<EPS) T=0.1; if(T>100) T=100; - min=0.03881-0.11272*log10(T)+0.08183*pow(log10(T),2); - min=pow(10, min); - max = (1.63+1.66*2.5*min)*pow(10, max); - max = max*MS_YEAR/MS_2001; - return max; -} - - -void heatx::cost() -{ - cout << setprecision(5); - cout << "WRITE FILE " << RUNTIME << name << ".cost" << " :\n\tBEGIN\n"; - cout << "\t>>" << get_cost(); - cout << "\n\tEND\n\n"; -} - - - -double heatx::get_water ( void ) -{ - max = (Q<0.0) ? fabs(Q)/(4.185*0.10*(out->T-298)) : 0.0; - return max; -} - - -void heatx::water() -{ - if(Q<0.0) max = fabs(Q)/(4.185*0.10*(out->T-298)); - else max = 0.0; - cout << "WRITE FILE " << RUNTIME << name << ".water" << " :\n\tBEGIN\n"; - cout << "\t>>" << max; - cout << "\n\tEND\n\n"; - -} - -double heatx::get_power ( void ) { - max = (mode) ? Q : Qreal; - if (max>EPS) - return max; - return 0.0; -} - -void heatx::power() -{ - if(mode==0) max = Qreal; - if(mode==1) max = Q; - - cout << "WRITE FILE " << RUNTIME << name << ".power" << " :\n\tBEGIN\n"; - if(max>EPS) cout<< "\t>>" << max; - else cout<< "\t>>" << 0; - cout << "\n\tEND\n\n"; -} +#include "heatx.hpp" +#include "bissection.cpp" + +heatx::heatx(bool m, stream* s1, stream* s2) +{ + in = s1; + out = s2; + out->m=0; + for(i=0;i<in->nb;i++) + { + out->chem[i]->m=in->chem[i]->m; + out->m+=out->chem[i]->m; + } + solver = new bissection<heatx>(); + mode = m; + success = true; +} + +void heatx::set(double d1, double d2) +{ + if(mode==0) T=d1; + if(mode==1) Q=d1; + eta = d2; +} + +bool heatx::solve() +{ + if(mode==0) + { + Q = 0.0; + out->set(in->P, T); + // out->write(); // WRITE TOTO + for(i=0;i<in->nb;i++) + Q+=out->chem[i]->dH(in->T, out->T, in->P)*out->chem[i]->n(); + if(eta>EPS) + Qreal = Q/eta; + else { + Qreal=Q; + success=false; + } + } + if(mode==1) + { + Qreal = eta*Q; + min = in->T; + max = 2000; + solver->set(this, min, max); + success = solver->run(); + out->set(in->P, T); + //out->write(); // WRITE TOTO + } + return success; +} + + +double heatx::f(double x) +{ + T=x; + max = Qreal; + for(i=0;i<in->nb;i++) + max -= out->chem[i]->dH(in->T, T, in->P)*out->chem[i]->n(); + return max; +} + +void heatx::write() +{ + + cout << "WRITE FILE " << RUNTIME << name << ".unit" << " :\n\tBEGIN\n"; + cout << "\t>> " << name; + cout << endl << "\t>> stream in: " << in->name << " T = " << in->T <<" K"; + cout << endl << "\t>> stream out: " << out->name << " T = " << out->T <<" K"; + if (mode==0) + cout<<endl<<"\t>> Heat duty : "<<Qreal<<" kW"; + if (mode==1) + cout<<endl<<"\t>> Heat duty : "<<Q<<" kW"; + if (success) + cout<<endl<<"\t>> Heat losses "<<fabs(Qreal-Q)<<" kW (converged normally)"; + cout << "\n\tEND\n\n"; + + cost(); + power(); + water(); +} + + + +double heatx::get_cost ( void ) { + if(mode==1) min=fabs(Q)/0.225/(eta)/fabs(out->T-in->T); + if(mode==0) min=fabs(Qreal)/0.25/(eta)/fabs(out->T-in->T); + if(min<10) min=10; if(min>1000) min=1000; + max = 4.3247-0.303*log10(min)+0.1634*pow(log10(min),2); + T=in->P; + T = (T-1)*1.01325; + if (fabs(T)<EPS) T=0.1; if(T>100) T=100; + min=0.03881-0.11272*log10(T)+0.08183*pow(log10(T),2); + min=pow(10, min); + max = (1.63+1.66*2.5*min)*pow(10, max); + max = max*MS_YEAR/MS_2001; + return max; +} + + +void heatx::cost() +{ + cout << setprecision(5); + cout << "WRITE FILE " << RUNTIME << name << ".cost" << " :\n\tBEGIN\n"; + cout << "\t>>" << get_cost(); + cout << "\n\tEND\n\n"; +} + + + +double heatx::get_water ( void ) +{ + max = (Q<0.0) ? fabs(Q)/(4.185*0.10*(out->T-298)) : 0.0; + return max; +} + + +void heatx::water() +{ + if(Q<0.0) max = fabs(Q)/(4.185*0.10*(out->T-298)); + else max = 0.0; + cout << "WRITE FILE " << RUNTIME << name << ".water" << " :\n\tBEGIN\n"; + cout << "\t>>" << max; + cout << "\n\tEND\n\n"; + +} + +double heatx::get_power ( void ) { + max = (mode) ? Q : Qreal; + if (max>EPS) + return max; + return 0.0; +} + +void heatx::power() +{ + if(mode==0) max = Qreal; + if(mode==1) max = Q; + + cout << "WRITE FILE " << RUNTIME << name << ".power" << " :\n\tBEGIN\n"; + if(max>EPS) cout<< "\t>>" << max; + else cout<< "\t>>" << 0; + cout << "\n\tEND\n\n"; +} diff --git a/tools/SENSITIVITY/problems/styrene/black-box/truth/heatx.hpp b/tools/SENSITIVITY/problems/styrene/black-box/truth/heatx.hpp index f9854adf318b541dcac49e2466d35cc69683cd2d..d3b7dffa4dd8771694a77c52ad38a6aba478e821 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/truth/heatx.hpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/truth/heatx.hpp @@ -1,49 +1,49 @@ -/* -This unit performs the heating of a stream (mode 0) or the heat -exchange to a stream (mode 1). -(ref : McCabe, Smith & Harriott) - -Structure in the .process file: -mode 0 : heatx {name} 0 {index of input stream} {index of output stream} {T out} {efficiency} //efficiency is a fraction between 0 and 1 -mode 1 : heatx {name} 1 {index of input stream} {index of output stream} {Q} {efficiency} //Q is the heat flow in kW -How to use: - 1- Call the constructor: heat = new heatx(mode, in, out); - 2- Set the operating conditions : heat->set(T_out, eta); //mode 0 - or : heat->set(Q, eta); //mode 1 - 3- Set the name of the unit: heat->set(name); - 4- Solve: bool=heat->solve(); -*/ -#ifndef HEATX_H -#define HEATX_H - -#include "stream.hpp" -#include "bissection.hpp" -using namespace std; - -class heatx -{ -private: - int i; - bool success, mode; - bissection<heatx> *solver; - // ofstream logf, results; - double min, max; - string name; - stream *in, *out; //streams of the unit - double eta, Q, Qreal, T; - -public: - heatx(){} - heatx(bool, stream*, stream*); //defines the connectivities of this unit - ~heatx(){delete solver;} - void set(double, double); - void set(const string & n) { name = n; } - double f(double); - bool solve(); - void write(); - void power(), water(), cost(); - double get_cost(); - double get_power(); - double get_water(); -}; -#endif +/* +This unit performs the heating of a stream (mode 0) or the heat +exchange to a stream (mode 1). +(ref : McCabe, Smith & Harriott) + +Structure in the .process file: +mode 0 : heatx {name} 0 {index of input stream} {index of output stream} {T out} {efficiency} //efficiency is a fraction between 0 and 1 +mode 1 : heatx {name} 1 {index of input stream} {index of output stream} {Q} {efficiency} //Q is the heat flow in kW +How to use: + 1- Call the constructor: heat = new heatx(mode, in, out); + 2- Set the operating conditions : heat->set(T_out, eta); //mode 0 + or : heat->set(Q, eta); //mode 1 + 3- Set the name of the unit: heat->set(name); + 4- Solve: bool=heat->solve(); +*/ +#ifndef HEATX_H +#define HEATX_H + +#include "stream.hpp" +#include "bissection.hpp" +using namespace std; + +class heatx +{ +private: + int i; + bool success, mode; + bissection<heatx> *solver; + // ofstream logf, results; + double min, max; + string name; + stream *in, *out; //streams of the unit + double eta, Q, Qreal, T; + +public: + heatx(){} + heatx(bool, stream*, stream*); //defines the connectivities of this unit + ~heatx(){delete solver;} + void set(double, double); + void set(const string & n) { name = n; } + double f(double); + bool solve(); + void write(); + void power(), water(), cost(); + double get_cost(); + double get_power(); + double get_water(); +}; +#endif diff --git a/tools/SENSITIVITY/problems/styrene/black-box/truth/mix.cpp b/tools/SENSITIVITY/problems/styrene/black-box/truth/mix.cpp index 00202a2af2f1ce299966b7b44e1fe85c060950d0..dc02dc7e4b82f42e8631fadcb4d4b2d8500fec32 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/truth/mix.cpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/truth/mix.cpp @@ -1,80 +1,80 @@ -#include "mix.hpp" -#include "bissection.cpp" -using namespace std; - -mix::mix ( int n , stream ** s1 , stream * s2 ) { - nb_in=n; - in = s1; - out= s2; - success = true; - solver = new bissection<mix>(); -} - -bool mix::solve() -{ - //Mass balance - out->m=0; - out->purge(); - for (j=0; j<out->nb;j++) - for (i=0;i<nb_in;i++) if(in[i]->chem[j]->m>EPS) - { - out->chem[j]->m+=in[i]->chem[j]->m; - out->m+=in[i]->chem[j]->m; - } - //Find the temperature - double max=0.0; double min=1e6; - for(i=0;i<nb_in;i++) - for(j=0;j<out->nb;j++) - { - if(in[i]->chem[j]->T>max && in[i]->chem[j]->m>EPS) max=in[i]->chem[j]->T; - if(in[i]->chem[j]->T<min && in[i]->chem[j]->m>EPS) min=in[i]->chem[j]->T; - } - if(fabs(max-min)<EPS) T=max; - else - { - solver->set(this, min, max); - success = solver->run(); - } - out->set(P,T); - // if (success==false) - // { - // log.open(MESSAGES, ios::app); - // log<<" --> Warning <-- Solver of "<<name<<" did not converge.\n"; - // log.close(); - // } - // min = 0; - // for(i=0;i<nb_in;i++) - // min+=in[i]->m; - // if(fabs(min-out->m)>sqrt(EPS)) - // { - // log.open(MESSAGES, ios::app); - // log<<" --> Warning <-- Block "<<name<<" is not in mass balance ("<<fabs(min-out->m)/min<<").\n"; - // log.close(); - // } - - // out->write(); // WRITE TOTO - return success; -} - -double mix::f(double x) -{ - T=x; - double energy=0.0; //in kW - for (j=0; j<out->nb;j++) - for (i=0;i<nb_in;i++) - energy += in[i]->chem[j]->dH(in[i]->T, T, P)*in[i]->chem[j]->n()/1000; - return energy; -} - -void mix::write() { - cout << "WRITE FILE " << RUNTIME << name << ".unit" << " :\n\tBEGIN\n"; - cout << "\t>> " << name - << endl << "\t>> streams in: "; - for ( int i = 0 ; i < nb_in ; i++ ) - cout << in[i]->name << " "; - cout << endl << "\t>> stream out: " << out->name; - cout <<endl << "\t>> P = " << P << " atm, T = " << T; - if (success) - cout << " K (converged normally)"; - cout << "\n\tEND\n\n"; -} +#include "mix.hpp" +#include "bissection.cpp" +using namespace std; + +mix::mix ( int n , stream ** s1 , stream * s2 ) { + nb_in=n; + in = s1; + out= s2; + success = true; + solver = new bissection<mix>(); +} + +bool mix::solve() +{ + //Mass balance + out->m=0; + out->purge(); + for (j=0; j<out->nb;j++) + for (i=0;i<nb_in;i++) if(in[i]->chem[j]->m>EPS) + { + out->chem[j]->m+=in[i]->chem[j]->m; + out->m+=in[i]->chem[j]->m; + } + //Find the temperature + double max=0.0; double min=1e6; + for(i=0;i<nb_in;i++) + for(j=0;j<out->nb;j++) + { + if(in[i]->chem[j]->T>max && in[i]->chem[j]->m>EPS) max=in[i]->chem[j]->T; + if(in[i]->chem[j]->T<min && in[i]->chem[j]->m>EPS) min=in[i]->chem[j]->T; + } + if(fabs(max-min)<EPS) T=max; + else + { + solver->set(this, min, max); + success = solver->run(); + } + out->set(P,T); + // if (success==false) + // { + // log.open(MESSAGES, ios::app); + // log<<" --> Warning <-- Solver of "<<name<<" did not converge.\n"; + // log.close(); + // } + // min = 0; + // for(i=0;i<nb_in;i++) + // min+=in[i]->m; + // if(fabs(min-out->m)>sqrt(EPS)) + // { + // log.open(MESSAGES, ios::app); + // log<<" --> Warning <-- Block "<<name<<" is not in mass balance ("<<fabs(min-out->m)/min<<").\n"; + // log.close(); + // } + + // out->write(); // WRITE TOTO + return success; +} + +double mix::f(double x) +{ + T=x; + double energy=0.0; //in kW + for (j=0; j<out->nb;j++) + for (i=0;i<nb_in;i++) + energy += in[i]->chem[j]->dH(in[i]->T, T, P)*in[i]->chem[j]->n()/1000; + return energy; +} + +void mix::write() { + cout << "WRITE FILE " << RUNTIME << name << ".unit" << " :\n\tBEGIN\n"; + cout << "\t>> " << name + << endl << "\t>> streams in: "; + for ( int i = 0 ; i < nb_in ; i++ ) + cout << in[i]->name << " "; + cout << endl << "\t>> stream out: " << out->name; + cout <<endl << "\t>> P = " << P << " atm, T = " << T; + if (success) + cout << " K (converged normally)"; + cout << "\n\tEND\n\n"; +} diff --git a/tools/SENSITIVITY/problems/styrene/black-box/truth/mix.hpp b/tools/SENSITIVITY/problems/styrene/black-box/truth/mix.hpp index 85b8d771f173ba66deb363e2586bb42d7cd74854..6d4ee0f28d6696616e803fdfe89e6689b3001d69 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/truth/mix.hpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/truth/mix.hpp @@ -1,44 +1,44 @@ -/* -This unit takes more than two input streams and merge them in one -output stream. The pressure must be specified by the user, and the -temperature of the output stream is computed. - -Structure in the .process file: -mix {name} {pressure} {nb_in} {indexes of input streams} {index of output stream} - -How to use: - 1- Call the constructor: mix1 = new mix(nb_in, list1_in, out); - 2- Set the operating pressure : mix1->set(P); - 3- Set the name of the unit: mix1->set(name); - 4- Solve: bool=mix1->solve(); -*/ -#ifndef MIX_H -#define MIX_H - -#include "stream.hpp" -#include "bissection.hpp" -using namespace std; - -class mix { - private: - int i, j; - bool success; - bissection<mix> *solver; - string name; - int nb_in; //number of input streams - stream **in; //list pointers to input streams - stream *out; //pointer to output stream - // double min, max; - - public: - double P, T; //pressure (given) and temperature (unknown) - mix(){P=0.0;} - mix(int, stream**, stream*); //defines the connectivities of this unit - ~mix(){delete solver;} - void set(double p) {P=p;} - void set ( const string & n ) { name = n; } - double f(double); //returns the function to the solver - bool solve(); //finds the temperature and computes mass balance - void write(); -}; -#endif +/* +This unit takes more than two input streams and merge them in one +output stream. The pressure must be specified by the user, and the +temperature of the output stream is computed. + +Structure in the .process file: +mix {name} {pressure} {nb_in} {indexes of input streams} {index of output stream} + +How to use: + 1- Call the constructor: mix1 = new mix(nb_in, list1_in, out); + 2- Set the operating pressure : mix1->set(P); + 3- Set the name of the unit: mix1->set(name); + 4- Solve: bool=mix1->solve(); +*/ +#ifndef MIX_H +#define MIX_H + +#include "stream.hpp" +#include "bissection.hpp" +using namespace std; + +class mix { + private: + int i, j; + bool success; + bissection<mix> *solver; + string name; + int nb_in; //number of input streams + stream **in; //list pointers to input streams + stream *out; //pointer to output stream + // double min, max; + + public: + double P, T; //pressure (given) and temperature (unknown) + mix(){P=0.0;} + mix(int, stream**, stream*); //defines the connectivities of this unit + ~mix(){delete solver;} + void set(double p) {P=p;} + void set ( const string & n ) { name = n; } + double f(double); //returns the function to the solver + bool solve(); //finds the temperature and computes mass balance + void write(); +}; +#endif diff --git a/tools/SENSITIVITY/problems/styrene/black-box/truth/pfr.cpp b/tools/SENSITIVITY/problems/styrene/black-box/truth/pfr.cpp index 10583ce4da9356087bcc65adc54e99937dc0187c..aa12b2fdd9edb49a3f61ee5e3a39ab278491f60d 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/truth/pfr.cpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/truth/pfr.cpp @@ -1,172 +1,172 @@ -#include "pfr.hpp" -#include "RungeKutta.cpp" -using namespace std; - -pfr::pfr ( stream * s1 , stream * s2 , double ** t , int nb_r , reaction ** rr , double u , double ta ) { - - F = s2; - F->m=0; - P=s1->P; - for ( i = 0 ; i < s1->nb ; i++ ) { - F->chem[i]->m = s1->chem[i]->m; - F->m+=F->chem[i]->m; - } - F->set(s1->P, s1->T); - m_in=F->m; - a = t; - rx = rr; - n=nb_r; - m= F->nb; - U=u; - Ta=ta; - T = F->T; - C = new double[m]; - y = new double[m+1]; - r=new double[n]; - OK=true; - explode=true; - solver = new RungeKutta<pfr>(m+1); -} - -pfr::~pfr() { - delete [] r; - delete [] C; - delete [] y; - delete solver; -} - -bool pfr::run() { - - for ( i = 0 ; i < m ; i++ ) - y[i]=F->chem[i]->n(); - - y[m]=T; - - solver->set ( this , y , 0.0 , L ); - - dL=solver->dx(); - - OK=solver->run(); - - sum = F->m; - F->m = 0; - - for ( i = 0 ; i < m ; i++ ) - F->m+=F->chem[i]->m; - for ( i = 0 ; i < m ; i++ ) - F->chem[i]->m *= sum/F->m; - // if (OK) - //mass balance! - if ( fabs(m_in-F->m) > EPS || !explode ) - OK=false; - - return OK; -} - -double pfr::f ( int eq , double l , double * y ) { - - - sum=F->m; - F->m=0; - for(i=0; i<m;i++) - { - if(y[i]<0) y[i]=0; - F->chem[i]->m = y[i]*F->chem[i]->M/1000.0; - F->m+=F->chem[i]->m; - } - - - for(i=0; i<m;i++) - F->chem[i]->m *= sum/F->m; - - - - F->m=sum; - T=y[m]; - if(T>MAX_TEMP) - { - cout << "ERROR 11\n\n"; - exit(0); - } - - - for(i=0; i<m;i++) - C[i]=F->chem[i]->n()/F->v; - - for(j=0;j<n;j++) - r[j] = rx[j]->rate(T,C); - - if(0<=eq && eq<m) //return dFi/dL - { - tmp=0.0; - for(j=0;j<n;j++) tmp+=a[eq][j]*r[j]; - tmp *= (pi*D*D/4.0); - } - - - - if(eq==m) //return dT/dL - { - - - F->set(F->P,T); - - tmp=0.0; - for(j=0;j<n;j++) - tmp -= r[j]*rx[j]->dHr(T); - - - tmp *= (pi*D*D/4.0); - - - tmp += (pi*D)*U*(Ta-T); - - - tmp1=0.0; - for(i=0;i<m;i++) { - tmp1+= y[i]*F->chem[i]->Cp()*0.001; - } - tmp /= tmp1; - - if(fabs(tmp*dL)>500.0) - { - cout << "ERROR 13\n\n"; - exit(0); - } - } - - return tmp; -} - - - -double pfr::get_cost ( void ) { - dL=L*pi*pow(D,2)/4.0; - if(dL<0.3) dL=0.3; if(dL>520) dL=520; - sum = 3.4974+0.4485*log10(dL)+0.1074*pow(log10(dL),2); - sum = pow(10, sum); - P= (P-1)*101.325/100; - dL=(P+1)*D/(317.46*(850-0.6*(P+1)))+0.0315; - sum *=(2.25+ 1.82*dL*4.2); - sum = sum*MS_YEAR/MS_2001; - return sum; -} - -double pfr::get_water() { - sum = (U>EPS && T>Ta) ? U*L*pi*pow(D,2)/4*(T-Ta)/4.185/25.0 : 0.0; - return sum; -} - -void pfr::cost() { - cout << "WRITE FILE " << RUNTIME << name << ".cost" << " :\n\tBEGIN\n"; - cout << "\t>>" << get_cost(); - cout << "\n\tEND\n\n"; -} - -void pfr::water() { - cout << "WRITE FILE " << RUNTIME << name << ".water" << " :\n\tBEGIN\n"; - if (U>EPS && T>Ta) sum = (U*L*pi*pow(D,2)/4*(T-Ta)/4.185/25.0); - else sum = 0.0; - cout << "\t>>" << sum; - cout << "\n\tEND\n\n"; -} +#include "pfr.hpp" +#include "RungeKutta.cpp" +using namespace std; + +pfr::pfr ( stream * s1 , stream * s2 , double ** t , int nb_r , reaction ** rr , double u , double ta ) { + + F = s2; + F->m=0; + P=s1->P; + for ( i = 0 ; i < s1->nb ; i++ ) { + F->chem[i]->m = s1->chem[i]->m; + F->m+=F->chem[i]->m; + } + F->set(s1->P, s1->T); + m_in=F->m; + a = t; + rx = rr; + n=nb_r; + m= F->nb; + U=u; + Ta=ta; + T = F->T; + C = new double[m]; + y = new double[m+1]; + r=new double[n]; + OK=true; + explode=true; + solver = new RungeKutta<pfr>(m+1); +} + +pfr::~pfr() { + delete [] r; + delete [] C; + delete [] y; + delete solver; +} + +bool pfr::run() { + + for ( i = 0 ; i < m ; i++ ) + y[i]=F->chem[i]->n(); + + y[m]=T; + + solver->set ( this , y , 0.0 , L ); + + dL=solver->dx(); + + OK=solver->run(); + + sum = F->m; + F->m = 0; + + for ( i = 0 ; i < m ; i++ ) + F->m+=F->chem[i]->m; + for ( i = 0 ; i < m ; i++ ) + F->chem[i]->m *= sum/F->m; + // if (OK) + //mass balance! + if ( fabs(m_in-F->m) > EPS || !explode ) + OK=false; + + return OK; +} + +double pfr::f ( int eq , double l , double * y ) { + + + sum=F->m; + F->m=0; + for(i=0; i<m;i++) + { + if(y[i]<0) y[i]=0; + F->chem[i]->m = y[i]*F->chem[i]->M/1000.0; + F->m+=F->chem[i]->m; + } + + + for(i=0; i<m;i++) + F->chem[i]->m *= sum/F->m; + + + + F->m=sum; + T=y[m]; + if(T>MAX_TEMP) + { + cout << "ERROR 11\n\n"; + exit(0); + } + + + for(i=0; i<m;i++) + C[i]=F->chem[i]->n()/F->v; + + for(j=0;j<n;j++) + r[j] = rx[j]->rate(T,C); + + if(0<=eq && eq<m) //return dFi/dL + { + tmp=0.0; + for(j=0;j<n;j++) tmp+=a[eq][j]*r[j]; + tmp *= (pi*D*D/4.0); + } + + + + if(eq==m) //return dT/dL + { + + + F->set(F->P,T); + + tmp=0.0; + for(j=0;j<n;j++) + tmp -= r[j]*rx[j]->dHr(T); + + + tmp *= (pi*D*D/4.0); + + + tmp += (pi*D)*U*(Ta-T); + + + tmp1=0.0; + for(i=0;i<m;i++) { + tmp1+= y[i]*F->chem[i]->Cp()*0.001; + } + tmp /= tmp1; + + if(fabs(tmp*dL)>500.0) + { + cout << "ERROR 13\n\n"; + exit(0); + } + } + + return tmp; +} + + + +double pfr::get_cost ( void ) { + dL=L*pi*pow(D,2)/4.0; + if(dL<0.3) dL=0.3; if(dL>520) dL=520; + sum = 3.4974+0.4485*log10(dL)+0.1074*pow(log10(dL),2); + sum = pow(10, sum); + P= (P-1)*101.325/100; + dL=(P+1)*D/(317.46*(850-0.6*(P+1)))+0.0315; + sum *=(2.25+ 1.82*dL*4.2); + sum = sum*MS_YEAR/MS_2001; + return sum; +} + +double pfr::get_water() { + sum = (U>EPS && T>Ta) ? U*L*pi*pow(D,2)/4*(T-Ta)/4.185/25.0 : 0.0; + return sum; +} + +void pfr::cost() { + cout << "WRITE FILE " << RUNTIME << name << ".cost" << " :\n\tBEGIN\n"; + cout << "\t>>" << get_cost(); + cout << "\n\tEND\n\n"; +} + +void pfr::water() { + cout << "WRITE FILE " << RUNTIME << name << ".water" << " :\n\tBEGIN\n"; + if (U>EPS && T>Ta) sum = (U*L*pi*pow(D,2)/4*(T-Ta)/4.185/25.0); + else sum = 0.0; + cout << "\t>>" << sum; + cout << "\n\tEND\n\n"; +} diff --git a/tools/SENSITIVITY/problems/styrene/black-box/truth/pfr.hpp b/tools/SENSITIVITY/problems/styrene/black-box/truth/pfr.hpp index a8f49a71415ecc208c6ed692e7a4c6b99351ce49..9746a504839af042f2f0584c37708be715bbbbb4 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/truth/pfr.hpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/truth/pfr.hpp @@ -1,36 +1,36 @@ -#ifndef PFR_H -#define PFR_H - -#include "reaction.hpp" -#include "RungeKutta.hpp" -#include "stream.hpp" -using namespace std; - -class pfr { -private: - // terminator *term; - // ofstream results; - string name; - bool OK, explode; - int i ,j, n, m; - double L,D,dL, U, Ta, m_in, sum, P; - stream *F; - double **a, *C, T, *y, *r, tmp, tmp1; - reaction **rx; - RungeKutta<pfr> *solver; - -public: - // pfr(){}; - pfr ( stream * , stream * , double ** , int , reaction ** , double , double ); - void set ( const string & n ) { name = n; } - void set(double l, double d) {L=l; D=d;} - bool run(); - void water(); - void cost(); - double get_cost ( void ); - double get_water ( void ); - - double f(int, double, double*); - ~pfr(); -}; -#endif +#ifndef PFR_H +#define PFR_H + +#include "reaction.hpp" +#include "RungeKutta.hpp" +#include "stream.hpp" +using namespace std; + +class pfr { +private: + // terminator *term; + // ofstream results; + string name; + bool OK, explode; + int i ,j, n, m; + double L,D,dL, U, Ta, m_in, sum, P; + stream *F; + double **a, *C, T, *y, *r, tmp, tmp1; + reaction **rx; + RungeKutta<pfr> *solver; + +public: + // pfr(){}; + pfr ( stream * , stream * , double ** , int , reaction ** , double , double ); + void set ( const string & n ) { name = n; } + void set(double l, double d) {L=l; D=d;} + bool run(); + void water(); + void cost(); + double get_cost ( void ); + double get_water ( void ); + + double f(int, double, double*); + ~pfr(); +}; +#endif diff --git a/tools/SENSITIVITY/problems/styrene/black-box/truth/profitability.cpp b/tools/SENSITIVITY/problems/styrene/black-box/truth/profitability.cpp index 3617b30317dac940d299770d5afe8f8ec4a67c31..902f30dcfd2091ddbd5395997e010cb446546243 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/truth/profitability.cpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/truth/profitability.cpp @@ -1,138 +1,138 @@ -#include "profitability.hpp" -#include "secant.cpp" -using namespace std; - -bool profitability::run ( double * y ) -{ - OK=true; - - // cout<<setiosflags(ios::fixed); - // cout<<endl<<endl<<" PROFITABILITY ANALYSIS"<<endl; - // cout<<endl<<setprecision(1)<<" Return on investment (%)= "<<ROI()*100.0; - // cout<<endl<<" Rate of return (%)= "<<RR()*100.0; // y[10] - - y[10] = RR()*100.0; // y[10] - - ROI(); - RR(); - - // cout<<endl<<" Discounted flow rate (%)= "<<DFR()*100.0; - - DFR(); - - // cout<<endl<<endl<<" Payout time (y)= "<<PT(); // y[ 9] - y[9] = PT(); - - // cout<<endl<<setprecision(0)<<" Annual equivalent cost ($)= "<<AEC(); // y[12] - y[12] = AEC(); - - // cout<<endl<<" Net present value ($)= "<<NPV()<<endl; // y[13] - y[13] = NPV(); - - return OK; -} - -double profitability::ROI() -{ - // if(!MUTE)cout<<endl<<" return on investment..."; - num=den=0.0; - for(i=0;i<C->N;i++) - { - if(C->Inv[i]>EPS) den+=C->Inv[i]; - num+=(C->Rev[i]-C->Coper[i]-C->Amort[i]); - } - if (num>EPS && den>EPS && C->N>0) { - // if(!MUTE)cout<<" OK"; - return num/C->N/den; - } - else return 0.0; -} - -double profitability::RR() -{ - // if(!MUTE)cout<<endl<<" rate of return..."; - num=den=0.0; - for(i=0;i<C->N;i++) - { - num+=(C->Rev[i]-C->Coper[i])/pow(1.0+C->i_rate, i); - den+=C->Inv[i]/pow(1.0+C->i_rate, i); - } - if(num>EPS && den>EPS) { - // if(!MUTE)cout<<" OK"; - return num/den; - } - else return 0.0; -} - -double profitability::DFR() -{ - //if(!MUTE)cout<<endl<<" discounted cash flow rate..."; - solver = new secant<profitability>(); - solver->set(this, 0.0, 0.01); - OK = solver->run(); - - if ( OK && num>EPS && num < 1e20 ) { - // if(!MUTE)cout<<" OK"; - return num; - } - else return 0.0; -} - -double profitability::f(double x) -{ - num=x; - sum=0.0; - for(i=0;i<C->N;i++) - sum += C->Flow[i]/pow(1.0+x, i); - return sum; -} - -double profitability::PT() -{ - // if(!MUTE)cout<<endl<<" payout time..."; - sum=0.0; - for(i=0;i<C->N;i++) - { - if((sum+C->Flow[i])>0.0) - { - den=0.0; - while(sum+den*C->Flow[i]<=0.0) den+=0.001; - den+=double(i-1); - i=C->N; - } - else sum+=C->Flow[i]; - } - - if(den>EPS) { - // if(!MUTE)cout<<" OK"; - return den; - } - else return 0.0; -} - -double profitability::AEC() -{ - //if(!MUTE)cout<<endl<<" annual equivalent cost..."; - sum=0.0; - for(i=0;i<C->N;i++) sum+=(C->Coper[i]+C->Inv[i])/pow(1.0+C->i_rate, i); - if (sum>EPS) { -// if(!MUTE) -// cout<<" OK"; - return sum*(C->i_rate*pow(1.0+C->i_rate,C->N))/(pow(1.0+C->i_rate,C->N)-1.0); - } - else return 0.0; -} - -double profitability::NPV() -{ - // if(!MUTE)cout<<endl<<" net present value..."; - sum=0.0; - for ( i = 0 ; i < C->N ; i++ ) - sum += C->Flowact[i]; - if ( sum > EPS ) { -// if(!MUTE) -// cout<<" OK"; - return sum; - } - return 0.0; -} +#include "profitability.hpp" +#include "secant.cpp" +using namespace std; + +bool profitability::run ( double * y ) +{ + OK=true; + + // cout<<setiosflags(ios::fixed); + // cout<<endl<<endl<<" PROFITABILITY ANALYSIS"<<endl; + // cout<<endl<<setprecision(1)<<" Return on investment (%)= "<<ROI()*100.0; + // cout<<endl<<" Rate of return (%)= "<<RR()*100.0; // y[10] + + y[10] = RR()*100.0; // y[10] + + ROI(); + RR(); + + // cout<<endl<<" Discounted flow rate (%)= "<<DFR()*100.0; + + DFR(); + + // cout<<endl<<endl<<" Payout time (y)= "<<PT(); // y[ 9] + y[9] = PT(); + + // cout<<endl<<setprecision(0)<<" Annual equivalent cost ($)= "<<AEC(); // y[12] + y[12] = AEC(); + + // cout<<endl<<" Net present value ($)= "<<NPV()<<endl; // y[13] + y[13] = NPV(); + + return OK; +} + +double profitability::ROI() +{ + // if(!MUTE)cout<<endl<<" return on investment..."; + num=den=0.0; + for(i=0;i<C->N;i++) + { + if(C->Inv[i]>EPS) den+=C->Inv[i]; + num+=(C->Rev[i]-C->Coper[i]-C->Amort[i]); + } + if (num>EPS && den>EPS && C->N>0) { + // if(!MUTE)cout<<" OK"; + return num/C->N/den; + } + else return 0.0; +} + +double profitability::RR() +{ + // if(!MUTE)cout<<endl<<" rate of return..."; + num=den=0.0; + for(i=0;i<C->N;i++) + { + num+=(C->Rev[i]-C->Coper[i])/pow(1.0+C->i_rate, i); + den+=C->Inv[i]/pow(1.0+C->i_rate, i); + } + if(num>EPS && den>EPS) { + // if(!MUTE)cout<<" OK"; + return num/den; + } + else return 0.0; +} + +double profitability::DFR() +{ + //if(!MUTE)cout<<endl<<" discounted cash flow rate..."; + solver = new secant<profitability>(); + solver->set(this, 0.0, 0.01); + OK = solver->run(); + + if ( OK && num>EPS && num < 1e20 ) { + // if(!MUTE)cout<<" OK"; + return num; + } + else return 0.0; +} + +double profitability::f(double x) +{ + num=x; + sum=0.0; + for(i=0;i<C->N;i++) + sum += C->Flow[i]/pow(1.0+x, i); + return sum; +} + +double profitability::PT() +{ + // if(!MUTE)cout<<endl<<" payout time..."; + sum=0.0; + for(i=0;i<C->N;i++) + { + if((sum+C->Flow[i])>0.0) + { + den=0.0; + while(sum+den*C->Flow[i]<=0.0) den+=0.001; + den+=double(i-1); + i=C->N; + } + else sum+=C->Flow[i]; + } + + if(den>EPS) { + // if(!MUTE)cout<<" OK"; + return den; + } + else return 0.0; +} + +double profitability::AEC() +{ + //if(!MUTE)cout<<endl<<" annual equivalent cost..."; + sum=0.0; + for(i=0;i<C->N;i++) sum+=(C->Coper[i]+C->Inv[i])/pow(1.0+C->i_rate, i); + if (sum>EPS) { +// if(!MUTE) +// cout<<" OK"; + return sum*(C->i_rate*pow(1.0+C->i_rate,C->N))/(pow(1.0+C->i_rate,C->N)-1.0); + } + else return 0.0; +} + +double profitability::NPV() +{ + // if(!MUTE)cout<<endl<<" net present value..."; + sum=0.0; + for ( i = 0 ; i < C->N ; i++ ) + sum += C->Flowact[i]; + if ( sum > EPS ) { +// if(!MUTE) +// cout<<" OK"; + return sum; + } + return 0.0; +} diff --git a/tools/SENSITIVITY/problems/styrene/black-box/truth/profitability.hpp b/tools/SENSITIVITY/problems/styrene/black-box/truth/profitability.hpp index 194102c797e5dc33436d923e0b2b883da4a85979..03f85c57c5454c84d5be1f6d6d35a42a45839c1f 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/truth/profitability.hpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/truth/profitability.hpp @@ -1,30 +1,30 @@ -#ifndef PROFITABILITY_H -#define PROFITABILITY_H -#include "cashflow.hpp" -#include "secant.hpp" - -#include <iomanip> - -using namespace std; - -class profitability -{ -private: - cashflow *C; -// ofstream out; -// char name[41]; - bool OK; - double ROI(), RR(), DFR(); - double PT(), AEC(), NPV(); - int i; - double den, num, sum; - secant<profitability> *solver; - -public: - profitability(cashflow* c){C=c;} - ~profitability(){delete solver;}; - // void set(char n[31]) {strcpy(name, n); strcat(name, ".econo");} - bool run ( double * y ); - double f(double); -}; -#endif +#ifndef PROFITABILITY_H +#define PROFITABILITY_H +#include "cashflow.hpp" +#include "secant.hpp" + +#include <iomanip> + +using namespace std; + +class profitability +{ +private: + cashflow *C; +// ofstream out; +// char name[41]; + bool OK; + double ROI(), RR(), DFR(); + double PT(), AEC(), NPV(); + int i; + double den, num, sum; + secant<profitability> *solver; + +public: + profitability(cashflow* c){C=c;} + ~profitability(){delete solver;}; + // void set(char n[31]) {strcpy(name, n); strcat(name, ".econo");} + bool run ( double * y ); + double f(double); +}; +#endif diff --git a/tools/SENSITIVITY/problems/styrene/black-box/truth/pump.cpp b/tools/SENSITIVITY/problems/styrene/black-box/truth/pump.cpp index 685a0bef39991b6383b7ec874dbe9d695504bf08..166123fcc5c2a010b33059419d072a6a5b28882c 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/truth/pump.cpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/truth/pump.cpp @@ -1,94 +1,94 @@ -#include "pump.hpp" -using namespace std; - -bool pump::solve() { - - // out->chem = in->chem; - out->set ( in->nb , in->chem ); - out->m = in->m; - - - in->set(in->P,in->T); - for ( i = 0 ; i < in->nb ; i++ ) - if(in->chem[i]->m>EPS) { - in->chem[i]->find_v(); - if(in->chem[i]->state==1) { - W+=in->chem[i]->gamma()*in->T*0.0083144*in->chem[i]->n()/ - (in->chem[i]->gamma()-1.0)*(pow(P/in->P, 1.0-1.0/in->chem[i]->gamma())-1.0); - tmp += in->chem[i]->gamma(); - n++; - } - if(in->chem[i]->state==0) - W+=in->chem[i]->v*(P-in->P)*101.325; - } - if (fabs(state-1)<EPS) //compressing gases - out->T = in->T*pow(P/in->P, 1.0-1.0/(tmp/n)); - else //compressing liquids - out->T=in->T; - out->set(P, out->T); - if(eta>EPS) - W /= eta; - else - success=false; - // out->write(); // WRITE TOTO - return success; -} - -void pump::write() { - - cout << setprecision(6); - - string file_name = RUNTIME + name + ".unit"; - cout << "WRITE FILE " << file_name << " :\n\tBEGIN\n"; - cout <<"\t>> " << name; - cout << endl << "\t>> stream in: "<<in->name<<" out: "<<out->name; - cout << endl << "\t>> P(in) = "<<in->P<<" P(out) = "<<out->P<<" atm"; - cout << endl << "\t>> T(in) = "<<in->T<<" T(out) = "<<out->T<<" K"; - cout << endl << "\t>> Shaft work = "<<W; - if (success) - cout <<" kW (converge normally)"; - cout << "\n\tEND\n\n"; - - power(); - cost(); -} - - -double pump::get_cost ( void ) { - - if ( fabs(state-1) < EPS ) { - if(W<450) W=450; if(W>3000)W=3000; - tmp=2.2891+1.3604*log10(W)-0.1027*pow(log10(W),2); - tmp=3.2*pow(10.0, tmp); - tmp1=2.4604+1.4191*log10(W)-0.1798*pow(log10(W),2); - tmp1=1.5*pow(10.0, tmp1); - tmp+=tmp1; - } - else { - if(W<1) W=1; if(W>300)W=300; - tmp=3.3892+0.0536*log10(W)+0.1538*pow(log10(W),2); - tmp=pow(10.0, tmp); - P=(P-1.0)*101.325/100.0; - if (P<EPS) P=1; if(P>100) P=100; - W = -0.3925+0.3957*log10(P)-0.00226*pow(log10(P),2); - W=pow(10.0, W); if(W<1) W=1; - tmp*=(1.89+1.35*W*1.8); - } - tmp = tmp*MS_YEAR/MS_2001; - return tmp; -} - - -void pump::cost() { - string file_name = RUNTIME + name + ".cost"; - cout << "WRITE FILE " << file_name << " :\n\tBEGIN\n"; - cout << "\t>>" << get_cost(); - cout << "\n\tEND\n\n"; -} - -void pump::power() { - string file_name = RUNTIME + name + ".power"; - cout << "WRITE FILE " << file_name << " :\n\tBEGIN\n"; - cout << "\t>>" << W; - cout << "\n\tEND\n\n"; -} +#include "pump.hpp" +using namespace std; + +bool pump::solve() { + + // out->chem = in->chem; + out->set ( in->nb , in->chem ); + out->m = in->m; + + + in->set(in->P,in->T); + for ( i = 0 ; i < in->nb ; i++ ) + if(in->chem[i]->m>EPS) { + in->chem[i]->find_v(); + if(in->chem[i]->state==1) { + W+=in->chem[i]->gamma()*in->T*0.0083144*in->chem[i]->n()/ + (in->chem[i]->gamma()-1.0)*(pow(P/in->P, 1.0-1.0/in->chem[i]->gamma())-1.0); + tmp += in->chem[i]->gamma(); + n++; + } + if(in->chem[i]->state==0) + W+=in->chem[i]->v*(P-in->P)*101.325; + } + if (fabs(state-1)<EPS) //compressing gases + out->T = in->T*pow(P/in->P, 1.0-1.0/(tmp/n)); + else //compressing liquids + out->T=in->T; + out->set(P, out->T); + if(eta>EPS) + W /= eta; + else + success=false; + // out->write(); // WRITE TOTO + return success; +} + +void pump::write() { + + cout << setprecision(6); + + string file_name = RUNTIME + name + ".unit"; + cout << "WRITE FILE " << file_name << " :\n\tBEGIN\n"; + cout <<"\t>> " << name; + cout << endl << "\t>> stream in: "<<in->name<<" out: "<<out->name; + cout << endl << "\t>> P(in) = "<<in->P<<" P(out) = "<<out->P<<" atm"; + cout << endl << "\t>> T(in) = "<<in->T<<" T(out) = "<<out->T<<" K"; + cout << endl << "\t>> Shaft work = "<<W; + if (success) + cout <<" kW (converge normally)"; + cout << "\n\tEND\n\n"; + + power(); + cost(); +} + + +double pump::get_cost ( void ) { + + if ( fabs(state-1) < EPS ) { + if(W<450) W=450; if(W>3000)W=3000; + tmp=2.2891+1.3604*log10(W)-0.1027*pow(log10(W),2); + tmp=3.2*pow(10.0, tmp); + tmp1=2.4604+1.4191*log10(W)-0.1798*pow(log10(W),2); + tmp1=1.5*pow(10.0, tmp1); + tmp+=tmp1; + } + else { + if(W<1) W=1; if(W>300)W=300; + tmp=3.3892+0.0536*log10(W)+0.1538*pow(log10(W),2); + tmp=pow(10.0, tmp); + P=(P-1.0)*101.325/100.0; + if (P<EPS) P=1; if(P>100) P=100; + W = -0.3925+0.3957*log10(P)-0.00226*pow(log10(P),2); + W=pow(10.0, W); if(W<1) W=1; + tmp*=(1.89+1.35*W*1.8); + } + tmp = tmp*MS_YEAR/MS_2001; + return tmp; +} + + +void pump::cost() { + string file_name = RUNTIME + name + ".cost"; + cout << "WRITE FILE " << file_name << " :\n\tBEGIN\n"; + cout << "\t>>" << get_cost(); + cout << "\n\tEND\n\n"; +} + +void pump::power() { + string file_name = RUNTIME + name + ".power"; + cout << "WRITE FILE " << file_name << " :\n\tBEGIN\n"; + cout << "\t>>" << W; + cout << "\n\tEND\n\n"; +} diff --git a/tools/SENSITIVITY/problems/styrene/black-box/truth/pump.hpp b/tools/SENSITIVITY/problems/styrene/black-box/truth/pump.hpp index aac9e6bea209a0cf9177dcdcc7f3bdd63d9030e6..dbcacfd5005ca04ff4cc2f45b02d8ef3bd55af37 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/truth/pump.hpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/truth/pump.hpp @@ -1,46 +1,46 @@ -/* -This unit takes one input stream and divides in two or more -output streams. The pressure and temparature of output streams -are the same as the input's. -(ref : McCabe, Smith & Harriott) - -Structure in the .process file: -pump {name} {index of input stream} {index of output stream} {output pressure in atm} {efficiency, between 0 and 1} - -How to use: - 1- Call the constructor: pump1 = new pump(in, out); - 2- Set conditions: pump1->set(P_output, efficiency); - 3- Set the name: pump1->set(name); - 4- Solve: pump1->solve(); -*/ -#ifndef PUMP_H -#define PUMP_H - -#include "stream.hpp" -using namespace std; - -class pump -{ -private: - int i, j, n; - double state, tmp, tmp1; - bool success; - string name; - stream *in; //pointer to input stream - stream *out; //pointer to output stream - -public: - double P, W, eta; //output presure in atm, work in kW and efficiency - pump(stream* s1, stream* s2) {in=s1; out=s2; success=true; W=0.0; n=0; tmp=0.0;} - ~pump(){} - void set(double p, double e){P = p; eta = e; state=in->quality();} - void set(const string & n) { name = n; } - bool solve(); //finds the temperature and computes mass balance - void write(); - void cost(); - double get_cost(); // calcule W aussi - double get_power() const { return W; } - - void power(); -}; -#endif +/* +This unit takes one input stream and divides in two or more +output streams. The pressure and temparature of output streams +are the same as the input's. +(ref : McCabe, Smith & Harriott) + +Structure in the .process file: +pump {name} {index of input stream} {index of output stream} {output pressure in atm} {efficiency, between 0 and 1} + +How to use: + 1- Call the constructor: pump1 = new pump(in, out); + 2- Set conditions: pump1->set(P_output, efficiency); + 3- Set the name: pump1->set(name); + 4- Solve: pump1->solve(); +*/ +#ifndef PUMP_H +#define PUMP_H + +#include "stream.hpp" +using namespace std; + +class pump +{ +private: + int i, j, n; + double state, tmp, tmp1; + bool success; + string name; + stream *in; //pointer to input stream + stream *out; //pointer to output stream + +public: + double P, W, eta; //output presure in atm, work in kW and efficiency + pump(stream* s1, stream* s2) {in=s1; out=s2; success=true; W=0.0; n=0; tmp=0.0;} + ~pump(){} + void set(double p, double e){P = p; eta = e; state=in->quality();} + void set(const string & n) { name = n; } + bool solve(); //finds the temperature and computes mass balance + void write(); + void cost(); + double get_cost(); // calcule W aussi + double get_power() const { return W; } + + void power(); +}; +#endif diff --git a/tools/SENSITIVITY/problems/styrene/black-box/truth/reaction.cpp b/tools/SENSITIVITY/problems/styrene/black-box/truth/reaction.cpp index 9eaafc1a52eb29cacd9e13768a770b8b28d8465c..ee658e5b654b82ee3560805b5a519f44cbc97a14 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/truth/reaction.cpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/truth/reaction.cpp @@ -1,204 +1,204 @@ -#include "reaction.hpp" -using namespace std; - - -int reaction::find_chemical ( const string & chem_name ) const { - for ( int i = 0 ; i < m ; i++ ) - if ( list[i]->CAS == chem_name ) - return i; - return -1; -} - -// donnees hardcodees -reaction::reaction ( const string & in1 , int dim , chemical ** in2 ) { - - m = dim; // nbre de chemicals - list = in2; // liste des chemicals - - n = new double[m]; - safe_n = new double[m]; - safe_a = new double[m]; - a = new double[m]; - - int i , j; - for ( i = 0 ; i < m ; i++ ) { - a[i]=0.0; - n[i]=0.0; - } - - // 1/5 : - if ( in1 == "eb2sty" ) { - k0 = 3.525e5; - E = 90.85; - if ( (j = find_chemical ("100-41-4")) < 0 ) { - cout << "ERROR 10a\n\n"; - exit(0); - } - a[j] = -1; - n[j] = 1; - if ( (j = find_chemical ("1333-74-0")) < 0 ) { - cout << "ERROR 10b\n\n"; - exit(0); - } - a[j] = 1; - n[j] = 0; - if ( (j = find_chemical ("100-42-5")) < 0 ) { - cout << "ERROR 10c\n\n"; - exit(0); - } - a[j] = 1; - n[j] = 0; - } - - // 2/5 : - else if ( in1 == "sty2eb" ) { - k0 = 2.754e-4; - E = -18.653; - if ( (j = find_chemical ("100-41-4")) < 0 ) { - cout << "ERROR 10d\n\n"; - exit(0); - } - a[j] = 1; - n[j] = 0; - if ( (j = find_chemical ("1333-74-0")) < 0 ) { - cout << "ERROR 10e\n\n"; - exit(0); - } - a[j] = -1; - n[j] = 1; - if ( (j = find_chemical ("100-42-5")) < 0 ) { - cout << "ERROR 10f\n\n"; - exit(0); - } - a[j] = -1; - n[j] = 1; - } - - // 3/5 : - else if ( in1 == "eb2bz" ) { - k0 = 9.577e4; - E = 111.375; - if ( (j = find_chemical ("100-41-4")) < 0 ) { - cout << "ERROR 10g\n\n"; - exit(0); - } - a[j] = -1; - n[j] = 1; - if ( (j = find_chemical ("71-43-2")) < 0 ) { - cout << "ERROR 10h\n\n"; - exit(0); - } - a[j] = 1; - n[j] = 0; - if ( (j = find_chemical ("74-85-1")) < 0 ) { - cout << "ERROR 10i\n\n"; - exit(0); - } - a[j] = 1; - n[j] = 0; - } - - // 4/5 : - else if ( in1 == "eb2tol" ) { - k0 = 6.077e8; - E = 207.850; - if ( (j = find_chemical ("100-41-4")) < 0 ) { - cout << "ERROR 10j\n\n"; - exit(0); - } - a[j] = -1; - n[j] = 1; - if ( (j = find_chemical ("1333-74-0")) < 0 ) { - cout << "ERROR 10k\n\n"; - exit(0); - } - a[j] = -1; - n[j] = 1; - if ( (j = find_chemical ("108-88-3")) < 0 ) { - cout << "ERROR 10l\n\n"; - exit(0); - } - a[j] = 1; - n[j] = 0; - if ( (j = find_chemical ("74-82-8")) < 0 ) { - cout << "ERROR 10m\n\n"; - exit(0); - } - a[j] = 1; - n[j] = 0; - } - - // 5/5 : - else if ( in1 == "tol2bz" ) { - k0 = 1; - E = 19.038; - if ( (j = find_chemical ("1333-74-0")) < 0 ) { - cout << "ERROR 10n\n\n"; - exit(0); - } - a[j] = -1; - n[j] = 0.5; - if ( (j = find_chemical ("108-88-3")) < 0 ) { - cout << "ERROR 10o\n\n"; - exit(0); - } - a[j] = -1; - n[j] = 1; - if ( (j = find_chemical ("71-43-2")) < 0 ) { - cout << "ERROR 10p\n\n"; - exit(0); - } - a[j] = 1; - n[j] = 0; - if ( (j = find_chemical ("74-82-8")) < 0 ) { - cout << "ERROR 10q\n\n"; - exit(0); - } - a[j] = 1; - n[j] = 0; - } - else { - cout << "ERROR 12\n\n"; - exit(0); - } - - for ( i = 0 ; i < m ; i++ ) { - safe_n[i]=n[i]; - safe_a[i]=a[i]; - } -} - -reaction::~reaction() { - delete [] a; - delete [] n; - delete [] safe_n; - delete [] safe_a; -} - -double reaction::dHr(double T) -{ - int i , j; - for (i=0;i<m;i++) - if(safe_a[i]!=a[i]) - { - if(a[i]>safe_a[i]) a[i]=safe_a[i]; - else safe_a[i]=a[i]; - } - double tmp=0.0; - for (i=0;i<m;i++) tmp += a[i]*list[i]->Ho; - if(fabs(T-298)>EPS) - for (i=0;i<m;i++) - for (j=1;j<=4;j++) tmp += a[i]*list[i]->Cp_param[j-1]*(pow(T,j)-pow(298.0,j))/j/1000.0; - return tmp; -} - -double reaction::rate(double T, double* C) -{ - double tmp = k0*exp(-1000*E/8.3144/T); - for ( int i=0;i<m;i++) - { - if(safe_n[i]!=n[i]) n[i]=safe_n[i]; - if(C[i]>EPS && fabs(n[i])>EPS) tmp *= pow(C[i], n[i]); - } - return tmp; -} +#include "reaction.hpp" +using namespace std; + + +int reaction::find_chemical ( const string & chem_name ) const { + for ( int i = 0 ; i < m ; i++ ) + if ( list[i]->CAS == chem_name ) + return i; + return -1; +} + +// donnees hardcodees +reaction::reaction ( const string & in1 , int dim , chemical ** in2 ) { + + m = dim; // nbre de chemicals + list = in2; // liste des chemicals + + n = new double[m]; + safe_n = new double[m]; + safe_a = new double[m]; + a = new double[m]; + + int i , j; + for ( i = 0 ; i < m ; i++ ) { + a[i]=0.0; + n[i]=0.0; + } + + // 1/5 : + if ( in1 == "eb2sty" ) { + k0 = 3.525e5; + E = 90.85; + if ( (j = find_chemical ("100-41-4")) < 0 ) { + cout << "ERROR 10a\n\n"; + exit(0); + } + a[j] = -1; + n[j] = 1; + if ( (j = find_chemical ("1333-74-0")) < 0 ) { + cout << "ERROR 10b\n\n"; + exit(0); + } + a[j] = 1; + n[j] = 0; + if ( (j = find_chemical ("100-42-5")) < 0 ) { + cout << "ERROR 10c\n\n"; + exit(0); + } + a[j] = 1; + n[j] = 0; + } + + // 2/5 : + else if ( in1 == "sty2eb" ) { + k0 = 2.754e-4; + E = -18.653; + if ( (j = find_chemical ("100-41-4")) < 0 ) { + cout << "ERROR 10d\n\n"; + exit(0); + } + a[j] = 1; + n[j] = 0; + if ( (j = find_chemical ("1333-74-0")) < 0 ) { + cout << "ERROR 10e\n\n"; + exit(0); + } + a[j] = -1; + n[j] = 1; + if ( (j = find_chemical ("100-42-5")) < 0 ) { + cout << "ERROR 10f\n\n"; + exit(0); + } + a[j] = -1; + n[j] = 1; + } + + // 3/5 : + else if ( in1 == "eb2bz" ) { + k0 = 9.577e4; + E = 111.375; + if ( (j = find_chemical ("100-41-4")) < 0 ) { + cout << "ERROR 10g\n\n"; + exit(0); + } + a[j] = -1; + n[j] = 1; + if ( (j = find_chemical ("71-43-2")) < 0 ) { + cout << "ERROR 10h\n\n"; + exit(0); + } + a[j] = 1; + n[j] = 0; + if ( (j = find_chemical ("74-85-1")) < 0 ) { + cout << "ERROR 10i\n\n"; + exit(0); + } + a[j] = 1; + n[j] = 0; + } + + // 4/5 : + else if ( in1 == "eb2tol" ) { + k0 = 6.077e8; + E = 207.850; + if ( (j = find_chemical ("100-41-4")) < 0 ) { + cout << "ERROR 10j\n\n"; + exit(0); + } + a[j] = -1; + n[j] = 1; + if ( (j = find_chemical ("1333-74-0")) < 0 ) { + cout << "ERROR 10k\n\n"; + exit(0); + } + a[j] = -1; + n[j] = 1; + if ( (j = find_chemical ("108-88-3")) < 0 ) { + cout << "ERROR 10l\n\n"; + exit(0); + } + a[j] = 1; + n[j] = 0; + if ( (j = find_chemical ("74-82-8")) < 0 ) { + cout << "ERROR 10m\n\n"; + exit(0); + } + a[j] = 1; + n[j] = 0; + } + + // 5/5 : + else if ( in1 == "tol2bz" ) { + k0 = 1; + E = 19.038; + if ( (j = find_chemical ("1333-74-0")) < 0 ) { + cout << "ERROR 10n\n\n"; + exit(0); + } + a[j] = -1; + n[j] = 0.5; + if ( (j = find_chemical ("108-88-3")) < 0 ) { + cout << "ERROR 10o\n\n"; + exit(0); + } + a[j] = -1; + n[j] = 1; + if ( (j = find_chemical ("71-43-2")) < 0 ) { + cout << "ERROR 10p\n\n"; + exit(0); + } + a[j] = 1; + n[j] = 0; + if ( (j = find_chemical ("74-82-8")) < 0 ) { + cout << "ERROR 10q\n\n"; + exit(0); + } + a[j] = 1; + n[j] = 0; + } + else { + cout << "ERROR 12\n\n"; + exit(0); + } + + for ( i = 0 ; i < m ; i++ ) { + safe_n[i]=n[i]; + safe_a[i]=a[i]; + } +} + +reaction::~reaction() { + delete [] a; + delete [] n; + delete [] safe_n; + delete [] safe_a; +} + +double reaction::dHr(double T) +{ + int i , j; + for (i=0;i<m;i++) + if(safe_a[i]!=a[i]) + { + if(a[i]>safe_a[i]) a[i]=safe_a[i]; + else safe_a[i]=a[i]; + } + double tmp=0.0; + for (i=0;i<m;i++) tmp += a[i]*list[i]->Ho; + if(fabs(T-298)>EPS) + for (i=0;i<m;i++) + for (j=1;j<=4;j++) tmp += a[i]*list[i]->Cp_param[j-1]*(pow(T,j)-pow(298.0,j))/j/1000.0; + return tmp; +} + +double reaction::rate(double T, double* C) +{ + double tmp = k0*exp(-1000*E/8.3144/T); + for ( int i=0;i<m;i++) + { + if(safe_n[i]!=n[i]) n[i]=safe_n[i]; + if(C[i]>EPS && fabs(n[i])>EPS) tmp *= pow(C[i], n[i]); + } + return tmp; +} diff --git a/tools/SENSITIVITY/problems/styrene/black-box/truth/reaction.hpp b/tools/SENSITIVITY/problems/styrene/black-box/truth/reaction.hpp index 1456e0d2bf24b59b66a76788fd8fdfa7ed5d6672..f05b27e4589a1e0443a3911532d8f8b4e7f6caeb 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/truth/reaction.hpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/truth/reaction.hpp @@ -1,32 +1,32 @@ -#ifndef REACTION_H -#define REACTION_H - -#include "chemical.hpp" -using namespace std; - -class reaction { -private: - - int m; - double *n, k0, E, Hr, *safe_n, *safe_a; - // double tmp; -// char file[41], line[31]; - chemical ** list; -// ifstream in; - // ofstream logf; - // terminator *end; - - int find_chemical ( const string & chem_name ) const; - -public: - // reaction(){}; - reaction ( const string & , int , chemical ** ); - ~reaction(); - double *a; //contains the molar coefficients - double dHr(double); //returns heat of rection at T, in kJ/mol - double rate(double, double*); //returns rate of reaction aT and C[], in mol/s.m3 - -// void show_name(){cout<<name;} -}; - -#endif +#ifndef REACTION_H +#define REACTION_H + +#include "chemical.hpp" +using namespace std; + +class reaction { +private: + + int m; + double *n, k0, E, Hr, *safe_n, *safe_a; + // double tmp; +// char file[41], line[31]; + chemical ** list; +// ifstream in; + // ofstream logf; + // terminator *end; + + int find_chemical ( const string & chem_name ) const; + +public: + // reaction(){}; + reaction ( const string & , int , chemical ** ); + ~reaction(); + double *a; //contains the molar coefficients + double dHr(double); //returns heat of rection at T, in kJ/mol + double rate(double, double*); //returns rate of reaction aT and C[], in mol/s.m3 + +// void show_name(){cout<<name;} +}; + +#endif diff --git a/tools/SENSITIVITY/problems/styrene/black-box/truth/reactor.cpp b/tools/SENSITIVITY/problems/styrene/black-box/truth/reactor.cpp index 7f6e3a9455b13cecce0397ef8540e84a8a3d46f7..0f0ddae03673fe3ccd6ad46ef92158393d835e32 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/truth/reactor.cpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/truth/reactor.cpp @@ -1,100 +1,100 @@ -#include "reactor.hpp" -using namespace std; - -template<class TYPE> -reactor<TYPE>::reactor(stream* s1, stream* s2) -{ - in = s1; - out = s2; - - model = NULL; -} - -template<class TYPE> -reactor<TYPE>::~reactor() { - for ( i = 0 ; i < n ; i++ ) - delete rx[i]; - delete [] rx; - for ( i = 0 ; i < m ; i++ ) - delete table[i]; - delete [] table; - - if (model) - delete model; -} - -template<class TYPE> -void reactor<TYPE>::set ( double l , double d , int nb , const string * list_rx ) { - m = in->nb; - n = nb; - L = l; - D = d; - V = pi*pow(D/2.0, 2)*L; - - double * yields = new double [n]; - - rx = new reaction * [n]; - for ( j = 0 ; j < n ; j++ ) - rx[j] = new reaction ( list_rx[j] , m , in->chem ); - - table = new double * [m]; - for ( i = 0 ; i < m ; i++ ) - table[i] = new double[n]; - for ( j = 0 ; j < n ; j++ ) - for ( i = 0 ; i < m ; i++ ) - table[i][j] = rx[j]->a[i]; - for ( j = 0 ; j < n ; j++ ) { - yields[j]=0.0; - for ( i = 0 ; i < m ; i++ ) - if ( table[i][j] < 0 ) { - yields[j]=in->chem[i]->n(); - i=m; - } - } - - delete [] yields; - -} - -template<class TYPE> -bool reactor<TYPE>::solve() { - - if (model) - delete model; - model = new TYPE(in, out, table, n, rx, U, Ta); - model->set(name); - model->set(L,D); - - success = model->run(); - - // if(fabs(in->m-out->m)>sqrt(EPS)) - // { - // log.open(MESSAGES, ios::app); - // log<<" --> Warning <-- Block "<<name<<" is not in mass balance ("<<fabs(in->m-out->m)/in->m<<").\n"; - // log.close(); - // } - - - // out->write(); // WRITE TOTO - - return success; -} - -template<class TYPE> -void reactor<TYPE>::write ( void ) { - - cout << setprecision(6); - - cout << "WRITE FILE " << RUNTIME << name << ".unit" << " :\n\tBEGIN\n"; - cout << "\t>> " << name; - cout << endl << "\t>> stream in : " << in->name; - cout << endl << "\t>> stream out : " << out->name; - cout << endl << "\t>> P = " << in->P - << " atm, T(in) = " << in->T << ", T(out) = " << out->T << " K"; - cout << endl << "\t>> L = " << L << ", D = " << D << " m"; - if (success) - cout << " (converge normally)"; - cout << "\n\tEND\n\n"; - model->cost(); - model->water(); -} +#include "reactor.hpp" +using namespace std; + +template<class TYPE> +reactor<TYPE>::reactor(stream* s1, stream* s2) +{ + in = s1; + out = s2; + + model = NULL; +} + +template<class TYPE> +reactor<TYPE>::~reactor() { + for ( i = 0 ; i < n ; i++ ) + delete rx[i]; + delete [] rx; + for ( i = 0 ; i < m ; i++ ) + delete table[i]; + delete [] table; + + if (model) + delete model; +} + +template<class TYPE> +void reactor<TYPE>::set ( double l , double d , int nb , const string * list_rx ) { + m = in->nb; + n = nb; + L = l; + D = d; + V = pi*pow(D/2.0, 2)*L; + + double * yields = new double [n]; + + rx = new reaction * [n]; + for ( j = 0 ; j < n ; j++ ) + rx[j] = new reaction ( list_rx[j] , m , in->chem ); + + table = new double * [m]; + for ( i = 0 ; i < m ; i++ ) + table[i] = new double[n]; + for ( j = 0 ; j < n ; j++ ) + for ( i = 0 ; i < m ; i++ ) + table[i][j] = rx[j]->a[i]; + for ( j = 0 ; j < n ; j++ ) { + yields[j]=0.0; + for ( i = 0 ; i < m ; i++ ) + if ( table[i][j] < 0 ) { + yields[j]=in->chem[i]->n(); + i=m; + } + } + + delete [] yields; + +} + +template<class TYPE> +bool reactor<TYPE>::solve() { + + if (model) + delete model; + model = new TYPE(in, out, table, n, rx, U, Ta); + model->set(name); + model->set(L,D); + + success = model->run(); + + // if(fabs(in->m-out->m)>sqrt(EPS)) + // { + // log.open(MESSAGES, ios::app); + // log<<" --> Warning <-- Block "<<name<<" is not in mass balance ("<<fabs(in->m-out->m)/in->m<<").\n"; + // log.close(); + // } + + + // out->write(); // WRITE TOTO + + return success; +} + +template<class TYPE> +void reactor<TYPE>::write ( void ) { + + cout << setprecision(6); + + cout << "WRITE FILE " << RUNTIME << name << ".unit" << " :\n\tBEGIN\n"; + cout << "\t>> " << name; + cout << endl << "\t>> stream in : " << in->name; + cout << endl << "\t>> stream out : " << out->name; + cout << endl << "\t>> P = " << in->P + << " atm, T(in) = " << in->T << ", T(out) = " << out->T << " K"; + cout << endl << "\t>> L = " << L << ", D = " << D << " m"; + if (success) + cout << " (converge normally)"; + cout << "\n\tEND\n\n"; + model->cost(); + model->water(); +} diff --git a/tools/SENSITIVITY/problems/styrene/black-box/truth/reactor.hpp b/tools/SENSITIVITY/problems/styrene/black-box/truth/reactor.hpp index af0d2810711e78ab8b2a3dcee4cde090396f2c58..78f936fe00e0bf1fd35f0487f3e8eb8e295a84a5 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/truth/reactor.hpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/truth/reactor.hpp @@ -1,48 +1,48 @@ -/* -This unit simulates a chemical reactor. Actually, only the pfr can be used. -(ref : Fogler). - -Structure in the .process file: -reactor {name} {pfr or cstr} {index of input stream} {index of output stream} {length in m} {diameter in m} {nb_react, list of reactions occuring} {U in kW/m2.K}{Ta in K} - -How to use: - 1- Call the constructor : react = new reactor<pfr or cstr>(in, out); - 2- Set dimensions and reactions : react->set(length, diameter, nb_react, list_react); //list_react is the list of reactions names - 3- Set cooling parameters : react->set(U, Ta); - 4- Set the name : react->set(name); - 5- Run the model: react->solve(); -*/ -#ifndef REACTOR_H -#define REACTOR_H - -#include "pfr.hpp" -using namespace std; - -template<class TYPE> -class reactor { -private: - // ofstream log; - bool success; - string name; - int i ,j, m, n; - double V, L, D, U, Ta; - stream *in, *out; - TYPE *model; - reaction ** rx; - double ** table; - -public: - // reactor(){}; - reactor(stream*, stream*); - void set( const string & n) { name = n; } - void set(double, double, int, const string * ); - void set(double u, double ta) {U=u;Ta=ta;} - bool solve(); - void write(); - - double get_cost ( void ) const { return model->get_cost() ; } - double get_water ( void ) const { return model->get_water(); } - - ~reactor(); -}; -#endif +/* +This unit simulates a chemical reactor. Actually, only the pfr can be used. +(ref : Fogler). + +Structure in the .process file: +reactor {name} {pfr or cstr} {index of input stream} {index of output stream} {length in m} {diameter in m} {nb_react, list of reactions occuring} {U in kW/m2.K}{Ta in K} + +How to use: + 1- Call the constructor : react = new reactor<pfr or cstr>(in, out); + 2- Set dimensions and reactions : react->set(length, diameter, nb_react, list_react); //list_react is the list of reactions names + 3- Set cooling parameters : react->set(U, Ta); + 4- Set the name : react->set(name); + 5- Run the model: react->solve(); +*/ +#ifndef REACTOR_H +#define REACTOR_H + +#include "pfr.hpp" +using namespace std; + +template<class TYPE> +class reactor { +private: + // ofstream log; + bool success; + string name; + int i ,j, m, n; + double V, L, D, U, Ta; + stream *in, *out; + TYPE *model; + reaction ** rx; + double ** table; + +public: + // reactor(){}; + reactor(stream*, stream*); + void set( const string & n) { name = n; } + void set(double, double, int, const string * ); + void set(double u, double ta) {U=u;Ta=ta;} + bool solve(); + void write(); + + double get_cost ( void ) const { return model->get_cost() ; } + double get_water ( void ) const { return model->get_water(); } + + ~reactor(); +}; +#endif diff --git a/tools/SENSITIVITY/problems/styrene/black-box/truth/secant.cpp b/tools/SENSITIVITY/problems/styrene/black-box/truth/secant.cpp index e8582e03da28e148ba43074dbff9b4e4a5ad4069..79e5d049cd839cf672a3eb71e48c6d976119c25f 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/truth/secant.cpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/truth/secant.cpp @@ -1,47 +1,47 @@ -#include "secant.hpp" -using namespace std; - -template <class E> -secant<E>::secant() -{ - x_last=0; - x_now=0; - x_next=0; - f_last=0; - f_now=0; - OK=false; -} - -template <class E> -void secant<E>::set(E* tmp, double x1, double x2) -{ - unit=tmp; - x_last=x1; - x_now=x2; - OK=false; -} - -template <class E> -bool secant<E>::run() -{ - // if(DEBUG) cout<<endl<<"begin solve secant"; - f_last = unit->f(x_last); - for (i=1; i<MAX_ITER_SECANT; i++) - { - f_now = unit->f(x_now); - // if(DEBUG) cout<<endl<<" x = "<<x_now<<" f(x) = "<<f_now; - x_next = x_now - (f_now*(x_now-x_last)/(f_now-f_last)); - if (fabs((x_next-x_now)/x_now)<=TOL_SECANT) - { - i=MAX_ITER_SECANT; - OK=true; - } - else - { - x_last=x_now; - f_last=f_now; - x_now=x_next; - } - } - return OK; -} +#include "secant.hpp" +using namespace std; + +template <class E> +secant<E>::secant() +{ + x_last=0; + x_now=0; + x_next=0; + f_last=0; + f_now=0; + OK=false; +} + +template <class E> +void secant<E>::set(E* tmp, double x1, double x2) +{ + unit=tmp; + x_last=x1; + x_now=x2; + OK=false; +} + +template <class E> +bool secant<E>::run() +{ + // if(DEBUG) cout<<endl<<"begin solve secant"; + f_last = unit->f(x_last); + for (i=1; i<MAX_ITER_SECANT; i++) + { + f_now = unit->f(x_now); + // if(DEBUG) cout<<endl<<" x = "<<x_now<<" f(x) = "<<f_now; + x_next = x_now - (f_now*(x_now-x_last)/(f_now-f_last)); + if (fabs((x_next-x_now)/x_now)<=TOL_SECANT) + { + i=MAX_ITER_SECANT; + OK=true; + } + else + { + x_last=x_now; + f_last=f_now; + x_now=x_next; + } + } + return OK; +} diff --git a/tools/SENSITIVITY/problems/styrene/black-box/truth/secant.hpp b/tools/SENSITIVITY/problems/styrene/black-box/truth/secant.hpp index a04cbc542af177484e56bbaa924df887a2c2cdc4..d1bb096e5c0267e24add5f95f58caa6523caa3ee 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/truth/secant.hpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/truth/secant.hpp @@ -1,31 +1,31 @@ -/* -To use the secant solver to find the root of a scalar function: - (the parametric object E must have public function such as E->f(x), - where x is the point at which evaluate f.) - 1- construct the solver : solver = new secant<E>(); - 2- set the solver : solver->set(unit, x0, x1); //unit is usually the pointer *this, and x0 and x1 are two required initial points - 3- launch the solver : bool = solver->run(); //will return true is success, false if the solver failed -*/ -#ifndef SECANT_H -#define SECANT_H - -#include "defines.hpp" -using namespace std; - - -template <class E> -class secant { -private: - double x_last, x_now, x_next; - double f_last, f_now, error; - int i; - bool OK; - E *unit; - -public: - secant(); - void set(E*, double, double); - bool run(); - ~secant(){} -}; -#endif +/* +To use the secant solver to find the root of a scalar function: + (the parametric object E must have public function such as E->f(x), + where x is the point at which evaluate f.) + 1- construct the solver : solver = new secant<E>(); + 2- set the solver : solver->set(unit, x0, x1); //unit is usually the pointer *this, and x0 and x1 are two required initial points + 3- launch the solver : bool = solver->run(); //will return true is success, false if the solver failed +*/ +#ifndef SECANT_H +#define SECANT_H + +#include "defines.hpp" +using namespace std; + + +template <class E> +class secant { +private: + double x_last, x_now, x_next; + double f_last, f_now, error; + int i; + bool OK; + E *unit; + +public: + secant(); + void set(E*, double, double); + bool run(); + ~secant(){} +}; +#endif diff --git a/tools/SENSITIVITY/problems/styrene/black-box/truth/servor.cpp b/tools/SENSITIVITY/problems/styrene/black-box/truth/servor.cpp index 75216ae65c7d270cc5ec7d40495dd7eac8e31163..0b2df2008515f202bf61bc495dc205e53d345e4d 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/truth/servor.cpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/truth/servor.cpp @@ -1,538 +1,538 @@ -#include "servor.hpp" -#include "reactor.cpp" -using namespace std; - -/*---------------------------------------------------------------------*/ -servor::servor ( int nb_u , int n2 , stream ** streams ) { - nb = nb_u; - nb_s = n2; - type = new string[nb]; - name = new string[nb]; - s = streams; - - -// for (int i=0; i<nb; i++) -// { -// type[i]=new char[31]; -// name[i]=new char[31]; -// } -// cursor=0; -// s = s_list; -// // end = new terminator("\0"); -// mix1=NULL; -// split1=NULL; -// flash1=NULL; -// pump1=NULL; -// col=NULL; -// react_pfr=NULL; -// react_cstr=NULL; -// heat=NULL; - - burn = new burner ( s[0]->nb , s[0]->chem ); -} - -/*---------------------------------------------------------------------*/ -servor::~servor() { - delete [] type; - delete [] name; - delete burn; -} - -/*---------------------------------------------------------------------*/ -bool servor::solve_process ( const double * x , double * y ) { - - - for ( i = 0 ; i < 8 ; i++ ) - costs[i] = 0.0; - - k = 0; - norm = 1.0 / TOL_WEGSTEIN; - - for ( cursor = 0 ; cursor < nb ; cursor++ ) { - - if (type[cursor] == "mix" ) { - do_mix_process(x); - } - else if ( type[cursor] == "split" ) { - do_split_process(x); - } - else if ( type[cursor] == "flash" ) { - do_flash_process(x); - } - else if ( type[cursor] == "pump" ) { - do_pump_process(x); - } - else if ( type[cursor] == "heatx") { - do_heatx_process(x); - } - else if ( type[cursor] == "burner" ) { - do_burner_process(x,y); - } - else if ( type[cursor] == "column" ) { - do_column_process(x,y); - } - else if ( type[cursor] == "reactor" ) { - do_reactor_process(x); - } - else if ( type[cursor] == "loop" ) { - - recycle = 10; - end_recycle = 0; - do_loop_process(x); - } - else { - cout << "ERROR 18\n\n"; - exit(0); - } - - } - - return true; -} - - -/*---------------------------------------------------------------------*/ -void servor::do_loop_process ( const double * x ) { - - // structure in the input file : - // loop - // name : "looping" - // index of recycle stream : 11 - // index of stream's beginning block : 7 - // index of stream's end block : 1 - - // TOTO -// if (k==0) -// cout << endl << " -> Wegstein iterations "; -// else if ( k <= 2 ) -// cout << endl << " -> loop " << setw(3) << k; -// else -// cout << endl << " -> loop " << setw(3) << k << " > error " << norm; - - // Get the two fisrst points - if ( k==0 ) { - for ( i = 0 ; i < s[0]->nb ; i++ ) - x_last[i] = s[recycle]->chem[i]->m; - end_loop = false; - } - - if ( k==1 ) { - for ( i = 0 ; i < s[0]->nb ; i++ ) { - x_now [i] = s[recycle]->chem[i]->m; - g_last[i] = s[recycle]->chem[i]->m; - } - - end_loop = false; - } - - if ( k == 2 ) { - for ( i = 0 ; i < s[0]->nb ; i++ ) - g_now[i] = s[recycle]->chem[i]->m; - end_loop=false; - } - k++; - - - // run the Wegstein algorithm - if ( k > 2 ) { - for ( i = 0 ; i < s[0]->nb ; i++ ) { - g_now[i] = s[recycle]->chem[i]->m; - - if ( fabs (x_now[i]-x_last[i]) > EPS ) - slope[i] = ( g_now[i] - g_last[i] ) / ( x_now[i] - x_last[i] ); - else - slope[i] = 0; - - theta[i] = 1.0 / (1.0-slope[i]); - if ( theta[i] < MIN_THETA ) - theta[i] = MIN_THETA; - if ( theta[i] > MAX_THETA ) - theta[i] = MAX_THETA; - x_next[i] = (1.0-theta[i])*x_now[i] + theta[i]*g_now[i]; - } - norm = 0.0; - for ( i = 0 ; i < s[0]->nb ; i++ ) - if ( fabs(x_now[i]) > EPS ) - norm += fabs (x_next[i]-x_now[i]) / fabs(x_now[i]); - - if ( norm > TOL_WEGSTEIN && k < MAX_ITER_WEGSTEIN ) { - s[recycle]->m = 0.0; - for ( i = 0 ; i < s[0]->nb ; i++ ) { - s[recycle]->chem[i]->m = x_next[i]; - s[recycle]->m += x_next[i]; - x_last[i] = x_now[i]; - g_last[i] = g_now[i]; - x_now[i] = x_next[i]; - } - end_loop=false; - } - if ( norm <= TOL_WEGSTEIN && k < MAX_ITER_WEGSTEIN ) - end_loop = true; - - } - - - if ( end_loop ) { - if ( k < MAX_ITER_WEGSTEIN && k > 3 ) { - // cout<<" OK"; // TOTO - // s[recycle]->write(); // WRITE TOTO - -// // WRITE TOTO : -// cout << "WRITE FILE " << RUNTIME << name[cursor] << ".unit" << " :\n\tBEGIN\n"; -// cout << "\t>> " << name[cursor]; -// cout << endl << "\t>> from block " << cursor+1 << " to block " << end_recycle+1; -// cout << endl << "\t>> Wegstein converged in " -// << k << " iterations (rel. err. " << norm << ")."; -// cout << "\n\tEND\n\n"; - - k = 0; - norm = 1.0/TOL_WEGSTEIN; - } -// else { -// log.open(MESSAGES, ios::app); -// log<<" ==> Error <== Wegstein algorithm did not converge.\n"; -// log.close(); -// } - } - - - if ( !end_loop && k < MAX_ITER_WEGSTEIN ) - cursor = end_recycle-1; - if ( !end_loop && k==MAX_ITER_WEGSTEIN ) { -// log.open(MESSAGES, ios::app); -// log<<" ==> Error <== Wegstein algorithm did not converge.\n"; -// log.close(); - k=0; - norm = 1.0/TOL_WEGSTEIN; - cursor=nb; - } - -} - -/*---------------------------------------------------------------------*/ -void servor::do_burner_process ( const double * x , double * y ) { - - // cout << endl << " -- " << name[cursor] << "... "; // TOTO - - // read parameters : - int i1 = 8; - int i2 = 13; - double f = x[6]; - - burn->set ( s[i1-1] , s[i2-1] ); - burn->set(f); - burn->set(name[cursor]); - - if ( burn->solve(y) ) { - // cout << "OK"; // TOTO - // burn->write(); // WRITE TOTO - costs[7] = burn->get_cost(); - } - else { - cout << "ERROR 20\n\n"; - exit(0); - } -} - -/*---------------------------------------------------------------------*/ -void servor::do_split_process ( const double * x ) -{ - // cout<<endl<<" -- "<<name[cursor]<<"... "; // TOTO - - //Read parameters - int i1 = 9; - int i2 = 2; - int i_tab[2] = { 10 , 11 }; - double f_tab[2]; - f_tab[0] = x[5]; - f_tab[1] = 1-x[5]; - - stream * list1[2]; - list1[0] = s[i_tab[0]-1]; - list1[1] = s[i_tab[1]-1]; - - split * split1 = new split ( i2 , s[i1-1] , list1 ); - - split1->set(f_tab); - split1->set(name[cursor]); - if ( split1->solve() ) { - // cout<<"OK"; // TOTO - // split1->write(); // WRITE TOTO - } - else { - cout << "ERROR 19\n\n"; - exit(0); - } - delete split1; -} - -/*---------------------------------------------------------------------*/ -void servor::do_column_process ( const double * x , double * y ) { - // cout<<endl<<" -- "<<name[cursor]<<"... "; // TOTO - - //Read parameters - double f1 , f2; - int i , i1 , i2; - int i_tab[2]; - double f = 1.0; - - if (name[cursor]=="sep-sty") { - i = 7; - i1 = 15; - i2 = 9; - i_tab[0] = 1; - i_tab[1] = 7; - f1 = f2 = x[2]; - } - else if (name[cursor]=="sep-bz") { - i = 10; - i1 = 12; - i2 = 14; - i_tab[0] = 5; - i_tab[1] = 1; - f1 = f2 = x[3]; - } - else { - cout << "ERROR 17\n\n"; - exit(0); - } - - column * col = new column ( s[i-1] , s[i1-1] , s[i2-1] ); - col->set ( f , i_tab[0] , f1 , i_tab[1] , f2 ); - col->set(name[cursor]); - if ( col->solve() ) { - //cout<<"OK"; // TOTO - //col->write(); // WRITE TOTO - - if (name[cursor]=="sep-sty") { - y[4] = col->get_N(); - costs[5] = col->get_cost(); - power[5] = col->get_power(); - water[5] = col->get_water(); - } - else { - y[5] = col->get_N(); - costs[6] = col->get_cost(); - power[4] = col->get_power(); - water[4] = col->get_water(); - } - } - else { - cout << "ERROR 15\n\n"; - exit(0); - } - delete col; -} - -/*---------------------------------------------------------------------*/ -void servor::do_flash_process ( const double * x ) { - // cout<<endl<<" -- "<<name[cursor]<<"... "; // TOTO - - //Read parameters - double f1 = 1.0; - double f2 = x[7]; - // int i_tab [3] = { 6 , 7 , 8 }; - // flash * flash1 = new flash ( s[i_tab[0]-1] , s[i_tab[1]-1] , s[i_tab[2]-1] ); - flash * flash1 = new flash ( s[5] , s[6] , s[7] ); - - flash1->set(f1, f2); - flash1->set(name[cursor]); - if ( flash1->solve() ) { - // cout<<"OK"; // TOTO - // flash1->write(); // WRITE TOTO - costs[4] = flash1->get_cost(); - power[2] = flash1->get_power(); - water[1] = flash1->get_water(); - } - else { - cout << "ERROR 14\n\n"; - exit(0); - } - delete flash1; -} - - -/*---------------------------------------------------------------------*/ -void servor::do_mix_process ( const double * x ) { - - // cout << endl << " -- " << name[cursor] << "... "; // TOTO - - // Read parameters (hardcode avec eb2sty.process) : - double f1 = 1.0; - int i1 = 3; - int i_tab[3] = { 1 , 12 , 11 }; - int i2 = 2; - - // We can solve the unit - stream * list2 = s[i2-1] , ** list1 = new stream * [i1]; - for ( int i = 0 ; i < i1 ; i++ ) - list1[i] = s[i_tab[i]-1]; - mix * mix1 = new mix ( i1 , list1 , list2 ); - mix1->set(f1); - mix1->set(name[cursor]); - if (mix1->solve()) { - // cout<<"OK"; // TOTO - // mix1->write(); // WRITE TOTO - } - else { - cout << "ERROR 6\n\n"; - exit(0); - } - delete mix1; - delete [] list1; -} - - -/*---------------------------------------------------------------------*/ -void servor::do_pump_process ( const double * x ) { - - // cout<<endl<<" -- "<<name[cursor]<<"... "; // TOTO - - //Read parameters (hardcode avec eb2sty.process) : - int i1 = 2; - int i2 = 3; - double f1 = x[4]; - double f2 = 0.75; - - pump * pump1 = new pump ( s[i1-1] , s[i2-1] ); - pump1->set(f1,f2); - pump1->set(name[cursor]); - - - - // solve : - if ( pump1->solve() ) { - // cout<<"OK"; // TOTO - // pump1->write(); // WRITE TOTO - - power[0] = pump1->get_power(); - costs[0] = pump1->get_cost(); - } - else { - cout << "ERROR 7\n\n"; - exit(0); - } - - delete pump1; -} - -/*---------------------------------------------------------------------*/ -void servor::do_heatx_process ( const double * x ) { - - // cout << endl << " -- " << name[cursor] << "... "; // TOTO - - //Read parameters (idem) : - - bool b = false; - - // heater : - int i1; - int i2; - double f1; - - // heater : - if (name[cursor]=="heater") { - i1 = 3; - i2 = 4; - f1 = x[0]; - } - - // cooler : - else if (name[cursor]=="cooler") { - i1 = 5; - i2 = 6; - f1 = x[7]; - } - else { - cout << "ERROR 16\n\n"; - exit(0); - } - - double f2 = 0.85; - - // solve : - heatx * heat = new heatx ( b , s[i1-1] , s[i2-1] ); - heat->set(f1,f2); - heat->set(name[cursor]); - if (heat->solve()) { - // cout<<"OK"; // TOTO - // heat->write(); // WRITE TOTO - if (name[cursor]=="heater") { - costs[1] = heat->get_cost(); - power[3] = heat->get_power(); - water[2] = heat->get_water(); - } - else { - costs[3] = heat->get_cost(); - power[1] = heat->get_power(); - water[0] = heat->get_water(); - } - } - else { - cout << "ERROR 8\n\n"; - exit(0); - } - delete heat; -} - -/*---------------------------------------------------------------------*/ -void servor::do_reactor_process ( const double * x ) { - - // cout<<endl<<" -- "<<name[cursor]<<"... "; // TOTO - - // Read parameters (idem) : - int i1 = 4; - int i2 = 5; - - reactor<pfr> * react_pfr = new reactor<pfr> ( s[i1-1] , s[i2-1] ); - - react_pfr->set(name[cursor]); - - double f1 = x[1]; - double f2 = 0.5; - - string list[5] = { "eb2sty" , "sty2eb" , "eb2bz" , "eb2tol" , "tol2bz" }; - - i1 = 5; - - react_pfr->set(f1,f2,i1,list); - - f1 = 0.0; - f2 = 300.0; - - react_pfr->set(f1,f2); - - if ( react_pfr->solve() ) { - // cout<<"OK"; // TOTO - // react_pfr->write(); // WRITE TOTO - costs[2] = react_pfr->get_cost(); - water[3] = react_pfr->get_water(); - } - else { - cout << "ERROR 9\n\n"; - exit(0); - } - delete react_pfr; -} - - -double servor::get_costs_sum ( void ) const { - double sum = 0.0; - for ( int i = 0 ; i < 8 ; i++ ) - sum += ( (ARRONDI) ? arrondi(costs[i],6) : costs[i] ); - return sum; -} - -double servor::get_power_sum ( void ) const { - double sum = 0.0; - for ( int i = 0 ; i < 6 ; i++ ) - sum += ( (ARRONDI) ? arrondi(power[i],6) : power[i] ); - return sum; -} - -double servor::get_water_sum ( void ) const { - double sum = 0.0; - for ( int i = 0 ; i < 6 ; i++ ) - sum += ( (ARRONDI) ? arrondi(water[i],6) : water[i] ); - return sum; -} +#include "servor.hpp" +#include "reactor.cpp" +using namespace std; + +/*---------------------------------------------------------------------*/ +servor::servor ( int nb_u , int n2 , stream ** streams ) { + nb = nb_u; + nb_s = n2; + type = new string[nb]; + name = new string[nb]; + s = streams; + + +// for (int i=0; i<nb; i++) +// { +// type[i]=new char[31]; +// name[i]=new char[31]; +// } +// cursor=0; +// s = s_list; +// // end = new terminator("\0"); +// mix1=NULL; +// split1=NULL; +// flash1=NULL; +// pump1=NULL; +// col=NULL; +// react_pfr=NULL; +// react_cstr=NULL; +// heat=NULL; + + burn = new burner ( s[0]->nb , s[0]->chem ); +} + +/*---------------------------------------------------------------------*/ +servor::~servor() { + delete [] type; + delete [] name; + delete burn; +} + +/*---------------------------------------------------------------------*/ +bool servor::solve_process ( const double * x , double * y ) { + + + for ( i = 0 ; i < 8 ; i++ ) + costs[i] = 0.0; + + k = 0; + norm = 1.0 / TOL_WEGSTEIN; + + for ( cursor = 0 ; cursor < nb ; cursor++ ) { + + if (type[cursor] == "mix" ) { + do_mix_process(x); + } + else if ( type[cursor] == "split" ) { + do_split_process(x); + } + else if ( type[cursor] == "flash" ) { + do_flash_process(x); + } + else if ( type[cursor] == "pump" ) { + do_pump_process(x); + } + else if ( type[cursor] == "heatx") { + do_heatx_process(x); + } + else if ( type[cursor] == "burner" ) { + do_burner_process(x,y); + } + else if ( type[cursor] == "column" ) { + do_column_process(x,y); + } + else if ( type[cursor] == "reactor" ) { + do_reactor_process(x); + } + else if ( type[cursor] == "loop" ) { + + recycle = 10; + end_recycle = 0; + do_loop_process(x); + } + else { + cout << "ERROR 18\n\n"; + exit(0); + } + + } + + return true; +} + + +/*---------------------------------------------------------------------*/ +void servor::do_loop_process ( const double * x ) { + + // structure in the input file : + // loop + // name : "looping" + // index of recycle stream : 11 + // index of stream's beginning block : 7 + // index of stream's end block : 1 + + // TOTO +// if (k==0) +// cout << endl << " -> Wegstein iterations "; +// else if ( k <= 2 ) +// cout << endl << " -> loop " << setw(3) << k; +// else +// cout << endl << " -> loop " << setw(3) << k << " > error " << norm; + + // Get the two fisrst points + if ( k==0 ) { + for ( i = 0 ; i < s[0]->nb ; i++ ) + x_last[i] = s[recycle]->chem[i]->m; + end_loop = false; + } + + if ( k==1 ) { + for ( i = 0 ; i < s[0]->nb ; i++ ) { + x_now [i] = s[recycle]->chem[i]->m; + g_last[i] = s[recycle]->chem[i]->m; + } + + end_loop = false; + } + + if ( k == 2 ) { + for ( i = 0 ; i < s[0]->nb ; i++ ) + g_now[i] = s[recycle]->chem[i]->m; + end_loop=false; + } + k++; + + + // run the Wegstein algorithm + if ( k > 2 ) { + for ( i = 0 ; i < s[0]->nb ; i++ ) { + g_now[i] = s[recycle]->chem[i]->m; + + if ( fabs (x_now[i]-x_last[i]) > EPS ) + slope[i] = ( g_now[i] - g_last[i] ) / ( x_now[i] - x_last[i] ); + else + slope[i] = 0; + + theta[i] = 1.0 / (1.0-slope[i]); + if ( theta[i] < MIN_THETA ) + theta[i] = MIN_THETA; + if ( theta[i] > MAX_THETA ) + theta[i] = MAX_THETA; + x_next[i] = (1.0-theta[i])*x_now[i] + theta[i]*g_now[i]; + } + norm = 0.0; + for ( i = 0 ; i < s[0]->nb ; i++ ) + if ( fabs(x_now[i]) > EPS ) + norm += fabs (x_next[i]-x_now[i]) / fabs(x_now[i]); + + if ( norm > TOL_WEGSTEIN && k < MAX_ITER_WEGSTEIN ) { + s[recycle]->m = 0.0; + for ( i = 0 ; i < s[0]->nb ; i++ ) { + s[recycle]->chem[i]->m = x_next[i]; + s[recycle]->m += x_next[i]; + x_last[i] = x_now[i]; + g_last[i] = g_now[i]; + x_now[i] = x_next[i]; + } + end_loop=false; + } + if ( norm <= TOL_WEGSTEIN && k < MAX_ITER_WEGSTEIN ) + end_loop = true; + + } + + + if ( end_loop ) { + if ( k < MAX_ITER_WEGSTEIN && k > 3 ) { + // cout<<" OK"; // TOTO + // s[recycle]->write(); // WRITE TOTO + +// // WRITE TOTO : +// cout << "WRITE FILE " << RUNTIME << name[cursor] << ".unit" << " :\n\tBEGIN\n"; +// cout << "\t>> " << name[cursor]; +// cout << endl << "\t>> from block " << cursor+1 << " to block " << end_recycle+1; +// cout << endl << "\t>> Wegstein converged in " +// << k << " iterations (rel. err. " << norm << ")."; +// cout << "\n\tEND\n\n"; + + k = 0; + norm = 1.0/TOL_WEGSTEIN; + } +// else { +// log.open(MESSAGES, ios::app); +// log<<" ==> Error <== Wegstein algorithm did not converge.\n"; +// log.close(); +// } + } + + + if ( !end_loop && k < MAX_ITER_WEGSTEIN ) + cursor = end_recycle-1; + if ( !end_loop && k==MAX_ITER_WEGSTEIN ) { +// log.open(MESSAGES, ios::app); +// log<<" ==> Error <== Wegstein algorithm did not converge.\n"; +// log.close(); + k=0; + norm = 1.0/TOL_WEGSTEIN; + cursor=nb; + } + +} + +/*---------------------------------------------------------------------*/ +void servor::do_burner_process ( const double * x , double * y ) { + + // cout << endl << " -- " << name[cursor] << "... "; // TOTO + + // read parameters : + int i1 = 8; + int i2 = 13; + double f = x[6]; + + burn->set ( s[i1-1] , s[i2-1] ); + burn->set(f); + burn->set(name[cursor]); + + if ( burn->solve(y) ) { + // cout << "OK"; // TOTO + // burn->write(); // WRITE TOTO + costs[7] = burn->get_cost(); + } + else { + cout << "ERROR 20\n\n"; + exit(0); + } +} + +/*---------------------------------------------------------------------*/ +void servor::do_split_process ( const double * x ) +{ + // cout<<endl<<" -- "<<name[cursor]<<"... "; // TOTO + + //Read parameters + int i1 = 9; + int i2 = 2; + int i_tab[2] = { 10 , 11 }; + double f_tab[2]; + f_tab[0] = x[5]; + f_tab[1] = 1-x[5]; + + stream * list1[2]; + list1[0] = s[i_tab[0]-1]; + list1[1] = s[i_tab[1]-1]; + + split * split1 = new split ( i2 , s[i1-1] , list1 ); + + split1->set(f_tab); + split1->set(name[cursor]); + if ( split1->solve() ) { + // cout<<"OK"; // TOTO + // split1->write(); // WRITE TOTO + } + else { + cout << "ERROR 19\n\n"; + exit(0); + } + delete split1; +} + +/*---------------------------------------------------------------------*/ +void servor::do_column_process ( const double * x , double * y ) { + // cout<<endl<<" -- "<<name[cursor]<<"... "; // TOTO + + //Read parameters + double f1 , f2; + int i , i1 , i2; + int i_tab[2]; + double f = 1.0; + + if (name[cursor]=="sep-sty") { + i = 7; + i1 = 15; + i2 = 9; + i_tab[0] = 1; + i_tab[1] = 7; + f1 = f2 = x[2]; + } + else if (name[cursor]=="sep-bz") { + i = 10; + i1 = 12; + i2 = 14; + i_tab[0] = 5; + i_tab[1] = 1; + f1 = f2 = x[3]; + } + else { + cout << "ERROR 17\n\n"; + exit(0); + } + + column * col = new column ( s[i-1] , s[i1-1] , s[i2-1] ); + col->set ( f , i_tab[0] , f1 , i_tab[1] , f2 ); + col->set(name[cursor]); + if ( col->solve() ) { + //cout<<"OK"; // TOTO + //col->write(); // WRITE TOTO + + if (name[cursor]=="sep-sty") { + y[4] = col->get_N(); + costs[5] = col->get_cost(); + power[5] = col->get_power(); + water[5] = col->get_water(); + } + else { + y[5] = col->get_N(); + costs[6] = col->get_cost(); + power[4] = col->get_power(); + water[4] = col->get_water(); + } + } + else { + cout << "ERROR 15\n\n"; + exit(0); + } + delete col; +} + +/*---------------------------------------------------------------------*/ +void servor::do_flash_process ( const double * x ) { + // cout<<endl<<" -- "<<name[cursor]<<"... "; // TOTO + + //Read parameters + double f1 = 1.0; + double f2 = x[7]; + // int i_tab [3] = { 6 , 7 , 8 }; + // flash * flash1 = new flash ( s[i_tab[0]-1] , s[i_tab[1]-1] , s[i_tab[2]-1] ); + flash * flash1 = new flash ( s[5] , s[6] , s[7] ); + + flash1->set(f1, f2); + flash1->set(name[cursor]); + if ( flash1->solve() ) { + // cout<<"OK"; // TOTO + // flash1->write(); // WRITE TOTO + costs[4] = flash1->get_cost(); + power[2] = flash1->get_power(); + water[1] = flash1->get_water(); + } + else { + cout << "ERROR 14\n\n"; + exit(0); + } + delete flash1; +} + + +/*---------------------------------------------------------------------*/ +void servor::do_mix_process ( const double * x ) { + + // cout << endl << " -- " << name[cursor] << "... "; // TOTO + + // Read parameters (hardcode avec eb2sty.process) : + double f1 = 1.0; + int i1 = 3; + int i_tab[3] = { 1 , 12 , 11 }; + int i2 = 2; + + // We can solve the unit + stream * list2 = s[i2-1] , ** list1 = new stream * [i1]; + for ( int i = 0 ; i < i1 ; i++ ) + list1[i] = s[i_tab[i]-1]; + mix * mix1 = new mix ( i1 , list1 , list2 ); + mix1->set(f1); + mix1->set(name[cursor]); + if (mix1->solve()) { + // cout<<"OK"; // TOTO + // mix1->write(); // WRITE TOTO + } + else { + cout << "ERROR 6\n\n"; + exit(0); + } + delete mix1; + delete [] list1; +} + + +/*---------------------------------------------------------------------*/ +void servor::do_pump_process ( const double * x ) { + + // cout<<endl<<" -- "<<name[cursor]<<"... "; // TOTO + + //Read parameters (hardcode avec eb2sty.process) : + int i1 = 2; + int i2 = 3; + double f1 = x[4]; + double f2 = 0.75; + + pump * pump1 = new pump ( s[i1-1] , s[i2-1] ); + pump1->set(f1,f2); + pump1->set(name[cursor]); + + + + // solve : + if ( pump1->solve() ) { + // cout<<"OK"; // TOTO + // pump1->write(); // WRITE TOTO + + power[0] = pump1->get_power(); + costs[0] = pump1->get_cost(); + } + else { + cout << "ERROR 7\n\n"; + exit(0); + } + + delete pump1; +} + +/*---------------------------------------------------------------------*/ +void servor::do_heatx_process ( const double * x ) { + + // cout << endl << " -- " << name[cursor] << "... "; // TOTO + + //Read parameters (idem) : + + bool b = false; + + // heater : + int i1; + int i2; + double f1; + + // heater : + if (name[cursor]=="heater") { + i1 = 3; + i2 = 4; + f1 = x[0]; + } + + // cooler : + else if (name[cursor]=="cooler") { + i1 = 5; + i2 = 6; + f1 = x[7]; + } + else { + cout << "ERROR 16\n\n"; + exit(0); + } + + double f2 = 0.85; + + // solve : + heatx * heat = new heatx ( b , s[i1-1] , s[i2-1] ); + heat->set(f1,f2); + heat->set(name[cursor]); + if (heat->solve()) { + // cout<<"OK"; // TOTO + // heat->write(); // WRITE TOTO + if (name[cursor]=="heater") { + costs[1] = heat->get_cost(); + power[3] = heat->get_power(); + water[2] = heat->get_water(); + } + else { + costs[3] = heat->get_cost(); + power[1] = heat->get_power(); + water[0] = heat->get_water(); + } + } + else { + cout << "ERROR 8\n\n"; + exit(0); + } + delete heat; +} + +/*---------------------------------------------------------------------*/ +void servor::do_reactor_process ( const double * x ) { + + // cout<<endl<<" -- "<<name[cursor]<<"... "; // TOTO + + // Read parameters (idem) : + int i1 = 4; + int i2 = 5; + + reactor<pfr> * react_pfr = new reactor<pfr> ( s[i1-1] , s[i2-1] ); + + react_pfr->set(name[cursor]); + + double f1 = x[1]; + double f2 = 0.5; + + string list[5] = { "eb2sty" , "sty2eb" , "eb2bz" , "eb2tol" , "tol2bz" }; + + i1 = 5; + + react_pfr->set(f1,f2,i1,list); + + f1 = 0.0; + f2 = 300.0; + + react_pfr->set(f1,f2); + + if ( react_pfr->solve() ) { + // cout<<"OK"; // TOTO + // react_pfr->write(); // WRITE TOTO + costs[2] = react_pfr->get_cost(); + water[3] = react_pfr->get_water(); + } + else { + cout << "ERROR 9\n\n"; + exit(0); + } + delete react_pfr; +} + + +double servor::get_costs_sum ( void ) const { + double sum = 0.0; + for ( int i = 0 ; i < 8 ; i++ ) + sum += ( (ARRONDI) ? arrondi(costs[i],6) : costs[i] ); + return sum; +} + +double servor::get_power_sum ( void ) const { + double sum = 0.0; + for ( int i = 0 ; i < 6 ; i++ ) + sum += ( (ARRONDI) ? arrondi(power[i],6) : power[i] ); + return sum; +} + +double servor::get_water_sum ( void ) const { + double sum = 0.0; + for ( int i = 0 ; i < 6 ; i++ ) + sum += ( (ARRONDI) ? arrondi(water[i],6) : water[i] ); + return sum; +} diff --git a/tools/SENSITIVITY/problems/styrene/black-box/truth/servor.hpp b/tools/SENSITIVITY/problems/styrene/black-box/truth/servor.hpp index 73b1cd2ef8efb77cae3833eff494a03b00db71d8..e048542375b8df2942bfd10dd2117cfe6622b53c 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/truth/servor.hpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/truth/servor.hpp @@ -1,101 +1,101 @@ -#ifndef SERVOR_H -#define SERVOR_H - -//Possible units -#include "mix.hpp" -#include "split.hpp" -#include "pump.hpp" -#include "column.hpp" -#include "reactor.hpp" -#include "heatx.hpp" -#include "burner.hpp" - -using namespace std; - -class servor { - -public: - - double norm; - int k; - int nb; - int nb_s; - string * type; - string * name; - int cursor; - stream ** s; - - int recycle; - int end_recycle; - int i; - bool end_loop; - - double x_last[MAX_DIM]; - double x_now [MAX_DIM]; - double x_next[MAX_DIM]; - double g_last[MAX_DIM]; - double g_now [MAX_DIM]; - double slope [MAX_DIM]; - double theta [MAX_DIM]; - - double costs[8]; - double power[6]; - double water[6]; - - - // clock_t beg_time, end_time; - // bool OK, b, solve_OK; - // char filename[31], kind[10], **list, process_name[31]; - // double f, f1, f2, f_tab[10], t; - // int i, i1, i2, i_tab[10], time; - // stream *list2; - -// double theta[MAX_DIM], slope[MAX_DIM], norm; -// bool end_loop; -// int k, recycle, end_recycle; -// char loop_name[31]; - -// mix *mix1; void do_mix(); -// split *split1; -// flash *flash1; void do_flash(); -// pump *pump1; void do_pump(); -// column *col; void do_column(); -// reactor<pfr> *react_pfr; void do_reactor(); -// reactor<cstr> *react_cstr; -// heatx *heat; void do_heatx(); - burner * burn; - -// stream *s; //list of streams -// friend void out_of_memory(void){exit(0);} - - - // constructeur : - servor ( int , int , stream ** ); - - // destructeur : - ~servor(); - - -// void set(int t) {time=t;} -// void set(char n[31]) {strcpy(process_name, n);} - void do_split_process ( const double * x ); - void do_column_process ( const double * x , double * y ); - void do_flash_process ( const double * x ); - void do_mix_process ( const double * x ); - void do_pump_process ( const double * x ); - void do_heatx_process ( const double * x ); - void do_reactor_process ( const double * x ); - void do_burner_process ( const double * x , double * y ); - void do_loop_process ( const double * x ); - - bool solve_process ( const double * x , double * y ); //main solver of the software. - - double get_costs_sum ( void ) const; - - double get_power_sum ( void ) const; - - double get_water_sum ( void ) const; - - -}; -#endif +#ifndef SERVOR_H +#define SERVOR_H + +//Possible units +#include "mix.hpp" +#include "split.hpp" +#include "pump.hpp" +#include "column.hpp" +#include "reactor.hpp" +#include "heatx.hpp" +#include "burner.hpp" + +using namespace std; + +class servor { + +public: + + double norm; + int k; + int nb; + int nb_s; + string * type; + string * name; + int cursor; + stream ** s; + + int recycle; + int end_recycle; + int i; + bool end_loop; + + double x_last[MAX_DIM]; + double x_now [MAX_DIM]; + double x_next[MAX_DIM]; + double g_last[MAX_DIM]; + double g_now [MAX_DIM]; + double slope [MAX_DIM]; + double theta [MAX_DIM]; + + double costs[8]; + double power[6]; + double water[6]; + + + // clock_t beg_time, end_time; + // bool OK, b, solve_OK; + // char filename[31], kind[10], **list, process_name[31]; + // double f, f1, f2, f_tab[10], t; + // int i, i1, i2, i_tab[10], time; + // stream *list2; + +// double theta[MAX_DIM], slope[MAX_DIM], norm; +// bool end_loop; +// int k, recycle, end_recycle; +// char loop_name[31]; + +// mix *mix1; void do_mix(); +// split *split1; +// flash *flash1; void do_flash(); +// pump *pump1; void do_pump(); +// column *col; void do_column(); +// reactor<pfr> *react_pfr; void do_reactor(); +// reactor<cstr> *react_cstr; +// heatx *heat; void do_heatx(); + burner * burn; + +// stream *s; //list of streams +// friend void out_of_memory(void){exit(0);} + + + // constructeur : + servor ( int , int , stream ** ); + + // destructeur : + ~servor(); + + +// void set(int t) {time=t;} +// void set(char n[31]) {strcpy(process_name, n);} + void do_split_process ( const double * x ); + void do_column_process ( const double * x , double * y ); + void do_flash_process ( const double * x ); + void do_mix_process ( const double * x ); + void do_pump_process ( const double * x ); + void do_heatx_process ( const double * x ); + void do_reactor_process ( const double * x ); + void do_burner_process ( const double * x , double * y ); + void do_loop_process ( const double * x ); + + bool solve_process ( const double * x , double * y ); //main solver of the software. + + double get_costs_sum ( void ) const; + + double get_power_sum ( void ) const; + + double get_water_sum ( void ) const; + + +}; +#endif diff --git a/tools/SENSITIVITY/problems/styrene/black-box/truth/split.cpp b/tools/SENSITIVITY/problems/styrene/black-box/truth/split.cpp index d14c519c6794b52ae69162e2455e248636ce0adc..d3f48c90fb149e1ebdd627f3fa28b56c0f331bff 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/truth/split.cpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/truth/split.cpp @@ -1,53 +1,53 @@ -#include "split.hpp" -using namespace std; - -split::split(int n, stream* s1, stream** s2) -{ - nb_out=n; - in = s1; - out= s2; - success = true; -} - -bool split::solve() -{ - tmp=0; - for (i=0;i<nb_out; i++) tmp+=frac[i]; - if(fabs(1-tmp)<=EPS) - { - success = true; - for (i=0; i<nb_out;i++) - { - out[i]->m=0; - for (j=0;j<in->nb;j++) - { - - out[i]->chem[j]->m = frac[i]*in->chem[j]->m; - out[i]->m += out[i]->chem[j]->m; - } - out[i]->set(in->P, in->T); - // out[i]->write(); // TOTO - } - } - tmp=0; for(i=0;i<nb_out;i++) tmp+=out[i]->m; - if(fabs(tmp-in->m)>EPS) - { -// logf.open(MESSAGES, ios::app); -// logf<<" --> Warning <-- Block "<<name<<" is not in mass balance ("<<fabs(tmp-in->m)/tmp<<").\n"; -// logf.close(); - success = false; - } - else success = true; - return success; -} - -void split::write() -{ - cout << "WRITE FILE " << RUNTIME << name << ".unit" << " :\n\tBEGIN\n"; - cout <<"\t>> "<<name; - cout << endl<<"\t>> stream in: "<<in->name;; - cout<<endl<<"\t>> streams out: "<<setprecision(3); - for ( i = 0 ; i < nb_out ; i++ ) - cout << out[i]->name<<" ("<<frac[i]<<") "; - cout << "\n\tEND\n\n"; -} +#include "split.hpp" +using namespace std; + +split::split(int n, stream* s1, stream** s2) +{ + nb_out=n; + in = s1; + out= s2; + success = true; +} + +bool split::solve() +{ + tmp=0; + for (i=0;i<nb_out; i++) tmp+=frac[i]; + if(fabs(1-tmp)<=EPS) + { + success = true; + for (i=0; i<nb_out;i++) + { + out[i]->m=0; + for (j=0;j<in->nb;j++) + { + + out[i]->chem[j]->m = frac[i]*in->chem[j]->m; + out[i]->m += out[i]->chem[j]->m; + } + out[i]->set(in->P, in->T); + // out[i]->write(); // TOTO + } + } + tmp=0; for(i=0;i<nb_out;i++) tmp+=out[i]->m; + if(fabs(tmp-in->m)>EPS) + { +// logf.open(MESSAGES, ios::app); +// logf<<" --> Warning <-- Block "<<name<<" is not in mass balance ("<<fabs(tmp-in->m)/tmp<<").\n"; +// logf.close(); + success = false; + } + else success = true; + return success; +} + +void split::write() +{ + cout << "WRITE FILE " << RUNTIME << name << ".unit" << " :\n\tBEGIN\n"; + cout <<"\t>> "<<name; + cout << endl<<"\t>> stream in: "<<in->name;; + cout<<endl<<"\t>> streams out: "<<setprecision(3); + for ( i = 0 ; i < nb_out ; i++ ) + cout << out[i]->name<<" ("<<frac[i]<<") "; + cout << "\n\tEND\n\n"; +} diff --git a/tools/SENSITIVITY/problems/styrene/black-box/truth/split.hpp b/tools/SENSITIVITY/problems/styrene/black-box/truth/split.hpp index 7634f470e968c8cda76ed0f9642e7bce2ff1a195..2c75638072d6ed52d32f8d48d0c4970069655230 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/truth/split.hpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/truth/split.hpp @@ -1,43 +1,43 @@ -/* -This unit takes one input stream and divides in two or more -output streams. The pressure and temparature of output streams -are the same as the input's. - -Structure in the .process file: -split {name} {index of input stream} {nb_out} {indexes of output streams and fractions of input} - -How to use: - 1- Call the constructor: split1 = new split(nb_out, in, list_out); - 2- Set split fractions: split1->set(fractions); - 3- Set the name: split1->set(name); - 4- Solve: split1->solve(); -*/ -#ifndef SPLIT_H -#define SPLIT_H - -#include "stream.hpp" -using namespace std; - -class split -{ -private: - - int i, j; - bool success; - double tmp; - string name; - int nb_out; //number of input streams - stream *in; //pointer to input stream - stream **out; //list of pointers to output streams - double *frac; //list of split fractions - -public: - split(int, stream*, stream**); //defines the connectivities of this unit - ~split(){} - void set(double* f) {frac=f;} - void set(const string & n) { name = n;} - bool solve(); //finds the temperature and computes mass balance - void write(); -}; - -#endif +/* +This unit takes one input stream and divides in two or more +output streams. The pressure and temparature of output streams +are the same as the input's. + +Structure in the .process file: +split {name} {index of input stream} {nb_out} {indexes of output streams and fractions of input} + +How to use: + 1- Call the constructor: split1 = new split(nb_out, in, list_out); + 2- Set split fractions: split1->set(fractions); + 3- Set the name: split1->set(name); + 4- Solve: split1->solve(); +*/ +#ifndef SPLIT_H +#define SPLIT_H + +#include "stream.hpp" +using namespace std; + +class split +{ +private: + + int i, j; + bool success; + double tmp; + string name; + int nb_out; //number of input streams + stream *in; //pointer to input stream + stream **out; //list of pointers to output streams + double *frac; //list of split fractions + +public: + split(int, stream*, stream**); //defines the connectivities of this unit + ~split(){} + void set(double* f) {frac=f;} + void set(const string & n) { name = n;} + bool solve(); //finds the temperature and computes mass balance + void write(); +}; + +#endif diff --git a/tools/SENSITIVITY/problems/styrene/black-box/truth/stream.cpp b/tools/SENSITIVITY/problems/styrene/black-box/truth/stream.cpp index 408c1cb21e949286b9cb58cc2e25801db61a1480..8854441ea39a4a547414299b8725c623b9042192 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/truth/stream.cpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/truth/stream.cpp @@ -1,265 +1,265 @@ -#include "stream.hpp" -using namespace std; - -// destructor : -stream::~stream ( void ) { - delete thermo; - delete [] tab1; - delete [] tab2; - delete [] tab3; - delete [] tab4; - for ( i = 0 ; i < nb ; i++ ) - delete chem[i]; - delete [] chem; -} - -void stream::check_error() -{ - - if (error>MAX_ERROR) { - cout << "ERROR 4\n\n"; - exit(0); - } - if (warning>MAX_WARNING) { - cout << "ERROR 5\n\n"; - exit(0); - } -} - -void stream::set ( int _nb , chemical ** _chem) { - int i; - for ( i = 0 ; i < nb ; i++ ) - delete chem[i]; - delete [] chem; - nb = _nb; - chem = new chemical * [nb]; - for ( i = 0 ; i < nb ; i++ ) - chem[i] = new chemical(*_chem[i]); -} - -void stream::set(double pres, double temp) //set P, T, find state and resulting v -{ - if(thermo->get_dim()!=nb) - { - delete thermo; - thermo = new thermolib(nb); - } - P=pres; - T=temp; - for (i=0;i<nb;i++) {chem[i]->P=pres; chem[i]->T=temp;} - if(n()>EPS) - { - v=quality(); - tmp1=0; - for (i=0;i<nb;i++) - { - if (T>chem[i]->Tc || v==1) chem[i]->state=1; - else chem[i]->state=0; - } - v=0; - for (i=0;i<nb;i++) - { - if (chem[i]->state==0) {if (chem[i]->m>EPS) v+= chem[i]->m/chem[i]->rho(); tab4[i]=0;} - if (chem[i]->state==1) {tab4[i] = chem[i]->n(); tmp1+=tab4[i];} - } - if (tmp1>EPS) - { - for (i=0;i<nb;i++) - { - tab1[i] = chem[i]->Pc; //cout<<endl<<tab1[i]; - tab2[i] = chem[i]->Tc; // cout<<" "<<tab2[i]; - tab3[i] = chem[i]->omega(); //cout<<" "<<tab3[i]; - tab4[i]/=tmp1; // cout<<" "<<tab4[i]; - } - thermo->send(tab1,tab2,tab3, tab4); - thermo->set(P,T,0.0,tmp1); - v+=thermo->v(); - } - } - else v= 0.0; -} - -void stream::set(double *list) -{ - m=0; - for (i=0; i<nb; i++) - { - chem[i]->m=list[i]; - m+=list[i]; - } -} - -void stream::bubble() -{ - bp=1.1e6; - for(i=0;i<nb;i++) if(T<chem[i]->Tc && chem[i]->Tboil(P)<bp && chem[i]->m>EPS) bp=chem[i]->Tboil(P); - if (bp==1.1e6) bp=0.0; - else - { - step=2; - while (fabs(step)>TOL_BP && fabs(tmp1-1)>TOL_BP) - { - //if(DEBUG) cout<<endl<<bp; - bp+=step; - tmp1=tmp2=0; - for (i=0;i<nb;i++) if(T<chem[i]->Tc) {tmp2+=chem[i]->n(); tmp1+=chem[i]->n()*chem[i]->Psat(bp)/P;} - tmp1/=tmp2; - step=10*(1.0-tmp1); - } - } -} - -void stream::dew() -{ - dp=0.0; - tmp1=10; - for(i=0;i<nb;i++) if(T<chem[i]->Tc && chem[i]->Tboil(P)>dp && chem[i]->m>EPS) dp=chem[i]->Tboil(P); - if (dp>EPS) - { - dp=bp; - step=1; - while (fabs(step)>TOL_DP && fabs(tmp1/tmp2-1)>TOL_DP) - { - dp+=step; - if(dp<bp) dp=bp; - //if(DEBUG) cout<<endl<<dp; - tmp1=tmp2=0; - for (i=0;i<nb;i++) if(T<chem[i]->Tc) {tmp2+=chem[i]->n(); tmp1+=chem[i]->n()/chem[i]->Psat(dp)*P; } - if (step/fabs(step)*tmp2/tmp1 >1 || step/fabs(step)*tmp1/tmp2 <-1) step*= -0.1; - } - } -} - -double stream::quality() -{ - if(T>EPS) - { - bubble(); - dew(); - //if(DEBUG) cout<<endl<<name<<" bp="<<bp<<" dp="<<dp<<" T="<<T; system("pause"); - if (bp < dp) - { - if (bp < T && T< dp) tmp= (T-bp)/(dp-bp); - if (T<= bp) tmp= 0.0; - if (T >= dp) tmp= 1.0; - } - } - else tmp= 0.0; - return tmp; -} - -double stream::K(int i) -{ - for (j=0;j<nb;j++) - tab4[j] = chem[j]->n()/n(); - thermo->send(tab1,tab2,tab3, tab4); - if (T>EPS && P>EPS) - { - thermo->set(P,T,v,n()); - return thermo->K(i); - } - else - { - ofstream logf; - logf.open(MESSAGES, ios::app); - logf<<" --> Warning <-- Cannot compute K of "<<chem[i]->name<<" in stream "<<name<<".\n"; - logf.close(); - warning++; - check_error(); - return 1.0; - } -} - -double stream::n() -{ - tmp=0.0; - for ( k = 0 ; k < nb ; k++ ) - tmp+=chem[k]->n(); - return tmp; -} - - -// affectation : -stream & stream::operator = ( const stream & s ) { - - (*thermo) = *(s.thermo); - - delete [] tab1; - delete [] tab2; - delete [] tab3; - delete [] tab4; - for ( i = 0 ; i < nb ; i++ ) - delete chem[i]; - delete [] chem; - - P = s.P; - T = s.T; - m = s.m; - v = s.v; - i = s.i; - j = s.j; - k = s.k; - error = s.error; - warning = s.warning; - name = s.name; - nb = s.nb; - chem = new chemical *[nb]; - - tab1 = new double[nb]; - tab2 = new double[nb]; - tab3 = new double[nb]; - tab4 = new double[nb]; - - step = s.step; - - for ( i = 0 ; i < nb ; i++ ) { - chem[i] = new chemical(*s.chem[i]); - tab1[i] = s.tab1[i]; - tab2[i] = s.tab2[i]; - tab3[i] = s.tab3[i]; - tab4[i] = s.tab4[i]; - } - - tmp = s.tmp; - tmp1 = s.tmp1; - tmp2 = s.tmp2; - - return *this; -} - - -void stream::write() { - - string file_name = RUNTIME + name + ".stream"; - - cout << "WRITE FILE " << file_name << " :\n\tBEGIN\n"; - - cout.unsetf(ios::scientific); - cout << setiosflags(ios::showpoint | ios::fixed)<<setprecision(1); - - cout << "\t>>" << setw(8) << P << " " << setw(9) << T <<" "; - - cout << resetiosflags(ios::fixed) << setiosflags(ios::scientific) << setprecision(3); - - if (m>EPS) - cout << setw(11) << m << setw(11) << v; - else - cout << " x x "; - for ( i = 0 ; i < nb ; i++ ) { - if ( chem[i]->m <= EPS ) - cout << " x "; - else - cout << setw(11) << chem[i]->m; - } - cout << "\n\tEND\n\n"; - - cout.setf(ios::scientific); - -} - -void stream::purge() -{ - P=T=m=v=0.0; - for(i=0;i<nb;i++) - chem[i]->purge(); -} +#include "stream.hpp" +using namespace std; + +// destructor : +stream::~stream ( void ) { + delete thermo; + delete [] tab1; + delete [] tab2; + delete [] tab3; + delete [] tab4; + for ( i = 0 ; i < nb ; i++ ) + delete chem[i]; + delete [] chem; +} + +void stream::check_error() +{ + + if (error>MAX_ERROR) { + cout << "ERROR 4\n\n"; + exit(0); + } + if (warning>MAX_WARNING) { + cout << "ERROR 5\n\n"; + exit(0); + } +} + +void stream::set ( int _nb , chemical ** _chem) { + int i; + for ( i = 0 ; i < nb ; i++ ) + delete chem[i]; + delete [] chem; + nb = _nb; + chem = new chemical * [nb]; + for ( i = 0 ; i < nb ; i++ ) + chem[i] = new chemical(*_chem[i]); +} + +void stream::set(double pres, double temp) //set P, T, find state and resulting v +{ + if(thermo->get_dim()!=nb) + { + delete thermo; + thermo = new thermolib(nb); + } + P=pres; + T=temp; + for (i=0;i<nb;i++) {chem[i]->P=pres; chem[i]->T=temp;} + if(n()>EPS) + { + v=quality(); + tmp1=0; + for (i=0;i<nb;i++) + { + if (T>chem[i]->Tc || v==1) chem[i]->state=1; + else chem[i]->state=0; + } + v=0; + for (i=0;i<nb;i++) + { + if (chem[i]->state==0) {if (chem[i]->m>EPS) v+= chem[i]->m/chem[i]->rho(); tab4[i]=0;} + if (chem[i]->state==1) {tab4[i] = chem[i]->n(); tmp1+=tab4[i];} + } + if (tmp1>EPS) + { + for (i=0;i<nb;i++) + { + tab1[i] = chem[i]->Pc; //cout<<endl<<tab1[i]; + tab2[i] = chem[i]->Tc; // cout<<" "<<tab2[i]; + tab3[i] = chem[i]->omega(); //cout<<" "<<tab3[i]; + tab4[i]/=tmp1; // cout<<" "<<tab4[i]; + } + thermo->send(tab1,tab2,tab3, tab4); + thermo->set(P,T,0.0,tmp1); + v+=thermo->v(); + } + } + else v= 0.0; +} + +void stream::set(double *list) +{ + m=0; + for (i=0; i<nb; i++) + { + chem[i]->m=list[i]; + m+=list[i]; + } +} + +void stream::bubble() +{ + bp=1.1e6; + for(i=0;i<nb;i++) if(T<chem[i]->Tc && chem[i]->Tboil(P)<bp && chem[i]->m>EPS) bp=chem[i]->Tboil(P); + if (bp==1.1e6) bp=0.0; + else + { + step=2; + while (fabs(step)>TOL_BP && fabs(tmp1-1)>TOL_BP) + { + //if(DEBUG) cout<<endl<<bp; + bp+=step; + tmp1=tmp2=0; + for (i=0;i<nb;i++) if(T<chem[i]->Tc) {tmp2+=chem[i]->n(); tmp1+=chem[i]->n()*chem[i]->Psat(bp)/P;} + tmp1/=tmp2; + step=10*(1.0-tmp1); + } + } +} + +void stream::dew() +{ + dp=0.0; + tmp1=10; + for(i=0;i<nb;i++) if(T<chem[i]->Tc && chem[i]->Tboil(P)>dp && chem[i]->m>EPS) dp=chem[i]->Tboil(P); + if (dp>EPS) + { + dp=bp; + step=1; + while (fabs(step)>TOL_DP && fabs(tmp1/tmp2-1)>TOL_DP) + { + dp+=step; + if(dp<bp) dp=bp; + //if(DEBUG) cout<<endl<<dp; + tmp1=tmp2=0; + for (i=0;i<nb;i++) if(T<chem[i]->Tc) {tmp2+=chem[i]->n(); tmp1+=chem[i]->n()/chem[i]->Psat(dp)*P; } + if (step/fabs(step)*tmp2/tmp1 >1 || step/fabs(step)*tmp1/tmp2 <-1) step*= -0.1; + } + } +} + +double stream::quality() +{ + if(T>EPS) + { + bubble(); + dew(); + //if(DEBUG) cout<<endl<<name<<" bp="<<bp<<" dp="<<dp<<" T="<<T; system("pause"); + if (bp < dp) + { + if (bp < T && T< dp) tmp= (T-bp)/(dp-bp); + if (T<= bp) tmp= 0.0; + if (T >= dp) tmp= 1.0; + } + } + else tmp= 0.0; + return tmp; +} + +double stream::K(int i) +{ + for (j=0;j<nb;j++) + tab4[j] = chem[j]->n()/n(); + thermo->send(tab1,tab2,tab3, tab4); + if (T>EPS && P>EPS) + { + thermo->set(P,T,v,n()); + return thermo->K(i); + } + else + { + ofstream logf; + logf.open(MESSAGES, ios::app); + logf<<" --> Warning <-- Cannot compute K of "<<chem[i]->name<<" in stream "<<name<<".\n"; + logf.close(); + warning++; + check_error(); + return 1.0; + } +} + +double stream::n() +{ + tmp=0.0; + for ( k = 0 ; k < nb ; k++ ) + tmp+=chem[k]->n(); + return tmp; +} + + +// affectation : +stream & stream::operator = ( const stream & s ) { + + (*thermo) = *(s.thermo); + + delete [] tab1; + delete [] tab2; + delete [] tab3; + delete [] tab4; + for ( i = 0 ; i < nb ; i++ ) + delete chem[i]; + delete [] chem; + + P = s.P; + T = s.T; + m = s.m; + v = s.v; + i = s.i; + j = s.j; + k = s.k; + error = s.error; + warning = s.warning; + name = s.name; + nb = s.nb; + chem = new chemical *[nb]; + + tab1 = new double[nb]; + tab2 = new double[nb]; + tab3 = new double[nb]; + tab4 = new double[nb]; + + step = s.step; + + for ( i = 0 ; i < nb ; i++ ) { + chem[i] = new chemical(*s.chem[i]); + tab1[i] = s.tab1[i]; + tab2[i] = s.tab2[i]; + tab3[i] = s.tab3[i]; + tab4[i] = s.tab4[i]; + } + + tmp = s.tmp; + tmp1 = s.tmp1; + tmp2 = s.tmp2; + + return *this; +} + + +void stream::write() { + + string file_name = RUNTIME + name + ".stream"; + + cout << "WRITE FILE " << file_name << " :\n\tBEGIN\n"; + + cout.unsetf(ios::scientific); + cout << setiosflags(ios::showpoint | ios::fixed)<<setprecision(1); + + cout << "\t>>" << setw(8) << P << " " << setw(9) << T <<" "; + + cout << resetiosflags(ios::fixed) << setiosflags(ios::scientific) << setprecision(3); + + if (m>EPS) + cout << setw(11) << m << setw(11) << v; + else + cout << " x x "; + for ( i = 0 ; i < nb ; i++ ) { + if ( chem[i]->m <= EPS ) + cout << " x "; + else + cout << setw(11) << chem[i]->m; + } + cout << "\n\tEND\n\n"; + + cout.setf(ios::scientific); + +} + +void stream::purge() +{ + P=T=m=v=0.0; + for(i=0;i<nb;i++) + chem[i]->purge(); +} diff --git a/tools/SENSITIVITY/problems/styrene/black-box/truth/stream.hpp b/tools/SENSITIVITY/problems/styrene/black-box/truth/stream.hpp index 895ef3d6b8fcd99dee13564f66d71932a2c009c5..94b21025cc190e1bc0783d172737cd72bef2e889 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/truth/stream.hpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/truth/stream.hpp @@ -1,86 +1,86 @@ -#ifndef STREAM_H -#define STREAM_H -#include "chemical.hpp" -#include <iomanip> -using namespace std; - -class stream { - -private: - - stream ( void ) {} - stream ( const stream & s ) {} - -public: - void check_error(); - - double P, T, m, v; // Pressure in atm, temperature in K, - // total mass flow in kg/s, total volume flow in m3/s - - int i, j, k, error, warning; - - string name; - - int nb; // number of chemicals to store; - - chemical ** chem; // list of stored chemicals - - thermolib *thermo; - - double tmp, tmp1,tmp2, *tab1, *tab2, *tab3, *tab4; - double step; - void bubble(), dew(); - -public: - - - - - - double dp, bp; - double rho() {if(v!=0) return m/v; else exit(0);} // Apparent density in kg/m3 - double n(); // total mole flow (mol/s) - double quality(); // returns the vapor fraction of stream (1=all vapor, 0 = all liquid) - double K(int); // returns the vapor-liquid equilibrium constant of compound i - - // constructor : - stream ( const string _name , int n , chemical ** list ) : P (0 ) , - T (0 ) , - m (0 ) , - v (0 ) , - error (0 ) , - warning(0 ) , - name (_name ) , - nb (n ) , - chem (new chemical *[nb]) , - thermo (new thermolib (nb)) , - tab1 (new double [nb]) , - tab2 (new double [nb]) , - tab3 (new double [nb]) , - tab4 (new double [nb]) { - for ( i = 0 ; i < nb ; i++ ) - chem[i] = new chemical(*list[i]); - } - - - // affectation : - stream & operator = ( const stream & s ); - - void set_thermo ( thermolib * t ) { (*thermo) = *t; } - - - void set(double, double); // Sets P and T - void set(double*); // Sets mass flows - void set( const string & n ) { name = n;} - void set ( int _nb , chemical ** _chem); - - - // destructor : - ~stream ( void ); - - void write(); - void purge(); -}; - - -#endif +#ifndef STREAM_H +#define STREAM_H +#include "chemical.hpp" +#include <iomanip> +using namespace std; + +class stream { + +private: + + stream ( void ) {} + stream ( const stream & s ) {} + +public: + void check_error(); + + double P, T, m, v; // Pressure in atm, temperature in K, + // total mass flow in kg/s, total volume flow in m3/s + + int i, j, k, error, warning; + + string name; + + int nb; // number of chemicals to store; + + chemical ** chem; // list of stored chemicals + + thermolib *thermo; + + double tmp, tmp1,tmp2, *tab1, *tab2, *tab3, *tab4; + double step; + void bubble(), dew(); + +public: + + + + + + double dp, bp; + double rho() {if(v!=0) return m/v; else exit(0);} // Apparent density in kg/m3 + double n(); // total mole flow (mol/s) + double quality(); // returns the vapor fraction of stream (1=all vapor, 0 = all liquid) + double K(int); // returns the vapor-liquid equilibrium constant of compound i + + // constructor : + stream ( const string _name , int n , chemical ** list ) : P (0 ) , + T (0 ) , + m (0 ) , + v (0 ) , + error (0 ) , + warning(0 ) , + name (_name ) , + nb (n ) , + chem (new chemical *[nb]) , + thermo (new thermolib (nb)) , + tab1 (new double [nb]) , + tab2 (new double [nb]) , + tab3 (new double [nb]) , + tab4 (new double [nb]) { + for ( i = 0 ; i < nb ; i++ ) + chem[i] = new chemical(*list[i]); + } + + + // affectation : + stream & operator = ( const stream & s ); + + void set_thermo ( thermolib * t ) { (*thermo) = *t; } + + + void set(double, double); // Sets P and T + void set(double*); // Sets mass flows + void set( const string & n ) { name = n;} + void set ( int _nb , chemical ** _chem); + + + // destructor : + ~stream ( void ); + + void write(); + void purge(); +}; + + +#endif diff --git a/tools/SENSITIVITY/problems/styrene/black-box/truth/thermolib.cpp b/tools/SENSITIVITY/problems/styrene/black-box/truth/thermolib.cpp index f6bf0a15792f059ba7e2c086395e348223ea5094..13a3b35f8f8bccf272bb39053902421df53d1f91 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/truth/thermolib.cpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/truth/thermolib.cpp @@ -1,174 +1,174 @@ -#include "thermolib.hpp" -#include "defines.hpp" -#include "secant.cpp" -using namespace std; - - - - -// affectation : -thermolib & thermolib::operator = ( const thermolib & t ) { - - if (dim!=t.dim) - reset(t.dim); - - for ( i = 0 ; i < dim ; i++ ) { - Pc[i] = t.Pc[i]; - Tc[i] = t.Tc[i]; - omega[i] = t.omega[i]; - molefrac[i] = t.molefrac[i]; - } - - return *this; -} - -thermolib::~thermolib() { - delete solver; - delete [] Pc; - delete [] Tc; - delete [] omega; - delete [] molefrac; -} - -void thermolib::construct ( void ) { - molefrac = new double[dim]; - Pc = new double[dim]; - Tc = new double[dim]; - omega = new double[dim]; - - // C. Tribes add this for more robustness (variables may be initialized uncorrectly dependent on the execution) - for ( i = 0 ; i < dim ; i++ ) - { - Pc[i] = 0.0; - Tc[i] = 0.0; - omega[i] = 0.0; - molefrac[i] = 0.0; - } - - solver = new secant<thermolib>(); -} - -void thermolib::reset(int b) -{ - delete [] molefrac; - delete [] Pc; - delete [] Tc; - delete [] omega; - delete solver; - dim = b; - construct(); -} - -double thermolib::a_mix() -{ - if (dim>1) - { - tmp=0; - for (i=0;i<dim;i++) - for (j=0;j<dim;j++) - tmp += molefrac[i]*molefrac[j]*sqrt(a(i)*a(j)); - return tmp; - } - else return a(0); -} - -double thermolib::b_mix() -{ - if (dim>1) - { - tmp=0; - for (i=0;i<dim;i++) - tmp += molefrac[i]*b(i); - return tmp; - } - else return b(0); -} - -void thermolib::send(double* pc, double* tc, double* w, double* y) -{ - for (i=0;i<dim;i++) - { - Pc[i] = pc[i]*101.325; - Tc[i] = tc[i]; - omega[i] = w[i]; - molefrac[i] = y[i]; - } -} - -double thermolib::P() -{ - task=0; - pressure = 8.3144*temperature/molevolume; - solver->set(this, pressure, 1.001*pressure); - success=solver->run(); - return pressure/101.325; -} - -double thermolib::T() -{ - task=1; - temperature = pressure*molevolume/8.144; - solver->set(this, temperature, 1.001*temperature); - success=solver->run(); - return temperature; -} - -double thermolib::v() -{ - if (mole>EPS) - { - task=2; - molevolume = 8.3144*temperature/pressure; - solver->set(this, molevolume, 1.001*molevolume); - success=solver->run(); - return 0.001*mole*molevolume; - } - else return 0.0; -} - -double thermolib::Zv() -{ - task=4; - solver->set(this, 1.0, 0.99); - success=solver->run(); - return Z; -} - -double thermolib::phiV(int i) -{ - return exp((Z-1)*B(i)/B() - log(Z-B()) - A()/B()*(2*sqrt(A(i)/A())-B(i)/B())*log(1+B()/Z)); -} - -double thermolib::phiL(int i) -{ - Pr = pressure/Pc[i]; - Tr = temperature/Tc[i]; - tmp = 2.05135 - 2.10899/Tr - 0.19396*pow(Tr,2) + 0.02282*pow(Tr,3) + (0.08852 - 0.00872*pow(Tr,2))*Pr + (-0.00353 - 0.00203*Tr)*pow(Pr,2) - log10(Pr); - tmp += omega[i]*(-4.23893 + 8.65808*Tr - 1.2206/Tr - 3.15224*pow(Tr,3) - 0.025*(Pr-0.6)); - return pow(10, tmp); -} - -double thermolib::f(double x) -{ - if (task==0) - { - pressure=x; - x= 8.3144*temperature/(molevolume-b_mix()) - a_mix()/(pow(molevolume,2)+b_mix()*molevolume) - x; - } - if (task==1) - { - temperature=x; - x= 8.3144*x/(molevolume-b_mix()) - a_mix()/(pow(molevolume,2)+b_mix()*molevolume) - pressure; - } - if (task==2) - { - molevolume=x; - x= 8.3144*temperature/(x-b_mix()) - a_mix()/(pow(x,2)+b_mix()*x) - pressure; - } - if(task==4) - { - Z=x; - x= (pow(x,3)-pow(x,2)+(A()-B()-pow(B(),2))*x-A()*B()); - } - return x; -} +#include "thermolib.hpp" +#include "defines.hpp" +#include "secant.cpp" +using namespace std; + + + + +// affectation : +thermolib & thermolib::operator = ( const thermolib & t ) { + + if (dim!=t.dim) + reset(t.dim); + + for ( i = 0 ; i < dim ; i++ ) { + Pc[i] = t.Pc[i]; + Tc[i] = t.Tc[i]; + omega[i] = t.omega[i]; + molefrac[i] = t.molefrac[i]; + } + + return *this; +} + +thermolib::~thermolib() { + delete solver; + delete [] Pc; + delete [] Tc; + delete [] omega; + delete [] molefrac; +} + +void thermolib::construct ( void ) { + molefrac = new double[dim]; + Pc = new double[dim]; + Tc = new double[dim]; + omega = new double[dim]; + + // C. Tribes add this for more robustness (variables may be initialized uncorrectly dependent on the execution) + for ( i = 0 ; i < dim ; i++ ) + { + Pc[i] = 0.0; + Tc[i] = 0.0; + omega[i] = 0.0; + molefrac[i] = 0.0; + } + + solver = new secant<thermolib>(); +} + +void thermolib::reset(int b) +{ + delete [] molefrac; + delete [] Pc; + delete [] Tc; + delete [] omega; + delete solver; + dim = b; + construct(); +} + +double thermolib::a_mix() +{ + if (dim>1) + { + tmp=0; + for (i=0;i<dim;i++) + for (j=0;j<dim;j++) + tmp += molefrac[i]*molefrac[j]*sqrt(a(i)*a(j)); + return tmp; + } + else return a(0); +} + +double thermolib::b_mix() +{ + if (dim>1) + { + tmp=0; + for (i=0;i<dim;i++) + tmp += molefrac[i]*b(i); + return tmp; + } + else return b(0); +} + +void thermolib::send(double* pc, double* tc, double* w, double* y) +{ + for (i=0;i<dim;i++) + { + Pc[i] = pc[i]*101.325; + Tc[i] = tc[i]; + omega[i] = w[i]; + molefrac[i] = y[i]; + } +} + +double thermolib::P() +{ + task=0; + pressure = 8.3144*temperature/molevolume; + solver->set(this, pressure, 1.001*pressure); + success=solver->run(); + return pressure/101.325; +} + +double thermolib::T() +{ + task=1; + temperature = pressure*molevolume/8.144; + solver->set(this, temperature, 1.001*temperature); + success=solver->run(); + return temperature; +} + +double thermolib::v() +{ + if (mole>EPS) + { + task=2; + molevolume = 8.3144*temperature/pressure; + solver->set(this, molevolume, 1.001*molevolume); + success=solver->run(); + return 0.001*mole*molevolume; + } + else return 0.0; +} + +double thermolib::Zv() +{ + task=4; + solver->set(this, 1.0, 0.99); + success=solver->run(); + return Z; +} + +double thermolib::phiV(int i) +{ + return exp((Z-1)*B(i)/B() - log(Z-B()) - A()/B()*(2*sqrt(A(i)/A())-B(i)/B())*log(1+B()/Z)); +} + +double thermolib::phiL(int i) +{ + Pr = pressure/Pc[i]; + Tr = temperature/Tc[i]; + tmp = 2.05135 - 2.10899/Tr - 0.19396*pow(Tr,2) + 0.02282*pow(Tr,3) + (0.08852 - 0.00872*pow(Tr,2))*Pr + (-0.00353 - 0.00203*Tr)*pow(Pr,2) - log10(Pr); + tmp += omega[i]*(-4.23893 + 8.65808*Tr - 1.2206/Tr - 3.15224*pow(Tr,3) - 0.025*(Pr-0.6)); + return pow(10, tmp); +} + +double thermolib::f(double x) +{ + if (task==0) + { + pressure=x; + x= 8.3144*temperature/(molevolume-b_mix()) - a_mix()/(pow(molevolume,2)+b_mix()*molevolume) - x; + } + if (task==1) + { + temperature=x; + x= 8.3144*x/(molevolume-b_mix()) - a_mix()/(pow(molevolume,2)+b_mix()*molevolume) - pressure; + } + if (task==2) + { + molevolume=x; + x= 8.3144*temperature/(x-b_mix()) - a_mix()/(pow(x,2)+b_mix()*x) - pressure; + } + if(task==4) + { + Z=x; + x= (pow(x,3)-pow(x,2)+(A()-B()-pow(B(),2))*x-A()*B()); + } + return x; +} diff --git a/tools/SENSITIVITY/problems/styrene/black-box/truth/thermolib.hpp b/tools/SENSITIVITY/problems/styrene/black-box/truth/thermolib.hpp index 3d39c8c7664d3be918c45978344f86a89d681550..3440270ab02d6575023747971b89e9725da31061 100644 --- a/tools/SENSITIVITY/problems/styrene/black-box/truth/thermolib.hpp +++ b/tools/SENSITIVITY/problems/styrene/black-box/truth/thermolib.hpp @@ -1,50 +1,50 @@ -#ifndef THERMOLIB_H -#define THERMOLIB_H -#include "secant.hpp" -using namespace std; - -class thermolib -{ - private: - bool success; - int dim, i, j; - double pressure, temperature, molevolume, mole,*molefrac; - double *Pc, *Tc, *omega, Z, tmp, Tr, Pr; - void construct(); - double a(int i) {return (0.42748*pow(8.8144,2)*pow(Tc[i],2)*pow(1.0+f_omega(i)*(1.0-sqrt(temperature/Tc[i])), 2)/Pc[i]);} - double a_mix(); - double b(int i) {return (0.08664*8.3144*Tc[i]/Pc[i]);} - double b_mix(); - double A(int i) {return (a(i)*pressure/pow(8.3144, 2)/pow(temperature, 2));} - double A() {return (a_mix()*pressure/pow(8.3144, 2)/pow(temperature, 2));} - double B(int i) {return (b(i)*pressure/8.3144/temperature);} - double B(){return (b_mix()*pressure/8.3144/temperature);} - double Zv(), phiV(int), phiL(int); - double f_omega(int i) {return (0.48 + 1.574*omega[i] - 0.176*pow(omega[i], 2));} - int task; //0=find P 1=find T 2=find v 3= find K 4=find Zv - secant<thermolib> *solver; - - public: - double P(); //retruns pressure at T and v, in atm - double T(); //returns temperature at P and v, in K - double v(); //returns volume flow at P, T, n(), in m3/s - double K() {Z = Zv(); return phiL(0)/phiV(0);} //returns the vapor-liquid equilibirum constant - double K(int i) {return phiL(i)/phiV(i);} - double compres_coeff(){return 1.0;}; - - -// affectation : - thermolib & operator = ( const thermolib & t ); - - thermolib ( int d = 1 ) { dim=d; construct();} - - void send(double pc, double tc, double w) { Pc[0] = pc*101.325; Tc[0] = tc; omega[0]=w;} - void send(double*, double*, double*, double*); - void set(double p, double t, double v, double n) {pressure=p*101.325; temperature=t; molevolume=0.001*n/v; mole=n;} - double f(double); - int get_dim() {return dim;} - ~thermolib(); - void reset(int); -}; -#endif - +#ifndef THERMOLIB_H +#define THERMOLIB_H +#include "secant.hpp" +using namespace std; + +class thermolib +{ + private: + bool success; + int dim, i, j; + double pressure, temperature, molevolume, mole,*molefrac; + double *Pc, *Tc, *omega, Z, tmp, Tr, Pr; + void construct(); + double a(int i) {return (0.42748*pow(8.8144,2)*pow(Tc[i],2)*pow(1.0+f_omega(i)*(1.0-sqrt(temperature/Tc[i])), 2)/Pc[i]);} + double a_mix(); + double b(int i) {return (0.08664*8.3144*Tc[i]/Pc[i]);} + double b_mix(); + double A(int i) {return (a(i)*pressure/pow(8.3144, 2)/pow(temperature, 2));} + double A() {return (a_mix()*pressure/pow(8.3144, 2)/pow(temperature, 2));} + double B(int i) {return (b(i)*pressure/8.3144/temperature);} + double B(){return (b_mix()*pressure/8.3144/temperature);} + double Zv(), phiV(int), phiL(int); + double f_omega(int i) {return (0.48 + 1.574*omega[i] - 0.176*pow(omega[i], 2));} + int task; //0=find P 1=find T 2=find v 3= find K 4=find Zv + secant<thermolib> *solver; + + public: + double P(); //retruns pressure at T and v, in atm + double T(); //returns temperature at P and v, in K + double v(); //returns volume flow at P, T, n(), in m3/s + double K() {Z = Zv(); return phiL(0)/phiV(0);} //returns the vapor-liquid equilibirum constant + double K(int i) {return phiL(i)/phiV(i);} + double compres_coeff(){return 1.0;}; + + +// affectation : + thermolib & operator = ( const thermolib & t ); + + thermolib ( int d = 1 ) { dim=d; construct();} + + void send(double pc, double tc, double w) { Pc[0] = pc*101.325; Tc[0] = tc; omega[0]=w;} + void send(double*, double*, double*, double*); + void set(double p, double t, double v, double n) {pressure=p*101.325; temperature=t; molevolume=0.001*n/v; mole=n;} + double f(double); + int get_dim() {return dim;} + ~thermolib(); + void reset(int); +}; +#endif + diff --git a/utils/DisplayCacheFile/build.m b/utils/DisplayCacheFile/build.m index a23f2823b47c4cae88998f7e39a120b4c12e5133..b74b71927cfc6abc9b599843caf66398fd4aacf1 100644 --- a/utils/DisplayCacheFile/build.m +++ b/utils/DisplayCacheFile/build.m @@ -1,87 +1,90 @@ -%% GERAD NOMAD Build for Matlab - -% This file will help you compile NOMAD for use with MATLAB. - -% To recompile you will need to get / do the following: - -% 1) Get NOMAD -% NOMAD is available from https://www.gerad.ca/nomad -% Complete the download form then download the latest version. Define the -% $NOMAD_HOME environment variable. - -% 2) Start Matlab and go into $NOMAD_HOME/examples/interfaces/Matlab_Mex -% The NOMAD MEX Interface is a simple MEX interface written to use NOMAD. - -% 3) Compile the MEX File -% The code below will build the NOMAD MEX file and set the Matlab path. - -clear nomad - -% Default library names -nameLibNomad = 'libnomad.so'; - -% Default update LDFLAGS -updateLDFLAGS= ''; - -% Current directory -cdir = cd; - -% Check and set nomad_home and create variables for path -clear nomad_home nomad_src; -nomad_home = getenv('NOMAD_HOME'); - - -if ( length(nomad_home)<1 ) -% Get a default directory for NOMAD_HOME -cd .. -cd .. -nomad_home = cd; - -if ( ~ exist(nomad_home,'dir') ) -error('The default NOMAD_HOME directory does not exist. Please provide a correct value for the NOMAD_HOME variables with the command setenv(''NOMAD_HOME'',ARG1)'); -end - -setenv('NOMAD_HOME',nomad_home); -warning('The NOMAD_HOME variable is set with its default value %s. The default can be replaced by using the command setenv(''NOMAD_HOME'',ARG1)! before runner the GERAD_NOMAD_build command.',nomad_home); -cd(cdir); -end -nomad_src=[nomad_home filesep 'src' filesep]; -nomad_lib=[nomad_home filesep 'lib' filesep]; -nomad_bin=[nomad_home filesep 'bin' filesep]; - -switch(computer) -case 'PCWIN' -libdir = ' -Lwin32\'; -nameLibNomad = 'nomad.dll'; -case 'PCWIN64' -libdir = ' -Lwin64\'; -nameLibNomad = 'nomad.dll'; -case 'GLNX86' -libdir = 'glnx86/'; -updateLDFLAGS = 'LDFLAGS=''$LDFLAGS -Wl,-rpath,''''$ORIGIN/../lib/'''' '' '; -case 'GLNXA64' -libdir = 'glnxa64/'; -updateLDFLAGS = 'LDFLAGS=''$LDFLAGS -Wl,-rpath,''''$ORIGIN/../lib/'''' '' '; -case 'MACI64' -libdir = 'maci64/'; -end - -%Get NOMAD Libraries -post = [' -I. -I' nomad_src ' -lm -lut -lnomad -L ' nomad_lib ' -output displayCacheM']; - -%Compile & Move -pre = ['mex -v -largeArrayDims ' updateLDFLAGS ' displayCacheM.cpp ' ]; - -try - eval([pre post]) - if ( strcmp(computer,'MACI64') ) - install_cmd = ['install_name_tool -change libnomad.so ' nomad_lib 'libnomad.so displayCacheM.mexmaci64' ]; - system(install_cmd); - end - clear nomad_home nomad_src cdir post pre libdir; - fprintf('Done!\n'); -catch ME - clear nomad_home nomad_src cdir post pre libdir; - error('opti:nomad','Error Compiling NOMAD!\n%s',ME.message); -end -fprintf('------------------------------------------------\n'); +%% GERAD NOMAD Build for Matlab + +% This file will help you compile NOMAD for use with MATLAB. + +% To recompile you will need to get / do the following: + +% 1) Get NOMAD +% NOMAD is available from https://www.gerad.ca/nomad +% Complete the download form then download the latest version. Define the +% $NOMAD_HOME environment variable. + +% 2) Start Matlab and go into $NOMAD_HOME/examples/interfaces/Matlab_Mex +% The NOMAD MEX Interface is a simple MEX interface written to use NOMAD. + +% 3) Compile the MEX File +% The code below will build the NOMAD MEX file and set the Matlab path. + +clear nomad + +% Default library names +nameLibNomad = 'libnomad.so'; + +% Default update LDFLAGS +updateLDFLAGS= ''; + +% Current directory +cdir = cd; + +% Check and set nomad_home and create variables for path +clear nomad_home nomad_src; +nomad_home = getenv('NOMAD_HOME'); + + +if ( length(nomad_home)<1 ) +% Get a default directory for NOMAD_HOME +cd .. +cd .. +nomad_home = cd; + +if ( ~ exist(nomad_home,'dir') ) +error('The default NOMAD_HOME directory does not exist. Please provide a correct value for the NOMAD_HOME variables with the command setenv(''NOMAD_HOME'',ARG1)'); +end + +setenv('NOMAD_HOME',nomad_home); +warning('The NOMAD_HOME variable is set with its default value %s. The default can be replaced by using the command setenv(''NOMAD_HOME'',ARG1)! before runner the GERAD_NOMAD_build command.',nomad_home); +cd(cdir); +end +nomad_src=[nomad_home filesep 'src' filesep]; +nomad_lib=[nomad_home filesep 'lib' filesep]; +nomad_bin=[nomad_home filesep 'bin' filesep]; +nomad_sgtelib_src=[nomad_home filesep 'ext' filesep 'sgtelib' filesep 'src']; + +switch(computer) +case 'PCWIN' +%libdir = ' -Lwin32\'; +%nameLibNomad = 'nomad.dll'; +error('The installation script for Windows is not yet available.'); +case 'PCWIN64' +%libdir = ' -Lwin64\'; +%nameLibNomad = 'nomad.dll'; +error('The installation script for Windows is not yet available.'); +case 'GLNX86' +libdir = 'glnx86/'; +updateLDFLAGS = 'LDFLAGS=''$LDFLAGS -Wl,-rpath,''''$ORIGIN/../lib/'''' '' '; +case 'GLNXA64' +libdir = 'glnxa64/'; +updateLDFLAGS = 'LDFLAGS=''$LDFLAGS -Wl,-rpath,''''$ORIGIN/../lib/'''' '' '; +case 'MACI64' +libdir = 'maci64/'; +end + +%Get NOMAD Libraries +post = [' -I. -I' nomad_src ' -I' nomad_sgtelib_src ' -lm -lut -lnomad -L ' nomad_lib ' -output displayCacheM']; + +%Compile & Move +pre = ['mex -v -largeArrayDims ' updateLDFLAGS ' displayCacheM.cpp ' ]; + +try + eval([pre post]) + if ( strcmp(computer,'MACI64') ) + install_cmd = ['install_name_tool -change libnomad.so ' nomad_lib 'libnomad.so displayCacheM.mexmaci64' ]; + system(install_cmd); + end + clear nomad_home nomad_src nomad_sgtelib_src cdir post pre libdir; + fprintf('Done!\n'); +catch ME + clear nomad_home nomad_src nomad_sgtelib_src cdir post pre libdir; + error('opti:nomad','Error Compiling NOMAD!\n%s',ME.message); +end +fprintf('------------------------------------------------\n'); diff --git a/utils/DisplayCacheFile/cache1.bin b/utils/DisplayCacheFile/cache1_OSX.bin similarity index 100% rename from utils/DisplayCacheFile/cache1.bin rename to utils/DisplayCacheFile/cache1_OSX.bin diff --git a/utils/DisplayCacheFile/makefile b/utils/DisplayCacheFile/makefile index 195338a268cb490019c55b41325520de0b5f8a20..a94bd91d84cc4d424baf17d09950fa96b8adcdb5 100644 --- a/utils/DisplayCacheFile/makefile +++ b/utils/DisplayCacheFile/makefile @@ -10,13 +10,13 @@ LIB_NOMAD = libnomad.so CXXFLAGS = ifeq ($(UNAME), Linux) -CXXFLAGS += -Wl,-rpath,’$(LIB_DIR)’ +CXXFLAGS += -Wl,-rpath,'$(LIB_DIR)' CXXFLAGS += -ansi endif LDLIBS = -lm -lnomad -INCLUDE = -I$(NOMAD_HOME)/src -I. +INCLUDE = -I$(NOMAD_HOME)/src -I$(NOMAD_HOME)/ext/sgtelib/src -I. COMPILE = $(COMPILATOR) $(COMPILATOR_OPTIONS) $(INCLUDE) -c OBJS = displayCache.o diff --git a/utils/MergeCacheFiles/build.m b/utils/MergeCacheFiles/build.m index 9a1ce337401bb6723428f4b765a8ad0814cd9d0d..3cad0402eda58d4d9111e62405332fb7fe28e897 100644 --- a/utils/MergeCacheFiles/build.m +++ b/utils/MergeCacheFiles/build.m @@ -1,87 +1,90 @@ -%% GERAD NOMAD Build for Matlab - -% This file will help you compile NOMAD for use with MATLAB. - -% To recompile you will need to get / do the following: - -% 1) Get NOMAD -% NOMAD is available from https://www.gerad.ca/nomad -% Complete the download form then download the latest version. Define the -% $NOMAD_HOME environment variable. - -% 2) Start Matlab and go into $NOMAD_HOME/examples/interfaces/Matlab_Mex -% The NOMAD MEX Interface is a simple MEX interface written to use NOMAD. - -% 3) Compile the MEX File -% The code below will build the NOMAD MEX file and set the Matlab path. - -clear nomad - -% Default library names -nameLibNomad = 'libnomad.so'; - -% Default update LDFLAGS -updateLDFLAGS= ''; - -% Current directory -cdir = cd; - -% Check and set nomad_home and create variables for path -clear nomad_home nomad_src; -nomad_home = getenv('NOMAD_HOME'); - - -if ( length(nomad_home)<1 ) -% Get a default directory for NOMAD_HOME -cd .. -cd .. -nomad_home = cd; - -if ( ~ exist(nomad_home,'dir') ) -error('The default NOMAD_HOME directory does not exist. Please provide a correct value for the NOMAD_HOME variables with the command setenv(''NOMAD_HOME'',ARG1)'); -end - -setenv('NOMAD_HOME',nomad_home); -warning('The NOMAD_HOME variable is set with its default value %s. The default can be replaced by using the command setenv(''NOMAD_HOME'',ARG1)! before runner the GERAD_NOMAD_build command.',nomad_home); -cd(cdir); -end -nomad_src=[nomad_home filesep 'src' filesep]; -nomad_lib=[nomad_home filesep 'lib' filesep]; -nomad_bin=[nomad_home filesep 'bin' filesep]; - -switch(computer) -case 'PCWIN' -libdir = ' -Lwin32\'; -nameLibNomad = 'nomad.dll'; -case 'PCWIN64' -libdir = ' -Lwin64\'; -nameLibNomad = 'nomad.dll'; -case 'GLNX86' -libdir = 'glnx86/'; -updateLDFLAGS = 'LDFLAGS=''$LDFLAGS -Wl,-rpath,''''$ORIGIN/../lib/'''' '' '; -case 'GLNXA64' -libdir = 'glnxa64/'; -updateLDFLAGS = 'LDFLAGS=''$LDFLAGS -Wl,-rpath,''''$ORIGIN/../lib/'''' '' '; -case 'MACI64' -libdir = 'maci64/'; -end - -%Get NOMAD Libraries -post = [' -I. -I' nomad_src ' -lm -lut -lnomad -L ' nomad_lib ' -output mergeM']; - -%Compile & Move -pre = ['mex -v -largeArrayDims ' updateLDFLAGS ' mergeM.cpp ' ]; - -try - eval([pre post]) - if ( strcmp(computer,'MACI64') ) - install_cmd = ['install_name_tool -change libnomad.so ' nomad_lib 'libnomad.so mergeM.mexmaci64' ]; - system(install_cmd); - end - clear nomad_home nomad_src cdir post pre libdir; - fprintf('Done!\n'); -catch ME - clear nomad_home nomad_src cdir post pre libdir; - error('opti:nomad','Error Compiling NOMAD!\n%s',ME.message); -end -fprintf('------------------------------------------------\n'); +%% GERAD NOMAD Build for Matlab + +% This file will help you compile NOMAD for use with MATLAB. + +% To recompile you will need to get / do the following: + +% 1) Get NOMAD +% NOMAD is available from https://www.gerad.ca/nomad +% Complete the download form then download the latest version. Define the +% $NOMAD_HOME environment variable. + +% 2) Start Matlab and go into $NOMAD_HOME/examples/interfaces/Matlab_Mex +% The NOMAD MEX Interface is a simple MEX interface written to use NOMAD. + +% 3) Compile the MEX File +% The code below will build the NOMAD MEX file and set the Matlab path. + +clear nomad + +% Default library names +nameLibNomad = 'libnomad.so'; + +% Default update LDFLAGS +updateLDFLAGS= ''; + +% Current directory +cdir = cd; + +% Check and set nomad_home and create variables for path +clear nomad_home nomad_src; +nomad_home = getenv('NOMAD_HOME'); + + +if ( length(nomad_home)<1 ) +% Get a default directory for NOMAD_HOME +cd .. +cd .. +nomad_home = cd; + +if ( ~ exist(nomad_home,'dir') ) +error('The default NOMAD_HOME directory does not exist. Please provide a correct value for the NOMAD_HOME variables with the command setenv(''NOMAD_HOME'',ARG1)'); +end + +setenv('NOMAD_HOME',nomad_home); +warning('The NOMAD_HOME variable is set with its default value %s. The default can be replaced by using the command setenv(''NOMAD_HOME'',ARG1)! before runner the GERAD_NOMAD_build command.',nomad_home); +cd(cdir); +end +nomad_src=[nomad_home filesep 'src' filesep]; +nomad_lib=[nomad_home filesep 'lib' filesep]; +nomad_bin=[nomad_home filesep 'bin' filesep]; +nomad_sgtelib_src=[nomad_home filesep 'ext' filesep 'sgtelib' filesep 'src']; + +switch(computer) +case 'PCWIN' +%libdir = ' -Lwin32\'; +%nameLibNomad = 'nomad.dll'; +error('The installation script for Windows is not yet available.'); +case 'PCWIN64' +%libdir = ' -Lwin64\'; +%nameLibNomad = 'nomad.dll'; +error('The installation script for Windows is not yet available.'); +case 'GLNX86' +libdir = 'glnx86/'; +updateLDFLAGS = 'LDFLAGS=''$LDFLAGS -Wl,-rpath,''''$ORIGIN/../lib/'''' '' '; +case 'GLNXA64' +libdir = 'glnxa64/'; +updateLDFLAGS = 'LDFLAGS=''$LDFLAGS -Wl,-rpath,''''$ORIGIN/../lib/'''' '' '; +case 'MACI64' +libdir = 'maci64/'; +end + +%Get NOMAD Libraries +post = [' -I. -I' nomad_src ' -I' nomad_sgtelib_src ' -lm -lut -lnomad -L ' nomad_lib ' -output mergeM']; + +%Compile & Move +pre = ['mex -v -largeArrayDims ' updateLDFLAGS ' mergeM.cpp ' ]; + +try + eval([pre post]) + if ( strcmp(computer,'MACI64') ) + install_cmd = ['install_name_tool -change libnomad.so ' nomad_lib 'libnomad.so mergeM.mexmaci64' ]; + system(install_cmd); + end + clear nomad_home nomad_src nomad_sgtelib_src cdir post pre libdir; + fprintf('Done!\n'); +catch ME + clear nomad_home nomad_src nomad_sgtelib_src cdir post pre libdir; + error('opti:nomad','Error Compiling NOMAD!\n%s',ME.message); +end +fprintf('------------------------------------------------\n'); diff --git a/utils/MergeCacheFiles/cache1.bin b/utils/MergeCacheFiles/cache1_OSX.bin similarity index 100% rename from utils/MergeCacheFiles/cache1.bin rename to utils/MergeCacheFiles/cache1_OSX.bin diff --git a/utils/MergeCacheFiles/cache2.bin b/utils/MergeCacheFiles/cache2_OSX.bin similarity index 100% rename from utils/MergeCacheFiles/cache2.bin rename to utils/MergeCacheFiles/cache2_OSX.bin diff --git a/utils/MergeCacheFiles/cache3.bin b/utils/MergeCacheFiles/cache3_OSX.bin similarity index 100% rename from utils/MergeCacheFiles/cache3.bin rename to utils/MergeCacheFiles/cache3_OSX.bin diff --git a/utils/MergeCacheFiles/makefile b/utils/MergeCacheFiles/makefile index d86324c0c554d81a6b005bc16a6f6f37811cd31a..e3e2608dda3c8d5252db4de0fbd470c34c8ee763 100644 --- a/utils/MergeCacheFiles/makefile +++ b/utils/MergeCacheFiles/makefile @@ -16,7 +16,7 @@ endif LDLIBS = -lm -lnomad -INCLUDE = -I$(NOMAD_HOME)/src -I. +INCLUDE = -I$(NOMAD_HOME)/src -I$(NOMAD_HOME)/ext/sgtelib/src -I. COMPILE = $(COMPILATOR) $(COMPILATOR_OPTIONS) $(INCLUDE) -c OBJS = merge.o diff --git a/utils/Run_TestSuite/runNomadAll_parallel.pl b/utils/Run_TestSuite/runNomadAll_parallel.pl index dd90b38b949b46b47ba9e2cea8660392ade1e3b9..0a2ae41a3f1e81704dafbf1420359ccaf4647d51 100755 --- a/utils/Run_TestSuite/runNomadAll_parallel.pl +++ b/utils/Run_TestSuite/runNomadAll_parallel.pl @@ -34,7 +34,7 @@ if ( grep(/MINGW/,<aComRes>) ){ $MPIcommand="mpirun -n"; # version OSX and linux } -my $keySearch=" Erreur | Error | error | error: | Exception | NOMAD::Exception | Failed | Arrêt | Stop"; +my $keySearch=" Erreur | Error | error | error: | Erreur | erreur | Exception | NOMAD::Exception | Failed | Arrêt | Stop"; my $nombre_de_jobs_en_parallele:shared; if ( ! exists $ARGV[0]) { @@ -61,7 +61,8 @@ my @list = ( ["cd $ENV{NOMAD_HOME}/examples/basic/library/single_obj ; if [ -e basic_lib_MPI.exe ] ; then rm -f basic_lib_MPI.exe ; fi ; make clean 2>&1 ; make mpi 2>&1; $MPIcommand 3 ./basic_lib_MPI.exe 2>&1"], ["cd $ENV{NOMAD_HOME}/examples/basic/library/bi_obj ; if [ -e basic_lib_MPI.exe ] ; then rm -f basic_lib_MPI.exe ; fi ; make clean 2>&1 ; make mpi 2>&1; $MPIcommand 3 ./basic_lib_MPI.exe 2>&1"], ["cd $ENV{NOMAD_HOME}/examples/basic/library/single_obj_parallel ; if [ -e basic_lib.exe ] ; then rm -f basic_lib.exe ; fi ; make clean 2>&1 ; make 2>&1; ./basic_lib.exe 2>&1"], - ["cd $ENV{NOMAD_HOME}/examples/advanced/categorical/batch ; if [ ! -e bb.exe -o ! -e neighbors.exe ] ; then g++ -o bb.exe bb.cpp 2>&1 ; g++ -o neighbors.exe neighbors.cpp ; fi ; echo ; $ENV{NOMAD_HOME}/bin/$nomadEXE param.txt 2>&1"], + ["cd $ENV{NOMAD_HOME}/examples/advanced/categorical/batch ; if [ ! -e bb.exe -o ! -e neighbors.exe ] ; then g++ -o bb.exe bb.cpp 2>&1 ; g++ -o neighbors.exe neighbors.cpp ; fi ; echo ; $ENV{NOMAD_HOME}/bin/$nomadEXE param.txt 2>&1"], + ["cd $ENV{NOMAD_HOME}/tools/PSD-MADS ; if [ -e psdmads.exe ] ; then rm -f *.exe *.o ; fi ; make 2>&1 ; cd problems/G2_20 ; g++ -o bb.exe bb.cpp 2>&1; $MPIcommand 6 ../../psdmads.exe param.txt 50 5 2>&1"], ["cd $ENV{NOMAD_HOME}/examples/advanced/categorical/batch ; if [ ! -e bb.exe -o ! -e neighbors.exe ] ; then g++ -o bb.exe bb.cpp 2>&1 ; g++ -o neighbors.exe neighbors.cpp ; fi ; echo ; $MPIcommand 3 $ENV{NOMAD_HOME}/bin/$nomadMPI_EXE param.txt 2>&1"], ["cd $ENV{NOMAD_HOME}/examples/advanced/categorical/single_obj ; if [ -e categorical.exe ] ; then rm -f categorical.exe ; echo ; fi ; make clean 2>&1 ; make 2>&1; ./categorical.exe 2>&1 "], ["cd $ENV{NOMAD_HOME}/examples/advanced/categorical/single_obj ; if [ -e categorical_MPI.exe ] ; then rm -f categorical_MPI.exe ; echo ; fi ; make clean 2>&1 ; make mpi 2>&1; $MPIcommand 3 ./categorical_MPI.exe 2>&1 "], @@ -86,8 +87,9 @@ my @list = ( ); my @NOMADcompilations = ( - ["cd $ENV{NOMAD_HOME}/src ; make clean ; make all -j $nombre_de_jobs_en_parallele 2>&1"], - ["cd $ENV{NOMAD_HOME}/src ; make clean ; make mpi -j $nombre_de_jobs_en_parallele 2>&1"] + ["cd $ENV{NOMAD_HOME}/src ; make del "], + ["cd $ENV{NOMAD_HOME}/src ; make all -j $nombre_de_jobs_en_parallele 2>&1"], + ["cd $ENV{NOMAD_HOME}/src ; make mpi -j $nombre_de_jobs_en_parallele 2>&1"] ); @@ -169,10 +171,10 @@ sub RunProblem($$$$$){ ############################# # Sub pour les compilations ############################# -sub CompileNOMAD($$$){ +sub CompileNOMAD($$){ my $aRef = shift; my $index = shift; - my $failed = shift; + my $failed = 0; open(WRITE_LOG,"> logNOMADCompile$index.txt"); for my $command (@{$aRef}){ @@ -182,16 +184,17 @@ sub CompileNOMAD($$$){ print WRITE_LOG "Path: $Path[1] \n Command: $Problem[1] ; Managed as process $index \n"; open(LOG,"$command |") or die "Can't run program: $!\n"; + my $errSearch="Erreur|Error|error|erreur|commande introuvable|compilation failed"; if ($? != 0) { print "Failed compilation of NOMAD: command $! process $index \n"; - $$failed=0; + $failed=1; } else { while (<LOG>){ - if (my @foo = grep(/error/, $_) ) { + if (my @foo = grep(/$errSearch/, $_) ) { print "??????? Problem encountered when compiling NOMAD in process $index:\n -----> @foo\n"; print WRITE_LOG " -----> @foo \n "; - $$failed=0; + $failed=1; last; } if (my @foo = grep(/warning/, $_) ) { @@ -199,52 +202,60 @@ sub CompileNOMAD($$$){ } } } - if ($$failed==1){ + if ($failed==0){ print WRITE_LOG "++++++++++ OK! \n"; } close (LOG); } close (WRITE_LOG); - return; + return $failed; } ##################################### ##### Debut du programme principal ##################################### + # nettoie les fichiers de log print "########################################################\n"; print "Cleaning old log files\n"; system ("rm -f log*.txt"); +print "########################################################\n"; +# Fait clean +print "NOMAD clean started"; +my $thrCleanNOMAD = threads->create("CompileNOMAD",($NOMADcompilations[0],1)); +$failedCleanNOMAD = $thrCleanNOMAD->join(); -# démarre la compilation de nomad -my $failedCompileNOMAD=1; -my $thrNOMAD = threads->create("CompileNOMAD",($NOMADcompilations[0],1,\$failedCompileNOMAD)); ### Version parallele +if ($failedCleanNOMAD!=0){ + print "\n NOMAD clean failed. Stopping here! \n"; + exit 0; +} +print " ---> success. \n"; print "########################################################\n"; -print "NOMAD compilation (not mpi) started \n"; -# démarre la compilation de nomad_mpi -my $failedCompileNOMAD_MPI=1; -my $thrNOMAD_MPI = threads->create("CompileNOMAD",($NOMADcompilations[1],2,\$failedCompileNOMAD_MPI)); ### Version parallele -print "NOMAD compilation (mpi) started\n"; +# démarre la compilation de nomad +print "NOMAD compilation (not mpi) started"; +my $thrNOMAD = threads->create("CompileNOMAD",($NOMADcompilations[1],2)); +my $failedCompileNOMAD = $thrNOMAD->join(); -$thrNOMAD->join(); -$thrNOMAD_MPI->join(); - -if ($failedCompileNOMAD==0){ - print "NOMAD compilation (not mpi) failed. Stopping here! \n"; +if ($failedCompileNOMAD!=0){ + print "\n NOMAD compilation (not mpi) failed. Stopping here! \n"; + exit 0; } +print " ---> success. \n"; +print "########################################################\n"; -if ($failedCompileNOMAD_MPI==0){ - print "NOMAD compilation (mpi) failed. Stoppinf here! \n"; -} +# démarre la compilation de nomad_mpi +print "NOMAD compilation (mpi) started"; +my $thrNOMAD_MPI = threads->create("CompileNOMAD",($NOMADcompilations[2],3)); +my $failedCompileNOMAD_MPI = $thrNOMAD_MPI->join(); -if ($failedCompileNOMAD==0 or $failedCompileNOMAD_MPI==0){ - exit 0; +if ($failedCompileNOMAD_MPI!=0){ + print "\n NOMAD compilation (mpi) failed. Stopping here! \n"; + exit 0; } - -print "NOMAD compilation(s) success\n"; +print " ---> success. \n"; print "########################################################\n\n"; print "########################################################\n";