1
0
mirror of https://github.com/kalmarek/PropertyT.jl.git synced 2024-12-25 02:15:29 +01:00

rework addconstraints! with progress printing

This commit is contained in:
kalmarek 2017-08-27 19:00:49 +02:00
parent db55927729
commit 8a6707eddd

View File

@ -127,24 +127,30 @@ function constrLHS(m::JuMP.Model, cnstr, Us, Ust, dims, vars, eps=100*eps(1.0))
return @expression(m, sum(vecdot(M[π], vars[π]) for π in 1:endof(Us)))
end
function addconstraints!(m::JuMP.Model, data::OrbitData, l::Int=length(data.laplacian); var::Symbol = )
λ = m[var]
Ust = [U' for U in data.Us]
for t in 1:l
# lhs = constrLHS(m, data, t)
lhs = constrLHS(m, data.cnstr[t], data.Us, Ust, data.dims, data.Ps)
function addconstraints!(m::JuMP.Model, data::OrbitData, l::Int=length(data.laplacian); var::Symbol=)
λ = m[var]
Ust = [U' for U in data.Us]
idx = [π for π in 1:endof(data.Us) if size(data.Us[π],2) != 0]
d, = data.laplacian[t], data.laplacianSq[t]
if lhs == zero(lhs)
if d == 0 && == 0
info("Detected empty constraint")
continue
else
warn("Adding unsatisfiable constraint!")
end
end
JuMP.@constraint(m, lhs == - λ*d)
end
for t in 1:l
if t % 100 == 0
print(t, ", ")
end
# lhs = constrLHS(m, data, t)
lhs = constrLHS(m, data.cnstr[t], data.Us[idx], Ust[idx], data.dims[idx], data.Ps[idx])
d, = data.laplacian[t], data.laplacianSq[t]
# if lhs == zero(lhs)
# if d == 0 && d² == 0
# info("Detected empty constraint")
# continue
# else
# warn("Adding unsatisfiable constraint!")
# end
# end
JuMP.@constraint(m, lhs == - λ*d)
end
println("")
end
function init_model(Uπs)