示例#1
0
Created on Fri Jul 10 11:37:09 2020

@author: fuksova
"""

#This is a script showing how to use LifT ILP solver from python. Its usage is similar to directly calling run-disjoint-paths
#from command line. The solver parameters are read from a parameter file.
# Graph structure together with assignemt of vertices to time frames are initialized from the same two files that are used for
#direct calling of run-disjoint-paths.
#The main difference is that the paths to the two files containing graph structure are not read from the parameter file.
#They have to be provided as in the script.

import disjointPathsPy as ldpPy

#Initializes structure for holding solver parameters. It expects the path to the solver parameter file.
params = ldpPy.DisjointParams(
    "../data/exampleSolverILP/params_sequence_py.ini")

#Constructor of structure for holding the mapping between time frames and graph vertices
timeFrames = ldpPy.TimeFramesToVertices()

#Initalizing the structure from a file
timeFrames.init_from_file("../data/exampleSolverILP/problemDesc_frames",
                          params)

#Initializing the graph structure from timeFrames. For now, no edges are present.
completeGraphStructure = ldpPy.GraphStructure(timeFrames)

#Adding edges to graph structure from a file.
completeGraphStructure.add_edges_from_file(
    "../data/exampleSolverILP/problemDesc", params)
示例#2
0
paramsMap["SMALL_INTERVALS"] = "40"
paramsMap["TRACKLET_SIZE"] = "20"
paramsMap["GUROBI_REL_GAP"] = "0"
paramsMap["GUROBI_REL_GAP_TRACKLET"] = "0"
paramsMap["DEBUG_OUTPUT_FILES"] = "0"
paramsMap["CONTROL_OUTPUT_FILES"] = "0"
paramsMap["ALL_BASE_TRACKLET"] = "1"
paramsMap["OPTIMIZE_PATHS"] = "0"
paramsMap["MAX_TIMEGAP_BASE"] = "60"
paramsMap["MAX_TIMEGAP_LIFTED"] = "60"
paramsMap["MAX_TIMEGAP_COMPLETE"] = "60"
paramsMap["CONTROL_STD_OUTPUT"] = "0"
paramsMap["OUTPUT_PATH"] = "../data/exampleSolverILP/"

#Initializes structure for holding solver parameters. It expects a string to string map (dictionary) as an input. ParametersParser.get_parsed_params() can be alternatively used for providing such map.
params = ldpPy.DisjointParams(paramsMap)

#Constructor of structure for holding the mapping between time frames and graph vertices
timeFrames = ldpPy.TimeFramesToVertices()

#This array contains information about how many detections are in each time frame. The array must contain non-negative integer values.
#Numbering of graph vertices in time frames: Frame 1: 0,1,2; Frame 2: 3,4; Frame 3: 4,5,6
vect = np.array([3, 2, 3])
numberOfVertices = 8

#Initalizing the structure from the given array.
timeFrames.init_from_vector(vect)

#Initializing the graph structure from timeFrames. For now, no edges are present.
completeGraphStructure = ldpPy.GraphStructure(timeFrames)
示例#3
0
#from command line. The solver parameters are read from a parameter file.
# Graph structure together with assignemt of vertices to time frames are initialized from the same two files that are used for
#direct calling of run-disjoint-paths.
#The main difference is that the paths to the two files containing graph structure are not read from the parameter file.
#They have to be provided as in the script.

import disjointPathsPy as ldpPy

#Create a parser for parameters
paramsParser = ldpPy.ParametersParser()

#Parses parameters from file
paramsParser.init_from_file("../data/exampleSolverILP/params_sequence_py.ini")

#Initializes structure for holding solver parameters. It expects a string to string map (dictionary) as an input. ParametersParser.get_parsed_params() can be used for providing such map.
params = ldpPy.DisjointParams(paramsParser.get_parsed_params())

#Constructor of structure for holding the mapping between time frames and graph vertices
timeFrames = ldpPy.TimeFramesToVertices()

#Initalizing the structure from a file
timeFrames.init_from_file("../data/exampleSolverILP/problemDesc_frames",
                          params)

#Initializing the graph structure from timeFrames. For now, no edges are present.
completeGraphStructure = ldpPy.GraphStructure(timeFrames)

#Adding edges to graph structure from a file.
completeGraphStructure.add_edges_from_file(
    "../data/exampleSolverILP/problemDesc", params)