-------- Forwarded Message -------- From: Sylvain Fournier <[email protected]> To: Andrew Makhorin <[email protected]> Subject: Re: [Help-glpk] Building a graph on the fly Date: Tue, 17 Apr 2012 10:12:27 -0300
Hi Andrew, Thanks for your quick answer. In fact, I am looking for an example in Java, as I can't find how to create a C struct using the Java routines, and how to use the offsetof macro. Does the '_' prefix for the class names _glp_graph, _glp_arc and _glp_vertex (in Java) mean something special? (I guess they are supported, as they can be found in the glpk-java.pdf documentation) Best regards. 2012/4/16 Andrew Makhorin <[email protected]> > 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. -- Sylvain Fournier Analista de Pesquisa Operacional 48 3239-2423 WPLEX Software Ltda. Rod SC 401 no. 8600 Corporate Park bloco 5 sala 101 88050-000 Santo Antônio de Lisboa, Florianópolis SC +55 48 3239-2400 wplex.com.br WPLEX _______________________________________________ Help-glpk mailing list [email protected] https://lists.gnu.org/mailman/listinfo/help-glpk
