当前位置:网站首页>Pymoo learning (8):grades
Pymoo learning (8):grades
2022-07-25 19:07:00 【Inji】
List of articles
1 Gradients
If the optimization problem is used autograd Realization , So you can go through AutomaticDifferentiation To deal with it :
import autograd.numpy as anp
from pymoo.core.problem import Problem
from pymoo.problems.autodiff import AutomaticDifferentiation
class MyProblem(Problem):
def __init__(self):
super().__init__(n_var=10, n_obj=1, n_constr=0, xl=-5, xu=5)
def _evaluate(self, x, out, *args, **kwargs):
out["F"] = anp.sum(anp.power(x, 2), axis=1)
if __name__ == '__main__':
problem = AutomaticDifferentiation(MyProblem())
X = anp.array([anp.arange(10)])
F, dF = problem.evaluate(X, return_values_of=["F", "dF"])
print(X, F)
print(dF.shape)
print(dF)
Output is as follows :
[[0 1 2 3 4 5 6 7 8 9]] [[285.]]
(1, 1, 10)
[[[ 0. 2. 4. 6. 8. 10. 12. 14. 16. 18.]]]
reference
边栏推荐
- 聊聊sql优化的15个小技巧
- 【DETR用于3D目标检测】DETR3D: 3D Object Detection from Multi-view Images via 3D-to-2D Queries
- 一个函数中写多少行代码比较合适呢? 代码整洁之道
- Microsoft azure and Analysys jointly released the report "Enterprise Cloud native platform driven digital transformation"
- How to create an effective help document?
- How to create an effective help document?
- Circulaindicator component, which makes the indicator style more diversified
- [919. Complete binary tree inserter]
- kubernetes RBAC
- Pymoo学习 (5):收敛性分析
猜你喜欢

2022 IAA industry category development insight series report - phase II

常用的开发软件下载地址

CLIP还能做分割任务?哥廷根大学提出一个使用文本和图像prompt,能同时作三个分割任务的模型CLIPSeg,榨干CLIP能力...

How to design product help center? The following points cannot be ignored

Huawei recruited "talented teenagers" twice this year; 5.4 million twitter account information was leaked, with a selling price of $30000; Google fired engineers who believed in AI consciousness | gee

Communication between processes (pipeline communication)

基础乐理之音程的度数

SQL 实现 Excel 的10个常用功能,附面试原题

Based on easycv to reproduce Detr and dab-detr, the correct opening method of object query

【919. 完全二叉树插入器】
随机推荐
How to design product help center? The following points cannot be ignored
【DETR用于3D目标检测】3DETR: An End-to-End Transformer Model for 3D Object Detection
MySQL sub query (selected 20 sub query exercises)
ES6 implements the observer mode through proxy and reflection
srec_ Use of common cat parameters
无惧高温暴雨,有孚网络如何保您无忧?
【加密周报】加密市场有所回温?寒冬仍未解冻!盘点上周加密市场发生的重大事件!
Summer Challenge [FFH] this midsummer, a "cool" code rain!
Juzhi cloud computing opens a new era to the "proprietary cloud" of Youfu network
优维低代码:Use Resolves
Hough transform understanding [easy to understand]
The bank's wealth management subsidiary accumulates power to distribute a shares; The rectification of cash management financial products was accelerated
Virtual machine VMware installation steps (how to install software in virtual machine)
Yyds dry inventory interview must brush top101: reverse linked list
Pymoo学习 (5):收敛性分析
Share six practical applet plug-ins
i3-status 配置
Communication between processes (pipeline communication)
Youwei low code: use resolutions
Full scale and Xuan of C key