Coder Social home page Coder Social logo

bbopt / nomad Goto Github PK

View Code? Open in Web Editor NEW
110.0 7.0 24.0 300.46 MB

NOMAD - A blackbox optimization software

Home Page: https://nomad-4-user-guide.readthedocs.io/

License: GNU Lesser General Public License v3.0

Python 0.14% C++ 98.15% MATLAB 0.24% CMake 0.75% C 0.06% Cython 0.31% Java 0.11% SWIG 0.23% M 0.01%
blackbox-optimization optimization-algorithms solver derivative-free-optimization simulation-based-optimization mathematical-algorithms surrogate-based-optimization blackbox-optimizer

nomad's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

nomad's Issues

Parallel Latin hypercube search

Hi, i have a nomad file that goes roughly like

DIMENSION 17
NB_THREADS_OPENMP 18
BB_EXE "$./a.out"
BB_OUTPUT_TYPE OBJ
BB_INPUT_TYPE * R
LH_SEARCH 16 10
LOWER_BOUND * -10
UPPER_BOUND *  10

The first iteration of the LH loop (in this case 16 evals) doesn't seem to be parallelized. am i doing something wrong or is this working as as intended?

restart multi obj

I tried to make a bi-obj optimization start from the previous state when the process was interrupted instead of starting from the beginning. Following the tutorial, I added the following to the parameter input file:

CACHE_FILE cache.txt
HOT_RESTART_ON_USER_INTERRUPT true
HOT_RESTART_READ_FILES true
HOT_RESTART_WRITE_FILES true
HOT_RESTART_FILE hotrestart.txt

But DMULTIMADS couldn't restart from the previous iteration when I killed the optimization. Similarly, when I ran bi-obj again without changing my param.txt, it made another MAX_BB_EVAL black box runs instead of being stopped at the beginning due to reaching max bb runs. For a single obj, the parameters above can make NOMAD read the hot restart file first. The example problems I tested were taken from nomad/examples/basic/batch/multi_obj/param.txt and /basic/batch/examples1/param.txt.

Thank you for your help!

Add support for SOLUTION_FILE.

This parameter is shown in user guide ver3.9. However in latest version, it's an unrecognized parameter. Writing the final solution to a file for post processing is very common.

Strange behaviour using PyNOMAD

Hi everyone,
I'm writing an application for which NOMAD is used as MIP solver. Calling PyNOMAD (v4.3.1) recurrently, a failure happens:

result = PyNomad.optimize(objective, x0, lb, ub, params)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
>   ???
E   AttributeError: 'bytes' object has no attribute 'encode'. Did you mean: 'decode'?
PyNomad.pyx:192: AttributeError

A similar problem was already mentioned and solved in #53, but, in the new version, the problem seems to be there again.

