Objective Function for Symmetrical Solution with fmincon?

1 view (last 30 days)
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!

Answers (1)

Matt J
Matt J on 26 Sep 2014
Edited: Matt J on 26 Sep 2014
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.

Community Treasure Hunt

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

Start Hunting!