当前位置:网站首页>Pymoo learning (6): termination conditions
Pymoo learning (6): termination conditions
2022-07-25 19:06:00 【Inji】
List of articles
1 default setting
about Multiobjective optimization , The default settings include :
from pymoo.util.termination.default import MultiObjectiveDefaultTermination
termination = MultiObjectiveDefaultTermination(
x_tol=1e-8, # Motion in design space
cv_tol=1e-6, # The convergence
f_tol=0.0025, # Target space value
nth_gen=5, # Check the termination condition every several generations
n_last=30, # The number of last generations that should be considered in the calculation
n_max_gen=1000, # Maximum number of offspring
n_max_evals=100000 # Maximum number of evaluations
)
about Single objective optimization , The default settings include :
from pymoo.util.termination.default import SingleObjectiveDefaultTermination
termination = SingleObjectiveDefaultTermination(
x_tol=1e-8,
cv_tol=1e-6,
f_tol=1e-6,
nth_gen=5,
n_last=20,
n_max_gen=1000,
n_max_evals=100000
)
2 Evaluation quantity (n_eval)
from pymoo.algorithms.moo.nsga2 import NSGA2` Insert a code chip here `
from pymoo.factory import get_problem, get_termination
from pymoo.optimize import minimize
problem = get_problem("zdt3")
algorithm = NSGA2(pop_size=100)
termination = get_termination("n_eval", 300)
res = minimize(problem,
algorithm,
termination,
pf=problem.pareto_front(),
seed=1,
verbose=True)
Output is as follows :
============================================================
n_gen | n_eval | igd | gd | hv
============================================================
1 | 100 | 1.304648356 | 1.530191068 | 0.00000E+00
2 | 200 | 1.304200356 | 1.517648901 | 0.00000E+00
3 | 300 | 0.988539101 | 1.378914374 | 0.00000E+00
3 The number of iterations (n_gen)
from pymoo.algorithms.moo.nsga2 import NSGA2
from pymoo.factory import get_problem, get_termination
from pymoo.optimize import minimize
problem = get_problem("zdt3")
algorithm = NSGA2(pop_size=100)
termination = get_termination("n_gen", 10)
res = minimize(problem,
algorithm,
termination,
pf=problem.pareto_front(),
seed=1,
verbose=True)
Output is as follows :
============================================================
n_gen | n_eval | igd | gd | hv
============================================================
1 | 100 | 1.304648356 | 1.530191068 | 0.00000E+00
2 | 200 | 1.304200356 | 1.517648901 | 0.00000E+00
3 | 300 | 0.988539101 | 1.378914374 | 0.00000E+00
4 | 400 | 0.920567183 | 1.351594290 | 0.00000E+00
5 | 500 | 0.920567183 | 1.282794381 | 0.00000E+00
6 | 600 | 0.894035691 | 1.360904372 | 0.00000E+00
7 | 700 | 0.817395517 | 1.280727114 | 0.00000E+00
8 | 800 | 0.802167697 | 1.189542707 | 0.00000E+00
9 | 900 | 0.730335663 | 0.993344639 | 0.002211246
10 | 1000 | 0.699750404 | 0.851632873 | 0.002211246
4 Time (time)
The format of the time-based termination criteria should be set to be similar to get_termination(“time”, “01:30:00”), Said to run 1 Hours 30 minute :
from pymoo.algorithms.moo.nsga2 import NSGA2
from pymoo.factory import get_problem, get_termination
from pymoo.optimize import minimize
problem = get_problem("zdt3")
algorithm = NSGA2(pop_size=100)
termination = get_termination("time", "00:00:03")
res = minimize(problem,
algorithm,
termination,
pf=problem.pareto_front(),
seed=1,
verbose=False)
print(res.algorithm.n_gen)
5 Design space tolerance (x_tol)
from pymoo.algorithms.moo.nsga2 import NSGA2
from pymoo.factory import get_problem
from pymoo.optimize import minimize
from pymoo.util.termination.x_tol import DesignSpaceToleranceTermination
problem = get_problem("zdt3")
algorithm = NSGA2(pop_size=100)
termination = DesignSpaceToleranceTermination(tol=0.0025, n_last=20)
res = minimize(problem,
algorithm,
termination,
pf=problem.pareto_front(),
seed=1,
verbose=False)
print(res.algorithm.n_gen)
6 Target space tolerance (f_tol)
This is a widely used standard :
from pymoo.algorithms.moo.nsga2 import NSGA2
from pymoo.factory import get_problem
from pymoo.optimize import minimize
from pymoo.util.termination.f_tol import MultiObjectiveSpaceToleranceTermination
from pymoo.visualization.scatter import Scatter
problem = get_problem("zdt3")
algorithm = NSGA2(pop_size=100)
termination = MultiObjectiveSpaceToleranceTermination(tol=0.0025,
n_last=30,
nth_gen=5)
res = minimize(problem,
algorithm,
termination,
pf=True,
seed=1,
verbose=False)
print("Generations", res.algorithm.n_gen)
plot = Scatter(title="ZDT3")
plot.add(problem.pareto_front(use_cache=False, flatten=False), plot_type="line", color="black")
plot.add(res.F, facecolor="none", edgecolor="red", alpha=0.8, s=20)
plot.show()
Output is as follows :
reference
边栏推荐
- 【阅读笔记】《深度学习》第一章:引言
- Interface automation test platform fasterrunner series (II) - function module
- Talk about 15 tips of SQL optimization
- Youfu force supercomputing provides customized high-performance computing services for customers
- Interface automation test platform fasterrunner series (I) - introduction, installation and deployment, startup service, access address, configuration supplement
- [web technology] 1391 page visualization building tool, previous life and present life
- Pymoo学习 (5):收敛性分析
- ES6 implements the observer mode through proxy and reflection
- A free image download warehouse website
- C 调的满级和玄
猜你喜欢
![[919. Complete binary tree inserter]](/img/d9/15a9af50893db955d9ebb4d7d4e3d1.png)
[919. Complete binary tree inserter]

