Home
GOBLIN - Stony Brook University
Contents
1. 4 3 Editing Graphs Menu Item Edit 44 LP Editor Dialogs Menu Item Edit 4 5 Composing Graphs Menu Item Compose 4 6 Graph Visualization Menu Item Layout 4 7 Problem Solvers Menu Item Optimize 4 8 Solver Configuration Menu Item Optimize 4 9 Browser Configuration Menu Item Browser Data Objects Preliminary Statements 5 1 Some Conventions wd Bess DDR 2o 9o Oe ee eee ee Cox Us kine ae aed te ee Me th Du du Y Be ew eae ee oe wes oun gosse xo cw a ea Ro e 5 2 4 Floating Point 50 Handles 12 222225 9x te Be we o Ra 5 2 6 Matrix Indices 5 2 7 Class Local Types 5 3 Bounds and Precisions of Numbers 5 4 Ownership of Objects 21 21 28 24 25 27 28 28 29 30 30 32 33 34 35 37 6 Graph Objects 43 6 1 Abstract Classes 6 2 6 3 6 4 6 1 1 6 1 2 6 1 3 6 1 4 6 1 5 Persistent Objects 6 2 1 pt hock Reg genes Lm 43 Mixed Graphs 24 44 4 eee 43 Undirected 44 Digraphs and Flow Networks 44 Bipartite Graphs 4 66526 05054 45 Balanced Flow Networks 45 iux A Soot od Ge ne
2. G2 new big2FNW G1 1 G2 gt MaxFlow G2 gt Source G2 gt Target O if G2 gt Perfect i 53 6 3 LOGICAL OBJECTS F1 new export sample rst G1 WriteSubgraph F1 delete F1 delete G2 delete G1 effectively determines a mximum 1 matching of the graph object G1 Figure 6 5 A Maximum Matching with Corresponding Balanced Flow 6 3 4 General Matching Problems as Balanced Flow Prob lems Include file graphToBalanced h Synopsis class gra2bal 1 public virtual abstractBalancedFNW gra2bal abstractGraph amp TCap TCap NULL gra2bal abstractGraph amp TCap gra2bal abstractGraph amp 54 CHAPTER 6 GRAPH OBJECTS TNode Source TNode Target void InitFlow void Update The idea of this problem transformation is to split the nodes and arcs into symmetrical pairs and reduce to a balanced network flow problem Similar to the bipartite situation artificial nodes and arcs are added The resulting flow network is bipartite and the image of an original node consists of an outer and an inner node The constructors and some other methods are defined in analogy to the bipartite situation If lower degree bounds are specified the elimination of the lower capacity bounds is done immediately If we would apply the class fnw2fnw the complementarity relationship would be lost Balanced network flow methods not ordinary network flow methods manipulate the subgrap
3. colvis lt boolean gt lt configuration gt lt mps problem gt lt mps basis gt CHAPTER 18 PERSISTENCY Here lt mps problem gt denotes the full description of a mixed integer linear program in CPLEX 5 format and lt mps basis gt denotes a respective basis The fields in the header are as follows e rows specifies the number k of structural restrictions e columns specifies the number l of variables e size denotes the number of non zero matrix coefficients e pivot specifies a potential pivot element listing the row index the column index and if the lower 0 or upper bound 1 is achieved af ter the pivot step Alternatively an asterisk indicates that no pivot element is defined e rowviz and colviz are currently not in use and must be set to 1 constantly e The lt configuration gt part is formatted as in graph objects files 18 6 Canvas and Text Form Include file abstractMixedGraph h Synopsis class goblinDataObject 1 void Export2XFig char void Export2Tk char void Export2Ascii char Hh CANVAS AND TEXT FORM In principle every data object can be exported into some user readable form The method prototypes are listed above and are so far implemented for graph objects canvas and text forms and mixed integer problems only text form The text form provided by Export2Ascii is used by the GOBLET browser The exact format for mixed integer problems is described in S
4. 13 10 8 The Primal Network Simplex Method The network simplex method can be considered an adaption of the gen eral simplex method to network flows but also a clever specialization of the Klein cycle canceling algorithm In order to generate negative cycles the network simplex method maintains node potentials and a spanning tree which entirely consists of arcs with zero reduced length 13 10 MINIMUM COST FLOWS Figure 13 9 A Strongly Feasible Spanning Tree Every arc not in the tree which has negative reduced length can be extended by tree arcs to a cycle with negative length One selects such a pivot arc with positive residual capacity but even then it is impossible to guarantee that the pivot cycle has residual capacity different from zero Such degen erate pivot steps do not affect the flows but change the node potentials and the spanning tree structure To fix up the problems with degeneracy one uses strongly feasible spanning tree structures where every arc can send flow up the tree and the leaving arc on the pivot cycle is chosen carefully 129 13 11 BALANCED NETWORK SEARCH CHAPTER 13 HIGH LEVEL ALGORITHMS In our implementation connectivity is neither required for the input graph nor forced by a problem transformation The method must start with a feasible b flow In a first step a procedure NWSimplexCancelFree transforms the initial b flow into a cycle free solution by a depth
5. Figure 13 10 An Optimum 2 Factor For complete graphs and bigraphs one can solve the matching problem on a sparse subgraph either heuristically if methSolve 0 or to optimality The candidate graph consists of 10 greedy like heuristic matchings and the k nearest neighbours of each node where k methCandidates Note that this option is provided for optimization with the internal node demands only If the graph is non bipartite only the fractional matching problem is solved on the candidate graph T JOIN AND POSTMAN PROBLEMS Figure 13 11 Gallai Edmonds Decomposition There is a procedure MinCEdgeCover which determines an edge cover with minimum weight This uses the well known reduction to the 1 factor prob lem In particular the worst case time complexity is the same as for the underlying matching solver A procedure to compute a minimum size edge cover from a given maximum cardinality maching is discussed in Section 11 2 13 15 T Join and Postman Problems Synopsis class abstractGraph void ComputeTJoin void MinCTJoin void MinCTJoin TNode TNode 135 TSP ALGORITHMS void ChinesePostman class diGraph void ChinesePostman An Eulerian cycle is an eligible closed walk which traverses every arc a at least Cap a times A graph is Eulerian if it admits an Eulerian cycle The Chinese postman problem CPP asks for an eulerian super graph such that the Eulerian cycle has minimum length This p
6. ae 46 Struct Objects e o a oen acao o o o Ro Re 46 6 2 2 Deusetraphs oea se e Rex om 9 m o x 46 6 2 9 Spare Graphs 2 4 5 26 2865 54 4T 6 2 4 Sparse Bigraphs 49 6 2 5 Planarity Issues c 6 66 ee o o o 49 Logical Objects Ro Ro m oo 50 6 3 1 Canonical Flow Networks 51 6 3 2 Layered Auxiliary 8 52 6 3 3 Bipartite Matching Problems as Network Flow Prob Be Vu co rue Ro n rest AMS Rad ox dear ge ed 53 6 3 4 General Matching Problems as Balanced Flow Problems 54 6 3 5 Layered Shrinking Networks 55 6 3 0 Surface Graphs gt lt cca sese aG o o bea d n m s 55 6 3 7 Suboptimal Balanced Flows 56 6 8 8 Making Logical Objects Persistent 57 Derived Persistent 57 OLI Copy ConstPuPbore cuo xk be RE red vum a 58 6 4 2 Mapping Back Derived Graph Objects 58 6 4 3 Line Graphs and Truncation of the vertices 58 6 4 4 Tearing Apart the Regions of a Planar Graph 59 6 4 5 Complementary 60 GAH Dua Graphs OR x 60 6 4 7 Spread Out Planar Graphs 60 6 4 8 Metric Closure 61 6 4 9 Distance Graphs 61 6 4 10 Complete Orientation 61 6411 Induced Oriewtation 42 99 0 62 64 12 Node Splitting lt c ecc ias 42 He em
7. e list of arc directions are specified for mixed graphs only Otherwise this field is filled with constant 0 or 1 18 4 FILE FORMAT FOR GRAPH OBJECTS The incidence lists must be disjoint and cover the integers 0 1 2m 2 2m 1 The node whose incidence list contains the integer a is the start node of the arc a and the node whose incidence list contains the integer a 1 is the end node As mentioned earlier an even index 21 denotes a forward arc 2i 1 is the corresponding backward arc 197 18 4 FILE FORMAT FOR GRAPH OBJECTS 18 4 2 Objectives lt objectives gt objectives commodities lt number of commodities gt bound lt float gt length commO lt float gt commi lt float gt comm lt c 1 gt lt float gt An objective function is cost vector on the arc set of a graph essen tially a set of arc length labels A network programming problem with side constraints asks for certain subgraph such that for each objective the total length does not exeed a respective bound or which minimizes the maximal objective This part has been added to support such problems at least by an ade quate file format So far no algorithms and no internal data structures for problems with multiple objectives are available in GOBLIN and this part should look like objectives commodities 1 bound length commO lt float gt 198 CHAPTER
8. 8 4 DICTIONARIES 8 4 Dictionaries Include file dictionary h Synopsis template class TKey gt class goblinDictionary public goblinData0bject goblinDictionary TIndex TKey goblinController amp TKey Key char TIndex NoIndex void ChangeKey char TKey TIndex NoIndex TOwnership OWNED BY RECEIVER dictionary is the pendant of an hash table which maps arbitrary strings to values of an unspecified type TKey This data structure is obvi ously needed to compute object indices from a tuple of node arc or variable labels The constructor call goblinDictionary 1 k0 CT sets the default value and the maximum number of non zero entries The retrieval operation Key pStr i takes a string and an optional object index to compute a hash value That is dictionaries do not only apply to the inverse mapping problem but also to support free style node and arc labels For the first ap plication no index is specified at all In the second case an index denotes an arc or node and a missing index denotes a constant arc or node labelling Since references are used ChangeKey pStr k i tp operations specify if the dictionary shall work with a copy of the look up string or if the string ownership moves to the dictionary 8 5 Matrices Include file matrix h Synopsis 76 CHAPTER 8 EXPLICIT DATA STRUCTURES template class TItem class TCoeff gt class goblinMatrix public virtual goblinDataObject t
9. class completeOrientation public diGraph completeOrientation abstractMixedGraph amp G TOption options 0 TArc OriginalArc TArc The complete orientation of a mixed graph is the digraph in which every undirected edge of the original object is replaced by a pair of antiparallel arcs If the optional parameter is OPT_REVERSE directed arcs are mapped to a pair of arcs likewise For every arc a in the orientation the origin can be obtained by the call OriginalArc a 6 4 11 Induced Orientation Include file sparseDigraph h Synopsis class induced rientation public diGraph 1 inducedOrientation abstractMixedGraph amp G TOption options 0 62 CHAPTER 6 GRAPH OBJECTS The complete orientation of a mixed graph is the digraph in which every undirected edge of the original graph object is oriented from the smaller node colour index to the higher index Since edges with equal colour indices are omitted this construction can be used to achieve oriented bigraphs An other application is the generation of st orientations from st numberings 6 4 12 Node Splitting Include file sparseDigraph h Synopsis class nodeSplitting public diGraph nodeSplitting abstractMixedGraph amp TOption 0 The node splitting of a mixed graph is similar to its complete orientation In addition every node v of the original graph is replaced by a pair v1 v2 an arc 0102 whose capacity bound is the demand o
10. k 1 the component X is adjacent to has at least two contact nodes in _1 For j 2 k 1 the component X is either a single node or a path Uri Ura Ur with exactly two contact nodes one adjacent to Ur and the other adjacent to v Xy vn consists of a single node Provided that the original graph is simple triconnected and combinatorially embedded not just implicitly planar the call TNode LMCOrderedPartition aLeft aRight vRight returns the following information 122 The number of components The components by the node colours where Colour v is the index of the component of v i 0 1 k 1 The components by the array vRight where vRight v is the right hand neighbor of the node v in its component or NO NODE if v is right most The left most contact arc aLeft i directed to the component i CHAPTER 13 HIGH LEVEL ALGORITHMS e The right most contact arc aRight i directed from the component 1 e no exterior face and basis arc have been defined in advance both data are computed and stored internally See Section 6 2 5 for details about the data structures The running time is O m We only mention that the procedure computes the left most canonical ordered partition and refer to the literature for the mathematical details 13 8 Maximum Flows and Circulations Synopsis class abstractFlowNetwork 1 protected TCap delta public
11. 9 2 Templates Include file indexSet h Synopsis singletonIndex TItem TItem goblinController amp goblinDefaultContext fullIndex TItem goblinController amp goblinDefaultContext voidIndex TItem goblinController amp goblinDefaultContext These three class templates are almost self explanatory TItem represents the template parameter that is the type of indices The constructors require to specify an index range by a TItem valued bound For example 79 GRAPH BASED IMPLEMENTATIONS fullIndex lt TArc gt G M denotes the entire arc set of graph G And singletonIndex TNode G Root O G NQ denotes a set of nodes in the same graph consisting of the predefined root node All classes implement the methods First and Successor in the obvious efficient way 9 3 Graph Based Implementations Include file abstractMixedGraph h Synopsis demandNodes abstractMixedGraph amp colouredNodes abstractMixedGraph amp TNode colouredArcs abstractMixedGraph amp TArc Include file abstractDigraph h Synopsis supersaturatedNodes abstractDiGraph amp deficientNodes abstractDiGraph amp Again the purpose of the listed classes is the obvious But other than the basic templates described in the previous section enumeration of the good indices is not really efficient the default implementations of the base class apply No lists of good indices are allocated If lists are read more t
12. MicaliVazirani and Anstee perform much better than the augmentation methods but neither beats the other methMaxBalFlow 0 Successive augmentation Phase Ordered augmentation Phase Ordered augmentation with look ahead Phase Ordered augmentation with look ahead and augmentation Capacity scaling Cycle canceling Table 13 5 Maximum Balanced Flow Options In the situation of k factor problems Anstee runs in O nm time which is the same as for the basic method BNSAndAugment However it has turned out that Cancel0dd decreases the flow value only by a very small amount probably 10 for 10 nodes Since balanced augmentation steps are con siderably more expensive than ordinary augmentations the method Anstee performs much better than BNSAndAugment in practice Note that the method CancelO0dd has two different implementa tions The general procedure depends on the problem transformation class bal2bal The second simpler implementation is in the class gra2bal and hence applies to explicit matching problems only 13 13 Weighted Balanced Network Flow Algo rithms Synopsis class abstractBalancedFNW 1 WEIGHTED BALANCED NETWORK FLOW ALGORITHMS TFloat MinCBalFlow TNode s TFloat PrimalDual TNode s TFloat EnhancedPD TNode s TFloat CancelPD 13 13 1 The Primal Dual Algorithm The primal dual algorithm for ordinary flows maintains an st flow and a set of potentials which satisfy a reduced length optimality cr
13. TFloat MaxFlow TNode TNode TFloat EdmondsKarp TNode TNode TFloat CapacityScaling TNode TNode TFloat GoldbergTarjan TNode TNode TFloat Dinic TNode TNode bool AdmissibleCirculation CHAPTER 13 HIGH LEVEL ALGORITHMS st flow is a pseudo flow such that every node v s t is balanced Divergence v Demand v A maximum st flow is an st flow such that Divergence s the flow value is maximal There is a generic prob lem solver MaxFlow which chooses one of the methods listed in Table 13 1 according to the value of the context variable methMaxFlow If the context flag methFailSave is enabled a reduced costs optimality criterion is checked that is minimum cut is computed All methods return the maximum flow value 141 2n ZINS V4 2 2 Gu x ucap Figure 13 5 A Maximum Flow Problem 13 8 MAXIMUM FLOWS AND CIRCULATIONS max flow methods have to be started with a feasible st flow Sup posed that all lower bound are zero one can start the solver with the zero flow If you have already compute an st flow and you have only increased some capacity or inserted a new arc no special initialization of the flow labels is required But if the source or target node have changed you have to start with the zero flow again If the lower bounds are non trivial you either need a feasible st flow or you can fix the desired flow value by set ting the demands of the root and the target node and then sear
14. The method abstractGraph ChinesePostman returns an Eulerian sub graph which has maximum weight rather than an Eulerian cycle It calls the method ComputeTJoin which has been described before The method graph ChinesePostman increases the capacities of the graph to a minimal Eulerian supergraph and has been added to preserve the analogy of the directed and the undirected case 13 15 3 The Directed CPP The method diGraph ChinesePostman reduces the CPP to a bipartite b matching problem and the running time is dominated by the matching solver used Note that the method is defined for the sparse implementation diGraph only The procedure does not compute an Eulerian cycle but increases the capacities of the graph to a minimal Eulerian supergraph CHAPTER 13 HIGH LEVEL ALGORITHMS 13 16 TSP Algorithms Synopsis class abstractMixedGraph class abstractGraph TFloat virtual TFloat TFloat TFloat TFloat TFloat TFloat virtual TFloat bool TFloat TFloat virtual TFloat TFloat TFloat bool TFloat TFloat TSP TNode NoNode TSPHeuristics TNode TSPHeuristicsRandom TSPHeuristicsInsert TSPHeuristicsInsert TNode TSPHeuristicsTree TSPHeuristicsTree TNode TSPLocalSearch TArc TSPNodeExchange TArc TFloat 0 TSPSubOptiTree TNode TFloat InfFloat TOption 1 TSPBranchAndBound TNode TFloat InfFloat TSPHeuristics TNode TSPHeuristicsChristofides TNode NoNo
15. public void InitLabels TFloat InfFloat virtual TFloat Dist TNode void SetDist TNode TFloat void ReleaseLabels void WriteLabels goblinExport void ReadLabels goblinImport F Distance labels are not only utilized by shortest path algorithms but more generally to store the length of the paths which are encoded into the prede cessor labels They are also used to specify cuts see Section 11 2 7 A distance label may be read the method Dist and changed by SetDist There is an initialization procedure InitLabels which sets some default value This initilization routine supports the reusage of the data structure to avoid repeated reallocation Note that most algorithms access the data structure directly for reasons of efficiency The methods ReadLabels and WriteLabels admit file import and ex port of the data structure The file format forms part of the general file POTENTIAL SOLUTIONS format for graph objects presented in Section 18 4 Equivalent statements hold for the other data structures described in what follows 11 2 6 Node Potentials Synopsis class abstractMixedGraph protected TFloat pi public void InitPotentials TFloat 0 TFloat Pi TNode void SetPotential TNode TFloat void PushPotential TNode TFloat void UpdatePotentials TFloat void ReleasePotentials void WritePotentials goblinExport void ReadPotentials goblinImport virtual TFloat RedLength TArc Node pot
16. 184 185 18 Persistency 193 18 1 Export of Data Objects 4 2 6225 4 55 RR 193 18 2 Import of General Data Objects 193 18 3 Import of Graph Objects lle 194 18 4 File Format for Graph Objects 196 1841 Dehn lec oco odo 9o 197 154 2 OBJOCUVER se ce 198 1842 1222 rame y 199 1844 Layout o m m9 mk xe 199 18 4 5 Potential Solutions s eca so succore marias 199 IS AD GOBDSMPAEIOH se sa ee a on EUR a 200 18 5 File Format for Linear Programs 200 18 6 Canvas Text 4 201 18 7 Support of Standard File Formats 201 18 7 1 lt o oc uoo o RR ERA 202 15 7 2 Expert Filters 202 19 Exception Handling 203 V GOBLIN Executables 205 20 The GOSH Interpreter 207 20 1 GOSH Besso fees scana e e m RR o n R9 207 20 2 Context Variables gt o c sesca 2l 207 20 3 Command s a ob aa d RR ee ee 208 20 3 1 Ressource Management 209 20 5 2 Thread REESE x 209 20 3 3 Messenger 210 20 3 4 Accessing Timers 2 2200 210 20 4 General Object Messages 211 20 5 Graph Retrieval Messages 212 20 6 Graph Manipulation 212 20 7 Sparse Graphs
17. CHAPTER 13 HIGH LEVEL ALGORITHMS and parallel arcs are embedded in post processing step to prevent from computational overhead The running time of this method is O m and by that O n for planar graphs Currently the required storage can be bounded only by O nm If the input graph is non planar no forbidden configuration is exported yet 13 7 2 Combinatorial Embedding For sparse graph objects a method Planarize exists which calls the pla narity test and then exports a combinatorial embedding to the node incidences To this end the method Planarize is called which actually orders the incidence lists It takes an array which specifies the predecessor of each arc when traversing the regions This array must be filled by any prospective planarization method 13 7 3 Outerplanar Embedding An outerplanar graph is graph which can be drawn in the plane with out edge crossings and such that all nodes are incident with the unbounded region to which we refer as the exterior face The method GrowExteriorFace requires a combinatorial embedding and selects from this embedding a region with the maximum number of adjacent nodes Then all exterior cut edges whose end nodes form cut ting pairs and which are no bridges swapped to the interior By that the number of external nodes strictly increases The running time is bounded by O n If the input graph is implicitly outerplanar a respective combinatorial embedding result
18. Message CHAPTER 20 THE GOSH INTERPRETER linegraph linegraph planar truncate complement underlying dualgraph Spread induced subgraph induced orientation induced bigraph transitive intransitive contraction nodesplitting orientation distances subgraph Object name Export subgraph into a separate object Object name Generate metric closure Object name number of rows number of Generate graph which consists of several copies of the addressed graph columns Compute maximum matching and return its cardinality Compute an edge cover of minimum weight and return this weight Compute minimum t join and return its weight or Compute perfect matching of minimum weight return this weight or CHAPTER 20 THE GOSH INTERPRETER MESSAGES FOR DIRECTED GRAPHS 20 13 Messages for Directed Graphs subgraph Object name Export subgraph into a separate object splitgraph Generate a balanced version of the network flow problem Source target Compute a maximum st flow and return the flow value Source target Compute a maximum st flow of minimum weight and return this weight Compute an admissible circulation or b flow minccirc Compute an admissible circulation or b flow of minimum weight and return this weight 20 14 Messages for Bipartite Graphs oF the Toft hand component SSS oF the right hand component 20 15 Messages for Balanced Flow Networks maxbalflow Compute a maximum balanced st
19. The constant edge length is either passed explicitly or given by the context parameter nodeSep The procedure is intended for drawing regular polyhedra including Pla tonic solids after unrolling the surface to plane EQUILATERAL DRAWING 109 12 7 EQUILATERAL DRAWING CHAPTER 12 GRAPH DRAWING 110 CHAPTER 13 HIGH LEVEL ALGORITHMS SHORTEST PATH ALGORITHMS 13 1 Shortest Paths Synopsis class abstractMixedGraph 1 Chapter 13 enum TOptSPX SPX DEFAULT 1 SPX FIFO 0 e e High Level Algorithms SPX_BFS 3 SPX_DAG 4 SPX_TJOIN 5 This chapter shows how GOBLIN problem solvers are called and configured It also includes a brief introduction to the respective problem settings and to the general ideas behind the algorithms implemented With some text ari TOptSPXChar book about graph theory at hand and using the GOBLET browser any SPX PLAIN 0 interested people should be able to understand the source code SPX SUBGRAPH 1 For the most problems the implemented algorithms do not reflect the SPX RESIDUAL 2 current state of research But the library covers all of the standard prob SPX REDUCED 4 lems and careful implementations of all of the algorithms which one can find SPX REDUCED RESIDUAL 6 in text books about graph optimization The non weighted matching code which was the original authors research interest clearly stands out Up to the max cut and the Steiner tree codes which can only be viewed b
20. The extra assignment is needed to reconstruct a valid pointer later The parameter Orientation is needed only for access to the current bases or tableaus of LP instances Then a return value of ROW_ORIENTED indicates that restrictions are treated as artificial columns whereas COLUMN_ORIENTED indicates that variables also form restrictions Row and column indices are partially orientation dependent 16 1 PUBLIC INTERFACE 173 16 1 PUBLIC INTERFACE 16 1 2 LP Instance Retrieval Operations Include file ilpWrapper h Synopsis class goblinILPWrapper virtual TRestr KO virtual TVar LO virtual TIndex NZO 0 virtual TFloat Cost TVar virtual TFloat URange TVar virtual TFloat LRange TVar virtual TFloat UBound TRestr virtual TFloat LBound TRestr enum TVarType 1 VAR FLOAT 0 VAR_INT 1 VAR_CANCELED 2 virtual TVarType VarType TVar virtual TObjectSense ObjectSense virtual TFloat Coeff TRestr TVar virtual TVar GetRow TRestr TVar double virtual TRestr GetColumn TVar TRestr double virtual char VarLabel TVar TOwnership virtual char RestrLabel TRestr TOwnership 174 CHAPTER 16 LINEAR PROGRAMMING SUPPORT A goblinILPWrapper object models a general form linear program minimize Tx subject to lt lt l lt a lt u with the dual form maximize aT y bT y tl 24 subject to A y_ y4 2 24 Y Y Z 2 20 Each of the vectors a b and may includ
21. When passing an object pointer by a method call or returning an object pointer it may be necessary for permanent access to specify which context owns the passed object e If the calling context specifies OWNED BY SENDER and passes an ob ject pointer the message receiver must make a copy of the object for permanent access If the calling context specifies OWNED BY RECEIVER and passes an ob ject pointer the passed object is already a copy or not needed by the message sender any longer If the calling context specifies OWNED BY SENDER and an object pointer is returned the method instanciates a copy to which the returned pointer refers e If the calling context specifies OWNED BY RECEIVER and an object pointer is returned the calling object either does not use the reference on the long run or makes a copy That is the SENDER denotes the sender of the message rather than the sender of the object pointer 41 5 4 OWNERSHIP OF OBJECTS 42 CHAPTER 5 PRELIMINARY STATEMENTS CHAPTER 6 GRAPH OBJECTS Chapter 6 Graph Objects Graph objects can be devided into three groups Abstract classes which hold mathematical methods and prototypes for implementations persis tent classes which can be written to and read from a file and logical classes which hold the problem transformations which are so important in network programming Figure 6 1 shows the GOBLIN classes which model abstract graph objects and logical views A
22. and problem reduction principles are defined by dedicated logical classes We concentrate on the specific data structures and functionality of persistent graphs 6 2 1 Struct Objects Include file graphStructure h The various sparse graph object classes are not defined independent from each other but are composed of a sparseGraphStructure object In the same way dense graph objects are composed of denseGraphStructure ob jects Both of the mentioned classes inherit by a class genericGraphStructure in which most graph data structures are defined Capacities arc length la bels node demands geometrical embedding into the plane arc orientations There are methods for loading a data structure changing values handling default values and bounds Note that persistent graphs do not inherit from denseGraphStructure or sparseGraphStructure objects but have such a component object This avoids multiple inheritance but makes it neccessary to repeat the declara tion of many methods in every class of persistent graph objects To avoid such repetitions there are special include files named geninc h spsinc h dnsinc h which declare the interface between struct objects and graph objects 6 2 2 Dense Graphs Include file denseStructure h Synopsis class denseGraphStructure public genericGraphStructure 1 void NewSubgraph TArc void ReleaseSubgraph CHAPTER 6 GRAPH OBJECTS TFloat Sub TArc void AddArc TArc TFloat void Om
23. hash table includes the choice of k a hash func tion which maps the index set 0 1 r 1 onto the 0 1 s 1 so that the preimages of any two indices have approximately equal size and a strategy for resolving collisions between two indices which need to be stored but which have the same image In the class goblinHashTable collisions are resolved by search ing through implicit set objects which model the images the hash value is the remainder modulo s and s 21 The constructor call goblinHashTable r 1 k0 specifies the dimensions r and a default value ko for the vector entries There are only two operations to be described here statement Key i returns the current vector entry at index 7 and statement ChangeKey i k would change this vector entry to k In practice only a few collisions occur so that one can treat these operations as if they were elementary But note that Key and ChangeKey operations take O s steps in the worst case A drawback of hash tables is that the number must be known a priori or reallocations occur Two main applications of hash tables in GOBLIN are adjacency matrices of sparse graphs and sparse subgraphs matchings paths trees of geometrical graphs Here the maximum size can be easily determined Additionally sparse matrices are implemented by hash tables The template parameter TItem must be an unsigned integer type but there are no restrictions about the data type TKey 75
24. 1 GOBLET Next type Control d in order to switch to the navigator mode You now can access a couple of images which illustrate the process of computing the strong components More explicitly these images show the iterated depth first search trees If you like you can print any of the displayed images by typing Control p If you do not like to generate such intermediate results you can turn off the tracing functionality by selecting Browser gt Tracing Options No Tracing gt Reset gt Done If you want to see a descriptive log file select Browser gt Logging Options gt Detailed Information gt Done restart the computation by Control c and display the log file by Contro1 1 In this example the logfile does not provide much additional information compared with the figures In general it contains informations about re cursive method calls search orders variable assignments and which is also helpful about the writing of trace images 22 CHAPTER 3 GETTING STARTED GOBLET strong4 modified File Edit Compose Layout Optimize Browser gm te 87 81 87 85 81 LP d e je B S ab a Starting 605 interpreter Threaded evaluation of hone chris trace strong4 tcl Computing strongly connected components Generating forward ra tree Component 0 0 7 6 13 12 18 19 14 20 21 15 9 8 Component 1 16 Component 2 22 Component 3 23 Componen
25. 1 Random Digraphs The tool rgraph generates directed graphs The option euler can be used to obtain Eulerian digraphs For example rdigraph n 5 m 6 randUCap 1 randLCap 1 examplel would generate a flow network with 5 nodes 6 arcs and random upper and lower capacity bounds and rdigraph n 5 m 22 euler randParallels 1 example2 would generate an Eulerian digraph with 5 nodes and 22 arcs Note that the randParallels 1 option cannot be omitted here since a simple digraph on 5 nodes may only consist of 20 arcs 21 3 2 Random Bigraphs The tool rbigraph generates bipartite graphs The option regular can be used to obtain regular bigraphs In that case the n and the m option are immaterial Otherwise the size of both partitions is passed by the n option For example rbigraph n 3 4 m 5 randLength 1 example3 would generate a bigraph with 5 arcs 3 outer nodes 4 inner nodes and random length labels On the other hand rbigraph regular 3 2 example4 would generate a 2 regular bigraph with 6 arcs 3 outer nodes and 3 inner nodes That is the regular option replaces or overrides the n and the m option 230 CHAPTER 21 SOLVER APPLICATIONS 21 3 3 Random Graphs The tool rgraph generates undirected non bipartite graphs There are two additional options euler and regular to obtain Eulerian and regular graphs respectively For example rgraph n 5 m 6 example5 would generate a sparse graph with 5 nodes and
26. 2 The Directed GPP 13 16 TSP Algorithms 13 16 1 The Insertion Heuristics 13 16 2 The Tree Approximation 13 16 3 The Christofides Approximation 13164 Local 2129 138 13 16 5 The Subgradient Method by Held and Karp 138 13 16 46 Brauch and 2 22229 cm 139 13 16 7 Application to Sparse 139 13 17Graph Colourings and Clique Covers 139 13 18Stable Sets and Cliques 141 13 19Discrete Steiner Trees 141 13 20Maximum Edge Cuts 142 IV Miscellaneous 145 14 The Object Controller 147 INN Construction 147 14 2 Interaction with Data 147 143 LOWE Eom odo B RE CE Ee der 148 14 2 1 Event Handlers e e ooo o xs 148 14 3 2 Writing Log Entries 149 14 3 3 Structured Source Code 151 14 3 4 Filtering the output lt o css 151 14 3 5 Selection of logging information 152 14 4 Method 5 158 144 1 Optional Data Structures gt e lt i so ng 154 14 4 2 Solver Options for NP hard problems 154 14 4 3 Problem Specific Solver Options 155 TA we 156 14 5 1 Trace Level Options 0 4 157 14 5 2 Tracing Data Structures ao oiu seaca doia sau 157 14 6
27. Active H v a G Read H v TNode w G EndNode a if G Dist w lt InfFloat amp amp G Length a gt L L G Length a J CHAPTER 7 ITERATORS Close H The latter approach requires additional effort for dereferencing the iterator The benefit is caching of the used iterator which effectively decreases the effort of memory allocation and defragmentation The method Investigate returns a handle to an iterator object If there is a cached iterator the cached object is initialized and the handle is returned Otherwise a new iterator is allocated and assigned to a handle The method Close THandle finishes a graph search If the cache space is exhausted the iterator is disallocated Otherwise the iterator object is cached and can be reused later If the Close statement is omitted GOBLIN will return an error when the referneced graph object is deleted The method RelaseIterators deletes all cached iterator objects This method is called by destructor methods automatically The Reset Read and Active operations work just as if the iterator would be accessed directly The most efficient way to work with iterators is to combine the caching functionality with explicit access as described in the previous section This is accomplished by the method Iterator THandle which returns the ad dress of the iterator object associated with some handle 7 4 Implementations IMPLEMENTATIONS most graph objects Such an iterato
28. Disjoint set families can be traced graphically see Section 14 5 for some more details The method Reversible helps to distinguish the two avail able implementations at run time The notation refers to the fact that shrinking families allow to expand sets in the reverse order 74 CHAPTER 8 EXPLICIT DATA STRUCTURES 8 2 1 Static Disjoint Set Systems Include files setFamily h setFamily cpp Find v operation runs in O 1 amortized time That is the running time can be considered constant if the the total number of Finds is large enough If the number m of Finds is small a worst case bound is O a m n where a denotes some inverse of the Ackermann function In practice Find v operations can be considered to be elementary operation This data structure is particularly useful for non weighted matching al gorithms 8 2 2 Shrinking Families Include files shrinkingFamily h shrinkingFamily cpp Synopsis template class TItem gt class shrinkingFamily public goblinDisjointSetSystem lt TItem gt 1 shrinkingFamily TItem TItem goblinController amp thisContext goblinDefaultContext void Bud TItem TItem MakeSet void Merge TItem TItem void FixSet TItem bool Top TItem TItem Set TItem TItem First TItem TItem Next TItem CHAPTER 8 EXPLICIT DATA STRUCTURES void Split TItem void Block TItem v void UnBlock TItem v This data structure is required for weighted matching solvers and
29. Shortcut Effect Section Insert Arcs Ctrl a Left button click selects start node Subsequent clicks place bend nodes Final 6 2 3 click selects end node Then the arc label can be placed by another left button click Alternatively a right button click enables automatic alignment of the arc label only available if no bends are present Insert Nodes Left button click in unoccupied area inserts a new graph node 6 2 3 Redirect Arcs Ctrl r For sparse graphs only Left button click reverts any directed arc right button 6 2 3 ges it sand vor eta o Incidences Reorder Manually Ctrl i For sparse graphs only Left button on a node steps over its incidences right 6 2 3 mE button click admits to change the ordering Incidences Planar Ordering For sparse planar graphs Compute a combinatorial embedding This operation 13 7 __ aes mor produe pte daming o e operan Delete Objects Left button click on existing graph nodes and arc labels deletes objects 6 2 3 Explicit Parallels For sparse graphs only Replace edges with non unit capacity labels by simple 6 2 3 EE parallel arcs Move Nodes Edit Labels Ctrl e Left button click on nodes and arc labels opens a dialog to manipulate the labels 11 2 SUNS ita teased wth graph modes edam Set Colours Left button click decreases right button click increases the colour index of the 11 2 7 EN T or aage eR Set Predecessors Left button
30. Tcl variables If you want to access goblinMethSolve within a procedure you have to declare this variable by global goblinMethSolve 207 20 3 ROOT COMMAND CHAPTER 20 THE GOSH INTERPRETER 20 3 Root Command After its initilization a GOSH interpreter provides only one new command compared with Tcl Tk There is a many to one correspondence between GOSH interpreters and GOBLIN controller objects options of the root command goblin manipulate the controller or generate a new GOSH command and by that a new object Example goblin sparse digraph G 10 G generate arcs 20 The first command generates a directed graph with 10 nodes whose T cl name is G Initially this graph does not contain any arcs Hence the second command is used to generate 20 random arcs for G If you want to generate bipartite graphs specify the number of nodes in each component ese logging and tracing module some context flag Object name file name Read graph object from file mixed graph Object name number of nodes Generate graph object sparse graph sparse digraph sparse bigraph dense graph dense digraph dense bigraph ilp Object name number of rows number of variables Generate mixed integer linear program 1 Read data object from file and translate it to canvas Uses a separate context input file name output file name optional integer Similar but export to a text based form Mainly used for linear programs export setting
31. University of Augsburg and Priv Doz Bernhard Schmidt for several helpful talks and their suggestions Bernhard Schmidt has also contributed the GOBLET overview to this document Prof Fernando de Oliveira Durao Technical University of Lisboa has prepared a self installing GOBLET 2 5 package for Windows 98 2000 XP The tree packing method and the ATSP subgradient optimization which is new in GOBLIN 2 2 is written by Markus Schwank University of Augs burg The basic LP simplex code which is attached to this release has been written by Priv Doz Bernhard Schmidt and integrated by Christian Fremuth Paeger Birk Eisermann University Augsburg has contributed a planarity test a makefile revision and a doxygen configuration file for release 2 6 2 Further informations about code authors can be obtained by using the module browser in the GOBLET application CHAPTER 2 INSTALLATION Chapter 2 Installation 2 1 Licence Agreement The GOBLIN core library was written by Christian Fremuth Paeger Department of Mathematics University of Augsburg Germany E Mail Fremuth Math Uni Augsburg DE C Dr Christian Fremuth Paeger et al 1998 2005 For details about the contributions by other authors see Section 1 7 copyrights remain with the authors GOBLIN is open source software and covered by the GNU Lesser Public License LGPL That is GOBLIN may be downloaded compiled and used for scientific educational and other purposes free o
32. a value of 1 if the expected time between two breakpoints is O 1 and a value of n m if the expected time is O nm for example A data object can be traced only if its class implements a method Display which should show relevant information encapsulated into the object The object to be displayed should reveal some relevant information about the course of an algorithm and the breakpoint should be placed right behind an update of this object Sometimes it may be useful to have more than one breakpoint in order to trace different objects For example the Dinic maxflow algorithm contains two breakpoints CT Ping Aux Handle m and CT Ping Handle m The first one is placed between the construction of the layered auxiliary network Aux which actually is displayed and the augmentation step The second breakpoint displays the flow network which has been augmented just before To use the tracing functionality and the graphical display make sure that the _TRACING_ pragma is defined in config h If this pragma is un defined the breakpoints are still found but only trace level 1 is available 14 5 1 Trace Level Options 14 5 TRACING 0 A dot is written to the standard output device 2 As before but a method Display O is called by the construc tors of classes which support this functionality Display ei ther writes information in tabular form to the standard output device or graphical information to trace files which c
33. all transitive arcs whose end nodes are connected by a directed path with at least two arcs length The running time is O nm If the option OPT_SUB is specified the input graph is encoded by the edge colours 6 4 19 Intransitive Reduction Include file sparseDigraph h Synopsis class intransitiveReduction 1 public diGraph intransitiveReduction abstractDiGraph amp TOption 0 For a given acyclic digraph G the constructor intransitiveReduction G opt determines a maximal subgraph without any transitive and parallel arcs The running time is O nm If the option OPT SUB is specified the in put DAG is copied and the intransitive subgraph is encoded by the edge colours 6 4 20 Explicit Surface Graphs Include file nixedGraph h Synopsis class explicitSurfaceGraph 1 public mixedGraph explicitSurfaceGraph abstractMixedGraph amp shrinkingFamily lt TNode gt amp TFloat TArc 6 4 DERIVED PERSISTENT OBJECTS This class has been added for the graphical tracing of the Edmonds span ning arborescence method only In a future release it may also be used to trace matching algorithms The constructor parameters are the digraph for which the arborescence is computed the current shrinking family the modified length labels and the predecessors of the original digraph 6 4 21 Voronoi Diagram Include file sparseGraph h Synopsis class voronoiDiagram public graph voronoiDiagram abstractM
34. and bound is enabled this applies to the original graph No candidate search is performed but the entire graph is evaluated Random tour Insertion heuristics Tree heuristics methTSP Christofides undirected graphs only Straight 1 tree bound Subgradient optimization fast Subgradient optimization stable methRelaxTSP1 Table 13 7 TSP Solver Methods 13 17 Graph Colourings and Clique Covers Synopsis class abstractMixedGraph TNode NodeColouring TNode TNode PlanarColouring TNode NCLocalSearch bool NCKempeExchange TNode TNode TNode TNode CliqueCover TNode TNode EdgeColouring TNode 140 CHAPTER 13 HIGH LEVEL ALGORITHMS A node colouring is an assignment of colours to the graph nodes such that the nodes with equal colour are non adjacent A clique cover is an assignment of colours to the graph nodes such that every colour class forms a clique The procedure NodeColouring calls the enumeration scheme which is described in Section 10 3 4 The parameter denotes the acceptable number of colours This value k has strong impact on the practical performance of the solver For example for a planar graph and a value of 6 the branch and bound would end within a single iteration If k is very close to the chromatic number x the computational efforts are tremendous even for 50 node graph In the case of k 5 and n 3m 6 the method PlanarColouring is called and enumeration occurs only i
35. and does not use any high level data structures It runs in O n time but performs better than the Kocay Stone algorithm up to a size of 5000 nodes approximately Just as the other heuristics BNSHeuristicsBF does not compute a dual solution odd set system 13 11 3 The Depth First Heuristics by Kameda and Munro This is the most efficient method according to our experiments and runs in O m time It utilizes two stacks for the management of blossoms instead of a disjoint set system Both version are only an heuristics which may miss to find a balanced augmenting path even if there is one The enhanced version requires some additional storage for time stamps but misses a node only in pathological situations 13 11 4 The Algorithm by Micali and Vazirani This method finds the distance labels with respect to the specified root node in O m time It depends on layered auxiliary shrinking networks into which the shortest augmenting paths are encoded For the time being no st path is extracted to the prop and petal data structures methBNS 0 Breadth First Kocay Stone Depth First Heuristics 1 2 Depth First Heuristics Time Stamps 3 Breadth First Heuristics Table 13 4 Balanced Network Search Options 131 13 12 MAXIMUM BALANCED NETWORK FLOWS 13 12 Maximum Balanced Network Flows Synopsis class abstractBalancedFNW x TFloat MaxBalFlow TNode TFloat BNSAndAugment TNode TFloat BalancedScaling TNode TFloat A
36. arc is deleted its alignment point and all interpolation point are deleted recursively If a node is deleted all incident arcs are deleted recursively Example 215 20 9 GRAPH NODE AND ARC MESSAGES CHAPTER 20 THE GOSH INTERPRETER for set 0 a lt G arcs incr 1 set a2 expr 2 a if G arc a2 head arc a2 tail set 0 node arc a2 head cx set 0 node arc a2 head cy arc a2 set align 0 expr 0 10 G arc a2 interpolate expr x0 10 expr y0 10 arc a2 interpolate 0 expr y0 20 G arc a2 interpolate expr x0 10 expr y0 10 checks the graph for loops which cannot be displayed without interpolation points For every loop an alignment point for the arc label and three interpolation points for a spline drawing are defined Whenever undefined or infinite labels are needed they are replaced by an asterisk 20 9 1 Node Based Messages cde colour 216 CHAPTER 20 THE GOSH INTERPRETER 20 9 GRAPH NODE AND ARC MESSAGES 20 9 2 Arc Based Messages Return further arc with the same start node Return the label alignment point index or Generate an alignment point with the given coordinates Check if the arc is displayed Manipulate one of the listed arc ressources 217 GRAPH OPTIMIZATION MESSAGES CHAPTER 20 THE GOSH INTERPRETER 20 10 Graph Optimization Messages The Tcl API of the C problem solver methods on script level is obv
37. ation performs a Resize with the actual problem dimensions The obvious purpose of this functionality is to save memory re allocations Any possible implementation class other than the native goblinLPSolver may ignore these implicit problem dimensions up to that adding rows and variables must be possible even if this requires a realloca tion An AddRestr operation sets a lower and an upper bound an AddVar operation sets the bounds the cost coefficient and a variable type in that order The variable type must be VAR INT or VAR FLOAT The matrix coef ficients associated with a restriction and variable are initialized as zero and have to be set one by one using SetCoeff Deleting rows DeleteRestr or variables DeleteVar may not change the remaining indices It essentially marks the row or column as canceled If deletions cannot be implemented otherwise a delete operation may zero out rows and columns Calling FlipObjectSense changes the object sense and inverts the objective vector By that optimum solutions are preserved but the objective value changes Calling SetObjectSense MAXIMIZE or SetObjectSense MINIMIZE only changes the object sense whereas Set bjectSense NO OBJECTIVE assigns a zero objective vector The implementation of the other methods is obvious Specifying incom patible bounds should raise an exception If setting a matrix coefficient corrupts the active basis this should be checked by the next ac
38. click selects a node whose predessor arc can be deleted click right 11 2 1 button or replace by another arc click with left button on an adjacent node or incident arc p Randomize Add Arcs Add a specified number of random arcs to the current graph Randomize Add Eulerian Cycle Add to the current graph a random Eulerian cycle of specified length Randomize Make Graph Regular Complete the current graph to k regular graph For this goal the degrees in the current graph must not exeed k and k must be even if the number of nodes ls even Randomize Random Generator Ctrl R Generate random labels for the existing graph nodes and arcs and or config ure the random generator which is also used for arc insertions and the graph composition described in this menu 29 44 LP EDITOR DIALOGS MENU ITEM EDIT CHAPTER 4 THE GOBLET GRAPH BROWSER 4 4 LP Editor Dialogs Menu Item Edit Option Shortcut Effect Section Edit Columns Ctrl C Dialog for variable based data Bounds cost coefficients labels Mark variables as float or integers Edit restriction matrix Edit Rows Ctrl R Dialog for restriction based data Right hand sides labels Edit restriction matrix Reset Basis Ctrl4 X Basis solution is set to the lower variable bounds Pivoting Ctrl4 P Perform pivoting steps manually 4 5 Composing Graphs Menu Item Compose The composition methods in this pulldown menu generate a new object from
39. declared public 5 2 Base Types There are a few GOBLIN objects which are rather basic values than in stances of a C class The corresponding types can be configured at compile time We just considered late binding and dereferencing to be too expensive operations at that low logical level 5 2 1 Nodes Graph nodes are distinguished by their indices which are integers of a spe cial type TNode The sequence of node indices associated with a graph is 0 1 n 1 where n is a protected instance variable of every graph ob ject In addition to the nodes of a graph a global constant NoNode is defined for the management of undefined node references This constant appears in GOBLIN files and in GOBLET as an asterisk In bipartite graphs the node set splits into outer nodes and inner nodes The outer nodes have the indices 0 1 n1 1 the inner nodes have the indices n1 ni 1 ni n2 1 Again and n2 are protected instance variables of a bigraph object and satisfy n n1 n2 In balanced flow networks nodes are arranged in complementary pairs which consist of one outer node and one inner node The comple 39 5 2 BASE TYPES mentary node v of the node u can be obtained by the operation v u 1 that is by changing the least significant bit With every graph up to three special nodes can be associated These nodes can be accessed by the methods SourceO Target For physical objects but not for problem transformation
40. definitions In contrast to general partitions complementary nodes are always in the same part of thepartition The method Base does not return an arbitrary canonical element but a special node which is called the blossom base This node can be defined algorithmically as follows Bud v implies that Base v v If one has Base u v and Base then the operation Shrink u x implies that Base x v That is the first param eter of Shrink determines the blossom base 11 2 10 Props and Petals Synopsis class abstractBalancedFNW X protected TArc prop TArc petal public void InitProps void ReleaseProps void InitPetals void ReleasePetals 99 11 3 MANIPULATING GRAPHS Props and petals determine augmenting paths in a balanced flow network The labels are set by the balanced network search methods which are dis cussed in Section 13 11 Augmenting paths can be extracted by the recursive call of the methods Expand and CoExpand The resulting path is assigned to the predecessor labels 11 2 11 Odd Cycles Synopsis class abstractBalancedFNW 1 protected TArc Q public void InitCyclesO void ReleaseCycles D This data structure is used quite analogously to the predecessor labels in particular to store a system of disjoint cycles in a balanced flow network These odd cycles occur during the symmetrization of the flow labels and denote the arcs with non integral
41. demands are zero The applied method can either be primal that is it starts with de termining an arbitrary feasible b flow This solution is improved iteratively and stays feasible throughout the computation Or the solver applies an SAP like algorithm to the b flow problem with the slight difference to the st flow solver that multiple terminal nodes occur This stems from the fact that only complementary slackness but not primal feasibility is maintained and that all supersaturated nodes are sources when searching for shortest augmenting paths The general drawback of SAP methods is that the running time com plexity is polynomial only if the number of augmentations can be bounded polynomially When optimizing from scratch this is true for the capacity scaling method only The generic solver methods MinCostSTFlow and MinCostBFlow ac cept optional parameters in order to specify a particular algorithm If these parameter are omitted the context variables methMinCFlow and methMinCCirc apply The possible values match the symbolic enum val ues which are listed above In all possible configurations the solvers check if the node demamds sum up to zero and raise an ERRejected exception otherwise If the problem is infeasible for other reasons InfFloat is returned All methods preserve optimal flows as far as possible As an exception starting b flow SAP codes with an optimal b flow but with suboptimal node potentials may lead to a di
42. file directly EXPLICIT DATA STRUCTURES Figure 8 1 Fibonacci Heaps 8 1 Container Objects Include file goblinQueue h Synopsis template class TItem class TPriority gt class goblinContainer public virtual goblinData Object 1 virtual void Init 0 Insert TItem TKey 0 ChangeKey TItem TKey 0 Delete 0 Peek 0 Empty Cardinality 0 virtual void virtual void virtual TItem virtual TItem virtual bool virtual TItem 71 8 1 CONTAINER OBJECTS Container objects are either set or multiset objects One can also classify containers into queues stacks and priority queues by the order in which elements can be deleted The members of a container are TItem objects which are inserted and deleted by the listed prototype methods The second template parameter TKey is the optional priority of the members of a priority queue It is de clared in a more general context to preserve compatibility among the various container classes The same holds for the operation ChangeKey Example binaryHeap lt TArc TFloat gt QMO for a 0 a lt M at Q Insert a Length 2 a while Q Empty 1 Q Delete effectively sorts the arcs of a graph object by their length labels This is simply done by putting the arcs on a priority queue from where they are taken for further processing All GOBLIN container classes are defined by templates That is the member type TItem is abstract This type is not
43. first search strategy in O m time Then NWSimplexStrongTree computes a strongly feasible spanning tree structure from any given cycle free b flow in O m n time The main functionality is located in a separate class networkSimplex especially the management of spanning tree indices and the data structures which are needed for the pricing step The initilization phase ends by calls to methods InitThreadIndex and ComputePotentials of this class which take O n steps together If the network simplex method is started with a cycle free solution the neccesary data are reconstructed without modifying the b flow The cyclic part consists of alternating calls to PivotArc and PivotOperation The pivot arc determination takes O m steps and the pivot step O n steps The practical perfomance depends on a good pric ing rule which is fixed by the context parameter methNetworkPricing All possible rules are based on the idea of choosing the arc with the most negative reduced length for pivoting By the Dantzig rule all arcs are considered By the partial pricing and the multiple partial pricing rules only a few arcs are considered The extreme case is the first eligible arc rule where only one admissible pivot arc is generated The network simplex code performs much better than the cost scaling method up to the case where Dantzigs rule is applied The other rules show a similar performance and partial pricing performs best of all methods 13
44. flow return the flow value mincbalflow Source Compute a maximum balanced st flow of minimum weight and return this weight 221 LINEAR PROGRAMMING CHAPTER 20 THE GOSH INTERPRETER 20 16 Linear Programming 20 16 1 Instance Manipulation Messages Message as minimization problem p ER 935 Mark as maximization problem nullify file resize Number of rows number of columns number of non Reallocate MIP instance with the specified dimensions zero coefficients sp SSCS Relocate fustance within minimum of memory set coeff or coefficient row index column index float Set a coefficient in the restriction matrix value MEN index row index variable index upper or lower Specify a basis restriction preset Reset basis to the lover variable range restrictions Invert the object vector and sense Dismiss the objective vector 222 CHAPTER 20 THE GOSH INTERPRETER 20 16 LINEAR PROGRAMMING 20 16 2 Instance Retrieval Messages and Basis Access Message Operation Return Value lp mps cplex bas or basis file name Write instance or basis to file rows or The number of restrictions femen columns or The number of variables eene LLL Pd orientation row or column direction maximize or minimize ow or restriction rection coeff or row index variable index A coefficient of the restriction matrix coefficient 20 16 3 Row and Column Based Message
45. flow algorithms implemented 13 8 4 The Push amp Relabel Algorithm by Goldberg and Tar jan This method iteratively chooses an active node that is a node v which has Divergence v gt Demand v This node can either be relabeled so that the distance label increases or a certain amount of flow is pushed to an appropriate neighbour of v The procedure GoldbergTarjan supports three different strategies e If methMaxFlow 2 active nodes are selected by a FIFO strategy and an O n algorithm results e If methMaxFlow 4 the set of active nodes is restricted to nodes whose flow excess exeeds a lower bound This bound is decreased everytime when no more active nodes exist This strategy is known as excess scaling The running time is bounded by O nm n log U e Otherwise the active nodes are stored on a priority queue and the priority of a node increases with its distance label Here the context variable methPQ determines the used PQ data structure and the best possible complexity bound is In either case several push operations from a selected active node are per formed and if no further push is possible the node is relabelled immediately We have experienced that the push amp relabel technique can be even more efficient than blocking flow algorithms but only if no flow has to be pushed back to the source node In odd cases not even a percent of the running time is needed to send the maximum flow to the sink no
46. ful for the writing of preliminary versions of graph implementations 11 1 2 Arc Capacities and Node Demands Synopsis class abstractMixedGraph 1 virtual TCap UCap TArc 0 virtual TCap MaxUCap O virtual bool CUCap 0 virtual TCap LCap TArc 0 virtual TCap MaxLCap virtual bool CLCap 0 virtual TCap Demand TNode virtual TCap MaxDemand virtual bool CDemand Arc capacities and node demands are numbers which determine the set of feasible subgraphs respectively flows of a network programming problem Although not checked exhaustively in GOBLIN arc capacities and node demands are supposed to satisfy some properties 92 CHAPTER 11 PROTOTYPES AND DATA STRUCTURES For digraphs and flow networks the node demands must resolve that is the sum of demands must be zero The arc capacities have to be non negative but may be non integral or even infinite Needless to say that the lower bounds should not exeed the respective upper bounds For undirected graphs all arc capacities and node demands must be non negative numbers which are either integral or infinite The sum of the node demands must be an even number which is at most twice the sum of the arc capacities The methods MaxUCap MaxLCap MaxDemand return the respective max imum label and the methods CUCap CLCap CDemand decide whether the labels are constant or not 11 1 3 Length Labels Synopsis class abstractMixedGraph 1 virtual
47. goblinMatrix TItem TItem throw TItem TItem LO void Transpose virtual void SetCoeff TItem TItem TCoeff 0 virtual TCoeff Coeff TItem TItem 0 void Add goblinMatrix amp void Sum goblinMatrix amp goblinMatrix void Product goblinMatrix amp goblinMatrix amp void GaussElim goblinMatrix amp TFloat 0 GOBLIN matrices are declared with two template parameters The first parameter TItem specifies the type of row and column indices the second TCoeff specifies the type of the matrix entries The only precompiled tem plate instance uses TIndex indices and TFloat coefficients There is a base class goblinMatrix which declares the mathemat ical functionality and two implementational classes denseMatrix and sparseMatrix which merely have to implement the methods Coeff and SetCoeff O The sparse implementation is based on hash tables Each matrix has a row dimension K and a column dimension LO Ma trices can be transposed implicitly by using Transpose without affecting the physical representation The very basic matrix algebra is implemented by the methods Add O Sum and Product The adressed matrix object denotes the place where CHAPTER 8 EXPLICIT DATA STRUCTURES the results are stored Either two input matrices are passed as parameters or the adressed matrix also acts as an input The running time complexities are O kl and O klm where m denotes the number of right hand columns The metho
48. graph theoretical methods but also models abstract flow net works which supply lot of additional functionality e hesidual capacities ResCap TArc e Node imbalances Div TNode e Computation of path capacities FindCap TArc TNode TNode e Push operations Push TArc TFloat and AdjustDegree TArc TFloat e Augmentation Augment TArc TNode TNode TF1oat e Max flow algorithms Push Relabel augmentation capacity scaling e Min cost flow algorithms SAP cycle canceling cost scaling minimum mean cycles These methods are defined in the file absdig cpp There are further defini tion files including network flow algorithms which directly utilize a special problem transformation e auxnet cpp Defines layered auxiliary networks which form part of the well known Dinic max flow algorithm This file also defines the method abstractFlowNetwork Dinic TNode TNode e fnw2fnw cpp The reduction of circulation problems to st flow prob lems abstractFlowNetwork ShortestAugmentingPath TNode TNode 6 1 4 Bipartite Graphs Include file abstractBigraph h Abstract bigraphs inherit from undirected graphs and specify a bipartition by parameters n1 and n2 This parameters can be accessed by the methods N1O and 20 Nodes can be checked to be in one of the components by Outer TNode and Inner TNode respectively Bigraphs overload the matching algorithms by dedicated assignment al gorithms The file big2fnw cpp which defines the reduc
49. in basis or The dual variable value The slack ubound lbound or label ressource value Change one of the listed ressources 224 CHAPTER 20 THE GOSH INTERPRETER 20 16 LINEAR PROGRAMMING 20 16 5 Column Based Messages Message insert Upper and lower bound or variable type cancel urange Lrange type label The variable name index The basis row associated with the variable value The primal variable value mark float int or integer Set variable type set urange lrange cost or label ressource value Change one of the listed ressources 20 16 6 Optimization Messages Message lp primal or dual Solve linear relaxation Solve mixed integer problem primal or dual Determine feasible solution of the linear relaxation Variable index incoming row index upper or lower Move from one basis to another 225 20 16 LINEAR PROGRAMMING CHAPTER 20 THE GOSH INTERPRETER 226 CHAPTER 21 SOLVER APPLICATIONS Chapter 21 Solver Applications One may argue that explicit solver programs are immaterial by the existence of the GOSH interpreter But the overhead for tracing and the graphical display is obvious and the compilation of efficient solvers does not require a Tcl Tk installation GOBLIN executables support the runtime configuration as described in Section 14 8 That is one can control the logging and tracing function ality including the graphical display from the console 21 1 Solver Applicati
50. increases the performance and decreases the binary size should be omitted in the final version of problem solvers 204 Part V GOBLIN Executables 205 CHAPTER 20 THE GOSH INTERPRETER Chapter 20 The GOSH Interpreter The gosh interpreter is based on the Tcl Tk libraries which are the out come of one of the most successful open source projects The Tcl interpreter can process complex scripts but can also be used interactively Without much effort it allows to construct adequate user interfaces for any kind of mathematical software GOSH extends the Tcl Tk scripting language to graph objects in a nat ural way Although Tcl is rather traditional language the windowing commands in Tk and the GOSH graph commands support some of the ideas of object orientation The interpreter is called by the console command gosh and then starts in the interactive mode If the name of a script is passed as a parameter this script is evaluated script example gosh can also be evaluated by typing source example gosh in the interactive mode Note that the Tcl interface of the GOBLIN library does not support all of the library functions but mainly those which were useful for the graph browser GOBLET Note also that the Tcl interface does not check the pa rameter lists of GOSH command exhaustively Inappropriate parameters are detected by the library functions and instructive error reports are avail able by the log file in addition to th
51. installation 17 phase of the Dinic method 52 56 pivot arc 129 pivot cycle 129 planar 49 planar graph 120 planar line graphs 59 pricing rule 130 primal algorithms 127 priority 73 problem relaxation 81 problem variables 81 Proportional growth 107 pseudo flow 95 push and relabel method active node 123 regions 50 return arc 120 root node 81 SAP algorithm 127 segments 120 semaphores 167 shortest path tree 112 shrinking family real items 75 virtual items 75 sparse implementation 46 stable set 141 Steiner nodes 142 Steiner tree 142 strong component 119 strongly connected node pair 119 strongly feasible spanning tree structures 129 INDEX 243 INDEX structural restrictions 174 subgraph 95 cardinality 95 infeasible 95 non optimal 95 weight 95 successor 44 system installation 17 templates 72 terminals 142 thread safe 167 topological erasure 52 tracing point 156 transitive arcs 64 transscript 207 traveling salesman problem TSP 137 triangular graph 24 66 triangulations 121 union find process 74 valid path 131 value st flow 127 variable range restrictions 174 vertex connectivity number 125 vertex cover 141 Visibility representations 107 Voronoi regions 113 weight 142 244 INDEX
52. its task but leaves consistent data structures This does not mean that the method un does all object manipulations which probably would result in very inefficient code It is impossible to formalize the notion of consistency from this general point of view but only when the concrete algorithm or data structure has been specified For example the method abstractGraph ExtractCycles translates 2 factors from the subgraph data structure into predecessor labels If the subgraph is not a 2 factor the method will use the predecessor labels as well but later call the method ReleasePredecessors to guarantee con sistency On the other hand the method abstractGraph ExtractTree TNode x would return some spanning tree via the predecessor labels even if the sub graph contains cycles Nevertheless an exception ERCheck is returned to indicate the special situation If the calling context considers this an error it may release the predecessor labels from its own 203 CHAPTER 19 EXCEPTION HANDLING The detection of GOBLIN errors heavily depends on the presence of the Note that GOBLIN may throw an exception ERCheck even if the pragma pragma _FAILSAVE_ which is defined in the file config h If this pragma _FAILSAVE_ is undefined Hence if algorithms work correctly the definition is undefined no error messages are generated and no errors are detected of _FAILSAVE_ does not change the functionality of a problem solver and This substantially
53. major build This makes some of the comments obsolete but the pack ages TclTk transfig ghostscript and netpbm are still required Start a bash shell or command prompt copy the downloaded file to the Cygwin not Windows root directory change to this directory in the shell and type in WINDOWS SETUP PACKAGE tar xfj goblin lt version gt tbz2 2 8 Windows Setup Package There are currently some efforts to make GOBLIN run out of the box on Windows machines The preliminary setup which is available consists of a compact Cygwin environment not just a Cywin dll Unfortunately this package does not run with any concurrent Cygwin installation because of the path variable extensions Especially latex makes trouble To be safe with other programs running Cygwin check the Windows registry for cygwin keys and values before executing the setup If you have trouble when starting the GOBLET graph browser check the path directories for other cygwini dll s and occasionally change the order of directories If you are already working with Cygwin do not run the setup but revert to the description of the previous section Since the tar and bunzip2 tools forms part of the GOBLIN setup an existing installation can be patched with subsequent versions of the goblin lt version gt cygwin tbz2 binary distribution It is not really a patch since all GOBLIN specific files will be replaced We mention that there are intrinsic problems with file names i
54. may manipulate the addressed object generate new objects from existing or call a solver routine In many cases the correspondence between the Tcl message and the signature of the GOBLIN C4 4 method called is obvious A detailed documentation of the Tcl commands is therefore omitted Message deese and Td command OS Pura S S T SSCS SSCS Retr object ane easter this object as the master object is graph mip sparse undirected directed bipartite balanced Evaluate object type Assign a fle name The above messages apply to all GOBLIN data objects In the following we list the messages for special classes of data objects Currently graph objects and linear problems are covered by the Tcl wrapper The Tcl interpreter adopts the graph polymorphism from the core library 211 20 5 GRAPH RETRIEVAL MESSAGES CHAPTER 20 THE GOSH INTERPRETER 20 5 Graph Retrieval Messages leap lengrh demand cx cy constant Is this a constant labeling EC J Rtn the default source node J Rtn the defilt target node 20 6 Graph Manipulation Messages 212 CHAPTER 20 THE GOSH INTERPRETER PLANARITY MESSAGES Message Parameters Description Check if the subgraph forms a rooted tree Generate predecessor labels o tres Check if the subgraph splits into trees Generate predecessor labels path start node s and end node t Check if s and are in the same connected component of the sub
55. much faster if they are encoded into predecessor labels Hence at least shortest path algorithms and TSP algorithms depend on this data structure There is a public method Pred to read the current predecessor arc of a given node and methods SetPred and InitPredecessors which manipu late the data structure in the obvious way In addition one can assign the complete set of predecessors with a subgraph present by the subgraph data structure There are several such methods each of which requires a special kind of subgraph e ExtractTrees generates a set of rooted trees covering all graph nodes and corresponding to the connected components of the sub graph An exception ERCheck is returned if the subgraph contains cycles e ExtractTree r generates a tree rooted at r If the subgraph is dis connected or if the subgraph contains cycles an exception ERCheck is returned If the context flag methiTree is enabled a unique cycle must exist and r must be on this cycle e ExtractPath u v generates a directed path starting at u and ending at v exception ERCheck is returned if u and v are disconnected in the subgraph of if the connected component of u and v contains branches that are nodes with degree at least 3 e ExtractCycles generates a set of directed cycles which cover all graph nodes Such a subgraph is called 2 factor An exception ERCheck is returned if the original subgraph is not a 2 factor CHAPTER 11 PROTOTYPES AND DAT
56. other potential solutions by the fact that it is implementation dependent That is a subgraph of a sparse graph object is a vector a subgraph of a dense graph object essentially is a hash table and subgraphs of logical views can be defined completely differently More explicitly every class must implement three methods AddArc OmitArc and Sub The first two methods increase respectively decrease the subgraph label by a specified amount If no subgraph data structure is present Sub should return the lower capacity bound Every implementa tion of AddArc and OmitArc has to check that the resulting subgraph still observes the capacity bounds The method SetSub depends on AddArc and OmitArc and can be used to set subgraph labels explicitly On the other hand a subgraph may be infeasible that is node degrees and node demands may differ A subgraph may also be non optimal that is there is a subgraph whose weight gt gt length a sub a is smaller The length of a subgraph can be computed in O m time by Weight O A corre sponding method Cardinality exists which determines the cardinality Yo sub a of a subgraph The method InitSubgraph initializes the data structure with a subgraph identical to the lower degree bound Finally the method AddToSubgraph takes the characteristic vector of the subgraph determined by the predecessor labels and adds it to the subgraph data structure If an optional node v is specified only the way back to th
57. passed and this is actually a root node an arborescence is returned by the predecessor labels If no root node is passed one is selected automat ically The procedure uses the shrinking family data structure see Section 8 2 2 118 CHAPTER 13 HIGH LEVEL ALGORITHMS 13 5 4 Cycle Trees All spanning tree methods described above can be used to compute an r tree In the undirected setting this is a minimum spanning tree of the nodes other than r plus the two shortest edges incident with r In the di rected setting an r tree is an minimum arborescence rooted at r plus the shortest arc entering r When the spanning tree solver is called with the MST ONE CYCLE and root node r it will determine predecessor labels such that r is on the unique directed cycle defined by these labels For every node v not on this cycle there is a unique directed path of predecessor arcs connecting the cycle and v The worst case complexities are the same as for constructing ordinary spanning trees 13 5 5 Tree Packings The method TreePacking TNode determines a maximum cardinality set of pairwise disjoint arborescences rooted at a specified node If the arc ca pacities are non trivial the algorithm computes some tree capacities and for every arc the sum of the tree capacities satisfies the capacity bound If the main procedure TreePacking is called the tree capacities are provided by the log file and if traceLevel gt 2 the found arbores
58. returned by SelectVariable has a maximum frac eter epsilon 88 Part III Methods CHAPTER 11 PROTOTYPES AND DATA STRUCTURES Chapter 11 Prototypes and Data Structures 11 1 Graph Definition In this section we describe how problem instances namely graph objects are specified in GOBLIN In Section 11 2 we will also discuss the potential solutions of graph optimization problems We have already mentioned that a class of graph objects may either represent physical objects or logical views of other data objects Hence we are concerned with prototype methods rather than data structures 11 1 1 Incidences and Adjacencies Synopsis class abstractMixedGraph x protected goblinHashTable lt TArc TArc gt adj GRAPH DEFINITION public First TNode 0 Right TArc TNode 0 virtual TArc virtual TArc StartNode TArc 0 EndNode TArc virtual TNode virtual TNode virtual TArc Adjacency TNode TNode void MarkAdjacency TNode TNode TArc void ReleaseAdjacencies Node incidences are the very core of any implementation of graph objects They can be accessed by iterator objects which were discussed in Chapter 7 and which in turn require an implementation of the methods First and Right O see Section 7 1 for the details In similar way any graph implementation must provide arc inci dences that are the end nodes of a given arc by defining a method StartNode call to the generi
59. run ning time is dominated by the complexity of the selected matching solver 13 16 4 Local Search GOBLIN provides a local search routine TSPLocalSearch which can be used to improve the heuristic tours discussed so far Local search is enabled by the configuration parameter methLocal One can also start this post optimization routine with a random tour by calling TSPHeuristicsRandom The method TSPLocalSearch iteratively tries to improve the present tour by recursive calls to TSP2Exchange and or TSP2NodeExchange The first method iteratively tries to improve a given tour by deleting two arbitrary arcs which are replaced by two new and entirely determined 138 CHAPTER 13 HIGH LEVEL ALGORITHMS arcs The second procedure selects a node which is deleted and inserted at another point of the tour Both local search procedures take an array of predecessor labels and an optional parameter which denotes the minimal improvement accepted for a local exchange If this value is positive a local exchange may increase the tour length by the specified amount Figure 13 13 A 2 Opt Step 13 16 5 The Subgradient Method by Held and Karp The method TSPSub0pt1Tree r iteratively calls MinTree r which returns an r tree as described in Section 13 5 4 by the subgraph data structure If all nodes have Deg v 2 a tour is found and the procedure halts CHAPTER 13 HIGH LEVEL ALGORITHMS s Figure 13 14 An optimal 1 Tree whic
60. several export filters especially the postscript filter needed for printing The xfig canvas drawing tool is useful for the postprocessing of figures also Problem solvers can be compiled and linked even if the Tcl Tk package is not present but the possible graphical output has to be processed man ually then In particular the fig files can be input to the xfig drawing tool 15 2 3 UNPACKING THE SOURCE 2 3 Unpacking the Source The source code is coming as a single zipped file goblin lt version gt tgz which can be extracted from a shell prompt by typing tar xfz goblin lt version gt tgz and then generates a folder goblin jversion including the Makefile With elder tar versions it may be necessary to extract the file in two steps gunzip goblin lt version gt tgz tar xf goblin lt version gt tar 2 4 Configuration Throughout this document especially in Chapter 14 we will describe the runtime configurability of the core library This section adresses some some possibilities for configuration at compile time by means of the source file configuration h and the general build options by means of Makefile conf The latter file is intended to do the platform dependent settings Cur rently only Linux and Windows Cygwin are well supported Advanced Unix users will find it obvious how to configure the compiler and linker for their own Unix platform There are some more build parameters to set but some options are experimen
61. st Flow Edge Routing Minimum Cost b Flow Edge Routing Eulerian Cycle Effect Compute a minimum Steiner tree and return it by the predecessor labels The terminal nodes are specified by the node demands For a given source node s compute a shortest s path tree If a target node t is specified the computation stops once a shortest st path has been found The results are returned by the predecessor and the distance labels For digraphs only Similar to the previous operation but search the residual network as it occurs in min cost flow algorithms For directed acyclic graphs only Compute a forest such that every node is reached from a root node by a maximum length path For digraphs only Compute a maximum st flow Return the subgraph and a min imum st cut by the distance labels A subgraph must be given in advance which satisfies the node demands other than for s and usually the zero flow For digraphs only Compute a maximum st flow of minimum costs Return the optimal subgraph and node potentials A subgraph must be given in advance which satisfies the node demands other than for s and t and which is optimal among all st flows with the same flow value usually the zero flow For digraphs only Compute a subgraph of minimum costs satisfying all node de mands Return the optimal subgraph and node potentials Check if the graph object is Eulerian Occasionally return an Eulerian walk by the edge colours Edge Ro
62. stndrd19 stndrd20 stndrd21 stndrd22 stndrd23 stndrd24 stndrd25 stndrd26 stndrd27 stndrd28 stndrd29 stndrd30 stndrd31 stndrd32 stndrd33 stndrd34 stndrd35 stndrd36 stndrd37 stndrd38 stndrd39 stndrd40 stndrd45 stndrd50 Cap 100000 100000 100000 100000 100000 150000 150000 150000 150000 150000 400000 400000 400000 400000 400000 400000 400000 400000 400000 400000 400000 400000 1000000 1000000 1000000 1000000 1500000 1500000 1500000 1500000 4000000 4000000 2000000 4000000 2000000 5000 300000 Len 9998 9998 9998 9998 9997 9996 9998 9997 9996 9996 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 9998 9997 9997 9998 9997 9995 9998 9997 10000 10000 10000 10000 10000 50000 100 Objective CS NW 196587626 194072029 159442947 2s 138936551 2s 102950805 1s 191968577 2s 172742047 3s 164468452 4s 144994180 4s 148675665 4s 6815524469 1s 2646770386 1s 6663684919 1s 2618979806 1s 6708097873 15 2631027973 25 6621515104 25 2630071408 15 6829799687 25 6396423129 2s 5297702923 1s 4863992745 1s 11599233408 6s 11700773092 6s 8782721260 6s 8577913734 6s 17996365110 138 18424893900 135 14596094907 115 14350903861 13s 87957673940 3295 35607266430 1495 2s 7265734372 845 48660418428 145s 2s 11068572024 62s 2s 1864582590629 165 15s 4024557 2s Os NON WEIGHTED MATCHING 22 4 Non Weighted Matching All computations were performed
63. strings only two characters are special The token 1 refers to the current values of the context variables arcLabels or nodeLabels re spectively The tokens 1 42 each represent one of the potential values of arcLabels and nodeLabels as listed in the Tables 14 6 5 and 14 6 6 As a simple and useful example arcFormatting e 47 would result in a set of arc labels e 1 e 2 in the GOBLIN canvas If this canvas is imported to LaTeX the labels e1 5 would result If one sets arcFormatting 1 42 43 161 14 6 GRAPHICAL DISPLAY CHAPTER 14 THE OBJECT CONTROLLER the ConfigDiplay O methods can determine which data shall be displayed Parameter Value by setting the variables arcLabels arcLabels2 arcLabels3 The appear i i ETIAM lines and polygons ance is left to the user In this example a label 1 5 1 3 may result 1 interpolated splines flow value with according capacity bounds 2 pipes othogonal polygons arcLabels 0 no labels arcLabels2 1 indices 0 1 2 The default layout of arc labels can be expressed as 1 2 3 provided arcLabels3 2 capacities that none of the context variables arcLabels arcLabels2 arcLabels3 is 3 subgraph flow unset If arcLabels is unset the equivalent format string is 42 43 4 length labels 5 reduced length labels 6 lower capacity bounds T indices 1 2 3 arrows 0 aligned with D objects 1 centered subgraph 0 draw predecessor arcs only 1 d
64. the currently controlled graph object The original graph is not manipulated Option Effect Section Underlying Graph EN Orientation Complete GLI Orientation Induced by Colours DENT Shrink Colours 6 17 Subgraph gt By Node Colours 6 415 Subgraph By Edge Colours 6 415 Subgraph Induced Bigraph 116 Subgraph Explicit Subgraph 11 Subgraph Transitive Closure For directed acyclic graphs only Add all transitive arcs arcs which represent non trivial directed 6 4 18 Subgraph Intransitive Reduction For directed acyclic graphs only Remove all transitive arcs 6 4 19 Complement Switch to the complementary graph 6 4 5 Line Graph Switch to the line graph 6 4 3 Node Splitting Switch to the node splitting 6 4 12 Distance Graph Generate a complete digraph where the length label of any arc uv is the length of a shortest 6 4 9 uv path in the original graph Metric Graph Undirected counterpart of the distance graph 6 4 8 30 CHAPTER 4 THE GOBLET GRAPH BROWSER 45 COMPOSING GRAPHS MENU ITEM COMPOSE Option Effect Section Planar Undirected Dual Graph Switch to the dual graph only for plane graph objects 6 4 6 Planar Directed Dual Graph Switch to the directed dual graph only for bipolar plane digraphs and for plane graphs with a 6 4 6 given st numbering Planar Planar Line Graph Replace all original nodes by faces of the same degree The original arcs are all contracted to 6 4 3 nod
65. the indices The number of faces is retrieved by ND and the face left hand to a given arc is obtained by Face a If the embedding has not been extracted explicitly Face will initiate this operation in its first occurence So for connected graphs a is an exterior arc if Face a Face ExteriorArc provided that the graph is implicitly or explicitly embedded In order to de cide if a given node v is on the exterior face one just calls ExteriorNode v Note that arc insertions and deletions call ReleaseEmbedding and after that the dual incidences must be extracted again 6 3 Logical Objects Logical objects describe a special view of another object Roughly speaking a logical class defines the reduction mechanism of one optimization problem to another The referenced object may either be persistent or logical Logical objects keep reference of the original object all of their lifetime referenced object may not be disallocated while logical views are present The benefit is a hidden back transformation of potential solutions of the CHAPTER 6 GRAPH OBJECTS respective optimization problems More precisely the potential solutions are merely logical views of solutions for the original problem 0 2 0 2 92 0 1 0 Figure 6 2 Transformation of Network Flow Problems 6 3 1 Canonical Flow Networks Include file digraphToDigraph h Synopsis class FNW2FNW public virtual abstractDiGraph 1 FNW2FNW abstractDiG
66. type in goblet samples strong4 Up to the missing node colours the browser starts with a screen as depicted in Figure 3 1 The main window is structed as follows e The leftmost icon bar refers to general tools for file management switches for the various operating modes a reset button for the mes senger and a start stop button for the problem solvers By clicking on THE GOBLET GRAPH BROWSER the camera you can save the current graph object into a trace image This tool bar is always available e The second icon bar and the canvas region form the built in graph editor T he editor mode is default but if no geometric embedding is available GOBLET starts with the messenger window instead e The bottom line displays the operating mode some status info de pending on the operating mode and rightmost an info about the usage of ressources Now click on the Optimize menu and in that menu select Connectivity gt Strong Edge Connectivity gt Go If nothing went wrong the configuration shown in Figure 3 1 results in which the strong components are represented by node colours GOBLET strong4 modified 2 99 amp 2 4 z Bi display graph Strong 1 Edge Connectivity objective value 0 0 seconds Tf you are working with a system installation you can download and unpack the sources to get access to the samples library 21 3 1 THE GOBLET GRAPH BROWSER Figure 3
67. which can be extracted by a call of FindPath s 1 Note that FindPath recursively calls Expand CoExpand and Traverse which are only needed at this point The method Augment actually does the augmentation and triggers off the necessary topological erasure operations All these operations must be separated from the InsertProp oper ations by using the methods Phase2 and a Phase1 The complexity of these new operations can be bounded for a whole phase and is O m for the DDFS operations The time needed for FindPath operations is proportional to the length of the constructed paths again 55 6 3 LOGICAL OBJECTS 6 3 6 Surface Graphs Include file surfaceGraph h Synopsis class surfaceGraph public abstractBalancedFNW 1 surfaceGraph abstractBalancedFNW amp TFloat ModLength TArc TFloat RModLength TArc void ShiftPotential TNode TFloat void ShiftModLength TArc TFloat bool Compatible void CheckDual TArc FindSupport TNode TArc dynamicStack lt TNode TFloat gt amp void Traverse TArc TArc TArc void Expand TArc TArc TArc void ExpandAndAugment TArc TArc TFloat ComputeEpsilon TFloat void PrimalDualO TNode void Explore TFloat goblinQueue TArc TFloat amp THandle TNode TFloat ComputeEpsiloni TFloat void PrimalDual TNode Surface graphs are data structures which are needed by all weighted match ing algorithms surface graph object keeps a shrink
68. with the GOBLET graph browser 2 3 on a Pentium 1 850 MHz notebook with 256 MB RAM and SuSE Linux 7 3 The test problems r10000 to r30000 are random graphs while reg3 is a 3 regular random graph and tilingi tiling are tilings with different base graphs The following methods have been tested here e Phase The phase ordered augmentation algorithm We report the running times and the number of phases which occur e Cancel The cycle canceling method We report the running times and the number of odd cycles after the call of CancelEven Note that the respective numbers of phases and odd cycles are much less than the worst case bounds may suggest Instance Nodes Arcs Type Phase Cancel Objective r10000 10000 10000 1 factor 2 factor r15000 10000 15000 1 factor 2 factor r20000 10000 20000 1 factor 2 factor r25000 10000 25000 l1 factor 2 factor r30000 10000 30000 1 factor 2 factor reg3 10000 15000 1 factor 2 factor tiling1 10166 30361 1 factor 2 factor tiling2 9941 29540 1 factor Average 10013 21863 1 factor 2 factor 237 22 5 WEIGHTED MATCHING 22 5 Weighted Matching All computations were performed with the GOBLET graph browser 2 2 on a Pentium 1 850 MHz notebook with 256 RAM and SuSE Linux 7 3 The test problems are from TSPLIB and defined on complete graphs The instances pr1002 and u1060 are geometric while 511032 is defined by a ma trix The problem rnd1000 is a matrix problem with random lengt
69. 0 methMinCFlow Revised shortest path Shortest path Transformation to b flows methMinCCirc Klein cycle canceling Cost scaling Cost scaling with e tightening Minimum mean cycle canceling Shortest Augmenting Path Primal network simplex Reduction to linear program Capacity scaling methNetworkPricing Partial pricing Multiple partial pricing Dantzig First eligible arc 0 1 2 0 1 2 3 4 5 6 7 0 1 2 3 Table 13 3 Min Cost Flow Solver Options 13 11 Balanced Network Search Synopsis class abstractBalancedFNW bool BNS TNode TNode NoNode bool BNSKocayStone TNode TNode NoNode bool BNSKamedaMunro TNode TNode NoNode bool BNSHeuristicsBF TNode TNode NoNode bool BNSMicaliVazirani TNode TNode NoNode CHAPTER 13 HIGH LEVEL ALGORITHMS void Expand TNode TNode void CoExpand TNode TNode valid path in a balanced flow network is an eligible path which does not traverse a pair of complementary arcs with BalCap a BalCap a 2 1 A balanced network search BNS method is a procedure which decides which nodes are reachable by a valid path from a specified root node All procedures take one or two parameters The first one is the root of search while the second optional parameter is a target node which should be reached on a valid path If such a target t is specified the method effectively decides whether t is reachable and halts once t has been reached The BNS methods may either
70. 062 5435s 1 factor heuristics 45448 39s l factor candidates 45448 60s 1 factor complete 45448 10195 2 factor heuristics 91940 59s 2 factor candidates 91939 562s 2 factor complete 91939 2163s heuristics 100651 98s 100356 18985 100356 3461s 210931 1235 011060 1 factor u1060 l factor candidates u1060 1 factor complete u1060 2 factor heuristics u1060 2 factor candidates 210931 1439s u1060 2 factor complete 210931 53725 rndi000 1 factor heuristics 41284 56s rnd1000 l factor candidates 41284 937s rnd1000 1 factor complete 41284 2628s rnd1000 2 factor heuristics 103401 77s rnd1000 2 factor candidates 103282 2745 rnd1000 2 factor complete 103282 27525 22 6 Cliques and Node Colouring All computations were performed with the GOBLET graph browser 2 14 2 2 2 3 on a Pentium 1 850 MHz notebook with 256 MB RAM SuSE Linux 7 2 7 3 and without any code optimization The test sets are from Michael Tricks graph colouring page http mat gsia cmu edu COLOR instances html All computation times were restricted to 5 minutes exceptions are marked with an asterisk Note that node k colourings and k clique covers have CHAPTER 22 COMPUTATIONAL RESULTS 22 6 CLIQUES AND NODE COLOURING been computed for a series of fixed decreasing k A successful k colouring Instance Nodes Arcs Clique Colour Stable Cover usually takes less than one second times for negative results mainly depend mulsol i on the branch and bound configuration mulsol i m
71. 18 PERSISTENCY CHAPTER 18 PERSISTENCY 18 4 3 Geometry geometry gt geometry metrics lt type of metrics gt dim lt d dimension of the embedding coordinates axisO lt float gt 1 1 lt float gt axiscd 1 gt lt float gt This information becomes important if one needs to solve geometrical prob lems but is also used for the graphical display The field lt type of metrics gt denotes the method by which length labels are computed internally and overwrites the context variable methGeometry If this parameter is zero the length labels are specified in the objectives part Otherwise GOBLIN takes the geometric embed ding specified here and computes the distances with respect to the specified metric In the current release the dimension d must be either 0 or 2 that is a graph either has a plane embedding or is not embedded at all 18 4 4 Layout lt layout gt layout model lt layout model gt 18 4 FILE FORMAT FOR GRAPH OBJECTS align lt node gt thread lt node gt exteriorArc lt gt This information is needed only for the graphical display Reading the value of layout model gt overwrites the corresponding context variable Even more SetLayoutParameters is called with this value and effectively sets all default values for this layout model The configuration part is used to customize the layout model If you
72. 2 new import sample tmp G2 gt ReadFlow F2 delete F2 if G2 gt Perfect Fi new export sample rst Gi gt WriteFlow F1 delete F1 delete G2 delete G1 It has turned out that file export is rather expensive and should be used 57 DERIVED PERSISTENT OBJECTS by extremely search intensive problem solvers only With some additional efforts for mapping the potential solutions copy constructors as presented in Section 6 4 1 are highly preferable 6 4 Derived Persistent Objects There are some situations where the implementation of a logical class with out an own incidence structure is inappropriate for the problem transfor mation e If the transformation mechanisms would be very expensive e If the problem to solve is very complicated so that the instances are rather small e Ifthe transformation is of academic interest rather than practical need Typically the class definition only consists of a constructor method 6 4 1 Copy Constructors Each of the persistent base classes provides a copy constructor which sup ports the following general purpose options e OPT_CLONE Generate a one to one copy of the graph That is map every node and every arc of the original graph If this option is absent arcs with zero capacity are not mapped e OPT_PARALLELS Allow parallel edges If this option is absent an ar bitrary arc of every parallel class is mapped The option is immaterial if mapping
73. 2 COMPUTATIONAL RESULTS 240 Index 2 edge connected component 119 T join 135 b flow 124 127 e optimal 128 r tree 118 st flow 127 v optimal 127 extreme 127 maximum 122 st numbering 120 st orientations 62 st path eligible 112 1 matching 95 2 factor 94 arc incidences 91 artificial nodes 93 auxiliary variables 174 backward arcs 40 balanced network search BNS 131 balanced pseudo flow 132 basic timer 188 basis 177 basis arc 121 241 basis row 177 bipolar digraphs 60 block 119 blossom 99 base 99 branch and bound 81 branch node 81 left successor 82 right successor 82 branch tree 85 breakpoint 156 bridge 119 canonical element 74 canonically ordered partition 121 child timers 188 Chinese postman problem CPP 135 circulation 124 circulations 127 clique 141 clique cover 140 code module 190 combinatorial embedding 120 combinatorially embedded 49 complementary graph 60 complementary pairs 39 40 INDEX complete orientation 62 concrete classes 43 configuration file 207 contact nodes 121 container dynamic 72 static 72 copy constructor 147 cut edges 121 cut node 119 cycle free solution 130 cycle space 136 DAG 115 Dantzig rule 130 data structures 71 default constructor 147 degenerate pivot steps 129 dense implementation 46 dictionary 76 directed dual graphs 60 double depth first search 55 dual graph 60 dual up
74. 22 SGO2 40 14290 14429 21s comopt software TSPLIB95 ry48p 14422 EXH 40 14422 758 46 ft53 6905 SGO2 6905 10s The following methods have been tested here ftv55 1608 SGO2 1584 1758 95 e SGO The fast version of the 1 tree subgradient optimization with od PAND 1084 1008 oes ftv55 1608 EXH 1608 883s 882 local search enabled This method has produced the most heuristic ftv64 1839 SGO2 1808 1958 26s tours ftv64 1839 CAND 1808 1839 30s 738 ftv64 1839 1839 58165 3996 e SGO2 Exhaustive 1 tree subgradient optimization with local search enabled 235 MIN COST FLOW CHAPTER 22 COMPUTATIONAL RESULTS Instance Opt Method Root Found Gap Time Branch Instance Nds Arcs Cap Len Objective CS NW ft70 38673 47 38632 38793 bigb 80101 10000 1000 15817090 198s ft70 38673 138632 38694 708 big6 60092 10000 1000 15864843 165s 70 38673 38673 16 big7 40105 10000 1000 13970599 138s ftv70 1950 1907 2176 capi 10000 500000 10000 2572055650 7s ftv70 1950 1907 1973 12804 cap2 30000 1199995 10000 868553404 14s ftv70 1950 1908 1950 2510 cap3 40000 1199995 10000 835752895 23s ftv70 1950 1928 1950 1000 cap4 30000 600000 10000 6572052044 1075 kro124p 36230 35974 392778 cap5 40000 600000 10000 4596714758 1305 kro124p 36230 35998 392778 cap6 49999 600000 120756 3905503120 130s kro124p 36230 35999 36230 cap 60000 600000 10000 3514982153 1425 kro124p 36230 36230 cap8 40000 1000000 10000 13836268653 473s f
75. 3 44303 44303 6942 6942 6942 59030 59030 59030 118282 118282 118282 6110 6110 6110 6110 96772 96772 96772 69853 69853 69853 58537 58537 58537 6528 6528 6528 26524 26524 26524 26524 Found Gap 628 647 628 629 629 14371 14379 14379 44116 44744 44116 44438 44303 6912 7082 6912 6942 6942 58068 59076 58068 59030 59030 117431 118580 117431 118282 118282 6075 6216 6076 6216 6076 6110 6110 95720 98650 95935 98650 95935 96772 69120 70240 69120 69853 69853 58190 59113 58190 58537 58537 6490 6610 6490 6528 6528 26265 26725 26299 26725 26299 26525 26524 Time 29s 5s 144s 92s 25s 21s 104s 6115 26s 12s 1489s 39s 28s 112s 29s 45s 109s 4428s 40s 177s 27578 55s 785 28945 258 198 8185 40s 422s 6318s 49s 92s 264s 224725 CHAPTER 22 COMPUTATIONAL RESULTS Branch 3052 23861 7462 1508 3670 324 10930 3470 CHAPTER 22 COMPUTATIONAL RESULTS Instance kroB150 kroB150 pr152 pr152 Opt Method Root 26130 26130 13682 13682 Found Gap 25733 26678 25733 26130 73209 74279 73209 73682 Time Branch 164s 905s 13410 223s 52s 8356 e CAND Branch and bound on a candidate graph with local search ASYMMETRIC TSP enabled and with methCandidates 0 e CAND Branch and bound on the entire graph with local search dis abled For difficult pro
76. 3 HIGH LEVEL ALGORITHMS 144 Part IV Miscellaneous 145 CHAPTER 14 THE OBJECT CONTROLLER Chapter 14 The Object Controller With any object derived from the base class goblinData0bject graph ob jects iterator objects and data structures a goblinController object is associated To this controller object we refer as the context of the data object Data objects may share their controller with other data objects In particular iterators logical views and temporary data structures used in algorithms are in the same context as the referenced graph object There is a global controller object namely the goblinDefaultContext For the most default and file constructors of GOBLIN data objects a ref erence to goblinDefaultContext appears as a default parameter 14 1 Construction Synopsis class goblinController 1 goblinController goblinController goblinController amp THE OBJECT CONTROLLER Whenever a controller object is instanciated this generates a couple of timer objects and an object hash table which allows to dereference the dependent data objects from a given integer handle All other context parameters are initialized either with default values or the respective value of the master context The copy constructor method produces a clone of the controller ob ject passed by its reference built in type and char string values are copied event handlers and module entry points are inherited from the ma
77. 3 Lower and Upper Problem Bounds Include files timers h data 0bject h Synopsis class goblinTimer i bool SetLowerBound TFloat bool SetUpperBound TFloat TFloat LowerBound TFloat UpperBound class goblinDataQbject x void SetLowerBound TTimer TFloat void SetUpperBound TTimer TFloat void SetBounds TTimer TFloat TFloat TFloat LowerBound TTimer TFloat UpperBound TTimer With every timer a pair of problem bounds is associated which can be manipulated in the obvious way For global timers an additional wrapper exists which simplifies the access from data object methods If the context flag logGaps is set every SetBounds operation which strictly decreases the duality gap writes some logging information 189 17 8 SOURCE CODE MODULES 17 3 Source Code Modules Include files globals h Synopsis enum TModule NoModule struct TModuleStruct 1 char moduleName TTimer moduleTimer TAuthor implementor1 TAuthor implementor2 char encodingDate char revisionDate TBibliography originalReference TBibliography authorsReference TBibliography textBook s const TModuleStruct listOfModules class goblinDataObject 1 void OpenFold void CloseFold void OpenFold TModule TOption 0 void CloseFold TModule TOption 0 As mentioned before a code module denotes specific implemen tation rather than a functional unit Source code is assigned to a m
78. 4 98 B2 Templaten ens LkGOG xo 9h REO RECEN Ee G 79 11 2 8 Partitions of the NodeSet 98 9 3 Graph Based Implementations 80 1129 olco uk Re ee be a el Res 99 9 4 Containers as Index 80 11 2 10 Props and 99 Cycles o 2299 see do 100 10 Branch and Bound 81 11 3 Manipulating 100 10 1 Branch so oee ade 81 11 3 1 Changes of the Incidence Structure 100 10 2 Generic RI ou dx ORE odes 83 11 3 2 Invalidation 101 10 3 Implementations u tore ag o eio RR kh 85 11 3 3 Updates on the Node and Arc Labels 101 JUI Stable Sets lt hak xr memo Row xS 85 11 34 Merging Graphs M 102 dita Symmetrie TSP ee 86 10 3 3 Asymmetric TSP 87 12 Graph Drawing 103 10 34 ius bee vae R8 REA 8T 12 1 Preliminary Remarks o 103 10 3 5 Maximum Cut 2 87 12 1 1 Layout Models 103 10 3 6 Mixed Integer Programming 87 dL dope 104 12 1 3 Translations of the Current Drawing 104 12 1 4 Automatic Alignment of 104 Methods 89 12 2 Layout 104 12 3 Tres Layout gt c9 03 90x 9 x xo b 9 X 9 X x 105 11 Prototype
79. 6 edges whereas rgraph n 5 randGeometry 1 dns seed 77 example6 would generate a complete graph with 5 nodes and 10 and random em bedding into plane The random generator is initialized with a special seed 21 4 Graphical Display Every problem solver has the capability to produce graphical information if the tracing module is configured that way But sometimes it is more conve nient to display graph directly This is achieved by the program gobshow Note that the file extension must be specified For example gobshow arcLabels 4 samples optasgn1 gob would show the graph defined in the file optasgn1 gob especially its length labels This program should be redundant in view of the existence of the GOBLET graph browser Since the compilation of the GOSH interpreter is the most difficult part of the GOBLIN installation it may be useful in case of trouble Part VI Appendix 231 CHAPTER 22 COMPUTATIONAL RESULTS Chapter 22 Computational Results 22 1 Symmetric TSP All computations were performed with the GOBLET graph browser 2 7 1 on an Athlon XP 1800 PC with 256 MB RAM and SuSE Linux 7 3 and with gcc optimization level O5 The test problems are all from the TSPLIB http www iwr uni heidelberg de groups comopt software TSPLIB95 The following methods have been tested here e SGO The fast version of the 1 tree subgradient optimization with local search enabled This method has produced the most heuristi
80. A STRUCTURES e ExtractiMatching checks if the arcs of the subgraph are pairwise non ajacent If so the predecessor labels are assigned with this 1 matching such that predecessors are always arcs with even indices If there are adjacent arcs an exception ERCheck is returned e ExtractEdgeCover checks if the arcs of the subgraph are pairwise non ajacent If so the predecessor labels are assigned with this 1 matching and augmented to an edge cover If the input subgraph is a maximum cardinality matching a minimum edge cover results The graph must not have isolated nodes e ExtractColours generates from the node partition data structure equivalent node colours such that the colour classes occur consecu tively 11 2 2 Subgraphs Synopsis class abstractMixedGraph 1 void InitSubgraph void WriteSubgraph goblinExport void ReadSubgraph goblinImport virtual void AddArc TArc TFloat 0 virtual void OmitArc TArc TFloat 0 virtual TFloat Sub TArc 0 virtual void SetSub TArc TFloat TCap Cardinality TCap Length void AddToSubgraph TNode NoNode POTENTIAL SOLUTIONS subgraph is a possibly fractional assignment of labels to the graph arcs which satisfies the capacity bounds If integral a subgraph label Sub a may be interpreted as the number of arcs in the subgraph which are parallel to a subgraph of a directed graph is also called pseudo flow This data structure differs from the
81. APTER 13 HIGH LEVEL ALGORITHMS TNode NegativeCycle TNode NoNode class abstractDiGraph 1 protected TCap mu public TNode MinimumMeanCycle J Primal min cost flow algorithm traditionally try to find an augmenting cycle of negative length GOBLIN supplies two methods which are useful in this context Both methods apply for digraphs only 13 2 1 Negative Cycles The method NegativeCycle determines an arbitrary eligible cycle with negative length The return value is a node on this cycle The cycle itself is returned via the predecessor labels If an optional node is passed this node is considered to be the root of graph search and essentially the FIFO label correcting algorithm results 13 2 2 Minimum Mean Cycles The method MinimumMeanCycle determines an eligible cycle such that the ratio of the sum of length labels and the number of arcs on this cycle is minimum Again the return value is a node on the cycle and the cycle itself is returned via the predecessor labels The minimum ratio is kept by the variable mu for further processing The method also works if this ratio 18 negative An important drawback of the algorithm is that it requires O n storage units which makes it inapplicable to large scale problems say with n gt 10 DAG SEARCH 13 2 3 Proposed Extension A mean cycle algorithm which runs with linear storage requirements 13 3 DAG Search Synopsis class abstractDigraph 1 enum TDAG
82. BSTRACT CLASSES absobj absbal big2fnw absbig bal2bal gra2bal surgra S Figure 6 1 GOBLIN Base Classes 6 1 Abstract Classes Abstract classes allow an high level description of solvers for graph opti mization problems They separate the fundamental algorithms from the data structures which are defined in dedicated classes called implementa tion classes or concrete classes Every abstract class definition is endowed with file export methods for problem instances and potential solutions These methods are inherited by all implementation classes That is the external formats are implementa tion independent Details can be found in Chapter 18 6 1 1 Mixed Graphs Include file abstractMixedGraph h 43 6 1 ABSTRACT CLASSES The class abstractMixedGraph is the base class for all graph structures It handles the management of the implicit data structures which are listed in Table 6 1 and which will be discussed in Chapter 13 Roughly speaking these data structures represent solutions of graph optimization problems whereas the graph defining data structures are implemented in the various concrete classes The first exception to this rule are subgraphs flows for which absmix h provides some prototypes but which are not implemented This polymor phism results from the fact that subgraphs flows are subject to problem back transformations and that dense graph objects should admit a sparse s
83. CutNodeIdentification can be called which iteratively chooses a pair x y of nodes determines a minimum 2 y cut and then identifies the nodes x and y These nodes and the y cut capacity are supplied by MinCutLegalUrdering r x y where r is an arbitrary root of search The search for a legal ordering is very similar to the Dijkstra and the enhanced Prim algorithm and hence runs in O n O mlogn or in O m nlogn time depending on the setting of methPQ In practice the node identification method performs much worse than the push relabel method 13 10 Minimum Cost Flows Synopsis class abstractDiGraph x enum TOptMCFST 1 MCF ST DEFAULT 1 MCF ST DIJKSTRA 0 MCF ST 8AP 1 MCF ST BFLOW 2 M TFloat MinCostSTFlow TNode TNode TOptMCFST TFloat MCF_BusackerGowen TNode TNode TFloat MCF_EdmondsKarp TNode TNode enum TOptMCFBF MCF_BF_DEFAULT 1 MCF_BF_CYCLE MCF_BF_COST 1 MCF_BF_TIGHT 2 MCF_BF_MEAN 3 0 CHAPTER 13 HIGH LEVEL ALGORITHMS MCF BF 8AP 4 MCF BF SIMPLEX 5 MCF BF LINEAR 6 MCF BF CAPA 7 TFloat MinCostBFlow TOptMCFBF TFloat MCF_CycleCanceling TFloat MCF_MinMeanCycleCanceling TFloat MCF_CostScaling TOptMCFBF TFloat MCF_ShortestAugmentingPath TFloat MCF_CapacityScaling TFloat MCF_NWSimplex void MCF NWSimplexCancelFree void MCF NWSimplexStrongTree Two formulations of the min cost flow problem are supported st flow
84. ER 11 PROTOTYPES AND DATA STRUCTURES 11 2 4 Node Degrees class abstractMixedGraph ji protected TFloat sDeg TFloat sDegIn TFloat sDegOut public void InitDegrees void InitDegI0 TFloat Deg TNode TFloat DegIn TNode TFloat DegOut TNode TFloat Divergence TNode void AdjustDegrees TArc TFloat void ReleaseDegrees Node degrees are rather an auxiliary data structure than a potential so lution They are completely determined by the subgraph labels The call Deg v returns the sum over all subgraph labels of undirected arcs adjacent with the node v In the same manner DegIn v is the sum of all directed arcs with end node v and DegOut is the sum of all directed arcs with start node v The necessary data structures are generated by the first calls of Deg DegIn or DegOut respectively To keep the degree labels and the subgraph labels compliant every implementation of AddArc and OmitArc must in clude a call to AdjustDegrees If they are not needed any longer degree labels may be disposed other than the subgraph data structure CHAPTER 11 PROTOTYPES AND DATA STRUCTURES In order to obtain the node degrees in the original graph rather than in subgraph one may set the lower capacity bounds to the value of the upper bounds Then the subgraph multiplicities and the node degrees will be set implicitly 11 2 5 Distance Labels Synopsis class abstractMixedGraph 1 protected TFloat d
85. FNW BNSMicaliVazirani TNode TNode 45 PERSISTENT OBJECTS which are defined in the file shrnet cpp the method void abstractBalancedFNW PrimalDual TNode which is defined in the file surgra cpp and the methods void abstractBalancedFNW Cancel0dd void abstractBalancedFNW CancelPD which are defined in the file bal2bal cpp 6 2 Persistent Objects A data object is persistent iff it can be exported to a file and reimported without significant loss of information The file formats for persistent objects are described in Chapter 18 To every abstract class of graph objects potentially two persistent im plementations exist A sparse implementation based on incidence lists and a dense implementation based on adjacency matrices The persistent classes defined in GOBLIN are listed in Table 6 2 class name description include file mixedGraph mixed graph objects Spsmix graph sparse graph objects spsgra diGraph sparse digraph objects spsdig biGraph spsbig balancedFNW denseGraph dense graph objects denseDiGraph dense digraph objects denseBiGraph dense bigraph objects sparse bigraph objects sparse balanced flow network objects spsbal dnsgra dnsdig dnsbig Table 6 2 Persistent Graph Objects The definition of persistent classes is of little mathematical interest since algorithms are defined by abstract classes where all object functionality is 46 CHAPTER 6 GRAPH OBJECTS specified
86. G SUPPORT scale problems If the width does not exeed 120 characters the objective function and the structural restrictions are aligned together The remaining sections are written in blocks of 5 or 10 entries In this format a given basis is primally feasible if all displayed slacks are non negative Optimality can be checked with the dual variable values which must have the correct sign depending on the direction of optimiza tion and differing for lower and upper bound restrictions 16 1 PUBLIC INTERFACE 183 Native LP Solver CHAPTER 16 LINEAR PROGRAMMING SUPPORT 16 2 Native LP Solver Include file 1pSolver h Synopsis class goblinLPSolver 1 private bool bool bool void void void void void TVar TRestr void TRestr TVar public void baseInitial baseValid dataValid DefaultBasisInverse EvaluateBasis BasisUpdate TRestr TVar SolutionUpdate PrimallyFeasibleBasis PricePrimal QTestPrimal TVar DuallyFeasibleBasis PriceDual QTestDual TRestr Pivot TRestr TVar TLowerUpper The native LP solver is preliminary and currently only a very basic sim plex code is available For this reason a detailed documentation of pricing 184 techniques ratio tests and the used data structures is postponed We give a few remarks about the basis update strategies so far and about some flags used internally e The flag baseInitial is equivalent with the method Ini
87. GOBLIN A Library for Graph Matching and Network Programming Problems Release 2 7 2 Reference Manual April 25 2006 Contents I Introduction 9 1 General Statements 11 Ido SMOD opoe aa enga ea a e Qd ee Redes ead 11 1 2 Ory uoo BEBE Re ee BO RUE PORC xen RR 11 13 Purpose and Applications saos ossoa ors o m 12 14 Project Overview o 22 ooo o esd dog m RR 12 1 5 Fundamental Library Concepts 13 1 6 Mathematical 13 LT Contributions o e ee a eed qox Re Re 14 2 Installation 15 2 1 Licence Agreement 15 2 2 Software 15 2 3 Unpacking the Source lt n ao ce esoo aeee ma Ena a 16 2401 2 kon oo e a god ee Reg 16 2 5 Makefile and UNIX Installation 17 2 6 Tcl Compatibility Issues gt o lt e ccro llle 18 By Cup Build 222 2 x eK Ee do 18 2 8 Windows Setup 19 2 9 Download of new GOBLIN Versions 19 2 10 Bug Reporte om bee b GR E 20 3 Getting Started 3 1 The GOBLET Graph Browser S4 GOSH Shell SEPS ulcus eis dox Rp xk Rex Es ae Usmg the Library ov 394 px WR OE E E 3 4 Solver Executables The GOBLET Graph Browser 4 1 File Management Menu Item File 4 2 Graph Editor Dialogs Menu Item Edit
88. Graphical Display o Rs xx R 158 14 6 1 Display Mode Options 158 14 6 2 Export of Graphical Information 158 14 6 3 Device Independent Layout 160 14 6 4 Formatting Arc and Node Labels 161 14 6 5 Arc Display Options 162 14 6 6 Node Display Options 14 6 7 General Layout 14 7 Random Instance Generators 14 8 Runtime Configuration iaaea 15 The Messenger 15 1 Problem Solver Management 15 2 The Message Queue 15 3 Tracing 16 Linear Programming Support IBI Pubie Lateran cR epo m RR ee ea 15 1 1 Enty Point 1c dox Raises 16 1 2 LP Instance Retrieval 16 13 LP Instance Manipulation 22 16 1 4 Basis Dependent Methods 16 1 5 16 1 6 Bolving Problems 2 nsu coke Rx 4 Be ee ee eS PUG GS 423p obo p Re cee 16 1 8 Text Display 16 2 Native LP Solver 16 2 GLPK Wrapper leo ooo y Remo aa Rome Problem Transformations 17 Ressource Management 17 1 Memory Management C de ea 17 2 1 Basic and Full Featured Timers 17 2 2 Global Timers 17 2 8 Lower and Upper Problem Bounds 17 3 Source Code Modules 17 3 1 Authorship 17 3 2 Bibliography Data Base 17 4 Progress Measurement 167 168 169 169 171 172 172 174 176 177 179 180 181 182
89. Heap object in general Binary and Fibonacci heaps can be traced graphically see Section 14 5 for some details 8 2 Disjoint Set Systems Include file abstractFamily h Synopsis template class TItem class goblinDisjointSetSystem x public goblinDataObject 73 8 2 DISJOINT SET SYSTEMS Bud TItem 0 Merge TItem TItem 0 Find TItem 0 Reversible 0 virtual void virtual void virtual TItem virtual bool F Disjoint set systems are objects which have been designed to perform a so called union find process on the node set of a graph object This process is fully described by the listed operations The call Bud v creates a single node set containing v while Merge u v effectively merges the sets containing u and v into a single set Each of these operations is elementary that is it requires a constant amount of time The call Find v returns the set containing the node v in terms of a canonical element That is sets are identified with one of their elements To check whether u and v are in the same set one would evaluate the ex pression Find u Find v Example goblinSetFamily lt TNode gt F n for v 0 v lt n v F Bud v for 0 lt F Merge StartNode a EndNode a return F Find x F Find y determines the connected components of a graph and checks whether x and y are in the same component The running times of a Find v operation are implementation dependent
90. If the SPX_SUBGRAPH option is used the subgraph defined by the arcs with Subgraph a 0 is searched An eligible st path is a simple path starting at node s and ending at node t which entirely consists of eligible arcs A shortest st path is an eligible st path of minimum length A shortest path tree is tree such that any path from the root to another node is a shortest path 112 CHAPTER 13 HIGH LEVEL ALGORITHMS Figure 13 1 A Shortest Path Tree 13 1 2 Solver Interface The solver is called like ShortestPath method characteristic s t There is a shortcut ShortestPath s t which applies the op tions method SPX_DEFAULT and characteristic SPX_PLAIN A method SPX_DEFAULT value is eventually replaced by the value of the context variable methSearch The parameter s denotes the root of the requested shortest path tree The parameter t is optional and denotes a node to be reached If no t is specified the member targetNode is used If this is also undefined a full shortest path tree is determined If t is specified and reachable from s by el igible arcs the computation may stop prematurely for sake of performance The return value is true if t is s reachable and false otherwise Shortest paths are returned by the predecessor labels together with the matching distance labels The characteristic parameter switches between applying the original CHAPTER 13 HIGH LEVEL ALGORITHMS length labels and the red
91. Kruskal algorithm also applies to this problem but returns the connected components by the node partition data structure CONNECTED COMPONENTS 13 6 2 Strong Connectivity Two nodes y of a graph are strongly connected if there are an eligible xy path and an eligible yz path A strong component is a maximal node set such that each pair of nodes is strongly connected The method StronglyConnected decides whether a graph is strongly connected or not and returns 1 or 0 respectively In the latter case the strong components are available by the node colour data structure The running time is O m 1 yu e 4 Xx D e Ns N M bo 7 e e Figure 13 4 Blocks and 2 Edge Connectivity 13 6 3 Second Order Connectivity A cut node bridge of a graph is a node arc whose deletion increases the number of connected components block is a maximal node set such that each pair of nodes is traversed by a simple cycle 2 edge connected component is a maximal node set such that the induced subgraph contains no bridges The method CutNodes checks if the graph has a cut node In that case the cut nodes are returned by the node colours with colour 0 The remaining nodes are coloured block by block For this direct 2 connectivity application no parameters are passed to CutNodes 119 PLANARITY The method TwoConnected checks if the graph is 2 edge connected It calls CutNodes with some extra d
92. LOG MEM2 logMan LOG MAN Object manipulations logIO LOG IO File management logRes LOG RES Computational results two levels LOG RES2 logTimers LOG_TIMERS Timer statistics logGaps LOG GAPS Duality gaps logWarn MSG_WARN Warnings 152 CHAPTER 14 THE OBJECT CONTROLLER CHAPTER 14 THE OBJECT CONTROLLER 14 4 Method Selection Synopsis class goblinController int int int int int int int int int int int int int int int int int int int int int methFailSave methAdjacency methDSU methPQ methModLength methGeometry methSearch methMaxFlow methMinCF low methMinCCirc methMinTree methiTree methMaxBalFlow methBNs methMinCBalFlow methPrimalDual methTSP methLocal methSolve maxBBIterations maxBBNodes METHOD SELECTION This section merely summarizes the method selector flags which have been described with the respective problem solver methods For details we refer to the Chapters 8 and 11 153 14 4 METHOD SELECTION 14 4 1 Optional Data Structures methFailSave 0 No special certificate checking Network flow and matching solvers are forced to verify a reduced costs optimality criterion methAdjacency 0 Search incidence lists Generate tasi tebie methDSU 0 Path compression disabled Ro methPQ 0 Use basic priority queue 1 Use binary Heaps 2 Use Fibonacci Heaps methModLength 0 Recursive computation of re
93. MPS problem description and an MPS basis file In order to implement this efficiently all file I O methods exist in two versions writing to or reading from a file specified either by the file name or an open stream A more detailed specification of the native format can be found in Section 18 5 The LP format generator is discussed next 181 16 1 PUBLIC INTERFACE 16 1 8 Text Display Include file ilpWrapper h Synopsis class goblinILPWrapper 1 enum TDisplayOpt DISPLAY OBJECTIVE 1 DISPLAY RESTRICTIONS 2 DISPLAY BOUNDS 4 DISPLAY INTEGERS 8 DISPLAY FIXED 16 DISPLAY PRIMAL 32 DISPLAY DUAL 64 DISPLAY SLACKS 128 DISPLAY BASIS 256 DISPLAY TABLEAU 512 DISPLAY INVERSE 1024 Hh void WriteLPNaive char TDisplayOpt 0 There is an implementation independent layout method WriteLPNaive which can display the complete problem description and tableau data This information is grouped into several sections rather than filled into a single table The calling parameters are an output file name and a bit field which is composed from the following flags e DISPLAY OBJECTIVE Write the direction of optimization and the lin ear objective function Variables with zero coefficients are omitted 182 CHAPTER 16 LINEAR PROGRAMMING SUPPORT DISPLAY RESTRICTIONS Write the structural restrictions Fields with zero coefficients are left blank Displayed are either equations or in equalities with one or two
94. Node TFloat SteinerEnumerate TNode NoNode The method SteinerTree evaluates the node demand labels which have to be either 0 or 1 Steiner tree is a rooted tree or arborescence which spans all nodes with demand 1 the terminals The demand 0 nodes are called Steiner nodes and are spanned only if they denote shortcuts The method SteinerEnumerate enumerates on all possibilities for the Steiner nodes and iteratively calls the generic min tree solver Hence the algorithm is non polynomial and the running times are acceptable for at most ten Steiner nodes The method SteinerTrimLeaves TArc turns a given spanning tree arborescence into a Steiner tree by successively deleting all Steiner nodes which are leaves The running time is O n the return value is the sum of lengths of the deleted arcs The general implementation of SteinerHeuristics does nothing more than calling MinTree and SteinerTrimLeaves In undirected graphs SteinerHeuristics implements the Mehlhorn 2 approximation algorithm This method calls Prim2 with some discrete 142 CHAPTER 13 HIGH LEVEL ALGORITHMS adaption of the Voronio geometry The running time is O m nlog n and is dominated by the shortest path problem which must be solved to the compute the Voronoi regions see Section 13 1 5 for the details The compound solver method SteinerTree calls the heuristics and if methSolve 1 the enumeration scheme Lower bounds can be obtained
95. Queue lt TNode TFloat gt Q new staticQueue TNode TFloat n 010 new staticQueue lt TNode TFloat gt n for v 1 v lt n v t Q v new staticQueue lt TNode TFloat gt Q 0 for v 1 v lt n v t Q d v gt Insert These lines of code form part of the Micali Vazirani algorithm which distributes the node set of a balanced flow network over all queues Q 0 1 Q 1 1 Q n 1 where Q i consists of the node with distance label i In this special situation the static implementation is indeed the most efficient data structure CHAPTER 8 EXPLICIT DATA STRUCTURES Every container object can be emptied by the method Init This is particularly useful for static implementations One could also think of some caching mechanism of dynamic queue member objects but this is not implemented yet 8 1 1 Queues DISJOINT SET SYSTEMS basicHeap h basicHeap cpp binaryHeap h binaryHeap cpp fibonacciHeap h fibonacciHeap cpp Synopsis template lt class TItem class TKey gt class goblinQueue public virtual goblinDataObject Include files staticQueue h staticQueue cpp dynamicQueue h dynamicQueu cpp Queues are container objects which follow the first in first out principle principle There are two implementations The class staticQueue which models sets and the class dynamicQueue which models multisets For both classes the GOBLIN library contains precompiled code for the template instances lt TNode TFloat gt a
96. Random Instance Generators 229 21 8 1 Digraphs lt c c satt 2 224645 Re 229 21 3 2 Random Bigraphs lt lt ce sse ca eso ew eaaa 230 213 3 Random Graphs 2 244 9 o bee ee 230 21 4 Graphical Display kms 230 VI Appendix 231 22 Computational Results 233 224 petri ToP 238 222 Asyuunebre TSP xo 235 2223 Mun Lost Flow 223 ee 236 22 4 Non Weighted Matching lll 237 225 Weighted Matching reacia 238 22 6 Cliques and Node Colouring 238 Part I Introduction CHAPTER 1 GENERAL STATEMENTS Chapter 1 General Statements 1 1 Scope GOBLIN is a C class library focussed on network programming prob lems Roughly speaking a network programming problem is a graph op timization problem which can be solved efficiently by linear programming techniques More explicitly GOBLIN includes solvers for the following prob lems e Shortest paths e Negative length cycles e Minimum mean cycles e Minimum spanning trees arborescences and 1 trees e Maximum packing with arborescences e Maximum st flows and min cost st flows e Several types of minimum cuts and connected compenents e Feasible min cost circulations and b flows e Maximum cardinality and min cost perfect assignments e Directed Chinese postman problems SCOPE e Transportation problems e Maximum cardinality a
97. Search 1 DAG TOPSORT DAG CRITICAL DAG SPTREE TNode DAGSearch TDAGSearch TNodezNoNode TNode NoNode TNode TopSort TNode CriticalPath A DAG is a directed acyclic graph object The procedure DAGSearch opt handles the recognition of DAGs and does some additional computations depending on the value of opt e For DAG_TOPSORT and DAG SPTREE a topological oerdering is exported by the node colour data structure If the graph contains directed cy cles a node on a cycle is returned e For DAG_SPTREE a shortest path tree and the distance labels are ex ported e For DAG CRITICAL a directed path of maximum length is computed and its end node is returned unless cycles are found For every 115 EULER CYCLES node the distance label denotes the maximum path lengths from a root node The methods CriticalPath and TopSort are shortcuts which should be used as entry points The shortest path version is handled by ShortestPath The running time of a DAG search is O m in every instance Note that eligible residual capacity arcs are searched instead of the original directions 13 4 Euler Cycles Synopsis class abstractMixedGraph bool EulerCycle TArc bool EulerCycleO An Euler cycle is a closed walk which traverses all graph edges exactly once It can be computed by the call EulerCycle pred in O m time This method implements the Hierholzer algorithm and returns false if no Euler cycle exist
98. TENT OBJECTS By the constructor vertexTruncation G the vertices of the original graph are also replaced by cycles of the adjacent edges and these cycles form faces of the newly generated graph Other than for the planar line graph the original arcs are maintained and all vertices have degree 3 Loosely speaking both planar transformations rasp off the vertices of the original polyhedron and the planar line graph is the extremal case where the original edges collapse the vertices Figure 6 6 Graph and its Line Graph 6 4 4 Tearing Apart the Regions of a Planar Graph Include file sparseGraph h Synopsis class facetSeparation 1 public graph enum TOptRotation 1 ROT NONE 0 ROT LEFT 1 ROT RIGHT 2 facetSeparation abstractMixedGraph amp 59 6 4 DERIVED PERSISTENT OBJECTS TOptRotation ROT NONE This constructor method is another technique to generate regular graphs e ROT NONE Grow the original nodes to faces of the same degree and the original edges to 4 sided faces The resulting graph is 4 regular e ROT LEFT As before but triangulate the faces representing the orig inal edges such that every node is incident with exactly one triangu lation arc and the resulting graph is 5 regular Two different trian gulations are possible Choose the one which can be interpreted as rotating the original faces counterclockwise e ROT RIGHT Analogous to the ROT LEFT option but ro
99. TFloat Length TArc 0 virtual TFloat MaxLength virtual bool CLength 0 Length labels install linear objective functions which apply to most kinds of network programming problems For physical graph objects length labels can either be implemented by a simple array or determined by the geometric embedding of the graph More explicitly if the context variable methGeometry is zero length labels are read from an array data structure Otherwise a certain metric of the graph embedding is evaluated The methods MaxLength return the maximum length label and the methods CLength CDemand decide whether the labels are constant or not CHAPTER 11 PROTOTYPES AND DATA STRUCTURES Explicit length labels Manhattan distances Euclidian distances Maximum coordinate distances Spheric distances methGeometry Table 11 1 Selection of Length Labels 11 1 4 Geometric Embedding Synopsis class abstractMixedGraph 1 virtual TFloat C TNode TDim virtual TFloat CMax TDim virtual TDim DimO Any class may may not provide a geometrical embedding for their graph objects This embedding is needed for the graphical display In case of physical graphs the geometrical embedding may also determine the length labels The method Dim specifies the dimension of the embedding that is the number of coordinates of each graph node The actual ith coordinate of the node v can be obtained by C v i A call CMax i returns the maximum
100. TS There is a constant InfCap which represents infinite capacities This constant appears in GOBLIN files an in GOBLET as an asterisk 5 2 4 Floating Point Numbers Length labels distance labels flow values and subgraph labels are held in floating point numbers of a type TFloat There is a constant InfFloat which is used for undefined values and appears in GOBLIN files and in GOBLET as an asterisk Explicit length labels are considered integral and metric distances are rounded to integrality Even if length and capacity labels are all integral several algorithms cost scaling method for min cost flow subgradient opti mization for TSP deal with fractional node potentials and reduced length labels Weighted matching algorithms deal with half integral potentials modified lengths and flow values Note that the cost scaling algorithm may end up with a suboptimal solution if the length labels are not integral 5 2 5 Handles Handles are integer numbers of a type THandle which are used to iden tify objects There is a constant NoHandle to determine undefined handles which appears in GOBLIN files and in GOBLET as an asterisk 5 2 6 Matrix Indices General matrix indices are integer numbers of a type TIndex There is a constant NoIndex to determine an undefined index When working with linear programs two additional types TVar TRestr occur with special con stants NoVar and NoRestr Although all three types are interchangable the
101. Tuple unsigned long GetTIndexTuple unsigned long GetCharTuple unsigned long Constant unsigned long Length size t AllocateTuple TBaseType TArrayDim void ReadTupleValues TBaseType size t template class TEntry gt TEntry GetTuple CHAPTER 18 PERSISTENCY template lt class TToken gt TToken ReadTuple const TTokenTable listOfParameters TToken endToken TToken undefToken Only a few comments are needed regarded the import of data objects The most basic method is Scan which reads a string separated by white spaces and parentheses called token in what follows Note that an opening paren thesis may not be followed by a white space If string argument is passed to Scan the method checks if this tring equals the scanned token and throws an ERParse exception otherwise If no argument is passed a pointer to the read token is returned The method Seek scans the input searching for the string which has been passed as argument It returns true if the string has been found in the context and false otherwise The methods Head and Tail can be used to determine the position of the last read token within its tuple Accordingly EOF detects the end of an object definition which should coincide with the file end For each base type used in GOBLIN a special method exists which reads a complete tuple These methods take a parameter which specifies the desired length of the tuple and the input is accepted if eith
102. Warn concerns GOBLIN exceptions see Chapter 19 which do not affect the general data integrity More explicitly e By Error MSG WARN an error message is printed only if logWarn is set but no exception is raised e By Error ERR_CHECK error message is printed only if logWarn is set and an exception ERCheck is raised in any circumstances e By Error ERR_REJECTED an exception ERRejected is raised and an error message is printed independently of the value of the flag 151 14 8 LOGGING logWarn This is so since the exception class ERCheck does not necessarily indicate errors For example a call FlowValue s t returns an exception ERCheck if the subgraph does not form an st flow Algorithms may check feasibility by this method and treat the exception as a standard functionality If tests are needed several times by an algorithm the log file should not include corresponding error messages There is pragma LOGGING which is defined in the file config h This definition may be omitted in order to improve the performance Note how ever that only a certain part of the logging module is compiled condition ally namely the information which is assigned with LOG METH2 LOG RES2 MSG WARN and some of the IncreaseLogLevel and DecreaseLogLevel statements 14 3 5 Selection of logging information logMeth LOG_METH Course of algorithms two levels LOG METH2 logMem LOG MEM Memory allocations two levels
103. a combinatorial embedding Furthermore a spanning tree must be available by the predecessor labels The tree edges are replaced by an Hamiltonian cycle in which every of the former edges occurs twice The resulting graph is outerplanar with the new cycle forming the exterior face The graph is drawn with the specialized method described in Section 12 7 Formally spreadOutRegular objects can be obtained from any planar graph But the final drawing step produces readable output only in the situation of regular polyhedra 6 4 DERIVED PERSISTENT OBJECTS 6 4 8 Metric Closure Include file denseGraph h Synopsis class metricGraph public denseGraph metricGraph abstractGraph amp This class defines the metric closure of undirected graphs in which the length of an arc corresponds to the minimum length of a path in the original graph The metric closure is used to generate heuristic hamiltonian cycles for sparse graphs PAY 1 Figure 6 7 A Graph and its Metric Closure 6 4 9 Distance Graphs Include file denseDigraph h Synopsis class distanceGraph public denseDiGraph 1 distanceGraph abstractMixedGraph amp y 61 6 4 DERIVED PERSISTENT OBJECTS This is the asymetric counterpart to the metric closure in which the length of an arc corresponds to the minimum length of a directed path in the original possibly mixed graph object 6 4 10 Complete Orientation Include file sparseDigraph h Synopsis
104. a special data structure persistently If one calls ExtractEmbedding to every arc the left hand face is saved internally The procedure also determines a face with a max imum number y of incident edges marks this face exterior and returns y The running time is O m in the default setting If the graph is disconnected the procedure processes each connected component separately and exports the connected components by the node colours Note that for disconnected graphs a distinction between regions of the complement of plane drawing and faces cycles in the boundary of a region is necessary and that this code handles faces rather than regions Depending on the optional parameters the procedure performs addi tional operations 50 CHAPTER 6 GRAPH OBJECTS e For PLANEXT DUAL the void pointer is interpreted as a abstractMixedGraph pointer to an empty graph which is filled with the dual incidence structure e For PLANEXT GROW the incidence lists are manipulated to obtain an embedding with the maximum of exterior nodes In the extreme case an outerplanar embedding results Here the running time is O m due to nested graph search for exterior separating edges e For PLANEXT CONNECT the connected components are linked such that in the resulting embedding all original components are exterior This graph augmentation effectively corrupts the face assignments Hence a second pass with PLANEXT DEFAULT would be necessary to rebuild
105. able 0 enum TBranchDir LOWER_FIRST 0 RAISE_FIRST 1 virtual TBranchDir DirectionConstructive TIndex 0 virtual TBranchDir DirectionExhaustive TIndex 0 virtual branchNode lt TIndex TObj gt Clone 0 virtual void Raise TIndex 0 virtual void Lower TIndex 0 virtual TObj SolveRelaxation 0 virtual TObjectSense ObjectSense 0 virtual TObj Infeasibility 0 virtual void SaveSolution 0 virtual void LocalSearch This class describes the interface between the generic branch scheme and the problem dependent branch nodes In order to implement a concrete branch and bound solver one just defines a subclass of branchNode which implements all listed prototypes We describe all methods in the order of occurence in the branch scheme 82 CHAPTER 10 BRANCH AND BOUND The method SelectVariable returns the index i of a problem vari able for which the lower and the upper bound still differ and which is relevant in the following sense The current variable value is non integral or restrict ing this variable promises a large change of the optimal objective in one of the new subproblems and a feasible solution in the other subproblem To generate the two new subproblems the branch scheme first calls Clone which returns a copy of the branch node which is currently ex panded Then Lower i is called for the original and Raise i is called for the clone This restricts the value of the variable i to di
106. ad by calling TraceEvent To the list of trace files the solver thread declares every trace file name by calling TraceAppend This also sets the event flag The solver thread 169 15 3 TRACING then calls TraceSemTake before continuing its computations The latter method returns only if the trace event is handled in the user interface The user interface handles a trace event as follows It reads the last trace file name by calling TraceFileName and then calls TraceUnblock which effectively resets the event flag We mention that TraceAppend and TraceFileName allocate copies of the file name string and that the string returned by TraceFileName must be disallocated by the calling context Some future work is at hand It should be possible to read the complete list of trace file names and this list should be editable in the same way as the message queue 170 CHAPTER 15 THE MESSENGER CHAPTER 16 LINEAR PROGRAMMING SUPPORT Chapter 16 Linear Programming Support In order to allow development of this library beyond the scope of pure com binatorial algorithms the author has decided to add some support for linear and integer programming techniques This currently includes e An abstract class goblinILPWrapper which models mixed integer problems and the interface to the GOBLIN core library e basic simplex code which applies to problems with a few 100s of variables but which does not utilize LU decomposition an
107. al or minimum deficiency matching For example optmatch w samples optmatch2 would return the 2 factor depicted in Figure 13 10 since all node demands defined in the input file are 2 The node demands are specified in the input file If you want to distin guish upper and lower bounds on the node degrees you may use the option deg Then the solver expects two additional input files whose names differ from the graph definition file only by the extensions adg respectively bdg The first file consists of the lower degree bounds the second consists of the upper degree bounds The formats are the same as for the graph definition If you want to solve a geometrical problem you must set the metrics in the input file to a value other than zero see Section 11 1 3 for the details 21 1 2 Network Flow Problems The program optflow is the GOBLIN solver for all kinds of network flow problems The input graph must be a directed graph either sparse or com plete 227 21 1 SOLVER APPLICATIONS There are two ways to use this solver One may use the div option and specify a source s and a target node t The solver will try to find a pseudo flow such that all divergences are zero except for s and The divergence of s is maximized and the divergence of t is minimized simultaneously This solver requires that e all lower arc capacities are zero e all node demands are zero except for the nodes s and t e all arc length labels are non ne
108. alue of CHAPTER 13 HIGH LEVEL ALGORITHMS methMinCCirc the method MinimumMeanCycle is called to check for opti mality after each scaling phase and the running time is O mn log n Each of the tightening steps derives potentials for which the b flow is epsilon tight It can been experienced that the method performs much better without ap plying MinimumMeanCycle 13 10 6 The Multi Terminal SAP Method The SAP algorithm starts with sending flow on all arcs which have residual capacity but the reduced length is negative After that operation the com plementary slackness condition is satisfied but many nodes are unbalanced So the remainder of the procedure is sending flow on shortest paths in the residual network and updating the node potentials correspondingly Only a non polynomial complexity order O m U m nlogn for the running times is achieved here but the method performs well in practice In particular it is well suited for post optimization 13 10 7 The Capacity Scaling Method The capacity scaling method MCF_CapacityScaling is a variant of this SAP method which limitates the number of augmentation steps by choosing augmenting paths with sufficiently high capacity The running time is bounded by O mlog U m nlog n but frankly can be achieved only for graphs which have infinite capacity paths be tween each pair of nodes Practically the capacity scaling method performs slightly better than the cost scaling method
109. ameters If the class is MSG_APPEND the passed string is appended at the most recent log entry Otherwise the oldest log entry on the queue is deleted and replaced by the new data The other functions are needed by the user interface for reading the messages which are currently queued The method MsgReset initializes a pointer to the oldest message in the queue The method MsgSkip then MESSAGE QUEUE moves from one entry to another If no more unread log entries exist the flag MsgEOF becomes true The flag MsgVoid indicates if no message is queued at all The following properties of the currently referenced message can be re trieved The message text the class of information the module index and the object handle which all have been passed by the respective LogEntry O and MsgAppend calls The MsgLevel is the context parameter logLevel at the time of writing the log entry In later releases it will be possible to switch between the described online mode and a mode for importing the incremental log file into the messenger and editing 15 3 Tracing Include file nessenger h Synopsis class goblinMessenger 1 void TraceAppend char void TraceSemTake char TraceFilename bool TraceEvent void TraceUnblock The tracing module has two ressources each of which is locked by an own semaphore A list of trace file names and a flag which indicates if there are unhandled trace events and which can be re
110. an viewed via Xfig or GOBLET or the Tcl Tk script display The method Display O is called at each tracing point Every output must be prompted by the user Only useful for console applications 14 5 2 Tracing Data Structures The GOBLIN data structures discussed in Chapter 8 can be traced sep arately from general objects by setting the traceData flag In that case every elementary operation on the used data structures is subject to graph ical tracing The tracing mechanism is restricted to binary heaps Fibon nacci heaps and disjoint set families Stacks and queues do not produce any graphical output 157 GRAPHICAL DISPLAY CHAPTER 14 THE OBJECT CONTROLLER 14 6 Graphical Display Every GOBLIN data object accepts a message Display O which may write some tracing information to the standard output device or to a trace file Graph objects admit textual output which is generated by TextDisplay Synopsis but also graphical output which is generated by Display OO The latter method may call TextDisplay O again but may also write trace files which can be read by GOBLET or the Xfig drawing tool More explicitly the output depends on the context variable displayMode which class goblinController 158 1 admits the alternatives shown in Table 14 6 1 int displayMode Trace files either consist of the graph object its current potential solu tions and context information in the GOBLIN native format or an explicit int xShift c
111. and Planarity 213 20 8 Graph Layout Messages 214 20 9 Graph Node and Arc Messages 215 20 9 1 Node Based Messages 216 20 9 2 Arc Based Messages 217 20 10Graph Optimization 218 20 11 Derived Graph 220 20 12Messages for Undirected Graphs 220 20 13Messages for Directed 221 20 14Messages for Bipartite 221 20 15Messages for Balanced Flow Networks 221 20 16Lamesr Programming 222 20 16 1 Instance Manipulation Messages 222 20 16 2 Instance Retrieval Messages and Basis Access 223 20 16 3 Row and Column Based Messages 223 20 16 4 Row Based 224 20 16 5 Column Based 225 20 16 6 Optimization Messages 225 21 Solver Applications 227 21 1 Solver Applications lt o eoc crec camo cit params 227 21 11 Matching Problems e 227 21 1 2 Network Flow Problems 227 21 1 3 Minimum Spanning Tree Problems 228 21 1 4 Shortest Path Problems 229 21 1 5 Chinese Postman Problems 229 21 1 6 Other 229 21 2 Linear Programunmg 24 044624 ee he ae ee 229 21 3
112. and Right TArc TNode which admit a generic class of iterators More explicitly First v returns some arc with start node v and Right a u returns the successor of the arc a in the inci dence list of the node u The class abstractMixedGraph also provides methods for the caching of iterator objects and for the implicit access to graph iterator objects More information about iterators can be found in Chapter 7 One of the most important features of this class are the methods Display and TextDisplay on which the tracing of all graph objects depends Finally the definition of abstractMixedGraph includes some mathemat ical methods These are basic graph search procedures like BFS and other shortest path algorithms which essentially work on the complete orientation of mixed graphs and methods which totally ignore the arc directions 6 1 2 Undirected Graphs Include file abstractGraph h Abstract graphs inherit from abstract mixed graphs Several optimization problems are associated with this class namely all kinds of matching prob lems and minimum spanning tree problems including the 1 tree problem There are also some algorithms for the symmetric TSP and the metric TSP The matching code and the Christofides heuristics are defined in the file gra2bal cpp 6 1 3 Digraphs and Flow Networks Include file abstractDigraph h CHAPTER 6 GRAPH OBJECTS Abstract digraphs inherit from abstract mixed graphs This class contains only a few
113. anvas depending on the value of diplayMode See Section 14 5 for the file aoe yShift naming policy double xZoom venue aont 14 6 1 Display Mode Options int nodeSize E E e 0 gt int arcLabels po the GOBLET graph browser int arrows int arrowSize 14 6 2 Export of Graphical Information int subgraph int predecessors GOBLIN provides two export filters for graph layouts which are imple int legenda mented by the classes exp2tk and exp2xfig respectively As the names suggest the first class generates some kind of Tcl Tk scripts while the sec char nodeFormatting ond class generates canvases for the xFig drawing tool The xFig files can char arcFormatting be converted to other graphics formats by using the tool fig2dev which usually forms part of the xFig distribution CHAPTER 14 THE OBJECT CONTROLLER 14 6 GRAPHICAL DISPLAY Note that the Tk files generated by exp2tk cannot be executed directly but are input to the GOBLET graph browser If you want to display a trace file on screen without using GOBLET you can use the small Tk script display which does not require the complete installation of the GOSH in terpreter This script is called if displayMode 2 is configured See Section 18 7 for a description of the explicit canvas export methods 159 14 60 GRAPHICAL DISPLAY 14 6 3 Device Independent Layout Synopsis class goblinDisplay 1 protected cha
114. aph A TSP candidate graph is shown in Figure 10 3 It is useful to run the branch and bound procedure twice First perform a candidate search with a limit on the number of branch nodes Take care that some sequences of best first steps can occur Then either run the can didate search again The candidate graph includes the tour found before CHAPTER 10 BRANCH AND BOUND so the good arcs are accumulated or run an exhaustive search which can also improve tours if the gap is small Experiments show that the T SP solver is able to evaluate complete graphs with less than 150 nodes and to candidate graphs with less than 200 nodes See the appendix for some computational results 10 3 3 Asymmetric TSP Include file branchAsyTSP h Nearly all statements of the previous section also apply to the TSP solver for directed graphs However the applied spanning tree method is much less performant and the subgradient optimization is converging slower than in the undirected setting Also only node insertion is available for local search so that optimal tours are found later Experiments have turned out that it is possible to completely evaluate digraphs up to a size of 50 nodes 10 3 4 Node Colouring Include file branchColour h The class branchColour defines an enumer ation scheme rather than a branch and bound solver That is the solver does not minimize the number of colours but tries to find a k colouring for a given number k The stra
115. aph are the 2 element subsets of a finite ground set Two nodes are adjacent if they have an element in common Triangular graphs are interesting for their regularity 66 Figure 6 10 CHAPTER 6 GRAPH OBJECTS A Triangular Graph CHAPTER 7 ITERATORS Chapter 7 Iterators An iterator is an object which allows to access listed information which is encapsulated into another data object In the context of graphs an iterator supplies with a stream of incident arcs for each of the nodes 7 1 Incidence Lists Include file abstractMixedGraph h Synopsis class abstractMixedGraph 1 TArc First TNode TArc Right TNode TArc 1 Node incidence lists are implicitly defined by the methods First and Right which are available in arbitrary graphs but implemented differently In any implementation the method call First v should return an arbitrary arc with start node v and the call Right u a should return an arc which has ITERATOR OBJECTS the same start node as a namely the node u The repetition of the start node is needed to improve the efficiency of the iterator oprations Moreover node incidence lists must be circular and contain all arcs which have the same start node That is for every pair a1 a2 of arcs with common start node a1 must be derefencable from a2 by the method Right The method name Right may suggest that one traverses the node inci dences clockwise In fact this makes sense for sparse graphs embed
116. aph can be computed instantly and the original graph and combinatorial embedding will result An existing drawing of the original graph is translated to the dual graph in a very simple way This drawing does not map back to the original drawing and produces edge crossings at least for the unbounded region It is also possible to generate directed dual graphs where the arcs are oriented as follows e Exterior edges of the primal graph are pointing towards the exterior region CHAPTER 6 GRAPH OBJECTS e If an interior edge is directed in the primal graph the dual arc will cross from the left hand face to the right hand face provided that the edges are ordered clockwise in the primal graph e If an interior edge does not have an explicit orientation the colours of its end nodes are compared and the edge is directed from the smaller colour index to the higher one By this procedure bipolar digraphs acyclic digraphs with a unique source and a unique sink node are mapped to bipolar dual digraphs The dual source and target nodes are available by Source and Target for further processing These nodes are adjacent by the ExteriorArc 6 4 7 Spread Out Planar Graphs Include file sparseGraph h Synopsis class spread OutRegular 1 public graph spreadQutRegular abstractMixedGraph amp TOption 0 This class is intended for displaying regular polyhedra in the plane The in put graph must be planar and already provide
117. ar TNode NoNode class abstractDiGraph 1 TCap TreePacking TNode abstractDiGraph TreePKGInit TCap TreePKGStripTree abstractDiGraph TCap TNode A spanning tree of a graph is a subgraph which connects all nodes but does not contain cycles There is no reason to distinguish between a minimization and a maximization problem for spanning trees We follow the convention to formulate the minimization problem at least as the default setting The spanning tree solver is called like MinTree method characteristic r The shortcut MinTree r applies method MST DEFAULT and characteristic MST_PLAIN A method MST_DEFAULT value is even tually replaced by the value of the context variable methMinTree The parameter r is optional and denotes the root node If r is not specified the member rootNode is used Other than in earlier releases the MinTree interface function is used for both the directed and the undirected setting Accordingly the Edmonds arborescence method can run on undirected graphs with a similar behavior as the Kruskal method at least when the edge lengths are mutually distinct 13 5 SPANNING TREES and the Prim and the Kruskal method apply to mixed and to directed graphs ignoring the edge orientation There is a couple of options which can be passed with characteristic and which all methods allow for e MST_MAX Changes the object sense to maximization e MST_REDUCED Consider the reduced length la
118. ares the data structures which are necessary to reconstruct an augmenting path traversing this blossom The latter task is managed by the meth ods Traverse Expand and ExpandAndAugment which take O nlog n time per each augmentation The FindSupport operations take O n time per phase that is the period between two augmentations of the PD algorithm GOBLIN includes three implementations of the PD algorithm which can be selected by the context flag methPrimalDual The options methPrimalDual 0 methPrimalDual 1 depend ComputeEpsilon whereas the option methPrimalDual 2 depends on ComputeEpsiloni Both methods determine the amount of dual up date that is an update on the node potentials The first procedure searches all arcs and takes O m time whereas the second procedure searches only one arc for each node and hence takes O n time CHAPTER 6 GRAPH OBJECTS In the current state of development methPrimalDual 0 causes the use of PrimalDual0 whereas methPrimalDual 1 and methPrimalDual 2 cause the use of PrimalDual1 Both methods use a dual update technique which takes O m time so that the overall complexity is O nm per phase in dependent of which implementation in used It is planned however to improve PrimalDual1 to O n time 6 3 7 Suboptimal Balanced Flows Include file balancedToalanced h The class bal2bal is the symmetrical counterpart of the class FNW2FNW and hence manages 1 the reduction of the feas
119. aseShapeNodes TNode void DeleteArc TArc void DeleteNode TNode void DeleteArcs void DeleteNodes void ContractArc TArc void IdentifyNodes TNode TNode In the class sparseGraphStructure the node incidence list defining meth ods First TNode and Right are implemented by own data struc tures In addition to the general functionality of node incidence lists sparse graph objects admit the following operations The predecessor of any arc in the incidence list of its start node is returned by the method Left TArc An explicit data structure is gener AT 6 2 PERSISTENT OBJECTS ated from the successor labels by the first call of Left which therefore takes O m computing steps Subsequent calls are O 1 Node incidence lists can be sorted by a method SwapArcs TArc TArc The first arc on a list can be fixed by a method SetFirst TNode TArc Arc directions can be changed by a method FlipArc TArc SetRight al a2 a3 makes ag the successor of a in the start nodes incidence list and make the original successor of a the new successor of If no thirst argument is specified ag is assumed In any case for Left and Right circular lists are maintained The methods StartNode TArc and EndNode TArc are implemented such that arrays for start nodes and end nodes of arcs are generated by the first request Again the first call of StartNode or EndNode takes O m computing steps but subsequent
120. ast one terminal node the procedure returns with partial trees which connect every node to some terminal and with corresponding distance labels The Voronoi regions are also returned by the node partition data structure The formal return value is the number of terminals and the running times are essentially the same as for SPX_Dijkstra 13 1 6 The Bellman Ford Algorithm This method determines a shortest sv path for every node v of the graph Negative length labels are allowed If a negative length cycle is detected the procedure returns an exception ERCheck The running time is O mn 113 NEGATIVE CYCLES 13 1 7 The FIFO Label Correcting Algorithm This method determines a shortest sv path for every node v of the graph Negative length labels are allowed If a negative length cycle is detected the procedure returns an exception ERCheck The running time is O mn This algorithm is a practical improvement of the Bellman Ford procedure Figure 13 2 A T Join Shortest Path 13 1 8 The 7 Join Algorithm The method SPX TJoinO differs from the previous shortest path algorithms in several ways First of all it does not compute a shortest path tree but only a single simple path Furthermore it applies to undirected graphs only In any circumsatnces the method returns an optimal 7 join by the sub graph labels and this subgraph splits into an st path and a couple of not necessarily node disjoint cycles The following situa
121. ata structures and returns a set of subgraph labels which represent the blocks and a colouring which represents the 2 edge connectivity components To store the blocks the arc capacities have to be infinite For both procedures the running time is O m 13 6 4 Open Ear Decomposition and st Numbering An ear decomposition partitions the edge set into simple paths Po P such that both end nodes of gt 1 occur on P5 but the intermediate nodes do not Ear decompositions are stored as edge colours If no cycles occur among P5 Pk the ear decomposition is called an open ear decomposition For given nodes s and t an st numbering is an assignment to the node colours with colour s 0 colour t n 1 and such that for every other node v two neighbors u and w with colour u lt colour v lt colour exist If s and t denote the end nodes of the path in an open ear de composition one can obtain an st numbering by inserting the nodes of each path in the order of appearance right after the start node of the path The method STNumbering computes both data structures simultane ously from a DFS tree which is again obtained from CutNodes It is not possible to choose the nodes s and t independent from each other Instead a so called return arc can be passed whose end nodes are t and s then in that order The input graph must be 2 connected the running time is O m 13 7 Planarity Syno
122. atching code is described in a series of papers of Christian Fremuth Pager and Dieter Jungnickel Balanced Networks Flows I A unifying framework for design and analysis of matching algorithms Networks 33 1 28 1999 Balanced Networks Flows II Simple augmentation algorithms Networks 33 29 41 1999 Balanced Networks Flows III Strongly polynomial algorithms Networks 33 43 56 1999 Balanced Networks Flows V Cycle canceling algorithms Networks 37 202 209 2001 Balanced Networks Flows VII Primal dual algorithms To appear in Networks which constitute part of the theoretical output of the mentioned DFG project 1 7 Contributions The core library has been written and is maintained by Dr Christian Fremuth Paeger University of Augsburg The same applies for this refer ence manual and the GUI application 14 CHAPTER 1 GENERAL STATEMENTS The following people have reviewed earlier versions of this reference man ual Dr Andreas Enge now at Ecole Polytechnique Paris Prof Dr Di eter Jungnickel and Priv Doz Bernhard Schmidt both at the University of Augsburg Andreas Hefele University of Augsburg has tested Release 2 1 Bern hard Schmidt has tested the releases 2 2 2 5 and 2 6 Markus Eisensehr KUKA Controls Augsburg and Bernhard Schmidt University Augsburg have tested the Windows XP setup of release 2 7 Many thanks to Dr Petra Huhn University of Augsburg Priv Doz Dirk Hachenberger
123. ate are in the positive orthant At least one 12 1 3 x coordinate and one y coordinate are zero Attention Do not manipulate the geometrical embedding when working with spheric distances use layout options instead Scale Geometry Seale the geometric embedding to fit into a specified bounding box 113 Node Grids Configure separate invisible grids for graph nodes bend nodes and arc label alignment points 14 6 7 Objects are aligned with this grid during editor operations automatically Optionally move existing nodes to the grid Fit into Window Fits the graph display into the GOBLET main window Zoom In Enlarge the graph display Zoom Out Lessen the graph display Planarity Check for planarity compute a combinatorial embedding explicitly maximize the number of ex terior nodes or compute a planar drawing from an existing combinatorial embedding Force Directed Drawing Basically models the graph nodes as loaded particles and the graph arcs as springs Searches for 12 4 Unrestricted equilibriance of the nodes Force Directed Drawing Similar to the previous method but maintains edge crossing properties That is if the input is a Preserve Geometry planar straight line drawing the result is a planar drawing with the same dual geometry Align Arcs PF Redraw arcs such that loops become visible and parallel arcs can be distinguished 12 1 4 Predecessor Tree Ps Manipulate the geometric embedding in order to expose a given tree of predec
124. ation steps on the artificial arcs are done immediately which do not affect the flow on the original network Example G1 new diGraph sample gob G2 new FNW2FNW G1 G2 gt MaxFlow G2 S8ource G2 Target O if G2 gt Perfect 1 F1 new export sample rst Gi gt WriteFlow F1 delete F1 y delete G2 delete G1 51 6 3 LOGICAL OBJECTS 6 3 2 Layered Auxiliary Networks Include file auxiliaryNetwork h Synopsis class layeredAuxNetwork public abstractDiGraph 1 layeredAuxNetwork abstractFlowNetwork amp TNode void Phase1 void InsertProp TArc void Phase2 bool Blocked TNode TFloat FindPath TNode void TopErasure TArc Layered auxiliary networks are instanciated by the Dinic maximum flow al gorithm and via inheritance by the Micali Vazirani cardinality matching algorithm layered network is a logical view of a flow network but with a different incidence structure Nodes and arcs are the same as for the orginal network and the arc capacities are the residual capacities of the original network The new incidence structure can be manipulated by two specific operations Arc insertions which are implemented by the method InsertProp TArc and topological erasure which is done by the method TopErasure TArc 52 CHAPTER 6 GRAPH OBJECTS Figure 6 3 A flow and a layered auxiliary network Topological erasure is the arc deletion process but in a very efficient im pl
125. avoided The methods SetCUCap SetCLCap SetCDemand SetCOrientation and SetCLength set the current labeling to constant and disallocate the re spective data structures Note that the updates described usually lead to non optimal or even in feasible solutions Post Optimality procedures are problem dependent and hence cannot be supported here 11 3 4 Merging Graphs Synopsis class abstractMixedGraph 1 void Merge abstractMixedGraph amp This method merges a specified graph object into another graph without identifying any of the graph nodes The passed graph is not manipulated but only a copy is generated The addressed graph which stores the result is layouted 102 CHAPTER 11 PROTOTYPES AND DATA STRUCTURES CHAPTER 12 GRAPH DRAWING Chapter 12 Graph Drawing 12 1 Preliminary Remarks By graph drawing we denote techniques to manipulate the graph node coordinates and to add some artificial points for better readability This task is distinguished from the graph display process which maps a draw ing to a computer screen and which assigns some textual information to the nodes and edges in the drawing When dealing with planar graphs draw ing is also distinguished from the embedding phase which determines an appropriate order of the node incidences and selects an exterior face In case of geometric optimization instances the node coordinates also define the edge lengths Here layout methods generally do no
126. be exact that is a valid path is determined for every node which is reachable on a valid path or heuristic For every BNS method and every node with finite distance label a valid augmenting path can be expanded by using the method Expand This method recursively calls CoExpand and utilizes the prop and the petal data structures which are returned by all BNS methods The exact meth ods BNSKocayStone and BNSMicaliVazirani also return an odd set system by the partition data structure The generic solver method BNS calls one of the various BNS meth ods according to the context variable methBNS Note that the DFS heuris tics and the Kameda Munro heuristics are both encoded into the method BNSKamedaMunro which also reads methBNS If a heuristical method is se lected but the target is missed the method BNSKocayStone is called to verify the negative result 13 11 1 The Algorithm by Kocay and Stone This method is in the tradition of the Edmonds Gabow cardinality match ing algorithm and uses a BFS approach It is exact that is it finds a valid augmenting path if there is one Although improved to O m com plexity it cannot beat the running times of the heuristic methods It also fails to compute paths of minimum length but is much simpler than the BALANCED NETWORK SEARCH Micali Vazirani algorithm 13 11 2 The Breadth First Heuristics This is the most simple BNS procedure since it totally ignores the necces sity of blossom shrinking
127. bels instead of the orig inal length labels e MST_ONE_CYCLE Construct a one cycle tree instead of a spanning tree The Kruskal method the enhanced Prim method and the method for mixed graphs can handle arcs with non trivial capacity lower bounds which denote mandatory arcs This mechanism is applied in the branch and bound mod ule of the TSP solver 13 5 1 The Enhanced Prim Algorithm This procedure grows the spanning tree from the root node to the tips If no root node is passed one is selected automatically The resulting tree is returned by the predecessor labels Two versions of this method are provided The running time of the basic version is O n The enhanced code differs from the basic version mainly by using a priority queue for node selection The complexity depends on the special choice of this queue and matches the running times for the Dijkstra algorithm see Section 13 1 4 117 13 5 SPANNING TREES Figure 13 3 Intermediate Step in the Prim Method 13 5 2 The Kruskal Algorithm The procedure returns a spanning tree via the subgraph data structure if one exists If not the connected components are maintained by the par tition data structure The running time is O mlog n due to the needed sorting of the edge by their lengths 13 5 3 Arborescences The method MST Edmonds is an O nm implementation of Edmond s ar borescence algorithm and determines a maximum spanning forest If a root node is
128. bject name object handle Assign a Tcl command name to an existing graph object Try to terminate the solver thread Check if the solver thread is active 209 20 3 ROOT COMMAND CHAPTER 20 THE GOSH INTERPRETER 20 3 3 Messenger Access Just as the context ther is one messenger object shared by all GOSH shells The explicit access to the messenger is restricted to the methods described in Section 15 2 Note that posting a message from Tcl level is implemented by the goblin echo command All listed messages start by goblin messenger The messenger does not keep all raised messages but only the most recent ones The buffer size is just large enough to fill a screen Complete and persistent information is provided by the transscript file so void skip handle level hidden filename blocked unblock class Message class ID 20 3 4 Accessing Timers The commands listed here wrap the functionality described in Section 17 2 All messages start by the prefix goblin timer and the timer index which must be ranged in 0 to expr goblin timers 1 210 CHAPTER 20 THE GOSH INTERPRETER GENERAL OBJECT MESSAGES enable disable label c prev a 1 The running time of timer j relative to the previous cycle of timer i is retrieved by the command goblin timer i child j 20 4 General Object Messages All commands other than the goblin root command are associated with data objects to which messages can be sent Messages
129. bjective Free Status Best Bound Best Lower Active Select 0 5 12 QUEUED 0 5 1 DEPTH 1 4 11 QUEUED 0 5 1 2 4 7 QUEUED 0 5 2 DEPTH 3 4 6 QUEUED 0 5 2 4 4 3 QUEUED 0 5 3 DEPTH 5 3 2 QUEUED 0 5 3 6 4 1 QUEUED 0 5 4 DEPTH 7 3 0 SAVED sa 5 3 8 4 0 SAVED 4 5 3 DEPTH 9 3 1 CUTOFF 4 sb 2 10 3 0 CUTOFF 4 5 2 DEPTH 11 3 5 CUTOFF 4 5 1 12 4 3 CUTOFF 4 5 1 DEPTH 13 4 10 CUTOFF 4 5 0 14 4 7 CUTOFF 4 5 0 IMPLEMENTATIONS Figure 10 2 A Branching Protocol The variable Tree maintains the branch tree which can be displayed graph ically An example of a branch tree can be found in Figure 10 1 and the corresponding logging information is shown in Figure 10 2 The labels of the tree nodes denote the iteration number and the arc labels denote the branching variable 10 3 Implementations 10 3 1 Stable Sets Include file branchStable h In the class branchStable all problem variables are associated with graph nodes Nodes can either be unfixed selected or excluded Every time a node is selected all of its neighbours are excluded node selection corresponds to a call to Raise excluding a node is done by calling Lower Let X denote the set of selected nodes and let T X denote the set of ex cluded nodes The method SelectVariable returns the index of a node which has minimum degree in the graph restricted to VV X UT X By the definitions of DirectionConstructive and DirectionExhaustive the s
130. blems the number of branch nodes has been restricted to 1000 so that no optimality proof is obtained but the lower bound is improved 152 73682 73682 185475 1136 1159 42080 41925 42168 56s u159 42080 41925 42080 1325 9352 01159 42080 42080 4305 204 81175 21407 21375 21426 2785 brg180 1950 1950 2020 5188 brg180 1950 1950 248s 10478 Instance Opt Method Root Found Gap Time Branch br17 39 SGO 7 39 1s ftv33 1286 SGO 11 1286 05 ftv35 1473 SGO 11 1456 1484 45 ftv35 1473 EXH 11 1473 115 23 ftv38 1530 SGO 7 1512 1541 2s ftv38 1530 CAND 7 1514 1530 5s 284 ftv38 1530 EXH 7 1530 30s 56 p43 5620 SGO2 40 5611 5629 29s rat195 2323 rat195 2323 2300 2379 2975 2300 2323 2145s 23784 d198 15780 15712 15825 450s d198 15780 15712 15780 802s 15196 kroA200 29368 29065 30043 104s kroA200 29368 29065 29368 170155 91520 kroB200 29487 29165 30364 87s p43 5620 CAND 40 5611 5620 1629s 5000 p43 5620 EXH 40 5614 5620 1133s 100 22 2 Asymmetric TSP ftv44 1613 SGO 17 1581 1708 35 ftv44 1613 CAND 17 1583 1634 35s 596 All computations were performed with the GOBLET graph browser 2 7 2 ftv44 1613 EXH 17 1613 175s 164 on an Athlon XP 1800 PC with 256 MB RAM and SuSE Linux 10 0 and ftv47 1776 SGO 17 1748 1932 4s without gcc optimization The test problems are all from the TSPLIB ftv47 1776 CAND 17 1748 1776 275 542 ftv47 1776 EXH 17 1776 156s 190 http www iwr uni heidelberg de groups ry48p 144
131. blin protected ERRejected protected ERRejected Throughout this document we have described the exceptions which are thrown by the various methods On the other hand we did not list any declarations of exceptions Instead of this we formulate the general policy which exceptions should be used in which circumstances EXCEPTION HANDLING An exception ERInternal indicates that a data structure has been cor rupted by an error prone method The calling context is asked to destruct this object This error class is a dummy That is such exceptions may be thrown but should not occur in a method signature Hence instead of the GOBLIN exceptions an unexpected exception is thrown which usually causes the termination of a program We mention that absobj h defines macros InternalError scope event and InternalErrori scope which write some debug information includ ing file and line information and then raise an internal error The first macro takes two strings the second reads the event description from CT logBuffer Use these macros consequently but be aware that they can be applied from data object methods only An exception ERRange is returned if an array index exeeds the limits Occasionally another data structure has been corrupted by the calling con text before and the calling context cannot handle the exception In that sense ERRange may also denote an internal error An exception ERRejected indicates that a method failed
132. bstractMixedGraph 1 enum TOptFDP 1 105 STRAIGHT LINE DRAWING FDP DEFAULT 1 FDP SPRING 0 FDP GEM 1 FDP PLANAR 2 F void Layout_ForceDirected TOptFDP FDP_DEFAULT int 0 void Layout_PlanarFDP int 0 void Layout SpringEmbedder TFloat O TFloat 0 void Layout GEMDrawing TOptFDP FDP_GEM int 0 The method Layout_ForceDirected method spacing is the interface to a couple of layout methods which all are force directed These kind of methods apply to general graph objects and can help to exhibit graph sym metries If method does not specified otherwise the applied method is determined by the context parameter methFDP The role of the parameter spacing is the same as for the circular layout method The method Layout SpringEmbedder gamma delta models the graph nodes as loaded particles and the graph arcs as springs in the x y plane The parameters work as constants for the respective forces Starting with the present embedding a Newton iteration scheme searches for equilibriance of the modelled forces The main disadvantage of this algorithm is its poor performance The input graph should be connected for otherwise the con nected components diverge For practical purposes it is recommended to apply Layout __GEMDrawing instead of the classic spring embedder This algorithm moves only one node at a time In addition to the forces discussed before attraction to the center of gravity is modelled T
133. by 123 13 8 4 The Push amp Relabel Algorithm by Goldberg and Tarjan123 13 8 5 Admissible Circulations and b Flows 124 13 8 6 Proposed Extension 13 9 Minimum Cuts and Connectivity Numbers 13 10Minimum Cost Flows lt o 13 10 1 The SAP Algorithm by Busacker Gowen 13 10 2 The Refined SAP Algorithm by Edmonds and Karp 13 10 3 The Cycle Canceling Algorithm by Klein 13 10 4 The Minimum Mean Cycle Canceling Algorithm 13 10 5 The Cost Scaling Algorithm 13 10 6 The Multi Terminal SAP Method 13 10 7 The Capacity Scaling 13 10 8 The Primal Network Simplex Method 13 11 Balanced Network Search 13 11 1 The Algorithm by Kocay and Stone 13 11 2 The Breadth First Heuristics 13 11 3 The Depth First Heuristics by Kameda and Munro 13 11 4 The Algorithm by Micali and Vazirani 13 12Maximum Balanced Network Flows 13 12 1 The Balanced Augmentation Algorithm 13 12 2 The Capacity Scaling Algorithm 13 12 3 The Phase Ordered Algorithm 13 12 4 The Cycle Canceling Algorithm 13 13Weighted Balanced Network Flow Algorithms 13 13 1 The Primal Dual Algorithm 13 13 2 The Enhanced Primal Dual Algorithm 13 14Matching e a oa 2 0064 ee Re 13 157 Join and Postman Problems 13 15 1 T Joins 13 15 2 Th Undirected CPP ee ee ook 135
134. by the branch scheme are locally optimal On the other hand this method will be called only rarely 10 2 Generic Algorithm Include file branchScheme h Synopsis template lt class TIndex class TObj gt class branchScheme public goblinDataObject private branchNode lt TIndex TObj gt firstActive diGraph Tree protected Figure 10 1 A Branch Tree void Optimize throw 83 10 2 GENERIC ALGORITHM 84 bool Inspect branchNode lt TIndex TObj gt branchNode lt TIndex TObj gt SelectActiveNode void QueueExploredNode branchNode lt TIndex TObj gt void StripQueue public TIndex nActive TIndex nIterations TIndex nDFS bool feasible TObj savedObjective TObj bestBound enum TSearchLevel SEARCH FEASIBLE 0 SEARCH CONSTRUCT 1 SEARCH EXHAUSTIVE 2 TSearchLevel level branchScheme branchNode lt TIndex TObj gt TObj TSearchLevel SEARCH_EXHAUSTIVE enum TSearchState INITIAL_DFS 0 CONSTRUCT_BFS 1 EXHAUSTIVE_BFS 2 EXHAUSTIVE_DFS 3 TSearchState SearchState CHAPTER 10 BRANCH AND BOUND unsigned long Size unsigned long Allocated Hh Once a class of branch nodes is available the application of the branch and bound algorithm is as simple as possible Just instanciate the root node an object which inherits from branchNode and then a branchScheme ob ject The branchScheme constructor takes the root node as a parameter and im
135. c tours e SGO2 Exhaustive 1 tree subgradient optimization with local search enabled e CAND Branch and bound on a candidate graph with local search enabled and with methCandidates 0 e CND2 As before but with methRelaxTSP2 2 COMPUTATIONAL RESULTS e EXH Branch and bound on the entire graph with local search dis abled e EXH2 As before but with methRelaxTSP2 2 The initial tours were obtained from random tours with local search enabled Note that the candidate graph generation also includes such random tours The performance of the available construction heuristics is not tested With a few exceptions marked by an asterisk the branch and bound has not been restricted in terms of running times or memory usage Prac tically one would interrupt the candidate search after a certain number of branching steps Instance Opt Method Root Found Gap Time Branch burmal4 3323 3323 ulysses16 6859 6859 erl7 2085 2085 gr21 2707 2707 ulysses22 1013 1013 gr24 1272 1272 fri26 937 937 bayg29 1610 1610 bays29 2020 2020 dantzig42 699 697 699 dantzig42 699 699 swiss42 1273 1272 1273 swiss42 1273 1273 hk48 11461 11445 11461 hk48 11461 11461 gr48 5046 4959 5055 gr48 5046 4959 5046 gr48 5046 5046 eil51 426 423 432 eil51 426 423 426 eil51 426 426 berlin52 7542 7542 233 22 1 SYMMETRIC TSP Instance brazil58 brazil58 st70 st70 st70 eil76 eil76 eil76 pr76 pr76 pr76 gr96 gr96 gr96
136. c method EndNode effectively determines the start node of the reverse arc We mention that StartNode utilizes an array in sparse graphs but merely evaluates the arc indices in dense graphs Once node and arc incidences are available GOBLIN can automatically compute node adjacencies that are arcs joining two given nodes by main taining an adequate data structure Hence node adjacencies are not really graph defining data structures but rather redundant information which can be generated and disposed dynamically The data structure used for node adjacencies is a hash table which is generated by the first call to Adjacency O Note that the operations on this hash table are not bounded polynomially but the computation of an adjacency can be practically considered an elementary operation The gen eration of this hash table can be suppressed by disabeling the context flag methAdjacency 91 11 1 GRAPH DEFINITION The returned arc is always non blocking That is in digraphs no back ward arcs are returned If the adjacency is ambiguous that is if parallel arc exist the returned arc index is the minimal one The method call MarkAdjacency u v a specifies the arc a to be re turned by Adjacency u v This is needed to maintain the adjacency table during graph insertion and deletion operations Some classes override the generic implementations of EndNode and Adjacency O for reasons of efficiency In any case the generic code is help
137. calls take O 1 steps Since sparse graphs are usually grown from scratch only file construc tors work somewhat differently the class sparseGraphStructure allows to predefine the final dimensions by the method ReSize TNode TArc which effectively prevents the iterated reallocation of the data structures The insertion of an arc connecting the nodes with indices v and w is achieved by InsertArc v w InsertArc v w uc ll or InsertArc v w uc lc 11 respectively Each of the methods return the index of the new arc One may explicitly assign an upper capacity bound uc a lower capacity bound 1c and a length label 11 to the new arc If no labels are specified the labels are set to default values or to random values depending on how the random generator is configured Once an arc is present an alignment point for the arc label and bend nodes for the arc drawing can be defined by the methods InsertAlignmentPoint and InsertBendNode respectively Example TArc a InsertArc v v TNode x InsertAlignmentPoint TNode InsertBendNode x 48 CHAPTER 6 GRAPH OBJECTS TNode gt InsertBendNode y introduces a new graph edge namely a loop which has two bend nodes y z and whose labels are drawn at the position of zr The coordinates have to be specified by the method SetC separately To delete arcs the following operations are provided CancelArc TArc which deletes an arc and its reverse arc from the incidence lis
138. cences are written to trace files But one can also call the component TreePKGStrip which manipulates a copy of the digraph and one by one returns the ar borescences via the predecessor labels of the original graph and also returns the corresponding tree capacity The graph copy is generated by the method TreePKGInit The complete method looks like this Example TCap totalMultiplicity StrongEdgeConnectivity r abstractDiGraph TreePKGInit while totalMultiplicity gt 0 CHAPTER 13 HIGH LEVEL ALGORITHMS TreePKGStrip G amp totalMultiplicity r Use the predecessor labels delete The tree packing method is non polynomial also slow in practice ap plies to directed graphs only Note that the application to the complete orientation does not yield a tree packing in the undirected sense 13 5 6 Proposed Extension cycle canceling method for post optimization of spanning trees 13 6 Connected Components Synopsis class abstractMixedGraph 1 bool Connected bool StronglyConnected bool CutNodes TNode NULL TArc NULL TNode NULL TArc NoArc bool TwoConnected bool STNumbering TArc NoArc 13 6 1 First Order Connectivity The DFS method Connected decides whether a graph is connected or not and returns 1 or 0 respectively In the latter case the connected compo nents are available by the node colour data structure The running time is O m Note that the
139. ces the nodes until a node is reached with is already placed Then a new thread of search is started In particular the procedure exhibits Hamiltonian cycles If no predecessor labels are available nodes are placed by their indices e Layout_CircularByColours The nodes are displayed by their colour index By that colour clusters and special node orderings can be exhibited If no predecessor labels are available nodes are placed by their indices e Layout_Outerplanar This checks if an outerplanar embedding is available and occasionally exhibits this embedding If methLocal is set the planar FDP method is called to improve the circular drawing When calling Layout Circular OO it applies on of the described methods in that order of preference TREE LAYOUT 12 3 Tree Layout Include file abstractMixedGraph h Synopsis class abstractMixedGraph 1 enum TOptAlign 1 ALIGN LEFT ALIGN CENTER ALIGN RIGHT void Layout PredecessorTree TOptAlign ALIGN CENTER TFloat O TFloat 0 The method Layout PredecessorTree method dx dy determines a x y plane layout based on the predecessor labels The predecessor labels must exist and form a forest of rooted trees Connectivity is not required The parameters dx and dy hereby denote the horizontal respectively the verti cal node distance If no values are specified the context variable nodeSep comes into play 12 4 Force Directed Placement Synopsis class a
140. cess to some basis dependent data only CHAPTER 16 LINEAR PROGRAMMING SUPPORT 16 1 4 Basis Dependent Methods Include file ilpWrapper h Synopsis class goblinILPWrapper ResetBasis Initial virtual void virtual bool enum TRestrType BASIC_LB 0 BASIC_UB 1 NON_BASIC 2 RESTR_CANCELED 3 virtual TRestrType RestrType TRestr virtual TRestr Index TVar virtual TRestr RowIndex TRestr virtual TVar RevIndex TRestr enum TLowerUpper LOWER O UPPER 1 virtual void SetRestrType TRestr TLowerUpper SetIndex TRestr TVar TLowerUpper Pivot TIndex TIndex TLowerUpper virtual void virtual void virtual TFloat X TVar throw ERRange virtual TFloat Y TRestr TLowerUpper throw ERRange virtual TFloat ObjVal Q virtual TFloat Slack TRestr TLowerUpper 16 1 PUBLIC INTERFACE virtual TFloat Tableau TIndex TIndex virtual TFloat BaseInverse TIndex TIndex PrimalFeasible DualFeasible virtual bool virtual bool All throughout lifetime a goblinILPWrapper maintains some kind of basis An initial basis is provided by the method ResetBasis This basis may consist of the variable range restrictions but other mechanisms are also pos sible The flag Initial indicates the state of the basis correspondingly The current row basis is accessed by the mappings Index and RevIndex which are inverse The method Index returns the basis row assigned with a given variable More p
141. ch for an admissible b flow instead 13 8 1 The Augmentation Algorithm by Edmonds and Karp This is the basic max flow algorithm which depends on the search method BFS The used data structures are the subgraph the predecessor labels and the distance labels which determine a corresponding minimum cut eventu ally The method runs in O nm computing steps 13 8 2 The Capacity Scaling Algorithm The method CapacityScaling splits the balanced augmentation algo rithm into scaling phases In the delta phase only the arcs with ResCap a gt delta are eligible The parameter delta is initialized to the maximum capacity and divided by 2 if no more augmenting paths can be found in this scaling phase The resulting time bound is O m log U where U 13 8 3 The Blocking Flow Algorithm This method heavily depends on the class 1ayeredAuxNetwork which is de scribed in Section 6 3 2 In contrast to the augmentation algorithm the Dinic method does not compute the distance and predecessor labels be fore every augmentation step but grows an acyclic incidence structure to perform a couple of augmentations 123 MINIMUM CUTS AND CONNECTIVITY NUMBERS The method runs in O n m computing steps which is inferior to the push and relabel algorithm but performs better in many practical situa tions At least in the case where all arc capacities are one the Dinic method is the most efficient and robust of the max
142. cle which is applied If no negative length cycle exists the circulation is optimal and the proce dure halts The procedure is non polynomial and also performs very badly in prac tice It is only useful for post optimization and educational purposes 13 10 4 The Minimum Mean Cycle Canceling Algorithm This is a strongly polynomial specialization of the cycle canceling method where all augmenting cycles are minimum mean cycles The running time is O n m log n and O n m log nC where C max length a The major drawback is the fact that the procedure requires O n units of stor age In our experience it is also too slow to solve practical min cost flow problems 13 10 5 The Cost Scaling Algorithm An e optimal b flow is a b flow such that one can find node potentials with RedLength a epsilon for every arc which satisfies ResCap a gt 0 A b flow is e tight if it is e optimal but it is not optimal for any lt The cost scaling algorithm iteratively transforms a 2e optimal b flow and compliant node potentials into an e optimal b flow and a corresponding set of potentials During such a scaling phase the method manipulates an e optimal pseudo flow rather than a b flow It performs push and relabel operations similar to the non weighted algorithm until every node is balanced The running time is O n log nC for the basic version without epsilon tightening If tightening operations are enabled depending on the v
143. clude file fileExport h Synopsis class goblinExport goblinExport char goblinController amp goblinDefaultContext void StartTuple char char char 0 void StartTuple unsigned long char char 0 void EndTuple template lt typename T gt void MakeItem T value char length void MakeNoItem char 1 This class supports file export of data objects into a hierarchical format In this format data object is essentially a tree The non leaf nodes of PERSISTENCY this tree are called tuples they start and end with a parenthesis Between these two parenthesis a label and the child nodes are listed child nodes must be of the same type that is either they are all tuples or they are all numbers of a certain type Needless to say that this simple concept does not only work for graph objects but is adequate for any data object which essentially consists of vectors Every StartTuple operation must be matched by an EndTupleO operation and vice versa These operations write parenthesis and re spectively It is checked if the number of parentheses resolve in the end and if there are unmatched opening parenthesis intermediately The first parameter of a StartTuple label type call is a header in formation which is written either a string which should not contain any white spaces or an integer number which represents some kind of index The second parameter is the type of the tuple If zero the tuple is a
144. colour 1 to the remaining nodes ExtractBipartition assigns colour zero to all nodes with even finite distance labels and colour 1 to the remain ing nodes ExtractColours saves a non persistent node partition into a consecutive series of node colours 11 2 8 Partitions of the Node Set Synopsis class abstractMixedGraph 1 protected CHAPTER 11 PROTOTYPES AND DATA STRUCTURES goblinDisjointSetSystem lt TNode gt partition public InitPartition Bud TNode v Merge TNode u TNode v Find TNode v ReleasePartition virtual void virtual void virtual void virtual TNode virtual void The partition data structure is a disjoint set union data structure In con trast to the most data structures which were discussed here a partition is a high level data structure which cannot be written to a file and reconstructed properly The methods are only shortcuts for the operations described in Section 8 2 1 That is Bud v generates a one elementary set which consists of v Merge x y unifies the sets containing x and y and Find w returns the canonical element of the set cotaining w 11 2 9 Blossoms Synopsis class abstractBalancedFNW 1 protected TNode base public void InitBlossoms void ReleaseBlossoms POTENTIAL SOLUTIONS TNode Base TNode v void Shrink TNode u TNode v Blossoms are the symmetric specialization of the node partition data struc ture and override the general
145. coordinates depending on spacing or the context parameter nodeSep The time complexity is O m The procedure uses the canonically ordered partition which is discussed in the next chapter This structure and the convexity of the interior faces require that the input graph is triconnected CHAPTER 12 GRAPH DRAWING When calling Layout StraightLineDrawing a spacing the graph is triangulated and to the triangulation the convex drawing method is ap plied The time complexity is O n If methLocal is set the planar FDP method is called to improve the drawing of the original graph This post processing is necessary at least if a lot of artificial edges have been added See Section 13 7 for more details about triangulations 12 6 Orthogonal Drawing Include file abstractMixedGraph h Synopsis class abstractMixedGraph enum TOptOrthogonal ORTHO_DEFAULT 1 ORTHO EXPLICIT 0 ORTHO_EULER 1 ORTHO_DEG4 2 ORTHO_4PLANAR 3 ORTHO_VISIBILITY 4 ORTHO_VISIBILITY_TRIM 5 ORTHO_VISIBILITY_GIOTTO 6 void Layout OrthogonaliBent TOptOrthogonal ORTHO DEFAULT int 0 void Layout OrthogonalDeg4 TOptOrthogonal ORTHO APLANAR int 0 void Layout VisibilityRepresentation TOptOrthogonal ORTHO VISIBILITY TRIM int 0 ORTHOGONAL DRAWING In an orthogonal drawing every edge is represented by an alternating se quence of horizontal and vertical line segments If the nodes are drawn without dimension th
146. cted The difference between Read and Peek is that the latter method does not mark any incidences unread To do this explicitly that is to proceed in the incidence list one calls Skip statement a I Read v does the same as the sequence a I Peek v I Skip v Example goblinIterator I new goblinIterator G TFloat L InfFloat for v 0 v lt G NQ v while G Dist v lt InfFloat amp amp I gt Active v I Read v TNode w G EndNode a if G Dist w lt InfFloat amp amp G Length a gt L L G Length a delete I determines the maximum length of an arc spanned by the nodes with finite distance labels in the graph G Note that this code is optimal only if the node set is rather small 68 CHAPTER 7 ITERATORS 7 3 Implicit Access Include file abstractMixedGraph h Synopsis class abstractMixedGraph THandle Investigate goblinIterator amp Iterator 1 void Reset THandle TNode NoNode TArc Read THandle TNode bool Active THandle TNode void Close THand1le void ReleaseIterators F Node incidences are accessed by iterators This may be done explicitly as described in the previous section There is however an equivalent formu lation where all iterator functionality is encapsulated into the referenced graph object Example TFloat L InfFloat THandle H G Investigate for v 0 v lt N v while G Dist v lt InfFloat amp amp G
147. d GaussElim applies to squares matrices only and tries to solve a linear equation system where the matrix parameter acts as the right hand side The second parameter denotes the absolut value at which matrix entries are treated as zero If omitted the context parameter epsilon is used Of course both matrices must have compliant dimensions Be aware that both input matrices are manipulated by the method If the initial left hand matrix is regular it is transformed to the identity If the right hand matrix is a column vector it is transformed to the unique solution vector By passing a right hand identity the left hand matrix is effectively inverted If the initial left hand matrix is singular an exception is thrown without reaching a triangular left hand form Since the method indeed implements Gauss elimination the complexity is O k k 1 where k denotes the left hand dimensions and is the number of right hand columns The matrix functionality may increase in future but only to speed up certain high level operations It is not planned to grow a linear algebra package 8 5 MATRICES 77 8 5 MATRICES CHAPTER 8 EXPLICIT DATA STRUCTURES 78 CHAPTER 9 INDEX SETS Chapter 9 Index Sets Index sets encode lists of integers which refer to node or arc indices in a graph or to rows or columns in an LP object Other than the container objects which have been described in the previous chapter an index set is basically determine
148. d by its constructor call It is not possible to manipulate the content or order of indices The general purpose of index sets is to supply high level algorithms with input data The concept is related to STL iterators though not as elaborate and currently with only few applications What is passed to algorithms in the STL language are rather containers than iterators There are basic class templates to specify all none or single indices of an interval 0 1 r 1 But there are also classes to collect all graph entities with a specific property 9 1 Interface Include file indexSet h Synopsis template class TItem gt class indexSet INDEX SETS 1 virtual bool IsMember const TItem const 0 virtual TItem First const virtual TItem Successor const TItem const index sets provide the following operations e IsMember i checks if the index 7 is in the set e First returns a contained index if one exists and an arbitrary index out of range otherwise e Successor i returns the successor of index in an arbitrary but fixed ordering of all contained indices and an arbitrary index out of range for the final index in that list When inheriting from this base class it is mandatory to implement IsMember It is recommended to reimplement First and Successor whenever it is possible to enumerate the contained indices more efficiently than enumerating all indices in range as the default codes do
149. d matching problems which have a few 1000s of nodes would require the _BIG_ARCS_ pragma The default configuration is chosen to support the full functionality of GOBLIN If you want to compile the final version of a problem solver you may delete the pragma definitions define LOGGING define _FAILSAVE_ define _TRACING_ define _HEAP_MON_ from the file configuration h In our experience this may decrease the running times by somewhat like 30 percent The final code is much smaller too We mention what is lost if these pragmas are unset The _LOGGING_ pragma filters only the low level logging information The _FAILSAVE_ pragma enables or disables most error detections includ ing wrong instrumentation of the C API and excluding some buffer over flows This pragma seems to be the most important for code optimization CHAPTER 2 INSTALLATION but if your solver includes any bugs you have to recompile the entire library to get some hints The HEAP MON define enables the compilation of special versions of new and delete and should be omitted in case of incompatibility with other C modules If the _TRACING_ pragma is not present the graphical display and the options traceLevel gt 1 are disabled The option traceLevel 1 which helps you to decide whether your solver is still alive works even then If the GOSH interpreter is compiled without the _TRACING_ pragma the GOBLET graph browser does not produce trace files 2 5 The Makefi
150. d sophisti cated pricing techniques yet e LP module entry point which is also designed as an abstract class goblinILPModule and which can be overloaded with plugins for other LP codes e File import and export filters which can supply to LP solvers other than the native simplex code Future releases may come up with a more efficient simplex code as well as with branch and cut techniques Additionally plugins for popular LP codes are desirable LINEAR PROGRAMMING SUPPORT This chapter mainly discusses the method prototypes Of course all pure virtual messages must be implemented by any prospective LP wrapper Some virtual functions provide default implementations which can be over loaded with more immediate code Others are needed for user interaction only and hence provide dummy implementations which throw exceptions if called from the GOBLET browser 171 PUBLIC INTERFACE 16 1 Public Interface 16 1 1 Entry Point Include file ilpWrapper h Synopsis class goblinController 1 void const pLPModule class goblinILPModule 1 goblinILPModule virtual goblinILPWrapper NewInstance TRestr TVar TIndex TObjectSense goblinController amp 0 virtual goblinILPWrapper ReadInstance char goblinController amp 0 virtual goblinILPWrapper Reinterprete void 0 virtual virtual virtual virtual virtual virtual char int int char char char Authors 0 MajorRelease Min
151. date 56 ear decomposition 119 edge connectivity number 125 elementary operation 39 74 eligible arc 112 Eulerian cycle 135 excess scaling 124 exterior face 121 faces 50 242 first in first out principle 73 flow value 122 force directed 106 forward arcs 40 general position 108 geometric embedding dimension 93 geometric optimization instances 103 GIOTTO 107 global timers 188 GOBLIN file token 194 tuple 193 type 193 vector 196 graph Eulerian 135 graph drawing 103 hamiltonian cycle 137 hash function 75 hash table 75 collisions 75 implementation classes 43 index set ivalidation 80 induced subgraph 64 inner nodes 39 internally triconnected 121 invalidated 101 Kandinski 107 INDEX INDEX last in first out principle 73 layout model 103 Layout models 103 line graph 58 linear program 174 maximum cut 142 metric closure 61 modified length labels 56 multiple partial pricing 130 network programming problem with side constraints 198 network programming problems 11 node balanced 122 node adjacencies 91 node capacities 125 node colouring 87 140 active node 87 dominated node 87 node incidence predecessor 48 successor 44 node splitting 62 objective function 198 odd cycle canceling problem 57 open ear decomposition 120 outer nodes 39 outerplanar graph 121 partial pricing 130 persistent 46 persistent object 46 personal
152. de 124 CHAPTER 13 HIGH LEVEL ALGORITHMS 13 8 5 Admissible Circulations and b Flows An b flow of a flow network is a pseudo flow such that all nodes are bal anced In the special situation where all node demands are zero the b flows are also called circulations The method AdmissibleCirculation decides whether an admissible b flow exists or not This is achieved by using the class FNW2FNW which is described in Section 6 3 1 and the generic solver method MaxFlow Since the parameters n m and U grow only by a constant factor during the prob lem transformation the complexity bounds are the same as for the used max flow methods 13 8 6 Proposed Extension The MKM blocking flow algorithm methMaxFlow Successive augmentation Blocking flows Dinic Push amp relabel FIFO Push amp relabel highest order Push amp relabel excess scaling Capacity scaling Table 13 1 Maximum Flow Solver Options 13 9 Minimum Cuts and Connectivity Numbers Synopsis class abstractMixedGraph CHAPTER 13 HIGH LEVEL ALGORITHMS 13 9 MINIMUM CUTS AND CONNECTIVITY NUMBERS virtual bool Connected TCap Table 13 2 Minimum Cut Solver Options virtual bool EdgeConnected TCap In GOBLIN there are two sets of methods which check for graph connec virtual bool StronglyConnected TCap tivity and which are listed above The methods of the first series take the virtual bool StronglyEdgeConnected TCap desired connectivity order k a
153. de TSPLocalSearch TArc TSP2Exchange TArc TFloat 0 TSPSubOptiTree TNode TFloat InfFloat TOption 1 TSPBranchAndBound TNode TFloat InfFloat 13 16 TSP ALGORITHMS class denseDiGraph 1 TFloat TSPHeuristics TNode class denseGraph TFloat TSPHeuristics TNode hamiltonian cycle or tour is an eligible cycle which traverses every node exactly once The traveling salesman problem TSP asks for a tour of minimum length In GOBLIN tours are represented by the predecessor labels The general TSP solver is defined by the method TSP This method is controlled by the configuration parameters methTSP methSolve and methLocal The parameters methTSP allows to select from several TSP heuristics and methLocal enables or disables local search routines The parameter methSolve determines the general optimization level If its value is zero only a heuristic tour is computed If its value is one a subgradient optimization is performed to obtain good lower bounds For higher values of methSolve the problem can be solved to optimality by branch and bound When the TSP solver starts it first checks if a 1 tree exists to sort out some infeasible instances The configuration parameters methSolve and methLocal are designed to control other hard problem solvers too but there is no application yet The optional node passed to TSP is used by the TSP heuristics in different ways and may help to produce good startin
154. ded in plane The most algorithms which run on planar graphs require that Right provides a combinatorial embedding of the graph Accordingly the method Left which is available for sparse graph ob jects supplies with reverse incidence lists In the mentioned cases Left defines combinatorial embedding and traverses the node incidences anti clockwise 7 2 Iterator Objects Include file goblinIterator h Synopsis class goblinIterator public virtual goblinDataObject goblinIterator abstractMixedGraph amp void Reset 0 void Reset TNode 0 TArc Read TNode 0 TArc Peek TNode 0 void Skip TNode 0 bool Active TNode 0 Node incidences may either be accessed directly using the methods First and Right or by an iterator object which has some advantages 67 IMPLICIT ACCESS e The code looks more tidy more like high level description e There is mechanism for caching iterator objects By that the fre quency of memory allocation and deallocation operations is reduced e Development is speeded up since memory faults can be avoided The possible iterator methods can be described within a few words The method Reset is used to reinitialize incidence streams either of a single node or the whole node set The method Active checks if there are unread incidences of a given node In that case the methods Read and Peek return such an unread incidence Otherwise Read and Peek throw an exception ERReje
155. delete and delete have been overwritten If conflicts with other C modules arise the entire func tionality can be turned off at compile time via the pragma _HEAP_MON_ The function GoblinRealloc does the same as the C function but a new name has been chosen to separate from C memory management Note that a block of memory which was allocated with the default im plementation of new cannot be disallocated with the GOBLIN version of delete Do also take care that new and delete are matching for sake of later redesigns If desired the calling class method has to provide meaningful logging information about allocation and disallocation of implicit objects objects which are not GOBLIN data objects A typical sequence of statements is like follows Example thisArray new TFloat 100 LogEntry LOG_MEM Handle Array allocated 17 2 TIMERS thisArray TFloat GoblinRealloc sizeof TFloat 200 LogEntry LOG MEM Handle Array resized delete thisArray LogEntry LOG MEM Handle Array disallocated Independently from the described heap information one can retrieve the size of any object by calling Size The returned amount is the actual object size via sizeof plus the amount of heap memory referenced by this object other than GOBLIN data objects Calling Size for an object controller would return its actual object size plus the size of all managed data objects 17 2 Timers Includ
156. do a Right a 1 while a a0 Supposed that the graph is connected all faces are traversed counter clock wise except for the exterior face which is traversed clockwise Every graph object may provide a combinatorial embedding from its own but only sparse graph objects admit manipulation of the incidence lists Arc deletions and contractions maintain a combinatorial embedding but some care is necessary when edges are inserted into an incidence structure The idea is that arcs are always inserted into the exterior face Calling MarkExteriorFace a sets the First incidences appropriately so that inserting an arc into the face left hand of a will preserve the embedding The arc a is saved as a representant of the exterior face and can be retrieved again by calling ExteriorArc 49 LOGICAL OBJECTS Of course it is possible to mark a face exterior insert edges and then re vert to the original exterior face The running time of MarkExteriorFace is proportional to the number of arcs of the selected face Another effect of this method is that the face of a given arc ag can be traversed in the converse usually clockwise direction of the previous ex ample but only if the graph is biconnected Example TArc aExt ExteriorArc MarkExteriorFace a0 TArc a a0 do TNode StartNode a First v 1 while 0 MarkExteriorFace aExt There is no need to store a planar embedding in
157. do not want any graphical output or if the pure geometric em bedding is satisfactory the dimension n3 should be zero and the layout part should look as follows layout model 6 align thread The displayed order of tuples is realized by the file export interface When reading from file the order is immaterial and tuples can be omitted instead of passing default values 18 4 5 Potential Solutions solutions gt solutions label float gt predecessor lt gt subgraph lt float gt potential lt float gt nodeColour lt node gt 199 FILE FORMAT FOR LINEAR PROGRAMS edgeColour lt arc This part keeps the computational results and corresponds to the internal data structures discussed in Chapter 13 If an object is imported from file the internal data structures are initialized with the external data This can be used for post optimization procedures Some care is recommended when a graph object is exported internal data structures which are not needed any longer should be deleted explicitly before file export If possible subgraphs should be converted to predecessor labels There are methods available for the conversion of paths trees and matchings see Section 11 2 1 for details The displayed order of tuples is realized by the file export interface When reading from file the order is immaterial and tuples can be omitted instead of passing defaul
158. duced length labels 14 4 2 Solver Options for NP hard problems methSolve 0 Apply only heuristics 1 Compute lower and upper bounds 2 Apply branch and bound 0 methLocal Apply only construction heuristics Apply local search heuristics maxBBIterations 100 Maximum number of branch and bound pee iterations divided by 1000 maxBBNodes 20 Maximum number of active leaves in EMEN E the branch tree divided by 100 methCandidates 1 Minimum degree in the candidate graph a If negative candidate search is disabled Used for TSP and weighted matching 154 CHAPTER 14 THE OBJECT CONTROLLER CHAPTER 14 THE OBJECT CONTROLLER 14 4 METHOD SELECTION 144 3 Problem Specific Solver Options FIFO label correcting Dijkstra Bellman Ford BFS methMaxFlow Successive augmentation Dinic Push Relabel FIFO Push Relabel Highest Order Capacity scaling methMinCFlow Revised shortest path Shortest path Capacity scaling Not implemented Transformation to circulations methMinCCirc Klein cycle canceling Cost scaling Cost scaling with e tightening Minimum mean cycle canceling Transformation to st flows EWN NH o RC methMinTree Prim Enhanced Prim Kruskal methiTree Ordinary spanning tree pom a asus methMaxBalFlow Successive augmentation Phase Ordered augmentation Phase Ordered augmentation with look ahead Phase Ordered augmentation with look ahead and augmentation Ca
159. e return some branching variable Nothing else is needed for an executable branch and bound solver With respect to efficiency the following should be kept in mind Feasible checks if the optimal solution returned SolveRelaxation is feasible for the original problem The default implementation considers every fixed solution to be problem feasible If the relaxed optimum is feasible and improves the best known solu tion for the original problem then SaveSolution is called in order to send this solution to the original graph or LP data structures It is useful to implement LocalSearch such that a post optimization procedure is applied to all saved solutions This local search method should be defined for the hidden graph objects rather than the branch nodes so that it can be used independently from branch and bound e Let the branch nodes consume as few as possible memory if you want to solve large scale instances with optimality proof In the constructive mode the number of active nodes is somewhat like the DFS search depth and memory usage is not the most important issue The tradeoff between the running times and the obtained objective of SolveRelaxation can be bothering It depends on the DFS search depth and hence on the instance sizes Generally the quality of the obtained bounds is more important than the running times Consider if LocalSearch is beneficial It is not obvious whether feasible solutions obtained
160. e 1 tree depicted in Figure 21 1 2 e Figure 21 1 A Minimum 1 Cycle Tree CHAPTER 21 SOLVER APPLICATIONS 21 1 4 Shortest Path Problems The program gsearch is the GOBLIN solver for shortest path problems The input graph must be a graph or a digraph object either sparse or complete One has to specify a root node s by using the s option The output are the predecessor labels which determine a shortest path tree rooted at s If the complete output form is used the distance labels are also returned One may optionally specify a target node by using the t option In that case the Dijkstra label setting method may halt once the target has been reached Note that all shortest path algorithms require that no negative length cycles exist and some methods that the length labels are even non negative If the input graph and the method configured are incompatible this will be reported in the log file For example gsearch s samples gsearch1 would return the shortest path tree depicted in Figure 13 1 21 1 5 Chinese Postman Problems The program postman is the solver for Chinese postamn problems The input file must denote a sparse graph object either directed or undirected No mixed or bipartite graphs are allowed The output is an Eulerian super graph with minimum costs For example postman samples postmani would return the graph depicted in Figure 13 12 21 1 6 Other Solvers Table 2 1 lists some more problem sol
161. e 1 tree method is applied to find the initial bound respectively the partial bounds for the branch and bound scheme value of methRelaxTSP2 2 does not yield a practical method 13 16 6 Branch and Bound There is a branch and bound solver TSPBranchAndBound which depends on the 1 tree relaxation It also uses the node potentials found by subgradient optimization If the configuration parameter methCandidates is negative the branch and bound module evaluates the entire graph Otherwise candidate graph is generated which consists of the best tour found so far several random locally optimal tours and the nearest neighbours of each node In that case the value of methCandidates denotes a lower bound on the node degrees See Section 10 3 2 for the details of the branch and bound module 13 16 7 Application to Sparse Graphs The TSP solver also applies to sparse graph objects and to graphs with non trivial capacity bounds The latter can be used to restrict the set of feasible solutions 139 GRAPH COLOURINGS None of the implemented heuristics would be helpful if applied to the original graph Instead of this the method TSPHeuristics computes the metric closure of the graph see Section 6 4 8 for more details On this metricGraph object the heuristics and the subgradient optimization are run irrespecitive of the current value of methSolve If the tour of the metric closure maps to the original graph this tour returned If branch
162. e Tcl return value THE GOSH INTERPRETER If you have built the shared object libgoblin so this dynamic library can be imported to an existing tcl interpreter by the command load libgoblin goblin where libgoblin stands for the complete path to the shared object So far this shared object does not form part of the system installation 20 1 GOSH Ressources There are two files which are important when using the GOSH shell namely the transscript and the configuration file Both files are located in the user root directory The transscript file gosh logis an important source of information since most GOSH commands do not return instructive error messages It can be flushed explicitly by the command goblin restart The configuration file goshrc is read during the initialization of the gosh interpreter and whenever an object is read from file this overwrites the default configuration parameters with some user dependent settings The format is the same as described in Section 18 4 6 for the graph object files The current context variable settings may be saved to goshrc by the command goblin export settings 20 2 Context Variables All configuration parameters discussed in Chapter 14 can be manipulated by GOSH scripts The variable name in GOSH differs from the C variable name just by the prefix goblin For example the Tcl variable goblinMethSolve matches the C variable methSolve Note that all configuration parameters are global
163. e arcs a with capacity UCap a gt 1 into couple of arcs which all have capacity lt 1 The total upper and lower bounds as well as sum of potential flows remain unchanged CHAPTER 6 GRAPH OBJECTS 6 2 4 Sparse Bigraphs Include file sparseBigraph h Synopsis class biGraph TNode SwapNode TNode For the manipulation of bigraph nodes an additional method SwapNode v is provided which moves the passed node v to the other component The return value is the new index of v say u Effectively the nodes u and v are swapped Deletions of outer nodes include an implicit SwapNode operation 6 2 5 Planarity Issues Include file abstractMixedGraph h Synopsis class abstractMixedGraph 1 void MarkExteriorFace TArc TArc ExteriorArc bool ExteriorNode TNode TNode NoNode enum TOptExtractEmbedding 1 PLANEXT DEFAULT O PLANEXT GROW 1 PLANEXT DUAL 2 PLANEXT CONNECT 3 6 2 PERSISTENT OBJECTS TNode ExtractEmbedding TOptExtractEmbedding PLANEXT DEFAULT 1 NULL TNode Face TArc TNode NDO void ReleaseEmbedding graph is planar if it can be drawn in the plane without any edge cross ings If for every node v and some virtual plane drawing the arcs starting at v are listed in clockwise order by the incidence lists the graph is called combinatorially embedded In embedded graphs the face left hand of a given arc can be traversed as follows Example TArc a a0
164. e canonical form of a canonical form does not change anything Canonical forms are maximization problems e The StandardForm fills inequality restrictions with slack variables and substitutes variables with non trivial bounds Computing the standard form of a standard form does not change anything Stan dard forms are minimization problems e The Clone is a plain copy of the addressed MIP object It can be used for explicit manipulation without changing the original LP 179 16 1 PUBLIC INTERFACE CHAPTER 16 LINEAR PROGRAMMING SUPPORT 16 1 6 Solving Problems Include file ilpWrapper h Synopsis class goblinILPWrapper methLP Automatic selection n Primal Simplex enum TSimplexMethod 1 Dual simplex method SIMPLEX AUTO 0 SIMPLEX PRIMAL 1 SIMPLEX DUAL 2 methLPStart Automatic selection Start with lower bounds Start with current basis enum TStartBasis Table 16 1 LP Solver Options START AUTO 0 START LRANGE 1 START CURRENT 2 Fs virtual TFloat SolveLP virtual TFloat SolvePrimal virtual TFloat SolveDual virtual bool StartPrimal virtual bool StartDual This is the most straightforward part of the LP interface description The entry point SolveLP calls one of the methods SolvePrimal and SolveDual based on the value of the context variable methLP There is a default implementation provided for SolveLP which can be used from later plugins in order to support the GOBLET browse
165. e coloured by a call to the method Complete 10 3 5 Maximum Cut Include file branchMaxCut h In branchMaxCut object the problem variables represent the nodes of a graph zero value denotes a left hand node and a value of 2 denotes a right hand node A variable value 1 represents a node which is not fixed yet Depending on the status of the end nodes arcs are either selected dismissed or unfixed In the undirected case it is possible to extend the partial cut by at least 1 2 of the unfixed edges To this end SelectVariable returns a maxi mum capacity unfixed node and DirectionConstructive guides a DFS search to add this node to the more profitable component The dual bound computed by SolveRelaxation counts all selected and all unfixed edges This simple bounding procedure performs really poor and only allows to evaluate undirected graphs with up to 30 nodes It is obvious but not implemented yet that the bounds can be improved by considering odd length cycles and chains of directed arcs 10 3 6 Mixed Integer Programming Include file branchMIP h 87 10 3 IMPLEMENTATIONS CHAPTER 10 BRANCH AND BOUND tional remainder among all integer variables and a solution is considered The class branchMIP implements a plain integer branch and bound That Feasible when all fractional remainders fall beyond the context param is there is no code for cutting plane generation and pool management yet The problem variable
166. e files timers h Synopsis class goblinTimer 1 goblinTimer goblinTimer NULL void Reset bool Enable bool Disable double AccTime double AvTime double MaxTime double MinTime double PrevTime 188 CHAPTER 17 RESSOURCE MANAGEMENT bool Enabled F The class goblinTimer provides timer objects to keep track of roundtrip times PrevTime accumulated times AccTime minimum MinTime maximum MaxTime and average AvTime roundtrip times for a special unit of code Timer are started by the method Enable and stopped by Disable A Reset operation clears the timer statistics and also stops the timer One can check if the timer is currently running by calling Enabled O If nested starts and stops of the same timer occur the timer object main tains the nesting depth and effectively stops only if all starts are matched by stop operations The compilation of the entire timer functionality is suppressed if the pragma _TIMERS_ is unset 17 2 1 Basic and Full Featured Timers Include files timers h Synopsis class goblinTimer double ChildTime TTimer bool FullInfo F A timer can report about explicit starts and stops but also about relative running times of other timers child timers For this goal a pointer to a list of global timers must be passed to the constructor method Whenever a timer is started all child running times are reset Since several timer
167. e n m initially to set the final dimensions In the same way InsertArc u v generates a new incidence with random or constant ca pacities This depends on the configuration flags randLength randUCap randLCap Dense graph objects also admit an operation InsertArc a uu 11 cc Actually such an operation does not generate a new incidence but increases the lower bound of an existing arc a by an amount of and the upper bound by an amount of uu The new length label overwrites the old one The other operations which apply to sparse graph objects only have been described in Section 6 2 3 Note that node insertions maintain colours dis tance labels and node potentials but destroy node partition data structure Arc and node canceling operations do not influence the potential solutions but node deletions effectively destroy all potential solutions None of the listed methods does apply if another data object references the graph which has to be manipulated 11 3 2 Invalidation Policy When the incidence structure of a graph is modified the following internal data structures are invalidated that is they do not apply to the modified graph object e Iterators e Potential solutions e Dual incidences e Node ajacencies There is no exhaustive code that keeps these data structures up to date It is only guaranteed that invalid data structures are deleted transparently MANIPULATING GRAPHS In the case of node adjacencies node degre
168. e root of v respectively the cycle containing v is added When working with subgraphs of dense graph objects it is necessary either to disable the subgraph hash table or to initialize the subgraph data structure its maximum cardinality card by calling the struct method NewSubgraph card See also Section 6 2 2 95 POTENTIAL SOLUTIONS 11 2 3 Flow Labels Synopsis class abstractMixedGraph 1 virtual TFloat Flow TArc 0 virtual void Push TArc TFloat 0 class abstractBalancedFNW 1 virtual TFloat BalFlow TArc 0 virtual void BalPush TArc TFloat 0 virtual void Symmetrize 0 virtual void Relax 0 Flow labels are an alias for subgraphs which is used for network flow problems That is Flow a and Sub a return the same value and Push a lambda does the same as AddArc a lambda or OmitArc a lambda depending on the parity of the arc a Note that the node degrees are affected as well In balanced flow networks a symmetric version of flow labels exists which admit the analogous operations BalFlow and BalPush Note that the call BalPush a lambda essentially performs both Push a lambda and the symmetric operation Push a 2 lambda There is a logical or even physical distinction between symmetric and non symmetric flow labels Flow labels can be symmetrized explicitly by calling Symmetrize and the non symmetric labels are initilized with their balanced counterparts by calling Relax O 96 CHAPT
169. e symbolic infinite coefficients In that case the associated dual variables are fixed to zero implicitly In the primal form lower and upper bounds may coincide to represent equal ity restrictions respectively fixed variables This mathematical description translates to the C model as follows e A TRestr value denotes a row index running from 0 to either K 1 or KO LO 1 depending on wether only structural restrictions or also variable range restrictions are valid arguments e TVar value denotes a column index running from 0 to LO 1 or K L 1 if auxiliary variables are also valid arguments which then occupy the indices 0 K 1 e The direction of optimization is determined by ObjectSense with the possible values MAXIMIZE MINIMIZE and NO OBJECTIVE e The method Cost O represents the cost vector c e The methods LRange and URange represent the vectors l and u e The methods LBound and UBound represent the vectors a and b which are extended to the variable range restrictions in the obvious Way CHAPTER 16 LINEAR PROGRAMMING SUPPORT 16 1 PUBLIC INTERFACE e The matrix A is represented by the method Coeff which is re stricted to the structural restrictions The number of non zero matrix coefficients is obtained by NZO e The VarType of a variable is either VAR FLOAT VAR INT which in dicate rational or integer variables or VAR CANCELED which indicates deleted variables e The methods Va
170. ec tion 16 1 8 For mixed graphs a node oriented format is generated which lists the node attributes and all node incidences An incidence record possi bly starts with a mark P to indicate the predecessor arc and with a mark B to indicate backward arcs All constant arc labellings are listed at the end of the file Graph can also be written to some canvas formats The method Export2Tk generates a Tcl Tk canvas and is needed by the GOBLET browser again The method Export2XFig generates a canvas format which can be processed by the xfig drawing program and the transfig filter software By the latter tool one can obtain a series of other can vas and bitmap formats More details about the GOBLIN graph layout functionality can be found in Section 14 6 18 7 Support of Standard File Formats We have already mentioned that MPS file can be read and written from C level The GOBLIN library does not support additional graph and Ip formats directly but there are GOSH scripts import tk and export tk which can be used to read and write DIMACS and TSPLIB problems So lutions can be exported but not imported into the GOSH interpreter For example you may input at the GOSH prompt the following Example source tcl import tk goblinImport G sample tsp tsp G tsp source tcl export tk 201 18 7 SUPPORT OF STANDARD FILE FORMATS CHAPTER 18 PERSISTENCY goblinExport G sample tour tour 18 7 2 Export Filters GOBLIN native format Tcl library
171. efficients can be associated with restrictions which are considered auxiliary variables e In GLPK efficient access to the constraint matrix is provided by row and column operations e GLPK is distributed under the terms of the GNU public licence GLPK WRAPPER 185 16 3 GLPK WRAPPER CHAPTER 16 LINEAR PROGRAMMING SUPPORT 186 17 Ressource Management 17 1 Memory Management Include files globals h goblinController h Synopsis long unsigned goblinHeapSize long unsigned goblinMaxSize long unsigned goblinNFragments long unsigned goblinNAllocs long unsigned goblinNObjects void operator new size t size void operator new size_t size void GoblinRealloc void p size t size void operator delete void p void operator delete void class goblinAbstractObject 1 virtual unsigned long Size 0 187 s class goblinController 1 unsigned long Size F The GOBLIN memory management keeps track of all changes of the dynamic memory heap referenced by the data objects Other than in previous releases the counters are global rather than context rela tive The counters inform about the current heap size goblinHeapSize the maximum heap size goblinMaxSize the current number of data objects goblinNObjects the current number of memory frag ments goblinNFragments and the total number of memory allocations goblinNAllocs To this end the operators new new
172. elected node is selected first in the DFS search and then excluded The constructor of the root node determines a heuristic clique cover This clique cover is maintained for all subproblems For a given subprob lem the method SolveRelaxation searches for all cliques which contain at least one unfixed node The number of these cliques plus the number of selected nodes gives an upper bound which is returned A possible extension of this class to the weighted stable set problem seems straightforward and desirable 85 10 3 IMPLEMENTATIONS 10 3 2 Symmetric TSP Include file branchSymmTSP h In the class branchSymnTSP all problem variables are associated with graph edges Every branch and bound node owns a copy of the original graph where the some of the arc capacities have been restricted to 0 or 1 More explicitly Lower sets the upper capacity bound to 0 and Raise sets the lower capacity bound to 1 A raise operation checks if two incident edges have been selected for one of the end nodes Both procedures can reduce the complexity by implicitly fixing arcs The arc returned by SelectVariable is always in the current 1 tree and one of the end nodes has degree higher than 2 in the 1 tree If possible the arc is chosen such that the high degree end node is already adjacent to fixed arc Arcs are selected first in the DFS search and then excluded 86 CHAPTER 10 BRANCH AND BOUND Figure 10 3 Candidate Graph The b
173. ementation If an arc is deleted some node v may become non reachable from the source node ss specified in the constructor In this case all arcs with start node v are deleted likewise After the topological erasure of v one has Blocked v 1 By that technique the search procedure FindPath t which determines an st path with residual capacity is prevented from performing backtracking operations Note that the information about this path has to be passed from the layeredAuxNetwork object to the original network for augmentation In the Dinic algorithm both graphs share the predecessor data structure CHAPTER 6 GRAPH OBJECTS During augmentation TopErasure a is called for every arc which has no more residual capacity Finally the arc insertions and the topological erasure operations are separated by calls to Phase1 and Phase2 respec tively The topological erasure process needs O m time during the construc tion of a single blocking flow called a phase and the time needed for a FindPath operation is proportional to the length of the constructed path Figure 6 4 A Maximum Assignment with Corresponding Flow 6 3 3 Bipartite Matching Problems as Network Flow Prob lems Include file bigraphToDigraph h Synopsis class big2FNW 1 public virtual abstractDiGraph big2FNW abstractBiGraph amp TCap TCap NULL big2FNW abstractBiGraph amp TCap big2FNW abstractBiGraph amp 6 3 LOGICAL OBJECTS TNode Sou
174. entials form the LP dual solutions of network flows and matchings This data structure can be accessed directly by network flow algorithms Even if not accessed directly they come into play via the reduced or modi fied length labels see Section 11 1 3 Reduced length labels also appear in the subgradient method TSPSubOptiTree for the TSP The public interface allows to read node potentials Pi to set a sin gle potential to the value SetPotential and to add some amount to the current potential PushPotential 97 POTENTIAL SOLUTIONS If this data structure is not present all potentials are treated as zero Accordingly a call to InitPotentials generates the data structure and sets all potentials to zero Note that InitPotentials may be called by SetPotential and PushPotential recursively A call UpdatePotentials alpha adds the current distance labels to the current potentials But note that only those potentials are changed for which the corresponding distance label is less than alpha This procedure is used by the min cost flow algorithm EdmondsKarp2 which recursively calls the Dijkstra method The latter procedure searches the reduced length labels but keeps the result via the distance labels The threshold alpha is needed since the Dijkstra graph search is incomplete in general The reduced length labels combine the length labels and the node potentials to the optimality certificates well known in linear program ming If a denotes
175. ents we refer as the problem vari ables These variables have values of a scalar type TObj and are indexed by values of an integer type TIndex Initially there are certain upper and lower integer bounds on the problem variables but the concrete bounds variable values and the objective function are unknown to the branch and bound module In order to derive a solver for a specific integer programming problem basically the following must be supplied e fast method which solves a relaxed problem to optimality and returns the objective value That is an easier problem with fewer restrictions is solved instead of the original problem e method to decide if a given integral vector is feasible for the origi nal problem This is the only way for the branch and bound module to get access to the combinatorial structure of a specific optimization problem BRANCH AND BOUND e Code to tighten the bounds of problem variables T he generic solver changes only one variable bound at a time but efficient implemen tations derive benefit from the combinatorial structure and implicitly restrict further variables To the relaxed problem instance together with the original variable bounds we refer as the root node of the binary branch tree which is generate as follows The branch and bound scheme adds this root node to a list of active branch nodes or subproblems and then iteratively deletes one of the active nodes and splits it into two new s
176. eption is raised 13 1 4 The Dijkstra Algorithm This is a multi terminal version of the Dijkstra method One index set is passed to specify the root nodes the second index set specifies the target nodes The return value is some target node which could be reached from any root node 13 1 SHORTEST PATHS The Dijkstra method cannot handle negative length arcs at all It will however complain only if a negative length arc is actually searched The algorithm utilizes a priority queue data structure This may either be passed by the member pointer variable nHeap or if nHeap NULL gener ated by the method itself In the latter case the type of the priority queue is chosen according to the context parameter methPQ The respective running times are O n O mlog n with the binary heaps and O m nlogn with the Fibonacci heaps If one needs to compute all pair shortest paths it is reasonable to ap ply a label correcting method but only if negative lengths can occur and then to compute a shortest path tree for each graph node with the Dijk stra method This requires O n m 4 nlogn time and only O m storage compared with O n for the Floyd Warshall code 13 1 5 Discrete Voronoi Regions This is a variation of the Dijkstra method which treats all graph nodes with Demand different from zero a root nodes The set of target nodes is empty and by that all full graph search is performed If every connected compo nent includes at le
177. er interface checks if the flag SolverIdle is true and if so calls SolverSignalPending and then sets up a new thread of exe cution At this stage both SolverIdle and SolverRunning are false e The new thread calls SolverSignalStarted and then the solver method Now SolverRunning is true e Occasionally the user interface calls SolverSignalStop so that the flag SolverRunning becomes false again e The solver thread stops the computation before time if the core li brary includes solverStopSignalHandler retrieval operations The thread calls SolverSignalIdle and then exits The messenger also allows to interrupt the solver temporarily and this fea ture is described in Section 15 3 168 CHAPTER 15 THE MESSENGER 15 2 The Message Queue Include file nmessenger h Synopsis class goblinMessenger void MsgAppend mnsgType TModule THandle char void MsgReset bool MsgEOF O bool MsgVoid void MsgSkipO char MsgText msgType MsgClass TModule MsgModule int MsgLevel THandle MsgHandle J The message queue buffers the most recent log entries generated by the solver thread It is just large enough to fill a single screen but does not occupy much system ressources The log event handler also writes an incre mental log file for later evaluations A new log entry is added to the queue by calling MsgAppend which takes the class of information and an object handle as par
178. er the actual length matches this parameter value or if the actual length is one This fact is used to read constant graph labelings more economically The method Length returns the length of the last read tuple and accordingly Constant decides whether the last read tuple has length 1 18 3 Import of Graph Objects Include file fileImport h Synopsis class goblinImport CHAPTER 18 PERSISTENCY 18 83 IMPORT OF GRAPH OBJECTS x TOptDefTokens ReadDefPar TOptLayoutTokens ReadLayoutPar TOptRegTokens ReadRegister 195 FILE FORMAT FOR GRAPH OBJECTS 18 4 File Format for Graph Objects The general file format for graph objects is as follows graph object gt class label gt definition gt objectives gt lt geometry gt lt layout gt lt solutions gt lt configuration gt CR LF where class label gt graph dense graph digraph dense digraph bigraph dense bigraph balanced fnw nixed graph Usually the information associated with some node or arc is stored by a file record Instead of this GOBLIN stores vectors that are lists of numbers which represent a specific node or arc labeling Many fields in the file for mat can be filled either with such a vector or with a single value which then denotes a constant labeling This may be inconvenient for reading and editing the files by hand but a lot of information is immaterial for concrete p
179. erations by setting the context variable threshold to k Note that any error prompt contains a Synopsis line class goblinController Bonen tracing MU which allows to debug large problems graphically by setting threshold to int traceLevel a reasonable value int threshold The message Display which is mentioned in Table 14 5 1 is available int fileCounter for every GOBLIN data object In order to trace an object its class must int traceStep implement the Display method So far graph objects can be displayed int traceData both graphically and textually and most data structures can be displayed int commLevel textually If textual output is configured the output stream is obtained by int breakLevel the context method ostream amp goblinController Display Otherwise a so called trace file is written which by default consists of void Ping THandle unsigned long the graph object and the context information with some modifications in the void ResetCounter GOBLIN native format The file name is the concatenation of the context void IncreaseCounter label obtained by the method Label the current value of fileCounter ostream amp Display and one of the extensions gob fig or tk Every trace file export will trigger off an increase in the value of fileCounter 156 CHAPTER 14 THE OBJECT CONTROLLER Note that the value of priority has strong impact on the quality of a tracing session We propose
180. es Planar Tear Regions Apart Replace the original nodes by faces of the same degree and the original edges by 4 sided faces 6 4 4 Planar Tear amp Turn Left Right As before but triangulate the faces representing the original edges 6 4 4 Planar Truncate Vertices Replace all original nodes by faces of the same degree and keep the original edges connecting the 6 4 3 new faces Planar Spread To Outerplanar Requires an regular graph and a spanning tree Double the tree arcs to obtain the exterior face 6 4 7 of an outerplanar graph The result is a cutting pattern for the original graph Tiling Compose a graph from tiles Open one of the templates tile gob in the example data base 6 4 13 folder samples Specify the number of tiles in and y direction Split Graph SERE Integer Linear Generate the integer linear formulation for the selected graph based optimization model Do not actually solve the ILP model 31 4 6 GRAPH VISUALIZATION MENU ITEM LAYOUT CHAPTER 4 THE GOBLET GRAPH BROWSER 4 6 Graph Visualization Menu Item Layout The operations in this pull down menu manipulate the display coordinates of the current graph object Partially pure display entities such as arc bend nodes are added or deleted and sometimes the order of node incidences are mainipulated to conform with the produced drawing Option Shortcut Effect Section Strip Geometry Translate the node coordinates so that all coordin
181. es and graph duality data this strategy is adequate since the data structure can be rebuilt implicitly With some exceptions required in the library potential solutions are lost irreversibly if they are invalidated Special care is required with iterators if maintained independently from the graph object To be safe generate a graph clone manipulate this copy but iterate on the original graph If you want to delete nodes or arcs apply cancel operations instead and delete the canceled items in a final step The following is a list of graph manipulation operations ordered by their impact on the discussed data structures e Arc insertions e Node insertions e Arc cancel and contraction operations e Arc deletions e Node deletions 11 3 3 Updates on the Node and Arc Labels Synopsis class genericGraphStructure x void SetUCap TArc TCap void SetLCap TArc TCap void SetDemand TNode TCap void SetLength TArc TFloat void Set rientation TArc char void SetC TNode bool TFloat void SetCUCap TCap void SetCLCap TCap void SetCDemand TCap 101 MANIPULATING GRAPHS void SetCLength TFloat void SetCOrientation char For physical graph objects each of the labels discussed in Section 11 1 can be set to another value by the methods SetUCap SetLCap SetDemand SetLength SetOrientation and SetC respectively All methods maintain the respective maximal labels in a way such that an exhaustive computation is
182. essor arcs 12 3 Circular Drawing EE Draw all nodes on a cycle The order is either given by the predecessor arcs or by the node colours 12 2 Orthogonal Drawing Draw the graph on grid lines The Kandinski model applies to general graphs The other models 12 6 are limited to planar graphs and or small node degrees Arc Display Ctrl A Specify the arc and arc label display 14 6 Node Display Ctrl4 N Specify the node and node label display 14 6 Layout Options Ctrl W Specify layout parameters scaling node and arrow size without changing the geometric embed 14 6 7 ding and or activate the graph legenda 32 CHAPTER 4 THE GOBLET GRAPH BROWSER 4 7 PROBLEM SOLVERS MENU ITEM OPTIMIZE 4 7 Problem Solvers Menu Item Optimize This pulldown menu lists all available solvers for graph based optimization models Calls to a solver can be interupted and or repeated by pressing Ctrl c Before repeating a solver call one can use the node context menus to select a different root source or target node Option Vertex Routing Minimum Spanning Tree Vertex Routing Maximum Spanning Tree Vertex Routing Travelling Salesman Vertex Routing Minimum 1 Cycle Tree Vertex Routing Minimum Steiner Tree Edge Routing Shortest Path Tree Edge Routing Residual Shortest Path Tree Edge Routing Critical Path Edge Routing Maximum st Flow Edge Routing Feasible b Flow Edge Routing Minimum Cost
183. estriction to the original graph gives the original com binatorial embedding The input graph must be connected There is also a procedure Triangulation to compute a maximum planar supergraph of the adressed graph object Such graphs are always triconnected and called triangulations since all faces form triangles As before the restriction to the original graph gives the original embedding The time complexity is O m up to the lookup of node adjacencies The input graph must be biconnected All procedures modify the incidence structure of the original graph 13 7 5 Ordered Partition The canonically ordered partition splits a simple triconnected planar graph G into components which can be inserted one by one into a par tial plane drawing This structure applies to convex as well as orthogonal drawing methods In some sense it is the triconnectivity analogon of ear decompositions and st numberings discussed earlier More explicitly the 121 MAXIMUM FLOWS AND CIRCULATIONS discussed partition consists of disjoint node sets X5 such that V G U X and v1 v2 v and v2 are neighbors on the exterior face of and 1102 is called the basis arc The induced subgraph G of G to UL X is biconnected and inter nally triconnected for every j 2 k That is deleting two interior nodes preserves connectivity For j 1 k all nodes in X are exterior with respect to Gj For j 2
184. extension of the graph in the ith coordinate We mention that the graphical display uses the first two coordinates only and hence logical views are generally embedded into two dimensional space Note also that the embedding includes the possible arc bend nodes and the alignment points for arc labels 11 1 5 Layout Synopsis 11 1 GRAPH DEFINITION class abstractMixedGraph virtual TNode NIO virtual TNode Align TArc virtual bool CAlign virtual TNode Interpolate TNode virtual bool CInterpolate virtual bool HiddenNode TNode virtual bool HiddenArc TArc J Here we have listed several graph properties which do not influence the be haviour of any problem solver but which are sometimes necessary to enhance the graphical output The boolean functions HiddenNode and HiddenArc suppress the draw ing of certain nodes and arcs The call Align a returns the potential first artificial node for the arc a Actually this point determines the alignment of the arc label If CAlign is true no alignment points and no bend nodes are present and the labels are aligned by a generic strategy Using Align a as the initial point the ordered list of bend nodes can be reconstructed by the iterated call of Interpolate If CInterpolate is true no bend nodes are present and the graph arcs are simple lines The interpolation and alignment points together are the artificial nodes The total number of artificial nodes is returned b
185. f charge For the details in particular the statements about redistribution and changes of the source code note the LGPL document which is attached to the package LICENCE AGREEMENT 2 2 Software Requirements To unpack and compile the GOBLIN library the following software is nec essary gzip tar gmake and a C compiler All of these programs should be available on any UNIX machine We have tested the following environments e Suse Linux 7 3 with GNU C 2 95 3 GOBLIN 2 6 4 e Redhat Linux 7 3 with GNU 2 96 GOBLIN 2 5 e Redhat Linux 8 0 with GNU C 3 2 GOBLIN 2 5 3 e Solaris 5 6 with GNU C 2 8 1 earlier GOBLIN versions e Aix 4 3 with GNU C previous GOBLIN versions Aix 4 3 with xIC GOBLIN 2 6 4 e Cygwin 1 5 9 with GNU C 3 3 1 GOBLIN 2 6 4 To compile the graphical tool GOBLET one also needs a Tcl Tk installa tion and POSIX threads You may check whether a Tcl Tk interpreter is available on your UNIX system by typing which wish Note that the com pilation of the GOSH shell tool does not utilize the wish interpreter but requires that the library files 1ibtcl a and libtk a and the include files tcl h and tk h are installed correctly It might be necessary to manually define links to make the Tcl Tk library accessible to your C compiler To compile this reference manual a latex installation is also needed Fi nally we recommend to install the graphical tools xv and xfig which supply GOBLET with
186. f legenda specifies the space between the graph and the legenda The other layout parameters together with their possible alternatives defaults boldfaced are listed in the following subsections The layout of 14 60 GRAPHICAL DISPLAY graph arcs deserves some further statements If the node x Align a is undefined the arc is drawn as a straight line between the geometrical embedding of the two end nodes u and v and the potential label is aligned with the center of this line Otherwise the label is aligned with the transparent node x If y Interpolate x is undefined the arc is drawn as line between and v again Finally if y NoNode the interpolation points are y and the iterated points y Interpolate y until y NoNode is reached This list of points either defines a spline or a polyline object in the graph drawing The end nodes of a spline or polyline object are aligned with the graph node objects which depend on the nodeStyle and the nodeSize parame ters This is done by the methods AlignedCX AlignedCY which shift the second nodes coordinates in the direction of the first graph node so that it becomes visible 14 6 4 Formatting Arc and Node Labels There are two ways how labels can be formatted By setting the format strings arcFormatting and nodeFormatting one can produce almost uni versal labels If these strings are left blank the node and arc labels are computed in the way known from earlier releases In the format
187. f the original node Every eligible arc uv in the original graph are represented by the arc in the node splitting Note that the origins of the arcs in a node splitting cannot be dereferenced 6 4 13 Tilings Include file sparseGraph h Synopsis class tiling 1 public graph tiling abstractMixedGraph amp TOption TNode TNode CHAPTER 6 GRAPH OBJECTS tiling of a given graph consists of several copies of the original The orig inal graph should provide plane embedding and the nodes 0 1 2 3 should form a rectangle with the remaining nodes in the interior The corner nodes are identified in the tiling By this construction principle one obtains a series of planar triangulated graphs each of which has an exponential number of 1 factors and 2 factors and also an exponential number of odd cycles Figure 6 8 A Tiling 6 4 14 Split Graphs Include file balancedDigraph h Synopsis class splitGraph public balancedFNW splitGraph abstractDiGraph amp G TNode s TNode t TNode Source return n 1 TNode Target return n 2 6 4 DERIVED PERSISTENT OBJECTS Split graphs establish balanced network flow matching formulations of or dinary st flow problems with integral capacities Since matching algorithms are technically much more complicated than network flow methods split graphs are not useful for practical computations but rather for the debug ging of matching algo
188. f the specialized method does not return a 5 colouring The colouring of planar graphs requires O nm time CHAPTER 13 HIGH LEVEL ALGORITHMS Figure 13 15 A 3 Colouring of the Dodecahedron If no k is specified the method produces a decreasing sequence of values for k for which the enumeration scheme is started By this strategy one can produce colourings which come close to x Note that cliques sizes are lower bounds for xy Hence with some luck it is possible to bound the chromatic number to a small interval The clique cover and the edge colouring method essentially perform a node colouring of the complementary graph and the line graph respec tively More precisely if A denotes the maximum node degree then EdgeColouring k computes an approximative edge colouring with either A A 1 colours in O mA m A log A time If gt A this colouring is returned by the subgraph labels If k lt A no k edge colouring exists Only if k A and if the approximation method has obtained a A 4 1 colouring the enumeration scheme is used for an potential improvement described methods return the number of colours in the final solution or the constant NoNode if no colouring was found If the context flag methLocal is set the procedure NCLocalSearch is called with the final colouring obtained by the enumeration scheme Each of the methods NCLocalSearch PlanarColouring and EdgeColouring depend on the method NCKempeExchange which
189. fferent final flow 127 13 10 MINIMUM COST FLOWS 13 10 1 The SAP Algorithm by Busacker and Gowen This method iteratively computes shortest paths using the generic method ShortestPath and augments on these paths The running time is O vmn The code is not for practical computations but rather for com parison with the refined method which is discussed next 13 10 2 The Refined SAP Algorithm by Edmonds and Karp This method depends on the Dijkstra shortest path algorithm and on the reduced length labels The running time is O v m nlogn This method is of practical importance since it solves the assignment problem in 4 n log computing steps and can produce a near optimal solution for the general 1 matching problem in the same order of complexity The method may be called with an st flow and with node potentials such that the residual network contains negative length arcs In that case a label setting shortest path method is called and the node potentials are corrected Doing so it may turn out that the input flow is not extreme In that case an ERRejected exception is raised Oe u 128 CHAPTER 13 HIGH LEVEL ALGORITHMS Figure 13 8 Minimum Mean Cycle 13 10 3 The Cycle Canceling Algorithm by Klein This is the very basic primal min cost flow method It iteratively searches for negative length cycles and augments on these cycles Consult Section 13 1 10 for information on the method NegativeCy
190. flow labels after a call of CancelEven The odd cycles are cancelled again by Cancel0dd and CancelPD Both methods form part of the Anstee and the EnhancedPD method See Sections 13 12 4 and 13 13 2 for the details 11 3 Manipulating Graphs The following methods are available for physical graph objects only That is we are now talking about data structures not only about prototype 100 CHAPTER 11 PROTOTYPES AND DATA STRUCTURES methods 11 3 1 Changes of the Incidence Structure Synopsis class sparseGraphStructure TArc InsertArc TNode TNode TCap TCap TFloat TArc InsertArc TNode TNode TNode InsertNode TNode InsertartificialNode TNode InsertAlignmentPoint TArc TNode InsertBendNode TNode void SwapArcs TArc TArc void SwapNodes TNode TNode void FlipArc TArc void CancelArc TArc void CancelNode TNode void DeleteArc TArc void DeleteNode TNode void DeleteArcs void DeleteNodes void ContractArc TArc void IdentifyNodes TNode TNode void ReSize TNode TArc class denseGraphStructure TArc InsertArc TArc TCap TCap TFloat CHAPTER 11 PROTOTYPES AND DATA STRUCTURES In sparse graph objects InsertArc u v uu ll cc generates new in cidence with start node u end node v upper capacity bound uu lower capacity bound and length label cc In order to avoid multiple realloca tion of the data structures when several new arcs are generated one can call ReSiz
191. g solutions In our experience the subgradient optimization produces the best heuristic tours 13 16 1 The Insertion Heuristics The method TSPHeuristicsInsert r starts with a cycle through r and a neighbour of r and successively inserts nodes into this cycle The node to be 187 13 16 TSP ALGORITHMS inserted is the node with maximum distance from the cycle It is inserted at the position where it causes the smallest possible costs If one neglects the computation of node adjacencies the running time is O n 13 16 2 The Tree Approximation The method TSPHeuristicsTree r expects an r tree stored in the pre decessor labels This r tree is transformed into a tour which is at most twice as long as the original tree if the graph is metric If one neglects the computation of node adjacencies the running time is O n 13 16 3 The Christofides Approximation The method TSPHeuristicsChristofides r combines the ideas of the tree heuristics and the Chinese postman algorithm It first computes a minimum r tree Then a complete graph on the nodes with odd degree is instanciated a perfect 1 matching of this graph is determined and added to the graph Then an Eulerian cycle results which can be contracted to a tour which is at most 50 percent longer than the initial r tree if the graph is metric The final tour is returned by the predecessor labels and its length is the return value If one neglects the computation of node adjacencies the
192. gType THandle char 14 8 LOGGING public char logBuffer LOGBUFFERSIZE LogEntry msgType THandle char THandle LogStart msgType THandle char void LogAppend THandle char void LogEnd THandle char NULL Data objects do not call the registered event handler directly but rather the context methods listed above If no handler is registered nothing happens Otherwise the information delivered by the data object is extended by some structural information and passed to the event handler Logging information is grouped into several classes each of which is rep resented by a token of the enumeration type msgType Table 14 3 5 shows the tokens which are used for the GOBLIN core library logging information The tokens associated with errors and with the GOSH shell are discussed later in this document The parameters of LogFilter are such a token an object handle and a text line which has to be logged It manages the filtering of message types and handles the event handlers The method LogEntry does nothing else than calling LogFilter and suppressing messages nested into compound log entries One can use the predefined buffer logBuffer to pass the message text but only for strings up to a size of LOGBUFFERSIZE 1 The methods LogStart LogAppend and LogEnd are used to grow compound messages from a series of strings To this end LogFilter and eventually the event handler are called with a special message t
193. gative For example optflow div O 7 samples maxflow4 would return the 0 7 flow depicted in Figure 13 5 and a minimum 0 7 cut likewise If no source node and no target node are specified the solver will de termine a pseudo flow such that all divergences match the node demands called a b flow If the w option is used the solver returns a b flow with minimum costs This solver requires that e all lower capacity bounds are non negative e the node demands sum up to zero If the maximum value of an st flow is known a priori one can assign the demands of s and t accordingly such that the second solver applies For example optflow samples maxflow4 determines a maximum 0 7 flow due to the node demands specified in the file 228 CHAPTER 21 SOLVER APPLICATIONS 21 1 3 Minimum Spanning Tree Problems The program mintree is the GOBLIN solver for minimum spanning tree and 1 tree problems The input graph must be a graph or a digraph object either sparse or complete One may specify a root node r by the option r In that case the pre decessors will form a rooted tree or for 1 trees a directed cycle through r plus several node disjoint arborescences with their root nodes on the cycle If the input graph is undirected and no root node is specified a subgraph is returned which consists of the tree arcs The 1 tree solver is enabled by the parameter 1 For example mintree r 9 1 samples mintree1 would return th
194. gical order and return it by the node colours 13 2 3 Balanced Network Flows Compute min cost maximum balanced st flow for a given source node s or min cost st flow 13 12 The sink node t is determined by the graph symmetry 13 13 Solve LP Relaxation Solve a linear program neglect all integrality requirements 16 1 6 4 8 Solver Configuration Menu Item Optimize Option Shortcut Effect Section Restart Stop Solver Resolve problem with the same parameters or stop the current computation 15 1 Optimization Ctrl4 O Restrict the computational efforts when solving NP hard problem Attention Candidate sets work 14 4 2 Level for weighted matching problems also Method Options 13 Data Structures Ctrl4 S Select from alternative data structures for priority queues union find processes and node adjacencies 14 4 1 34 CHAPTER 4 THE GOBLET GRAPH BROWSER 4 9 BROWSER CONFIGURATION MENU ITEM BROWSER 4 9 Browser Configuration Menu Item Browser Option Shortcut Effect Section Toggle Editor Navigator Snapshot Image View Update Messenger Tracing Options Hs Browser Options Logging Options H3 Save Browser Options to a file in the goblet folder 35 49 BROWSER CONFIGURATION MENU ITEM BROWSER CHAPTER 4 THE GOBLET GRAPH BROWSER 36 Part II Data Objects CHAPTER 5 PRELIMINARY STATEMENTS Chapter 5 Preliminary Statements 5 1 Some Conventions Before we start the description of da
195. gmake private or gmake privclean where the second command also deletes the C source files and the build resources Add the new bin directory to your PATH variable and the lib directory to LD_LIBRARY_PATH in your user profile To perform a system installation become a super user and then type gmake install The default installation directories are usr lib usr include and usr bin Take care to set up these directories if you are working in a system other than linux Any existing installation if it is not too old is properly removed from the system One can manually delete a system installation by typing gmake sysclean or if the Makefile is not available by executing sh usr bin goblin_uninstall sh 17 COMPATIBILITY A binary distribution say goblin lt version gt lt platform gt tbz2 is in stalled as follows Become a super user copy the archive to the file system root directory change to this directory and type in tar xfj goblin lt version gt lt platform gt tbz2 and then sh goblin install sh The gmake install command discussed before exactly generates such a bi nary distribution via the gmake bin option and then tries to execute the goblin install sh there is good hope that your package will install also on other machines If you have made changes to the source code you may like to bind new GOBLIN tarball by typing gmake pkg The resulting package includes the source code for the l
196. gment works correctly We tried a careful trade off between a C and C like implementation That is to some extent we ignore the OO paradigm Nodes and arcs are base types and vectors are implemented as ordinary arrays We briefly describe the various classes of GOBLIN The design distin guishes between graph objects iterator objects explicit data structures which are all data objects and controller objects which allow to select solution methods as well as logging information and tracing points Con trollers also keep track of the dependencies among the various data objects The term explicit data structure shall indicate that such objects have a meaning which is independent from graph theory Apart from this there are implicit data structures such as incidence lists subgraphs dis tance labels etc which are encapsulated in graph objects The explicit data structures are discussed in Chapter 8 the implicit ones in Chapter 11 The GOBLIN design is completed by export and import objects which manage the file interface of GOBLIN 1 6 Mathematical References Most GOBLIN algorithms are based on the textbooks Network Flows R K Ahuja T L Magnanti J B Orlin Prentice Hall 1993 Combinatorial Optimization W J Cook W H Cunningham W R Pulleyblank A Schrijver Wiley 1998 13 CONTRIBUTIONS Graphs Networks and Algorithms D Jungnickel Springer 1999 and Graphs and Algorithms M Gondran N Minoux Wiley 1984 The m
197. gnedRand O int randMin int randMax int randUCap int randLCap int randLength int randGeometry int randParallels Many instance generators are prepared to generate random arc and node labels depending on which of the context flags randLength randUCap randLCap and randGeometry are set The flag randParallels enables or disables the generation of parallel arcs Random labels can be generated by every graph constructor method and by every call to the method InsertArc TNode TNode and InsertNode If you do not want to generate labels keep in mind to unset the respective flags Edge length labels and node coordinates are generated by the method SignedRand and arc capacities are genrated by UnsignedRand The numbers returned by SignedRand are equally distributed integers from the interval randMin randMax The numbers returned by UnsignedRand are in the same range if randMin is non negative and from 164 CHAPTER 14 THE OBJECT CONTROLLER the interval 0 randMax otherwise A method call Rand k returns equally distributed integers from the interval 0 k 1 CHAPTER 14 THE OBJECT CONTROLLER 14 8 RUNTIME CONFIGURATION 14 8 Runtime Configuration Synopsis class goblinController 1 void Configure int ParamCount char ParamStr Throughout this chapter we have described the various configuration pa rameters which are available in GOBLIN We finally need to explain how the controller objects are co
198. graph Generate predecessor labels for some st path Le Check if the subgraph forms a 2 factor Generate predecessor labels Return the number of cycles matching Check if the subgraph forms a 1 matching Generate predecessor labels edgecover Check if the subgraph forms a maximum cardinality 1 matching Return a minimum size edge cover by the predecessor labels eut Generate colours which separate the nodes with finite and infinite distance labels _ bipartition Generate colours which separate the nodes with odd and even distance labels eolors Generate node colours equivalent not equal with the node partition delete subgraph labels Delete the specified data structure predecessors colours potentials partition ucap 1cap length demand Assign a constant labeling source target root node index Assign special nodes 20 7 Sparse Graphs and Planarity planaize Check if the graph is planar and occasionally compute a combinatorial embedding outerplanar For planar graph objects If possible refine the present combinatorial embedding to an outerplanar embedding Return an arc on the exterior exterior arc index For planar graph objects Set the exterior face to the left hand side of the specified arc Adjust the first incidence of the exterior nodes 213 LAYOUT MESSAGES CHAPTER 20 THE GOSH INTERPRETER 20 8 Graph Layout Messages The following messages apply to every
199. graph Object DIMACS generic format for undirected graphs Do not confuse the Tcl Tk canvasses which have been discussed in the DIMACS max flow instance last section with the Tcl library graph objects which can be generated from i DIMACS min cost flow instance script level DIMACS assignment problem instance DIMACS flow labels DIMACS geometric matching instance This sequence would load the filter precedures read a problem in TSPLIB format from the file sample tsp compute a tour and save this tour to the file sample tour which is again in TSPLIB format DIMACS matching solution TSPLIB symmetric TSP instance 18 7 1 Import Filters TSPLIB asymetric TSP instance TSPLIB solution Standard MPS linear program CPLEX MPS linear program CPLEX LP format MPS basis GOBLIN native format DIMACS generic format for undirected graphs DIMACS max flow instance DIMACS min cost flow instance DIMACS assignment problem instance DIMACS geometric matching instance TSPLIB symmetric TSP instance TSPLIB asymetric TSP instance Steinlib instance MPS linear program standard and CPLEX MPS basis 202 CHAPTER 19 EXCEPTION HANDLING Chapter 19 Exception Handling Include file globals h Synopsis class ERGoblin 1 class ERIO protected ERGoblin 1 11 protected ERIO i class ERParse protected ERIO i class ERInternal protected ERGoblin class ERRejected class ERRange class ERCheck protected ERGo
200. graph object G with the prefix G layout and manipulate the node coordinates rtificial nodes which are only used for layout purposes are also added deleted or shifted Most methods allow to specify spacing followed by the desired minimum distance between two nodes For grid drawings the keyword grid is synonymous Whenever dx and dy are available spacing can also be used Message scale bounding box minX maxX minY maxY Scale geometric embedding to the specified size When max min the drawing is strip Shift the geometric embedding so that the upper left corner of the bounding box be rte then ons eee spacing Reroute arcs so that parallel arcs and loops can be distinguished tree dx dy left right Embedding guided by the predecessor arcs A tree or forest is drawn and the nodes are aligned atop of its successors as specified spacing colours predecessors Embedding of the graph on a cycle Use an option to control the node order outerplanar grid small Embedding of the graph in a grid The small node option applies to 2 connected graphs with maximum degree 4 or less fdp spacing preserve unrestricted Force directed layout Using the preserve option nodes are shifted without modifying Embedding guided by the node colours plane grid convex basis For planar graph objects Straight line drawing of the current embedding and the pes uos specified basis arc Convex drawing requires 3 connectivity Fo
201. h encoded into the referenced object However a gra2bal object may maintain a flow which is non symmetric and indepen dent from the referenced object One can generate and access this flow simply by calling any network flow method or by explicit call to the method InitFlow By that the flow is initialized to the symmetric logical flow but can be treated as an ordinary flow afterwards Every call to a balanced network flow method requires the symmetric flow If necessary Update is called which symmetrizes the flow again The subgraph of the referenced object is updated and the physical flow is disallocated Note that Update is called by the gra2bal destructor also Hence there are two kinds of flow associated with a gra2bal object exactly one of these flows is present at each point of lifetime and the object is generated and destructed with a balanced flow Example CHAPTER 6 GRAPH OBJECTS G1 new graph sample gob G2 new gra2bal G1 1 G2 gt MaxFlow G2 gt Source G2 gt Target G2 gt CancelEven if G2 gt Cancel0Odd gt 1 G2 gt MaxBalFlow G2 gt Source delete G2 Fi new export sample rst Gi gt WriteSubgraph F1 delete F1 delete Gi determines a maximum 1 matching of the graph in sample gob as follows First an ordinary maximum flow of the object G2 is computed starting with a call to InitFlow The call of CancelEven implies a call to Update subsequent operati
202. h forms a tour Otherwise the potentials of the nodes with Deg v gt 2 are increased and the potentials of the nodes with Deg v 2 are decreased by some amount and the min tree solver is called again If the TSP problem cannot be solved within certain number of iterations the procedure returns the best lower bound and the corresponding r tree by the subgraph data structure If it looks promising TSPSubO0ptiTree calls TSPHeuristicsTree r which determines a feasible tour and hence an upper bound The best tour found is returned by the predecessor labels One may pass the length of a 13 16 TSP ALGORITHMS known tour by an optional parameter in order to initialize the upper bound This procedure yields very strong lower bounds on the length of an opti mal tour but one cannot expect that an optimal tour is found for practical instances The quality of the bound depends on the third parameter which acts as follows If a value of zero is passed only a single 1 tree is computed without changing any node potentials If a value of one is passed good potentials are computed within a reasonable number of iterations say 100 roughly For a value of two large number of iterations occurs 3000 ap proximately The found bound is much better for some instances but on the average the fast strategy already achieves the optimal bound This calling parameter is matched by the context parameters methRelaxTSP1 and methRelaxTSP2 which specify how th
203. h labels equally distributed in the interval 0 49999 The following methods have been tested here heuristic The problem is solved on a sparse subgraph only where methCandidates 10 candidates The fractional matching problem is solved on a candi date graph with methCandidates 10 converted into a optimal frac tional matching on the entire graph and then converted into a optimal integral solution e exhaustive The matching solver is applied to the complete graph directly that is with methCandidates 1 The results indicate that the candidate graph is constructed slowly but provides excellent solutions The price amp repair strategy for the fractional matching problem cannot reach the performance of price amp repair methods for the 1 matching problem The running times of the price amp repair method strongly depend on the performance of the primal dual method since the number of expensive PD operations does not decrease via candidate search Note the significant differences in the running times for the geometric and the matrix problems 238 CHAPTER 22 COMPUTATIONAL RESULTS Method Objective Time Dual Expand 112630 84s 112630 12695 112630 52245 244062 104s Instance Type 1002 pr 002 pr 002 1002 1002 1002 511032 511032 511032 511032 511032 511032 1 factor heuristics l factor candidates 1 factor complete 2 factor heuristics 2 factor candidates 244062 2029s 2 factor complete 244
204. han once it is worth to generate a container object with the same content and to use this as an index set 80 CHAPTER 9 INDEX SETS 9 4 Containers as Index Sets Include file staticQueue h staticStack h Sometimes it makes sense to use containers as index sets e There is no predefined index set with the desired property or this set must be post processed e As pointed out in the previous section if an index set has few elements compared with the value range it may be inefficient to enumerate its indices several times Exporting the indices to a container prevents from searching deselected indices e In particular when the index range is divided in different sets contigu ous memory containers may operate on the same chunk of memory Using containers as index sets has the following limitations e Adding or deleting items from a container can invalidate running enumeration processes e Only the classes staticQueue and staticStack provide the index set functionality Node based containers potentially repeat indices and elements may be of a non integral data type also CHAPTER 10 BRANCH AND BOUND Chapter 10 Branch and Bound Branch and bound is a strategy for solving hard integer optimization problems not only for problems on graphs The basic concept is combina torial and does not involve LP formulations The GOBLIN branch and bound module operates on vectors of a spec ified dimension the vector compon
205. he step length is determined by the nodes tem peratures and the sophisticated temperature adjustment rule is the reason for the good performance The resulting drawings do not differ significantly 106 CHAPTER 12 GRAPH DRAWING compared with the spring embedder There is another method Layout_PlanarFDP which preserves the edge crossing properties of the initial layout It applies to general graphs but of course is intended to allow post processing of planar layouts The procedure augments the GEM algorithm by additional forces and certain restrictions It is less performant than the unrestricted GEM code 12 5 Planar Straight Line Drawing Synopsis class abstractMixedGraph i void Layout StraightLineDrawing TArc NoArc int 0 void Layout ConvexDrawing TArc NoArc int 0 7 The method Layout_ConvexDrawing a spacing computes a straight line grid drawing without edge crossings for triconnected planar graphs such that all interior faces are convex combinatorial embedding must be already assigned The shape of drawing is a triangle with the specified arc a forming the basis By that the exterior face is set to the left hand side of a If no arc is specified the basis arc is the same as ExteriorArc If the latter arc is undefined the exterior arc is chosen on a face which maximizes the number of exterior nodes The tip node is set implicitly and is half way on the exterior face All nodes are placed at integer
206. her Example graph G TNode 0 TOption 0 TNode node new TNode n TNode i NoNode for i 0 i lt n i 1 CHAPTER 3 GETTING STARTED node i new TNode nl TNode j NoNode for j it1 j lt n j i node i j G InsertNode TNode k NoNode for k 0 k lt i k G InsertArc node 11 j node k j for k i 1 k lt j k G InsertArc node 1 j i k for k 0 k lt i k G InsertArc node 1 j node k i 5j delete node This C code is equivalent to the described GOSH script given before which generates a triangular graph for a set with n elements Using this instance generator as a benchmark indicates that C code is almost five times faster than equivalent Tcl code 3 4 Solver Executables GOBLIN comes with source code for solver executables These main rou tines do not cover the entire GOBLIN functionality but only the most frequently asked standard problem solvers To work with these solvers you must compile them separately see Section 2 5 You can customize the main routines which are distributed with the GOBLIN source code to your own convenience without much effort This is probably the easiest way to become familiar with the library But note that every additional binary may include a lot of library func tions and hence require a lot of disk space Moreover if you want to call a SOLVER EXECUTABLES GOBLIN solver from another C C program
207. hogonal layout model One can move nodes manually and rerun the method to improve the node placement e When using opt ORTHO EXPLICIT directed arcs leave on the top or the bottom side of the start node and enter the end node on the left or the right side The same is true for the inherent orientation of undirected edges It follows that one can revert the the orientations of undirected edges in order to reduce the number of edge crossings and the node size d 108 CHAPTER 12 GRAPH DRAWING The running time is O m the number of bends is m and the square area is 2n d 1 1 The parameter d is trivially bounded by the maximum node degree A and for opt ORTHO EULER one has d A 2 By calling Layout OrthogonalDeg4 opt grid an st numbering is computed and the nodes are placed one by one with respect to this or dering each node on a new grid row Columns may carry several graph nodes and at most two bends The input graph must be 2 connected and without loops If the graph is planar and if opt ORTHO A4PLANAR is used a plane drawing results and the inherent embedding is visualized In this case the running time is O n Otherwise the running time is O n due to the iterated computation of horizontal coordinates The achieved grid size is m n 1 n in the worst case Every edge is drawn with at most two bends Only one edge incident with the final node may be drawn with 3 bends By calling Layout VisibilityRepresen
208. hs which appear in our matching code reuse the layered auxiliary networks which form part of the well known Dinic max flow method 1 3 Purpose and Applications GOBLIN has been designed for researchers developers people who just need to solve network flow or matching sub problems but also for educa tional purposes Since the needs of all these potential users are sometimes contradictory GOBLIN provides several configuration mechanisms both at compile time and at runtime The GOBLIN runtime configuration includes the selection of logging in formation of graph layouts of tracing breakpoints and of the mathematical methods and the data structures which are used The graphical display together with the logging module allows the rapid preparation of adequate runtime examples for teaching and documenting network programming algorithms Of course this functionality is also help ful for the debugging of such algorithms Before GOBLIN is compiled one may edit the file config h in order to suppress the compilation of this GOBLIN functionality which is not needed for the final version of a problem solver but which causes considerable com putational overhead and large binaries Note that this compile time configuration is possible only with open source software Hence the open source concept is an important prerequi site for the success of this project The library comes with source code for executable solver programs which support the runt
209. ible balanced circulation problem to the max imum balanced st flow problem 2 the reduction of the min cost balanced circulation problem to the min cost balanced st flow problem The main application is the reduction of the odd cycle canceling prob lem for balanced network flows to a balanced st flow problem This problem occurs if an integral circulation is symmetrized so that some flow values be come non integral These reductions eventually extend the Anstee maximum balanced flow algorithm to the general setting of balanced flow networks and allow a strongly poynomial implementation of the primal dual algorithm respec tively 6 3 8 Making Logical Objects Persistent Logical objects turn into persistent objects by writing them to file and load ing them again By running optimization methods on the persistent object one can avoid the time consuming dereferencing steps to the original data object 6 3 LOGICAL OBJECTS However the capability of back transformation of computational results to the original problem instance is lost If necessary the results can be written to a file and reimported into the logical object Example G1 new diGraph sample gob G2 new FNW2FNW G1 Fi new export sample tmp G2 gt Write F1 delete F1 G3 new diGraph sample tmp G3 gt MaxFlow G2 gt Source G2 gt Target Fi new export sample tmp G3 gt WriteFlow F1 delete F1 delete G3 F
210. ibrary and the ex ecutables the latex sources for the reference manual including the figures the tk scripts the definition files for the examples and a file doku history which keeps track of the ancestor tarballs This GOBLIN package contains some source code which helps to gen erate executable solvers for various optimization problems In the same manner one can obtain some instance generators The respective project names are listed in Table 2 1 and coincide with the file names for the main routines If you just need a problem solver say optflow you may generate this executable by typing gmake exe pr optflow For all purposes gmake must be called from the GOBLIN root directory where the produced files can be found On linux computers and in a CYG WIN environment one can type make instead of gmake On other UNIX platforms make possibly cannot interprete the Makefile 18 CHAPTER 2 INSTALLATION Max Flow feasible b flows and min cost flows Heuristics and lower bounds for the metric TSP Table 2 1 Executable Solver Programs 2 6 Tcl Compatibility Issues Generally GOBLIN can be linked with every Tcl Tk 8 x release Since Tcl Tk 8 4 a minor patch of the Makefile conf is necessary Activate the define tcl_flags D_CONST_QUAL_ const to compensate some changes of the Tcl prototypes between the releases 8 3 and 8 4 2 7 Cygwin Build Cygwin is an environment which admits to compile and or run Unix soft wa
211. ical matching problems say with gt 10 nodes The recursive computation of modified length labels is enabled by the 133 MATCHING SOLVERS CHAPTER 13 HIGH LEVEL ALGORITHMS context flag methModLength and can be performed explicitly if RModLength methMinCBalFlow 0 Primal Dual is called 1 Enhanced primal dual methPrimalDual 0 Restart BNS after each dual update Restart BNS after changes in the shrinking family 2 Restart BNS after blossom expansions 13 13 2 The Enhanced Primal Dual Algorithm methModLength 0 Recursive computation 1 Store modified length labels This is an improvement of the PD algorithm resambling the cycle canceling method Anstee discussed in Section 13 12 4 More explicitly the method Table 13 6 Min Cost Balanced Flow Options EnhancedPD first calls the generic solver MinCFlow to compute an ordinary extreme maximum st flow 13 14 Matching Solvers This flow is symmetrized by using CancelEven and CancelPD The latter method is essentially the same as the general implementation of 10 but calls PrimalDual for the final balanced augmentation steps The mere Synopsis symmetrization takes O m steps By this preprocessing PrimalDual is started with a complementary pair Clape aAbetfacturaph where the flow value is at most n less than the value of a maximum balanced st flow and therefore runs in O n m time The overall complexity is dom pool inated b
212. ime configurability The experienced C programmer however will find it easy to build GOBLIN problem instances immediately from his domestic data structures The library also comes with source code for a Tcl Tk based interpreter gosh which can process complex scripts and user interactions and with the graphical front end goblet Both parts heavily depend on the open source Tcl Tk library which must be installed to get the full functionality 12 CHAPTER 1 GENERAL STATEMENTS of GOBLIN 1 4 Project Overview GUI Shell Tcl Tk GOBLIN Libraries Figure 1 1 3 Level Architecture The GOBLIN programming project essentially splits into four parts each of which provides its own interface to the graph optimization methods of the GOBLIN library e The C Class library 64000 lines of source code CHAPTER 1 GENERAL STATEMENTS e An extension of the Tcl Tk shell sript language to graph objects 6000 lines e graph browser and editor tool 13000 lines e Solver executables 2000 lines Here we have listed the respective source code sizes which may indicate the efforts of implementation The Tcl wrapper is indeed a rather simple task and strongly recommended for other mathematical programming projects Generally the GOSH shell is compliant with other Tcl Tk extensions One only has to merge the project file goshAppInit cpp and the other AppInit file Alternatively one can build a shared object a
213. ine Graphs and Truncation of the vertices Include file sparseGraph h Synopsis CHAPTER 6 GRAPH OBJECTS class lineGraph public graph 1 lineGraph abstractMixedGraph amp TOption option 0 class planarLineGraph public graph 4 planarLineGraph abstractMixedGraph amp TOption option 0 class vertexTruncation public graph vertexTruncation abstractMixedGraph amp TOption 0 J In a line graph the nodes are the arcs of the original graph and nodes are adjacent if and only if the arcs share an end node in the original graph The constructor method lineGraph G matches this graph theoretical def inition of line graphs By the constructor planarLineGraph G edges are generated only for pairs of edges which are neighbors in the incidence lists of G We refer to this as planar line graphs since planar input graphs are mapped to planar graphs by this procedure More explicitly the faces are mapped to face of the same length and the boundary cycle is directed counter clockwise The nodes of the original graph are also mapped to faces where the boundary cycle is directed clockwise and its length is the degree of the original node If G is the surface graph of some non degenerate polyhedron all vertices have degree 3 both definitions coincide If G is the surface graph of some regular polyhedron all faces are equilateral the planar surface graph has the same geometric interpretation 6 4 DERIVED PERSIS
214. ing family of a given balanced flow network and forms a new graph in which some of the original nodes are identified and some arcs are redirected 56 CHAPTER 6 GRAPH OBJECTS While shrinking families will be discussed later in Section 8 2 we need to describe the other components of the primal dual algorithm here Modified length labels are the reduced costs known from linear pro gramming and are available by the method ModLength They may be present by an own data structure or must be computed recursively by RModLength which evaluates the node potentials and the shrinking fam ily data structure This recursive computation is needed when working with large scale geometrical matching problems and is enabled by the context flag methModLength If disabled mismatchs between physical and computed modified lengths can be detected by a call of CheckDual This is done automatically before the primal dual methods halt but only if the context flag methFailSave is set In that case Compatible is called likewise to check for reduced costs optimality Note that a single RModLength call takes O n operations and that exhaustive computation may increase the running time of the whole algo rithm by a factor of n Hence some care is recommended when setting methModLength and methFailSave The complexity statements which fol low are true only if both variables are zero The method FindSupport determines the nodes of a blossom and pre p
215. insight about problem type dimensions and numerics In any case of trou ble consult the problem statistics and the GOSH transscript The system ressources info displays some information about the heap dynamic mem ory occupied by GOBLIN Note that the browser does not support the entire GOBLIN function ality but somewhat like 95 percent For example the matching solver can only be fed with one degree sequence while the C API allows to specify upper and lower bounds on the node degrees We mention that one can solve moderate size optimization problems without much knowledge of the library but it requires some care and ex perience to produce graphical output which is useful for teaching purposes Then it is the combination of trace objects and the messages which is in structive 27 41 FILE MANAGEMENT MENU ITEM FILE CHAPTER 4 THE GOBLET GRAPH BROWSER 4 1 File Management Menu Item File Option Shortcut Effect Section New Generate a new graph object or linear program Open Ctrl4 o Read a graph object from file Supported formats GOBLIN DIMACS TSPLIB and STEINLIB problems 18 4 If the check button is unset the current graph is replaced by the selected object Otherwise the graphs are 18 7 merged Save LE Print Object Print the current graph or trace object Assign a shell print command Save as Export the current graph object or the selected trace object to file The supported file formats include p
216. ious Example goblin read example gob G set demand 2 G set ucap G maxmatch G write example rst computes a 2 matching of the graph whereas G set demand 2 G set ucap 1 G maxmatch determines a 2 factor Note that matching solver is defined for undirected graphs only while network flow methods can be accessed with digraphs only The Tables 20 12 20 13 20 14 and 20 15 list all messages which are restricted to special classes In order to simplify contributions by other authors some solver messages are available from script level for every graph object even if there are no solver methods for mixed graphs yet This applies for the tree packing and the Chinese postman solver 218 CHAPTER 20 THE GOSH INTERPRETER DERIVED GRAPH CONSTRUCTORS Root node Order of Connectivity Order of Connectivity Order of Connectivity Check for strong connectivity Order of Connectivity Check for strong edge connectivity Accepted mimber of colours optional Accepted number of colours optional Accepted number of diques optional Compute an st numbering if the graph is 2 connected root Root node optional cycis Root node optional Root node Root node Compute a cut of maximum capacity and return this capacity Compute a minimum Eulerian supergraph and return its weight 219 20 11 DERIVED GRAPH CONSTRUCTORS 20 11 Derived Graph Constructors 20 12 Messages for Undirected Graphs Parameters Description 220
217. is approach is restricted to graphs with maximum de gree 4 or less The literature comes up with at least four layout models for drawing high degree graphs e GIOTTO where the nodes are rectangles in a square grid Edges are drawn by placing ports at each end node and a sequence of bend nodes within the same grid as the rectangles No bound on the size of the rectangles is imposed by this model e Kandinski where the nodes are squares of a common size centered in sparse square grid Edge ports and bend nodes are placed in a subdivided square grid The size of the node squares is the maximum number of ports d assigned to one side of a square e Proportional growth which is similar to GIOTTO but also requires that the height of a node equals the number of ports on either the left or the right side and that the width equals the number of ports on the top or the bottom line e Visibility representations in which nodes are horizontal and edges are vertical line segments The length of node segments does not de pend on the node degrees In every model the edges must be drawn on the grid lines Edges and node representation may not overlap or cross each other but edges may cross other edges when planarity is not required known algorithms for graphs with maximum degree 4 produce drawings which fit into the first three models General methods applied to degree 4 graphs are not as smart That is large nodes with several ports on
218. is specified by logDepth 14 8 LOGGING In the same way OpenFold and CloseFold manipulate the pa rameter moduleNestingLevel and set the current code module context OpenFold saves the new context on the stack nestedModule if the max imum depth MAX MODULE NESTING has been reached the context does not change effectively and CloseFold recovers the parent context If the NO INDENT option is specified OpenFold CloseFold im plicitly calls IncreaseLogLevel DecreaseLogLevel The option SHOW TITLE causes OpenFold to send the module name to the log event handler Note that data objects also implement OpenFold and CloseFold methods which cover the described functionality and in addition start and stop the module timers See Section 17 3 for more details 14 3 4 Filtering the output The information which is actually logged can be filtered by several context parameters The available flags are listed in Table 14 3 5 Note that all values higher than the default values may result in tremendous increase of logging information But for rather small problem instances the options logMeth 2 and logRes 2 allow a good understanding of the various op timization algorithms Other than the preliminary version of the logging module the output is now filtered by the controller object internally The flags logWarn and logMem have been added for debugging purposes The flag logMem is discussed in Section 17 1 The flag log
219. itArc TArc TFloat The data structures defined in genericGraphStructure are simply arrays with fixed dimensions To handle sparse subgraphs in complete and geomet rical graph instances denseGraphStructure implements an optional hash table for subgraph labels This data structure is generated by the first call of AddArc automatically In that case the number of arcs in the subgraph is restricted to the number of nodes which is satisfactory for working with trees l trees 1 matchings and 2 factors Alternatively the subgraph data structure may be allocated explicitly by the method NewSubgraph TArc which takes the maximum size as a parameter and requires O l computing steps 6 2 3 Sparse Graphs Include file sparseStructure h Synopsis class sparseGraphStructure public genericGraphStructure 1 TArc First TNode void SetFirst TNode TArc TArc Right TArc void SetRight TArc TArc TArc Left TArc TNode StartNode TArc TNode EndNode TArc 6 2 PERSISTENT OBJECTS void ReSize TNode TArc TArc InsertArc TNode TNode TCap TCap TFloat TArc InsertArc TNode TNode TNode InsertNode TNode InsertArtificalNode TNode InsertAlignmentPoint TArc TNode InsertBendNode TNode void ExplicitParallels void SwapArcs TArc TArc void SwapNodes TNode TNode void FlipArc TArc a void CancelArc TArc void CancelNode TNode void ReleaseBendNodes TArc bool ReleaseDoubleBendNodes void Rele
220. iterion If these solutions admit an augmenting path such that all arcs on this path have zero reduced length the PD algorithm augments as long as possible Otherwise several dual updates updates on the node potentials are performed each of which extends the set of s reachable nodes In the setting of balanced networks the dual solution consists of node potentials a shrinking family and variables assigned with the sets of this family T hese data structures are managed by a special class surfaceGraph whose incidence structure is the graph in which all blossoms sets in the shrinking family are contracted to a single node This class has been de scribed in Section 6 3 6 The GOBLIN implementations are still rather basic That is they do not use splitable priority queues or multiple search trees The complex ity so far is O vnm where v denotes the value of a maximum balanced st flow minus the vlaue of the initial flow A later release of GOBLIN should achieve a O vn implementation See Table 13 6 for the available variations of the PD algorithm Note that all PD methods can run with modified length labels which are not physically present but computed from the dual variables This recur sive computation takes O n time and hence may increase the complexity of the PD method by a factor n It has the benefit that only O n storage is needed for keeping the modified length labels compared to O m This is important for large scale geometr
221. itted with an elaborate logging module Like the tracing mod ule which is discussed later it can be used for debugging and also for preparation of runtime examples 14 3 1 Event Handlers Synopsis class goblinController 1 private unsigned long suppressCount CHAPTER 14 THE OBJECT CONTROLLER public void logEventHandler msgType TModule THandle char void PlainLogEventHandler msgType TModule THandle char void DefaultLogEventHandler msgType TModule THandle char void void SuppressLogging O void RestoreLogging In order to keep any multitasking code out of the core library we have in troduced a function pointer logEventHandler which originally references the method DefaultLogEventHandler This method writes all passed logging information to the file or device referenced by logStream There is an alternative procedure PlainLogEventHandler which processes user readable output to the same stream but only handles plain message texts The messenger and the GOSH shell which are discussed later provide more complex event handlers These procedures call DefaultLogEventHandler in turn The method SuppressLogging saves and deregisters the current event handler RestoreLogging registers the saved event handler again Calls must be matching but it is save to use these methods in a nested way 14 3 2 Writing Log Entries Synopsis class goblinController a private THandle LogFilter ms
222. ixedGraph amp voronoiDiagram TFloat UpdateSubgraph This class has been introduced for the Mehlhorn Steiner tree Heuristic Other applications seem obvious especially to the 7 join solver The name indicates a relationship to the well known geometric structure but do not confuse both notions The constructor method generates a copy of the given graph in which the node sets of the partition data structure are contracted The mapping of the nodes and edges is preserved transparently The procedure assumes that in the original graph the predecessor la bels form partial trees which span the node partition sets and which are rooted at some terminal node see Section 13 19 The needed data struc tures for the original graph are implicitly set up by calling the method VoronoiRegions By that the partial trees consist of shortest paths corresponding distance labels are given and hence the transformed graph edges are shortest paths between different terminal node 65 6 4 DERIVED PERSISTENT OBJECTS The method UpdateSubgraphO considers the predecessor arcs of the transformed graph and maps them back to paths in the original problem instance The result is a subgraph not a set of modified predecessor labels 6 4 22 Triangular Graphs Include file sparseGraph h Synopsis class triangularGraph public graph 1 triangularGraph TNode TOption goblinController amp goblinDefaultContext The nodes of a triangular gr
223. jects without any geometrical embedding but does not provide sophisticted tools for graph layout Be careful when tracing a computation Without any special effort GOBLET may generate several thousands of files and by that cause a collapse of your file system GOSH SHELL SCRIPTS 3 2 GOSH Shell Scripts The GOSH shell script interpreter extends the well known Tcl Tk script lan guage by the possibility of defining and manipulating graph objects Tcl Tk is an excellent tool to prepare prototype algorithms instance generators and import export filters with a minimum of code and effort Example set n lindex argv 0 goblin sparse graph G for set i 1 i lt n incr i for set j expr i 1 j lt n incr j i set node i j G node insert for set k 1 k lt i incr k G arc insert node i j node k j for set k expr i 1 k lt j incr 1 G arc insert node i j node i k for set k 1 k lt i incr k G arc insert node i j node k i set FileName file rootname lindex argv 1 G write FileName gob G delete 23 USING THE LIBRARY exit This script generates so called triangular graphs which are interesting for their regularity message goblin sparse graph instanciates a graph object G which is written to file and disallocated again by the mes sages G write and G delete respectively Before file export some node and arc insertion operatio
224. ko Rx 62 Bap Tal oen RE pas GS GA nS hg ERASE 62 64 Split Graphs ul ludorum Soe nod d 63 6 4 15 Subgraph induced by a Node or 63 6 4 16 Bigraph induced by two Node Colours 64 6 4 17 Colour Contraction lt ces secca resida 64 6 4 18 Transitive Closure 64 6 4 19 Intransitive Reduction cles 65 6 4 20 Explicit Surface Graphs 65 0 4 21 Voronoi s a es RR Eod 65 6 4 22 Triangular Graphs 66 7 Iterators 67 T Uneidence Lists 67 Ta Vterator Objets os nc c 9 Xo e Sees eee b bons 67 INI oa Fani 68 7 4 Implementations lt eca ci eaaa 000002 69 8 Explicit Data Structures 71 81 Container s o soe ees ora eai Re doe p Re es 71 BLL unn om eg mos Re a we pe 73 BI uu adu oh ed ek Bd qos Us dE UTER SU 73 Bla Fronty eed s BR aoe 73 8 2 Disjoint Set Systems llle 73 8 2 Static Disjoint Set Systems 74 8 2 2 Shrinking Families o ss ssu taeao x xo 74 Do Hash Tables AURI 75 Dictionaries 26s ee XR OR 75 Matrices 225 o soe o ook Roo RE oho RR ORO S 76 9 Index Sets 79 11 26 Node Potentials oc sted 97 DI 79 112 7 Bode Colows o e o 229 262454 4204 e92
225. latter types are helpful to distinguish the primal respectively dual side of a linear program CHAPTER 5 PRELIMINARY STATEMENTS 5 2 7 Class Local Types Apart from these global base types there are some more types which are used with a few methods only and which are declared within one of the root classes goblinData0bject and goblinILPWrapper respectively Generally the scope is obvious and not specified explicitly in this document 5 3 Bounds and Precisions of Numbers The length of matrix indices is an upper bound to the length of arc indices which in turn bounds the length of node indices Node indic values are bounded by the number of nodes in the corre sponding graph object This number of nodes is in turn bounded by the maxNode parameter defined in the context Finally naxNode is bounded by the constant NoNode which cannot be manipulated at runtime The method goblinController SetMaxNode manipulates the maxNode parameter There is a method goblinController SetMaxArc which works in the same way for arc indices the parameter maxArc and the constant NoArc The context variable goblinController epsilon denotes the smallest number which is treated different from zero It may apply in any situation where the numerical stability needs to be improved 5 4 Ownership of Objects Include file globals h Synopsis class goblinAbstractObject t enum TOwnership OWNED BY SENDER OWNED BY RECEIVER BOUNDS AND PRECISIONS s
226. le and UNIX Installation The GOBLIN Makefile controls the compilation and linkage of the library the GOSH shell tool and the executable solvers the generation of this doc umentation and the generation of new GOBLIN packages which either in clude all sources or binaries In what follows it is supposed that your current working directory is the root directory of the source code distribution The GOBLIN library libgoblin a is then generated from console prompt by typing gmake goblin As the next step of GOBLIN installation generate the GOSH shell inter preter For this goal set in Makefile the variables libtcl and libtk to the Tcl Tk versions installed on your machine and then type gmake Similarly gmake shared creates a shared object libgoblin so which includes the core library func tions in goblin a plus the Tcl Tk command registrations and which can be dynamically loaded into the original tclsh shell The call THE MAKEFILE gmake manual produces the two files mgoblin lt version gt ps and mgoblin lt version gt pdf This is the reference manual which you are just reading The document can be viewed and printed by using ghostview mgoblin lt version gt ps amp or acroread mgoblin lt version gt pdf amp Once the shell tool is available one can start the GUI by typing goblet but this works from the Makefile directory only If you don t have root privileges exectute the personal installation by typing
227. liminated Conversely if the target model is LAYOUT FREESTYLE POLYGONES or LAYOUT FREESTYLE CURVES the edges are redrawn to exhibit parallel edges and loops If neither the target model nor the original model is LAYOUT STRAIGHT 2DIM by default an interme diary conversion to the LAYOUT STRAIGHT 2DIM model takes place Future development will bear more sophisticated conversion rules but only for particular pairs of layout models The procedure is not intended to perform drawing algorithms inline 12 1 2 Grid Lines Synopsis class goblinController 1 int nodeSep int bendSep int fineSep 12 1 3 Translations of the Current Drawing Include file abstractMixedGraph h Synopsis class abstractMixedGraph 1 void Layout StripEmbedding O void Layout ScaleEmbedding TFloat TFloat TFloat TFloat 104 CHAPTER 12 GRAPH DRAWING There are two methods Layout StripEmbedding and Layout ScaleEmbedding x X which shift respectively scale the current drawing The strip operation shifts the drawing to the non negative orthant such that every coordinate becomes zero for at least one graph node The parameters of the scale operation specify a tight bounding box for the updated coordinates By taking X x or lt the scale operation can be used to flip the layout along the ordinate or abscissa Do not confuse this functionality with the display parameters which are discussed in Section 14 6 and which change the view i
228. lly unique object handle This functionality is transparent to the programmer If a new class is derived from goblinDataObject or its descendants the programmer merely writes call goblinData 0bject into all constructors of the new class Here CT denotes the desired context The context of a goblinDataObject and its respective handle can be accessed by the class methods Context and Handle Conversely con 148 trollers can determine the addresses of the hosted data objects from their handles by means of ObjectPointer If only the handle but not the context is known goblinDefaultContext Lookup H returns the address It is particular useful to store handles instead of addresses if the refer enced object may be deleted within the life time of the referencing object Lookup returns a NULL pointer when dereferencing raises a segmentation fault Internally all data objects hosted by the same controller object are in a linked list Since all controller objects are also in a linked list it is possible to enumerate all valid GOBLIN data objects The method DisplayA11 is straight forward application To every controller object one can assign a master object by calling SetMaster with the handle of the desired master object This handle can be questioned by the method Master The master object determines the context label and implicitly the labels of all unnamed objects in that context 14 3 Logging GOBLIN is f
229. mp indexSet lt TNode gt amp indexSet lt TNode gt amp TOption OPT_PARALLELS This constructor inducedBigraph G U V opt works much like for the pre viously described class inducedSubgraph Two specified node sets U and V are mapped Edges are mapped only if one end node is in U and the other 64 CHAPTER 6 GRAPH OBJECTS end node is in V and implicitly oriented from U to V then Both sets must be disjoint otherwise an exception ERRejected is raised The options are handled as before 6 4 17 Colour Contraction Include file mixedGraph h Synopsis class colourContraction 1 public mixedGraph colourContraction abstractMixedGraph amp TOption 0 The nodes of colourContraction G opt are the colour classes of G That is all nodes are mapped and equally coloured nodes of G are mapped to the same node Edges are mapped only if the end nodes belong to different colour classes Two options are supported If the option OPT PARALLELS is specified parallel arcs are allowed Otherwise some minimum length edge is mapped If the option OPT SUB is specified the subgraph data structure is exported to an own graph object 6 4 18 Transitive Closure Include file sparseDigraph h Synopsis class transitiveClosure 1 public diGraph transitiveClosure abstractDiGraph amp G TOption 0 CHAPTER 6 GRAPH OBJECTS This constructor transitiveClosure G opt copies the input digraph and augments it by
230. ncluding blanks The graph browser can handle this in the most cases but we did not find a way to save a GIF bitmap to a file in Documents and settings yet 2 9 Download of new GOBLIN Versions New versions of GOBLIN will be distributed via the internet URL http www math uni augsburg de opt goblin html The project is presented at http www freshmeat net 19 BUG REPORTS under the project name goblin By subscribing to the project you ob tain regular infos about updates via e mail Do not miss to make a project rating 2 10 Bug Reports The authors appreciate any kind of suggestions and bug reports E mail to goblin math uni augsburg de In the folder project of this installation you can find a form for bug reports 20 CHAPTER 2 INSTALLATION CHAPTER 3 GETTING STARTED Chapter 3 Getting Started This chapter will give you a first idea of how GOBLIN can apply to your own graph optimization problem More explicitly it describes the four different interfaces to the GOBLIN library functions by some instructive examples 3 1 The GOBLET Graph Browser GOBLET is the graphical user interface to the GOBLIN library It can be used to edit graphs to configure the core library to run problem solvers and to view the computational results This graphical output can be printed and exported to bitmaps but also to canvases First try the following example Change to the root directory of the GOBLIN installation and
231. nd lt TArc TFloat gt Note that the choice of TKey is immaterial to some extent Except for the construction of a static queue and the destruction of a dynamic queue all operations are elementary that is they take O 1 time 8 1 2 Stacks Include files staticStack h staticStack cpp dynamicStack h dynami 2 Stacks are container objects which follow the last in first out principle There are two implementations The class staticStack which models sets and the class dynamicStack which models multisets For both classes the GOBLIN library contains precompiled code for the template instances lt TNode TFloat gt and lt TArc TFloat gt Again the choice of TKey is immaterial Except for the construction of a static stack and the destruction of a dynamic stack all operations are elementary 8 1 3 Priority Queues Include files void Insert TItem TKey TKey Key TItem void ChangeKey TItem TKey F Priority queues are container objects to which TItem objects are added to gether with a specific priority The item to be deleted is the set member with the highest priority This value is usually called the key of an item a notation which is somewhat misleading since two members may have the same priority GOBLIN priority queues are all static and differ only by their run time hayjour From a theoretical point of view only a fibonacciHeap per forms better than a binaryHeap which in turn performs better than a basic
232. nd inftyColour are used for the display of predeces sor arcs and the display of unreachable nodes respectively The method FixedColour provides an explicit scheme for the node and arc colours SmoothColour can be used if the fixed colours are not exhausted 20 colours are defined of if adjacent colour indices should be displayed with similar colours All returned strings are in 24 bit rgb format CHAPTER 14 THE OBJECT CONTROLLER Figure 14 1 A Graph Layout with Subgraph and Predecessor Arcs The class goblinDisplay also supplies with the node and the arc labels and the labels of the legenda Note that two sets of arc labels can be dis played simultaniously that is the arcLabels or arcLabels2 option must be passed to the methods ArcLabel and ArcLegenda explicitly Figure 13 5 shows a graph layout with two sets of arc labels and a legenda The layout is based on the geometric information which is encapsulated into the graph object Up to the layout of trees GOBLIN does not compute any graph embeddings If no embedding is present the graph object cannot be viewed The parameters xShift xZoom yShift and yZoom define an affine transformation of this embedding and the transformed coordinates can be accessed by CanvasCX and CanvasCY The parameter legenda enables or disables the generation of a legenda This legenda shows which node and arc labels are displayed in the layout If legenda 0 no legenda is printed Otherwise the value o
233. nd load the library dy namically into a Tcl shell This document describes the C API of the library functions and the Tcl wrapper extensively The solver programs and the graph browser GOBLET are discussed within a few pages only 1 5 Fundamental Library Concepts The design of the GOBLIN library follows the object oriented paradigm This means a rather restrictive data encapsulation in order to obtain e compliance with other mathematical libraries especially LP Solvers e a user interface which is as simple as possible Merely the configuration parameters associated with controller objects are public The extensive use of polymorphisms leads to a class hierarchy which is adequate and intuitive from the point of view of mathematics High level methods are separated from data structures and problem transformations are established by separate classes In general the C implementation of mathematical algorithms is somewhat slower than straight C code This stems from so called late FUNDAMENTAL LIBRARY CONCEPTS binding operations which assign a method name to a method implemen tation at runtime On the other hand polymorphism eases the development and debugging of new algorithms a lot Even more this mechanism is compliant with the idea of open source projects where nobody is responsible for the correct ness of the source code Every new algorithm which uses an old part of the library is a certificate that this old code fra
234. nd min cost perfect matchings e Undirected Chinese postman problems and 7 joins Weighted b matching problems Weighted f factor problems e Weighted capacitated b matchings The library also includes algorithms for some NP hard problems in graph theory namely e A TSP TSP and ATSP e Stable sets vertex covers and maximum cliques e Graph colourings and clique partitions There is a generic branch and bound module which is applied for the metric TSP solver and the computation of independent sets Since GOBLIN does not support cutting planes the solvers cannot compare with state of the art codes for these problems but should work for problems up to 100 nodes Release 2 6 comes with a basic LP simplex code and a generic interface for integration with more sophisticated LP solvers So far this module is utilized by the min cost flow solver only Branch and cut applications will follow 1 2 History GOBLIN is result from the Deutsche Forschungsgemeinschaft DFG re search project Balanced Network Flows This project is dedicated to the design analysis and implementation of algorithms for generalized matching problems The extensive source code for network flow algorithms in GOBLIN is due to the strong dependencies between network flow and matching prob lems Some of the matching algorithms explicitly require solvers for certain 11 PURPOSE AND APPLICATIONS network flow problems Furthermore the layered shrinking grap
235. ndependently from the saved coordiantes and the geometric distance labels 12 1 4 Automatic Alignment of Arcs Include file abstractMixedGraph h Synopsis class abstractMixedGraph void Layout_ArcAlignment TFloat 0 The method Layout ArcAlignment d eliminates all arc alignment points from the present layout and then redraws the arcs where simple graphs are drawn with straight lines Parallel arcs are separated by using the parame ter d If no value is specified the context variable bendSep comes into play Loops which are usually invisible unless interpolation points are associated with them are also drawn All of the layout methods which are discussed next perform this arc alignment procedure as a final step 12 2 Circular Layout Include file abstractMixedGraph h Synopsis CHAPTER 12 GRAPH DRAWING class abstractMixedGraph void Layout_Circular int 0 void Layout CircularByPredecessors int 0 void Layout CircularByColours int 0 bool Layout Outerplanar int 0 The method Layout_Circular spacing draws the graph nodes as a regu lar polyhedron in the x y plane If spacing is specified this overwrites the context parameter nodeSep There are some variants of the method which differ by the order of the nodes on the resulting circle e Layout_CircularByPredecessors If predecessor arcs are avail able the method starts at some node tracks back the predecessor arcs and consecutively pla
236. nfigured in practice If you call GOBLIN from within a C program you can access all variables directly If you call the library from a GOSH script the GOBLIN context variables have a prefix goblin For example the tracing module is switched off by the command set goblinTraceLevel 0 Sometimes it is more efficient to call the method Configure which can change several parameters in one pass This method is called with an ar ray of strings each of which represents a variable name value or a general option One can set a context variable by adding a parameter which is composed from the variable name and the desired value The Configure method can be called from any C C main routine and then passes the console input to GOBLIN It can also be called from GOSH scripts For example the GOBLIN branch and bound module is enabled by the command goblin configure methSearch 2 The logging module admits some general settings which can be selected from the options silent report details and debug with increasing order of logging information Note that string context variables are generally read only in the GOSH shell Strings can be set with the goblin configure command only Even from C level it is recommended to use this mechanism to avoid incon sistencies with the memory management 165 14 8 RUNTIME CONFIGURATION CHAPTER 14 THE OBJECT CONTROLLER 166 CHAPTER 15 THE MESSENGER Chapter 15 The Messenger A messenger objec
237. ns occur which will not be explained in detail Example set fileName file rootname lindex argv 0 set file open fileName max r goblin sparse digraph G set n 0 while gets file thisLine gt 0 if scan thisLine p max n m 2 for set i 1 i lt n incr i G node insert if scan thisLine n As u type 2 if type s set source expr u 1 if type t set target expr u 1 if scan thisLine a u v 3 if n 0 puts File conversion failed exit 1 set a G arc insert expr u 1 expr v 11 G arc a set ucap cap 24 CHAPTER 3 GETTING STARTED close file if source target puts Missing source and or target node exit 1 G maxflow source target This script reads a graph from a foreign file format namely the DIMACS max flow format and computes a maximum st flow These two examples illustrate how graph objects can be manipulated easily from within a Tcl Tk GOSH script On the other hand the variable substitution is sometimes difficult to read and long scripts are more difficult to handle than equivalent C code 3 3 Using the Library The bulk of this reference manual deals with the C library objects and methods This is so since direct application of the library produces the most efficient code Of course we also want to give other researchers the opportunity to develop the GOBLIN library furt
238. nstee TNode TFloat MicaliVazirani TNode TNode NoNode void CancelEven virtual TFloat CancelOdd A balanced pseudo flow on a balanced flow network is a pseudo flow such that for every arc a BalFlow a BalFlow a 2 holds In contrast to the ordinary max flow solvers one only specifies the source node s The sink note t s 1 is determined by the flow symmetry The generic solver method MaxBalFlow calls one of the actual problem solvers according to the value of methMaxBalFlow 13 12 1 The Balanced Augmentation Algorithm The method BNSAndAugment is the most simple method which iteratively calls BNS It solves a k factor problem in O nm time for fixed k and the general maximum balanced flow problem in O vm time 13 12 2 The Capacity Scaling Algorithm The method CapacityScaling splits the balanced augmentation algo rithm into scaling phases In the delta phase only the arcs with BalCap a gt delta are considered The parameter delta is initialized to 132 CHAPTER 13 HIGH LEVEL ALGORITHMS the maximum capacity and is divided by 2 if no further augmenting path can be found The resulting time bound is O m log U Except for the final scaling phase every augmenting path is valid Hence the balanced network search is replaced by an ordinary BFS for the bulk of the computation Effectively the effort decreases to the solution of an ordinary network flow problem 13 12 3 The Phase Ordered Algorithm The me
239. odule modSample by the method calls OpenFold modSample opt and CloseFold modSample opt which must match each other 190 CHAPTER 17 RESSOURCE MANAGEMENT By default folds signal indentations to the messenger suppress such indentations one can pass an optional parameter NO INDENT Conversely if the module context has already been set additional indentations can be forced by calling OpenFold and CloseFold without any parameters Opening a fold enables the associated timer If the timer was not already running the problem bounds are also reset 17 3 1 Authorship Include files globals h Synopsis enum TAuthor NoAuthor struct TAuthorStruct char name char affiliation char e_mail F const TAuthorStruct listOfAuthors 17 3 2 Bibliography Data Base Include files globals h Synopsis enum TBibliography NoBibliography struct TBibliographyStruct 1 char refKey char authors char title char type CHAPTER 17 RESSOURCE MANAGEMENT char char int char int collection editors volume publisher year const TBibliographyStruct listOfReferences 17 4 Progress Measurement A description of this functionality is delayed until the interface has become stable 17 4 PROGRESS MEASUREMENT 191 17 4 PROGRESS MEASUREMENT CHAPTER 17 RESSOURCE MANAGEMENT 192 CHAPTER 18 PERSISTENCY Chapter 18 Persistency 18 1 Export of Data Objects In
240. one side of a node may result GOBLIN provides Kandinski drawings of general graphs visibility rep resentations and GIOTTO drawings for planar graphs and drawings with 107 12 6 ORTHOGONAL DRAWING small nodes for 2 connected graphs with maximum node degree 4 Post processing techniques for the GIOTTO model are desirable but are not available yet By calling Layout OrthogonaliBent opt grid the following steps are performed in order to obtain drawing in the Kandinski model e The nodes are placed in general position that is with only node in one column or row This placement preserves the order of coordinate values in the preceding drawing e The edges are distributed to the four sides of each node The node size is also computed This procedure depends on the opt parameter e couple of context parameters are set according to the Kandinski layout model and the grids used for this drawing e The edges on each side of a node are ordered so that the drawing does not include crossings of adjacent arcs e Every arc is drawn with exactly one bend node and with the arc label in the neighbourhood of this bend node If the graph layout and incidence structure is not changed intermediately calling this layout tool several times results in the same drawing But the procedure supports some pre and postprocessing techniques e The preceding node placement It is useful to start with a readable drawing not necessarily in an ort
241. ons The last argument passed to a problem solver is the input file name say xyz The solver expects a file xyz gob which consists of a graph definition see Section 18 4 for the file formats Do not specify the extension gob explicitly The computational results are written to a file xyz rst and the logging information is written to a file xyz log By default the output is the entire graph definition which can be read by the program gobshow to display the results One can produce a more economic output by using the options sh and silent The first option forces the solver to write only the relevant data structure subgraph predecessor labels etc to file the second option SOLVER APPLICATIONS suppresses the writing of a log file completely Note that the main routines do not support any error handling yet In case of trouble consult the log file The return value indicates the existence of a feasible solution rather than internal errors If the log file does not give evidence of what has gone wrong please contact the author 21 1 1 Matching Problems The program optmatch is the GOBLIN solver for all kinds of matching problems The input graph may be any undirected graph either sparse or complete For bipartite graphs specialized methods are used If one specifies w either a perfect matching of minimal costs is com puted or the program shows that no perfect matching exists If this option is omitted the objective is a maxim
242. ons immediately manipulate the subgraph of the ob ject G1 6 3 5 Layered Shrinking Networks Include file shrinkingNetwork h Synopsis class layeredShrNetwork public layeredAuxNetwork layeredShrNetwork abstractBalancedFNW amp TNode staticQueue lt TNode TFloat gt staticQueue lt TArc TFloat gt staticQueue lt TArc TFloat gt TNode StartNode TArc TNode DDFS TArc void ShrinkBlossom TNode TArc TFloat 6 3 LOGICAL OBJECTS TFloat FindPath TNode void Expand TNode TNode void CoExpand TNode TNode void Traverse TNode TNode TNode TArc TArc TArc void Augment TArc This class makes the topological erasure technique of layered auxiliary net works available to matching and balanced network flow problems But this class has a lot of additional data structure and functionality If one looks at the constructor interface only it is obvious that there are a lot of dependencies between the layeredShrNetwork objects and the algorithm which constructs the object We do not go into the details but need to describe the functionality and the running times of some of the methods Roughly speaking a double depth first search DDFS a determines the blossom which occurs if the arc a is added to the layered auxiliary net work and returns the base b of this blossom Then the blossom can either be shrunk by a call ShrinkBlossom b a or a minimum length aug menting path is found
243. ool ShortestPath TNode s TNode t NoNode as an interface for future implementations all solvers are configured to solve bool ShortestPath TOptSPXMeth TOptSPXChar practical problem instances This ranges from several 10000 node instances TNode TNode NoNode for shortest path min tree max flow and non weighted matching prob lems few thousand node problems for min cost flow arborescence and bool Eligible TOptSearch TArc weighted matching problems to 150 node instances for the exact solution of NP hard problems we have restricted ourselves to pure combinatorial bool BFS TOptSearch TNode TNode NoNode methods Note that there was considerable effort to provide codes which TNode SPX_Dijkstra TOptSPXChar support post optimization and which apply to the most general problem formulations possible const indexSet lt TNode gt amp const indexSet lt TNode gt amp 111 13 1 SHORTEST PATHS bool SPX FIF LabelCorrecting TOptSPXChar TNode TNode NoNode bool SPX BellmanFord TOptSPXChar TNode TNode NoNode TNode VoronoiRegions class abstractGraph 1 bool SPX TJoin TNode TNode 13 1 1 Eligible Arcs The method Eligible qualifies the arcs which may appear on a shortest path tree Basically it guides shortest path algorithms to compute di rected paths for digraph objects and arbitrary paths in undirected graphs If the SPX_RESIDUAL option is used paths with residual capacity are deter mined
244. orRelease PatchLevel O BuildDate 0 License 0 enum TLPOrientation 1 172 we CHAPTER 16 LINEAR PROGRAMMING SUPPORT ROW_ORIENTED 0 COLUMN_ORIENTED uo 1 virtual TLPOrientation Orientation 0 The LP module is accessed by a context pointer to a goblinILPModule ob ject The purpose of this class is instance generation NewInstance and ReadInstance explicit runtime time information about the LP instances Reinterprete plus some general module information The method ReadInstance expects a filename as an input parameter The input file format may differ among the various implementations The method NewInstance takes the desired number of restrictions variables and non zero matrix coefficients as well as the direction of optimization Note that the goblinILPModule object is in the goblinDefaultContext but LP instances may be inserted into other contexts In order to generate LP instances from this abstract interface one needs to cast back the entry pointer before problem instanciation Example goblinILPModule X goblinILPModule goblinController pLPModule goblinILPWrapper myLP X ReadInstance fileName thisContext Accordingly the registration of an LP module looks like Example goblinILPModule tmpPtr new myLPModule goblinController pLPModule void tmpPtr CHAPTER 16 LINEAR PROGRAMMING SUPPORT where myLPModule may denote some implementation of goblinILPModule
245. ounding procedure SolveRelaxation is as follows First it is checked that for all nodes at most two incident edges have been selected and that the subproblem is still 2 connected If one of these conditions is violated InfFloat is returned Otherwise a minimum spanning tree method is called which has been modified to compute the optimal extension of the selected arcs to a 1 tree The used node potentials are inherited from the parent branch node The root node for the 1 tree computations is the same for all subproblems If methRelaxTSP2 gt 0 if the inital DFS phase has been passed and if the the length of the optimal 1 tree does not exeed the feasibility bound subgradient optimization is applied to increase the relaxation bound This procedure stops immediately when the 1 tree length exeeds the feasibil ity bound When setting methRelaxTSP2 1 the subgradient method runs in the fast mode When setting methRelaxTSP2 2 the number of branch nodes is minimized If the original graph is complete and CT methCandidates k where k gt 0 the constructor of the root branch node computes a candidate sub graph which consists of e the current predecessor arcs usually the best known tour e 20 random tours one should set methLocal 1 to force the tours to local optimality e and the least cost edges incident with every graph node It has been experienced that even for k 0 often an optimal tour can be obtained from the candidate gr
246. pacity scaling Max Flow start up methBNS Breadth First Depth First Heuristics Depth First Heuristics Breadth First Heuristics ojo e WNr w N TRACING CHAPTER 14 THE OBJECT CONTROLLER The tracing functionality is a valuable tool both for debugging and for vi methMinCBalFlow 0 Primal Dual sualising of the course of an algorithm The tracing can be controlled by methPrimalDual Restart BNS after each dual update A class method can be traced only if it defines a breakpoint By this Restart BNS after changes in the shrinking fam we denote a method call CT Ping H priority which does the following ily The handle H specifies the object to be traced The value of priority Restart BNS after blossom expansion is added to the current value of traceCounter If the new value of the methTSP Random tour counter exeeds traceStep then traceCounter is reset to zero and some Insertion heuristics information is written to an output device To this situation we refer as a Tree heuristics tracing point If one has traceStep 1 every breakpoint triggers off a Christofides undirected graphs only tracing operation The concrete output depends on the value of traceLevel Table 14 5 1 gives an overview A higher trace level generally generates more tracing information Levels 3 and 4 are reasonable for small examples only and 14 5 Tracing may generate several megabyte of tracing files It is possible to suppress the first tracing op
247. plicitly calls the solver method Optimize As the second constructor parameter either pass the objective value of a solution known in advance or the Infeasibility O constant if no feasible solution is known The Optimize O method consists of the main loop and of iterated calls to SelectActiveNode and Inspect The method SelectActiveNode selects an active subproblem which is split as described in the previous sec tion Inspect evaluates the new subproblems and StripQueue deletes irrelevant branch nodes when an improving feasible solution is found We have already described the problem specific parts of branch and bound codes and how these parts apply to the general algo rithm We have seen that the branch strategy is partially con trolled by the methods SelectVariable O DirectionConstructive and DirectionExhaustive The method SelectActiveNode contributes the general strategy of switching between best first and depth first steps This strategy depends on the specified search level e SEARCH CONSTRUCT Branching starts with a certain rather large number of DFS steps in order to obtain an initial bound After that series of depth first steps alternate with a few best first steps so that the solver cannot get stuck in non profitable regions of the branch tree When getting close to maxBBNodes the maximal configured number of active branch nodes only DFS steps are performed e SEARCH EXHAUSTIVE It is assumed that the ini
248. psis class abstractMixedGraph 120 CHAPTER 13 HIGH LEVEL ALGORITHMS bool IsPlanar bool PlanarityDMP64 TArc TNode LMCOrderedPartition TArc TArc TNode void GrowExteriorFace void PlaneConnectivityAugmentation void PlaneBiconnectivityAugmentation void Triangulation class sparseGraphStructure void Planarize TArc planar graph is a graph which can be drawn in the plane without any edge crossings Many optimization problems admit special solvers for planar graphs which perform much better than the general codes see the max cut section for an example Usually it is not necessary to know an explicit drawing The method IsPlanar is the general entry point for planarity tests It checks if the graph is planar but does not export an embedding The pure planarity test is implemented for general graph objects Explicit pla narization is restricted to sparse graph objects which are stored by incidence lists 13 7 1 The Method of Demoucron Malgrange and Pertuiset The implemented planarity test PlanarityDMP64 first adds some arcs to obtain a 2 connected graph Then an initial cycle and two regions are gen erated The remaining graph arcs are partitioned into segments In the main loop of the algorithm a segment is determined which can be embed ded into a minimum number of regions From this segment an arbitrary path is embedded into some feasible region and this region is split All loops
249. r of edges which must be removed so that two nodes become disconnected The strong counterparts require that all connecting paths are eligible Iterated Max Flows Push Relabel FIFO methMinCut 0 1 2 Push Relabel Highest Order 3 Node Identification Figure 13 6 Edge Connected Components of Order 3 125 MINIMUM COST FLOWS Note that the methods Connectivity and StrongConnectivity uti lize node splittings which were described in Section 6 4 12 and essentially solve O n max flow problems Since the node demands in the original graph map to arc capacities in the node splitting the vertex connectivity methods observe node capacities In order to compute vertex connectivity in the traditional sense one must set all node demands to 1 Figure 13 7 A Legal Ordering If methMinCut 0 is configured each of the three edge connectivity meth ods solves O n max flow problems If StrongEdgeConnectivity TNode or EdgeConnectivity is called with methMinCut gt 0 a modified version of the push and relabel method MinCutHaoOrlin is called which has the same worst case time complexity as the original max flow algorithm To our experience the highest order implementation performs much better than the FIFO version and the iterated max flow strategy The method EdgeConnectivity which works for the global min cut problem supports a further algorithm The method 126 CHAPTER 13 HIGH LEVEL ALGORITHMS Min
250. r predColour char inftyColour long int width long int height public virtual void goblinDisplay abstractMixedGraph amp float long int CanvasCX TNode v long int CanvasCY TNode v long int AlignedCX TNode u TNode v long int AlignedCY TNode u TNode v goblinController amp Configuration virtual void DisplayGraph char ArcLabel TArc int char NodeLabel TNode char ArcLegenda int char NodeLegenda char char FixedColour TNode char SmoothColour TNode 160 CHAPTER 14 THE OBJECT CONTROLLER virtual void DisplayArc TArc 0 DisplayNode TNode 0 DisplayLegenda long int long int long int 0 virtual void virtual void The class goblinDisplay organizes the device indepent layout of GOBLIN graph objects This class is abstract and instances are implicitly generated by the method abstractMixedGraph Display which also calls a virtual method ConfigDisplay The goblinDisplay constructor generates a clone of the controller object This clone the configuration can be accessed by the method Configuration The method ConfigDisplay which is called with the display configuration makes some class dependent changes of the layout pa rameters The class goblinDisplay provides some other ressources such as colours and the bounding box This guarantees that the graphical output gener ated by the classes exp2tk and exp2xfig has the same appearance The colours predColour a
251. r 2 connected outerplanar graphs Draw every interior face as a regular polygone 214 CHAPTER 20 THE GOSH INTERPRETER NODE AND ARC MESSAGES 20 9 Graph Node and Arc Messages The most significant difference between the C library functions and the GOSH message concerns the nodes and arcs of a graph All messages which address the node 3 and the arc 7 of a graph G start G node 3 and G arc respectively This applies to all messages listed in Table 20 9 1 and Table 20 9 2 arc indices range between 0 and 2m 1 and arc directions are specified by the least significant bit On the other hand arc insertion messages return the new arc index without this additional bit Example G spath s set a expr 2 G arc insert u v G arc a set length expr G node u potential G node v potentiall would generate a new arc with start node u and end node v The new arc is initialized with zero reduced length so that it can replace one of the arcs in the shortest path tree which was computed before In order to specify the drawing of a graph arc a first add an alignment point by the command G arc a set align x y where x and y are the coordinates of the alignment point This denotes the point where the arc labels are printed Then interpolation points are successively defined by G arc a interpolate x y where x and y are the coordinates again New interpolation points are placed at the end of the list If an
252. r is returned by the method abstractMixedGraph NewIterator and utilizes the methods First and Right which have been discussed before Under some circumstances the methods First and Right do not pro vide an efficient implementation For this reason surface graphs and layered auxiliary networks implement own iterators which keep some temporary in formation Accordingly the method NewIterator is overloaded in order to supply Investigate with a proprietary iterator object Include files abstractMixedGraph h auxiliaryNetwork h surfaceGraph h Synopsis class abstractMixedGraph 1 virtual goblinIterator NewIterator Just as graph objects GOBLIN iterators are polymorphic There is however the class iGraph which supplies with iterators for 69 7 4 IMPLEMENTATIONS 70 CHAPTER 7 ITERATORS CHAPTER 8 EXPLICIT DATA STRUCTURES Chapter 8 Explicit Data Structures This chapter describes the GOBLIN classes which are data structures in the usual sense and for some of which equivalent data structures can be found in the standard template library STL The template data structures which are discussed here support the GOBLIN memory manage ment and tracing functionality In general the template parameter lt TItem gt has to be integral and the GOBLIN library file contains template instances for the types TNode and TArc generate additional template instances one may include the cor responding cpp
253. r messaging The relationship between the options methLP methLPStart and the types TSimplexMethod TStartBasis is the obvious one The methods StartPrimal and StartDual can be used to deter mine feasible rather than optimal solutions 180 CHAPTER 16 LINEAR PROGRAMMING SUPPORT 16 1 7 File I O Include file ilpWrapper h Synopsis class goblinILPWrapper 1 enum TLPFormat 1 MPS_FORMAT 0 LP_FORMAT 1 MPS_CPLEX 2 BAS CPLEX 3 BAS GOBLIN 4 J void Write char TOption 0 void Write char TLPFormat TOption 0 void WriteMPSFile char TLPFormat MPS_CPLEX void WriteMPSFile ofstream amp TLPFormat MPS_CPLEX void WriteBASFile char TLPFormat BAS CPLEX void WriteBASFile ofstream amp TLPFormat BAS CPLEX void ReadMPSFile char void ReadMPSFile ifstream amp void ReadBASFile char void ReadBASFile ifstream amp The LP file interface supports the standard MPS format and the CPLEX MPS variant for both reading and writing files and the CPLEX LP format for writing files only The output methods work implementation indepen dent the input MPS method requires a void LP to run and by that a default constructor in the LP plugin Additionally one can read and write 16 1 PUBLIC INTERFACE MPS basis files Again reading a basis requires that the LP plugin supports setting a special basis The native LP file format generated by the method Write char TOption consists of a certain header part an
254. rLabel and RestrLabel supply with variable names and symbolic row labels Generally rows and columns are ref erenced by indices rather than labels 175 16 1 PUBLIC INTERFACE 16 1 3 LP Instance Manipulation Include file ilpWrapper h Synopsis class goblinILPWrapper virtual TVar AddVar TFloat TFloat TFloat TVarType virtual TRestr AddRestr TFloat TFloat virtual void DeleteVar TVar virtual void DeleteRestr TRestr virtual void SetURange TVar TFloat virtual void SetLRange TVar TFloat virtual void SetUBound TRestr TFloat virtual void SetLBound TRestr TFloat virtual void SetCost TVar TFloat virtual void SetVarType TVar TVarType virtual void SetVarLabel TVar char TOwnership virtual void SetRestrLabel TRestr char TOwnership virtual void Set bjectSense TObjectSense void FlipObjectSense virtual void SetCoeff TRestr TVar TFloat virtual void SetRow TRestr TVar TVar double virtual void SetColumn TVar TRestr TRestr double virtual void Resize TRestr TVar TIndex virtual void StripO 176 CHAPTER 16 LINEAR PROGRAMMING SUPPORT Every goblinILPWrapper object is instanciated with a couple of problem dimensions These quantities are not the actual dimensions but rather the amount of reserved memory which can be adjusted dynamically by using Resize k 1 r This concerns the number of rows k the number of vari ables l and the number of non zero matrix coefficients r StripO oper
255. raph amp TNode Source TNode Target bool Perfect canonical network flow problem is flow network whose lower ity bounds are all zero and such that except for a special node pair all node demands are zero The class FNW2FNW allows to transform a given net work flow problem into an equivalent canonical problem More explicitly it manages 6 3 LOGICAL OBJECTS 1 the reduction of the feasible circulation problem to the maximum st flow problem 2 the reduction of the min cost circulation problem to the min cost st flow problem The reduction technique is adding an artificial source node and an artificial target node and adding some arcs to the network artificial nodes may be accessed by the respective methods Source and Target O Any flow on the logical graph object corresponds to a pseudoflow of the referenced flow network which respects the capacity bounds For example a zero flow corresponds to a pseudoflow with Flow a LCap a If a feasible b flow circulation of the referenced networks exists any maximum flow of the logical object will give such a b flow A maximum flow of minimum costs corresponds to a minimum cost b flow then Given any logical flow it may be checked whether it maps to a feasible b flow or not by a call to the method Perfect O The constructor method does not initialize the flow on the FNW2FNW ob ject to zero but to the image of the original flow Some augment
256. rat99 rat99 rat99 rd100 rd100 rd100 rd100 kroA100 kroA100 kroA100 kroB100 kroB100 kroB100 kroC100 kroC100 kroC100 kroD100 kroD100 kroD100 kroE100 kroE100 kroE100 234 Opt Method Root 25395 SGO 25395 EXH 675 SGO 675 CAND 675 EXH 538 SGO 538 CAND 538 EXH 108159 SGO 108159 CAND 108159 EXH 55209 SGO 55209 CAND 55209 EXH 1211 SGO 1211 CAND 1211 EXH 7910 SGO 7910 SGO2 7910 CAND 7910 EXH 21282 SGO 21282 CAND 21282 EXH 22141 SGO 22141 CAND 22141 EXH 20749 SGO 20749 CAND 20749 EXH 21294 SGO 21294 CAND 21294 EXH 22068 SGO 22068 CAND 22068 EXH 30 30 16 16 16 6 6 6 39 39 39 79 79 Found Time 25355 25395 25395 671 684 671 675 675 537 543 537 538 538 105120 108879 105120 108159 106509 108159 54570 55462 54570 55209 55209 1206 1220 1206 1211 1211 7898 8046 7900 8046 7900 7910 7910 20937 21583 20937 21282 21282 21834 23698 21834 22141 22141 20473 20812 20473 20749 20749 21142 21493 21142 21294 21294 21800 22141 21800 22068 22068 Instance eill01 eill01 eill01 lin105 lin105 107 107 107 51120 51120 51120 124 124 124 bier127 bier127 bier127 ch130 ch130 ch130 ch130 pr136 pr136 pr136 gr137 gr137 gr137 144 144 144 ch150 ch150 ch150 kroA150 kroA150 kroA150 kroA150 Opt Method Root 629 629 629 14379 14379 4430
257. raw non empty arcs only 2 draw fractional arcs dashed 3 draw empty free full arcs with different width 4 draw all arcs uniformly 5 different patterns for different subgraph labels 6 display arc colours with a fixed colour pattern T display arc colours with a dynamic colour pat 14 6 5 Arc Display Options tern predecessors 0 nothing special 1 highlight predecessor arcs 14 6 6 Node Display Options 162 CHAPTER 14 THE OBJECT CONTROLLER 14 6 GRAPHICAL DISPLAY Parameter Default Value nodeStyle dots Shift on the ordinate 2 circles Scaling of the ordiante no colours bendSep Grid size for the bend nodes highlight nodes with finite distance labels Used in AutoArcAlignment boxes yShift Shift on the abscissa nodeColours node colours fineSep Grid size for node and arc labels node demands Currently used by the browser only 4 node partition indices 0 1 2 Diameter of graph nodes 2 distance label Width of arrows 0 1 0 1 3 node potentials legenda Separator for the legenda 4 node colours If zero no legenda is generated 6 0 1 3 no labels Scaling of the abscissa 5 2 node demands nodeSep 10 Grid size for the graph nodes indices 1 2 3 Used in several graph layout methods 14 6 7 General Layout Options 163 14 7 RANDOM INSTANCE GENERATORS 14 7 Random Instance Generators Synopsis class goblinController 1 unsigned long Rand unsigned long TFloat UnsignedRand TFloat Si
258. rce TNode Target This class handles the reduction of bipartite matching problems to network flow problems ans is closely relates to the class of canonical flow networks which were introduced before Technically an artificial source node an artificial target node and some arcs are added to the network The arcs of the original bigraph are directed from one part of the bigraph to the other part The artificial nodes may be accessed by the respective methods Source and Target O Any flow on the logical graph object corresponds to a subgraph of the referenced bigraph and a zero flow corresponds to the empty subgraph If a perfect matching of the referenced bigraph exists any maximum flow of the logical object will give such a matching In that case a maximum flow of minimum cost corresponds to a minimum cost perfect matching It may be checked whether a logical flow maps to a perfect matching or not by a call to the method Perfect One may pass optional values by the displayed constructor methods Using the first method upper and lower degree bounds are defined which appear as capacity bounds of the artificial arcs Even if lower degree bounds are specified the big2fnw object is always in canonical form The second constructor method is used to solve a k factor problem If no parameters up to the bigraph are specified the node demand labels encapsulated in the bigraph come into play Example Gi new bigraph sample
259. re on Windows machines Similar to Linux distributions Cygwin can be downloaded from internet and installed online A setup program can be found at http www redhat com download cygwin html CHAPTER 2 INSTALLATION The first manual and non trivial step is to choose from a large set of mod ule packages In view of the later GOBLIN installation select the following packages e gmake e gcc and gpp including the libraries e TclTk for building the gosh shell e X11devel included by the Tcl Tk header e transfig ghostscript and netpbm only for the graphical export of images from GOBLET The setup will detect package dependencies and hence add a lot of further packages to your selection So far netpbm does not form part of the stan dard Cygwin installation and hence must be downloaded separately lt is not required to install a X server In a final installation step one has to extend the Windows system vari ables Provided that the Cygwin installation directory is c Ncygvin the Path system variable must be extended by a sequence c cygwin bin c cygwin usr X11R6 bin and an environment variable HOME c cygwin home should be added Now Windows is prepared to build the GOBLET graph browser Before compiling the gosh interpreter just set os cygwin in the Makefile Then start a bash shell and follow the description of the previous section Starting with Release 2 7 we will also distribute Cygwin binaries with each
260. recisely RestrType i is either RESTR_CANCELED or NON BASIC or RevIndex i NoVar is defined In the latter case the type is either BASIC LB or BASIC UB In a column oriented implementation the basis data can be manipulated as follows e The operation SetIndex i j tp results in RevIndex i j and Index j i The passed type tp has to be either LOWER or UPPER If previously Index k i then k must be matched elsewhere ideally with the former Index j It is not checked that the basis rows are linear independent after the operation e The operation Pivot i j tp has similar effects on the indices but requires that the entering row j is non basic Exception j i The indexed rows must be linearly independent afterwards e Switching between RestrType BASIC LB and BASIC UB is also achieved by SetRestrType Of course this applies to basis rows only The methods Index and SetIndex are also mandatory for row ori ented implementations Additionally the current column basis has to be determined by the method RowIndex and the row and column in dices have to be partially inverse If RowIndex i is a structural variable 177 16 1 PUBLIC INTERFACE Index RowIndex i i must hold Both indices are completed by artifi cial variables and variable range restrictions respectively Column oriented solver do not need to implement a RowIndex The primal and dual solutions which are associated with the current basis are ret
261. resolved at run time but by the C compiler In our example the template instance binaryHeap lt TArc TFloat gt can be already found by the linker in the library goblin a If no pre compiled code would be available one would include binheap cpp rather than binheap h to force the compiler to generate such code container may be dynamic where every member is represented by an individual struct object Otherwise the container is static and all members 72 CHAPTER 8 EXPLICIT DATA STRUCTURES are represented by arrays which are maintained during the entire lifetime of the container object The latter concept has some serious drawbacks e The member type TItem must be integral That is the members are indices rather than objects e No repetitions are allowed That is static containers are set objects rather than multisets e A maximum index must be passed to the constructor which determines the size of all arrays encapsulated into the set object Note that a static data structure is adequate in the example from above Even if inefficient static sets may be useful during the testing phase of an algorithm to detect unwanted repetitions and can be replaced by a dynamic structure in the final version For static containers one can check efficently if an item is missing IsMember Furthermore static containers may share memory with other containers However it must be clear that all these sets are disjoint Example static
262. right hand sides DISPLAY BOUNDS Write the variable range restrictions Free variables are not listed Non negative non positive and binary variables are grouped together The remaining variables are displayed by equations or inequalities with one or two right hand sides DISPLAY INTEGERS Write the list of integer variables DISPLAY FIXED Write the list of fixed variables DISPLAY PRIMAL Write the variable values Zero values are omitted DISPLAY DUAL Write the dual variable values associated with the structural and the range restrictions Lower and upper bound re strictions are grouped together Zero values are omitted especially those of unbounded restrictions DISPLAY SLACKS Write the primal slacks Lower and upper bounds are grouped together Unbounded restrictions and zero slacks are not listed DISPLAY BASIS Write the mapping from variables to basis restric tions DISPLAY TABLEAU Write the transposed tableau matrix where the ba sis column are omitted Zero matrix entries are not displayed DISPLAY INVERSE Write the transposed inverse of the basis matrix Zero matrix entries are not displayed If no display option or a zero value is specified the output is in CPLEX LP format This essentially consists of the first three listed sections All sections list variable and restriction labels rather than indices The tableau and basis inverse output is always formatted take care with large CHAPTER 16 LINEAR PROGRAMMIN
263. rithms Figure 6 9 A Digraph and its Split Graph 6 4 15 Subgraph induced by a Node or Arc Set Include file mixedGraph h Synopsis class inducedSubgraph public mixedGraph 1 inducedSubgraph abstractMixedGraph amp indexSet lt TNode gt amp 63 6 4 DERIVED PERSISTENT OBJECTS TOption OPT PARALLELS inducedSubgraph abstractMixedGraph amp indexSet lt TNode gt amp indexSet lt TArc gt amp TOption OPT_PARALLELS Other than the subgraphs which can be generated by a mixedGraph con structor and which map every node of the original graph this class handles subgraphs which are induced by a given node set This node set is passed as an index set see Chapter 9 for a description and may be further restricted by an arc index set More explicitly the graph inducedSubgraph G V A opt consists of all nodes in the index set V Only the original arcs in A are mapped namely iff both end nodes are in V If no arc set A is specified the resulting induced subgraph is as in the literature If the option OPT PARALLELS is specified or if the parameter opt is omit ted parallel arcs are allowed Otherwise some minimum length edge is mapped The other supported options are OPT NO LOOPS OPT SUB and OPT MAPPINGS with the already described semantics 6 4 16 Bigraph induced by two Node Colours Include file sparseBigraph h Synopsis class inducedBigraph 1 public biGraph inducedBigraph abstractMixedGraphk a
264. rob lem instances GOBLIN DIMACS TSPLIB solutions bitmaps GIF JPEG and canvasses Postscript EPS If a trace file is exported to a GOBLIN file the browser switches to the trace object as the current graph Compression PY Specify the shell commands used for file compression and decompression Save Settings Export the current configuration to the file goshrc which is read when the GOSH interpreter is started 20 1 Quit Ctrl q Quit GOBLET 4 2 Graph Editor Dialogs Menu Item Edit Option Shortcut Effect Section Constant Labels Ctrl C Dialog for constant node and arc labelings Metrics Choose edge length metrics Only for dense graphs Either explicit length labels are used during 11 1 3 optimization or length labels are computed with respect to the selected metrics GOBLIN supports Euclidian Manhattan coordinate maximum and spheric distances as specified in the TSPLIB Delete Solutions Ctrl4 X Computational results can be deleted This is important if algorithms support postoptimization but computation shall be started from scratch Extract Solutions Ctrl E Predecessor labels representing trees 1 matchings or cycles can be extracted from the subgraph labels 11 2 1 Node colourings representing bipartitions and edge cuts can be extracted from the distance labels 28 CHAPTER 4 THE GOBLET GRAPH BROWSER 43 EDITING GRAPHS MENU ITEM EDIT 4 3 Editing Graphs Menu Item Edit Option
265. roblem is NP hard for general mixed graphs but can be reduced to matching prob lems if the graph is either directed or undirected These easy cases are handled in GOBLIN Given a node set T of even cardinality a 7 join is a subgraph in which all nodes in T have odd degree and all other nodes have even degree The undirected CPP is a special case of the minimum 7 join problem which is actually solved in GOBLIN Note that the minimum 7 join problem has several further interesting special cases 1 matching shortest paths and optimization on the cycle space All methods require O n storage for the complete graph on which the respective matching problems are solved Hence the CPP solvers do not work for large scale problems say with n gt 10 nodes 13 15 1 T Joins The method ComputeTJoin requires non negative length labels and a set T which is specified by the node demand labels where a demand 1 denotes a member of T This procedure reduces the T join problem to 1 matching problem so that the running time is dominated by the matching solver used The methods MinCTJoin TNode TNode graph ChinesePostman and MinCTJoin can handle negative length labels These latter proce dures set the demand labels and then call ComputeTJoin which actually 136 CHAPTER 13 HIGH LEVEL ALGORITHMS determines the 7 join length ucap Figure 13 12 Graph Minimum Eulerian Supergraph 13 15 2 The Undirected CPP
266. roblems In that sense the GOBLIN file format keeps the file sizes small Some items merely keep place for future extensions of GOBLIN In what follows a term lt arc gt can be replaced either by a single arc index or by a list of arc indices with exact length x Corresponding terms are used for node indices booleans capacities and floating numbers 196 CHAPTER 18 PERSISTENCY CHAPTER 18 PERSISTENCY 18 4 1 Definition definition gt definition nodes nl n2 n3 arcs lt m number of arcs gt incidences incO arcs incident with node 0 gt inci arcs incident with node 1 inc lt n 1 gt lt arcs incident with node n 1 gt ucap lt capacity gt 1 lt capacity gt demand lt capacity gt directed lt boolean gt The definition part essentially describes the feasibility region of a network programming problem For concrete classes the following items can be omitted e For bipartite graphs the cardinality of both partitions is specified by the numbers n1 and n2 and the total number of nodes is n n1 4 n2 Otherwise the number of graph nodes is n nl The number denotes interpolation points which are needed for the graph layout sometimes In what follows some vectors have length n n n3 e Incidence lists are specified for sparse graphs only In dense graphs the incidences are determined by the arc indices implicitly
267. roposed Extension lt lt ecoa coe rero 9 114 Negative Cycles aoaaa ie RR o 114 13 21 Negative toycles 115 13 2 2 Minimum Mean Cycles 115 13 2 8 Proposed Extension 115 DAG Dearth P aa m 115 Enler Celes cus uae us 116 Spannum POR 0o OX TR ub Nom x 116 13 5 1 The Enhanced Prim Algorithm 117 13 5 2 The Kruskal Algorithm 118 13 5 3 Arbotestencss eec seen oye dog y oon 118 13 5 4 One Cycle Tres 118 13 5 5 Tres Parkinga 6 06 20004 uno a eee E Ge d 118 13 5 6 Proposed Extension 118 Connected Components 119 13 6 1 First Order Connectivity 119 13 6 2 Strong Connectivity 119 13 6 3 Second Order Connectivity 119 13 6 4 Open Ear Decomposition and st Numbering 119 n wr dis 120 13 7 1 The Method of Demoucron Malgrange and Pertuiset 120 13 7 2 Combinatorial Embedding 120 13 7 8 Outerplanar Embedding 121 13 7 4 Connectivity Augmentation 121 13 7 5 Canonically Ordered Partition 121 Maximum Flows and Circulations 122 13 8 1 The Augmentation Algorithm by Edmonds and Karp 123 13 8 2 The Capacity Scaling Algorithm 123 13 8 3 The Blocking Flow Algorithm
268. s configuration fie nonewline string Write string to goblin transscript 208 CHAPTER 20 THE GOSH INTERPRETER 20 3 1 Ressource Management size fallocs 20 8 ROOT COMMAND fragments Current number memory fragments objects Number of currently managed objects timers Number of managed timers 20 3 2 Thread Support The GOSH shell is all but thread safe and the thread support is intended for the GOBLET browser only The browser utilizes a master thread for the graphical interface and one slave thread for the computations Both threads interpreters share the GOBLIN controller and occasionally some graph objects The slave interpreter uses an alias for the graph object which can be traced by the master but should not be edited during computations listed messages start by goblin solver The master thread can try to terminate the slave thread by the command stop and wait for termination by testing goblin solver idle which returns false if the computation is still running Note that only some solver routines support this termination mechanism Eventually the solver thread returns some information before exiting by using the return and throw commands The information is received on master side by the command result Parameter Description Message Set return value of a thread Set return value of a thread and signal an error Acknowledge the return code of a thread Evaluate script in an own thread of execution O
269. s All messages which address the restriction 3 and the variable 7 of a mixed integer problem X start X row 3 and X column 7 223 20 16 LINEAR PROGRAMMING CHAPTER 20 THE GOSH INTERPRETER respectively You may also use the keywords restriction instead of row and the keyword variable instead of column This syntax applies to all messages listed in Table 20 16 4 and Table 20 16 5 All column indices range between 0 and 1 The row indices range between 0 and k 1 respectively k 1 1 depending on whether variable range restrictions are included Here and denote the effective dimensions returned by X restrictions and X variables respectively Whenever infinite labels are needed they are replaced by an asterisk Lower bounds cannot be set to 00 upper bounds are never oo which makes the procedure unique Example if X row i typel non basic set k X column j index catch X pivot i j upper puts X row i type would check if the ith row is in the current basis and occasionally try to exchange the current basis row k matched with variable j with i If the pivoting is successful that is if a basis structure can be maintained the output is upper 20 16 4 Row Based Messages Message cmi Hemd Hae ThersreHonlibe SSCS ups Lower right hand side bound The variable associated with the restriction
270. s ter context For example a display configuration is a volatile controller object and copied from the context of the object to be displayed This controller is modified with some class dependent display parameters before the object is actually mapped or written to file exp2tk E this dummy tk ConfigDisplay E Configuration E DisplayGraph Controller objects which are constructed by the default constructor are somewhat like clones of the global object goblinDefaultContext Other than for the subsequent controller instanciations the construc tion of goblinDefaultContext also generates a controller object hash table which allows to dereference all valid controller and data objects from their handle 14 2 Interaction with Data Objects Synopsis class goblinController x 147 LOGGING CHAPTER 14 THE OBJECT CONTROLLER public THandle InsertObject goblinData0bject void DeleteObject 1 goblinRootObject ObjectPointer THandle const goblinRoot bject Lookup THandle const class goblinDataObject public goblinRoot0bject 1 protected goblinController amp CT THandle amp H public goblinData0bject goblinController amp goblinDefaultContext goblinController amp Context THandle amp Handle Every constructor of GOBLIN data object subscribes to the controller ob ject which forms its context This is managed by the method InsertObject which returns a globa
271. s But even in the case of general planar graphs more appealing layouts can be achieved with this procedure Furthermore one can determine st numberings with both and viv on the exterior face of the refined embedding The procedure also applies if the input graph is disconnected It is only a wrapper around the call ExtractEmbedding PLANEXT GROW See section 6 2 5 for more details 13 7 PLANARITY 13 7 4 Connectivity Augmentation Most planar graph drawing algorithms require a certain level of connectivity of the input graph One can link the connected components of a planar em bedded graph arbitrarily without destroying the combinatorial embedding Even more if the connected components are linked tree like this gives a minimal connected planar supergraph in linear time The only advanced fea ture of the procedure PlaneConnectivityAugmentation is that it selects a maximal exterior face of each component This procedure is a wrapper around the call ExtractEmbedding PLANEXT_CONNECT and runs in linear time Things are more complicated with the biconnectivity and triconnectiv ity augmentation problems One can compute in polynomial time minimal biconnected and triconnected supergraphs but these are in general not planar The planar versions of these problems are NP hard GOBLIN includes a procedure PlaneBiconnectivityAugmentation which computes a probably not minimal planar biconnected supergraph in linear time The r
272. s Otherwise an Euler cycle is returned by the referenced array pred which must be allocated by the calling context as TArc MO The Euler cycle is decoded from the array as follows Example TArc pred new TArc MO if EulerCycle pred Handle exception TArc a pred 0 for TArc i 0 i lt M i 116 CHAPTER 13 HIGH LEVEL ALGORITHMS a pred a gt gt 1 Process the arc a If one calls EulerCycle without parameters the Euler cycle is translated to an edge numbering and saved to the edge colours Note that the procedure does not inspect the arc capacities If capaci ties are considered as multiplicities as in the Chinese postman solver the graph must be preprocessed with ExplicitParallels to eliminate the capacities Zero capacity arc must be eliminated manually Be aware of the problem size and the running time which grows linearly with the sum of multiplicities 13 5 Spanning Trees Synopsis class abstractMixedGraph enum TOptMSTMeth MST_DEFAULT 1 MST_PRIM 0 MST_PRIM2 1 MST_KRUSKAL 2 MST_EDMONDS 3 enum TOptMSTChar 1 MST PLAIN 0 MST ONE CYCLE 1 MST REDUCED 8 MST MAX 16 CHAPTER 13 HIGH LEVEL ALGORITHMS I TFloat MinTree TNode NoNode TFloat MinTree TOptMSTMeth TOptMSTChar TNode NoNode TFloat MST_Prim TOptMSTMeth TOptMSTChar TNode NoNode TFloat MST Edmonds TOptMSTChar TNode NoNode TFloat MST Kruskal TOptMSTCh
273. s and b flows All algorithms are accessed by the respective entry methods MinCostSTFlow and MinCostBFlow An st flow is a pseudoflow such that all nodes are balanced up to a fixed pair s t of nodes and the imbalance at node f is called the value of this flow An extreme or v optimal st flow is an st flow which is optimal among all st flows with the same value v When calling the first solver MinCostSTFlow s t a series of v optimal st flows is computed and the flow value v is strictly increasing This process halts if either a maximum flow has been determined or if the sink node t becomes balanced This scheme is usually known as the short est augmenting path SAP algorithm referring to the fact that every intermediary extreme flow differs from its predecessor by a shortest aug menting path 13 10 MINIMUM COST FLOWS It is required that the input flow is also an extreme st flow In many situations one can call the solver with the zero flow which is 0 optimal if the length labels are non negative The zero flow is admissible also for negative edge lengths if the digraph is acyclic If node potentials are not already present the solver is smart enough to compute a compatible dual solution before starting with augmentations The second solver MinCostBFlow determines b flows in which all node imbalances match the given node demand vector b of minimum costs This includes the special case of circulations where the node
274. s these nodes can be manipulated by the methods SetSourceNode SetTargetNode SetRootNode respectively 5 2 2 Arcs Graph arcs are distinguished by their indices which are integers of a spe cial type TArc The sequence of arc indices is 0 1 2 m 1 wherem is a protected instance variable of every graph object In addition to the arcs of a graph a constant NoArc is defined for the management of undefined arc references This constant appears in GOBLIN files and in GOBLET as an asterisk With every arc the reverse arc also exists Both arcs have indices which differ in the least significant bit Forward arcs have even indices back ward arcs have odd indices This is arranged such that a reverse arc is computed by the operation a2 a1 1 Note that labels are assigned to forward arcs only In balanced flow networks arcs are arranged in complementary pairs Complementary arcs differ by the second least significant bit that is a com plementary arc is computed by the operation a2 a1 2 Note that flow values are assigned to single arcs but capacity labels and length labels are assigned to complementary arc pairs 5 2 3 Capacities Capacity labels and node demands are held in numbers of a type TCap This may either be an integral type or a floating point type We do not strictly exclude the possibility of non integral capacities But note that matching solvers require integral values 40 CHAPTER 5 PRELIMINARY STATEMEN
275. s an input parameter and check if the graph actually is k connected If k is small one of the basic methods described TCap Connectivity O in Section 13 6 is used For strong edge connectivity of higher order the TCap EdgeConnectivity connected components are determined by computing minimum cuts on the virtual TCap StrongConnectivity subgraph induced by a single colour and splitting the node set with respect virtual TCap StrongEdgeConnectivity to this cut This requires the solution of O n max flow problems For vertex connectivity of higher order merely the method Connectivity re virtual TFloat StrongEdgeConnectivity TNode spectively StrongConnectivity are called since connected components virtual TFloat StrongEdgeConnectivity TNode TNode are immaterial here The methods of the second series compute a minimum cut and return TCap MinCutLegal0rdering TNode TNode amp TNode amp the cut capacity The cut is returned by the node colours where the colours TCap MinCutNodeIdentification of edge cuts are 0 1 and cut edge are directed from colour 1 to colour 0 class abstractDiGraph x TCap MinCutHaoOrlin TNode Node cuts are coloured 0 and directed from the nodes with colour 1 to the nodes with colour 2 The vertex connectivity number is the minimum number of nodes which must be removed from the graph so that some nodes become disconnected Correspondingly the edge connectivity number is the minimum numbe
276. s and Data Structures 91 12 4 Force Directed Placement 2522 92 o o 4 40005 105 11 1 Graph Definition NC T ERR IR ERE 91 12 5 Planar Straight Line Drawing eco cso o ee n 106 11 1 1 Incidences Adjacencies 91 12 6 Orthogonal Drawing 107 11 1 2 Arc Capacities and Node Demands 92 12 7 Equilateral Drawing 2 2 109 11 1 3 Length Labels 2 2 222 m km 92 11 1 4 Geometric Embedding 93 13 High Level Algorithms 111 LEO 2393203 ees Hotes ok uL RUE d 93 13 1 Shortest Pathe 2 22229 mm m 9 RE b SRE es 111 1118 Are Orientations iuum SE 3oe ow 93 13 1 1 Eligible oc ecca Ge RE SE EE 112 11 2 Potential Solutions 5225222231 94 13 1 2 Rober Interiat eu num ok ek Ea a m Re es 112 11 2 1 Predecessor Labels 94 18 1 8 Breadth First Search co s 646 2 ee ves 113 1123 2 lE we he eR ee a ee 95 13 1 4 The Dijkstra Algorithm 113 112 3 Flow Labels oe og RR 95 13 1 5 Discrete Voronoi Regions 113 11 2 4 Node Degrees 96 13 1 6 The Bellman Ford Algorithm 113 11 2 5 Distance 96 13 1 7 The FIFO Label Correcting Algorithm 113 13 2 13 3 13 4 13 5 13 6 13 7 13 8 13 L8 The 7 Join Algorithm c e 22m ws 114 13 1 9 The Floyd Warshall Algorithm 114 13 1 10 P
277. s can be active at a time the child times do not sum up to the parent timer value CHAPTER 17 RESSOURCE MANAGEMENT if no or a NULL pointer is passed to the constructor method a basic timer is instanciated Such timers do not keep track of nested timer starts and stops given timer is basic if FullInfo returns false 17 2 2 Global Timers Include files globals h goblinController h Synopsis enum TTimer NoTimer struct TTimerStruct char timerName bool fullFeatured F3 const TTimerStruct listOfTimers class goblinController 1 pGoblinTimer globalTimer F There is a list of global timers declared by the enum index type TTimer and the global array listOfTimers From this structural information ev ery controller object instanciates its own timer table This table can be addressed by the pointer globalTimer and the enum index values Global timers are intended to split the code into functional units whereas the source code modules discussed later represent special authorship Sev eral modules may share a global timer Some basic global timers are utilized explicitly by the high level data structures and the file interface whereas the other global timers are de activated by OpenFold and CloseFold operations implicitly 17 2 TIMERS If the context flag logTimers is set every CloseFold operation files the complete timer status including child times Zero timer values are not displayed 17 2
278. sjoint intervals in both subproblems To the new problems we refer as the left and the right successor The parent node is not needed any longer The methods DirectionConstructive and DirectionExhaustive tell the branch scheme which of the two new subproblems is inspected first A return value RAISE_FIRST causes that the left subproblem is inspected first Note that DirectionConstructive is called before the first feasible solution for the original problem is found and DirectionExhaustive is called afterwards Then the branch scheme evaluates the left and the right subproblem using the following methods e SolveRelaxation actually computes the objective value for the re laxed subproblem while Objective retrieves the cached objective value when possible The objective value is compared with the class constant Infeasibility in order to detect infeasible relaxed sub problems It is not allowed that SolveRelaxation operates on the original graph or LP data structures since these are needed to save the best solution found so far e ObjectSense isa class constant and specifies either a maximization or minimization problem e Unfixed returns the number of variables for which the lower and the upper bound still differ subproblem with Unfixed 0 must be either feasible for the original problem or infeasible for the relax CHAPTER 10 BRANCH AND BOUND GENERIC ALGORITHM ation For all other subproblems let SelectVariabl
279. slacks of the existing restrictions although the solution may become primally infea sible and the indices must be recomputed It shall not possible to delete a row in the current basis The deletion of a variable must mark the matched basis row non basic 178 CHAPTER 16 LINEAR PROGRAMMING SUPPORT CHAPTER 16 LINEAR PROGRAMMING SUPPORT 16 1 PUBLIC INTERFACE 16 1 5 Problem Transformations transformations preserve the optimum objective value Generally the new variable row names can clash with original names Include file ilpWrapper h To be safe the original names should consist of a letter followed by digits Synopsis For example you can use the internal naming scheme class goblinILPWrapper 1 goblinILPWrapper 1 goblinILPWrapper DualForm goblinILPWrapper StandardForm goblinILPWrapper CanonicalForm F The LP interface supports the well known transformations of linear pro grams All methods do not modify the addressed object but return a new LP instance of the requested form e If the original LP instance is a standard or canonical form the DualForm flips the role of rows and variables but does not intro duce new items Generally lower and upper bounds are replaced by two variables or two rows and the object sense is reverted e The CanonicalForm replaces all variable range restrictions by struc tural restrictions and all equality restrictions by a pair of inequalities Computing th
280. some arc with end nodes u and v then RedLength a is defined as Length a Pi u Pi v in undirected graphs and as Length a Pi u Pi v in directed graphs Shortest path problems and weighted network flow problems are solved optimally if and only if all re duced length labels are non negative There are two further methods ModLength and RModLength which ex tend the concept of reduced cost optimality to balanced network flow and matching problems Since the computation of modified length labels is ex pensive RModLength allows the recursive computation whereas ModLength utilizes an explicit data structure 11 2 7 Node Colours Synopsis class abstractMixedGraph 1 protected TNode colour 98 CHAPTER 11 PROTOTYPES AND DATA STRUCTURES public void InitColours TNode NoNode virtual TNode Colour TNode void SetColour TNode TNode void ReleaseColours void WriteColours goblinExport void ReadColours goblinImport void UpdateColours void ExtractCut void ExtractBipartition void ExtractColours Node colours are not only used to store graph colourings but can also repre sent cuts and connected components with a minimum of computer storage For example the matching procedures return the blossom structure as node colours More explicitly the gra2bal destructor assigns to each node the blossom base as its colour ExtractCut assigns colour zero to all nodes with finite distance labels and
281. structured object and the next operation must be another call to StartTuple Otherwise the tuple represents a vector or a constant If the type k is one the entire vector is written to a single line Finally if k gt 1 the entries are written in batches of k numbers The third optional parameter denotes the maximum length of an entry if written to file This parameter is needed for formatting the output only A call MakeItem lt T gt x 1 writes a value x of type T into a field of width l In case of floats one can use the context method SetExternalPrecision to control the formatting Finally MakeNoItem 1 writes an asterisk which represents undefined values All items are aligned to the right hand side 18 2 Import of General Data Objects Include file fileImport h Synopsis enum TBaseType 1 TYPE NODE INDEX TYPE ARC INDEX 193 TYPE FLOAT VALUE IMPORT TYPE CAP VALUE TYPE INDEX TYPE ORIENTATION TYPE INT TYPE_BOOL enum TArrayDim DIM GRAPH NODES DIM GRAPH ARCS DIM ARCS TWICE DIM ALL NODES DIM LAYOUT NODES DIM SINGLETON 194 F class goblinImport 1 goblinImport char goblinController amp char bool bool bool bool TNodex TFloat TIndex char bool goblinDefaultContext Scan char NULL Seek char Head TailO EofO GetTNodeTuple unsigned long GetTArcTuple unsigned long GetTCapTuple unsigned long GetTFloat
282. t 4 3 10 11 5 4 Component 5 2 Generating forward DFS tree Component 6 Generating forward DFS tree Component 7 B8raph has 8 strongly connected components Halting GOSH interpreter Total execution time 0 seconds a_i 2 M trace file 6 of 11 fo seconds Figure 3 2 GOBLET Browser Suppose you want to make the graph strongly connected You can add some arcs by selecting Edit gt Insert Arcs For example click with the left mouse button on the node 23 place some interpolation nodes and then click on the node 20 Finally you are asked to specify the placement of arc labels click with the left button again which is immaterial in this example CHAPTER 3 GETTING STARTED These manipulations result in a new graph arc 23 20 You may run the computation with Control c again and observe that the number of strong components effectively reduces Try and find out how many arcs must be added to the original graph to make it strongly connected GOBLET strong4 modified File Edit Compose Layout Optimize Browser align label L align label Figure 3 3 GOBLET Editor We do not give a complete description of the GOBLET editor tool here The status line helps you stepping through the chosen editor function The most GOBLET menus and dialogs are intuitive and this document describes the various components of the GOBLIN library rather than the tool GOBLET Note that GOBLET may handle graph ob
283. t apply All produced drawings are 2 dimensional This is frequently used for inline drawing when graph objects are derived from others 12 1 1 Layout Models Include file globals h abstractMixedGraph h Synopsis enum TLayoutModel 1 PRELIMINARY REMARKS LAYOUT DEFAULT 1 LAYOUT FREESTYLE POLYGONES 0 LAYOUT FREESTYLE CURVES 1 LAYOUT ORTHO SMALL 2 LAYOUT ORTHO BIG 3 LAYOUT VISIBILITY 4 LAYOUT KANDINSKI 5 LAYOUT STRAIGHT 2DIM 6 LAYOUT LAYERED 7 LAYOUT NONE 8 Hh class goblinController i void SetDisplayParameters TLayoutModel class abstractMixedGraph 1 void Layout ConvertModel TLayoutModel J Layout models denote general drawing styles with precise properties al lowing to improve given drawings and to convert to other laout models All drawing methods activate the appropriate layout model by calling Layout ConvertModel and recursively SetDisplayParameters The latter procedure effectively overwrites the various display param eters listed in Section 14 6 with layout model dependent default values One can customize the display style by setting some of the context pa rameters Note that custom values are overwritten with the next call to SetLayoutParameters In addition Layout ConvertModel model has the capability to adjust the current drawing If the target layout model is LAYOUT STRAIGHT 2DIM 103 CIRCULAR LAYOUT all bends and shape nodes are e
284. t manages the interaction of two threads of execution namely a problem solver and a user interface It implements methods to browse and edit the logging information provides the possibility to inter rupt the solver from the user interface and it keeps control of the trace files Internally the messenger is thread safe that is its data structures are locked by so called semaphores to prevent different threads from accessing the data at the same time The solver thread takes semaphores for a short period only but the user interface may block the solver in order to read some volatile information and to make online changes The GOBLIN core library does not utilise semaphores at all But for the GOSH shell the function pointers solverStopSignalHandler logEventHandler and traceEventHandler essentially refer to messenger methods Hence editing a graph which is subject to some computation can but does not necessarily corrupt the object and the solver process THE MESSENGER 167 SOLVER MANAGEMENT CHAPTER 15 THE MESSENGER 15 1 Problem Solver Management Include file messenger h Synopsis class goblinMessenger bool SolverRunning bool SolverIdle void SolverSignalPending void SolverSignalStarted void SolverSignalStop void SolverSignalIdle The first goal of task communication is to force a solver to stop the opti mization with a suboptimal solution The complete schedule is as follows e The us
285. t values 18 4 6 Configuration configuration gt configure lt context parameter gt lt integer gt This part may keep any kind of context parameters logging method se lection as well as layout information When a graph object is imported from file the method goblinImport ReadConfiguration is called and the information from file overwrites the respective context variables The method goblinExport WriteConfiguration goblinController amp TConfig CONF_DIFF 200 CHAPTER 18 PERSISTENCY allows to write the configuration of the specified controller object to file If the optional parameter is CONF_DIFF the values of the configuration pa rameters are compared with the default context and only differing values are written to the output file Alternatively CONF_FULL can be specified to write a complete set of parameters During graph export the method goblinExport WriteConfiguration goblinData0bject is used which calls the graph method ConfigDisplay O and then writes the resulting configuration 18 5 File Format for Linear Programs The native file format for linear programs and mixed integer problems con sists of a GOBLIN specific header followed by the problem definition and some basis lt mip object gt mixed_integer rows lt integer gt columns lt integer gt size lt integer gt pivot lt integer gt lt integer gt 0 1 D rowvis lt boolean gt
286. ta objects we give some general re marks about GOBLIN files classes and methods which are omitted later in this document e If not stated otherwise any operation is elementary that is it takes only a constant number of computing steps Sometimes oper ations take constant time in practice but an exact statement about their theoretical complexity is beyond the scope of this document and therefore omitted e If not stated otherwise the amount of computer storage required by any algorithm is proportional to the number of arcs or less e GOBLIN source code file contains the definition of a single class and the file name ends with cpp This class is declared in the header file whose name only differs by the extention h As an exception a class definition may include a method of another class if this method instanciates the former class so that an external definition would only complicate the dependencies among the source CONVENTIONS code files For example the TSP branch and bound method is de fined in branchSymmTSP cpp which implements the branch node data structure e Iterators are declared with their graphs but defined in a separate file whose name differs from the graph definition file name by a leading i e Every section starts with a listing of the declaration of the methods which are discussed The header file where these methods are declared is listed likewise e If not stated otherwise all listed methods are
287. takes the colours of the two specified nodes and flips the colours in the Kempe component of the first node If both nodes are in in the same Kempe component 0 is returned and 1 otherwise Such an exchange operation needs O m time 13 18 Stable Sets and Cliques Synopsis class abstractMixedGraph i void StableSet void Clique STABLE SETS AND CLIQUES void VertexCover stable set is a set of pairwise non ajacent nodes whereas a clique con sists of pairwise adjacent nodes and a vertex cover is a node set which contains at least one end node of every egde The three listed methods return the maximum cardinality of a respective node set The set itself consists of the nodes with colour 1 methods call the branch and bound solver for the stable set problem described in Section 10 3 1 and use heuristic graph colouring Our experi ments have turned out that one can compute cliques in graphs with 150 200 nodes depending on the graph density and on the quality of the heuristic colouring SS Q Figure 13 16 A Maximum Stable Set of Queens on a Chessboard 141 DISCRETE STEINER TREES 13 19 Discrete Steiner Trees Synopsis class abstractMixedGraph 1 TFloat SteinerTree TNode TFloat SteinerTrimLeaves TArc virtual TFloat SteinerHeuristics TNode virtual TFloat SteinerEnumerate TNode class abstractGraph 1 TFloat SteinerHeuristics TNode No
288. tal and the default values achieve the most stable code This Makefile conf has been set up to run on a SuSE linux machine with default parameters Cygwin and Aix are explicitly supported that is editing the platform specifier os in should be sufficient Generally before applying the Makefile you have to edit some further lines in it You may specify your compiler CC and CXX the linker LD the compression tool zip and the linkage names of the Tcl Tk libraries libtcl and libtk which are installed on your machine Probably you need to change only some of of the 16 CHAPTER 2 INSTALLATION defaults If no Tcl Tk libraries are available you may build the GOBLIN library but not the the GOSH interpreter and the shared objects The file configuration h contains some pragmas which may help to improve the performance and or stability of the final C code Probably it is not worth reading the following lines unless you encounter respective problems First at all in this file the index types TNode TArc are declared implic itly You can choose from three different scalings by uncommenting one of the rows define SMALL NODES define BIG ARCS define BIG NODES The scaling which is adequate for your purposes depends on the kind of problems you want to solve large scale but solvable in a few minutes spanning tree problem may have several 10000s of nodes and hence requires the _BIG_NODES_ pragma On the other hand weighte
289. tate clockwise This construction is well defined for every planar graph topologic em bedding is provided for the resulting graph As an example if G is a tetrahedron facetSeparation G facetSeparation will produce an icosahedron 6 4 5 Complementary Graph Include file sparseGraph h Synopsis class complementaryGraph public graph complementaryGraph abstractMixedGraph amp TOption The complementary graph is defined on the same node set as the origi nal graph and two nodes are adjacent if and only if they are non adjacent in the original graph Complementary graphs are used to switch between stable set and clique problems Note that the complement of a graph with many nodes but few edges requires a lot of computer storage 60 CHAPTER 6 GRAPH OBJECTS 6 4 6 Dual Graphs Include file sparseGraph h Synopsis class dualGraph public graph dualGraph abstractMixedGraph amp TOption 0 class directedDual public diGraph directedDual abstractMixedGraph amp TOption 0 ROT_LEFT To generate a dual graph the input graph must be planar and already pro vide a combinatorial embedding A geometric embedding is not required The nodes of the new graph are the regions of the original graph and the arcs map one to one Nodes are adjacent if and only if the regions share an arc in the original graph Dualization preserves the combinatorial embedding In particular the dual of a dual gr
290. tation opt grid the input graph is augmented to a 2 connected planar graph Then a bipolar orien tation and a directed dual graph are generated For both the primal and the dual digraph the distance labels with respect to the source nodes are computed The primal distances give assigment of rows to the nodes in the drawing and the dual distances determine the columns for the drawing of arcs T he method option applies as follows e Using opt ORTHO VISIBILITY RAW the drawing is as usually de scribed in the literature That is the node width may exceed the size required by the vertical edge segments e Using opt ORTHO VISIBILITY TRIM the nodes are shrunk in a way that edges are still drawn vertically without bends e Using opt ORTHO VISIBILITY GIOTTO the node widths are mini mized and every edge is drawn with at most two bends If the input graph is 2 connected and all nodes have degree 2 or 3 the final drawing is in the small node model Otherwise a GIOTTO drawing results CHAPTER 12 GRAPH DRAWING In any circumstances the input graph must be without loops The running time is O n and the achieved grid size is 2n 5 n 1 in the worst case 12 7 Equilateral Drawing Include file abstractMixedGraph h Synopsis class abstractMixedGraph 1 void Layout Equilateral int 0 This method requires an outerplanar 2 connected graph All faces other than the exterior region are drawn as equilateral polygones
291. tegy is as follows Initially all nodes are active Nodes become inactive if they are coloured or dominated by the current partial colouring Here a node v is called dominated if every consistent extension of the current colouring to the active nodes can be extended to v consistently Some nodes can be marked dominated a priori For example if the graph is planar and k gt 6 then all nodes are marked dominated The constructor for the master problem checks if the node colour data structure of the original graph provides a clique In the positive case the clique nodes are coloured 0 1 2 immediately Otherwise a maximum degree node is coloured with colour 0 and one of its neighbours is coloured with colour 1 10 3 IMPLEMENTATIONS Here SelectVariable determines the minimum available colour c and returns an active node which can be coloured with c A call Lower will fix this colour and Raise u will forbid this colour for The former method calls SetColour u c which actually fixes the colour of u and checks for every active neighbour of u if the number of conflicts falls below k In that situation Reduce u is called which marks the node as dominated The method SolveRelaxation returns number of colours which are used in this subproblem or detects infeasibility If there are nodes for which only one colour is available then SetColour to fix these node colours If there are no active nodes left the dominated nodes ar
292. the min imum spanning arborescence method Beside the inherited functionality it allows to split a set S into the subsets which previously were merged into S Actually there is a lot of new functionality associated with the class shrinkingFamily We first mention that a constructor call shrinkingFamily k 1l specifies two dimensions and l The constructed shrinking family has k l elements where the indices 0 1 k 1 represent real items whereas the indices 1 1 1 represent sets called virtual items Find v operation runs in O log n time in the worst case The oper ations Block w and UnBlock w split and then shrink a virtual item again They are needed for the construction of augmenting paths in the primal dual method for weighted matching problems The calls to Block w and UnBlock w take O n log n time alltogether for one augmenting path com putation 8 3 Hash Tables Include file hashTable h Synopsis template class TItem class TKey class goblinHashTable public goblinData0bject 1 goblinHashTable TItem TItem TKey goblinController amp TKey Key TItem HASH TABLES void ChangeKey TItem TKey A hash table is a data structure which allows to store a sparse vector or matrix say of length r in an array whose dimension is proportional to the maximal number of non zero entries Actually the size of the hash table is not but some number s gt The definition of
293. thod MicaliVazirani is the fastest cardinality matching algorithm both in practice and theory achieving the complexity bound O nm The general problem of maximum balanced network flows is solved in O n m time In fact the GOBLIN implementation is not the original Micali Vazirani algorithm but a careful extension to balanced network flows It is the most involved of the maximum balanced flow solvers and implemented by its own class see Section 6 3 5 for the details 13 12 4 The Cycle Canceling Algorithm The method Anstee computes an ordinary maximum st flow which is sym metrized afterwards resulting in a balanced flow which is half integral but not integral T he non integral flow values are deleted successively by calling the methods CancelEven and Cancel0dd The latter method may decrease the flow value and perform some balanced augmentation steps which con clude the computation Note that the generic method MaxFlow is used which allows to select from all implemented max flow algorithms On the other hand 10 calls the procedure BNSKocayStone directly which is needed to perform the balanced augmentations Hence the complexity of the Anstee algorithm is dominated by the max flow algorithm used If one uses the push and relabel algorithm this yield the best complexity bound namely O mn but the Dinic algorithm performs much better for explicit matching problems In our experience CHAPTER 13 HIGH LEVEL ALGORITHMS
294. tial It is set by constructors and by ResetBasis operations It indicates the basis consisting of the lower variable bounds The flag is cleared by every SetIndex operation e The flag baseValid indicates if a basis inverse matrix exists and if it is up to date with the basis indices and the coefficient matrix It is set by DefaultBasisInverse EvaluateBasis and BasisUpdate The flag is cleared initially and by ResetBasis SetIndex and SetCoeff operations e The flag dataValid indicates if the basic solutions are up to date with the problem definiton and the basis inverse matrix It set by calls to DefaultBasisInverse and SolutionUpdate and cleared when ever the problem is modified or the basis indices change The method EvaluateBasis computes the basis inverse matrix and a pair of basis solutions from scratch This operation takes O I time and is used only if optimization is started from a given basis without knowing the initial basis inverse especially if SetIndex has been called explicitly A Pivot operation also calls SetIndex but then updates the basis inverse by a subsequent call to BasisUpdate The update of the basic solutions is delayed until values are actually requested CHAPTER 16 LINEAR PROGRAMMING SUPPORT 16 3 GLPK Wrapper Include file glpkWrapper h Synopsis class goblinGLPKWrapper There are some conceptual differences between GLPK and the GOBLIN native code e In GLPK cost co
295. tial bound is very close to the optimum Best first steps are performed unless the number of CHAPTER 10 BRANCH AND BOUND active branch nodes is getting close to naxBBNodes 100 in that case DFS steps are performed e SEARCH FEASIBLE The search strategy is the same as in the SEARCH CONSTRUCT case but the solver stops when the first feasible solution has been found If the number of active nodes exeeds maxBBNodes 100 or if the total number nlIterations of solved subproblems exeeds maxBBIterations 1000 then the solver halts in any case The current state of computation is given by SearchState Espe cially for SolveRelaxation codes it can be useful to retrieve this search level and to apply dual bounding procedure which is worse but faster to compute in the inital DFS phase The transitions between the search states depend the branchNode depth parameter which is copied once from the root node to the branch scheme object It basically denotes an estimation the depth of the branch tree This may be the maximum number of non zero problem variables for example If this depth is underestimated the solver may halt prematurely by reaching the configured maximal number of active branch nodes or the constructive DFS search is interrupted before any leaves of the branch tree have been considered If the depth is overrated no best first steps can take place By default the depth is the number of problem variables Iteration O
296. tion of assignment 6 1 ABSTRACT CLASSES problems to network flow problems also defines these assignment methods The remaining methods are defined in absbig cpp including specialized methods for colouring and stable sets 6 1 5 Balanced Flow Networks Include file abstractBalancedDigraph h Abstract balanced flow networks inherit from digraphs but have a certain symmetry based on the complementarity of nodes and arcs The additional functionality is e Pairwise push operations BalPush TArc TFloat symmetrical residual capacities BalCap TArc e Symmetrical path capacities FindBalCap TNode TNode pairwise augmentation BalAugment TNode TNode TFloat e Balanced network search methods which constitute the balanced aug mentation algorithm Kocay Stone Kameda Munro and other heuris tics e Maximum balanced flow algorithms which essentially solve non weighted matching problems Anstee Micali Vazirani augmentation capacity scaling e Min Cost balanced flow algorithms which essentially solve weighted matching problems Primal dual primal dual starting with min cost flow optimum The new functionality is needed if one is interested in integral symmetric flows only But this is the case for the reduction of matching problems which is implemented by the class gra2bal All class methods are defined in the file absbal cpp except for the meth ods abstractBalancedFNW MicaliVazirani TNode abstractBalanced
297. tions may arise e The T join is a simple st path Then this path is a shortest st path and is returned by the predecessor labels 114 CHAPTER 13 HIGH LEVEL ALGORITHMS e There is no 7 join Then also no st path exists e The 7 join splits into a simple st path plus some more connected com ponents Then this st path is returned by the predecessor labels but this is not necessarily a shortest path e In the 7 join s and t are in common non trivial component From this component an arbitrary st path is extracted That is the method can deal with negative length arcs at least if there are no negative length cycles When it is not possible to compute an exact solution for the shortest path problem from the optimal 7 at least a heuristic solution is returned The method consists of O n calls of the Dijkstra method and the solu tion of a weighted 1 matching problem with at most n nodes the problem size depends on the number negative length edges This matching problem dominates the running times 13 1 9 The Floyd Warshall Algorithm This method determines the distances between every pair of nodes in O n time It is encoded into the constructor of the class distanceGraph and by that generates a complete digraph which has the original node distances as its length labels 13 1 10 Proposed Extension A dequeue label correcting algorithm 13 2 Negative Cycles Synopsis class abstractMixedGraph CH
298. to dense implementations e OPT_SUB Export the subgraph labels into a separate object That is the capacity of a mapped arc is the subgraph label of the original arc The graph and the denseGraph copy constructors accept arbitrary mixed graphs and just forget about the orientations The directed classed also 58 CHAPTER 6 GRAPH OBJECTS accept mixed graphs and in principle generate antiparallel arc pairs for undirected arcs in the original graph But be careful with the constructor method digraph G opt If the input graph is bipartite and OPT_CLONE is absent the arcs are just oriented from one partition the end node with smaller index to the other 6 4 2 Mapping Back Derived Graph Objects Synopsis class abstractMixedGraph TNode OriginalNode TNode TArc OriginalArc TArc void ReleaseNodeMapping void ReleaseArcMapping When generating graph objects from others it is sometimes useful to maintain the mappings of nodes and arcs from the derived to the origi nal graph In principle this information can be accessed by the methods OriginalNode and OriginalArc However these mappings must be generated explicitly by the construc tor option OPT MAPPINGS and only few classes implement this option yet now Even more the mappings are invalidated by every node or arc dele tion operation If there is no predecessor in the original graph or if no mappings are available NoNode NoArc is returned 6 4 3 L
299. ts and DeleteArc TArc which eventually deletes the canceled arc from all data structures Note that the latter operation may change the index of other arcs and hence must be applied very carefully A call to DeleteArcs eliminates all canceled arcs This operation should not be used in algo rithms intermediately but rather as a concluding step Similarly a call to CancelNode TNode cancels all arcs incident with this node and DeleteNodes eliminates all canceled and isolated nodes The methods DeleteNode TNode and DeleteNodes potentially change all node and arc indices Calling ReleaseBendNodes a eliminates the alignment point for the arc label and all bend nodes assigned with a Similarly ReleaseShapeNodes v deletes all artifical nodes assigned with the vertex v The method ReleaseDoubleBendNodes checks for pairs of consecutive bend nodes with the same position in a drawing and occasionally deletes some bend nodes This check includes the end nodes of all edges The method ContractArc TArc merges the incidence list of the end node into the incidence list of the start node of the given arc and cancels the arc and the end node If the incidence lists provide a planar embedding the contraction preserves planarity More generally IdentifyNodes x y merges the incidence list of the node y into the incidence list of the node x and cancels node y The nodes to be identified may be non adjacent The method ExplicitParallels splits th
300. tv170 2755 2682 2932 cap9 50000 1000000 10000 12273727410 389s ftv170 2755 2707 2932 transp 10028 200000 9997 258178684 9s ftv170 2755 2707 2780 10000 transp2 20000 200000 10000 147794030 165 ftv170 2755 2707 2772 10000 transp3 30000 200000 10000 93015638 245 ftv170 2755 2707 2755 10000 transp4 40002 200000 10000 75304321 37s transp5 20049 200000 10000 176263777 225 transp6 40002 200000 10000 124416104 845 transp7 40025 200000 10000 96121936 34s transp8 50055 200000 10000 92366438 51s 22 3 Min Cost Flow transp9 10000 200000 10000 158058350 6s transp10 19969 200000 10000 94008769 135 transpii 10020 200000 999 7 220335437 9s transp12 20000 200000 10000 126443694 158 transp13 30000 200000 10000 110331273 258 transp14 40000 200000 10000 85534936 285 All computations were performed with the GOBLET graph browser 2 5 1 on an Athlon XP 1800 PC with 256 MB RAM and SuSE Linux 7 3 The test sets are NETGEN problems taken from http elib zib de pub Packages mp testdata mincost netg index html The tested methods are the cost scaling algorithm CS methMinCCirc 1 and the network simplex method NW methMinCCirc 5 The columns for the respective solution times with gcc optimization level 05 and the pragmas _LOGGING_ and _FAILSAVE_ unset 236 CHAPTER 22 COMPUTATIONAL RESULTS Instance Nds Arcs stndrdt stndrd2 stndrd3 stndrd4 stndrd5 stndrd6 stndrd7 stndrd8 stndrd9 stndrdi10 stndrdi6 stndrd17 stndrd18
301. ubgraph structure Based on these prototypes abstractMixedGraph im plements methods to extract trees paths cycles and 1 matchings from a subgraph data structure On the other hand one may think that adjacencies which are imple mented in abstractMixedGraph constitute a graph defining data structure But note that graph defintions are based on incidence lists and that node adjacencies are defined explicitly just to speed up algorithms If the context flag methAdjacency is enabled the first call to Adjacency generates a hash table for efficient access to node adjacencies That is this first call requires O m computing steps but the other calls can be considered elementary operations This data structure is not useful for dense implementations where the index of an adjacent arc can be computed directly from the node indices Hence Adjacency is overloaded in some classes public access description adj Adjacency TNode TNode Arcs connecting two nodes d Dist TNode nHeap P Pred TNode Distance labels Heap in cache Path predecessor labels Node partitions Node colours Node potentials Node degrees in a subgraph partition Find TNode colour Colour TNode pi Pi TNode sDeg Deg TNode 44 CHAPTER 6 GRAPH OBJECTS Table 6 1 Implicit Data Structures Incidence lists are managed by iterator objects which allow to iterate on the node incidences The class abstractMixedGraph declares prototype methods First TNode
302. ubproblems by putting disjoint bounds on one of the problem variables For these new branch nodes a re laxation is solved which either yields the optimal objective or an infeasibility proof for the relaxed subproblem Newly generated branch nodes which admit feasible solutions for the relaxed subproblem and objective values not exeeding the best known ob jective of a feasible solution for the original problem are added to the list of active branch nodes Sometimes the optimal solution of a relaxed subproblem is feasible for the original problem and improves the best known solution Then the new solution is saved after some post optimzation steps and the new bound decreases the number of active subproblems Implementing a branch and bound solver means implementing a class for the branch nodes which occur From this class the root nodes are explicitly instanciated and passed to the branchScheme constructor which internally performs the branching operations That is the branch nodes keep the problem dependent information and the branch scheme models the problem independent data and methods 10 1 Branch Nodes Include file branchScheme h Synopsis 8l 10 1 BRANCH NODES template class TIndex class TObj gt class branchNode public goblinDataObject 1 branchNode TIndex goblinController amp branchScheme lt TIndex TObj gt NULL TObj Objective virtual bool Feasible TIndex UnfixedO virtual TIndex SelectVari
303. uced length labels when using SPX REDUCED or SPX REDUCED RES IDUAL A shortest path tree with respect to the reduced length labels is also a shortest path tree for the original length labels The length of cycles does not depend on the characteristic option and the concrete node po tentials But searching the reduced length labels is useful since those labels can be usually kept non negative and this is required by some shortest path methods In what follows the particular shortest path algorithms are described Most methods can be accessed by the hub ShortestPath but this does mean that the codes are interchangeable Each algorithms applies to a spe cial and often restrictive setting The label correcting algorithms are the most general ones but even those cannot handle the computation of a short est path when the graph admits negative length cycles and in particular when undirected edges of negative length exist In any situation where the selected method does not apply an ERRejected exception is raised 13 1 3 Breadth First Search This method computes an eligible sv path with a minimum number of arcs for every node v of the graph So this procedure solves the shortest path problem for graph with constant non negative edge lengths The running time is O m When calling BFS directly the length labels are ignored When calling this method by using ShortestPath and if the length labels are not constant or negative an exc
304. ulsol i For the series fpsol inithx and 1e450 the k colour enumeration scheme requires too much computer memory to obtain the optimal colour ing Moreover the computation times for cliques and clique covers are dominated by the explicit construction of complementary graphs Results myciel3 20 are therefore omitted mulsol i mulsol i Instance anna david homer huck jean DSJC125 1 DSJC125 5 DSJC125 9 flat300_20 fpsol2 i 1 gamesi20 le450 5a miles250 miles500 miles750 milesi000 milesi1500 Arcs 586 812 3258 602 508 136 3891 6961 21375 11654 1276 5714 774 2340 4226 6432 10396 Stable 80 36 341 27 38 32 48 10 4 12 43 307 22 24 78 141 44 18 12 8 5 Cover 80 36 341 2T 38 32 48 10 20 4 6 12 44 307 22 24 78 141 44 18 19 12 8 5 1 14 71 15 16 myciel7 queen5 5 queen6_6 queen7_7 queen8 8 queen9 9 queen8 12 queen10 10 queenii 11 queeni2 12 queen13 13 queeni4 14 queeni5_15 queeni6_16 schooli schooli_nsh zeroin i 1 zeroin i 2 zeroin i 3 236 755 2360 320 580 952 1456 2112 2736 2940 3960 5192 6656 8372 10360 12640 19095 14612 4100 3541 3540 15 21 16 22 14 14 17 49 30 30 40 48 37 47 120 127 123 40 47 37 47 120 127 123 239 22 6 CLIQUES AND NODE COLOURING CHAPTER 2
305. urned by the methods XO only structural variables are han dled and YO respectively The violation of the primal restrictions is checked with the methods Slack and PrimalFeasible The method DualFeasible essentially checks the signs of the dual variable values How the solutions are computed from the basis indices are implementation details The methods Tableau BaseInverse and Pivot have been added for didactic purposes In order to get a unique interface for both column and row oriented solvers all methods accept indices running from 0 to K L 1 For Tableau and Pivot the first parameter spec ifies a basic index and the second parameter is non basic index For BaseInverse the first parameter denotes a basic index running from 0 to K L 1 and the second parameter denotes a row index ranged in 0 K 1 or a column index ranged in 0 L 1 respectively Finally it must be mentioned how the basis changes if the problem def inition changes If the right hand sides or the cost coefficients are modified the basis remains intact If some matrix coefficients are modified the in dexed rows may become linearly dependent but this may be detected by the next pivoting step only If variable is added basis row must be assigned immediately ideally the variable range restriction this is always feasible A new structural re striction does not affect the row basis and the primal solution and
306. uting Minimum Eulerian Supergraph Increase the capacity bounds so that the graph becomes Eulerian Section 13 5 13 5 13 16 13 16 13 19 13 1 13 1 13 2 3 13 8 13 8 13 10 13 10 13 3 13 15 33 4 8 SOLVER CONFIGURATION MENU ITEM OPTIMIZE CHAPTER 4 THE GOBLET GRAPH BROWSER Option Effect Section Bipartitions Maximum Edge Cut Compute a maximum capacity edge cut and return it by the node colours 13 20 Bipartitions Maximum Stable Set Compute a maximum stable set and return it by the node colours 13 18 Bipartitions gt Minimum Vertex Cover Compute a minimum vertex cover and return it by the node colours 13 18 Bipartitions Maximum Clique 1318 Graph Partitions Compute a node colouring a cover with node disjoint cliques or an edge colouring Optionally 13 17 the number of sets can be restricted Connectivity Compute the strongly edge connected components for a given degree of connectivity or 13 6 determine some connectivity number 13 9 Matching Problems Compute a maximum capacitated b matching a minimum cost perfect b matching a optimal 13 14 T join or a minimal Eulerian supergraph Chinese Postman Problem The vector b and the 13 15 set T are determined by the current node demands Ordering Problems st Numbering Compute an st numbering and return it by the node colours 13 6 Ordering Problems Topologic Order For directed acyclic graphs only Compute a topolo
307. vers some of which are experimental For this reason we omit a documentation of these programs but refer to the source files of the main routine which easily exhibit how the solvers apply LINEAR PROGRAMMING 21 2 Linear Programming The last argument passed to lpsolve is the LP instance name say xyz The solver expects an input file xyz mps which contains a linear program in CPLEX MPS format Do not specify the extension mps explicitly The optimal basis is written to a file named xyz bas and the logging information is written to xyz log If the option b is given the start basis is read from xyz bas and overwritten with the final basis If f is specified the computation stops with a suboptimal but primal or dual feasible basis depending on which method is configured in methLP The option silent suppresses the writing of a log file 21 3 Random Instance Generators These tools can be used to generate random graph objects The last argu ment passed to an instance generator is the output file name say xyz In any case the solver writes a file xyz gob but never a log file All tools work in a very similar way and Table 21 1 describes the command line options By default no random arc labels and no parallel arcs are generated Number of nodes m Number of arcs only for sparse objects Complete graph Generate Eulerian graph Generate regular graph Table 21 1 Instance Generator Options 229 GRAPHICAL DISPLAY 21 3
308. without complete enumeration in the undirected case only 13 20 Maximum Edge Cuts Synopsis class abstractMixedGraph 1 TFloat MaxCut TNode NoNode TNode NoNode virtual TFloat MaxCutHeuristics TNodezNoNode TNode NoNode TFloat MaxCutHeuristicsGRASP TNodezNoNode TNode NoNode TFloat MaxCutLocalSearch TNode TNode NoNode TNode NoNode TFloat MaxCutBranchAndBound TNode NoNode TNodezNoNode TFloat InfFloat class abstractGraph TFloat MaxCutHeuristics TNode NoNode TNode NoNode TFloat MaxCutHeuristicsTree TNodezNoNode TNode NoNode TFloat MaxCutDualTJoin TNode NoNode CHAPTER 13 HIGH LEVEL ALGORITHMS maximum cut is a strong edge cut with the maximum sum of weights where the weight of an arc a is defined as UCap a Length a In undi rected graphs with unit edge capacities and lengths a maximum cut corre sponds to a maximum bipartite subgraph For all described max cut algorithms the return value is the cut weight The cut is returned by the node colours which can be either 0 or 1 Cut arcs are directed from colour 0 to colour 1 and only non blocking arcs are counted for the cut weight If one or two optional nodes are specified the first node is always coloured 0 and the second node is coloured 1 Apart from the exact methods GOBLIN provides two starting heuris tics e In the general setting MaxCutHeuristicsGRASP applies which as signs colours to the nodes step b
309. y So far the layout of logical views is not too elaborate in particular the definitions of Align and Interpolate are only dummies In a later release these two methods may also control the drawing of graph nodes 11 1 6 Arc Orientations Synopsis class abstractMixedGraph x 93 11 2 POTENTIAL SOLUTIONS virtual bool Blocking TArc 0 This functionality is needed to distiguish directed arcs from undirected arcs More explicitly Blocking a is true if the arc a is directed but a backward arc In most classes this method returns a constant but for physical mixed graphs the method is the public interface to an array data structure 11 2 Potential Solutions 11 2 1 Predecessor Labels Synopsis class abstractMixedGraph protected TArc p public void InitPredecessors TArc Pred TNode void SetPred TNode TArc void ReleasePredecessors void WritePredecessors goblinExport void ReadPredecessors goblinImport void ExtractTrees void ExtractTree TNode TNode ExtractPath TNode TNode TNode ExtractCycles void Extract1Matching 94 CHAPTER 11 PROTOTYPES AND DATA STRUCTURES void ExtractEdgeCover general purpose of this data structure is to keep track of paths cy cles trees and any disjoint collection of such subgraphs with a minimum of computer storage Since predecessor labels define arborescences rather than undirected trees subgraphs can be searched
310. y step In each iteration a candidate list with a few nodes is generated and from this list an arbitrary node is chosen Then this node is always added to the most profitable component If the graph is undirected the cut weight is at least 1 2 of the sum of arc weights e In undirected graphs MaxCutHeuristicsTree computes a mini mum spanning tree where the length labels are substituted by the arc weights After that the bipartition is chosen with respect to the tree 13 20 MAXIMUM EDGE CUTS ID S Figure 13 17 A Maximum Edge Cut LULZ The local search procedure MaxCutLocalSearch iteratively shifts a single node from one component to another if the cut capacity strictly increases by that operation Every iteration takes O m computing steps but the num ber of iterations cannot be bounded polynomially As for other solvers the local search procedure is integrated into the heuristics and executed when the context flag methLocal is set For planar undirected graphs with non negative arc weights the method MaxCutDualTJoin determines a maximum of the dual graph and maps it back to an edge cut This is an exact algorithm not just a heuristic The running time is dominated by the used T join method The method MaxCutBranchAndBound applies to the general setting but can solve and proof optimality for small graphs only with roughly 30 nodes and less 143 13 20 MAXIMUM EDGE CUTS CHAPTER 1
311. y the min cost flow solver which comes into play If one enables the bool Tap cost scaling or minimum mean cycle canceling method see Section 13 10 MaximumMatching TCap TCap NULL a strongly polynomial procedure results virtual bool MinCMatching If one applies EnhancedPD and the shortest path method EdmondsKarp2 virtual bool MinCMatching TCap to a k factor problem the time complexity is the same as for the straight virtual bool MinCMatching TCap TCap NULL primal dual method However the actual running times may decrease dra matically since Dijkstra augmentations are conceptually much more simple TFloat MinCEdgeCover and can be performed in O m nlogn time instead of O mn time Matching problems are solved in GOBLIN by transformation to balanced flow networks generally This involves the class gra2bal which was dis cussed in Section 6 3 4 Note that the general methods are overridden for bipartite graphs by another problem transformation which depends on the class big2fnw 134 CHAPTER 13 HIGH LEVEL ALGORITHMS If the matching solver is called without any parameters a subgraph with Deg v Demand v for every node v is computed It may also be called with an integer k and then returns a k factor that is Deg v k for every node Finally the matching solver may be called with two degree sequences a and b Then al v lt Deg v lt b v will hold for the resulting subgraph
312. you may waste a lot of cpu time and disk space for the file export and import 25 3 4 SOLVER EXECUTABLES CHAPTER 3 GETTING STARTED 26 CHAPTER 4 THE GOBLET GRAPH BROWSER Chapter 4 The GOBLET Graph Browser This chapter gives an rough overview about the graphical front end of the GOBLIN library The GOBLET browser has been designed to test and de bug new implementations of graph algorithms to visualize standard graph methods in undergraduate courses and just to play with the combinatorial structure of graphs Intentionally GOBLET is no graph drawing software But in order to have a self contained tool we have added a graph editor All graph layout methods provided by the core C library can be accessed from the GUI GOBLET The GOBLET tool utilizes the graphical filter software fig2dev ghostscript and transfig which supply to GOBLET an almost universal export filter T his allows to prepare figures for latex documents which can be included directly or post processed by the canvas drawing tool xFig Every table lists a single pull down menu There are no inline descrip tions of how the tools work but only references to the C API functionality for each item user manual would be more gentle but many features are still floating and it is hard to keep this document up to date One menu is missing namely the info menu which provides the prob lem statistics and system ressources info The statistics dialog gives some
313. ype MSG_APPEND The handle returned from LogStart must be passed for the trailing components Calls to LogStart and LogEnd must be matching 149 14 8 LOGGING To prevent obvious overhead data objects also implement a method LogEntry O which substitutes the own object handle in the context method Compound messages can be written by data object methods likewise The method Error O calls the log event handler with a message com posed from the two strings passed as arguments The first string describes the scope where the exception occured and the second one describes the exceptional situation All information about the most recent exception is saved internally Finally Error throws a C exception depending on the delivered msgType token See Chapter 19 for more details 150 CHAPTER 14 THE OBJECT CONTROLLER CHAPTER 14 THE OBJECT CONTROLLER 14 3 3 Structured Source Code Synopsis class goblinController x private TModule nestedModule MAX MODULE NESTING int moduleNestingLevel public char logDepth char logLevel void IncreaseLogLevel void DecreaseLogLevel enum TFoldOptions 1 NO INDENT 1 SHOW TITLE 2 void OpenFold TModule TOption 0 void CloseFold TModule TOption 0 The event handlers do some alignment of the log entries depend ing on the current logLevel which can be manipulated by calls to IncreaseLogLevel and DecreaseLogLevel The maximum indenta tion level
Download Pdf Manuals
Related Search
Related Contents
2004 Normas de Discapacidad-AENOR Assembly and Operation Parameters Manual VIDEO CAPTURIX USER MANUAL Introduction à Wikidata septembre 2013 Analog Devices AD602 User's Manual Copyright © All rights reserved.
Failed to retrieve file