Clear Filters
Clear Filters

Simple Optimization with integer vector

2 views (last 30 days)
fr_sk
fr_sk on 4 Mar 2017
Commented: fr_sk on 7 Mar 2017
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
fr_sk
fr_sk on 6 Mar 2017
Hello Torsten, thanks for the response. I want to maximize
A .* B
where A contains real-world data and B contains variables that can take on the values constrained by C.
John D'Errico
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)?

Sign in to comment.

Answers (1)

John D'Errico
John D'Errico on 6 Mar 2017
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.
  1 Comment
fr_sk
fr_sk on 7 Mar 2017
Hello John D'Errico,
thanks for your answer, I am going to try to specify my problem:
Let's say I want to optimize the following functions
2x(1) + 5y(1)
6x(2) + 7y(2)
4x(3) + 3y(3)
... ...
x(n) + y(n)
constrained by
x(1,2,...n) >= 20
y(1,2,...n) >= 10
x(1,2,...n) > 0
y(1,2,...n) > 0
The integers for these problems are stored in vectors of length n:
A = [2; 6; 4; ...]
B = [5; 7; 3; ...]
I now want to obtain the optimal (let's say it's an minimization) n values for x(1,2,...,n) and y(1,2,...,n).
Thanks a lot for looking into this.

Sign in to comment.

Categories

Find more on Linear Programming and Mixed-Integer Linear Programming 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!