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?

Respuestas (1)

Walter Roberson
Walter Roberson el 22 de Feb. de 2017

0 votos

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.

Categorías

Más información sobre Simulate Responses to Biological Variability and Doses en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 22 de Feb. de 2017

Respondida:

el 22 de Feb. de 2017

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by