Minimize objective function with sums

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

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.

Sign in to comment.

Answers (1)

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

Thank you Matt ! I will try this and let you know. Have a nice day.

Sign in to comment.

Categories

Find more on Mathematics in Help Center and File Exchange

Asked:

on 7 Jun 2016

Commented:

on 7 Jun 2016

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!