Objective Function for Symmetrical Solution with fmincon?

1 次查看(过去 30 天)
Hello,
I am writing a code that uses fmcinon to solve for the solution of a system that is constrained by various linear and nonlinear equality constraints (no inequality constraints). In addition to finding the solution that provides the smallest f(x), I would also like to create an objective function that will find the most symmetrical solution. By symmetrical, I mean that the values inside x are as close to one another as possible.
Here's a few ideas I've been playing with.
1) f = sum(x^2)
2) f = sum(x^2) / length(x)
3) xAverage = sum(x) / length(x)
cost = sum((x - xAvg).^2) / length(x)
Any thoughts or suggestions? Thanks!

回答(1 个)

Matt J
Matt J 2014-9-26
编辑:Matt J 2014-9-26
You can try adding a penalty on the variance or the first differences in x,
  1. min. f(x)+beta*var(x)
  2. min. f(x)+beta*norm(diff(x))^2
where beta>0 is a weight factor on the penalty term controlling its priority level.

类别

Help CenterFile Exchange 中查找有关 Nonlinear Optimization 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by