forked from coin-or/rbfopt
-
Notifications
You must be signed in to change notification settings - Fork 0
RBFOpt library for black-box optimization
License
sartorg/rbfopt
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
# File: README # Author(s): Giacomo Nannicini # Singapore University of Technology and Design # International Business Machines Corporation # [email protected], [email protected] # Last edit: 03/16/16 # # (C) Copyright Singapore University of Technology and Design 2015. # (C) Copyright International Business Machines Corporation 2016. # You should have received a copy of the license with this code. # Research partially supported by SUTD-MIT International Design Center. This software is released under the Revised BSD License. By using this software, you are implicitly accepting the terms of the license. Contents of this directory: LICENSE: Licensing information. VERSION: Version of the library. AUTHORS: Authors of the library. README: This file. requirements.txt: List of dependencies for this project. Contents of the src/ directory: rbfopt_black_box.py: Description of an abstract black-box function. rbfopt_black_box_example.py: Example of an implementation of a simple black-box function. rbfopt_algorithm.py: Main optimization algorithm, both serial and parallel. rbfopt_aux_problems.py: Interface for the auxiliary problems solved during the optimization process. rbfopt_cl_interface.py: Driver for the command-line interface, to run the library on a user-defined black-box function. rbfopt_config.py: (Static) configuration file for the machine. rbfopt_degreeX_models.py: PyOmo models for the auxiliary problems necessary for RBF functions with minimum required polynomial degree X. rbfopt_model_selection.py: Routines for automatic model selection. rbfopt_settings.py: Global and algorithmic settings. rbfopt_utils.py: Utility routines. Contents of the tests/ directory: rbfopt_test_interface.py: Executable file to test the library on a standard global optimization test set. test_functions.py: Global optimization test functions. test_rbfopt_algorithm.py: Testing module for rbfopt_algorithm.py. test_rbfopt_aux_problems.py: Testing module for rbfopt_aux_problems.py. test_rbfopt_degreeX_models.py: Testing module for rbfopt_degreeX_models.py. test_rbfopt_env.py: Environment variables for testing environment. test_rbfopt_settings.py: Testing module for rbfopt_settings.py. test_rbfopt_utils.py Testing module for rbfopt_utils.pu. Contents of the doc/ directory: conf.py: Configuration file for Sphinx. Makefile: Makefile (for Linux/Mac) to build the documentation. make.bat: Batch file (for Windows) to build the documentation. *.rst: ReStructured Text files for the documentation. #-------------------------------------------------------------------------- # Installation requirements #-------------------------------------------------------------------------- This package requires the following software: Python 2.7.* (latest 2.7.* release recommended) NumPy version >= 1.8.1 SciPy version >= 0.13.3 Pyomo version 4.3.11388 The software has been tested with the versions indicated above. It may work with earlier version and should work with subsequent version, if they are backward compatible. Note that Python 3.* is not compatible with Python 2.7. While our library is Python 3 compliant and consistently uses "from __future__ import [...]", the code has not been tested on Python 3 yet. We recommend using Python 2.7. If for some reason you require Python 3, it should be very easy to port the code. The easiest way to install all the dependencies is via the Python module manager pip, using the command: pip install -r requirements.txt The file requirements.txt contains the list of required modules and their latest version that has been tried and found to work correctly. If your want to install them one at a time, you can try: pip install numpy pip install scipy pip install pyomo To build the documentation, you also need numpydoc: pip install numpydoc On Windows systems, we recommend WinPython, available at http://winpython.sourceforge.net/ , which comes with NumPy, SciPy and pip already installed. After installing WinPython, it is typically necessary to update the PATH environment variable. The above command using pip to install missing libraries has been successfully tested on a fresh WinPython installation. RBFOpt requires the solution of convex and nonconvex nonlinear programs (NLPs), as well as nonconvex mixed-integer nonlinear programs (MINLPs) if some of the decision variables (design parameters) are constrained to be integer. Solution of these subproblems is performed through Pyomo, which supports any solver with an AMPL interface (.nl file format). In our tests we employed BonMin and Ipopt, that are open-source and available through the COIN-OR repository. The end-user is responsible for checking that they have the right to use whatever solver they employs. To obtain pre-compiled binaries for BonMin and Ipopt for several platforms, we suggest having a look at: http://ampl.com/products/solvers/open-source/ and http://ampl.com/dl/open/ (for static binaries). In case any of the packages indicated above is missing, some features may be disabled, not function properly, or the software may not run at all. This package can take advantage of supported linear programming solvers to increase the speed of the automatic model selection procedure. Supported solvers: IBM-ILOG Cplex via its Python API COIN-OR Clp via CyLP (see https://github.com/coin-or/CyLP). The two packages above are optional. #-------------------------------------------------------------------------- # Installation instructions and getting started #-------------------------------------------------------------------------- 1) Install the required packages NumPy, SciPy, Pyomo, as indicated above. If you use pip, you can verify that they are present with the commands: pip show numpy pip show scipy pip show pyomo 2) Edit rbfopt_config.py to point to the correct location for the NLP and MINLP solvers, using the MINLP_SOLVER_PATH and NLP_SOLVER PATH variables. 3) Enjoy! 4) You can test the installation by running: python2.7 tests/rbfopt_test_interface.py branin See: python2.7 tests/rbfopt_test_interface.py --help for more details on command-line options for the testing utility. Many more test functions, with different characteristics, are implemented in the file test_functions.py. They can all be used for testing. 5) Unit tests for the library can be executed by running: python2.7 -m unittest discover -s tests/ from the current (main) directory. This may take some time. If some of the tests fail, the library may or may not work correctly. Some of the test failures are relatively harmless. You are advised to contact the mailing list (see below) if you are unsure about some test failure. 6) To run the library on a user-defined black-box function, have a look at the example in src/rbfopt_black_box_example.py. You can implement a similar class (derived from rbfopt_black_box.BlackBox), say in a file called my_black_box.py, and the alorithm can be executed on it by running: python2.7 src/rbfopt_cl_interface.py -m my_black_box.py See: python2.7 src/rbfopt_cl_interface.py --help for more details on command-line options. (If no module is specified with the -m option, the algorithm will be applied to rbfopt_black_box_example.py.) 7) To take advantage of faster model selection procedures, you must have either IBM-ILOG Cplex or COIN-OR Clp available on your machine. By default, the model selection procedure uses Numpy and it can be slow on large problems. Using Cplex (via its Python library) or Clp (via CyLP) can increase its speed dramatically. If one of these packages is installed and available via the corresponding "import" Python command (i.e. "import cplex" and "import cylp.cy"), you can select the corresponding value for the option model_selection_solver. #-------------------------------------------------------------------------- # Parallel optimization #-------------------------------------------------------------------------- RBFOpt supports asynchronous parallel optimization using Python's multiprocessing library. This mode is enabled whenever the parameter num_cpus is set to a value greater than 1. Black-box function evaluations as well as some of the heaviest computatations carried out by the algorithm will then be executed in parallel. Since the parallel computations are asynchronous, determinism cannot be guaranteed: in other words, if you execute the parallel optimizer twice in a row, you may (and often will) get different results, even if you provide the same random seed. This is because the order in which the computations will be completed may change, and this may impact the course of the algorithm. The default parameters of the algorithm are optimized for the serial optimization mode. Recommended parameters for the parallel optimization will be detailed in the future. For now, feel free to ask on the mailing list. #-------------------------------------------------------------------------- # Documentation #-------------------------------------------------------------------------- The documentation for the code can be built using Sphinx with the numpydoc extension. numpydoc can be installed with pip (if you followed our instructions above, it should already be installed): pip install numpydoc After that, the directory doc/ contains a Makefile (on Windows, use make.bat) and the Sphinx configuration file conf.py. You can build the HTML documentation (recommended) with: make html The output will be located in _build/html/ and the index can be found in _build/html/index.html . A PDF version of the documentation (much less readable than the HTML version) can be built using the command: make latexpdf An online version of the documentation for the latest master branch of the code, and for the latest stable release, are available on ReadTheDocs at the following URLs: http://rbfopt.readthedocs.org/en/latest/ http://rbfopt.readthedocs.org/en/stable/ #-------------------------------------------------------------------------- # Support #-------------------------------------------------------------------------- The best place to ask question is the mailing list: [email protected] You can subscribe at: http://list.coin-or.org/mailman/listinfo/rbfopt
About
RBFOpt library for black-box optimization
Resources
License
Stars
Watchers
Forks
Packages 0
No packages published
Languages
- Python 100.0%