DEAP / deap

Distributed Evolutionary Algorithms in Python
http://deap.readthedocs.org/
GNU Lesser General Public License v3.0
5.82k stars 1.13k forks source link

Optimization with multiple variables #304

Closed seyedzadeh closed 5 years ago

seyedzadeh commented 6 years ago

I am trying to optimize two outputs of simulation software (I used random forest to train a model for fast prediction of outputs). There are seven input variables three are continuous, and the rest are discrete. I have used DEAP package for multi-objective optimization but only one variable or a set of related variables (something like knapsack). The mentioned seven variables are:

    n_rate = [0.1:0.5]
    estim = [1000, 1500, 2000]
    max_d = [1:20]
    ft = [None, "rel"]
    min_s = [2:1000]
    min_m = [1:1000]
    lim = [0:1]

Except ft, for all continues variables, it is possible to define several discrete numbers.

My question is how I can create different individuals for these inputs to define the population?

mdalvi commented 5 years ago

My intuition says what you can do is create a population of individuals of length 7 (since you have 7 parameters to optimize) where each gene in the individual can take values from 0 to 1; basically np.random.random((1, 7)).

Then you can inverse transform using the min-max normalization formula like here to convert each gene to the desired parameter range at that position.

For discrete values, you can inverse transform for the index.