PathModel¶
Lightweight model for path-only problems. Returns solutions as lists of edge IDs rather than full solution objects. Does not support master variables or constraints.
Constructor¶
import flowty
model = flowty.PathModel()
model = flowty.PathModel("MyPathModel")
Methods¶
addGraph¶
Same as Model.addGraph:
graph = model.addGraph(edges=E, edgeCosts=C, resources=[time, capacity], pathSense="S")
addSubproblem¶
Same as Model.addSubproblem:
subproblem = model.addSubproblem(
graph, source=0, target=n-1, obj=0, lb=1, ub=10, domain="B", rules=rules
)
setParam¶
model.setParam("LogLevel", 2)
See Parameters.
solve¶
status = model.solve()
Returns flowty.Model.Status.
getPathSolution¶
solution = model.getPathSolution() # best solution
solution = model.getPathSolution(idx) # idx-th solution
solutions = model.getPathSolutions() # all solutions
PathSolution¶
| Property | Type | Description |
|---|---|---|
.cost |
float |
Objective value |
.paths |
list[list[int]] |
Paths as lists of edge IDs |
Properties¶
model.name # str
model.graphs # list of Graph
model.subproblems # list of Subproblem
Limitations¶
PathModel does not support:
addVariable()addConstraint()/+=operatorflowty.sum()addPaths()/getPaths()read()/write()
Use Model if you need these features.