华为交换机系统软件升级和安全漏洞修复教程

modelsim和quartus联合仿真PLL FIFO等IP核

How to change the chords after the tune of the song is changed

Baklib:制作优秀的产品说明手册

Communication between processes (pipeline communication)

基于FPGA的1080P 60Hz BT1120接口调试过程记录

Basic mode of music theory

Full scale and Xuan of C key

【开源工程】STM32C8T6+ADC信号采集+OLED波形显示
随机推荐
软件测试(思维导图)
What is hpapaas platform?
In the first half of the year, the shipment volume has exceeded that of the whole year of last year, and centritec millimeter wave radar has "captured" the international giant
Excellent test / development programmers should make breakthroughs and never forget their original intentions, so that they can always
Talk about 15 tips of SQL optimization
With 8 years of product experience, I have summarized these practical experience of continuous and efficient research and development
Korean AI team plagiarizes shock academia! One tutor with 51 students, or plagiarism recidivist
I3 status configuration
SQL realizes 10 common functions of Excel, with original interview questions attached
How to design product help center? The following points cannot be ignored
高并发下如何保证数据库和缓存双写一致性?
【小程序开发】宿主环境详解
Is Cinda securities a state-owned enterprise? Is it safe to open an account in Cinda securities?
600000 pieces of data are made from March 1 to March 31. Videodate requires starting time from 00:00 to 24:00 on March 1 to 31, which is only for notes
聊聊sql优化的15个小技巧
Communication between processes (pipeline communication)
Yyds dry inventory interview must brush top101: reverse linked list
ThreadLocal夺命11连问
Fruit chain "siege": it's a journey of sweetness and bitterness next to apples
一个函数中写多少行代码比较合适呢? 代码整洁之道