Minimizing a linear objective function under a unit-sphere constraint
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi folks,
It might be pretty simple question for some of you, but it would be great to share this idea with me.
I have an objective function to minimize and it's given as a linear.
Let's say that f(q) where f is linear.
q is of unit length m-dimensional vector and there is another given m-dimensional vector p which is orthogonal to q.
The question is how I can minimize the objective function s.t.
norm(q) = 1 and p'q = 0.
In particular, I'd like to use the simplex method.
Is there any way to tackle this problem using linprog function?
If not, is there any other way to utilize the simplex method in solving this?
Thanks in advance.
Martin
6 commentaires
Bjorn Gustavsson
le 2 Avr 2011
Why do you want to use an optimization algorithm for this problem. As I outlined below it has a simple solution. Is your real problem more complex? If so in what way?
Réponse acceptée
Andrew Newell
le 31 Mar 2011
ceq = @(x) abs(norm(x)-1) + abs(p'*x);
(ceq is an anonymous function). I added the absolute values to make sure that both terms have to be zero for ceq to be zero.
EDIT: Actually, since ceq can return a vector, a better formulation would be
ceq = @(x) [norm(x)-1; p'*x];
FURTHER EDIT: You might get better numerical behavior if you use
ceq = @(x) [x'*x-1; p'*x];
because then you don't have to take a square root.
6 commentaires
Andrew Newell
le 31 Mar 2011
You're right - I can't see the prime (although I can see it in (f')^2). That makes a lot more sense.
Andrew Newell
le 31 Mar 2011
One advantage my third formulation has is that you have a problem that contains nothing worse than second order polynomials. If you drop the dimension by one, you have to deal with square roots and the chance that imaginary components can creep in, while gaining nothing. If I understand FMINCON, the initial guess doesn't have to satisfy the constraints.
Plus de réponses (1)
Bjorn Gustavsson
le 31 Mar 2011
I'd go about it this way (if I've gotten the question right):
- calculate the gradient of f: df
- calculate Df = df - dot(p,df)*p - should be the gradient of f in the plane perpendicular to p.
- calculate q = -Df/norm(Df)
- fmin = f(q)
HTH, Bjoern
0 commentaires
Voir également
Catégories
En savoir plus sur Linear Least Squares dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!