Git Product home page Git Product logo

geatpy's Introduction

Geatpy2

The Genetic and Evolutionary Algorithm Toolbox for Python with high performance.

GitHub Workflow Status Package Status Python Pypi Download License Gitter

Introduction

The features of Geatpy:

  • Capability of solving single-objective, multi-objectives, many-objectives and combinatorial optimization problems fast.

  • A huge number of operators with high performance of evolutionary algorithms (selection, recombination, mutation, migration...).

  • Support numerous encodings for the chromosome of the population.

  • Many evolutionary algorithm templates, including GA, DE, ES for single/multi-objective(s) evolution.

  • Multiple population evolution.

  • Support polysomy evolution.

  • Parallelization and distribution of evaluations.

  • Testbeds containing most common benchmarks functions.

  • Support tracking analysis of the evolution iteration.

  • Many evaluation metrics of algorithms.

Improvement of Geatpy 2.7.0

  • Add a new way to define the aim function of the problem.

  • Support calculating objectives and constraints for the variables of only one individual.

  • Add a optimize function to do the optimization more convenient.

  • Add new open-source plotting functions.

  • Remove the dependency on scipy.

  • A new and faster core.

Installation

1.Installing online:

pip install geatpy

2.From source:

python setup.py install

or

pip install <filename>.whl

Attention: Geatpy requires numpy>=1.17.0 and matplotlib>=3.0.0, the installation program won't help you install them so that you have to install both of them by yourselves.

Versions

Geatpy must run under Python3.5, 3.6, 3.7, 3.8, 3.9, or 3.10 in Windows x32/x64, Linux x64 or MacOS x64.

There are different versions for Windows, Linux and Mac, you can download them from http://geatpy.com/

The version of Geatpy on github is the latest version suitable for Python >= 3.5

You can also update Geatpy by executing the command:

pip install --upgrade geatpy

If something wrong happened, such as decoding error about 'utf8' of pip, run this command instead or execute it as an administrator:

pip install --upgrade --user geatpy

Quick start

Here is the UML figure of Geatpy2.

image

For solving a multi-objective optimization problem, you can use Geatpy mainly in two steps:

1.Write down the aim function and some relevant settings in a derivative class named MyProblem, which is inherited from Problem class:

"""MyProblem.py"""
import numpy as np
import geatpy as ea
class MyProblem(ea.Problem): # Inherited from Problem class.
    def __init__(self, M): # M is the number of objects.
        name = 'DTLZ1' # Problem's name.
        maxormins = [1] * M # All objects are need to be minimized.
        Dim = M + 4 # Set the dimension of decision variables.
        varTypes = [0] * Dim # Set the types of decision variables. 0 means continuous while 1 means discrete.
        lb = [0] * Dim # The lower bound of each decision variable.
        ub = [1] * Dim # The upper bound of each decision variable.
        lbin = [1] * Dim # Whether the lower boundary is included.
        ubin = [1] * Dim # Whether the upper boundary is included.
        # Call the superclass's constructor to complete the instantiation
        ea.Problem.__init__(self, name, M, maxormins, Dim, varTypes, lb, ub, lbin, ubin)
    def aimFunc(self, pop): # Write the aim function here, pop is an object of Population class.
        Vars = pop.Phen # Get the decision variables
        XM = Vars[:,(self.M-1):]
        g = np.array([100 * (self.Dim - self.M + 1 + np.sum(((XM - 0.5)**2 - np.cos(20 * np.pi * (XM - 0.5))), 1))]).T
        ones_metrix = np.ones((Vars.shape[0], 1))
        pop.ObjV = 0.5 * np.fliplr(np.cumprod(np.hstack([ones_metrix, Vars[:,:self.M-1]]), 1)) * np.hstack([ones_metrix, 1 - Vars[:, range(self.M - 2, -1, -1)]]) * np.tile(1 + g, (1, self.M))
    def calReferObjV(self): # Calculate the theoretic global optimal solution here.
        uniformPoint, ans = ea.crtup(self.M, 10000) # create 10000 uniform points.
        realBestObjV = uniformPoint / 2
        return realBestObjV

