Simple Optimization with integer vector
Show older comments
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 Comments
Torsten
on 6 Mar 2017
Do you mean you want to maximize
transpose(A)*B ?
Best wishes
Torsten.
fr_sk
on 6 Mar 2017
John D'Errico
on 6 Mar 2017
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)?
Answers (1)
John D'Errico
on 6 Mar 2017
0 votes
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.
Categories
Find more on Operating on Diagonal Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!