Optimization with custom constraint
显示 更早的评论
I am trying to formulate a linear optimization problem with a simple cost function of the form
Cost = X*Price_X + Y*Price_Y
But additionally, I have a parameter Z that I had obtained before through an iterative process. Z is a 2x2 matrix, where each value index is the value of X and Y.
Example: ParameterValue = Z(X,Y)
In my optimization problem, on top of having to minimize the cost of X and Y, the ParameterValue has to be within certain limits, or under a certain threshold
My Question is: is it possible to pass that parameter as a function handle, although it is a function of the other variables? Or should I formulate a multi-objective algorithm where ParameterValue is another objective function.
What I have tried was to have the following code:
if true
Value= @(X,Y) Z(X,Y) %To have value as an anonymous function
ObjFunc = PriceX * X + PriceY * Y + 0*Value(X,Y)
end
Then adding the threshold as a constraint for Value. But this has not worked at all.
Is my formulation, procedure right? or doable in any case? or should I try to do some multi-objective linear optimization if possible. Please note that the values of Z (2x2 matrix)are obtained before, so I also need to call them somehow to the optimization function.
Thank you in advance.
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Choose a Solver 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!