2.Instantiate MyProblem class and a derivative class inherited from Algorithm class in a Python script file "main.py" then execute it. For example, trying to find the pareto front of DTLZ1, do as the following:

"""main.py"""
import geatpy as ea # Import geatpy
from MyProblem import MyProblem # Import MyProblem class
if __name__ == '__main__':
    M = 3                      # Set the number of objects.
    problem = MyProblem(M)     # Instantiate MyProblem class
    # Instantiate a algorithm class.
    algorithm = ea.moea_NSGA3_templet(problem,
                                      ea.Population(Encoding='RI', NIND=100),  # Set 100 individuals.
                                      MAXGEN=500,  # Set the max iteration number.
                                      logTras=1)  # Set the frequency of logging. If it is zero, it would not log.
    # Do the optimization
    res = ea.optimize(algorithm, verbose=False, drawing=1, outputMsg=True, drawLog=True, saveFlag=True)

Run the "main.py" and the part of the result is:

image

Execution time: 0.3650233745574951 s

Evaluation number: 45500

The number of non-dominated solutions is: 91

gd: 0.00033

igd: 0.02084

hv: 0.84061

spacing: 0.00158

For solving another problem: Ackley-30D, which has only one object and 30 decision variables, what you need to do is almost the same as above.

1.Write the aim function in "MyProblem.py".

import numpy as np
import geatpy as ea
class Ackley(ea.Problem): # Inherited from Problem class.
    def __init__(self, D = 30):
        name = 'Ackley' # Problem's name.
        M = 1 # Set the number of objects.
        maxormins = [1] * M # All objects are need to be minimized.
        Dim = D # Set the dimension of decision variables.
        varTypes = [0] * Dim # Set the types of decision variables. 0 means continuous while 1 means discrete.
        lb = [-32.768] * Dim # The lower bound of each decision variable.
        ub = [32.768] * Dim # The upper bound of each decision variable.
        lbin = [1] * Dim # Whether the lower boundary is included.
        ubin = [1] * Dim # Whether the upper boundary is included.
        # Call the superclass's constructor to complete the instantiation
        ea.Problem.__init__(self, name, M, maxormins, Dim, varTypes, lb, ub, lbin, ubin)
    def aimFunc(self, pop): # Write the aim function here, pop is an object of Population class.
        x = pop.Phen # Get the decision variables
        n = self.Dim
        f = np.array([-20 * np.exp(-0.2*np.sqrt(1/n*np.sum(x**2, 1))) - np.exp(1/n * np.sum(np.cos(2 * np.pi * x), 1)) + np.e + 20]).T
        return f, CV
    def calReferObjV(self): # Calculate the global optimal solution here.
        realBestObjV = np.array([[0]])
        return realBestObjV

2.Write "main.py" to execute the algorithm templet to solve the problem.

import geatpy as ea # import geatpy
import numpy as np
from MyProblem import Ackley
if __name__ == '__main__':
    # Instantiate MyProblem class.
    problem = Ackley(30)
    # Instantiate a algorithm class.
    algorithm = ea.soea_DE_rand_1_bin_templet(problem,
                                              ea.Population(Encoding='RI', NIND=20),
                                              MAXGEN=1000,  # Set the max times of iteration.
                                              logTras=1)  # Set the frequency of logging. If it is zero, it would not log.
    algorithm.mutOper.F = 0.5  # Set the F of DE
    algorithm.recOper.XOVR = 0.2  # Set the Cr of DE (Here it is marked as XOVR)
    # Do the optimization
    res = ea.optimize(algorithm, verbose=False, drawing=1, outputMsg=True, drawLog=True, saveFlag=True, dirName='result')

Part of the result is:

image

Execution time: 0.256328821182251 s

Evaluation number: 20000

The best objective value is: 3.209895993450118e-08

