Simply add:
var flow{arcs} >= 0;
s.t. FlowConservation{node in nodes_that_are_used}:
sum{(node,head_node) in arcs} flow[node,head_node]
=
sum{(tail_node,node) in arcs} flow[tail_node,node]
;
After the set nodes_that_are_used is defined.
From: Abhishek Shivakumar [mailto:[email protected]]
Sent: Thursday, March 31, 2016 10:53 AM
To: Meketon, Marc; [email protected]
Subject: RE: [Help-glpk] Condensing a sparse matrix by creating a subset of
parameter data
Thanks for your message. That is indeed (almost) what I'm looking for. I would
like to then apply a constraint to the subset of nodes that are being used.
Specifically, I want to set a constraint on the 'flow' between the nodes.
I agree that reducing the matrix size won't have a significant effect on the
optimization time. However, we're generating an lp file from our model and the
time to generate the lp file is likely to be reduced significantly. I expect
that there will be an optimal point between reducing the size of the matrix
(and time to generate it) and the optimization time.
From: Meketon, Marc [mailto:[email protected]]
Sent: 31 March, 2016 4:11 PM
To: Abhishek Shivakumar <[email protected]<mailto:[email protected]>>;
[email protected]<mailto:[email protected]>
Subject: RE: [Help-glpk] Condensing a sparse matrix by creating a subset of
parameter data
Are you looking for something like the below that finds the subset of nodes
being used?
set nodes := {"A", "B", "C", "D", "E"};
set arcs within nodes cross nodes := {("A","B"), ("B","E")};
display nodes;
display arcs;
set nodes_that_are_used :=
setof{tail_node in nodes, head_node in nodes : (tail_node, head_node) in arcs
} tail_node
union
setof{tail_node in nodes, head_node in nodes : (tail_node, head_node) in arcs
} head_node;
display nodes_that_are_used;
end;
From:
[email protected]<mailto:[email protected]>
[mailto:[email protected]] On Behalf Of
Abhishek Shivakumar
Sent: Thursday, March 31, 2016 9:18 AM
To: [email protected]<mailto:[email protected]>
Subject: [Help-glpk] Condensing a sparse matrix by creating a subset of
parameter data
Hi,
I have an lp model that produces an extremely sparse constraint matrix. I would
like to reduce the number of non-zero entries in this matrix (make the matrix
more dense). The main cause of this sparse-ness is the relation between two
parameters. They can be seen as 'arcs' and 'nodes: not all nodes have arcs
between them. Is there a way to create a subset of parameter data from the sets
'arcs' and 'nodes' based on whether they are connected? I would then be able to
apply constraints only for this subset. In other languages (such as python)
such an operation is possible through nested conditional statements. Is there a
similar/equivalent approach in glpk/GNU mathprog?
Thanks!
Abhishek
________________________________
This e-mail and any attachments may be confidential or legally privileged. If
you received this message in error or are not the intended recipient, you
should destroy the e-mail message and any attachments or copies, and you are
prohibited from retaining, distributing, disclosing or using any information
contained herein. Please inform us of the erroneous delivery by return e-mail.
Thank you for your cooperation.
________________________________
This e-mail and any attachments may be confidential or legally privileged. If
you received this message in error or are not the intended recipient, you
should destroy the e-mail message and any attachments or copies, and you are
prohibited from retaining, distributing, disclosing or using any information
contained herein. Please inform us of the erroneous delivery by return e-mail.
Thank you for your cooperation.
_______________________________________________
Help-glpk mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-glpk