├── src ├── gimpy │ ├── examples │ │ ├── __init__.py │ │ ├── graph.tex │ │ ├── expression_tree.py │ │ ├── postordereval.py │ │ ├── search.py │ │ ├── milp1.py │ │ ├── milp2.py │ │ ├── milp3.py │ │ ├── forestry.py │ │ ├── maxflow.py │ │ ├── mincostflow.py │ │ ├── SAT.py │ │ ├── simplex_visualization_test.py │ │ ├── prerequisites.py │ │ └── simplex_test.py │ ├── __init__.py │ ├── Makefile.am │ └── global_constants.py └── __init__.py ├── AUTHORS ├── images ├── Turing.png ├── bacon.png ├── xdot.png ├── forestry.png ├── maxflow.png └── ISERequirements.png ├── INSTALL ├── .gitattributes ├── test ├── test_label_components.py ├── test_binarytree.py ├── test_tree.py ├── test_simplex.py ├── test_strong_components.py ├── Makefile.am ├── test_cycle_canceling.py ├── test_display.py ├── test_cluster.py └── Makefile.in ├── .gitignore ├── setup.py ├── Makefile.am ├── .coin-or └── projDesc.xml ├── README.md ├── configure.ac ├── py-compile ├── docs └── html │ ├── examples │ ├── expression_tree.html │ ├── search.html │ ├── postordereval.html │ ├── milp1.html │ ├── milp2.html │ ├── milp3.html │ ├── forestry.html │ ├── SAT.html │ ├── maxflow.html │ ├── mincostflow.html │ └── index.html │ └── index.html ├── install-sh ├── LICENSE └── missing /src/gimpy/examples/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Aykut Bulut (aykut@lehigh.edu) 2 | Ted Ralphs (ted@lehigh.edu) 3 | -------------------------------------------------------------------------------- /images/Turing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coin-or/GiMPy/HEAD/images/Turing.png -------------------------------------------------------------------------------- /images/bacon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coin-or/GiMPy/HEAD/images/bacon.png -------------------------------------------------------------------------------- /images/xdot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coin-or/GiMPy/HEAD/images/xdot.png -------------------------------------------------------------------------------- /src/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | __import__('pkg_resources').declare_namespace(__name__) 3 | -------------------------------------------------------------------------------- /images/forestry.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coin-or/GiMPy/HEAD/images/forestry.png -------------------------------------------------------------------------------- /images/maxflow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coin-or/GiMPy/HEAD/images/maxflow.png -------------------------------------------------------------------------------- /images/ISERequirements.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coin-or/GiMPy/HEAD/images/ISERequirements.png -------------------------------------------------------------------------------- /INSTALL: -------------------------------------------------------------------------------- 1 | GiMPy 1.0 2 | ========= 3 | 4 | To install, use either the incuded setup.py file: 5 | 6 | python setup.py install 7 | 8 | or the autotools: 9 | 10 | configure 11 | make 12 | make install 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Set the default behavior, in case people don't have core.autocrlf set. 2 | * text=auto 3 | 4 | # Explicitly declare text files you want to always be normalized and converted 5 | # to native line endings on checkout. 6 | *.py text 7 | 8 | # Denote all files that are truly binary and should not be modified. 9 | *.png binary 10 | *.jpg binary 11 | -------------------------------------------------------------------------------- /test/test_label_components.py: -------------------------------------------------------------------------------- 1 | from gimpy import Graph 2 | 3 | if __name__=='__main__': 4 | g = Graph() 5 | g.add_edge(1,2) 6 | g.add_edge(1,3) 7 | g.add_edge(3,4) 8 | g.add_edge(3,5) 9 | g.add_edge(2,4) 10 | g.add_edge(6,7) 11 | g.add_edge(7,8) 12 | g.add_edge(7,9) 13 | g.label_components() 14 | g.set_display_mode('pygame') 15 | g.label_components(display='pygame') 16 | 17 | -------------------------------------------------------------------------------- /test/test_binarytree.py: -------------------------------------------------------------------------------- 1 | from gimpy import BinaryTree 2 | import random 3 | 4 | if __name__=='__main__': 5 | t = BinaryTree(display='pygame') 6 | t.add_root(0) 7 | t.add_left_child(1, 0, label='lc', color='red') 8 | t.add_right_child(2, 0, label='rc', color='red') 9 | t.add_right_child(3, 2, label='rrc', color='green') 10 | t.dfs() 11 | # check postordereval 12 | # check printexp 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/gimpy/examples/graph.tex: -------------------------------------------------------------------------------- 1 | \documentclass[18pt]{article} 2 | %\usepackage[T1]{fontenc} 3 | %\usepackage[latin1]{inputenc} 4 | \usepackage{geometry} 5 | \geometry{verbose,letterpaper,landscape,lmargin=1in,rmargin=1in} 6 | \usepackage{graphicx} 7 | 8 | \makeatletter 9 | \usepackage{psfrag} 10 | %\usepackage{babel} 11 | \makeatother 12 | \begin{document} 13 | 14 | \scalebox{0.28}{ 15 | \input{graph.dot.tex} 16 | \includegraphics{graph.dot.ps} 17 | } 18 | 19 | \end{document} 20 | -------------------------------------------------------------------------------- /src/gimpy/examples/expression_tree.py: -------------------------------------------------------------------------------- 1 | from __future__ import print_function 2 | try: 3 | from src.gimpy import BinaryTree 4 | except ImportError: 5 | from coinor.gimpy import BinaryTree 6 | 7 | T = BinaryTree() 8 | T.add_root('*') 9 | T.add_left_child('+', '*') 10 | T.add_left_child('4', '+') 11 | T.add_right_child('5', '+') 12 | T.add_right_child('7', '*') 13 | T.set_display_mode('matplotlib') 14 | T.display() 15 | T.printexp() 16 | print() 17 | T.postordereval() 18 | print() 19 | -------------------------------------------------------------------------------- /src/gimpy/__init__.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import 2 | from .global_constants import * 3 | from . import graph 4 | from . import examples 5 | from .tree import Tree 6 | from .tree import BinaryTree 7 | 8 | Graph = graph.Graph 9 | DisjointSet = graph.DisjointSet 10 | MATPLOTLIB_INSTALLED = graph.MATPLOTLIB_INSTALLED 11 | DOT2TEX_INSTALLED = graph.DOT2TEX_INSTALLED 12 | PIL_INSTALLED = graph.PIL_INSTALLED 13 | XDOT_INSTALLED = graph.XDOT_INSTALLED 14 | ETREE_INSTALLED = graph.ETREE_INSTALLED 15 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | acinclude.m4 2 | aclocal.m4 3 | autom4te.cache 4 | *.py[cod] 5 | *.bak 6 | 7 | # C extensions 8 | *.so 9 | 10 | # Packages 11 | *.egg 12 | *.egg-info 13 | dist 14 | build 15 | eggs 16 | parts 17 | bin 18 | var 19 | sdist 20 | develop-eggs 21 | .installed.cfg 22 | lib 23 | lib64 24 | __pycache__ 25 | 26 | # Installer logs 27 | pip-log.txt 28 | 29 | # Unit test / coverage reports 30 | .coverage 31 | .tox 32 | nosetests.xml 33 | 34 | # Translations 35 | *.mo 36 | 37 | # Mr Developer 38 | .mr.developer.cfg 39 | .project 40 | .pydevproject 41 | -------------------------------------------------------------------------------- /src/gimpy/examples/postordereval.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Created on Oct 15, 2012 3 | 4 | @author: tkr2 5 | ''' 6 | from __future__ import print_function 7 | 8 | from coinor.gimpy import BinaryTree 9 | 10 | if __name__ == '__main__': 11 | T = BinaryTree(display = 'off') 12 | T.add_root(0, label = '*') 13 | T.add_left_child(1, 0, label = '+') 14 | T.add_left_child(2, 1, label = '4') 15 | T.add_right_child(3, 1, label = '5') 16 | T.add_right_child(4, 0, label = '7') 17 | T.printexp(True) 18 | print() 19 | T.postordereval(True) 20 | -------------------------------------------------------------------------------- /src/gimpy/examples/search.py: -------------------------------------------------------------------------------- 1 | try: 2 | from src.gimpy import Graph, UNDIRECTED_GRAPH 3 | except ImportError: 4 | from coinor.gimpy import Graph, UNDIRECTED_GRAPH 5 | 6 | G = Graph(type = UNDIRECTED_GRAPH, splines = 'true', K = 1.5) 7 | G.random(numnodes = 10, Euclidean = True, seedInput = 11, 8 | #add_labels = True, 9 | #scale = 10, 10 | #scale_cost = 10, 11 | #degree_range = (2, 4), 12 | #length_range = (1, 10) 13 | ) 14 | G.set_display_mode('off') 15 | G.display() 16 | #G.dfs(0) 17 | G.search(0, display = 'off', algo = 'Dijkstra') 18 | 19 | -------------------------------------------------------------------------------- /test/test_tree.py: -------------------------------------------------------------------------------- 1 | from __future__ import print_function 2 | from gimpy import BinaryTree 3 | 4 | if __name__=='__main__': 5 | t = BinaryTree() 6 | t.add_root(0) 7 | t.add_left_child(1,0) 8 | t.add_left_child(2,1) 9 | t.add_left_child(3,2) 10 | t.add_right_child(4,2) 11 | t.add_right_child(6,1) 12 | t.add_right_child(5,0) 13 | t.add_right_child(8,5) 14 | # test print_nodes() 15 | t.print_nodes() 16 | # test dfs 17 | t.dfs() 18 | # test bfs 19 | t.bfs() 20 | print('off display done') 21 | # test print_nodes(display='pygame') 22 | t.print_nodes(display='pygame') 23 | # test dfs(display='pygame') 24 | t.dfs(display='pygame') 25 | # test bfs(display='pygame') 26 | t.bfs(display='pygame') 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /test/test_simplex.py: -------------------------------------------------------------------------------- 1 | #import pycallgraph 2 | import cProfile 3 | import pstats 4 | 5 | from test_algorithms import generate_graph 6 | 7 | # a generator is in the following form (numnode, density, demand_numnode, 8 | # supply_numnode, demand_range, cost_range, capacity_range) 9 | # The following is an example for individual elements in a generator tuple 10 | # numnodes = 10 11 | # density = 0.5 12 | # demand_numnodes = 3 13 | # supply_numnodes = 2 14 | # demand_range = (5,10) 15 | # cost_range = (30,50) 16 | # capacity_range = (10,20) 17 | 18 | if __name__=='__main__': 19 | generator = (38, 0.6, 7, 5, (5,10), (30,50), (10,20)) 20 | g = generate_graph(1, generator) 21 | g.min_cost_flow(algo="simplex", pivot="dantzig") 22 | #pycallgraph.start_trace() 23 | #cProfile.run('rg.min_cost_flow(algo="simplex", pivot="dantzig")', 'cprof.out') 24 | #p = pstats.Stats('cprof.out') 25 | #p.sort_stats('cumulative').print_stats(30) 26 | #pycallgraph.make_dot_graph('simplex_call_graph.png') 27 | -------------------------------------------------------------------------------- /src/gimpy/examples/milp1.py: -------------------------------------------------------------------------------- 1 | #List of constraint index 2 | CONSTRAINTS = ["Capacity"] 3 | 4 | #Dictionary of objective function coefficients of variables 5 | OBJ = {"x1" : 4, 6 | "x2" : 1, 7 | "x3" : 3, 8 | "x4" : 4, 9 | "x5" : 8, 10 | "x6" : 9, 11 | "x7" : 11, 12 | "x8" : 1, 13 | "x9" : 2, 14 | "x10": 0, 15 | "x11": 3, 16 | "x12": 1, 17 | "x13": 2, 18 | "x14": 3, 19 | "x15": 1} 20 | 21 | #Dictionary of variable coefficients in each constraint (column) 22 | MAT = {"x1" : [2], 23 | "x2" : [4], 24 | "x3" : [1], 25 | "x4" : [6], 26 | "x5" : [2], 27 | "x6" : [5], 28 | "x7" : [9], 29 | "x8" : [4], 30 | "x9" : [2], 31 | "x10": [1], 32 | "x11": [3], 33 | "x12": [3], 34 | "x13": [3], 35 | "x14": [5], 36 | "x15": [2]} 37 | 38 | #Right hand side of the constraints 39 | RHS = [29] 40 | 41 | #List of variable indices 42 | VARIABLES = list(OBJ.keys()) 43 | VARIABLES.sort() 44 | 45 | -------------------------------------------------------------------------------- /test/test_strong_components.py: -------------------------------------------------------------------------------- 1 | from __future__ import print_function 2 | from gimpy import Graph, DIRECTED_GRAPH 3 | 4 | def generate_test_instance1(): 5 | g = Graph(type=DIRECTED_GRAPH, display='pygame') 6 | g.add_edge(0,1) 7 | g.add_edge(1,2) 8 | g.add_edge(2,0) 9 | g.add_edge(2,3) 10 | g.add_edge(3,4) 11 | g.add_edge(5,6) 12 | g.add_edge(6,7) 13 | g.add_edge(7,8) 14 | g.add_edge(8,6) 15 | g.add_edge(6,9) 16 | g.add_edge(10,11) 17 | return g 18 | 19 | def generate_test_instance2(): 20 | g = Graph(type=DIRECTED_GRAPH, display='pygame') 21 | g.add_edge(0,1) 22 | g.add_edge(0,2) 23 | g.add_edge(2,3) 24 | g.add_edge(3,0) 25 | g.add_edge(0,4) 26 | g.add_edge(4,5) 27 | g.add_edge(5,6) 28 | g.add_edge(6,4) 29 | g.add_edge(4,7) 30 | g.add_edge(7,1) 31 | g.add_edge(1,8) 32 | return g 33 | 34 | if __name__=='__main__': 35 | g = generate_test_instance1() 36 | #g.label_strong_component(0) 37 | g.tarjan() 38 | for n in g.get_node_list(): 39 | print(n, g.get_node_attr(n, 'component')) 40 | g.display() 41 | -------------------------------------------------------------------------------- /src/gimpy/examples/milp2.py: -------------------------------------------------------------------------------- 1 | #List of constraint index 2 | CONSTRAINTS = ["Capacity", "Cardinality"] 3 | 4 | #Dictionary of objective function coefficients of variables 5 | OBJ = {"x1" : 4, 6 | "x2" : 1, 7 | "x3" : 3, 8 | "x4" : 4, 9 | "x5" : 8, 10 | "x6" : 9, 11 | "x7" : 11, 12 | "x8" : 1, 13 | "x9" : 2, 14 | "x10": 0, 15 | "x11": 3, 16 | "x12": 1, 17 | "x13": 2, 18 | "x14": 3, 19 | "x15": 1} 20 | 21 | #Dictionary of variable coefficients in each constraint (column) 22 | MAT = {"x1" : [2, 1], 23 | "x2" : [4, 1], 24 | "x3" : [1, 1], 25 | "x4" : [6, 1], 26 | "x5" : [2, 1], 27 | "x6" : [5, 1], 28 | "x7" : [9, 1], 29 | "x8" : [4, 1], 30 | "x9" : [2, 1], 31 | "x10": [1, 1], 32 | "x11": [3, 1], 33 | "x12": [3, 1], 34 | "x13": [3, 1], 35 | "x14": [5, 1], 36 | "x15": [2, 1]} 37 | 38 | #Right hand side of the constraints 39 | RHS = [29, 8] 40 | 41 | #List of variable indices 42 | #VARIABLES = OBJ.keys() 43 | #VARIABLES.sort() 44 | 45 | VARIABLES = ["x1", "x2", "x3", "x4", "x5", "x6", "x7", "x8", "x9", "x10", 46 | "x11", "x12", "x13", "x14", "x15"] 47 | -------------------------------------------------------------------------------- /test/Makefile.am: -------------------------------------------------------------------------------- 1 | #============================================================================# 2 | # This file is part of the GiMPy graph library # 3 | # # 4 | # GiMPy is distributed under the Eclipse Public License as part of the # 5 | # COIN-OR repository (http://www.coin-or.org). # 6 | # # 7 | # Authors: Ayukut Bulut, Lehigh University (ayb211@lehigh.edu) # 8 | # Ted Ralphs, Lehigh University (ted@lehigh.edu) # 9 | # # 10 | # # 11 | # Copyright (C) 2013, Lehigh University, Aykut Bulut, and Ted Ralphs # 12 | # All Rights Reserved. # 13 | #============================================================================# 14 | 15 | AUTOMAKE_OPTIONS = foreign 16 | 17 | test: 18 | PYTHONPATH=@abs_source_dir@/src:@abs_source_dir@/test \ 19 | ${PYTHON} @abs_source_dir@/test/test_algorithms.py 20 | 21 | .PHONY: test 22 | 23 | -------------------------------------------------------------------------------- /src/gimpy/examples/milp3.py: -------------------------------------------------------------------------------- 1 | #List of constraint index 2 | CONSTRAINTS = ["Capacity", "Budget", "Cardinality"] 3 | 4 | #Dictionary of objective function coefficients of variables 5 | OBJ = {"x1" : 4, 6 | "x2" : 1, 7 | "x3" : 3, 8 | "x4" : 4, 9 | "x5" : 8, 10 | "x6" : 9, 11 | "x7" : 11, 12 | "x8" : 1, 13 | "x9" : 2, 14 | "x10": 0, 15 | "x11": 3, 16 | "x12": 1, 17 | "x13": 2, 18 | "x14": 3, 19 | "x15": 1} 20 | 21 | #Dictionary of variable coefficients in each constraint (column) 22 | MAT = {"x1" : [2, 7, 1], 23 | "x2" : [4, 2, 1], 24 | "x3" : [1, 3, 1], 25 | "x4" : [6, 5, 1], 26 | "x5" : [2, 1, 1], 27 | "x6" : [5, 7, 1], 28 | "x7" : [9, 6, 1], 29 | "x8" : [4, 4, 1], 30 | "x9" : [2, 1, 1], 31 | "x10": [1, 0, 1], 32 | "x11": [3, 2, 1], 33 | "x12": [3, 3, 1], 34 | "x13": [3, 7, 1], 35 | "x14": [5, 9, 1], 36 | "x15": [2, 2, 1]} 37 | 38 | #Right hand side of the constraints 39 | RHS = [29, 35, 8] 40 | 41 | #List of variable indices 42 | VARIABLES = list(OBJ.keys()) 43 | VARIABLES.sort() 44 | 45 | VARIABLES = ["x1", "x2", "x3", "x4", "x5", "x6", "x7", "x8", "x9", "x10", 46 | "x11", "x12", "x13", "x14", "x15"] -------------------------------------------------------------------------------- /src/gimpy/Makefile.am: -------------------------------------------------------------------------------- 1 | #============================================================================# 2 | # This file is part of the GiMPy graph library # 3 | # # 4 | # GiMPy is distributed under the Eclipse Public License as part of the # 5 | # COIN-OR repository (http://www.coin-or.org). # 6 | # # 7 | # Authors: Ayukut Bulut, Lehigh University (ayb211@lehigh.edu) # 8 | # Ted Ralphs, Lehigh University (ted@lehigh.edu) # 9 | # # 10 | # # 11 | # Copyright (C) 2013, Lehigh University, Aykut Bulut, and Ted Ralphs # 12 | # All Rights Reserved. # 13 | #============================================================================# 14 | 15 | ## $Id: $ 16 | 17 | ######################################################################## 18 | # GiMPy # 19 | ######################################################################## 20 | 21 | GIMPYdir = $(pythondir)/gimpy 22 | 23 | GIMPY_PYTHON = __init__.py graph.py global_constants.py tree.py 24 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | from setuptools import setup, find_packages 4 | 5 | setup(name='coinor.gimpy', 6 | version='2.1.1', 7 | description='Graph Methods in Python', 8 | long_description='''GiMPy is yet another graph class in Python. It is part of the COIN-OR software repository (www.coin-or.org). The class includes implementations of a range of standard graph algorithms. The goal of the implementations is clarity and the package includes visualizations for most of the methods. It is intended for educational/research purposes. The implementations are as efficient as possible, but where tradeoffs have to be made, clarity and ability to visualize are emphasized above efficiency. For this reason, the package is pure Python (and thus will not be as fast as other graph classes with C extensions). Visualization is done using Graphviz, which should be installed in order to do any visualization. Graphs can be displayed using either pygame (live), PIL (static), xdot (live), gexf (static display in browser), or dot2tex (set in LaTex). 9 | 10 | Documentation for the API is here: 11 | 12 | https://coin-or.github.io/GiMPy 13 | ''', 14 | author='Aykut Bulut, Ted Ralphs', 15 | author_email='ted@lehigh.edu', 16 | license='Eclipse Public License', 17 | url='https://github.com/coin-or/GiMPy/', 18 | namespace_packages=['coinor'], 19 | packages=[pkg.replace('src','coinor') for pkg in find_packages()], 20 | package_dir = {'coinor': 'src'}, 21 | install_requires=['coinor.blimpy>=2.0.0'] 22 | ) 23 | -------------------------------------------------------------------------------- /src/gimpy/examples/forestry.py: -------------------------------------------------------------------------------- 1 | from builtins import str 2 | from builtins import range 3 | from coinor.gimpy import Graph 4 | from coinor.gimpy import DIRECTED_GRAPH 5 | 6 | import random 7 | 8 | ''' 9 | # Here is some static data for testing 10 | demand = [10, 11 | 4, 12 | 7] 13 | 14 | harvest = [[7, 2], 15 | [3, 5], 16 | [2, 1]] 17 | 18 | numForests = len(harvest[0]) 19 | numYears = len(demand) 20 | ''' 21 | 22 | random.seed(0) 23 | numForests = 2 24 | numYears = 3 25 | demand = [random.randint(25, 50) for i in range(numYears)] 26 | harvest = [[random.randint(5, 10) for j in range(numForests)] 27 | for i in range(numYears)] 28 | 29 | forest = ['f'+ str(i) for i in range(numForests)] 30 | year = ['y'+ str(i) for i in range(numYears)] 31 | 32 | g = Graph(display='off',type=DIRECTED_GRAPH, splines = 'true', K = 1.5, 33 | rankdir = 'LR', layout = 'dot') 34 | 35 | for i in range(numYears): 36 | g.add_node(year[i], label = 'Total Production\nin Year %s' %(i+1)) 37 | g.add_edge(year[i], 'sink', capacity = demand[i]) 38 | 39 | for j in range(numForests): 40 | g.add_node(forest[j], label = 'Forest ' + str(j+1)) 41 | g.add_edge('source', forest[j]) 42 | for i in range(numYears): 43 | g.add_node((forest[j], year[i]), 44 | label = "Production\nof Forest %s\nin Year %s"%(str(j+1), str(i+1))) 45 | g.add_edge(forest[j], (forest[j], year[i]), capacity = harvest[i][j]) 46 | g.add_edge((forest[j], year[i]), year[i]) 47 | for i in range(numYears-1): 48 | g.add_edge((forest[j], year[i]), (forest[j], year[i+1])) 49 | 50 | g.max_flow('source', 'sink') 51 | g.set_display_mode('file') 52 | g.display() 53 | -------------------------------------------------------------------------------- /test/test_cycle_canceling.py: -------------------------------------------------------------------------------- 1 | ''' 2 | tests if cycle canceling method works properly. 3 | ''' 4 | from __future__ import print_function 5 | from builtins import str 6 | from builtins import range 7 | 8 | from test_algorithms import generate_graph 9 | 10 | # a generator is in the following form (numnode, density, demand_numnode, 11 | # supply_numnode, demand_range, cost_range, capacity_range) 12 | # The following is an example for individual elements in a generator tuple 13 | # numnodes = 10 14 | # density = 0.5 15 | # demand_numnodes = 3 16 | # supply_numnodes = 2 17 | # demand_range = (5,10) 18 | # cost_range = (30,50) 19 | # capacity_range = (10,20) 20 | 21 | if __name__=='__main__': 22 | generator = (10, 0.8, 3, 2, (5,10), (0,5), (100,200)) 23 | print('Seed'.ljust(5), 'simplex'.ljust(8), 'cycle canceling') 24 | for seed in range(10): 25 | # cycle canceling flows 26 | cc_flows = {} 27 | # simplex flows 28 | s_flows = {} 29 | g = generate_graph(seed, generator) 30 | el = g.get_edge_list() 31 | g.min_cost_flow(algo="simplex", pivot="dantzig") 32 | for e in el: 33 | s_flows[e] = g.get_edge_attr(e[0], e[1], 'flow') 34 | g.set_edge_attr(e[0], e[1], 'flow', 0) 35 | g.min_cost_flow(algo="cycle_canceling") 36 | for e in el: 37 | cc_flows[e] = g.get_edge_attr(e[0], e[1], 'flow') 38 | # measure total cost of flow 39 | cc_cost = 0 40 | s_cost = 0 41 | for e in el: 42 | cost_e = g.get_edge_attr(e[0], e[1], 'cost') 43 | s_cost += s_flows[e]*cost_e 44 | cc_cost += cc_flows[e]*cost_e 45 | print(str(seed).ljust(5), str(s_cost).ljust(8), str(cc_cost)) 46 | -------------------------------------------------------------------------------- /test/test_display.py: -------------------------------------------------------------------------------- 1 | from __future__ import print_function 2 | # import classes 3 | from gimpy import Graph, Tree, BinaryTree 4 | # import dependency related globals. All these dependencies are optional. 5 | # They all provide different display capabilities. If some of them are missing 6 | # it means you only miss the display capability provided by it. 7 | from gimpy import PYGAME_INSTALLED, DOT2TEX_INSTALLED, PIL_INSTALLED 8 | from gimpy import XDOT_INSTALLED, ETREE_INSTALLED 9 | 10 | if PYGAME_INSTALLED: 11 | print('Pygame is installed.') 12 | elif not PYGAME_INSTALLED: 13 | print('Warning: Pygame can not found.') 14 | if DOT2TEX_INSTALLED: 15 | print('Dot2tex is installed.') 16 | elif not DOT2TEX_INSTALLED: 17 | print('Warning: Dot2tex can not found.') 18 | if PIL_INSTALLED: 19 | print('PIL (Python Imaging Library) is installed.') 20 | elif not PIL_INSTALLED: 21 | print('Warning: PIL (Python Imaging Library) can not found.') 22 | if XDOT_INSTALLED: 23 | print('Xdot is installed.') 24 | elif not XDOT_INSTALLED: 25 | print('Warning: Xdot can not found.') 26 | if ETREE_INSTALLED: 27 | print('Etree is installed.') 28 | elif not ETREE_INSTALLED: 29 | print('Warning: Etree can not found.') 30 | 31 | if __name__=="__main__": 32 | g = Graph(display='off', layout='dot') 33 | g.random(numnodes= 20, density =0.2) 34 | # test pygame 35 | g.set_display_mode('pygame') 36 | g.display() 37 | # test xdot 38 | g.set_display_mode('xdot') 39 | g.display() 40 | # test file, layout dot 41 | g.set_display_mode('file') 42 | g.display(basename='test_graph') 43 | # test file, layout dot2tex 44 | g.set_display_mode('file') 45 | g.set_layout('dot2tex') 46 | g.display() 47 | # test PIL 48 | g.set_layout('dot') 49 | g.set_display_mode('PIL') 50 | g.display() 51 | # test svg 52 | g.set_display_mode('svg') 53 | g.display() 54 | 55 | -------------------------------------------------------------------------------- /src/gimpy/examples/maxflow.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Small example for demonstrating flow agumenting path (ford-fulkerson) 3 | algorithm. 4 | This example is taken from youtube lecture series on Advanced Operations 5 | Research by Prof. G.Srinivasan. 6 | Link to the video is: 7 | http://www.youtube.com/watch?v=J0wzih3_5Wo 8 | 9 | black: there is no flow on the arc 10 | red : the flow equals to the arc capacity 11 | green: there is positive flow on the arc, less then capacity. 12 | ''' 13 | from __future__ import print_function 14 | 15 | try: 16 | from src.gimpy import Graph, DIRECTED_GRAPH 17 | except ImportError: 18 | from coinor.gimpy import Graph, DIRECTED_GRAPH 19 | 20 | if __name__=='__main__': 21 | g = Graph(type = DIRECTED_GRAPH, display = 'off') 22 | g.add_node(1,pos='"0,2!"') 23 | 24 | g.add_node(3,pos='"2,4!"') 25 | g.add_node(2,pos='"2,0!"') 26 | g.add_node(4,pos='"4,2!"') 27 | g.add_node(6,pos='"6,4!"') 28 | 29 | g.add_node(5,pos='"6,0!"') 30 | g.add_node(7,pos='"8,2!"') 31 | g.add_edge(1, 3, capacity=40, label='40') 32 | g.add_edge(1, 2, capacity=40, label='40') 33 | g.add_edge(3, 4, capacity=10, label='10') 34 | g.add_edge(3, 6, capacity=10, label='10') 35 | g.add_edge(2, 4, capacity=15, label='15') 36 | g.add_edge(2, 5, capacity=20, label='20') 37 | g.add_edge(4, 6, capacity=20, label='20') 38 | g.add_edge(4, 7, capacity=10, label='10') 39 | g.add_edge(4, 5, capacity=10, label='10') 40 | g.add_edge(6, 7, capacity=30, label='30') 41 | g.add_edge(5, 7, capacity=20, label='20') 42 | g.set_display_mode('off') 43 | 44 | # g.max_flow_preflowpush(1, 7, algo = 'HighestLabel') 45 | g.max_flow(1, 7, algo = 'BFS') 46 | 47 | nl = list(int(n) for n in g.get_node_list()) 48 | nl.sort() 49 | for n in nl: 50 | for m in nl: 51 | if g.check_edge(n, m): 52 | print(n, m, g.get_edge_attr(n, m, 'flow')) 53 | -------------------------------------------------------------------------------- /test/test_cluster.py: -------------------------------------------------------------------------------- 1 | ''' 2 | This script implements the graphviz example at location 3 | http://www.graphviz.org/Gallery/directed/cluster.html 4 | in our graph class. Main purpose of the Graph class is not to be python 5 | interface to graphviz. Main purpose is to implement a graph class using 6 | the methods in the literature and measuring running time performances. Hence 7 | it is teaching/research oriented. This script demonstrates the Graph class's 8 | capability as a graphviz interface. 9 | ''' 10 | from __future__ import print_function 11 | 12 | from gimpy import Graph, DIRECTED_GRAPH 13 | 14 | if __name__=='__main__': 15 | c = Graph(type=DIRECTED_GRAPH, layout = 'dot') 16 | # add edges 17 | c.add_edge('start', 'a0') 18 | c.add_edge('a0', 'a1') 19 | c.add_edge('a1', 'a2') 20 | c.add_edge('a2', 'a3') 21 | c.add_edge('start', 'b0') 22 | c.add_edge('b0', 'b1') 23 | c.add_edge('b1', 'b2') 24 | c.add_edge('b2', 'b3') 25 | c.add_edge('b2', 'a3') 26 | c.add_edge('a3', 'end') 27 | c.add_edge('b3', 'end') 28 | c.add_edge('a3', 'a0') 29 | c.add_edge('a1', 'b3') 30 | # set node attributes 31 | c.set_node_attr('start', 'shape', 'Mdiamond') 32 | c.set_node_attr('end', 'shape', 'Msquare') 33 | # create clusters 34 | # create dictionaries with cluster attributes and node attributes 35 | cluster_attrs = {'name':'0', 'style':'filled', 'color':'lightgrey', 'label':'process #1'} 36 | node_attrs = {'style':'filled', 'color':'white'} 37 | # create cluster 38 | c.create_cluster(['a0', 'a1', 'a2', 'a3'], cluster_attrs, node_attrs) 39 | # modify attributes for the second cluster 40 | cluster_attrs['name']='1' 41 | cluster_attrs['color']='blue' 42 | del cluster_attrs['style'] 43 | cluster_attrs['label'] = 'process #2' 44 | del node_attrs['color'] 45 | # create second cluster 46 | c.create_cluster(['b0', 'b1', 'b2', 'b3'], cluster_attrs, node_attrs) 47 | # print graph in dot language to stdout 48 | print(c.to_string()) 49 | c.set_display_mode('pygame') 50 | c.display() 51 | -------------------------------------------------------------------------------- /src/gimpy/examples/mincostflow.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Small example for demonstrating flow agumenting path (ford-fulkerson) 3 | algorithm. 4 | This example is taken from youtube lecture series on Advanced Operations 5 | Research by Prof. G.Srinivasan. 6 | Link to the video is: 7 | http://www.youtube.com/watch?v=J0wzih3_5Wo 8 | 9 | black: there is no flow on the arc 10 | red : the flow equals to the arc capacity 11 | green: there is positive flow on the arc, less then capacity. 12 | ''' 13 | from __future__ import print_function 14 | 15 | try: 16 | from src.gimpy import Graph, DIRECTED_GRAPH 17 | except ImportError: 18 | from coinor.gimpy import Graph, DIRECTED_GRAPH 19 | 20 | if __name__=='__main__': 21 | g = Graph(type = DIRECTED_GRAPH, display = 'off') 22 | g.add_node(1,pos='"0,2!"', demand=4, label='(1, 4)') 23 | 24 | g.add_node(3,pos='"2,4!"', demand=0) 25 | g.add_node(2,pos='"2,0!"', demand=0) 26 | g.add_node(4,pos='"4,2!"', demand=0) 27 | g.add_node(6,pos='"6,4!"', demand=0) 28 | 29 | g.add_node(5,pos='"6,0!"', demand=0) 30 | g.add_node(7,pos='"8,2!"', demand=-4, label='(1, -4)') 31 | g.add_edge(1, 3, cost=0, capacity=2, label='(0, 2)') 32 | g.add_edge(1, 2, cost=0, capacity=2, label='(0, 2)') 33 | g.add_edge(3, 4, cost=1, capacity=1, label='(1, 1)') 34 | g.add_edge(3, 6, cost=2, capacity=2, label='(2, 2)') 35 | g.add_edge(2, 4, cost=3, capacity=1, label='(3, 1)') 36 | g.add_edge(2, 5, cost=5, capacity=1, label='(5, 1)') 37 | g.add_edge(4, 6, cost=1, capacity=3, label='(1, 3)') 38 | g.add_edge(4, 7, cost=4, capacity=2, label='(4, 2)') 39 | g.add_edge(4, 5, cost=1, capacity=1, label='(3, 1)') 40 | g.add_edge(6, 7, cost=0, capacity=2, label='(0, 2)') 41 | g.add_edge(5, 7, cost=0, capacity=2, label='(0, 2)') 42 | g.set_display_mode('off') 43 | g.display() 44 | 45 | # g.cycle_canceling('matplotlib') 46 | g.min_cost_flow(algo='cycle_canceling') 47 | # g.max_flow(1, 7) 48 | 49 | nl = list(int(n) for n in g.get_node_list()) 50 | nl.sort() 51 | for n in nl: 52 | for m in nl: 53 | if g.check_edge(n, m): 54 | print(n, m, g.get_edge_attr(n, m, 'flow')) 55 | -------------------------------------------------------------------------------- /src/gimpy/examples/SAT.py: -------------------------------------------------------------------------------- 1 | from __future__ import print_function 2 | try: 3 | from src.gimpy import Graph 4 | except ImportError: 5 | from coinor.gimpy import Graph 6 | 7 | if __name__ == '__main__': 8 | G = Graph(graph_type = 'digraph', splines = 'true', layout = 'dot2tex', 9 | display = 'off', rankdir = 'LR', fontsize = '44', 10 | d2tgraphstyle = 'every text node part/.style={align=left}', 11 | ) 12 | node_format = { 13 | # 'height':1.0, 14 | # 'width':2.0, 15 | # 'fixedsize':'true', 16 | # 'fontsize':'36', 17 | # 'fontcolor':'red', 18 | 'shape':'rect', 19 | } 20 | 21 | G.add_node('0', label = r'C_1 = x_1 \mid x_2$ \\ $C_2 = x_2 \mid x_3', **node_format) 22 | G.add_node('1', label = r'C_1 = \text{TRUE}$ \\ $C_2 = x_2 \mid x_3', **node_format) 23 | G.add_node('2', label = r'C_1 = x_2$ \\ $C_2 = x_2 \mid x_3', **node_format) 24 | G.add_node('3', label = r'C_1 = \text{TRUE}$ \\ $C_2 = \text{TRUE}', color = 'green', **node_format) 25 | G.add_node('4', label = r'C_1 = \text{TRUE}$ \\ $C_2 = x_3', **node_format) 26 | G.add_node('5', label = r'C_1 = \text{TRUE}$ \\ $C_2 = \text{TRUE}', color = 'green', **node_format) 27 | G.add_node('6', label = r'C_1 = \text{FALSE}$ \\ $C_2 = x_3', color = 'red', **node_format) 28 | G.add_node('9', label = r'C_1 = \text{TRUE}$ \\ $C_2 = \text{TRUE}', color = 'green', **node_format) 29 | G.add_node('10', label = r'C_1 = \text{FALSE}$ \\ $C_2 = \text{FALSE}', color = 'red', **node_format) 30 | G.add_edge('0', '1', label = r'x_1 = \text{TRUE}') 31 | G.add_edge('0', '2', label = r'x_1 = \text{FALSE}') 32 | G.add_edge('1', '3', label = r'x_2 = \text{TRUE}') 33 | G.add_edge('1', '4', label = r'x_2 = \text{FALSE}') 34 | G.add_edge('2', '5', label = r'x_2 = \text{TRUE}') 35 | G.add_edge('2', '6', label = r'x_2 = \text{FALSE}') 36 | G.add_edge('4', '9', label = r'x_3 = \text{TRUE}') 37 | G.add_edge('4', '10', label = r'x_3 = \text{FALSE}') 38 | 39 | G.set_display_mode('file') 40 | 41 | print(G) 42 | 43 | G.display(basename='Turing') 44 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | #============================================================================# 2 | # This file is part of the GiMPy graph library # 3 | # # 4 | # GiMPy is distributed under the Eclipse Public License as part of the # 5 | # COIN-OR repository (http://www.coin-or.org). # 6 | # # 7 | # Authors: Ayukut Bulut, Lehigh University (ayb211@lehigh.edu) # 8 | # Ted Ralphs, Lehigh University (ted@lehigh.edu) # 9 | # # 10 | # # 11 | # Copyright (C) 2013, Lehigh University, Aykut Bulut, and Ted Ralphs # 12 | # All Rights Reserved. # 13 | #============================================================================# 14 | 15 | AUTOMAKE_OPTIONS = foreign 16 | 17 | ######################################################################## 18 | # Subdirectories # 19 | ######################################################################## 20 | 21 | SUBDIRS = src/gimpy 22 | 23 | # We don't want to compile the test subdirectory, unless the test target is 24 | # specified. But we need to list it as subdirectory to make sure that it is 25 | # included in the tarball 26 | 27 | if ALWAYS_FALSE 28 | SUBDIRS += test 29 | endif 30 | 31 | ######################################################################## 32 | # Additional files to be included in tarball # 33 | ######################################################################## 34 | 35 | # Here we need include all files that are not mentioned in other Makefiles 36 | EXTRA_DIST = 37 | 38 | ######################################################################## 39 | # Extra Targets # 40 | ######################################################################## 41 | 42 | test: all 43 | cd test; $(MAKE) test 44 | 45 | unitTest: test 46 | 47 | .PHONY: test unitTest 48 | -------------------------------------------------------------------------------- /src/gimpy/examples/simplex_visualization_test.py: -------------------------------------------------------------------------------- 1 | ''' 2 | tests network simplex visualization 3 | ''' 4 | 5 | from coinor.gimpy import Graph, DIRECTED_GRAPH 6 | from random import seed, randint, random 7 | 8 | def generate_graph(): 9 | g = Graph(type=DIRECTED_GRAPH) 10 | # supply nodes; 1,2 11 | g.add_node(1, demand=20, pos='"0,3!"') 12 | g.add_node(2, demand=10, pos='"0,1!"') 13 | # transhipment nodes; 3,4 14 | g.add_node(3, demand=0, pos='"3,4!"') 15 | g.add_node(4, demand=0, pos='"3,1!"') 16 | # demand nodes; 5,6,7 17 | g.add_node(5, demand=-5, pos='"6,3!"') 18 | g.add_node(6, demand=-10, pos='"6,2!"') 19 | g.add_node(7, demand=-15, pos='"6,0!"') 20 | # add edges 21 | g.add_edge(1,2,cost=5,capacity=10) 22 | g.add_edge(1,3,cost=6,capacity=15) 23 | g.add_edge(1,4,cost=10,capacity=15) 24 | g.add_edge(2,3,cost=7,capacity=10) 25 | g.add_edge(3,4,cost=4,capacity=15) 26 | g.add_edge(3,5,cost=5,capacity=10) 27 | g.add_edge(3,6,cost=7,capacity=10) 28 | g.add_edge(4,5,cost=6,capacity=8) 29 | g.add_edge(4,6,cost=4,capacity=10) 30 | g.add_edge(4,7,cost=8,capacity=20) 31 | g.add_edge(5,6,cost=2,capacity=10) 32 | g.add_edge(6,7,cost=2,capacity=20) 33 | return g 34 | 35 | def generate_graph2(): 36 | ''' 37 | this example is form lecture notes of Prof. James Orlin in Optimization 38 | Methods in Management Science class. Link to lecture notes is as follows. 39 | http://ocw.mit.edu/courses/sloan-school-of-management/ 40 | 15-053-optimization-methods-in-management-science-spring-2007/ 41 | lecture-notes/lec15.pdf 42 | ''' 43 | g = Graph(type=DIRECTED_GRAPH) 44 | # supply nodes; 2,3,6 45 | g.add_node(2, demand=6, pos='"1,2!"') 46 | g.add_node(3, demand=6, pos='"0,0!"') 47 | g.add_node(6, demand=12, pos='"5,2!"') 48 | # demand nodes; 1,4,5,7 49 | g.add_node(1, demand=-3, pos='"3,4!"') 50 | g.add_node(4, demand=-11, pos='"2,0!"') 51 | g.add_node(5, demand=-3, pos='"3,2!"') 52 | g.add_node(7, demand=-7, pos='"4,0!"') 53 | # add edges 54 | g.add_edge(1,2,cost=1,capacity=10) 55 | g.add_edge(2,4,cost=2,capacity=15) 56 | g.add_edge(2,5,cost=2,capacity=15) 57 | g.add_edge(3,2,cost=2,capacity=10) 58 | g.add_edge(3,4,cost=1,capacity=4) 59 | g.add_edge(4,7,cost=1,capacity=10) 60 | g.add_edge(6,1,cost=3,capacity=10) 61 | g.add_edge(6,5,cost=2,capacity=2) 62 | g.add_edge(6,7,cost=10,capacity=5) 63 | return g 64 | 65 | if __name__=='__main__': 66 | g = generate_graph() 67 | g.set_display_mode('off') 68 | g.min_cost_flow(algo='simplex') 69 | -------------------------------------------------------------------------------- /.coin-or/projDesc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 9 | GiMPy 10 | 11 | GiMPy 12 | 13 | 14 | Graph Methods in Python (GiMPy) is a Python graph library containing 15 | pure Python implementations of a variety of graph algorithms. The goal 16 | is clarity in implementation rather than eficiency. Most methods have 17 | an accompanying visualization and are thus appropriate for use in the 18 | classroom. 19 | 20 | 21 | 22 | A Python graph library. 23 | 24 | 25 | Ted Ralphs, ted at lehigh.edu 26 | 27 | https://github.com/coin-or/GiMPy 28 | 29 | Eclipse Public License 1.0 30 | 31 | http://www.opensource.org/licenses/eclipse-1.0 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | Python 41 | 42 | 43 | 44 | Active 45 | 46 | 5 47 | 48 | 49 | 50 | 51 | 52 | Microsoft Windows 53 | Python 2.7 54 | 55 | 56 | 57 | Linux 58 | Python 2.7 59 | 60 | 61 | 62 | OS X 63 | Python 2.7 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | Graphs 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | https://coin-or.github.io/GiMPy 81 | 82 | 83 | https://github.com/coin-or/GiMPy 84 | 85 | 86 | 87 | https://pypi.python.org/pypi/coinor.gimpy 88 | 89 | 90 | https://github.com/coin-or/GiMPy/issues 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # GiMPy 2.1 2 | 3 | [![DOI](https://zenodo.org/badge/18214894.svg)](https://zenodo.org/badge/latestdoi/18214894) 4 | 5 | Graph Methods in Python (GiMPy) is a Python graph library containing pure 6 | Python implementations of a variety of graph algorithms. The goal is clarity 7 | in implementation rather than eficiency. Most methods have an accompanying 8 | visualization and are thus appropriate for use in the classroom. 9 | 10 | Documentation for the API is here: 11 | 12 | https://coin-or.github.io/GiMPy 13 | 14 | Pypi download page is here: 15 | 16 | https://pypi.python.org/pypi/coinor.gimpy 17 | 18 | ## Installation Notes 19 | 20 | To install, do 21 | ``` 22 | pip install coinor.gimpy 23 | ``` 24 | 25 | In order for GiMPy to visualize the graphs it produces, it's necessary to install 26 | [GraphViz](http://www.graphviz.org/Download.php) (**Important**: after installing 27 | graphviz, you must add the graphviz `bin` directory, usually 28 | `C:\Program Files (x86)\Graphviz2.38\bin`, to your `PATH`) 29 | and choose one of these additional methods for display: 30 | * Recommended: [matplotlib](https://pypi.org/project/matplotlib/) and call 31 | `set_display_mode('matplotlib') 32 | * [Python Imaging Library](http://www.pythonware.com/products/pil/) and 33 | call `set_display_mode('PIL')` 34 | * Call `set_display_mode('file')` to just write files to disk that have to 35 | then be opened manually. 36 | 37 | It is also possible to typeset labels in LaTex and to output the graph in 38 | LaTex format using `dot2tex`. After installing `dot2tex`, this can be done 39 | by simply calling the method `write(basename='fileName', format='dot')`, and 40 | then doing `dot2tex --tmath fileName.dot` or by calling 41 | `set_display_mode('dot2tex')` and then `display()` as usual. At the moment, 42 | the latter only seems to work with version `2.9.0dev` available 43 | [here](https://github.com/Alwnikrotikz/dot2tex). For the former method, just 44 | using `easy_install dot2tex` should work fine. 45 | 46 | # Additional Notes for Windows Installation 47 | 48 | * To install Graphviz, download the installer [here](http://www.graphviz.org/Download.php). **Important**: after installing, you must manually add the graphviz `bin` directory (usually `C:\Program Files (x86)\Graphviz2.38\bin`) to your `PATH` 49 | * If you want to use `xdot`, there are some more requirements: 50 | * Unfortunately, you must have a 32-bit version of Python 2.7 51 | * You must install the [PyGtk version 2.22.6](http://ftp.gnome.org/pub/GNOME/binaries/win32/pygtk/2.22/pygtk-all-in-one-2.22.6.win32-py2.7.msi). Version 2.24 is buggy on Windows. 52 | * To install `gnuplot`, download the installer [here](https://sourceforge.net/projects/gnuplot/). Note that the CYGWIN version of gnuplot may not work when called from Python. 53 | 54 | # Additional Notes for Linux Installation 55 | 56 | * Graphviz can be installed as a package on most Linux distros, e.g., `sudo apt-get install graphviz` 57 | 58 | # Additional Notes for OS X Users 59 | 60 | * The situation with Python on OS X is a bit of a mess. It is recommended to install python using [homebrew](http://brew.sh) with `brew install python`). 61 | * With homebbrew, one can also easily install graphviz (`brew install graphviz`). 62 | 63 | ## Examples 64 | 65 | ### Forestry Model 66 | ![Forestry](https://raw.githubusercontent.com/coin-or/GiMPy/master/images/forestry.png) 67 | ### Display Window in XDot 68 | ![XDot](https://raw.githubusercontent.com/coin-or/GiMPy/master/images/xdot.png) 69 | ### Lehigh ISE Prerequisite Graph 70 | ![ISE Prerequisites](https://raw.githubusercontent.com/coin-or/GiMPy/master/images/ISERequirements.png) 71 | ### Graph of Actors Starring Together in Movies in IMDB 72 | ![Bacon](https://raw.githubusercontent.com/coin-or/GiMPy/master/images/bacon.png) 73 | ### Branch and Bound Tree 74 | ![Branch and Bound](https://raw.githubusercontent.com/coin-or/GrUMPy/master/images/BranchAndBound.png) 75 | ### SAT Game Tree 76 | ![SAT](https://raw.githubusercontent.com/coin-or/GiMPy/master/images/Turing.png) 77 | ### Flow Problem 78 | ![Max Flow](https://raw.githubusercontent.com/coin-or/GiMPy/master/images/maxflow.png) 79 | 80 | -------------------------------------------------------------------------------- /configure.ac: -------------------------------------------------------------------------------- 1 | #============================================================================# 2 | # This file is part of the GiMPy graph library # 3 | # # 4 | # GiMPy is distributed under the Eclipse Public License as part of the # 5 | # COIN-OR repository (http://www.coin-or.org). # 6 | # # 7 | # Authors: Ayukut Bulut, Lehigh University (ayb211@lehigh.edu) # 8 | # Ted Ralphs, Lehigh University (ted@lehigh.edu) # 9 | # # 10 | # # 11 | # Copyright (C) 2013, Lehigh University, Aykut Bulut, and Ted Ralphs # 12 | # All Rights Reserved. # 13 | #============================================================================# 14 | 15 | ############################################################################# 16 | # Names and other basic things # 17 | ############################################################################# 18 | # autoconf version used by COIN 19 | AC_PREREQ(2.59) 20 | 21 | # name of project, version number, contact info 22 | AC_INIT([GiMPy],[trunk],[coin-bazaar@lists.coin-or.org]) 23 | 24 | # copyright for configure script 25 | AC_COPYRIGHT([ 26 | #============================================================================# 27 | # This file is part of the GiMPy graph library # 28 | # # 29 | # GiMPy is distributed under the Eclipse Public License as part of the # 30 | # COIN-OR repository (http://www.coin-or.org). # 31 | # # 32 | # Authors: Aykut Bulut, Lehigh University (ayb211@lehigh.edu) # 33 | # Ted Ralphs, Lehigh University (ted@lehigh.edu) # 34 | # # 35 | # # 36 | # Copyright (C) 2013, Lehigh University, Aykut Bulut, and Ted Ralphs # 37 | # All Rights Reserved. # 38 | #============================================================================# 39 | ]) 40 | 41 | # List one file in the package so that the configure script can test 42 | # whether the package is actually there 43 | AC_CONFIG_SRCDIR(src/gimpy/graph.py) 44 | 45 | # Where should everything be installed by default? Here, we want it 46 | # to be installed directly in 'bin', 'lib', 'include' subdirectories 47 | # of the directory where configure is run. The default would be 48 | # /usr/local. 49 | AC_PREFIX_DEFAULT([`pwd`]) 50 | 51 | ############################################################################# 52 | # Standard build tool stuff # 53 | ############################################################################# 54 | # Get the system type 55 | AC_CANONICAL_BUILD 56 | 57 | # If this project depends on external projects, the Externals file in 58 | # the source root directory contains definition of where to find those 59 | # externals. The following macro ensures that those externals are 60 | # retrieved by svn if they are not there yet. 61 | AC_COIN_PROJECTDIR_INIT(GiMPy) 62 | 63 | # Get the name of the C++ compiler and appropriate compiler options 64 | AC_COIN_PROG_CXX 65 | 66 | # Initialize automake and libtool 67 | AC_COIN_INIT_AUTO_TOOLS 68 | 69 | # Get the EXEXT variable for CYGWIN 70 | AC_EXEEXT 71 | 72 | ############################################################################# 73 | # Check for Python # 74 | ############################################################################# 75 | 76 | AM_PATH_PYTHON([2.6],,[:]) 77 | if test "$PYTHON" != "" ; then 78 | PY_PREFIX=`$PYTHON -c 'import sys ; print sys.prefix'` 79 | fi 80 | AM_CONDITIONAL([HAVE_PYTHON], [test "$PYTHON" != "" ]) 81 | 82 | ############################################################################# 83 | # Generate the Makefiles # 84 | ############################################################################# 85 | 86 | AC_CONFIG_FILES([Makefile 87 | src/gimpy/Makefile 88 | test/Makefile]) 89 | 90 | # Finally, we let configure write all the output... 91 | AC_COIN_FINALIZE 92 | -------------------------------------------------------------------------------- /py-compile: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # py-compile - Compile a Python program 3 | 4 | scriptversion=2005-05-14.22 5 | 6 | # Copyright (C) 2000, 2001, 2003, 2004, 2005 Free Software Foundation, Inc. 7 | 8 | # This program is free software; you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation; either version 2, or (at your option) 11 | # any later version. 12 | 13 | # This program is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | 18 | # You should have received a copy of the GNU General Public License 19 | # along with this program; if not, write to the Free Software 20 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 21 | # 02110-1301, USA. 22 | 23 | # As a special exception to the GNU General Public License, if you 24 | # distribute this file as part of a program that contains a 25 | # configuration script generated by Autoconf, you may include it under 26 | # the same distribution terms that you use for the rest of that program. 27 | 28 | # This file is maintained in Automake, please report 29 | # bugs to or send patches to 30 | # . 31 | 32 | if [ -z "$PYTHON" ]; then 33 | PYTHON=python 34 | fi 35 | 36 | basedir= 37 | destdir= 38 | files= 39 | while test $# -ne 0; do 40 | case "$1" in 41 | --basedir) 42 | basedir=$2 43 | if test -z "$basedir"; then 44 | echo "$0: Missing argument to --basedir." 1>&2 45 | exit 1 46 | fi 47 | shift 48 | ;; 49 | --destdir) 50 | destdir=$2 51 | if test -z "$destdir"; then 52 | echo "$0: Missing argument to --destdir." 1>&2 53 | exit 1 54 | fi 55 | shift 56 | ;; 57 | -h|--h*) 58 | cat <<\EOF 59 | Usage: py-compile [--help] [--version] [--basedir DIR] [--destdir DIR] FILES..." 60 | 61 | Byte compile some python scripts FILES. Use --destdir to specify any 62 | leading directory path to the FILES that you don't want to include in the 63 | byte compiled file. Specify --basedir for any additional path information you 64 | do want to be shown in the byte compiled file. 65 | 66 | Example: 67 | py-compile --destdir /tmp/pkg-root --basedir /usr/share/test test.py test2.py 68 | 69 | Report bugs to . 70 | EOF 71 | exit $? 72 | ;; 73 | -v|--v*) 74 | echo "py-compile $scriptversion" 75 | exit $? 76 | ;; 77 | *) 78 | files="$files $1" 79 | ;; 80 | esac 81 | shift 82 | done 83 | 84 | if test -z "$files"; then 85 | echo "$0: No files given. Try \`$0 --help' for more information." 1>&2 86 | exit 1 87 | fi 88 | 89 | # if basedir was given, then it should be prepended to filenames before 90 | # byte compilation. 91 | if [ -z "$basedir" ]; then 92 | pathtrans="path = file" 93 | else 94 | pathtrans="path = os.path.join('$basedir', file)" 95 | fi 96 | 97 | # if destdir was given, then it needs to be prepended to the filename to 98 | # byte compile but not go into the compiled file. 99 | if [ -z "$destdir" ]; then 100 | filetrans="filepath = path" 101 | else 102 | filetrans="filepath = os.path.normpath('$destdir' + os.sep + path)" 103 | fi 104 | 105 | $PYTHON -c " 106 | import sys, os, string, py_compile 107 | 108 | files = '''$files''' 109 | 110 | print 'Byte-compiling python modules...' 111 | for file in string.split(files): 112 | $pathtrans 113 | $filetrans 114 | if not os.path.exists(filepath) or not (len(filepath) >= 3 115 | and filepath[-3:] == '.py'): 116 | continue 117 | print file, 118 | sys.stdout.flush() 119 | py_compile.compile(filepath, filepath + 'c', path) 120 | print" || exit $? 121 | 122 | # this will fail for python < 1.5, but that doesn't matter ... 123 | $PYTHON -O -c " 124 | import sys, os, string, py_compile 125 | 126 | files = '''$files''' 127 | print 'Byte-compiling python modules (optimized versions) ...' 128 | for file in string.split(files): 129 | $pathtrans 130 | $filetrans 131 | if not os.path.exists(filepath) or not (len(filepath) >= 3 132 | and filepath[-3:] == '.py'): 133 | continue 134 | print file, 135 | sys.stdout.flush() 136 | py_compile.compile(filepath, filepath + 'o', path) 137 | print" 2>/dev/null || : 138 | 139 | # Local Variables: 140 | # mode: shell-script 141 | # sh-indentation: 2 142 | # eval: (add-hook 'write-file-hooks 'time-stamp) 143 | # time-stamp-start: "scriptversion=" 144 | # time-stamp-format: "%:y-%02m-%02d.%02H" 145 | # time-stamp-end: "$" 146 | # End: 147 | -------------------------------------------------------------------------------- /docs/html/examples/expression_tree.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | coinor.gimpy.examples.expression_tree API documentation 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 |
21 |
22 |

Module coinor.gimpy.examples.expression_tree

23 |
24 |
25 |
26 | 27 | Expand source code 28 | 29 |
from __future__ import print_function
30 | try:
31 |     from src.gimpy import BinaryTree
32 | except ImportError:
33 |     from coinor.gimpy import BinaryTree
34 |     
35 | T = BinaryTree()
36 | T.add_root('*')
37 | T.add_left_child('+', '*')
38 | T.add_left_child('4', '+')
39 | T.add_right_child('5', '+')
40 | T.add_right_child('7', '*')
41 | T.set_display_mode('matplotlib')
42 | T.display()
43 | T.printexp()
44 | print()
45 | T.postordereval()
46 | print()
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 | 71 |
72 | 75 | 76 | -------------------------------------------------------------------------------- /docs/html/examples/search.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | coinor.gimpy.examples.search API documentation 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 |
21 |
22 |

Module coinor.gimpy.examples.search

23 |
24 |
25 |
26 | 27 | Expand source code 28 | 29 |
try:
30 |     from src.gimpy import Graph, UNDIRECTED_GRAPH
31 | except ImportError:
32 |     from coinor.gimpy import Graph, UNDIRECTED_GRAPH
33 | 
34 | G = Graph(type = UNDIRECTED_GRAPH, splines = 'true', K = 1.5)
35 | G.random(numnodes = 10, Euclidean = True, seedInput = 11, 
36 |          #add_labels = True,
37 |          #scale = 10,
38 |          #scale_cost = 10,
39 |          #degree_range = (2, 4),
40 |          #length_range = (1, 10)
41 |          )
42 | G.set_display_mode('off')
43 | G.display()
44 | #G.dfs(0)
45 | G.search(0, display = 'off', algo = 'Dijkstra')
46 |         
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 | 71 |
72 | 75 | 76 | -------------------------------------------------------------------------------- /docs/html/examples/postordereval.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | coinor.gimpy.examples.postordereval API documentation 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 |
21 |
22 |

Module coinor.gimpy.examples.postordereval

23 |
24 |
25 |

Created on Oct 15, 2012

26 |

@author: tkr2

27 |
28 | 29 | Expand source code 30 | 31 |
'''
32 | Created on Oct 15, 2012
33 | 
34 | @author: tkr2
35 | '''
36 | from __future__ import print_function
37 | 
38 | from coinor.gimpy import BinaryTree
39 | 
40 | if __name__ == '__main__':
41 |     T = BinaryTree(display = 'off')
42 |     T.add_root(0, label = '*')
43 |     T.add_left_child(1, 0, label = '+')
44 |     T.add_left_child(2, 1, label = '4')
45 |     T.add_right_child(3, 1, label = '5')
46 |     T.add_right_child(4, 0, label = '7')
47 |     T.printexp(True)
48 |     print()
49 |     T.postordereval(True)
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 | 74 |
75 | 78 | 79 | -------------------------------------------------------------------------------- /src/gimpy/global_constants.py: -------------------------------------------------------------------------------- 1 | ''' 2 | This file has global constants required for GIMPy. 3 | ''' 4 | from past.builtins import basestring 5 | 6 | import re # for compile() 7 | 8 | class MultipleNodeException(Exception): 9 | pass 10 | 11 | class MultipleEdgeException(Exception): 12 | pass 13 | 14 | GRAPH_ATTRIBUTES = set( ['Damping', 'K', 'URL', 'aspect', 'bb', 'bgcolor', 15 | 'center', 'charset', 'clusterrank', 'colorscheme', 'comment', 'compound', 16 | 'concentrate', 'defaultdist', 'dim', 'dimen', 'diredgeconstraints', 17 | 'dpi', 'epsilon', 'esep', 'fontcolor', 'fontname', 'fontnames', 18 | 'fontpath', 'fontsize', 'id', 'label', 'labeljust', 'labelloc', 19 | 'landscape', 'layers', 'layersep', 'layout', 'levels', 'levelsgap', 20 | 'lheight', 'lp', 'lwidth', 'margin', 'maxiter', 'mclimit', 'mindist', 21 | 'mode', 'model', 'mosek', 'nodesep', 'nojustify', 'normalize', 'nslimit', 22 | 'nslimit1', 'ordering', 'orientation', 'outputorder', 'overlap', 23 | 'overlap_scaling', 'pack', 'packmode', 'pad', 'page', 'pagedir', 24 | 'quadtree', 'quantum', 'rankdir', 'ranksep', 'ratio', 'remincross', 25 | 'repulsiveforce', 'resolution', 'root', 'rotate', 'searchsize', 'sep', 26 | 'showboxes', 'size', 'smoothing', 'sortv', 'splines', 'start', 27 | 'stylesheet', 'target', 'truecolor', 'viewport', 'voro_margin', 28 | 'd2tgraphstyle', 29 | # for subgraphs 30 | 'rank']) 31 | DEFAULT_GRAPH_ATTRIBUTES = {} 32 | EDGE_ATTRIBUTES = set( ['URL', 'arrowhead', 'arrowsize', 'arrowtail', 33 | 'color', 'colorscheme', 'comment', 'constraint', 'decorate', 'dir', 34 | 'edgeURL', 'edgehref', 'edgetarget', 'edgetooltip', 'fontcolor', 35 | 'fontname', 'fontsize', 'headURL', 'headclip', 'headhref', 'headlabel', 36 | 'headport', 'headtarget', 'headtooltip', 'href', 'id', 'label', 37 | 'labelURL', 'labelangle', 'labeldistance', 'labelfloat', 'labelfontcolor', 38 | 'labelfontname', 'labelfontsize', 'labelhref', 'labeltarget', 39 | 'labeltooltip', 'layer', 'len', 'lhead', 'lp', 'ltail', 'minlen', 40 | 'nojustify', 'penwidth', 'pos', 'samehead', 'sametail', 'showboxes', 41 | 'style', 'tailURL', 'tailclip', 'tailhref', 'taillabel', 'tailport', 42 | 'tailtarget', 'tailtooltip', 'target', 'tooltip', 'weight', 43 | 'rank' ] ) 44 | DEFAULT_EDGE_ATTRIBUTES = {} 45 | NODE_ATTRIBUTES = set( ['URL', 'color', 'colorscheme', 'comment', 46 | 'distortion', 'fillcolor', 'fixedsize', 'fontcolor', 'fontname', 47 | 'fontsize', 'group', 'height', 'id', 'image', 'imagescale', 'label', 48 | 'labelloc', 'layer', 'margin', 'nojustify', 'orientation', 'penwidth', 49 | 'peripheries', 'pin', 'pos', 'rects', 'regular', 'root', 'samplepoints', 50 | 'shape', 'shapefile', 'showboxes', 'sides', 'skew', 'sortv', 'style', 51 | 'target', 'tooltip', 'vertices', 'width', 'z', 52 | # The following are attributes dot2tex 53 | 'texlbl', 'texmode' ] ) 54 | DEFAULT_NODE_ATTRIBUTES = {} 55 | CLUSTER_ATTRIBUTES = set( ['K', 'URL', 'bgcolor', 'color', 'colorscheme', 56 | 'fillcolor', 'fontcolor', 'fontname', 'fontsize', 'label', 'labeljust', 57 | 'labelloc', 'lheight', 'lp', 'lwidth', 'nojustify', 'pencolor', 58 | 'penwidth', 'peripheries', 'sortv', 'style', 'target', 'tooltip'] ) 59 | DIRECTED_GRAPH = 'digraph' 60 | UNDIRECTED_GRAPH = 'graph' 61 | #DEFAULT_ATTR = {'strict':None, 'name':'graph'} 62 | EDGE_CONNECT_SYMBOL = {DIRECTED_GRAPH:' -> ', UNDIRECTED_GRAPH:' -- '} 63 | DOT2TEX_INSTALLED = None # it wil be set when we try to import 64 | PIL_INSTALLED = None 65 | XDOT_INSTALLED = None 66 | ETREE_INSTALLED = None 67 | INF = 10000 68 | 69 | DOT2TEX_TEMPLATE = r''' 70 | \documentclass[landscape]{minimal} 71 | \usepackage[x11names, rgb]{xcolor} 72 | \usepackage[utf8]{inputenc} 73 | %\usepackage[margin=2cm,nohead]{geometry}% 74 | \usepackage[margin=2cm,a4paper]{geometry} 75 | \usepackage{graphicx} 76 | \setkeys{Gin}{keepaspectratio} 77 | \usepackage{tikz} 78 | \usetikzlibrary{snakes,arrows,shapes} 79 | \usepackage{amsmath} 80 | <>% 81 | \usepackage[active,auctex]{preview} 82 | <>% 83 | <>% 84 | <>% 85 | <>% 86 | 87 | \begin{document} 88 | \pagestyle{empty} 89 | % 90 | <>% 91 | <> 92 | <>% 93 | % 94 | <> 95 | \enlargethispage{100cm} 96 | % Start of code 97 | % \begin{tikzpicture}[anchor=mid,>=latex',join=bevel,<>] 98 | \resizebox{\textwidth}{\textheight}{ 99 | \begin{tikzpicture}[>=latex',join=bevel,<>] 100 | \pgfsetlinewidth{1bp} 101 | <>% 102 | <> 103 | <>% 104 | \end{tikzpicture} 105 | % End of code 106 | } 107 | <> 108 | % 109 | \end{document} 110 | % 111 | <> 112 | \begin{tikzpicture}[>=latex,join=bevel,<>] 113 | \pgfsetlinewidth{1bp} 114 | <>% 115 | <> 116 | <>% 117 | \end{tikzpicture} 118 | <> 119 | ''' 120 | 121 | # following globals and two methods are from pydot 122 | DOT_KEYWORDS = ['graph', 'subgraph', 'digraph', 'node', 'edge', 'strict'] 123 | ID_RE_ALPHA_NUMS = re.compile('^[_a-zA-Z][a-zA-Z0-9_,]*$', re.UNICODE) 124 | ID_RE_ALPHA_NUMS_WITH_PORTS = re.compile('^[_a-zA-Z][a-zA-Z0-9_,:\"]*[a-zA-Z0-9_,\"]+$', re.UNICODE) 125 | ID_RE_NUM = re.compile('^[0-9,]+$', re.UNICODE) 126 | ID_RE_WITH_PORT = re.compile('^([^:]*):([^:]*)$', re.UNICODE) 127 | ID_RE_DBL_QUOTED = re.compile('^\".*\"$', re.S|re.UNICODE) 128 | ID_RE_HTML = re.compile('^<.*>$', re.S|re.UNICODE) 129 | 130 | def quote_if_necessary(s): 131 | if isinstance(s, bool): 132 | if s is True: 133 | return 'True' 134 | return 'False' 135 | if not isinstance(s, basestring): 136 | return s 137 | if not s: 138 | return s 139 | if needs_quotes(s): 140 | replace = {'"' : r'\"', 141 | "\n" : r'\n', 142 | "\r" : r'\r', 143 | "\\ " : r'\\ '} 144 | for (a,b) in list(replace.items()): 145 | s = s.replace(a, b) 146 | return '"' + s + '"' 147 | return s 148 | 149 | def needs_quotes(s): 150 | """Checks whether a string is a dot language ID. 151 | It will check whether the string is solely composed 152 | by the characters allowed in an ID or not. 153 | If the string is one of the reserved keywords it will 154 | need quotes too but the user will need to add them 155 | manually. 156 | """ 157 | # If the name is a reserved keyword it will need quotes but pydot 158 | # can't tell when it's being used as a keyword or when it's simply 159 | # a name. Hence the user needs to supply the quotes when an element 160 | # would use a reserved keyword as name. This function will return 161 | # false indicating that a keyword string, if provided as-is, won't 162 | # need quotes. 163 | if s in DOT_KEYWORDS: 164 | return False 165 | chars = [ord(c) for c in s if ord(c)>0x7f or ord(c)==0] 166 | if chars and not ID_RE_DBL_QUOTED.match(s) and not ID_RE_HTML.match(s): 167 | return True 168 | for test_re in [ID_RE_ALPHA_NUMS, ID_RE_NUM, ID_RE_DBL_QUOTED, ID_RE_HTML, ID_RE_ALPHA_NUMS_WITH_PORTS]: 169 | if test_re.match(s): 170 | return False 171 | m = ID_RE_WITH_PORT.match(s) 172 | if m: 173 | return needs_quotes(m.group(1)) or needs_quotes(m.group(2)) 174 | return True 175 | -------------------------------------------------------------------------------- /docs/html/examples/milp1.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | coinor.gimpy.examples.milp1 API documentation 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 |
21 |
22 |

Module coinor.gimpy.examples.milp1

23 |
24 |
25 |
26 | 27 | Expand source code 28 | 29 |
#List of constraint index
 30 | CONSTRAINTS = ["Capacity"]
 31 | 
 32 | #Dictionary of objective function coefficients of variables
 33 | OBJ = {"x1" : 4,
 34 |        "x2" : 1,
 35 |        "x3" : 3,
 36 |        "x4" : 4,
 37 |        "x5" : 8,
 38 |        "x6" : 9,
 39 |        "x7" : 11,
 40 |        "x8" : 1,
 41 |        "x9" : 2,
 42 |        "x10": 0,
 43 |        "x11": 3,
 44 |        "x12": 1,
 45 |        "x13": 2,
 46 |        "x14": 3,
 47 |        "x15": 1}
 48 | 
 49 | #Dictionary of variable coefficients in each constraint (column)
 50 | MAT = {"x1" : [2], 
 51 |        "x2" : [4], 
 52 |        "x3" : [1], 
 53 |        "x4" : [6], 
 54 |        "x5" : [2], 
 55 |        "x6" : [5], 
 56 |        "x7" : [9], 
 57 |        "x8" : [4], 
 58 |        "x9" : [2], 
 59 |        "x10": [1], 
 60 |        "x11": [3], 
 61 |        "x12": [3], 
 62 |        "x13": [3], 
 63 |        "x14": [5], 
 64 |        "x15": [2]}
 65 | 
 66 | #Right hand side of the constraints
 67 | RHS = [29]
 68 | 
 69 | #List of variable indices
 70 | VARIABLES = list(OBJ.keys())
 71 | VARIABLES.sort()
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 | 96 |
97 | 100 | 101 | -------------------------------------------------------------------------------- /docs/html/examples/milp2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | coinor.gimpy.examples.milp2 API documentation 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 |
21 |
22 |

Module coinor.gimpy.examples.milp2

23 |
24 |
25 |
26 | 27 | Expand source code 28 | 29 |
#List of constraint index
 30 | CONSTRAINTS = ["Capacity", "Cardinality"]
 31 | 
 32 | #Dictionary of objective function coefficients of variables
 33 | OBJ = {"x1" : 4,
 34 |        "x2" : 1,
 35 |        "x3" : 3,
 36 |        "x4" : 4,
 37 |        "x5" : 8,
 38 |        "x6" : 9,
 39 |        "x7" : 11,
 40 |        "x8" : 1,
 41 |        "x9" : 2,
 42 |        "x10": 0,
 43 |        "x11": 3,
 44 |        "x12": 1,
 45 |        "x13": 2,
 46 |        "x14": 3,
 47 |        "x15": 1}
 48 | 
 49 | #Dictionary of variable coefficients in each constraint (column)
 50 | MAT = {"x1" : [2, 1], 
 51 |        "x2" : [4, 1], 
 52 |        "x3" : [1, 1], 
 53 |        "x4" : [6, 1], 
 54 |        "x5" : [2, 1], 
 55 |        "x6" : [5, 1], 
 56 |        "x7" : [9, 1], 
 57 |        "x8" : [4, 1], 
 58 |        "x9" : [2, 1], 
 59 |        "x10": [1, 1], 
 60 |        "x11": [3, 1], 
 61 |        "x12": [3, 1], 
 62 |        "x13": [3, 1], 
 63 |        "x14": [5, 1], 
 64 |        "x15": [2, 1]}
 65 | 
 66 | #Right hand side of the constraints
 67 | RHS = [29, 8]
 68 | 
 69 | #List of variable indices
 70 | #VARIABLES = OBJ.keys()
 71 | #VARIABLES.sort()
 72 | 
 73 | VARIABLES = ["x1", "x2", "x3", "x4", "x5", "x6", "x7", "x8", "x9", "x10", 
 74 |              "x11", "x12", "x13", "x14", "x15"]
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 | 99 |
100 | 103 | 104 | -------------------------------------------------------------------------------- /docs/html/examples/milp3.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | coinor.gimpy.examples.milp3 API documentation 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 |
21 |
22 |

Module coinor.gimpy.examples.milp3

23 |
24 |
25 |
26 | 27 | Expand source code 28 | 29 |
#List of constraint index
 30 | CONSTRAINTS = ["Capacity", "Budget", "Cardinality"]
 31 | 
 32 | #Dictionary of objective function coefficients of variables
 33 | OBJ = {"x1" : 4,
 34 |        "x2" : 1,
 35 |        "x3" : 3,
 36 |        "x4" : 4,
 37 |        "x5" : 8,
 38 |        "x6" : 9,
 39 |        "x7" : 11,
 40 |        "x8" : 1,
 41 |        "x9" : 2,
 42 |        "x10": 0,
 43 |        "x11": 3,
 44 |        "x12": 1,
 45 |        "x13": 2,
 46 |        "x14": 3,
 47 |        "x15": 1}
 48 | 
 49 | #Dictionary of variable coefficients in each constraint (column)
 50 | MAT = {"x1" : [2, 7, 1], 
 51 |        "x2" : [4, 2, 1], 
 52 |        "x3" : [1, 3, 1], 
 53 |        "x4" : [6, 5, 1], 
 54 |        "x5" : [2, 1, 1], 
 55 |        "x6" : [5, 7, 1], 
 56 |        "x7" : [9, 6, 1], 
 57 |        "x8" : [4, 4, 1], 
 58 |        "x9" : [2, 1, 1], 
 59 |        "x10": [1, 0, 1], 
 60 |        "x11": [3, 2, 1], 
 61 |        "x12": [3, 3, 1], 
 62 |        "x13": [3, 7, 1], 
 63 |        "x14": [5, 9, 1], 
 64 |        "x15": [2, 2, 1]}
 65 | 
 66 | #Right hand side of the constraints
 67 | RHS = [29, 35, 8]
 68 | 
 69 | #List of variable indices
 70 | VARIABLES = list(OBJ.keys())
 71 | VARIABLES.sort()
 72 | 
 73 | VARIABLES = ["x1", "x2", "x3", "x4", "x5", "x6", "x7", "x8", "x9", "x10", 
 74 |              "x11", "x12", "x13", "x14", "x15"]
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 | 99 |
100 | 103 | 104 | -------------------------------------------------------------------------------- /docs/html/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | coinor.gimpy API documentation 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 |
21 |
22 |

Package coinor.gimpy

23 |
24 |
25 |
26 | 27 | Expand source code 28 | 29 |
from __future__ import absolute_import
30 | from .global_constants import *
31 | from . import graph
32 | from . import examples
33 | from .tree import Tree
34 | from .tree import BinaryTree
35 | 
36 | Graph = graph.Graph
37 | DisjointSet = graph.DisjointSet
38 | MATPLOTLIB_INSTALLED = graph.MATPLOTLIB_INSTALLED
39 | DOT2TEX_INSTALLED = graph.DOT2TEX_INSTALLED
40 | PIL_INSTALLED = graph.PIL_INSTALLED
41 | XDOT_INSTALLED = graph.XDOT_INSTALLED
42 | ETREE_INSTALLED = graph.ETREE_INSTALLED
43 |
44 |
45 |
46 |

Sub-modules

47 |
48 |
coinor.gimpy.examples
49 |
50 |
51 |
52 |
coinor.gimpy.global_constants
53 |
54 |

This file has global constants required for GIMPy.

55 |
56 |
coinor.gimpy.graph
57 |
58 |

A Graph class implementation. The aim for this implementation is 59 | 1. To reflect implementation methods in literature as much as possible 60 | 3. To have …

61 |
62 |
coinor.gimpy.tree
63 |
64 |

Tree class built on top of Graph class.

65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 | 91 |
92 | 95 | 96 | -------------------------------------------------------------------------------- /docs/html/examples/forestry.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | coinor.gimpy.examples.forestry API documentation 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 |
21 |
22 |

Module coinor.gimpy.examples.forestry

23 |
24 |
25 |
26 | 27 | Expand source code 28 | 29 |
from builtins import str
 30 | from builtins import range
 31 | from coinor.gimpy import Graph
 32 | from coinor.gimpy import DIRECTED_GRAPH
 33 | 
 34 | import random
 35 | 
 36 | '''
 37 | # Here is some static data for testing
 38 | demand = [10,
 39 |           4,
 40 |           7]
 41 | 
 42 | harvest = [[7, 2],
 43 |            [3, 5],
 44 |            [2, 1]]
 45 | 
 46 | numForests = len(harvest[0])
 47 | numYears = len(demand)
 48 | '''
 49 | 
 50 | random.seed(0)
 51 | numForests = 2
 52 | numYears = 3
 53 | demand = [random.randint(25, 50) for i in range(numYears)]
 54 | harvest = [[random.randint(5, 10) for j in range(numForests)]
 55 |            for i in range(numYears)]
 56 | 
 57 | forest = ['f'+ str(i) for i in range(numForests)]
 58 | year = ['y'+ str(i) for i in range(numYears)]
 59 | 
 60 | g = Graph(display='off',type=DIRECTED_GRAPH, splines = 'true', K = 1.5,
 61 |           rankdir = 'LR', layout = 'dot')
 62 | 
 63 | for i in range(numYears):
 64 |     g.add_node(year[i], label = 'Total Production\nin Year %s' %(i+1))
 65 |     g.add_edge(year[i], 'sink', capacity = demand[i])
 66 | 
 67 | for j in range(numForests):
 68 |     g.add_node(forest[j], label = 'Forest ' + str(j+1))
 69 |     g.add_edge('source', forest[j])
 70 |     for i in range(numYears):
 71 |         g.add_node((forest[j], year[i]),
 72 |                    label = "Production\nof Forest %s\nin Year %s"%(str(j+1), str(i+1)))
 73 |         g.add_edge(forest[j], (forest[j], year[i]), capacity = harvest[i][j])
 74 |         g.add_edge((forest[j], year[i]), year[i])
 75 |     for i in range(numYears-1):
 76 |         g.add_edge((forest[j], year[i]), (forest[j], year[i+1]))
 77 | 
 78 | g.max_flow('source', 'sink')
 79 | g.set_display_mode('file')
 80 | g.display()
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 | 105 |
106 | 109 | 110 | -------------------------------------------------------------------------------- /src/gimpy/examples/prerequisites.py: -------------------------------------------------------------------------------- 1 | try: 2 | from src.gimpy import Graph 3 | except: 4 | from coinor.gimpy import Graph 5 | 6 | if __name__ == '__main__': 7 | G = Graph(type = 'digraph', splines = 'true', layout = 'dot', 8 | display = 'xdot', rankdir = 'LR', label = 'ISE Requirements and Prerequisite Map', 9 | fontsize = '120', labelloc = 't', size = "7.5,10.0!", ratio = 'fill', 10 | esep = '10', ranksep = '1.8', 11 | ) 12 | node_format = { 13 | # 'height':1.0, 14 | # 'width':2.0, 15 | # 'fixedsize':'true', 16 | 'fontsize': '60', 17 | # 'fontcolor':'red', 18 | 'shape': 'ellipse', 19 | 'style': 'bold', 20 | 'fontname': 'Times-Bold' 21 | } 22 | 23 | G.add_node('CSE 2', **node_format) 24 | G.add_node('Eng 10', **node_format) 25 | G.add_node('ISE 112', **node_format) 26 | G.add_edge('Eng 10', 'CSE 2') 27 | G.add_edge('CSE 2', 'ISE 112', style = 'invisible', arrowhead = 'none') 28 | G.add_node('ISE 172', **node_format) 29 | G.add_node('ISE 215/216', **node_format) 30 | G.add_node('CSE 17', **node_format) 31 | G.add_edge('CSE 2', 'CSE 17') 32 | G.add_edge('ISE 112', 'CSE 17', style = 'invisible', arrowhead = 'none') 33 | G.add_node('Mat 33', **node_format) 34 | G.add_edge('CSE 17', 'ISE 172') 35 | G.add_edge('Mat 33', 'ISE 215/216') 36 | G.add_node('ISE 305', **node_format) 37 | G.add_node('Math 21', **node_format) 38 | G.add_node('Physics 11/12', **node_format) 39 | G.add_edge('Math 21', 'Physics 11/12') 40 | G.add_node('Math 22', **node_format) 41 | G.add_edge('Math 21', 'Math 22') 42 | G.add_node('Physics 21/22', **node_format) 43 | G.add_edge('Physics 11/12', 'Physics 21/22') 44 | G.add_node('Math 23', **node_format) 45 | G.add_edge('Math 23', 'Physics 21/22', style = 'dashed') 46 | G.add_edge('Math 22', 'Math 23') 47 | G.add_node('ISE 111', **node_format) 48 | G.add_edge('Math 22', 'ISE 111') 49 | G.add_node('Math 205', **node_format) 50 | G.add_edge('Math 22', 'Math 205') 51 | G.add_node('ISE 121', **node_format) 52 | G.add_edge('ISE 111', 'ISE 121') 53 | G.add_node('Mech 2/3', **node_format) 54 | G.add_node('ME 104', **node_format) 55 | G.add_node('ECE 83/81', **node_format) 56 | G.add_node('CEE 170', **node_format) 57 | G.add_node('Chem 44', **node_format) 58 | G.add_edge('Physics 21/22', 'ECE 83/81', style = 'dashed') 59 | G.add_edge('Math 22', 'Mech 2/3', stlye = 'dashed') 60 | G.add_edge('Math 23', 'ME 104', style = 'dashed') 61 | G.add_edge('Physics 11/12', 'ME 104', style = 'dashed') 62 | G.add_node('ISE 240', **node_format) 63 | G.add_edge('Math 205', 'ISE 240') 64 | G.add_node('ISE 230', **node_format) 65 | G.add_edge('ISE 111', 'ISE 230') 66 | G.add_node('ISE 131/132', **node_format) 67 | G.add_edge('ISE 111', 'ISE 131/132', style = 'dashed') 68 | G.add_node('ISE 224', **node_format) 69 | G.add_edge('ISE 121', 'ISE 305') 70 | G.add_node('ISE 226', **node_format) 71 | G.add_edge('ISE 111', 'ISE 226') 72 | G.add_node('ISE 251', **node_format) 73 | G.add_edge('ISE 121', 'ISE 251') 74 | G.add_edge('ISE 240', 'ISE 251') 75 | G.add_edge('ISE 230', 'ISE 251') 76 | G.add_node('Engl 1', **node_format) 77 | G.add_node('Engl 2', **node_format) 78 | G.add_edge('Engl 1', 'Engl 2') 79 | G.add_node('Eng 5', **node_format) 80 | G.add_node('Chem 30', **node_format) 81 | G.add_node('Eco 1', **node_format) 82 | G.add_node('Acct 108', **node_format) 83 | G.add_node('ISE 154', **node_format) 84 | G.add_edge('Engl 2', 'Eng 5', style = 'invisible', arrowhead = 'none') 85 | G.add_edge('Eng 5', 'Chem 30', style = 'invisible', arrowhead = 'none') 86 | G.add_edge('Chem 30', 'Eco 1', style = 'invisible', arrowhead = 'none') 87 | G.add_edge('Eco 1', 'Acct 108', style = 'invisible', arrowhead = 'none') 88 | G.add_edge('Acct 108', 'ISE 154', style = 'invisible', arrowhead = 'none') 89 | G.add_node('ISE 339', **node_format) 90 | G.add_edge('ISE 230', 'ISE 339') 91 | G.add_node('ISE 316', **node_format) 92 | G.add_edge('ISE 240', 'ISE 316') 93 | G.add_node('ISE 347', **node_format) 94 | G.add_edge('ISE 316', 'ISE 347') 95 | G.add_node('ISE 275', **node_format) 96 | G.add_edge('ISE 224', 'ISE 275') 97 | G.add_node('ISE 372', **node_format) 98 | G.add_edge('ISE 275', 'ISE 372') 99 | G.add_node('ISE 358', **node_format) 100 | G.add_node('ISE 324', **node_format) 101 | G.add_edge('Math 205', 'ISE 324') 102 | G.add_node('ISE 332', **node_format) 103 | G.add_edge('ISE 121', 'ISE 332') 104 | G.add_node('ISE 362', **node_format) 105 | G.add_edge('ISE 230', 'ISE 362') 106 | G.add_edge('ISE 240', 'ISE 362') 107 | G.add_node('ISE 341', **node_format) 108 | G.add_edge('ISE 230', 'ISE 341') 109 | G.add_edge('ISE 224', 'ISE 341') 110 | G.add_edge('ISE 240', 'ISE 341') 111 | G.add_node('ISE 356', **node_format) 112 | G.add_edge('ISE 230', 'ISE 356') 113 | G.add_edge('ISE 240', 'ISE 356') 114 | G.add_node('ISE 355', **node_format) 115 | G.add_edge('ISE 240', 'ISE 355') 116 | G.add_node('ISE 321', **node_format) 117 | G.add_node('ISE 345', **node_format) 118 | G.add_edge('ISE 275', 'ISE 345') 119 | G.add_node('ISE 382', **node_format) 120 | G.add_node('ISE 334', **node_format) 121 | G.add_edge('ISE 240', 'ISE 372') 122 | G.add_edge('ISE 230', 'ISE 372') 123 | G.add_node('ISE 319', **node_format) 124 | G.add_edge('ISE 131/132', 'ISE 319') 125 | G.add_node('ISE 340', **node_format) 126 | G.add_edge('ISE 215/216', 'ISE 340') 127 | G.add_node('ISE 344', **node_format) 128 | G.add_edge('ISE 215/216', 'ISE 344') 129 | G.add_node('CSE 2xx', label = 'CSE 2xx \n except \n 241/252', **node_format) 130 | G.add_node('CSE 3xx', **node_format) 131 | G.add_node('BIS 3xx', **node_format) 132 | G.add_node('Math 230', **node_format) 133 | G.add_node('Math 251', **node_format) 134 | G.add_node('ISE 156', label = 'ISE 156\nMust take\nISE 155\nas FE', **node_format) 135 | G.add_edge('ISE 362', 'CSE 2xx', style = 'invisible', arrowhead = 'none') 136 | G.add_edge('ISE 362', 'CSE 3xx', style = 'invisible', arrowhead = 'none') 137 | G.add_edge('ISE 362', 'BIS 3xx', style = 'invisible', arrowhead = 'none') 138 | G.add_edge('ISE 362', 'Math 230', style = 'invisible', arrowhead = 'none') 139 | G.add_edge('ISE 362', 'Math 251', style = 'invisible', arrowhead = 'none') 140 | G.add_edge('ISE 362', 'ISE 334', style = 'invisible', arrowhead = 'none') 141 | G.add_edge('ISE 362', 'ISE 382', style = 'invisible', arrowhead = 'none') 142 | G.add_edge('ISE 362', 'ISE 156', style = 'invisible', arrowhead = 'none') 143 | 144 | cluster_attrs = {'fontsize' : '72'} #, 'style' : 'bold'} 145 | 146 | cluster_attrs.update({'name': 'Tracks', 'label': 'Choose One'}) 147 | G.create_cluster(['ISE 172', 'ISE 215/216'], cluster_attrs) 148 | 149 | cluster_attrs.update({'name':'English', 'label':'English Requirements'}) 150 | G.create_cluster(['Engl 1', 'Engl 2'], cluster_attrs) 151 | 152 | cluster_attrs.update({'name': 'Eng', 'label':'Engineering Electives\nChoose At Least Four'}) 153 | G.create_cluster(['Mech 2/3', 'ME 104', 'ECE 83/81', 'CEE 170', 'Chem 44', 154 | 'CSE 17', 'Mat 33'], cluster_attrs) 155 | 156 | cluster_attrs.update({'name':'Isolated', 'label':'Miscellaneous Requirements'}) 157 | G.create_cluster(['Eng 5', 'Chem 30', 'Eco 1', 'Acct 108', 'ISE 154'], cluster_attrs) 158 | 159 | cluster_attrs.update({'name':'TE', 160 | 'label':'Technical Electives\nChoose at Least 4\n(at Least 2 ISE)'}) 161 | G.create_cluster(['ISE 339', 'ISE 316', 'ISE 347', 'ISE 275', 'ISE 358', 'ISE 324', 162 | 'ISE 332', 'ISE 362', 'ISE 341', 'ISE 356', 'ISE 355', 'ISE 321', 163 | 'ISE 345', 'ISE 382', 'ISE 334', 'ISE 372', 'ISE 319', 'ISE 340', 164 | 'ISE 344', 'CSE 2xx', 'Math 251', 'BIS 3xx', 'CSE 3xx', 'Math 230', 165 | 'ISE 156'], 166 | cluster_attrs) 167 | 168 | cluster_attrs.update({'name':'Computing', 'label':'Computing Requirements'}) 169 | G.create_cluster(['CSE 2', 'Eng 10', 'ISE 112'], cluster_attrs) 170 | 171 | G.set_display_mode('xdot') 172 | 173 | G.display(basename = 'ISERequirements', format = 'pdf') 174 | -------------------------------------------------------------------------------- /docs/html/examples/SAT.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | coinor.gimpy.examples.SAT API documentation 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 |
21 |
22 |

Module coinor.gimpy.examples.SAT

23 |
24 |
25 |
26 | 27 | Expand source code 28 | 29 |
from __future__ import print_function
 30 | try:
 31 |     from src.gimpy import Graph
 32 | except ImportError:
 33 |     from coinor.gimpy import Graph
 34 | 
 35 | if __name__ == '__main__':
 36 |     G = Graph(graph_type = 'digraph', splines = 'true', layout = 'dot2tex', 
 37 |               display = 'off', rankdir = 'LR', fontsize = '44', 
 38 |               d2tgraphstyle = 'every text node part/.style={align=left}',
 39 |               )
 40 |     node_format = {
 41 | #                   'height':1.0,
 42 | #                   'width':2.0,
 43 | #                   'fixedsize':'true',
 44 | #                   'fontsize':'36',
 45 | #                   'fontcolor':'red',
 46 |                     'shape':'rect',
 47 |                    }
 48 | 
 49 |     G.add_node('0', label = r'C_1 = x_1 \mid x_2$ \\ $C_2 = x_2 \mid x_3', **node_format)
 50 |     G.add_node('1', label = r'C_1 = \text{TRUE}$ \\ $C_2 = x_2 \mid x_3', **node_format)
 51 |     G.add_node('2', label = r'C_1 = x_2$ \\ $C_2 = x_2 \mid x_3', **node_format)
 52 |     G.add_node('3', label = r'C_1 = \text{TRUE}$ \\ $C_2 = \text{TRUE}', color = 'green', **node_format)
 53 |     G.add_node('4', label = r'C_1 = \text{TRUE}$ \\ $C_2 = x_3', **node_format)
 54 |     G.add_node('5', label = r'C_1 = \text{TRUE}$ \\ $C_2 = \text{TRUE}', color = 'green', **node_format)
 55 |     G.add_node('6', label = r'C_1 = \text{FALSE}$ \\ $C_2 = x_3', color = 'red', **node_format)
 56 |     G.add_node('9', label = r'C_1 = \text{TRUE}$ \\ $C_2 = \text{TRUE}', color = 'green', **node_format)
 57 |     G.add_node('10', label = r'C_1 = \text{FALSE}$ \\ $C_2 = \text{FALSE}', color = 'red', **node_format)
 58 |     G.add_edge('0', '1', label = r'x_1 = \text{TRUE}')
 59 |     G.add_edge('0', '2', label = r'x_1 = \text{FALSE}')
 60 |     G.add_edge('1', '3', label = r'x_2 = \text{TRUE}')
 61 |     G.add_edge('1', '4', label = r'x_2 = \text{FALSE}')
 62 |     G.add_edge('2', '5', label = r'x_2 = \text{TRUE}')
 63 |     G.add_edge('2', '6', label = r'x_2 = \text{FALSE}')
 64 |     G.add_edge('4', '9', label = r'x_3 = \text{TRUE}')
 65 |     G.add_edge('4', '10', label = r'x_3 = \text{FALSE}')
 66 |     
 67 |     G.set_display_mode('file')
 68 | 
 69 |     print(G)
 70 | 
 71 |     G.display(basename='Turing')
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 | 96 |
97 | 100 | 101 | -------------------------------------------------------------------------------- /docs/html/examples/maxflow.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | coinor.gimpy.examples.maxflow API documentation 8 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 |
23 |
24 |

Module coinor.gimpy.examples.maxflow

25 |
26 |
27 |

Small example for demonstrating flow agumenting path (ford-fulkerson) 28 | algorithm. 29 | This example is taken from youtube lecture series on Advanced Operations 30 | Research by Prof. G.Srinivasan. 31 | Link to the video is: 32 | http://www.youtube.com/watch?v=J0wzih3_5Wo

33 |

black: there is no flow on the arc 34 | red 35 | : the flow equals to the arc capacity 36 | green: there is positive flow on the arc, less then capacity.

37 |
38 | 39 | Expand source code 40 | 41 |
'''
 42 | Small example for demonstrating flow agumenting path (ford-fulkerson)
 43 | algorithm.
 44 | This example is taken from youtube lecture series on Advanced Operations
 45 | Research by Prof. G.Srinivasan.
 46 | Link to the video is:
 47 | http://www.youtube.com/watch?v=J0wzih3_5Wo
 48 | 
 49 | black: there is no flow on the arc
 50 | red  : the flow equals to the arc capacity
 51 | green: there is positive flow on the arc, less then capacity.
 52 | '''
 53 | from __future__ import print_function
 54 | 
 55 | try:
 56 |     from src.gimpy import Graph, DIRECTED_GRAPH
 57 | except ImportError:
 58 |     from coinor.gimpy import Graph, DIRECTED_GRAPH
 59 | 
 60 | if __name__=='__main__':
 61 |     g = Graph(type = DIRECTED_GRAPH, display = 'off')
 62 |     g.add_node(1,pos='"0,2!"')
 63 |     
 64 |     g.add_node(3,pos='"2,4!"')
 65 |     g.add_node(2,pos='"2,0!"')
 66 |     g.add_node(4,pos='"4,2!"')
 67 |     g.add_node(6,pos='"6,4!"')
 68 |     
 69 |     g.add_node(5,pos='"6,0!"')
 70 |     g.add_node(7,pos='"8,2!"')
 71 |     g.add_edge(1, 3, capacity=40, label='40')
 72 |     g.add_edge(1, 2, capacity=40, label='40')
 73 |     g.add_edge(3, 4, capacity=10, label='10')
 74 |     g.add_edge(3, 6, capacity=10, label='10')
 75 |     g.add_edge(2, 4, capacity=15, label='15')
 76 |     g.add_edge(2, 5, capacity=20, label='20')
 77 |     g.add_edge(4, 6, capacity=20, label='20')
 78 |     g.add_edge(4, 7, capacity=10, label='10')
 79 |     g.add_edge(4, 5, capacity=10, label='10')
 80 |     g.add_edge(6, 7, capacity=30, label='30')
 81 |     g.add_edge(5, 7, capacity=20, label='20')
 82 |     g.set_display_mode('off')
 83 | 
 84 | #    g.max_flow_preflowpush(1, 7, algo = 'HighestLabel')
 85 |     g.max_flow(1, 7, algo = 'BFS')
 86 |     
 87 |     nl = list(int(n) for n in g.get_node_list())
 88 |     nl.sort()
 89 |     for n in nl:
 90 |         for m in nl:
 91 |             if g.check_edge(n, m):
 92 |                 print(n, m, g.get_edge_attr(n, m, 'flow'))
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 | 117 |
118 | 121 | 122 | -------------------------------------------------------------------------------- /docs/html/examples/mincostflow.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | coinor.gimpy.examples.mincostflow API documentation 8 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 |
23 |
24 |

Module coinor.gimpy.examples.mincostflow

25 |
26 |
27 |

Small example for demonstrating flow agumenting path (ford-fulkerson) 28 | algorithm. 29 | This example is taken from youtube lecture series on Advanced Operations 30 | Research by Prof. G.Srinivasan. 31 | Link to the video is: 32 | http://www.youtube.com/watch?v=J0wzih3_5Wo

33 |

black: there is no flow on the arc 34 | red 35 | : the flow equals to the arc capacity 36 | green: there is positive flow on the arc, less then capacity.

37 |
38 | 39 | Expand source code 40 | 41 |
'''
 42 | Small example for demonstrating flow agumenting path (ford-fulkerson)
 43 | algorithm.
 44 | This example is taken from youtube lecture series on Advanced Operations
 45 | Research by Prof. G.Srinivasan.
 46 | Link to the video is:
 47 | http://www.youtube.com/watch?v=J0wzih3_5Wo
 48 | 
 49 | black: there is no flow on the arc
 50 | red  : the flow equals to the arc capacity
 51 | green: there is positive flow on the arc, less then capacity.
 52 | '''
 53 | from __future__ import print_function
 54 | 
 55 | try:
 56 |     from src.gimpy import Graph, DIRECTED_GRAPH
 57 | except ImportError:
 58 |     from coinor.gimpy import Graph, DIRECTED_GRAPH
 59 | 
 60 | if __name__=='__main__':
 61 |     g = Graph(type = DIRECTED_GRAPH, display = 'off')
 62 |     g.add_node(1,pos='"0,2!"', demand=4, label='(1, 4)')
 63 | 
 64 |     g.add_node(3,pos='"2,4!"', demand=0)
 65 |     g.add_node(2,pos='"2,0!"', demand=0)
 66 |     g.add_node(4,pos='"4,2!"', demand=0)
 67 |     g.add_node(6,pos='"6,4!"', demand=0)
 68 | 
 69 |     g.add_node(5,pos='"6,0!"', demand=0)
 70 |     g.add_node(7,pos='"8,2!"', demand=-4, label='(1, -4)')
 71 |     g.add_edge(1, 3, cost=0, capacity=2, label='(0, 2)')
 72 |     g.add_edge(1, 2, cost=0, capacity=2, label='(0, 2)')
 73 |     g.add_edge(3, 4, cost=1, capacity=1, label='(1, 1)')
 74 |     g.add_edge(3, 6, cost=2, capacity=2, label='(2, 2)')
 75 |     g.add_edge(2, 4, cost=3, capacity=1, label='(3, 1)')
 76 |     g.add_edge(2, 5, cost=5, capacity=1, label='(5, 1)')
 77 |     g.add_edge(4, 6, cost=1, capacity=3, label='(1, 3)')
 78 |     g.add_edge(4, 7, cost=4, capacity=2, label='(4, 2)')
 79 |     g.add_edge(4, 5, cost=1, capacity=1, label='(3, 1)')
 80 |     g.add_edge(6, 7, cost=0, capacity=2, label='(0, 2)')
 81 |     g.add_edge(5, 7, cost=0, capacity=2, label='(0, 2)')
 82 |     g.set_display_mode('off')
 83 |     g.display()
 84 |     
 85 | #    g.cycle_canceling('matplotlib')
 86 |     g.min_cost_flow(algo='cycle_canceling')
 87 | #    g.max_flow(1, 7)
 88 | 
 89 |     nl = list(int(n) for n in g.get_node_list())
 90 |     nl.sort()
 91 |     for n in nl:
 92 |         for m in nl:
 93 |             if g.check_edge(n, m):
 94 |                 print(n, m, g.get_edge_attr(n, m, 'flow'))
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | 119 |
120 | 123 | 124 | -------------------------------------------------------------------------------- /src/gimpy/examples/simplex_test.py: -------------------------------------------------------------------------------- 1 | ''' 2 | tests network simplex method and cycle canceling method of GIMPy. 3 | 4 | ''' 5 | from __future__ import print_function 6 | from builtins import str 7 | from builtins import range 8 | 9 | from coinor.gimpy import Graph, DIRECTED_GRAPH 10 | from random import seed, randint, random 11 | from pulp import LpProblem, LpVariable, LpMinimize, lpSum, value, GLPK 12 | import time 13 | 14 | # global variables, experimental parameters 15 | capacity_range = (10,20) 16 | cost_range = (30,50) 17 | demand_range = (10,15) 18 | demand_numnodes = 3 19 | supply_numnodes = 2 20 | numnodes = 6 21 | density = 0.4 22 | 23 | #testing 24 | # nodes 10, 15, 20, 25, 30 25 | # arcs sparse 20, 30, 45, 65, 90 26 | # arcs dense 35, 80, 150, 200, 300 27 | 28 | def get_solution(g): 29 | ''' 30 | returns optimal solution (optimal flows) of min cost flow problem for a 31 | given graph instance g. return type is dictionary, keys are edge keys values 32 | are int. 33 | ''' 34 | sol = {} 35 | for e in g.get_edge_list(): 36 | sol[e] = g.get_edge_attr(e[0],e[1],'flow') 37 | return sol 38 | 39 | def generate_graph(seed_i): 40 | g = mGraph(type=DIRECTED_GRAPH, splines='true', layout = 'dot') 41 | #g = mGraph(type=DIRECTED_GRAPH) 42 | seed(seed_i) 43 | for i in range(numnodes): 44 | for j in range(numnodes): 45 | if i==j: 46 | continue 47 | if (i, j) in g.get_edge_list(): 48 | continue 49 | if (j, i) in g.get_edge_list(): 50 | continue 51 | if random() < density: 52 | cap = randint(capacity_range[0], capacity_range[1]) 53 | cos = randint(cost_range[0], cost_range[1]) 54 | g.add_edge(i, j, cost=cos, capacity=cap) 55 | # set supply/demand 56 | # select random demand_numnodes many nodes 57 | demand_node = {} 58 | while len(demand_node) < demand_numnodes: 59 | n = randint(0,numnodes-1) 60 | if n in demand_node: 61 | continue 62 | demand_node[n] = 0 63 | # select random supply_numnodes many nodes (different than above) 64 | supply_node = {} 65 | while len(supply_node) < supply_numnodes: 66 | n = randint(0,numnodes-1) 67 | if n in demand_node or n in supply_node: 68 | continue 69 | supply_node[n] = 0 70 | # set demand amounts 71 | total_demand = 0 72 | for n in demand_node: 73 | demand_node[n] = randint(demand_range[0], demand_range[1]) 74 | total_demand += demand_node[n] 75 | # set supply amounts 76 | total_supply = 0 77 | for n in supply_node: 78 | supply_node[n] = randint(demand_range[0], demand_range[1]) 79 | total_supply += supply_node[n] 80 | if total_demand > total_supply: 81 | # this line may create random behavior, because of dictionary query 82 | for n in supply_node: 83 | excess = total_demand-total_supply 84 | supply_node[n] += excess 85 | break 86 | elif total_demand < total_supply: 87 | for n in demand_node: 88 | excess = total_supply-total_demand 89 | demand_node[n] += excess 90 | break 91 | # set demand attributes 92 | for n in g.get_node_list(): 93 | if n in demand_node: 94 | g.set_node_attr(n, 'demand', -1*demand_node[n]) 95 | elif n in supply_node: 96 | g.set_node_attr(n, 'demand', supply_node[n]) 97 | else: 98 | g.set_node_attr(n, 'demand', 0) 99 | return g, demand_node, supply_node 100 | 101 | def get_obj_value(g): 102 | el = g.get_edge_list() 103 | cost = 0 104 | for e in el: 105 | cost_e = g.get_edge_attr(e[0], e[1], 'cost') 106 | flow_e = g.get_edge_attr(e[0], e[1], 'flow') 107 | cost += cost_e*flow_e 108 | return cost 109 | 110 | def solve(g): 111 | el = g.get_edge_list() 112 | nl = g.get_node_list() 113 | p = LpProblem('min_cost', LpMinimize) 114 | capacity = {} 115 | cost = {} 116 | demand = {} 117 | x = {} 118 | for e in el: 119 | capacity[e] = g.get_edge_attr(e[0], e[1], 'capacity') 120 | cost[e] = g.get_edge_attr(e[0], e[1], 'cost') 121 | for i in nl: 122 | demand[i] = g.get_node_attr(i, 'demand') 123 | for e in el: 124 | x[e] = LpVariable("x"+str(e), 0, capacity[e]) 125 | # add obj 126 | objective = lpSum (cost[e]*x[e] for e in el) 127 | p += objective 128 | # add constraints 129 | for i in nl: 130 | out_neig = g.get_out_neighbors(i) 131 | in_neig = g.get_in_neighbors(i) 132 | p += lpSum(x[(i,j)] for j in out_neig) -\ 133 | lpSum(x[(j,i)] for j in in_neig)==demand[i] 134 | p.solve() 135 | return x, value(objective) 136 | 137 | class mGraph(Graph): 138 | 139 | def __init__(self, **attrs): 140 | Graph.__init__(self, **attrs) 141 | 142 | def network_simplex(self, display, pivot, root): 143 | ''' 144 | API: 145 | network_simplex(self, display, pivot) 146 | Description: 147 | Solves minimum cost feasible flow problem using network simplex 148 | algorithm. It is recommended to use min_cost_flow(algo='simplex') 149 | instead of using network_simplex() directly. Returns True when an 150 | optimal solution is found, returns False otherwise. 'flow' attribute 151 | values of arcs should be considered as junk when returned False. 152 | Pre: 153 | (1) check Pre section of min_cost_flow() 154 | Inputs: 155 | pivot: specifies pivot rule. Check min_cost_flow() 156 | display: 'off' for no display, 'matplotlib' for live update of 157 | spanning tree. 158 | Post: 159 | (1) Changes 'flow' attribute of edges. 160 | Return: 161 | Returns True when an optimal solution is found, returns 162 | False otherwise. 163 | ''' 164 | # ==== determine an initial tree structure (T,L,U) 165 | # find a feasible flow 166 | iter = 0 167 | if not self.find_feasible_flow(): 168 | return (False, iter) 169 | t = self.simplex_find_tree() 170 | # mark spanning tree arcs 171 | self.simplex_mark_st_arcs(t) 172 | self.set_display_mode(display) 173 | # display initial spanning tree 174 | self.display() 175 | self.set_display_mode('off') 176 | # set predecessor, depth and thread indexes 177 | t.simplex_search(root, 1) 178 | # compute potentials 179 | self.simplex_compute_potentials(t, root) 180 | # while some nontree arc violates optimality conditions 181 | while not self.simplex_optimal(t): 182 | self.set_display_mode(display) 183 | self.display() 184 | self.set_display_mode('off') 185 | # select an entering arc (k,l) 186 | (k,l) = self.simplex_select_entering_arc(t, pivot) 187 | self.simplex_mark_entering_arc(k, l) 188 | # determine leaving arc 189 | ((p,q), capacity, cycle)=self.simplex_determine_leaving_arc(t,k,l) 190 | # mark leaving arc 191 | self.simplex_mark_leaving_arc(p, q) 192 | self.set_display_mode(display) 193 | # display after marking leaving arc 194 | self.display() 195 | self.simplex_mark_st_arcs(t) 196 | self.display() 197 | self.set_display_mode('off') 198 | # remove arc 199 | self.simplex_remove_arc(t, p, q, capacity, cycle) 200 | # set predecessor, depth and thread indexes 201 | t.simplex_search(root, 1) 202 | # compute potentials 203 | self.simplex_compute_potentials(t, root) 204 | return (True, iter) 205 | 206 | if __name__=='__main__': 207 | print() 208 | dantzig_file = open('dantzig_results.txt', 'w') 209 | eligible_file = open('eligible_results.txt', 'w') 210 | dantzig_file.write('# seed, simplex obj value, pulp obj value,'+\ 211 | ' time, iteration\n') 212 | eligible_file.write('# seed, simplex obj value, pulp obj value,'+\ 213 | ' time, iteration\n') 214 | for seed_i in range(0,100): 215 | g, d, s = generate_graph(seed_i) 216 | root = 0 217 | #==========solve using simplex, first eligible 218 | start = time.perf_counter() 219 | tup = g.network_simplex('off', 'first_eligible', root) 220 | elapsed_time = time.perf_counter() - start 221 | if tup[0]: 222 | sol = get_solution(g) 223 | eligible_obj_value = get_obj_value(g) 224 | else: 225 | # skip infeasible ones 226 | continue 227 | # set obj value to 0 if the problem is infeasible. 228 | eligible_obj_value = 0.0 229 | #==========solve using pulp 230 | x, pulp_obj_value = solve(g) 231 | pulp_obj_value = int(pulp_obj_value) 232 | # check success of simplex with first eligible 233 | flag = True 234 | if eligible_obj_value != pulp_obj_value: 235 | flag = False 236 | e_line = str(seed_i).ljust(5)+str(eligible_obj_value).ljust(6)+\ 237 | str(pulp_obj_value).ljust(6)+str(elapsed_time).ljust(7)+str(tup[1])+'\n' 238 | eligible_file.write(e_line) 239 | #==========solve using simplex, dantzig 240 | start = time.perf_counter() 241 | tup = g.network_simplex('off', 'dantzig', root) 242 | elapsed_time = time.perf_counter() - start 243 | if tup[0]: 244 | sol = get_solution(g) 245 | dantzig_obj_value = get_obj_value(g) 246 | else: 247 | # set obj value to 0 if the problem is infeasible. 248 | simplex_obj_value = 0.0 249 | # write to file 250 | d_line = str(seed_i).ljust(5)+str(dantzig_obj_value).ljust(6)+\ 251 | str(pulp_obj_value).ljust(6)+str(elapsed_time).ljust(7)+str(tup[1])+'\n' 252 | dantzig_file.write(d_line) 253 | flag = True 254 | if dantzig_obj_value != pulp_obj_value: 255 | flag = False 256 | dantzig_file.close() 257 | eligible_file.close() 258 | if flag: 259 | print('All problems solved accurately.') 260 | -------------------------------------------------------------------------------- /install-sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # install - install a program, script, or datafile 3 | 4 | scriptversion=2005-05-14.22 5 | 6 | # This originates from X11R5 (mit/util/scripts/install.sh), which was 7 | # later released in X11R6 (xc/config/util/install.sh) with the 8 | # following copyright and license. 9 | # 10 | # Copyright (C) 1994 X Consortium 11 | # 12 | # Permission is hereby granted, free of charge, to any person obtaining a copy 13 | # of this software and associated documentation files (the "Software"), to 14 | # deal in the Software without restriction, including without limitation the 15 | # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 16 | # sell copies of the Software, and to permit persons to whom the Software is 17 | # furnished to do so, subject to the following conditions: 18 | # 19 | # The above copyright notice and this permission notice shall be included in 20 | # all copies or substantial portions of the Software. 21 | # 22 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 26 | # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- 27 | # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | # 29 | # Except as contained in this notice, the name of the X Consortium shall not 30 | # be used in advertising or otherwise to promote the sale, use or other deal- 31 | # ings in this Software without prior written authorization from the X Consor- 32 | # tium. 33 | # 34 | # 35 | # FSF changes to this file are in the public domain. 36 | # 37 | # Calling this script install-sh is preferred over install.sh, to prevent 38 | # `make' implicit rules from creating a file called install from it 39 | # when there is no Makefile. 40 | # 41 | # This script is compatible with the BSD install script, but was written 42 | # from scratch. It can only install one file at a time, a restriction 43 | # shared with many OS's install programs. 44 | 45 | # set DOITPROG to echo to test this script 46 | 47 | # Don't use :- since 4.3BSD and earlier shells don't like it. 48 | doit="${DOITPROG-}" 49 | 50 | # put in absolute paths if you don't have them in your path; or use env. vars. 51 | 52 | mvprog="${MVPROG-mv}" 53 | cpprog="${CPPROG-cp}" 54 | chmodprog="${CHMODPROG-chmod}" 55 | chownprog="${CHOWNPROG-chown}" 56 | chgrpprog="${CHGRPPROG-chgrp}" 57 | stripprog="${STRIPPROG-strip}" 58 | rmprog="${RMPROG-rm}" 59 | mkdirprog="${MKDIRPROG-mkdir}" 60 | 61 | chmodcmd="$chmodprog 0755" 62 | chowncmd= 63 | chgrpcmd= 64 | stripcmd= 65 | rmcmd="$rmprog -f" 66 | mvcmd="$mvprog" 67 | src= 68 | dst= 69 | dir_arg= 70 | dstarg= 71 | no_target_directory= 72 | 73 | usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE 74 | or: $0 [OPTION]... SRCFILES... DIRECTORY 75 | or: $0 [OPTION]... -t DIRECTORY SRCFILES... 76 | or: $0 [OPTION]... -d DIRECTORIES... 77 | 78 | In the 1st form, copy SRCFILE to DSTFILE. 79 | In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. 80 | In the 4th, create DIRECTORIES. 81 | 82 | Options: 83 | -c (ignored) 84 | -d create directories instead of installing files. 85 | -g GROUP $chgrpprog installed files to GROUP. 86 | -m MODE $chmodprog installed files to MODE. 87 | -o USER $chownprog installed files to USER. 88 | -s $stripprog installed files. 89 | -t DIRECTORY install into DIRECTORY. 90 | -T report an error if DSTFILE is a directory. 91 | --help display this help and exit. 92 | --version display version info and exit. 93 | 94 | Environment variables override the default commands: 95 | CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG 96 | " 97 | 98 | while test -n "$1"; do 99 | case $1 in 100 | -c) shift 101 | continue;; 102 | 103 | -d) dir_arg=true 104 | shift 105 | continue;; 106 | 107 | -g) chgrpcmd="$chgrpprog $2" 108 | shift 109 | shift 110 | continue;; 111 | 112 | --help) echo "$usage"; exit $?;; 113 | 114 | -m) chmodcmd="$chmodprog $2" 115 | shift 116 | shift 117 | continue;; 118 | 119 | -o) chowncmd="$chownprog $2" 120 | shift 121 | shift 122 | continue;; 123 | 124 | -s) stripcmd=$stripprog 125 | shift 126 | continue;; 127 | 128 | -t) dstarg=$2 129 | shift 130 | shift 131 | continue;; 132 | 133 | -T) no_target_directory=true 134 | shift 135 | continue;; 136 | 137 | --version) echo "$0 $scriptversion"; exit $?;; 138 | 139 | *) # When -d is used, all remaining arguments are directories to create. 140 | # When -t is used, the destination is already specified. 141 | test -n "$dir_arg$dstarg" && break 142 | # Otherwise, the last argument is the destination. Remove it from $@. 143 | for arg 144 | do 145 | if test -n "$dstarg"; then 146 | # $@ is not empty: it contains at least $arg. 147 | set fnord "$@" "$dstarg" 148 | shift # fnord 149 | fi 150 | shift # arg 151 | dstarg=$arg 152 | done 153 | break;; 154 | esac 155 | done 156 | 157 | if test -z "$1"; then 158 | if test -z "$dir_arg"; then 159 | echo "$0: no input file specified." >&2 160 | exit 1 161 | fi 162 | # It's OK to call `install-sh -d' without argument. 163 | # This can happen when creating conditional directories. 164 | exit 0 165 | fi 166 | 167 | for src 168 | do 169 | # Protect names starting with `-'. 170 | case $src in 171 | -*) src=./$src ;; 172 | esac 173 | 174 | if test -n "$dir_arg"; then 175 | dst=$src 176 | src= 177 | 178 | if test -d "$dst"; then 179 | mkdircmd=: 180 | chmodcmd= 181 | else 182 | mkdircmd=$mkdirprog 183 | fi 184 | else 185 | # Waiting for this to be detected by the "$cpprog $src $dsttmp" command 186 | # might cause directories to be created, which would be especially bad 187 | # if $src (and thus $dsttmp) contains '*'. 188 | if test ! -f "$src" && test ! -d "$src"; then 189 | echo "$0: $src does not exist." >&2 190 | exit 1 191 | fi 192 | 193 | if test -z "$dstarg"; then 194 | echo "$0: no destination specified." >&2 195 | exit 1 196 | fi 197 | 198 | dst=$dstarg 199 | # Protect names starting with `-'. 200 | case $dst in 201 | -*) dst=./$dst ;; 202 | esac 203 | 204 | # If destination is a directory, append the input filename; won't work 205 | # if double slashes aren't ignored. 206 | if test -d "$dst"; then 207 | if test -n "$no_target_directory"; then 208 | echo "$0: $dstarg: Is a directory" >&2 209 | exit 1 210 | fi 211 | dst=$dst/`basename "$src"` 212 | fi 213 | fi 214 | 215 | # This sed command emulates the dirname command. 216 | dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'` 217 | 218 | # Make sure that the destination directory exists. 219 | 220 | # Skip lots of stat calls in the usual case. 221 | if test ! -d "$dstdir"; then 222 | defaultIFS=' 223 | ' 224 | IFS="${IFS-$defaultIFS}" 225 | 226 | oIFS=$IFS 227 | # Some sh's can't handle IFS=/ for some reason. 228 | IFS='%' 229 | set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` 230 | shift 231 | IFS=$oIFS 232 | 233 | pathcomp= 234 | 235 | while test $# -ne 0 ; do 236 | pathcomp=$pathcomp$1 237 | shift 238 | if test ! -d "$pathcomp"; then 239 | $mkdirprog "$pathcomp" 240 | # mkdir can fail with a `File exist' error in case several 241 | # install-sh are creating the directory concurrently. This 242 | # is OK. 243 | test -d "$pathcomp" || exit 244 | fi 245 | pathcomp=$pathcomp/ 246 | done 247 | fi 248 | 249 | if test -n "$dir_arg"; then 250 | $doit $mkdircmd "$dst" \ 251 | && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ 252 | && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ 253 | && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ 254 | && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } 255 | 256 | else 257 | dstfile=`basename "$dst"` 258 | 259 | # Make a couple of temp file names in the proper directory. 260 | dsttmp=$dstdir/_inst.$$_ 261 | rmtmp=$dstdir/_rm.$$_ 262 | 263 | # Trap to clean up those temp files at exit. 264 | trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 265 | trap '(exit $?); exit' 1 2 13 15 266 | 267 | # Copy the file name to the temp name. 268 | $doit $cpprog "$src" "$dsttmp" && 269 | 270 | # and set any options; do chmod last to preserve setuid bits. 271 | # 272 | # If any of these fail, we abort the whole thing. If we want to 273 | # ignore errors from any of these, just make sure not to ignore 274 | # errors from the above "$doit $cpprog $src $dsttmp" command. 275 | # 276 | { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ 277 | && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ 278 | && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ 279 | && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && 280 | 281 | # Now rename the file to the real destination. 282 | { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \ 283 | || { 284 | # The rename failed, perhaps because mv can't rename something else 285 | # to itself, or perhaps because mv is so ancient that it does not 286 | # support -f. 287 | 288 | # Now remove or move aside any old file at destination location. 289 | # We try this two ways since rm can't unlink itself on some 290 | # systems and the destination file might be busy for other 291 | # reasons. In this case, the final cleanup might fail but the new 292 | # file should still install successfully. 293 | { 294 | if test -f "$dstdir/$dstfile"; then 295 | $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ 296 | || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ 297 | || { 298 | echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 299 | (exit 1); exit 1 300 | } 301 | else 302 | : 303 | fi 304 | } && 305 | 306 | # Now rename the file to the real destination. 307 | $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" 308 | } 309 | } 310 | fi || { (exit 1); exit 1; } 311 | done 312 | 313 | # The final little trick to "correctly" pass the exit status to the exit trap. 314 | { 315 | (exit 0); exit 0 316 | } 317 | 318 | # Local variables: 319 | # eval: (add-hook 'write-file-hooks 'time-stamp) 320 | # time-stamp-start: "scriptversion=" 321 | # time-stamp-format: "%:y-%02m-%02d.%02H" 322 | # time-stamp-end: "$" 323 | # End: 324 | -------------------------------------------------------------------------------- /docs/html/examples/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | coinor.gimpy.examples API documentation 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 |
21 |
22 |

Module coinor.gimpy.examples

23 |
24 |
25 |
26 |
27 |

Sub-modules

28 |
29 |
coinor.gimpy.examples.BB
30 |
31 |

Original Authors : Murat H. Mut, Serdar Yildiz, 32 | Lehigh University ISE Department 05/07/2010 33 | Edited by Victor Pillac on Aug 5 2010 34 | …

35 |
36 |
coinor.gimpy.examples.SAT
37 |
38 |
39 |
40 |
coinor.gimpy.examples.expression_tree
41 |
42 |
43 |
44 |
coinor.gimpy.examples.forestry
45 |
46 |
47 |
48 |
coinor.gimpy.examples.maxflow
49 |
50 |

Small example for demonstrating flow agumenting path (ford-fulkerson) 51 | algorithm. 52 | This example is taken from youtube lecture series on Advanced …

53 |
54 |
coinor.gimpy.examples.milp1
55 |
56 |
57 |
58 |
coinor.gimpy.examples.milp2
59 |
60 |
61 |
62 |
coinor.gimpy.examples.milp3
63 |
64 |
65 |
66 |
coinor.gimpy.examples.mincostflow
67 |
68 |

Small example for demonstrating flow agumenting path (ford-fulkerson) 69 | algorithm. 70 | This example is taken from youtube lecture series on Advanced …

71 |
72 |
coinor.gimpy.examples.postordereval
73 |
74 |

Created on Oct 15, 2012 …

75 |
76 |
coinor.gimpy.examples.prerequisites
77 |
78 |
79 |
80 |
coinor.gimpy.examples.search
81 |
82 |
83 |
84 |
coinor.gimpy.examples.simplex_test
85 |
86 |

tests network simplex method and cycle canceling method of GIMPy.

87 |
88 |
coinor.gimpy.examples.simplex_visualization_test
89 |
90 |

tests network simplex visualization

91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 | 132 |
133 | 136 | 137 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Eclipse Public License Version 1.0 2 | 3 | THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC 4 | LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM 5 | CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. 6 | 7 | 1. DEFINITIONS 8 | 9 | "Contribution" means: 10 | 11 | a) in the case of the initial Contributor, the initial code and 12 | documentation distributed under this Agreement, and 13 | 14 | b) in the case of each subsequent Contributor: 15 | 16 | i) changes to the Program, and 17 | 18 | ii) additions to the Program; 19 | 20 | where such changes and/or additions to the Program originate from and are 21 | distributed by that particular Contributor. A Contribution 'originates' from a 22 | Contributor if it was added to the Program by such Contributor itself or 23 | anyone acting on such Contributor's behalf. Contributions do not include 24 | additions to the Program which: (i) are separate modules of software 25 | distributed in conjunction with the Program under their own license agreement, 26 | and (ii) are not derivative works of the Program. 27 | 28 | "Contributor" means any person or entity that distributes the Program. 29 | 30 | "Licensed Patents " mean patent claims licensable by a Contributor which are 31 | necessarily infringed by the use or sale of its Contribution alone or when 32 | combined with the Program. 33 | 34 | "Program" means the Contributions distributed in accordance with this 35 | Agreement. 36 | 37 | "Recipient" means anyone who receives the Program under this Agreement, 38 | including all Contributors. 39 | 40 | 2. GRANT OF RIGHTS 41 | 42 | a) Subject to the terms of this Agreement, each Contributor hereby grants 43 | Recipient a non-exclusive, worldwide, royalty-free copyright license to 44 | reproduce, prepare derivative works of, publicly display, publicly perform, 45 | distribute and sublicense the Contribution of such Contributor, if any, and 46 | such derivative works, in source code and object code form. 47 | 48 | b) Subject to the terms of this Agreement, each Contributor hereby grants 49 | Recipient a non-exclusive, worldwide, royalty-free patent license under 50 | Licensed Patents to make, use, sell, offer to sell, import and otherwise 51 | transfer the Contribution of such Contributor, if any, in source code and 52 | object code form. This patent license shall apply to the combination of the 53 | Contribution and the Program if, at the time the Contribution is added by the 54 | Contributor, such addition of the Contribution causes such combination to be 55 | covered by the Licensed Patents. The patent license shall not apply to any 56 | other combinations which include the Contribution. No hardware per se is 57 | licensed hereunder. 58 | 59 | c) Recipient understands that although each Contributor grants the licenses to 60 | its Contributions set forth herein, no assurances are provided by any 61 | Contributor that the Program does not infringe the patent or other 62 | intellectual property rights of any other entity. Each Contributor disclaims 63 | any liability to Recipient for claims brought by any other entity based on 64 | infringement of intellectual property rights or otherwise. As a condition to 65 | exercising the rights and licenses granted hereunder, each Recipient hereby 66 | assumes sole responsibility to secure any other intellectual property rights 67 | needed, if any. For example, if a third party patent license is required to 68 | allow Recipient to distribute the Program, it is Recipient's responsibility to 69 | acquire that license before distributing the Program. 70 | 71 | d) Each Contributor represents that to its knowledge it has sufficient 72 | copyright rights in its Contribution, if any, to grant the copyright license 73 | set forth in this Agreement. 74 | 75 | 3. REQUIREMENTS 76 | 77 | A Contributor may choose to distribute the Program in object code form under 78 | its own license agreement, provided that: 79 | 80 | a) it complies with the terms and conditions of this Agreement; and 81 | 82 | b) its license agreement: 83 | 84 | i) effectively disclaims on behalf of all Contributors all warranties and 85 | conditions, express and implied, including warranties or conditions of 86 | title and non-infringement, and implied warranties or conditions of 87 | merchantability and fitness for a particular purpose; 88 | 89 | ii) effectively excludes on behalf of all Contributors all liability for 90 | damages, including direct, indirect, special, incidental and 91 | consequential damages, such as lost profits; 92 | 93 | iii) states that any provisions which differ from this Agreement are 94 | offered by that Contributor alone and not by any other party; and 95 | 96 | iv) states that source code for the Program is available from such 97 | Contributor, and informs licensees how to obtain it in a reasonable 98 | manner on or through a medium customarily used for software exchange. 99 | 100 | When the Program is made available in source code form: 101 | 102 | a) it must be made available under this Agreement; and 103 | 104 | b) a copy of this Agreement must be included with each copy of the Program. 105 | 106 | Contributors may not remove or alter any copyright notices contained within 107 | the Program. 108 | 109 | Each Contributor must identify itself as the originator of its Contribution, 110 | if any, in a manner that reasonably allows subsequent Recipients to identify 111 | the originator of the Contribution. 112 | 113 | 4. COMMERCIAL DISTRIBUTION 114 | 115 | Commercial distributors of software may accept certain responsibilities with 116 | respect to end users, business partners and the like. While this license is 117 | intended to facilitate the commercial use of the Program, the Contributor who 118 | includes the Program in a commercial product offering should do so in a manner 119 | which does not create potential liability for other Contributors. Therefore, 120 | if a Contributor includes the Program in a commercial product offering, such 121 | Contributor ("Commercial Contributor") hereby agrees to defend and indemnify 122 | every other Contributor ("Indemnified Contributor") against any losses, 123 | damages and costs (collectively "Losses") arising from claims, lawsuits and 124 | other legal actions brought by a third party against the Indemnified 125 | Contributor to the extent caused by the acts or omissions of such Commercial 126 | Contributor in connection with its distribution of the Program in a commercial 127 | product offering. The obligations in this section do not apply to any claims 128 | or Losses relating to any actual or alleged intellectual property 129 | infringement. In order to qualify, an Indemnified Contributor must: a) 130 | promptly notify the Commercial Contributor in writing of such claim, and b) 131 | allow the Commercial Contributor to control, and cooperate with the Commercial 132 | Contributor in, the defense and any related settlement negotiations. The 133 | Indemnified Contributor may participate in any such claim at its own expense. 134 | 135 | For example, a Contributor might include the Program in a commercial product 136 | offering, Product X. That Contributor is then a Commercial Contributor. If 137 | that Commercial Contributor then makes performance claims, or offers 138 | warranties related to Product X, those performance claims and warranties are 139 | such Commercial Contributor's responsibility alone. Under this section, the 140 | Commercial Contributor would have to defend claims against the other 141 | Contributors related to those performance claims and warranties, and if a 142 | court requires any other Contributor to pay any damages as a result, the 143 | Commercial Contributor must pay those damages. 144 | 145 | 5. NO WARRANTY 146 | 147 | EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN 148 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR 149 | IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, 150 | NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each 151 | Recipient is solely responsible for determining the appropriateness of using 152 | and distributing the Program and assumes all risks associated with its 153 | exercise of rights under this Agreement , including but not limited to the 154 | risks and costs of program errors, compliance with applicable laws, damage to 155 | or loss of data, programs or equipment, and unavailability or interruption of 156 | operations. 157 | 158 | 6. DISCLAIMER OF LIABILITY 159 | 160 | EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY 161 | CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, 162 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION 163 | LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 164 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 165 | ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE 166 | EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY 167 | OF SUCH DAMAGES. 168 | 169 | 7. GENERAL 170 | 171 | If any provision of this Agreement is invalid or unenforceable under 172 | applicable law, it shall not affect the validity or enforceability of the 173 | remainder of the terms of this Agreement, and without further action by the 174 | parties hereto, such provision shall be reformed to the minimum extent 175 | necessary to make such provision valid and enforceable. 176 | 177 | If Recipient institutes patent litigation against any entity (including a 178 | cross-claim or counterclaim in a lawsuit) alleging that the Program itself 179 | (excluding combinations of the Program with other software or hardware) 180 | infringes such Recipient's patent(s), then such Recipient's rights granted 181 | under Section 2(b) shall terminate as of the date such litigation is filed. 182 | 183 | All Recipient's rights under this Agreement shall terminate if it fails to 184 | comply with any of the material terms or conditions of this Agreement and does 185 | not cure such failure in a reasonable period of time after becoming aware of 186 | such noncompliance. If all Recipient's rights under this Agreement terminate, 187 | Recipient agrees to cease use and distribution of the Program as soon as 188 | reasonably practicable. However, Recipient's obligations under this Agreement 189 | and any licenses granted by Recipient relating to the Program shall continue 190 | and survive. 191 | 192 | Everyone is permitted to copy and distribute copies of this Agreement, but in 193 | order to avoid inconsistency the Agreement is copyrighted and may only be 194 | modified in the following manner. The Agreement Steward reserves the right to 195 | publish new versions (including revisions) of this Agreement from time to 196 | time. No one other than the Agreement Steward has the right to modify this 197 | Agreement. The Eclipse Foundation is the initial Agreement Steward. The 198 | Eclipse Foundation may assign the responsibility to serve as the Agreement 199 | Steward to a suitable separate entity. Each new version of the Agreement will 200 | be given a distinguishing version number. The Program (including 201 | Contributions) may always be distributed subject to the version of the 202 | Agreement under which it was received. In addition, after a new version of the 203 | Agreement is published, Contributor may elect to distribute the Program 204 | (including its Contributions) under the new version. Except as expressly 205 | stated in Sections 2(a) and 2(b) above, Recipient receives no rights or 206 | licenses to the intellectual property of any Contributor under this Agreement, 207 | whether expressly, by implication, estoppel or otherwise. All rights in the 208 | Program not expressly granted under this Agreement are reserved. 209 | 210 | This Agreement is governed by the laws of the State of New York and the 211 | intellectual property laws of the United States of America. No party to this 212 | Agreement will bring a legal action under this Agreement more than one year 213 | after the cause of action arose. Each party waives its rights to a jury trial 214 | in any resulting litigation. -------------------------------------------------------------------------------- /missing: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # Common stub for a few missing GNU programs while installing. 3 | 4 | scriptversion=2005-06-08.21 5 | 6 | # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005 7 | # Free Software Foundation, Inc. 8 | # Originally by Fran,cois Pinard , 1996. 9 | 10 | # This program is free software; you can redistribute it and/or modify 11 | # it under the terms of the GNU General Public License as published by 12 | # the Free Software Foundation; either version 2, or (at your option) 13 | # any later version. 14 | 15 | # This program is distributed in the hope that it will be useful, 16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | # GNU General Public License for more details. 19 | 20 | # You should have received a copy of the GNU General Public License 21 | # along with this program; if not, write to the Free Software 22 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 23 | # 02110-1301, USA. 24 | 25 | # As a special exception to the GNU General Public License, if you 26 | # distribute this file as part of a program that contains a 27 | # configuration script generated by Autoconf, you may include it under 28 | # the same distribution terms that you use for the rest of that program. 29 | 30 | if test $# -eq 0; then 31 | echo 1>&2 "Try \`$0 --help' for more information" 32 | exit 1 33 | fi 34 | 35 | run=: 36 | 37 | # In the cases where this matters, `missing' is being run in the 38 | # srcdir already. 39 | if test -f configure.ac; then 40 | configure_ac=configure.ac 41 | else 42 | configure_ac=configure.in 43 | fi 44 | 45 | msg="missing on your system" 46 | 47 | case "$1" in 48 | --run) 49 | # Try to run requested program, and just exit if it succeeds. 50 | run= 51 | shift 52 | "$@" && exit 0 53 | # Exit code 63 means version mismatch. This often happens 54 | # when the user try to use an ancient version of a tool on 55 | # a file that requires a minimum version. In this case we 56 | # we should proceed has if the program had been absent, or 57 | # if --run hadn't been passed. 58 | if test $? = 63; then 59 | run=: 60 | msg="probably too old" 61 | fi 62 | ;; 63 | 64 | -h|--h|--he|--hel|--help) 65 | echo "\ 66 | $0 [OPTION]... PROGRAM [ARGUMENT]... 67 | 68 | Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 69 | error status if there is no known handling for PROGRAM. 70 | 71 | Options: 72 | -h, --help display this help and exit 73 | -v, --version output version information and exit 74 | --run try to run the given command, and emulate it if it fails 75 | 76 | Supported PROGRAM values: 77 | aclocal touch file \`aclocal.m4' 78 | autoconf touch file \`configure' 79 | autoheader touch file \`config.h.in' 80 | automake touch all \`Makefile.in' files 81 | bison create \`y.tab.[ch]', if possible, from existing .[ch] 82 | flex create \`lex.yy.c', if possible, from existing .c 83 | help2man touch the output file 84 | lex create \`lex.yy.c', if possible, from existing .c 85 | makeinfo touch the output file 86 | tar try tar, gnutar, gtar, then tar without non-portable flags 87 | yacc create \`y.tab.[ch]', if possible, from existing .[ch] 88 | 89 | Send bug reports to ." 90 | exit $? 91 | ;; 92 | 93 | -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 94 | echo "missing $scriptversion (GNU Automake)" 95 | exit $? 96 | ;; 97 | 98 | -*) 99 | echo 1>&2 "$0: Unknown \`$1' option" 100 | echo 1>&2 "Try \`$0 --help' for more information" 101 | exit 1 102 | ;; 103 | 104 | esac 105 | 106 | # Now exit if we have it, but it failed. Also exit now if we 107 | # don't have it and --version was passed (most likely to detect 108 | # the program). 109 | case "$1" in 110 | lex|yacc) 111 | # Not GNU programs, they don't have --version. 112 | ;; 113 | 114 | tar) 115 | if test -n "$run"; then 116 | echo 1>&2 "ERROR: \`tar' requires --run" 117 | exit 1 118 | elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 119 | exit 1 120 | fi 121 | ;; 122 | 123 | *) 124 | if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 125 | # We have it, but it failed. 126 | exit 1 127 | elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 128 | # Could not run --version or --help. This is probably someone 129 | # running `$TOOL --version' or `$TOOL --help' to check whether 130 | # $TOOL exists and not knowing $TOOL uses missing. 131 | exit 1 132 | fi 133 | ;; 134 | esac 135 | 136 | # If it does not exist, or fails to run (possibly an outdated version), 137 | # try to emulate it. 138 | case "$1" in 139 | aclocal*) 140 | echo 1>&2 "\ 141 | WARNING: \`$1' is $msg. You should only need it if 142 | you modified \`acinclude.m4' or \`${configure_ac}'. You might want 143 | to install the \`Automake' and \`Perl' packages. Grab them from 144 | any GNU archive site." 145 | touch aclocal.m4 146 | ;; 147 | 148 | autoconf) 149 | echo 1>&2 "\ 150 | WARNING: \`$1' is $msg. You should only need it if 151 | you modified \`${configure_ac}'. You might want to install the 152 | \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 153 | archive site." 154 | touch configure 155 | ;; 156 | 157 | autoheader) 158 | echo 1>&2 "\ 159 | WARNING: \`$1' is $msg. You should only need it if 160 | you modified \`acconfig.h' or \`${configure_ac}'. You might want 161 | to install the \`Autoconf' and \`GNU m4' packages. Grab them 162 | from any GNU archive site." 163 | files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 164 | test -z "$files" && files="config.h" 165 | touch_files= 166 | for f in $files; do 167 | case "$f" in 168 | *:*) touch_files="$touch_files "`echo "$f" | 169 | sed -e 's/^[^:]*://' -e 's/:.*//'`;; 170 | *) touch_files="$touch_files $f.in";; 171 | esac 172 | done 173 | touch $touch_files 174 | ;; 175 | 176 | automake*) 177 | echo 1>&2 "\ 178 | WARNING: \`$1' is $msg. You should only need it if 179 | you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 180 | You might want to install the \`Automake' and \`Perl' packages. 181 | Grab them from any GNU archive site." 182 | find . -type f -name Makefile.am -print | 183 | sed 's/\.am$/.in/' | 184 | while read f; do touch "$f"; done 185 | ;; 186 | 187 | autom4te) 188 | echo 1>&2 "\ 189 | WARNING: \`$1' is needed, but is $msg. 190 | You might have modified some files without having the 191 | proper tools for further handling them. 192 | You can get \`$1' as part of \`Autoconf' from any GNU 193 | archive site." 194 | 195 | file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` 196 | test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` 197 | if test -f "$file"; then 198 | touch $file 199 | else 200 | test -z "$file" || exec >$file 201 | echo "#! /bin/sh" 202 | echo "# Created by GNU Automake missing as a replacement of" 203 | echo "# $ $@" 204 | echo "exit 0" 205 | chmod +x $file 206 | exit 1 207 | fi 208 | ;; 209 | 210 | bison|yacc) 211 | echo 1>&2 "\ 212 | WARNING: \`$1' $msg. You should only need it if 213 | you modified a \`.y' file. You may need the \`Bison' package 214 | in order for those modifications to take effect. You can get 215 | \`Bison' from any GNU archive site." 216 | rm -f y.tab.c y.tab.h 217 | if [ $# -ne 1 ]; then 218 | eval LASTARG="\${$#}" 219 | case "$LASTARG" in 220 | *.y) 221 | SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 222 | if [ -f "$SRCFILE" ]; then 223 | cp "$SRCFILE" y.tab.c 224 | fi 225 | SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 226 | if [ -f "$SRCFILE" ]; then 227 | cp "$SRCFILE" y.tab.h 228 | fi 229 | ;; 230 | esac 231 | fi 232 | if [ ! -f y.tab.h ]; then 233 | echo >y.tab.h 234 | fi 235 | if [ ! -f y.tab.c ]; then 236 | echo 'main() { return 0; }' >y.tab.c 237 | fi 238 | ;; 239 | 240 | lex|flex) 241 | echo 1>&2 "\ 242 | WARNING: \`$1' is $msg. You should only need it if 243 | you modified a \`.l' file. You may need the \`Flex' package 244 | in order for those modifications to take effect. You can get 245 | \`Flex' from any GNU archive site." 246 | rm -f lex.yy.c 247 | if [ $# -ne 1 ]; then 248 | eval LASTARG="\${$#}" 249 | case "$LASTARG" in 250 | *.l) 251 | SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 252 | if [ -f "$SRCFILE" ]; then 253 | cp "$SRCFILE" lex.yy.c 254 | fi 255 | ;; 256 | esac 257 | fi 258 | if [ ! -f lex.yy.c ]; then 259 | echo 'main() { return 0; }' >lex.yy.c 260 | fi 261 | ;; 262 | 263 | help2man) 264 | echo 1>&2 "\ 265 | WARNING: \`$1' is $msg. You should only need it if 266 | you modified a dependency of a manual page. You may need the 267 | \`Help2man' package in order for those modifications to take 268 | effect. You can get \`Help2man' from any GNU archive site." 269 | 270 | file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` 271 | if test -z "$file"; then 272 | file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` 273 | fi 274 | if [ -f "$file" ]; then 275 | touch $file 276 | else 277 | test -z "$file" || exec >$file 278 | echo ".ab help2man is required to generate this page" 279 | exit 1 280 | fi 281 | ;; 282 | 283 | makeinfo) 284 | echo 1>&2 "\ 285 | WARNING: \`$1' is $msg. You should only need it if 286 | you modified a \`.texi' or \`.texinfo' file, or any other file 287 | indirectly affecting the aspect of the manual. The spurious 288 | call might also be the consequence of using a buggy \`make' (AIX, 289 | DU, IRIX). You might want to install the \`Texinfo' package or 290 | the \`GNU make' package. Grab either from any GNU archive site." 291 | # The file to touch is that specified with -o ... 292 | file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` 293 | if test -z "$file"; then 294 | # ... or it is the one specified with @setfilename ... 295 | infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 296 | file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile` 297 | # ... or it is derived from the source name (dir/f.texi becomes f.info) 298 | test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 299 | fi 300 | # If the file does not exist, the user really needs makeinfo; 301 | # let's fail without touching anything. 302 | test -f $file || exit 1 303 | touch $file 304 | ;; 305 | 306 | tar) 307 | shift 308 | 309 | # We have already tried tar in the generic part. 310 | # Look for gnutar/gtar before invocation to avoid ugly error 311 | # messages. 312 | if (gnutar --version > /dev/null 2>&1); then 313 | gnutar "$@" && exit 0 314 | fi 315 | if (gtar --version > /dev/null 2>&1); then 316 | gtar "$@" && exit 0 317 | fi 318 | firstarg="$1" 319 | if shift; then 320 | case "$firstarg" in 321 | *o*) 322 | firstarg=`echo "$firstarg" | sed s/o//` 323 | tar "$firstarg" "$@" && exit 0 324 | ;; 325 | esac 326 | case "$firstarg" in 327 | *h*) 328 | firstarg=`echo "$firstarg" | sed s/h//` 329 | tar "$firstarg" "$@" && exit 0 330 | ;; 331 | esac 332 | fi 333 | 334 | echo 1>&2 "\ 335 | WARNING: I can't seem to be able to run \`tar' with the given arguments. 336 | You may want to install GNU tar or Free paxutils, or check the 337 | command line arguments." 338 | exit 1 339 | ;; 340 | 341 | *) 342 | echo 1>&2 "\ 343 | WARNING: \`$1' is needed, and is $msg. 344 | You might have modified some files without having the 345 | proper tools for further handling them. Check the \`README' file, 346 | it often tells you about the needed prerequisites for installing 347 | this package. You may also peek at any GNU archive site, in case 348 | some other package would contain this missing \`$1' program." 349 | exit 1 350 | ;; 351 | esac 352 | 353 | exit 0 354 | 355 | # Local variables: 356 | # eval: (add-hook 'write-file-hooks 'time-stamp) 357 | # time-stamp-start: "scriptversion=" 358 | # time-stamp-format: "%:y-%02m-%02d.%02H" 359 | # time-stamp-end: "$" 360 | # End: 361 | -------------------------------------------------------------------------------- /test/Makefile.in: -------------------------------------------------------------------------------- 1 | # Makefile.in generated by automake 1.9.6 from Makefile.am. 2 | # @configure_input@ 3 | 4 | # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 5 | # 2003, 2004, 2005 Free Software Foundation, Inc. 6 | # This Makefile.in is free software; the Free Software Foundation 7 | # gives unlimited permission to copy and/or distribute it, 8 | # with or without modifications, as long as this notice is preserved. 9 | 10 | # This program is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY, to the extent permitted by law; without 12 | # even the implied warranty of MERCHANTABILITY or FITNESS FOR A 13 | # PARTICULAR PURPOSE. 14 | 15 | @SET_MAKE@ 16 | 17 | #============================================================================# 18 | # This file is part of the GiMPy graph library # 19 | # # 20 | # GiMPy is distributed under the Eclipse Public License as part of the # 21 | # COIN-OR repository (http://www.coin-or.org). # 22 | # # 23 | # Authors: Ayukut Bulut, Lehigh University (ayb211@lehigh.edu) # 24 | # Ted Ralphs, Lehigh University (ted@lehigh.edu) # 25 | # # 26 | # # 27 | # Copyright (C) 2013, Lehigh University, Aykut Bulut, and Ted Ralphs # 28 | # All Rights Reserved. # 29 | #============================================================================# 30 | srcdir = @srcdir@ 31 | top_srcdir = @top_srcdir@ 32 | VPATH = @srcdir@ 33 | pkgdatadir = $(datadir)/@PACKAGE@ 34 | pkglibdir = $(libdir)/@PACKAGE@ 35 | pkgincludedir = $(includedir)/@PACKAGE@ 36 | top_builddir = .. 37 | am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd 38 | INSTALL = @INSTALL@ 39 | install_sh_DATA = $(install_sh) -c -m 644 40 | install_sh_PROGRAM = $(install_sh) -c 41 | install_sh_SCRIPT = $(install_sh) -c 42 | INSTALL_HEADER = $(INSTALL_DATA) 43 | transform = $(program_transform_name) 44 | NORMAL_INSTALL = : 45 | PRE_INSTALL = : 46 | POST_INSTALL = : 47 | NORMAL_UNINSTALL = : 48 | PRE_UNINSTALL = : 49 | POST_UNINSTALL = : 50 | build_triplet = @build@ 51 | host_triplet = @host@ 52 | subdir = test 53 | DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in 54 | ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 55 | am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ 56 | $(top_srcdir)/configure.ac 57 | am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 58 | $(ACLOCAL_M4) 59 | mkinstalldirs = $(install_sh) -d 60 | CONFIG_CLEAN_FILES = 61 | SOURCES = 62 | DIST_SOURCES = 63 | DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) 64 | ABSBUILDDIR = @ABSBUILDDIR@ 65 | ACLOCAL = @ACLOCAL@ 66 | ADD_CFLAGS = @ADD_CFLAGS@ 67 | ADD_CXXFLAGS = @ADD_CXXFLAGS@ 68 | ALWAYS_FALSE_FALSE = @ALWAYS_FALSE_FALSE@ 69 | ALWAYS_FALSE_TRUE = @ALWAYS_FALSE_TRUE@ 70 | AMDEP_FALSE = @AMDEP_FALSE@ 71 | AMDEP_TRUE = @AMDEP_TRUE@ 72 | AMTAR = @AMTAR@ 73 | AR = @AR@ 74 | AUTOCONF = @AUTOCONF@ 75 | AUTOHEADER = @AUTOHEADER@ 76 | AUTOMAKE = @AUTOMAKE@ 77 | AUX_DIR = @AUX_DIR@ 78 | AWK = @AWK@ 79 | BUILDTOOLSDIR = @BUILDTOOLSDIR@ 80 | CC = @CC@ 81 | CCDEPMODE = @CCDEPMODE@ 82 | CDEFS = @CDEFS@ 83 | CFLAGS = @CFLAGS@ 84 | COIN_CC_IS_CL_FALSE = @COIN_CC_IS_CL_FALSE@ 85 | COIN_CC_IS_CL_TRUE = @COIN_CC_IS_CL_TRUE@ 86 | COIN_CXX_IS_CL_FALSE = @COIN_CXX_IS_CL_FALSE@ 87 | COIN_CXX_IS_CL_TRUE = @COIN_CXX_IS_CL_TRUE@ 88 | CPP = @CPP@ 89 | CPPFLAGS = @CPPFLAGS@ 90 | CXX = @CXX@ 91 | CXXCPP = @CXXCPP@ 92 | CXXDEFS = @CXXDEFS@ 93 | CXXDEPMODE = @CXXDEPMODE@ 94 | CXXFLAGS = @CXXFLAGS@ 95 | CYGPATH_W = @CYGPATH_W@ 96 | DBG_CFLAGS = @DBG_CFLAGS@ 97 | DBG_CXXFLAGS = @DBG_CXXFLAGS@ 98 | DEFS = @DEFS@ 99 | DEPDIR = @DEPDIR@ 100 | DEPENDENCY_LINKING_FALSE = @DEPENDENCY_LINKING_FALSE@ 101 | DEPENDENCY_LINKING_TRUE = @DEPENDENCY_LINKING_TRUE@ 102 | ECHO = @ECHO@ 103 | ECHO_C = @ECHO_C@ 104 | ECHO_N = @ECHO_N@ 105 | ECHO_T = @ECHO_T@ 106 | EGREP = @EGREP@ 107 | EXEEXT = @EXEEXT@ 108 | F77 = @F77@ 109 | FFLAGS = @FFLAGS@ 110 | GIMPY_SVN_REV = @GIMPY_SVN_REV@ 111 | HAVE_EXTERNALS_FALSE = @HAVE_EXTERNALS_FALSE@ 112 | HAVE_EXTERNALS_TRUE = @HAVE_EXTERNALS_TRUE@ 113 | HAVE_PYTHON_FALSE = @HAVE_PYTHON_FALSE@ 114 | HAVE_PYTHON_TRUE = @HAVE_PYTHON_TRUE@ 115 | INSTALL_DATA = @INSTALL_DATA@ 116 | INSTALL_PROGRAM = @INSTALL_PROGRAM@ 117 | INSTALL_SCRIPT = @INSTALL_SCRIPT@ 118 | INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ 119 | LDFLAGS = @LDFLAGS@ 120 | LIBEXT = @LIBEXT@ 121 | LIBOBJS = @LIBOBJS@ 122 | LIBS = @LIBS@ 123 | LIBTOOL = @LIBTOOL@ 124 | LIBTOOLM4 = @LIBTOOLM4@ 125 | LN_S = @LN_S@ 126 | LTLIBOBJS = @LTLIBOBJS@ 127 | LT_LDFLAGS = @LT_LDFLAGS@ 128 | MAINT = @MAINT@ 129 | MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ 130 | MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ 131 | MAKEINFO = @MAKEINFO@ 132 | MPICC = @MPICC@ 133 | MPICXX = @MPICXX@ 134 | OBJEXT = @OBJEXT@ 135 | OPT_CFLAGS = @OPT_CFLAGS@ 136 | OPT_CXXFLAGS = @OPT_CXXFLAGS@ 137 | PACKAGE = @PACKAGE@ 138 | PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ 139 | PACKAGE_NAME = @PACKAGE_NAME@ 140 | PACKAGE_STRING = @PACKAGE_STRING@ 141 | PACKAGE_TARNAME = @PACKAGE_TARNAME@ 142 | PACKAGE_VERSION = @PACKAGE_VERSION@ 143 | PATH_SEPARATOR = @PATH_SEPARATOR@ 144 | PYTHON = @PYTHON@ 145 | PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ 146 | PYTHON_PLATFORM = @PYTHON_PLATFORM@ 147 | PYTHON_PREFIX = @PYTHON_PREFIX@ 148 | PYTHON_VERSION = @PYTHON_VERSION@ 149 | RANLIB = @RANLIB@ 150 | RPATH_FLAGS = @RPATH_FLAGS@ 151 | SET_MAKE = @SET_MAKE@ 152 | SHELL = @SHELL@ 153 | STRIP = @STRIP@ 154 | VERSION = @VERSION@ 155 | VPATH_DISTCLEANFILES = @VPATH_DISTCLEANFILES@ 156 | abs_bin_dir = @abs_bin_dir@ 157 | abs_include_dir = @abs_include_dir@ 158 | abs_lib_dir = @abs_lib_dir@ 159 | abs_source_dir = @abs_source_dir@ 160 | ac_c_preproc_warn_flag = @ac_c_preproc_warn_flag@ 161 | ac_ct_AR = @ac_ct_AR@ 162 | ac_ct_CC = @ac_ct_CC@ 163 | ac_ct_CXX = @ac_ct_CXX@ 164 | ac_ct_F77 = @ac_ct_F77@ 165 | ac_ct_RANLIB = @ac_ct_RANLIB@ 166 | ac_ct_STRIP = @ac_ct_STRIP@ 167 | ac_cxx_preproc_warn_flag = @ac_cxx_preproc_warn_flag@ 168 | am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ 169 | am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ 170 | am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ 171 | am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ 172 | am__include = @am__include@ 173 | am__leading_dot = @am__leading_dot@ 174 | am__quote = @am__quote@ 175 | am__tar = @am__tar@ 176 | am__untar = @am__untar@ 177 | bindir = @bindir@ 178 | build = @build@ 179 | build_alias = @build_alias@ 180 | build_cpu = @build_cpu@ 181 | build_os = @build_os@ 182 | build_vendor = @build_vendor@ 183 | datadir = @datadir@ 184 | exec_prefix = @exec_prefix@ 185 | have_autoconf = @have_autoconf@ 186 | have_automake = @have_automake@ 187 | have_svn = @have_svn@ 188 | have_svnversion = @have_svnversion@ 189 | host = @host@ 190 | host_alias = @host_alias@ 191 | host_cpu = @host_cpu@ 192 | host_os = @host_os@ 193 | host_vendor = @host_vendor@ 194 | includedir = @includedir@ 195 | infodir = @infodir@ 196 | install_sh = @install_sh@ 197 | libdir = @libdir@ 198 | libexecdir = @libexecdir@ 199 | localstatedir = @localstatedir@ 200 | mandir = @mandir@ 201 | mkdir_p = @mkdir_p@ 202 | oldincludedir = @oldincludedir@ 203 | pkgpyexecdir = @pkgpyexecdir@ 204 | pkgpythondir = @pkgpythondir@ 205 | prefix = @prefix@ 206 | program_transform_name = @program_transform_name@ 207 | pyexecdir = @pyexecdir@ 208 | pythondir = @pythondir@ 209 | sbindir = @sbindir@ 210 | sharedstatedir = @sharedstatedir@ 211 | sol_cc_compiler = @sol_cc_compiler@ 212 | sysconfdir = @sysconfdir@ 213 | target_alias = @target_alias@ 214 | AUTOMAKE_OPTIONS = foreign 215 | all: all-am 216 | 217 | .SUFFIXES: 218 | $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) 219 | @for dep in $?; do \ 220 | case '$(am__configure_deps)' in \ 221 | *$$dep*) \ 222 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ 223 | && exit 0; \ 224 | exit 1;; \ 225 | esac; \ 226 | done; \ 227 | echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign test/Makefile'; \ 228 | cd $(top_srcdir) && \ 229 | $(AUTOMAKE) --foreign test/Makefile 230 | .PRECIOUS: Makefile 231 | Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status 232 | @case '$?' in \ 233 | *config.status*) \ 234 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ 235 | *) \ 236 | echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ 237 | cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ 238 | esac; 239 | 240 | $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) 241 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh 242 | 243 | $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) 244 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh 245 | $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) 246 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh 247 | 248 | mostlyclean-libtool: 249 | -rm -f *.lo 250 | 251 | clean-libtool: 252 | -rm -rf .libs _libs 253 | 254 | distclean-libtool: 255 | -rm -f libtool 256 | uninstall-info-am: 257 | tags: TAGS 258 | TAGS: 259 | 260 | ctags: CTAGS 261 | CTAGS: 262 | 263 | 264 | distdir: $(DISTFILES) 265 | @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ 266 | topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ 267 | list='$(DISTFILES)'; for file in $$list; do \ 268 | case $$file in \ 269 | $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ 270 | $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ 271 | esac; \ 272 | if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ 273 | dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ 274 | if test "$$dir" != "$$file" && test "$$dir" != "."; then \ 275 | dir="/$$dir"; \ 276 | $(mkdir_p) "$(distdir)$$dir"; \ 277 | else \ 278 | dir=''; \ 279 | fi; \ 280 | if test -d $$d/$$file; then \ 281 | if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ 282 | cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ 283 | fi; \ 284 | cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ 285 | else \ 286 | test -f $(distdir)/$$file \ 287 | || cp -p $$d/$$file $(distdir)/$$file \ 288 | || exit 1; \ 289 | fi; \ 290 | done 291 | check-am: all-am 292 | check: check-am 293 | all-am: Makefile 294 | installdirs: 295 | install: install-am 296 | install-exec: install-exec-am 297 | install-data: install-data-am 298 | uninstall: uninstall-am 299 | 300 | install-am: all-am 301 | @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am 302 | 303 | installcheck: installcheck-am 304 | install-strip: 305 | $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ 306 | install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ 307 | `test -z '$(STRIP)' || \ 308 | echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install 309 | mostlyclean-generic: 310 | 311 | clean-generic: 312 | 313 | distclean-generic: 314 | -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) 315 | 316 | maintainer-clean-generic: 317 | @echo "This command is intended for maintainers to use" 318 | @echo "it deletes files that may require special tools to rebuild." 319 | clean: clean-am 320 | 321 | clean-am: clean-generic clean-libtool mostlyclean-am 322 | 323 | distclean: distclean-am 324 | -rm -f Makefile 325 | distclean-am: clean-am distclean-generic distclean-libtool 326 | 327 | dvi: dvi-am 328 | 329 | dvi-am: 330 | 331 | html: html-am 332 | 333 | info: info-am 334 | 335 | info-am: 336 | 337 | install-data-am: 338 | 339 | install-exec-am: 340 | 341 | install-info: install-info-am 342 | 343 | install-man: 344 | 345 | installcheck-am: 346 | 347 | maintainer-clean: maintainer-clean-am 348 | -rm -f Makefile 349 | maintainer-clean-am: distclean-am maintainer-clean-generic 350 | 351 | mostlyclean: mostlyclean-am 352 | 353 | mostlyclean-am: mostlyclean-generic mostlyclean-libtool 354 | 355 | pdf: pdf-am 356 | 357 | pdf-am: 358 | 359 | ps: ps-am 360 | 361 | ps-am: 362 | 363 | uninstall-am: uninstall-info-am 364 | 365 | .PHONY: all all-am check check-am clean clean-generic clean-libtool \ 366 | distclean distclean-generic distclean-libtool distdir dvi \ 367 | dvi-am html html-am info info-am install install-am \ 368 | install-data install-data-am install-exec install-exec-am \ 369 | install-info install-info-am install-man install-strip \ 370 | installcheck installcheck-am installdirs maintainer-clean \ 371 | maintainer-clean-generic mostlyclean mostlyclean-generic \ 372 | mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \ 373 | uninstall-info-am 374 | 375 | 376 | test: 377 | PYTHONPATH=@abs_source_dir@/src:@abs_source_dir@/test \ 378 | ${PYTHON} @abs_source_dir@/test/test_algorithms.py 379 | 380 | .PHONY: test 381 | # Tell versions [3.59,3.63) of GNU make to not export all variables. 382 | # Otherwise a system limit (for SysV at least) may be exceeded. 383 | .NOEXPORT: 384 | --------------------------------------------------------------------------------