To get more tutorials, please link to http://www.geatpy.com.

geatpy's People

Contributors

1061655504 avatar authenticz avatar geatpy-dev avatar hktkzyx avatar jsbyysheng avatar strongwinder avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

geatpy's Issues

How to add random seed into the algorithm?

Hi, I'm trying to explore the pattern of the objective value by doing multiple runs of the main file, fixing NIND = 10 and gradually increasing MAXGEN.
However, since there's random factor in the algorithm, I'm thinking about adding a random seed, but don't know how. How can I add a random seed? Thanks!

RuntimeError:error in moeaplot: The number of ObjVs columns must not be 1. (使用frontplot绘图函数时,ObjV的列数不能为1。)

I was trying to solve a small optimization problem using NSGA2.
In MyProblem.py, I defined the aimFuc function as the following:
My input format is:
x1 = Vars[:,[0]]
x2 = Vars[:,[1]]
My output is of the format:
obj =np.array( [[a],[b],[c]] ) #where a,b,c are integers and the len(obj) = len(Vars).
When I was running my main file, I ran across the following error saying my obj shape is wrong:
RuntimeError: error in moeaplot: The number of ObjVs columns must not be 1. (使用frontplot绘图函数时,ObjV的列数不能为1。)
Can anyone help me with this one? Thanks : )

How to interpret the pareto front image with many objective functions?

I was running an optimization problem with 7 objective functions without any constraints using NSGA2. After running the model, I get the image of pareto front, but find it hard to interpret.

