1
0
mirror of https://github.com/kalmarek/PropertyT.jl.git synced 2024-11-26 17:05:27 +01:00

constraints return linear indices

This commit is contained in:
kalmarek 2018-08-20 03:50:03 +02:00
parent 13bc1bef8b
commit 33fc456879

View File

@ -1,13 +1,14 @@
using JuMP using JuMP
import MathProgBase: AbstractMathProgSolver import MathProgBase: AbstractMathProgSolver
function constraints(pm, total_length=maximum(pm)) function constraints(pm::Matrix{I}, total_length=maximum(pm)) where {I<:Integer}
n = size(pm,1) cnstrs = [Vector{I}() for _ in 1:total_length]
constraints = [Vector{Tuple{Int,Int}}() for _ in 1:total_length] for i in eachindex(pm)
for j in 1:n push!(cnstrs[pm[i]], i)
for i in 1:n end
idx = pm[i,j] return cnstrs
push!(constraints[idx], (i,j)) end
end end
end end
return constraints return constraints