Giter Club home page Giter Club logo

mg-gpo's Introduction

Multi-Generation Gaussian Process Optimizer

This is the Matlab version of the MG-GPO algorithm. Currently MG-GPO has only been implemented in Matlab.

If you'd like to use it in your research or project, please cite the following paper:

Prerequisites

The following setup is not necessary but highly recommended if you want to archive a similar performance as shown in the MG-GPO paper.

Download and install the GPML Matlab code

To download and install the GPML Matlab code, please follow the official instructions here.

You can change the mean function, covariance function and Gaussian likelihood in the GPML/GPML_predict.m script as you need. More options can be found in the manual of GPML Matlab code.

Usage

Test run

  1. Execute the run.m script within Matlab

The test run will optimize the 30D ZDT2 problem with MG-GPO + local GP. The test run should be done in 1 min.

Optimize your own objective function

To optimize your own objective function, you'll have to implement the function in Matlab as a .m script, and put it into the evaluators folder.

The signature of the function should be like:

function obj = YOUR_BADASS_PROBLEM(x)

Please refer to the demo objective functions Rosenbrock (single objective) and ZDT2 (multi-objective) that located in the evaluators folder to get more details.

After completing your objective function setup, tune the MG-GPO settings to your needs. The settings of MG-GPO are located at the Configs section of the run.m script. They are:

problem = @ZDT2; % the objective funtion to be minimized
Nobj = 2;        % the number of the objectives
Nvar = 30;       % the number of the input variables
Npop = 10;       % the population size of each generation in MG-GPO
Ngen = 10;       % the total number of generations to evolve in MG-GPO
useGPML = 0;     % if use the GPML package
                 % set to 0 to use the local GP module with a cost of
                 % decreased performance
                 % set to 1 to use the GPML package with a better performance
                 % You should addpath for GPML package or run the startup.m
                 % script in the GPML package

Set problem to the name of your problem, and change Nobj and Nvar accordingly. The settings for Npop and Ngen depend on the problem to be optimized, but Npop = 80 and Ngen = 100 are usually a good starting point. Set useGPML = 1 to get the better performance of MG-GPO.

Access and visualize the history runs data

The data (all the varaible values at every generation) of each run will be saved as generation_*.mat file and put into the data/yyyymmdd_HHMMSS folder in the root directory, where the datetime string shows the starting time of the run. To visualize the evolution of the optmization process, in Matlab command line, run:

pl_solution 'data/yyyymmdd_HHMMSS' [[start] end]

This command will show the Pareto fronts from the start generation to the end generation for the run started at yyyymmdd_HHMMSS.

If start is not specified, the start generation is 1; If both the start and end are not specified, it will only show the Pareto front of the first generation in the run.

Here are some examples:

pl_solution 'data/20200610_004036' % visualize generation 1
pl_solution 'data/20200610_004036' 10 % visualize generation 1 to 10
pl_solution 'data/20200610_004036' 5 10 % visualize generation 5 to 10

For developers

WIP

mg-gpo's People

Contributors

catohxb avatar zhe-slac avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

lnadolski

mg-gpo's Issues

starting from a previouly calculated generation

Hi there,

I have started using MG-GPO to optimize the dynamical aperture and beam lifetime. First of all, thanks for sharing this type of content, it is very nice, I really apreciate it.

I was trying to start from a previously calculated generation 2 of a diferent run. I did:

load('generation_2.mat');
gbest = MGGPO(evaluate,predict,Npop,Ngen,Nobj,Nvar,da);

It produced ar error because f0 iwas not defined I did the following modification in MGGPO (line 43):

elseif nargin > 6
    %{
    da = varargin{1}; 
    %     da.Xmat=[da.Xmat xt];
    %     da.fa = [da.fa; ynew];
    %     da.nf = nf;
    %     da.invKmat = inv(Kmat+sigy^2*eye(nf))
    gbest = da.gbest;
    v0 = da.v0;
    %}
    % zeus modification:
    vrange1 = ones(Nvar,1)*[0,1,1e-6]*1;
    l_limit = vrange1(:,1);
    u_limit = vrange1(:,2);
    gen = varargin{1};
    da=gen.da;
    gbest = da.gbest;
    v0 = da.v0;
    f0=gen.f0;
end

Then I run:

gen=importdata('generation_2.mat');
gbest = MGGPO(evaluate,predict,Npop,Ngen,Nobj,Nvar,gen);

This time the code calculated the evaluate function (it takes a long time to evaluate the dynamical aperture and lifetime) but it produced an error because pbest was not defined... Maybe there are more things missing. Could you take a look at it?

Also I know I'm not understanding what the field da contains, could you
briefly describe it?

Thanks a lot

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.