# fmincon performance with linear vs non linear constraints

2 次查看（过去 30 天）
Krishna Nunna 2022-9-14

I am currently running fmincon interior point with linear inqeuality, equality and non-linear inequality constraints. I am specifying both objective gradient and constraint gradient. I am wondering if there is any benefit with regard to speed up if I specify the linear inequality constraint as a non-linear inequality constraint along with the corresponding gradient.
##### 1 个评论显示 无隐藏 无
William Rose 2022-9-14
@Krishna Nunna, I don;t know . I suspect it will be as fast to just try it and find out, compared to getting a deifnitive answer on Matlab Answers. (I realize computing a gradient analytically can be time consuming, but for a linear function it should not be too hard.) I predict that the linear inequaliy constraint will be faster since it can be implemented as a matrix operation internally, with possible one-step solution, whereas nonlinear inequality constraint will certainly require an approximation process for solution. Good luck.

### 采纳的回答

Dinesh 2023-6-7
Hi Krishna!
In general, specifying a linear inequality constraint as a non-linear inequality constraint with corresponding gradient may not lead to a significant speedup in fmincon interior point algorithm. This is because fmincon interior point algorithm is specifically designed to handle linear inequality constraints efficiently.
The benefit of specifying non-linear constraints (and their gradients) may arise in cases where the constraints themselves are non-linear in nature. In such cases, providing the non-linear gradient can help fmincon to converge faster.
However, if you are uncertain about the linearity of your inequality constraint, or if you suspect that there may be some non-linearity, it is worth trying both linear and non-linear formulations of the constraint to see if there is any significant difference in the performance and convergence rate of fmincon.
Hope this helps,
Thank you!

### 类别

Help CenterFile Exchange 中查找有关 Solver Outputs and Iterative Display 的更多信息

R2020a

### Community Treasure Hunt

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

Start Hunting!

Translated by