fmincon with external function as constraint
古いコメントを表示
I use the fmincon to optimize the size of electrical motor. I also use the OctaveFemm toolbox to connect the Matlab with FEMM 4.2 solver. I have the function geometry.m which I use to load my model to FEMM (the inputs are dimensions of the machine). Next I use mi_analyse command to start FEMM calculations and after this I have the function torque_read which provides me the torque from obtained FEMM results as a value in Matlab.
I would like to add the optimisation constraint for torque range. Is it possible to implement my FEMM calculation procedure somewhere in fmincon function?
回答 (1 件)
Walter Roberson
2017 年 2 月 22 日
0 投票
The nonlcon parameter expects a function handle. The function can call upon whatever other functions it wants. The requirements are:
- the nonlcon function must return two outputs (not a vector of length two), the first of which is the nonlinear inequality constraints, and the second of which is the nonlinear equality constraints. Return [] in the appropriate position if a constraint does not apply
- the inequality constraint is a vector or matrix output. Each entry must be negative or 0 to indicate that the constraint is not violated, with positive indicating a constraint violation
- the nonlinear equality constraint should be 0 when the constraint is not violated.
カテゴリ
ヘルプ センター および File Exchange で Simulate Responses to Biological Variability and Doses についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!