x-axis = Dimension of Number (# of objective functions in my point of view)
y_axis = Function Value
There are 7 lines in the image, the lines are close to each other but they don't coincide.

Can anyone help me interpreting the pareto front image? Or is it possible for the crew in geatpy to add a demo of multiple objective function with more than 3 dimension? Thanks!


关于一些小细节

在使用的过程中发现一个疑问,望指教。

NIND = 100                 # Set the number of individuals.

设置种群数量为100个,但是在测试问题中的aimFuc(self, Vars, CV)函数中ObjV维度是<class 'tuple'>: (91, 3),不应该是(100, 3)吗?

MAC OS装不了2.1.0

执行的pip install geatpy自动安装了2.0.0,按照官网简介,应该是有2.1.0.
还没办法更新到2.1.0。

2.0.0有如下报错!
from awGA import awGA
ImportError: cannot import name 'awGA' from 'awGA' (unknown location)

奇怪的问题

我运行如下代码:
...
[pop_trace, var_trace, times] = ga.sga_real_templet(AIM_M, 'aimfuc',
None, None, FieldDR, problem = 'I', maxormin =1, MAXGEN = 64,
NIND = 32, SUBPOP = 1, GGAP = 0.85, selectStyle = 'sus',
recombinStyle = 'xovdp', recopt = 0.85, pm = 0.2, distribute =
True, drawing = 1)
print('目标函数最大值:',np.max(pop_trace[:, 1])) # 输出目标函数最大值
print("10 win:", heapq.nsmallest(10,pop_trace[:, 1]))
a=np.reshape(pop_trace[:,1], (-1,1))
b=pd.DataFrame(np.hstack((var_trace,a)))
b.to_csv('output/ipga_result.csv')
print(Top_10_lst)
np.save("top10_result.npy",Top_10_lst)
Top_10=pd.DataFrame(Top_10_lst)
Top_10.to_csv('output/top10_result.csv')
print("end!")

  1. 如果在debug状态下跟踪运行, 结果是正常的. 但在正常运行时, 这个学习过程运行了两遍, 并且后面的结果可能全是0, 把第一次的内容冲掉了.
  2. 这个pop_trace[:,0]好像是均值, 和quickstart里面的介绍刚好反了.
  3. 这只是个建议, 未必和你们初衷. 多代训练后, var_trace里只是记录了每代中的最优, 最后信息重复了. 但其实有时希望能够记录整体训练过程中的, 比如top10, 最优.
    我是在aimfuc中加了一点
    def aimfuc(Phen, LegV):
    global Top_10_lst
    ...
    fit_element=...
    not_good=np.max(Top_10_lst[:,41])
    not_good_row=np.argmax(Top_10_lst[:,41])
    if fit_element<not_good:
    Top_10_lst[not_good_row, 0:40]=Phen[i,0:40]
    Top_10_lst[not_good_row, 41]=fit_element

How to use 'maxormin'

I know about 'maxormin' in geatpy, but how to use it correctly?
When I learn to use awGA-function, should I multiply ‘ObjV' by this 'maxormin' before?
It's quite hard for me to learn your Chinese tutorials, please explain detaily.

关于多种群求解VRP 问题编码

我现在需要求解VRPTW问题,自己用python编写的多种群编码方式如下,k一般为2或3
x

经群里咨询geatpy开发的博士,对每辆车的路径编写一个染色体来处理,但是参照多种群模板
y

我并不知道每辆车具体分哪些任务,所以这个field2(及field3)并不知道从第几个任务开始设置新的染色体,如果随机切割的话,在交叉变异时该车辆的任务没有变化,只是顺序变了而已?望解答?

pop.CV计算不正确

你好,我在使用soea_DE_rand_1_L_templet运行一个单目标多限制条件的最优化问题。
我的变量一共有14位

    Vars = pop.Phen #决策变量矩阵
    m1 = Vars[:,[0]]
    m2 = Vars[:,[1]]
    delta_d = {'AR1_1':Vars[:,[2]],
               'AR1_2':Vars[:,[3]],
               'AR2_1':Vars[:,[4]],
               'AR2_2':Vars[:,[5]],
               'AR3_1':Vars[:,[6]],
               'AR3_2':Vars[:,[7]],
               'AP1_1':Vars[:,[8]],
               'AP1_2':Vars[:,[9]],
               'AP2_1':Vars[:,[10]],
               'AP2_2':Vars[:,[11]],
               'AP3_1':Vars[:,[12]],
               'AP3_2':Vars[:,[13]]}

模型给出的结果为 [5,10,-1,0,2,0,-4,0,-1,-3,0,-2,0,-2]。
我的限制条件共有36项,为

   sum_adj = abs(delta_d['AR1_1'])+abs(delta_d['AR1_2'])+abs(delta_d['AR2_1'])+abs(delta_d['AR2_2'])+abs(delta_d['AR3_1'])+ abs(delta_d['AR3_2'])+ abs(delta_d['AP1_1'])+ abs(delta_d['AP1_2'])+abs(delta_d['AP2_1'])+ abs(delta_d['AP2_2'])+ abs(delta_d['AP3_1'])+ abs(delta_d['AP3_2'])
   qualification_list = [
                    sum_adj - int(self.params['ADJUST_TOTAL'][0]),
                    m1+1-m2,
                    1-self.redmpt['AR1'] - delta_d['AR1_1'],
                    1-self.redmpt['AR1']-delta_d['AR1_1']-delta_d['AR1_2'],
                    1-self.redmpt['AR2'] - delta_d['AR2_1'],
                    1-self.redmpt['AR2']-delta_d['AR2_1']-delta_d['AR2_2'],
                    1-self.redmpt['AR3'] - delta_d['AR3_1'],
                    1-self.redmpt['AR3']-delta_d['AR3_1']-delta_d['AR3_2'],
                    1-self.redmpt['AP1'] - delta_d['AP1_1'],
                    1-self.redmpt['AP1']-delta_d['AP1_1']-delta_d['AP1_2'],   
                    1-self.redmpt['AP2'] - delta_d['AP2_1'],
                    1-self.redmpt['AP2']-delta_d['AP2_1']-delta_d['AP2_2'],
                    1-self.redmpt['AP3'] - delta_d['AP3_1'],
                    1-self.redmpt['AP3']-delta_d['AP3_1']-delta_d['AP3_2'],    
                    -delta_d['AR1_1']*delta_d['AR1_2'],
                    -delta_d['AR2_1']*delta_d['AR2_2'],
                    -delta_d['AR3_1']*delta_d['AR3_2'],
                    -delta_d['AP1_1']*delta_d['AP1_2'],
                    -delta_d['AP2_1']*delta_d['AP2_2'],
                    -delta_d['AP3_1']*delta_d['AP3_2'],
                    delta_d['AR1_1']+delta_d['AR1_2']-self.AR1_REDEMPT_RANGE_up,
                    self.AR1_REDEMPT_RANGE_down-delta_d['AR1_1']-delta_d['AR1_2'], 
                    delta_d['AR2_1']+delta_d['AR2_2']-self.AR2_REDEMPT_RANGE_up,
                    self.AR2_REDEMPT_RANGE_down-delta_d['AR2_1']-delta_d['AR2_2'],
                    delta_d['AR3_1']+delta_d['AR3_2']-self.AR3_REDEMPT_RANGE_up,
                    self.AR3_REDEMPT_RANGE_down-delta_d['AR3_1']-delta_d['AR3_2'],
                    delta_d['AP1_1']+delta_d['AP1_2']-self.AP1_REDEMPT_RANGE_up,
                    self.AP1_REDEMPT_RANGE_down-delta_d['AP1_1']-delta_d['AP1_2'],
                    delta_d['AP2_1']+delta_d['AP2_2']-self.AP2_REDEMPT_RANGE_up,
                    self.AP2_REDEMPT_RANGE_down-delta_d['AP2_1']-delta_d['AP2_2'],
                    delta_d['AP3_1']+delta_d['AP3_2']-self.AP3_REDEMPT_RANGE_up,
                    self.AP3_REDEMPT_RANGE_down-delta_d['AP3_1']-delta_d['AP3_2'] ,
                    -sumr1+sumar1+15,
                    -sumr2+sumar2+20,
                    -sumr2+sumar2+10,
                    -sumap1 - sumap2 -sumap3 + sumc1 -30]

pop.CV = np.hstack(qualification_list)

其中,int(self.params['ADJUST_TOTAL'][0]) = 15,self.redmpt['AR1'] = 3, self.redmpt['AR2'] = 6,self.redmpt['AR3'] = 6, self.redmpt['AP1'] = 4, self.redmpt['AP2'] =4, self.redmpt['AP3'] = 4,self.AR1_REDEMPT_RANGE_up = 2,self.AR1_REDEMPT_RANGE_down = -4,其他AR AP的REDMPT_RANGE与以上相同。

以下为population中与var_trace[best_gen]相同的解对应的CV:
捕获

如果手工按照限制条件计算,第四个限制条件应该与第三个限制条件值相等 = -1。除了第四个限制条件外有些其他限制条件的CV值也与手工计算年的值不符合。请问这是什么原因导致的呢? 谢谢

add a progress bar?

我注意到算法结束后可以给计算过程绘图,但是试用中发现比较在乎的还是能够实时看到计算过程,特别是计算问题比较大比较慢的时候。所以是否有可能在遗传算法过程中增加一个监控变量变化规律的功能?

How to deal with conditional constraints?

Hi, I'm writing program that involves a conditional constraint:

if abs(x1-c) = 0, then x2 = 0,
where x1 and x2 are decision variables.

I heard that there are ways to express this using big M method, but is there any bettter way to formulate this constriant in geatpy?

Thanks

Really sad to find it's only for Windows

Hey, guys! I'm really willing to try this new "seeming wonderful" toolbox, but it turned me down while I found the modules all folded by .pyd files.
Feel sad about it.
Really hope there could be mac version or linux version. If it happens someday, I will really appreciate!

能否类似Gurobi,Cplex优化器那样,求解*.lp文件

geatpy能否提供类似Gurobi,Cplex优化器那样的接口,可以先读取lp或MPS类型的模型文件,然后求解问题;
如read(test.lp),读取对应的模型文件,然后使用geatpy的遗传算法进行求解!谢谢!

crtfld.pdf 解释有点不清楚

以这几行为例:
x1 = [-3, 5] # 自变量1的范围
x2 = [2, 10] # 自变量2的范围
b1 = [1, 0] # 自变量1的边界
b2 = [1, 1] # 自变量2的边界
codes = [0, 1] # 各变量的编码方式, 2个变量均使用格雷编码
precisions = [0, 0] # 各变量的精度, 0表示精确到个位
scales = [1, 0] # 采用算术刻度
ranges = np.vstack([x1, x2]).T # 生成自变量的范围矩阵
borders = np.vstack([b1, b2]).T # 生成自变量的边界矩阵

b1 是不是应该为[1,1], 因为上下界都存在?
codes=[1,1] 如果两个都是格雷编码?
scales = [1, 1] , 如果都采用算术精度?

UnicodeDecodeError in installing

When my installing:

Exception:
Traceback (most recent call last):
File "/home/server5/anaconda3/envs/tf19/lib/python3.6/site-packages/pip/_internal/cli/base_command.py", line 179, in main
status = self.run(options, args)
File "/home/server5/anaconda3/envs/tf19/lib/python3.6/site-packages/pip/_internal/commands/install.py", line 393, in run
use_user_site=options.use_user_site,
File "/home/server5/anaconda3/envs/tf19/lib/python3.6/site-packages/pip/_internal/req/init.py", line 57, in install_given_reqs
**kwargs
File "/home/server5/anaconda3/envs/tf19/lib/python3.6/site-packages/pip/_internal/req/req_install.py", line 913, in install
use_user_site=use_user_site, pycompile=pycompile,
File "/home/server5/anaconda3/envs/tf19/lib/python3.6/site-packages/pip/_internal/req/req_install.py", line 445, in move_wheel_files
warn_script_location=warn_script_location,
File "/home/server5/anaconda3/envs/tf19/lib/python3.6/site-packages/pip/_internal/wheel.py", line 607, in move_wheel_files
generated=generated, lib_dir=lib_dir,
File "/home/server5/anaconda3/envs/tf19/lib/python3.6/site-packages/pip/_internal/wheel.py", line 275, in get_csv_rows_for_installed
for row in old_csv_rows:
File "/home/server5/anaconda3/envs/tf19/lib/python3.6/codecs.py", line 321, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd0 in position 4333: invalid continuation byte

I do not know what caused this and how to figure it out

结果出现不满足约束的点

如题:
if shift_h <= 30 and shift_v <= 30:
cv_value = -100
else:
cv_value = 100
cv.append(cv_value)
pop.Cv = np.array([cv]).T
我已经将对应解得cv置为正数了,结果中还是出现不满足约束的解,而且保存的cv文件中全为0.
请问这是怎么回事?

How to combine the usual Constraint-Handling Technology in Geatpy2

I am very excited about the Geatpy2 release.
I am always confused about handling the constraints, which is the key point to the application of EA.
The punishing function method is quite simple, but once the built-in Constraint-Handling Method does not has good performance, the satisfactory optimization result will not be obtained.
Could you please give some suggestions or introductions about the combination of usual Constraint-Handling Technology with Geatpy2 in the Geatpy Tutorials?
Thanks for your excellent work.

运行快速示例出现错误

我在运行快速入门中的带约束的多目标优化问题时出现错误提示:
TypeError: init() takes 1 positional argument but 10 were given
请问有解吗?

可变长度的编码

我现在遇到一个无人机路径优化问题,但麻烦的是路径经过的点的个数是不确定的,这种需要可变长度的编码吗?有其他解决方案吗?

pyd

请问您的论文大概什么时候能够发表,想看源代码,555555

linux版本的获取

已经给[email protected]发过邮件了,暂时没有回复,不知道是不是这个邮箱地址变了2333,另外tutorial写的很好,建议直接在网页端展示,pdf看起来切换不是很方便

submit...maybe a bug?

when use sga_code_templet in my code, report index error in line 139:
var_trace[gen,:] = variable[bestIdx, :] # 记录当代最优的控制变量值.

Debug geatpy\source-code\templets\sga_code_templet.py, in line 179:
variable = ga.bs2int(SelCh, FieldD).astype('int64')

maybe it should be:
variable = ga.bs2int(Chrom, FieldD).astype('int64')

cause the index in line 139 is acquired from objv in line 130, and objv has changed in line 171 function ga.reins, so the dimensions of Objv and Selch are different.

thanks for apply.

添加并行计算示例

在进行多目标问题时,如问题规模变大需要则并行计算来提高运行效率。据我所知新版本的geatpy支持并行计算。可否添加一个附带并行计算代码的例子供大家参考学习?谢谢!

关于选择,交叉的问题

我只是看了几个demo,首先这个运行速度是真的非常快,比自己写的要好很多,不过对于选择和交叉有几个疑问。
首先是选择的时候我发现了重复选取某个个体,就是选择之后的种群中的某几个个体可能时来源于同一个个体,请问这样会造成局部最优解吗,就是感觉可能减少了全局搜索的广度。
第二个交叉,不是太清楚交叉时是哪两个个体进行交叉的
另外,请问方便给linux版本的geatpy吗,毕竟windows下很容易打游戏了,我的邮箱是[email protected],是一位来自**石油大学的小生

no mudule named awGA

当我在mac os x中利用pip安装好geatpy后,在import geatpy as ga语句执行时报出no mudule named awGA 这个错误 我的python版本是3.7

ValueError: left cannot be >= right in trcplot.trcplot?

hello, I got an error when running all the demos, The error was showed that ValueError: left cannot be >= right,the details were as followed.
Traceback (most recent call last):
File "E:/Test/GA/demo/quickstart_demo/quickstart_demo.py", line 74, in
ga.trcplot(pop_trace, [['种群个体平均目标函数值', '种群最优个体目标函数值']], ['demo_result'])
File "geatpy\trcplot.py", line 76, in trcplot.trcplot
File "D:\Anaconda3\envs\tensorflow\lib\site-packages\matplotlib\pyplot.py", line 253, in show
return _show(*args, **kw)
File "D:\PyCharm 2018.2.1\helpers\pycharm_matplotlib_backend\backend_interagg.py", line 25, in call
manager.show(**kwargs)
File "D:\PyCharm 2018.2.1\helpers\pycharm_matplotlib_backend\backend_interagg.py", line 107, in show
self.canvas.show()
File "D:\PyCharm 2018.2.1\helpers\pycharm_matplotlib_backend\backend_interagg.py", line 62, in show
self.figure.tight_layout()
File "D:\Anaconda3\envs\tensorflow\lib\site-packages\matplotlib\figure.py", line 2276, in tight_layout
self.subplots_adjust(**kwargs)
File "D:\Anaconda3\envs\tensorflow\lib\site-packages\matplotlib\figure.py", line 2088, in subplots_adjust
self.subplotpars.update(*args, **kwargs)
File "D:\Anaconda3\envs\tensorflow\lib\site-packages\matplotlib\figure.py", line 241, in update
raise ValueError('left cannot be >= right')
ValueError: left cannot be >= right
And i do not know how to deal with it.

如何设置初始解产生策略

我遇到的问题解空间太大,如果随机尝试解,不能找到符合约束条件的解,因此必须产生大量的随机的有效解,如何设置呢?

TypeError when running soea demo2

I was running the main of soea_demo2. I ran into the following problem:

problem = MyProblem() # 生成问题对象
ea.Problem.init(self, name, M, maxormins, Dim, varTypes, lb, ub, lbin, ubin)
TypeError: init() takes 1 positional argument but 10 were given

I didn't make any changes to the code. Is there anything wrong with the code?
Thanks!

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.