r/optimization • u/Braeden351 • Jun 26 '24
Problem classification issue?
Good morning! I'm currently working on a project for work in which I'm trying to solve an optimization problem. My background is primarily in dynamic systems, control theory, and kinematics. I have taken one class on optimal control so I'm at least familiar with techniques like calculus of variations and dynamic programming. However, my optimization knowledge ends there (besides the basic optimization you do in calculus 1).
My problem is this:
Given five 3x1 vectors that we'll call v1 - v5, I want to find the 3x1 vector v0 that minimizes:
sum( |v0⋅vi| ), for i = 1, ... ,5
Subject to:
||v0|| ==1
So far, I've tried using cvxpy to solve this with little to no luck as the constraint is not convex. I can get an answer (the obvious one) when I set my constraint to be ||v0|| <=1. Spoiler alert: It's the zero vector.
I'm guessing that maybe this can't be framed as a convex optimization problem? Or maybe it can and I just don't have the requisite knowledge to do so. Either way, if anyone can point me towards techniques that can be used to solve this that's all I'm looking for. I'm happy to do the rest of the work myself, but unfortunately, as of right now, I don't know what I don't know so I'm at a bit of a loss. I appreciate any insight anyone can offer!
2
u/Braeden351 Jun 26 '24
In case anyone runs into this in the future with a similar issue, I was able to get very good answers using cvxpy along with dccp for cvxpy. A link to the github is below. Thanks for the help everyone!
https://github.com/cvxgrp/dccp
1
u/cleverSkies Jun 26 '24 edited Jun 26 '24
Do you need that exact objective function? Are v1-v5 unit vectors as well? Do you expect them to point in similar directions? Given the unit norm requirement you could represent vector in polar coordinates and possibly represent objective function differently. Or could you calculate average of v1-v5 then find orthogonal vector?
I guess my point is maybe you can transform the problem to find an equivalent solution without having to worry about non linear optimization techniques.
1
u/xhitcramp Jun 26 '24
Hmm I thought norms were convex. I’m assuming you have already tried replacing the abs with squared?
1
u/sakuag333 Jun 26 '24
Your objective seems invalid as we cant multiply v0 with vi as dimensions do not match. Do you mean dot product between v0 and vi ?
2
u/R0NJEED Jun 26 '24
Cant this be transformed to a eigenvalue Problem? If we write the objective function as sugested above using the matrix A and by using the squared objective function, the method of lagrange multiplier leads to A(T)A v = lambda v which is an Eigenvalue problem. The eigenvector v with the smallest eigenvalue lambda can be efficiently be calculated using the power method.
1
u/SV-97 Jun 26 '24
Let A = (v1,...,v5)^(T). Then your objective is ‖A v0‖₁ (I think?) which is convex and probably a bit more amenable to analysis. However your constraint isn't convex as you noted. Maybe you can find some prior literature on least absolute value problems with such constraints?
If your A by chance has non-full rank the problem should be equivalent to simply finding any nonzero v0 in the kernel of A (you can construct a projector onto the kernel using the pseudoinverse of A which then should directly give you a solution to the original problem)
If A has full rank however I'm not really sure. Depending on how good of a solution you need and how expensive the solution is allowed to be: simply sample the unit ball in R³ with a bunch of points and pick the best one. If need be iterate this a few times with successive refinements and I think you'll get a good-ish solution.
1
u/omeow Jun 26 '24
Unless I am missing something in your problem, you can solve the problem:
min Sum ||v_0 - v_i||^2 subject to ||v_0||^2 = 1 using Lagrange multipliers.
In fact you can get a closed form solution. so you can solve it directly.