(As suggested in #53, a simple workaround, that works for me, is to create a copy of the parameter list)

Best regards,
Alessio

NOMAD does not provide blocks of points to eval for parallel processing

Despite setting BB_MAX_BLOCK_SIZE to a number greater than 1, I cannot get NOMAD to provide more than 1 point for evaluation at a time. I am using the MATLAB interface for NOMAD. Please advise on what other parameters I need to set in order to use block sizes greater than 1. Thank you!

EDIT: I should add that my options structure looks like the following:

K>> o

o =

struct with fields:

      direction_type: 'ortho n+1 quad'
    stop_if_feasible: '0'
           nm_search: '0'
      display_degree: '2'
    display_all_eval: '1'
   bb_max_block_size: '100000000000'
       DISPLAY_STATS: 'BBE TIME OBJ CONS_H H_MAX'
SGTELIB_MODEL_SEARCH: 'false'
      bb_output_type: 'OBJ PB PB PB PB PB PB PB PB PB PB PB PB PB PB PB PB PB PB PB PB PB PB PB PB PB PB PB PB PB PB PB PB PB PB'

I am calling NOMAD through the typical MATLAB interface:

[x,fval,exitflag,iter,nfval] = nomadOpt(problem.objective, problem.x0, problem.lb, problem.ub, o, iterFun);

Java wrapper compilation error

OS: Debian "bullseye"
Nomad version: 4.2

When building the Java wrapper, following the instructions in interfaces/jNomad/Readme, I get the following error:

[ 93%] Built target jNomad
[ 93%] Linking CXX executable NMOpt.exe
Scanning dependencies of target jNomad_jar
gmake[2]: *** No rule to make target 'interfaces/jNomad/SWIGTYPE_p_NOMAD_4_1__EvalParameters.java', needed by 'interfaces/jNomad/CMakeFiles/jNomad_jar.dir/java_compiled_jNomad_jar'.  Stop.
gmake[1]: *** [CMakeFiles/Makefile2:1366: interfaces/jNomad/CMakeFiles/jNomad_jar.dir/all] Error 2
gmake[1]: *** Waiting for unfinished jobs....

and cmake exits with error code 2.

Here is the complete Dockerfile I'm using:


ENV DEBIAN_FRONTEND=noninteractive

# Install dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
	build-essential	\
	m4 \
    cmake \
    nano \
    curl

WORKDIR /

# First install SWIG
# Install dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
	git \
	autotools-dev \
	automake \
	byacc \
	libpcre2-dev

RUN git clone https://github.com/swig/swig.git

WORKDIR swig
RUN ./autogen.sh
RUN ./configure --prefix=/swig
RUN make
RUN make install

RUN ln -s /swig/bin/swig /usr/local/bin/swig

# Compile and install NOMAD
WORKDIR /

RUN curl https://codeload.github.com/bbopt/nomad/tar.gz/refs/tags/v.4.2.0 --output NOMAD42.tar.gz
RUN tar -xf NOMAD42.tar.gz && mv nomad-v.4.2.0 NOMAD42 && rm -r NOMAD42.tar.gz

ENV NOMAD_HOME="/NOMAD42"
WORKDIR /NOMAD42

RUN cmake -DTEST_OPENMP=OFF -DBUILD_INTERFACE_C=ON -DBUILD_INTERFACE_JAVA=ON  -S . -B build/release && \
    cmake --build build/release --parallel 16 && \
    cmake --install build/release

ENV LD_LIBRARY_PATH="/NOMAD42/build/release/lib"

WORKDIR /
CMD /bin/bash

I was able to build the C and Python interfaces without a problem.

Any help would be greatly appreciated!

Installation error in Windows

The command cmake --install build/release in Windows powershell

Returns

CMake Error at build/release/ext/sgtelib/cmake_install.cmake:39 (file):
  file INSTALL cannot find
  "C:/......../nomad-v.4.2.0/build/release/ext/sgtelib/Release/sgtelib_main.exe":

A temporary fix consists of replacing the file CMakeLists.txt in C:/..../nomad-v.4.2.0/ext/sgtelib by the one in attachment.
I just commented "sgtelib_main.exe" which is not necessary for Nomad optimization.
CMakeLists.txt

Just some helpful guidelines on building nomad's MATLAB interface

As per Christophe's request that I share my approach/instructions on how to build nomad's MATLAB interface, I believe that the following details would be super-useful for anyone struggling to realize this.

Using the NOMAD Optimizer which requires building Nomad with MinGW compiler using CMake

  • Update MATLAB’s MinGW using this link: (https://www.mathworks.com/support/requirements/supported-compilers.html)
    Follow on-screen instructions (for example, dragging and dropping in MATLAB’s command window)
    NB: Updates will be displayed in MATLAB’s Command window while installation is in progress

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

image

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

  • Download CMake using the link (https://cmake.org/download/). I recommend using the Windows x64 Installer option to enable you make your own installation settings. Make sure it is available for all users of the PC. Confirm that cmake is on the PC by typing “cmake” on command prompt

  • Finally, ensure that Microsoft Visual Studio is installed on the machine. Please note that Microsoft Visual Studio is different from Microsoft Visual Studio Code. Again, compatibility should be confirmed in the users’ guide manual provided by NOMAD developers

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

image

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

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

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

  • The above might take some minutes. Following the completion, use the command below:

cmake --build build/release --config Release

to proceed with configuration

  • Then, finally, use the command
    cmake --install build/release
    which must be run before using the Matlab nomadOpt function. You can expect to see the following during the build process:

image
image
image

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

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

image

nomad should unregsiter the signal handlers

In an attempt to fix NOMAD.jl (the threading issue), i realized that nomad never releases the signal handlers. Mark Kittisopikul and i think that might be the issue. Would it be possible to restore the original signal handlers? or even better have an option to not catch them at all in the library mode? specifically the sigev signal handler breaks julia as julia also catches the sigev signal.

ref bbopt/NOMAD.jl#39

Pynomad with LH_SEARCH

Hi,
I want to use LH_SEARCH with pynomad but it asks me x0. According to documentation, I dont need x0 when I use LH.
I didnot find any example or help about this in the doc.
Here is my code:
lb = [ 0 , .0001 , 1, 2 , .1 , 0.1, 0, 5 , 10, 5]
ub = [20, 1, 100, 10, 1, 1, 50, 40, 400, 400]
LH_SEARCH = [5 , 15]
params = ["BB_OUTPUT_TYPE OBJ EB EB EB EB", "DISPLAY_DEGREE 10","MAX_BB_EVAL 10", "DISPLAY_STATS BBE OBJ"]

result = PyNomad.optimize(bb, LH_SEARCH, lb, ub, params)
I got the following error: NOMAD Parameter Error:
The lower bound size is inconsistent with X0 size
NOMAD exception (report to developper):
NOMAD::Exception thrown (C:\projets\Depots\bbot\nomad\src\Param../Param/Parameters.hpp, 426) Parameter to be checked. In getAttributeValue the attribute BB_MAX_BLOCK_SIZE has not been checked

I have 10 parameters, please help me.
Thanks in advance

CMake error during install step

The command cmake --install build/release in Windows returns an error

CMake Error at build/release/ext/sgtelib/cmake_install.cmake:39 (file):
  file INSTALL cannot find
  "C:/......../nomad-v.4.2.0/build/release/ext/sgtelib/Release/.....exe":

This happens when the Release config option is missing in the build step. For windows, the build step is not for the Release config by default but it is for the install step!
Hence, for the Release config in Windows:

STEP 2:
cmake --build build\release --config Release

STEP 3:
cmake --install build\release

Python importError when building PyNomad interface for Apple M1 chip (apple ARM64 or intel X86_64)

When using Clang compiler with OSX on Apple M1 chip, after building PyNomad successfully, when importing PyNomad in Python

import PyNomad
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: dlopen(/Users/christophe/.local/lib/python3.9/site-packages/PyNomad.cpython-39-darwin.so, 0x0002): symbol not found in flat namespace '__ZN9NOMAD_4_210Parameters17_typeOfAttributesE'

or

ImportError: dlopen(xxxx/PyNomad.cpython-39-darwin.so, 0x0002) .... 
(mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64'))

This issue can be resolved by forcing the architecture to X86_64 when configuring the cmake build with a flag like -DCMAKE_OSX_ARCHITECTURES=x86_64. This is required when Python binaries for the API are x86_64. This can be tested with the command file. For example,

>> file /opt/homebrew/anaconda3/bin/python
/opt/homebrew/anaconda3/bin/python: Mach-O 64-bit executable x86_64

In this case, the nomad binaries must all be x86_64, which is not the default when building with Clang.

It is important, to remove the build directory and the PyNomad.cpython-39-darwin.so in
$NOMAD_HOME/interfaces/PyNomad to make sure all PyNomad binaries are deleted before building again.

cmake error during Configuration step

I am on windows server 2019.
The command cmake -S . -B build/release returns an error.

CMake Error at CMakeLists.txt:9 (project):
  Running
    'nmake' '-?'
  failed with:
     The system cannot find the file specified

CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
See also "C:/Nomad/nomad-4.1.0/build/release/CMakeFiles/CmakeOutput.log".

Any ideas?

GRANULARITY parameter causes errors for specific X0 values

Hello,

First of all I would like to thank you for developping NOMAD, it is very useful and easy to use. I'm currently trying to use NOMAD 3.9.1 (Windows 10 64-bit, 19041.450) to optimize a problem of mine, but I'm having a little bit of trouble with the GRANULARITY parameter. Here is the sample parameters file I'm using:

DIMENSION		1
BB_EXE			bb.exe
BB_OUTPUT_TYPE		OBJ
X0			( #### )
GRANULARITY		0.1

After some testing, I found out that values of #### between 1024 and 2047 with a decimal place (e.g. 1024.1) and between 2458 and 4095 with a decimal place (e.g. 4095.1) (and probably other ranges of values for ####) cause the following error:

ERROR: Invalid Parameter (..\src\Parameters.cpp, 5951):  invalid granularity of variable 0: 0.1 vs initial value: 4095.1

For values in those ranges, I have to set the GRANULARITY parameter to at least 0.000001 to not have that error. However, a value of 1024.2 doens't give that error. If I understood the GRANULARITY parameter correctly, this doesn't seem like an expected behavior.

Any help is appreciated!

MATLAB interface documentation inconsistency

The documentation for the MATLAB interface diverges from the actual implementation.

  1. According to the documentation, nomadOpt returns [ x, fval, exitflag, iter, nfval ], however, the actual implementation returns [ x, fval, hinf, exitflag, nfval ]. The example reflects the actual implementation.
  2. Values of the exitflag do not follow the documented scheme. Instead of the declared spectrum of return values, only two values are returned and their meaning differs from the documentation. The value 0 represents generic success, whereas -1 indicates no feasible result was found.

I believe it may be possible to modify nomadmex.cpp to approach the documented behavior. The following pseudo-code might do that.

bool hasConverged = (nbBestFeas > 0);
bool hasInfeasible = (nbBestInf > 0);

bool exitInitializationError = AllStopReasons::testIf(INITIALIZATION_FAILED);
bool exitUser = (
  AllStopReasons::testIf(BaseStopType::CTRL_C) ||
  AllStopReasons::testIf(BaseStopType::USER_STOPPED));
bool exitNomadError = (
  AllStopReasons::testIf(BaseStopType::ERROR) ||
  AllStopReasons::testIf(BaseStopType::UNKNOWN_STOP_REASON));
bool exitExceededEvaluations =  (
  AllStopReasons::testIf(EvalGlobalStopType::MAX_EVAL_REACHED) ||
  AllStopReasons::testIf(EvalGlobalStopType::MAX_BB_EVAL_REACHED) ||
  AllStopReasons::testIf(EvalGlobalStopType::MAX_BLOCK_EVAL_REACHED) ||
  AllStopReasons::testIf(EvalGlobalStopType::MAX_SURROGATE_EVAL_OPTIMIZATION_REACHED));

if (exitUser) {
  * exitflag = -5;
}
else if (exitNomadError) {
  * exitflag = -3;
}
else if (exitInitializationError) {
  * exitflag = -2;
}
else if (hasConverged) {
  * exitflag = 1;
}
else if (exitExceededEvaluations) {
  * exitflag = 0;
}
else if (hasInfeasible) {
  * exitflag = -1;
}
else {
  // Something else must have happened.
  // There are neither feasible nor infeasible points and there is no clear reason for termination. 
  // Let's chalk that up as 'nomad error'.
  * exitflag = -3;
}

REMARKS

  • I see a potential issue regarding the definition of converged / target reached within the above code: should we consider the search successful if at least one feasible point was found even though the optimizer eventually ran out of evaluations?
  • I currently do not have access to MATLAB-compatible version of GCC. Once I do, and if desired, I can eventually turn this into a pull request.
  • Essentially identical code could be used to resolve #104.

nomad .input file serial number

Can we add serial number to .input file which is input for bbe. Is there any way to configure serial number to input file please let us know. your help very much appreciated

we are using bbe for python script

Some examples run unsucessfully in NOMAD4, but successuly in NOMAD3.9.1

Hi, I am new using the NOMAD to do a evaluation of a problem. When I download the NOMAD 4 and modify the single_obj file to a simple objective function like y=sin(x) * x *x, every parameter seems set good. NOMAD4 will run into a dead loop while NOMAD3.9.1 will run with best feasible solution immediately. They are the same project in different libraries.
3
4
I am not sure this is normal for using NOMAD. Thank you

Passing in initial points with evaluation?

How can I pass a set of initial points with their evaluation into NOMAD? I'm using python and the PyNomad interface.

I have a set of initial points and their evaluations stored in two numpy arrays. The only way I found in the user guide is through 'X0' parameter but that still doesn't include the evaluations.

Add pip installation

I found an unofficial pip installation path to an older and possibly modified version of NOMAD. Would be convenient to have an official pip installation path to the latest version.

Can't Build MATLAB Interface (Can't find MATLAB)

I receive the following error when I attempt to build the software on Linux (Linux Mint). For what it's worth, I've also tried this on CentOS and got the same error, and on Windows I got the same error until I specified the target platform with "-A x64".

I could use some help figuring out how to handle this. My version of CMake is up to date (3.16). I'm on MATLAB R2021a and I've already added the appropriate entry for this MATLAB version to the FindMATLAB cmake file.

adam@adam-VirtualBox:~/Desktop/nomad-v.4.2.0$ cmake -DTEST_OPENMP=OFF -DBUILD_INTERFACE_MATLAB=ON -S . -B build/release
-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CHECK_START Configuring custom options
-- Installation prefix set to /home/adam/Desktop/nomad-v.4.2.0/build/release
CHECK_START Configuring for use of Sgtelib library
CHECK_PASS Sgtelib found. done
-- Compiling Nomad without OpenMP
CHECK_START Configuring build for library and batch mode examples
-- Add example library #1
-- Add example library #2
-- Add example library #3
-- Add example library single_obj_parallel
-- Add example library tests using Suggest And Observe
-- Add example batch #1
-- Add example batch #2
-- Add example batch single_obj
-- Add example batch surrogate sort
-- Add example batch single_obj_MPIparallel (MPI found).
CHECK_PASS done
-- C interface to Nomad NOT built
-- Python interface to Nomad NOT built
CHECK_START Configuring build for Matlab interface
CMake Error at /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message):
Could NOT find Matlab (missing: Matlab_INCLUDE_DIRS Matlab_MEX_LIBRARY
Matlab_MEX_EXTENSION Matlab_ROOT_DIR Matlab_MX_LIBRARY MEX_COMPILER) (found
version "NOTFOUND")
Call Stack (most recent call first):
/usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:393 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake-3.16/Modules/FindMatlab.cmake:1803 (find_package_handle_standard_args)
CMakeLists.txt:170 (find_package)

-- Configuring incomplete, errors occurred!

I've attached my CMakeOutput.log file, hopefully that will provide some insight.
CMakeOutput.log

Any help you can provide would be appreciated!

Make Nomad 4 installer for end users

Hello Nomad team,

for Nomad 3.9.1, there is an installer for end user so the user can install with a simple click of the installer file.

Could we also have an installer for Nomad 4 for end user? Typically I am asking for Windows OS.

Thank you,
Jenny

LH_SEARCH: Unrecongized Parameter

When trying to use the LH_SEARCH parameter in the MATLAB interface, I receive the following error:

NOMAD Parameter Error:
NOMAD::Exception thrown (/home/aharden/Documents/nomad-v4.3.1/src/Param/RunParameters.cpp, 152) Unrecognized parameters in file Standard Input:
line 0: Unrecognized parameter: LH_SEARCH

My options structure looks like this:

             direction_type: 'ortho 2n'
           stop_if_feasible: 0
    VNS_MADS_SEARCH_TRIGGER: 0.75
            VNS_MADS_SEARCH: 1
                  nm_search: 0
             display_degree: 2
           display_all_eval: 1
          BB_MAX_BLOCK_SIZE: 100
              DISPLAY_STATS: 'BBE TIME OBJ CONS_H H_MAX'
       SGTELIB_MODEL_SEARCH: 0
                  LH_SEARCH: [10000 100]

Any ideas? Is this just not implemented yet?

MATLAB building fails on macOS

My problem

I am building nomad on macOS for MATLAB. I hence ran

cmake -DBUILD_INTERFACE_MATLAB=ON -DMatlab_ROOT_DIR=/Applications/MATLAB_R2022b.app -S . -B build/release

This completed successfully. However, when building the library with

cmake --build build/release

I get the following error.

[ 99%] Linking CXX shared library nomadOpt.mexmaci64
Undefined symbols for architecture x86_64:
  "_utIsInterruptPending", referenced from:
      matlabEval::eval_x(NOMAD_4_2::EvalPoint&, NOMAD_4_2::Double const&, bool&) const in nomadmex.cpp.o
  "_utSetInterruptPending", referenced from:
      matlabEval::eval_x(NOMAD_4_2::EvalPoint&, NOMAD_4_2::Double const&, bool&) const in nomadmex.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [interfaces/Matlab_MEX/nomadOpt.mexmaci64] Error 1
make[1]: *** [interfaces/Matlab_MEX/CMakeFiles/nomadOpt.dir/all] Error 2
make: *** [all] Error 2

I set up mex to run with clang.

My architecture

  • macOS: version 12.6 (Monterey, x86_64)
  • clang: version 14.0.0 (clang-1400.0.29.102)
  • MATLAB: version 9.13.0.2049777 (R2022b)
  • CMake: version 3.24.1

Do you have any idea how I can fix my problem? Thank you very much for your help 😁

Failure in solving recurrent problems using PyNOMAD

Hi,
I'm devising an application for which I'm using Nomad in python as an MIP solver. I want to use PyNomad recurrently to solve several subproblems but I get the following message from the second execution of Nomad (it works well in the first one) :
image

How can I avoid such problem?

Best regards,
Juan José

Java interface error for INCLUDE PATH when configuring

When enabling Java interface building with Swig (for example with command cmake -DBUILD_INTERFACE_JAVA=ON -S . -B build/release), the following type of error is obtained:

CMake Error at /opt/homebrew/Cellar/cmake/3.22.1/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find JNI (missing: JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH)

To fix this, uncomment the lines and make sure that the path to JNI include directories are correct.

   #set(JAVA_INCLUDE_PATH "$ENV{JAVA_HOME}/Contents/Home/include")
   #set(JAVA_INCLUDE_PATH2 "$ENV{JAVA_HOME}/Contents/Home/include")
   #set(JAVA_AWT_INCLUDE_PATH "$ENV{JAVA_HOME}/Contents/Home/include")

in root CMakeLists.txt. The environment variable $JAVA_HOME must also be properly set.

Problem with building the python interface

Hi,
when following the directions from https://nomad-4-user-guide.readthedocs.io/en/latest/LibraryMode.html#pynomad-interface, in combination with the info in the readme of the python interface (there's a bit of a difference between these two, fyi, in the online version, the quite necessary --config Release option, without which the build fails when linking), a .pyd file is generated and an .egg is put into the site-packages, everything seemingly working fine.

However, importing with pynomad does not work: ImportError: DLL load failed while importing PyNomad: The specified module could not be found.

Given the instructions mentioned above are working with the "old" msvc versions, it may be relevant that I tried it using -G"Visual Studio 17 2022" which does not support an [Arch] option because w32 is deprecated (I think).

Any hints?

Is there a way to terminate the costly blackbox evaluation in advance?

Hi, I am using the NOMAD3.9.1 to evaluate a blackbox task. It will drop to obvious local optimum somethings. I notice that the outputs are nearly same or even get very small differences at the end of the evaluation. In some conditions, it will last for hundres of iterations. More compuating resources and time have been put into the final result, but the result has satisfied the requirements. So, my question is how can I alter some arguments or is there a mechanism to terminate the evaluaion in NOMAD to solve this problem? I know user can use CTRL-C to terminate the algorithm mamually. Thank you very much.

Interrupt and resume

Is there a way to resume the optimization after if is interrupted. Resume means that past trial histories will be considered by the optimizer.

I also thought about saving the parameters and its objective values tried in a file and then load it when resuming the optimization. But does it support pre-loading of parameters and objectives values?

Matlab and python interface exit status

Both python and matlab interfaces should provide complete exit status range:
% 1 - converged / target reached
% 0 - maximum iterations / function evaluations exceeded
% -1 - infeasible / mesh limit reached
% -2 - initialization error
% -3 - nomad error
% -5 - user exit

This issue has been updated using issue #124.
Maybe we need more exit statuses (and clarify the meaning):

  • (feasible+max eval/iter reached) from (infeasible+max eval/iter reached).
  • (feasible+mesh limit reached-> equivalent to 1-converged) from (infeasible+mesh limit reached).

cmake 3.14 is not enough

Hello,

My laptop is running under Unbuntu 18.04. I tried first to build the software using first the stable system version of cmake (3.10) but I got an error managed on your own telling me that I must use cmake > 3.14. I updated cmake to 3.14.7 and tried again but stopped at the end of the process with an error related to the POP_BACK command, which may be available only in later versions of cmake (at least I see it available in 3.22, then I will try again with a more recent cmake version, but this should be documented and corrected anyway).

EDIT: I can confirm everything is fine with cmake 3.22.0

I give you the full output:

(sci386) user@paulduf:~/workspace/nomad (master)$ cmake -DBUILD_INTERFACES=ON -S . -B build/release
-- The C compiler identification is GNU 8.4.0
-- The CXX compiler identification is GNU 8.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CHECK_START Configuring custom options
--   Installation prefix set to /home/pauldufosse/workspace/nomad/build/release
CHECK_START  Configuring for use of Sgtelib library
CHECK_PASS   Sgtelib found. done
--   Test OpenMP for parallel functionalities  -- found 
CHECK_START  Configuring build for library and batch mode examples
--     Add example library test 1
--     Add example library test 2
--     Add example library test 3
--     Add example library test single_obj_parallel
--     Add example library tests using Suggest And Observe
--     Add example batch test 1
--     Add example batch test 2
--     Add example batch test single_obj
--     Add example batch test surrogate sort
--     Add example batch test single_obj_parallel
CHECK_PASS done
CHECK_START  Configuring build for interfaces
CHECK_PASS done
CMake Error at CMakeLists.txt:145 (list):
  list does not recognize sub-command POP_BACK


CHECK_PASS done
-- Configuring incomplete, errors occurred!

Transient failure in ExampleAdvancedPSDMads test

After adding set -o pipefail after the hash-bang line in the runExampleTest.sh script (in order to detect failing library tests — see https://github.com/bbopt/nomad4dev/issues/707), the ExampleAdvancedPSDMads test fails, but seemingly only sometimes. Here is the relevant section of the log of my latest (failed) build (through Guix) of NOMAD:

starting phase `check'
Running tests...
/gnu/store/zga679c4nldah9l8dhd5a4hdy820hcyf-cmake-minimal-3.21.4/bin/ctest --force-new-ctest-process 
Test project /tmp/guix-build-nomad-optimizer-4.2.0.drv-0/build
      Start  1: Example1BasicLib
 1/21 Test  #1: Example1BasicLib ........................   Passed   23.50 sec
      Start  2: Example2BasicLib
 2/21 Test  #2: Example2BasicLib ........................   Passed    5.67 sec
      Start  3: Example3BasicLib
 3/21 Test  #3: Example3BasicLib ........................   Passed    1.77 sec
      Start  4: SingleObjParallelBasicLib
 4/21 Test  #4: SingleObjParallelBasicLib ...............   Passed    0.66 sec
      Start  5: ExampleAdvancedFixedVariables
 5/21 Test  #5: ExampleAdvancedFixedVariables ...........   Passed   50.30 sec
      Start  6: ExampleAdvancedNMOnly
 6/21 Test  #6: ExampleAdvancedNMOnly ...................   Passed    0.68 sec
      Start  7: ExampleAdvancedRestart
 7/21 Test  #7: ExampleAdvancedRestart ..................   Passed    6.48 sec
      Start  8: ExampleAdvancedSuggestAndObserve
 8/21 Test  #8: ExampleAdvancedSuggestAndObserve ........   Passed    0.09 sec
      Start  9: ExampleAdvancedLoopSuggestAndObserve
 9/21 Test  #9: ExampleAdvancedLoopSuggestAndObserve ....   Passed    0.45 sec
      Start 10: ExampleAdvancedPSDMads
10/21 Test #10: ExampleAdvancedPSDMads ..................***Failed    0.22 sec
Running Example test /tmp/guix-build-nomad-optimizer-4.2.0.drv-0/build/examples/advanced/library/PSDMads/rosenbrock.exe
Warning: Dimension 50 is greater than (or equal to) 50. Models are disabled.
BBE OBJ
1 162.5     
48 156.29    
60 153.49    
64 150.2     
67 151.48    
79 149.85    
87 137.4     
terminate called after throwing an instance of 'NOMAD_4_2::Exception'
  what():  NOMAD::Exception thrown (/tmp/guix-build-nomad-optimizer-4.2.0.drv-0/source/src/Eval/Barrier.cpp, 144) Barrier has points of size 2 and of size 50
/tmp/guix-build-nomad-optimizer-4.2.0.drv-0/build/examples/runExampleTest.sh: line 11:  1989 Aborted                 $executable $param_file
      1990 Done                    | tee runTestLog.txt

      Start 11: ExampleAdvancedC-API1
11/21 Test #11: ExampleAdvancedC-API1 ...................   Passed   34.83 sec
      Start 12: ExampleAdvancedC-API2
12/21 Test #12: ExampleAdvancedC-API2 ...................   Passed  229.05 sec
      Start 13: Example1BasicBatch
13/21 Test #13: Example1BasicBatch ......................   Passed    6.88 sec
      Start 14: Example2BasicBatch
14/21 Test #14: Example2BasicBatch ......................   Passed    9.38 sec
      Start 15: Example3BasicBatch
15/21 Test #15: Example3BasicBatch ......................   Passed    0.26 sec
      Start 16: ExampleSingleObjBasicBatch
16/21 Test #16: ExampleSingleObjBasicBatch ..............   Passed    6.53 sec
      Start 17: ExampleSurrogateSortBasicBatch
17/21 Test #17: ExampleSurrogateSortBasicBatch ..........   Passed    0.94 sec
      Start 18: ExampleBasicBatchSingleObjParallel
18/21 Test #18: ExampleBasicBatchSingleObjParallel ......   Passed    0.01 sec
      Start 19: ExampleAdvancedBatchLHOnly
19/21 Test #19: ExampleAdvancedBatchLHOnly ..............   Passed    0.12 sec
      Start 20: ExampleAdvancedBatchFixedVariables
20/21 Test #20: ExampleAdvancedBatchFixedVariables ......   Passed   60.65 sec
      Start 21: ExampleAdvancedBatchSuggestAndObserve
21/21 Test #21: ExampleAdvancedBatchSuggestAndObserve ...   Passed    0.03 sec

95% tests passed, 1 tests failed out of 21

Total Test time (real) = 438.50 sec

The following tests FAILED:
	 10 - ExampleAdvancedPSDMads (Failed)
Errors while running CTest
make: *** [Makefile:139: test] Error 8

Test suite failed, dumping logs.
error: in phase 'check': uncaught exception:
%exception #<&invoke-error program: "make" arguments: ("test" "-j" "4") exit-status: 2 term-signal: #f stop-signal: #f> 
phase `check' failed after 438.6 seconds
command "make" "test" "-j" "4" failed with status 2

This issue is a duplicate of https://github.com/bbopt/nomad4dev/issues/711. I've created it in order to have a public issue to reference in the comments of the Guix package for NOMAD (which disables this particular test). See https://issues.guix.gnu.org/55067.

Repository size

The size of this repository is over 300 Mb, mostly because of the compiled docs. I'm wondering if you could shrink it, by making the compiled docs available by other means. This might benefit users with poor connection, by reducing network traffic and storage.

Thanks for making this great tool available here!

.gitignore should include .vs

The latest release v4.1.0 supports Windows build - that is great, and thank you

I think the following line should be included in .gitignore file:

.vs

MATLAB Interface: Specifying "String"-Only Params With Iteration Function

In NOMAD 3.9.x, it was possible to specify an "iteration function" that was called each iteration. In this version, the iteration function was a function handle that was called in a particular war. However, when running NOMAD 4.2 using the MATLAB interface, I get the following error when specifying a param structure with a function handle:

Error using nomadOpt

 NOMAD Parameter Error:
Params should be provided as Matlab structure with string value: struct('KEY1','VAL1','KEY2','VAL2')

My params structure has the following relevant entry:

iterfun: @(iter,fval,x)nomadOutput1(iter,fval,x,'iter')

This worked in the previous 3.9.x release of NOMAD but no longer works here. Please advise on how iteration functions should be specified in NOMAD 4.2+ using the MATLAB interface. Thank you!

documention for python interface

Is there any python interface for nomad. If yes can you please provide documentation. It would be great help for us. You help is very much appreciated.

Temporary directory can be erased while running

The default directory to write the input files and run the blackbox in batch mode is /tmp. This directory can be erased automatically. This leads to message like

problem with input file /tmp/nomadtmp.18096.0 Warning: Evaluation error with point #640 ( 220 20 0 100 ) Evaluation error : output is empty

The default temporary directory will be "./" in the next release.
To force this behaviour with the version 4.2.0, set TMP_DIR ./

Install PyNomad in virtual environment

The current installation instructions make very hard to install PyNomad in virtual enviroment, in fact the --user option in the line
COMMAND python setup_PyNomad.py ${CMAKE_BINARY_DIR} ${NOMAD_VERSION} install inside interfaces/PyNomad/CMakeLists.txt overwrite the default setting of a virtual environment.

A separate parameter PYTHON_DIR defined in CMake could allow the user to specify the correct Python location, otherwise the --user flag could be removed to let the system the best location by itself.

Is there a way to install PyNomad in a virtual environment with the current code?

Eval OK but output not matching (Matlab 2022a/Windows 10 x64)

I am playing with the example provided in Matlab:

fun = @(x)   [-x(1) - x(2) - x(3);
             (x(2) - 1./2.)*(x(2) - 1./2.) + (sin(x(3)) - 1./2.)*(x(3) - 1./2.) - 1/4 - fcn(x); %%%%Changed here
             x(1) - x(2);
             x(1) + x(3) + sin(x(4)^3) - 2];          %%%Changed here
ub = [1;10;10;5];
lb = [0;0;0;0];
x0 = [0;0;1;0]; %%%Changed here

params = struct('display_degree','2', 'bb_output_type','OBJ PB PB PB','max_bb_eval','100', 'eval_queue_sort','dir_last_success'); %%%%Changed here

[x,fval,hinf,exit_status,nfeval] = nomadOpt(fun,x0,lb,ub,params);


function res = fcn(x)
    res = x(3).^5;
end

When I run the code, I get:
image

I don't understand where the warnings are coming from if evaluating the function fun separately works:
image
It seems that the problem is related to the fourth constraint, and in particular to sin(x(4)^3) because if I change it to sin(x(4)) I do not get the warning.

Any help would be appreciated!

Default example that I started with (runs w/o warnings):


% 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];
 
 params = struct('display_degree','2', 'bb_output_type','OBJ PB PB PB','bb_input_type','(B R R I)', 'max_bb_eval','50', 'eval_queue_sort','dir_last_success');
 
 [x,fval,hinf,exit_status,nfeval] = nomadOpt(fun,x0,lb,ub,params);

PSD-MADS - Cannot open include file: 'mpi.h': No such file or directory

trying to run parallel proceesing with PSD-MADS. I am trying to build the psdmas.sln file getting below error.

Cannot open include file: 'mpi.h': No such file or directory

We have installed MSMPI also, still we are getting this error

OS: Windows
visual studio - 2017

1- Open the psdmads Microsoft VisualStudio solution located in %NOMAD_EXAMPLES%\VisualStudio
2- Build the solution
3- Open a VisualStudio command shell
4- Change the directory to one of the problem directories in %NOMAD_EXAMPLES%\tools\PSD-MADS\problems
5- Build the blackbox executable with the command: cl bb.cpp
6- Start the optimization: mpirun -np p ../../psdmads.exe param.txt bbe ns
p: Number of processors to use
bbe: Maximal number of evaluations performed by each slave
ns: Number of variables considered by the slaves.
Ex: mpiexec -n 4 ....\psdmads.exe param.txt 20 3

Java wrapper build error

OS: Debian "bullseye"
Nomad version: 4.2

When building the Java wrapper, following the instructions in interfaces/jNomad/Readme, I get the following error:

[ 93%] Built target jNomad
[ 93%] Linking CXX executable NMOpt.exe
Scanning dependencies of target jNomad_jar
gmake[2]: *** No rule to make target 'interfaces/jNomad/SWIGTYPE_p_NOMAD_4_1__EvalParameters.java', needed by 'interfaces/jNomad/CMakeFiles/jNomad_jar.dir/java_compiled_jNomad_jar'.  Stop.
gmake[1]: *** [CMakeFiles/Makefile2:1366: interfaces/jNomad/CMakeFiles/jNomad_jar.dir/all] Error 2
gmake[1]: *** Waiting for unfinished jobs....

and cmake exits with error code 2.

Here is the complete Dockerfile I'm using:

FROM openjdk:8u332-bullseye

ENV DEBIAN_FRONTEND=noninteractive

# Install dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
	build-essential	\
	m4 \
    cmake \
    nano \
    curl

WORKDIR /

# First install SWIG
# Install dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
	git \
	autotools-dev \
	automake \
	byacc \
	libpcre2-dev

RUN git clone https://github.com/swig/swig.git

WORKDIR swig
RUN ./autogen.sh
RUN ./configure --prefix=/swig
RUN make
RUN make install

RUN ln -s /swig/bin/swig /usr/local/bin/swig

# Compile and install NOMAD
WORKDIR /

RUN curl https://codeload.github.com/bbopt/nomad/tar.gz/refs/tags/v.4.2.0 --output NOMAD42.tar.gz
RUN tar -xf NOMAD42.tar.gz && mv nomad-v.4.2.0 NOMAD42 && rm -r NOMAD42.tar.gz

ENV NOMAD_HOME="/NOMAD42"
WORKDIR /NOMAD42

RUN cmake -DTEST_OPENMP=OFF -DBUILD_INTERFACE_C=ON -DBUILD_INTERFACE_JAVA=ON  -S . -B build/release && \
    cmake --build build/release --parallel 16 && \
    cmake --install build/release

ENV LD_LIBRARY_PATH="/NOMAD42/build/release/lib"

WORKDIR /
CMD /bin/bash

I was able to build the C and Python interfaces without a problem.

Any help would be greatly appreciated!

Investigate PyNomad with OpenMP enabled

In version 4.2 and above, PyNomad building requested to disable OpenMP. Weird crashes was observed. Maybe related to Gil releasing.
Look into Pyx code. Test again on all platforms with version > 4.3.1.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.