Skip to content

QuadraticModels with unit range #71

@tmigot

Description

@tmigot

The idea would be to define the rows and cols using UnitRange. I am wondering whether this would be a desirable feature or not, because it looks so natural.

julia> QuadraticModel(zeros(3), 1:3, 1:3, ones(3))
ERROR: MethodError: no method matching SparseMatricesCOO.SparseMatrixCOO(::Int64, ::Int64, ::UnitRange{Int64}, ::UnitRange{Int64}, ::Vector{Float64})
Closest candidates are:
  SparseMatricesCOO.SparseMatrixCOO(::Integer, ::Integer, ::Vector, ::Vector, ::Vector) at .julia\packages\SparseMatricesCOO\z5uST\src\coo_types.jl:51
Stacktrace:
 [1] QuadraticModel(c::Vector{Float64}, Hrows::UnitRange{Int64}, Hcols::UnitRange{Int64}, Hvals::Vector{Float64}; Arows::Vector{Int64}, Acols::Vector{Int64}, Avals::Vector{Float64}, lcon::Vector{Float64}, ucon::Vector{Float64}, lvar::Vector{Float64}, uvar::Vector{Float64}, c0::Float64, sortcols::Bool, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ QuadraticModels .julia\packages\QuadraticModels\etxWq\src\qpmodel.jl:123
 [2] QuadraticModel(c::Vector{Float64}, Hrows::UnitRange{Int64}, Hcols::UnitRange{Int64}, Hvals::Vector{Float64})
   @ QuadraticModels .julia\packages\QuadraticModels\etxWq\src\qpmodel.jl:97
 [3] top-level scope
   @ REPL[5]:1
``

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions