diff --git a/CHANGELOG.md b/CHANGELOG.md index a5180a8..2b85ded 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,11 @@ -### 0.1.6 (Upcoming release) +### 0.1.7 (Upcoming release) + +### 0.1.6 - Add Latex support for Transportation tables - Pretty printing simplex iterations - Automatic calculation of objective value by iterations and manual calculation code is removed - +- Non-negativity conditions of models in the definition stage ### 0.1.5 diff --git a/Project.toml b/Project.toml index 89624f4..4622c2a 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "OperationsResearchModels" uuid = "8042aa49-e599-49ec-a8f7-b5b80cc82a88" authors = ["Mehmet Hakan Satman "] -version = "0.1.5" +version = "0.1.6" [deps] HiGHS = "87dc4568-4c63-4d18-b0c0-bb2238e4078b" diff --git a/src/maximumflow.jl b/src/maximumflow.jl index d0e9b54..abb2f0e 100644 --- a/src/maximumflow.jl +++ b/src/maximumflow.jl @@ -40,7 +40,7 @@ function solve(cns::Array{Connection,1}) return :f end expr = @expression(model, 0) - for i = 1:length(lst) + for i = eachindex(lst) expr += x[lst[i].from, lst[i].to] end return expr @@ -58,7 +58,7 @@ function solve(cns::Array{Connection,1}) # Variables @variable(model, f) - @variable(model, x[1:n, 1:n]) + @variable(model, x[1:n, 1:n] .>= 0) # Objective Function @objective(model, Max, f) @@ -78,7 +78,6 @@ function solve(cns::Array{Connection,1}) for nd in cns @constraint(model, x[nd.from, nd.to] <= nd.value) - @constraint(model, x[nd.from, nd.to] >= 0) end @constraint(model, f >= 0) diff --git a/src/shortestpath.jl b/src/shortestpath.jl index 48490aa..a88f398 100644 --- a/src/shortestpath.jl +++ b/src/shortestpath.jl @@ -41,7 +41,7 @@ function solve(cns::Array{Connection,1}) return 0 end expr = @expression(model, 0) - for i = 1:length(lst) + for i = eachindex(lst) expr += x[lst[i].from, lst[i].to] end return expr diff --git a/src/transportation.jl b/src/transportation.jl index 905c9c1..e47077e 100644 --- a/src/transportation.jl +++ b/src/transportation.jl @@ -85,12 +85,11 @@ function solve(t::TransportationProblem)::TransportationResult n, p = size(newt.costs) - @variable(model, x[1:n, 1:p]) + @variable(model, x[1:n, 1:p] .>= 0) @objective(model, Min, sum(newt.costs .* x)) @constraint(model, sum(x[1:n, j] for j = 1:p) .== newt.supply) @constraint(model, sum(x[i, 1:p] for i = 1:n) .== newt.demand) - @constraint(model, x .>= 0) optimize!(model)