This code is developed to experiments with the models presented in the paper Generative Neural Models for Global Optimization With Gradients.
The code is organized as follows:
- main.py: proceeds with the optimization procedure.
- objective.py: defines in Tensorflow various differentiable objective functions.
- generator.py: constructs the generative neural network used to model the search distribution.
- utils.py: plotting utilities.
In the 2D case, plots of the objective function and the search distribution can be created, and stored in a img/ folder.
The code was run using Python 3.6.4 and Tensorflow 1.5.0. You will need the matplotlib and numpy package as well.
You can follow the TensorFlow installation guide to set up a virtualenv in which you can run the code. You will need pip>=8.1. On a MacOS, running the following commands inside the GENNES directory should get you a working environment:
virtualenv -p python3 myvirtualenv
source myvirtualenv/bin/activate
pip3 install --upgrade tensorflow
pip3 install matplotlib
With this environment set-up, you can make sure the code works by running the command
python main.py
If everything is working correctly, you should see an output ressembling:
End at iteration 100 / 100
Minimum value found is 3.237146392786256e-05 at iteration 82
You will also notice that an img/ folder has been created.
The last command ran GENNES with default hyper-parameters on the Rastrigin function (default). Running the command
python main.py --help
displays all the arguments you might want to change in your experiments:
Deep Black-Box Optimization Parameters
optional arguments:
-h, --help show this help message and exit
--bbdim BBDIM Dimension of the black-box optimization problem (default: 2)
--ndim NDIM Dimension of the input noise for the generator (default: 2)
--fevals FEVALS Function evaluations budget (default: 1000.0)
--glr GLR Generative network learning rate (default: 0.0001)
--popsize POPSIZE Population size generated by the generative network (default: 20)
--nmag NMAG Magnitude (support) of the generators input noise (default: 2)
--nannealing NANNEALING Annealing factor for the input noise (default: 0.99)
--objective OBJECTIVE Objective function to minimize (default: Rastrigin)
--seed SEED Random seed for reproducibiltiy (default: 1)
--stopcriter STOPCRITER Stop criterion for the search (default: 1e-08)
Copyright CRITEO
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.