Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various fixes #262

Merged
merged 3 commits into from
Feb 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/Algorithm/record.jl
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,15 @@ end
function apply_data!(form::Formulation, var::Variable, var_state::VarState)
# Bounds
if getcurlb(form, var) != var_state.lb || getcurub(form, var) != var_state.ub
@logmsg LogLevel(-2) string("Reseting bounds of variable ", getname(var))
@logmsg LogLevel(-2) string("Reseting bounds of variable ", getname(form, var))
setcurlb!(form, var, var_state.lb)
setcurub!(form, var, var_state.ub)
@logmsg LogLevel(-3) string("New lower bound is ", getcurlb(form, var))
@logmsg LogLevel(-3) string("New upper bound is ", getcurub(form, var))
end
# Cost
if getcurcost(form, var) != var_state.cost
@logmsg LogLevel(-2) string("Reseting cost of variable ", getname(var))
@logmsg LogLevel(-2) string("Reseting cost of variable ", getname(form, var))
setcurcost!(form, var, var_state.cost)
@logmsg LogLevel(-3) string("New cost is ", getcurcost(form, var))
end
Expand All @@ -108,7 +108,7 @@ end
function apply_data!(form::Formulation, constr::Constraint, constr_state::ConstrState)
# Rhs
if getcurrhs(form, constr) != constr_state.rhs
@logmsg LogLevel(-2) string("Reseting rhs of constraint ", getname(constr))
@logmsg LogLevel(-2) string("Reseting rhs of constraint ", getname(form, constr))
setrhs!(form, constr, constr_state.rhs)
@logmsg LogLevel(-3) string("New rhs is ", getcurrhs(form, constr))
end
Expand All @@ -117,7 +117,7 @@ end

function reset_var_constr!(form::Formulation, active_var_constrs, var_constrs_in_formulation)
for (id, vc) in var_constrs_in_formulation
@logmsg LogLevel(-4) "Checking " getname(vc)
@logmsg LogLevel(-4) "Checking " getname(form, vc)
# vc should NOT be active but is active in formulation
if !haskey(active_var_constrs, id) && getcurisactive(form, vc)
@logmsg LogLevel(-4) "Deactivating"
Expand Down
2 changes: 1 addition & 1 deletion src/Containers/solsandbounds.jl
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ end
Base.promote_rule(B::Type{<:Bound}, ::Type{<:AbstractFloat}) = B
Base.promote_rule(B::Type{<:Bound}, ::Type{<:Integer}) = B
Base.promote_rule(B::Type{<:Bound}, ::Type{<:AbstractIrrational}) = B
Base.promote_rule(::Type{Bound{Primal,Se}}, ::Type{Bound{Dual,Se}}) where {Se<:Coluna.AbstractSense} = Float64
Base.promote_rule(::Type{<:Bound{<:Primal,Se}}, ::Type{<:Bound{<:Dual,Se}}) where {Se<:Coluna.AbstractSense} = Float64

Base.convert(::Type{<:AbstractFloat}, b::Bound) = b.value
Base.convert(::Type{<:Integer}, b::Bound) = b.value
Expand Down
3 changes: 2 additions & 1 deletion src/MathProg/MOIinterface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,8 @@ function fill_dual_result!(optimizer::MoiOptimizer,
for (id, constr) in constrs
moi_index = getindex(getmoirecord(constr))
val = MOI.get(inner, MOI.ConstraintDual(res_idx), moi_index)
if val > 0.000001 || val < - 0.000001 # todo use a tolerance
val = round(val, digits = Coluna._params_.tol_digits)
if abs(val) > Coluna._params_.tol
@logmsg LogLevel(-4) string("Constr ", constr.name, " = ", val)
push!(solconstrs, id)
push!(solvals, val)
Expand Down