geatpy-dev / geatpy

Evolutionary algorithm toolbox and framework with high performance for Python
http://www.geatpy.com
GNU Lesser General Public License v3.0
2.02k stars 726 forks source link

混合(离散和连续)决策变量类型设置以及更新 #170

Closed fengqzHD closed 3 years ago

fengqzHD commented 3 years ago

如果有四个决策变量(x1,x2,x3,x4),且其中x1, x2为离散变量,x3,x4为连续变量 例如 x1,x2∈{1.1, 1, 0, 3, 5.5, 7.2, 9} 1<x3<10 2<x4<10 此时可以设置varTypes = [1,1,0,0],并结合https://github.com/geatpydev/geatpy/blob/master/geatpy/demo/soea_demo/soea_demo11/MyProblem.py 来写init 此时aimFunc应怎样处理?

fengqzHD commented 3 years ago

尝试了一下,在soea_demo11上,修改aminfunc如下 Vars = pop.Phen x1 = self.var_set[Vars[:, [0]].astype(np.int32)] x2 = self.var_set[Vars[:, [1]].astype(np.int32)] x3 = Vars[:, [2]] 此时,x1,x2为离散,x3为连续