Simple Optimization with integer vector
2 次查看(过去 30 天)
显示 更早的评论
Dear all,
I have a very easy optimization problem but I am not sure how do formulate it for the optimization toolbox.
The basic version of my problem is the following: f= max A*B
in which B is vector of decision variables: B = [b(1); b(2); ...; b(n)]
and A is a vector (length: n) filled with integers (real world data): e.g. A = [53; 12; ...; 47]
then I have a matrix C with simple constraints regarding the range of b(i). So I want to find the the n optimal values of b(i) (constrained by C).
My assumption was, that I could just use intlinprog for this:
x = intlinprog(f,A,B,C) ... but it doesn't work like that.
Do you guys have an idea how to formulate this for intlinprog (or which command to use instead)
Thanks a lot!
3 个评论
John D'Errico
2017-3-6
Whatare your constraints?
Bound constraints?
LINEAR equality constraints?
LINEAR inequality constraints?
What is C? What does it mean? You cannot simply state that B is constrained by C. That has no meaning, to anyone but you.
Next, You state you want to maximize A.*B. Again, thismakes no sense, since A.*B wll generate a VECTOR. You cannot optimize a vector.
So do you want to maximimze A*B, i.e, dot(A,B)?
回答(1 个)
John D'Errico
2017-3-6
First, read the help for intlinprog.
Next, intlinprog is a minimizer. You want to maximize. Assuming that you really need to maximize dot(A,B), where A is a vector, then you would need to minimize dot(-A,B) using intlinprog.
Once you are able to tell me what the constraints are in C, I will answer the remainder of your question.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Linear Programming and Mixed-Integer Linear Programming 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!