Minimize objective function with sums
Show older comments
Morning everybody ! I'm kind of a total newbie in Matlab and ILP problems and I would like to ask for you help. I'm trying to solve this objective function :

I read about the intlinprog function but the examples I found didn't help me, especially since I have two constraints with a sum.
The B variables are binary and this is about two graphs (where n are the nodes and e the edges).
I would love if anyone could help me with that. If anything isn't clear, please let me know so I can add more explanation.
Thanks for all of you ! Best Regards.
1 Comment
Steven Lord
on 7 Jun 2016
What does this problem represent in terms of a graph? I'm guessing the binary variables are being used to select some subset of the nodes and edges of your original graph -- what is that subset intended to minimize? Perhaps there's a way to use the graph algorithm functionality introduced in release R2015b to solve the problem as a graph problem rather than an ILP.
Answers (1)
Matt J
on 7 Jun 2016
Well, a 2-dimensional sum can always be rewritten as a 1-dimensional sum if that's what you're asking. For example, if you have
A=rand(5);
B=randi(1,5);
then sum(sum(A.*B)) is the same as sum(A(:).*B(:)). Once you have things formulated in 1-dimensional, it should be straightforward to express the sums via matrix multiplication,
A(:).'*B(:)
as required by intlinprog.
1 Comment
Khaled MOULOUDI
on 7 Jun 2016
Categories
Find more on Mathematics 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!