Hi,
I have a linear function with number of variables f(x1 x2, x3, x4 …) which I want to minimize wrt the variables x1, x2 …such that the sum of variables x1+x2+x3… also remains minimum.
I would be thankful for any suggestion regarding this interdependent double optimization problem.
thanks SG
I suggest you post a simple example of what you want to do and what you have done so far.
Thanks for your response. Let us consider a simple example z = Abs[4x + 6y - 18], where x, y >= 0. The minimum possible value for this function is 0, which can be achieved by a number of combinations of x and y. Among these possible sets (x, y), I want to find one for which x+y is minimum.
In simple example as above, we can easily find that the solution to this problem is x = 0, y = 3. Any other set of x, y which satisfies above equation, x+y would always be higher than 3.
Though I am not sure for a complicated problem having about 30 variables, how can I solve such problem using mathematica.
thanks
- SG
I don’t think this question is well posed.
One problem is that I don’t know what you mean by linear function. Are you looking for the intersection of two hyper planes? If yes, this should be a set of dimension N-1, not a simple point.
Let’s assume instead f is an arbitrary function, it could have numerous local minima in the region of space where all coordinate values are less than zero. Which minimum should we then choose?
There is a similar problem, solved by Lagrange Multipliers. This optimization problem is well stated, so maybe you can use it as an example to reformulate your question. Until then I don’t think we will see a satisfactory answer.
Thanks fo sharing the info on Lagrange Multiplier method, I tought about it earlier, but seems Mathematica can not do it directly. I will reconsider it. In the meantime, in my last post (after your response) I have given a simple example of what I want to do. Please look at it and it might make more sense than what I posted initially. Thanks.
Here is the example again..
Let us consider a simple example z = Abs[4x + 6y - 18], where x, y >= 0. The minimum possible value for this function is 0, which can be achieved by a number of combinations of x and y. Among these possible sets (x, y), I want to find one for which x+y is minimum. In simple example as above, we can easily find that the solution to this problem is x = 0, y = 3. Any other set of x, y which satisfies above equation, x+y would always be higher than 3. Though I am not sure for a complicated problem having about 30 variables, how can I solve such problem using mathematica. thanks - SG
Since x,y>=0 just minimize the sum of your two goals
NMinimize[{Abs[4 x + 6 y - 18] + x + y, x >= 0, y >= 0}, {x, y}]
In your actual problem you might need Norm[]
optimize the first function and then use the result as a constraint in the optimization of the second function.
The minimum value 0 of the function z=Abs[4x+6y-18] is achieved on the straight line defined by the equation 4x+6y-18=0. So, you want to solve the optimization problem:
x+y \rightarrow min,
s.t.
4x+6y-18=0,
x \geq 0, y\geq 0.
This is a simple linear programming problem and it may be solved in Mathematica:
In[1]:= Minimize[{x + y, 4 x + 6 y - 18 == 0, x >= 0, y >= 0}, {x, y}]
Out[1]= {3, {x -> 0, y -> 3}}
This seems to be a good idea, I will surely try. Though it would be great to think of a universal solution to such problems. Thanks a lot !!
Thanks a lot, it seems to be a good idea !
I think you’re basically asking about the fundamental problem of linear algebra, from a geometric perspective, maybe with a few extra constraints. You might be interested in the following:
Brief discussion of linear solving in \mathbb{R}^n
If you are studying this question from a computational perspective, using Mathematica, you should also be interested in the inner workings of the RowReduce function.
Thanks,
Brad