Skip to content

Commit

Permalink
Fix indexing bug in copy_to (#101)
Browse files Browse the repository at this point in the history
* Fix indexing bug in copy_to

* Add trailing newline

* Bump version for new release
  • Loading branch information
odow authored Oct 27, 2020
1 parent 9012c3f commit 0f30c44
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Clp"
uuid = "e2554f3b-3117-50c0-817c-e040a3ddf72d"
repo = "https://github.com/jump-dev/Clp.jl.git"
version = "0.8.1"
version = "0.8.2"

[deps]
BinaryProvider = "b99e7846-7c00-51b0-8f62-c81ae34c0232"
Expand Down
2 changes: 1 addition & 1 deletion src/MOI_wrapper/MOI_wrapper.jl
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ function _extract_row_data(src, mapping, lb, ub, I, J, V, ::Type{S}) where S
end
mapping.conmap[c_index] = MOI.ConstraintIndex{
MOI.ScalarAffineFunction{Float64}, S
}(length(ub))
}(row)
row += 1
end
return
Expand Down
16 changes: 16 additions & 0 deletions test/MOI_wrapper.jl
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,19 @@ end
@test MOI.get(model, MOI.RawParameter(key)) == value
end
end

@testset "copy_to bug" begin
model = MOI.Utilities.Model{Float64}()
x = MOI.add_variable(model)
con = [
MOI.add_constraint(
model,
MOI.ScalarAffineFunction([MOI.ScalarAffineTerm(1.0, x)], 0.0),
MOI.EqualTo(1.0),
)
for i = 1:2
]
clp = Clp.Optimizer()
index_map = MOI.copy_to(clp, model)
@test index_map[con[1]] != index_map[con[2]]
end

2 comments on commit 0f30c44

@odow
Copy link
Member Author

@odow odow commented on 0f30c44 Oct 27, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/23737

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.8.2 -m "<description of version>" 0f30c4494d1ad1d19ae94178e602850d17fab989
git push origin v0.8.2

Please sign in to comment.