Skip to content
This repository was archived by the owner on Oct 22, 2021. It is now read-only.

Commit 2158d81

Browse files
authored
Mathprog (#8)
* added mincost func * added default solver * added tests for mincost, export function * default sink and source, circulation tests * changed LP solver, added doc, conservation tests * added mincost docs * replace JuMP with basic MathProg * removed JuMP from require * changed mincost signature, removing default GLPK solver * moved required solver to tests * remove GLPK dep * newline
1 parent 1f95fe2 commit 2158d81

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

src/mincost.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ julia> demand = spzeros(6,6)
3535
julia> demand[3,6] = 1
3636
julia> demand[4,6] = 1
3737
julia> capacity = ones(6,6)
38-
julia> flow = mincost_flow(g, capacity, demand, w, GLPKSolverLP(), 5, 6)
38+
julia> flow = mincost_flow(g, capacity, demand, w, ClpSolver(), 5, 6)
3939
```
4040
"""
4141
function mincost_flow(g::lg.DiGraph,

test/REQUIRE

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
GLPK
2-
GLPKMathProgInterface
1+
Clp

test/mincost.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using GLPKMathProgInterface: GLPKSolverLP
1+
using Clp: ClpSolver
22

33
@testset "Minimum-cost flow" begin
44

@@ -24,7 +24,7 @@ using GLPKMathProgInterface: GLPKSolverLP
2424
demand[4,6] = 1
2525
capacity = ones(6,6)
2626

27-
flow = mincost_flow(g, capacity, demand, w, GLPKSolverLP(), 5, 6)
27+
flow = mincost_flow(g, capacity, demand, w, ClpSolver(), 5, 6)
2828
@test flow[5,1] == 1
2929
@test flow[5,2] == 1
3030
@test flow[3,6] == 1
@@ -42,7 +42,7 @@ using GLPKMathProgInterface: GLPKSolverLP
4242

4343
# no demand => null flow
4444
d2 = spzeros(6,6)
45-
flow = mincost_flow(g, capacity, d2, w, GLPKSolverLP(), 5, 6)
45+
flow = mincost_flow(g, capacity, d2, w, ClpSolver(), 5, 6)
4646
for idx in 1:6
4747
for jdx in 1:6
4848
@test flow[idx,jdx] 0.0
@@ -62,7 +62,7 @@ using GLPKMathProgInterface: GLPKSolverLP
6262
demand = spzeros(6,6)
6363
demand[1,2] = 1
6464
costs = ones(6,6)
65-
flow = mincost_flow(g, capacity, demand, costs, GLPKSolverLP())
65+
flow = mincost_flow(g, capacity, demand, costs, ClpSolver())
6666
active_flows = [(1,2), (2,5), (5,6),(6,1)]
6767
for s in 1:6
6868
for t in 1:6
@@ -79,7 +79,7 @@ using GLPKMathProgInterface: GLPKSolverLP
7979
end
8080
# higher short-circuit cost
8181
costs[2,5] = 10.
82-
flow = mincost_flow(g, capacity, demand, costs, GLPKSolverLP())
82+
flow = mincost_flow(g, capacity, demand, costs, ClpSolver())
8383
active_flows = [(1,2),(2,3),(3,4),(4,5),(5,6),(6,1)]
8484
for s in 1:6
8585
for t in 1:6

0 commit comments

Comments
 (0)