help-glpk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-glpk] Building a graph on the fly


From: Andrew Makhorin
Subject: Re: [Help-glpk] Building a graph on the fly
Date: Tue, 17 Apr 2012 04:26:36 +0400

> I need to solve a minimum cost flow problem in Java, and for this I'd
> like to use the Out-Of-Kilter algorithm included in GLPK. I saw there
> is a way to build the graph reading the information from a text file
> (glp_read_graph), however I wonder whether I can do it on the fly,
> using some routines that modify the graph.
> I saw I can use for example glp_create_graph, glp_add_vertices,
> glp_add_arc. On the other hand, I can't find a way to create or modify
> the data associated with a vertex (demand) or an arc (capacity, cost).
> I had no success in searching either into the mailing list archives,
> or in the files included in the GLPK distribution (examples and
> documentation). Did I miss something?

Please see the example in Subsection 2.1.5 "Solve minimum-cost flow
problem with the out-of-kilter algorithm" of the document "GLPK: Graph
and Network Routines" (doc/graph.pdf). You need to define your own
structs, one for each node and one for each arc of the network, which
include fields to store node supply/demand, arc capacity, etc. When you
call glp_mincost_okalg, you specify with the standard offsetof macro
where the input data are stored in your structs and to where the routine
should store the solution components.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]