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

Fix for constraint with unit coefficients #3786

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
7 changes: 7 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ jobs:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: julia-actions/cache@v1
- name: MOI
shell: julia --project=@. {0}
run: |
using Pkg
Pkg.add([
PackageSpec(name="MutableArithmetics", rev="bl/zero_number"),
])
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
with:
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ jobs:
shell: julia --color=yes --project=docs/ {0}
run: |
using Pkg
Pkg.develop(PackageSpec(path=pwd()))
Pkg.add([
PackageSpec(name="MutableArithmetics", rev="bl/zero_number"),
PackageSpec(path=pwd()),
])
Pkg.instantiate()
- name: Build and deploy
env:
Expand Down
10 changes: 5 additions & 5 deletions src/macros.jl
Original file line number Diff line number Diff line change
Expand Up @@ -300,11 +300,11 @@ Therefore, the result of [`build_constraint`](@ref) is converted in a call to
"""
model_convert(::AbstractModel, rhs::Any) = rhs

function model_convert(model::AbstractModel, set::MOI.AbstractScalarSet)
if MOI.Utilities.supports_shift_constant(typeof(set))
T = value_type(typeof(model))
return MOI.Utilities.shift_constant(set, zero(T))
end
function model_convert(::AbstractModel, set::MOI.AbstractScalarSet)
#if MOI.Utilities.supports_shift_constant(typeof(set))
# T = value_type(typeof(model))
# return MOI.Utilities.shift_constant(set, zero(T))
#end
return set
end

Expand Down
2 changes: 1 addition & 1 deletion src/macros/@constraint.jl
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,7 @@ function build_constraint(
end

function build_constraint(error_fn::Function, f, set::Zeros, args...; kwargs...)
return build_constraint(error_fn, f, MOI.EqualTo(false), args...; kwargs...)
return build_constraint(error_fn, f, MOI.EqualTo(_MA.Zero()), args...; kwargs...)
end

function build_constraint(
Expand Down
Loading