Skip to content

Commit

Permalink
Restrict scope for NumberOfReads attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
pedromxavier committed Dec 4, 2023
1 parent e3c91c7 commit de8f6b7
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions ext/QUBOTools_MOI/num_reads.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ struct NumberOfReads <: MOI.AbstractModelAttribute
result_index::Int

function NumberOfReads(result_index::Integer = 1)
@assert result_index > 0

new(result_index)
end
end
Expand All @@ -15,18 +17,6 @@ function MOI.is_set_by_optimize(::NumberOfReads)
return true
end

function MOI.supports(::MOI.ModelLike, ::NumberOfReads)
return true
end

function MOI.get(model::MOI.ModelLike, attr::NumberOfReads)
MOI.check_result_index_bounds(model, attr)

# By default, solvers that do not implement their own method
# will not account for solution multiplicity.
return 1
end

# The function takes no arguments and returns the NumberOfReads type.
# Other packages will assign its return value to a constant, e.g.,
#
Expand Down

0 comments on commit de8f6b7

Please sign in to comment.