From dd709aab1eeba5ff89f8f5813818ad6700cbd670 Mon Sep 17 00:00:00 2001 From: goulart-paul Date: Wed, 12 Jun 2024 17:36:27 +0100 Subject: [PATCH] fixes #171 --- src/chordal/merge_strategy/clique_graph.jl | 8 ++++---- src/chordal/merge_strategy/parent_child.jl | 12 ++++++------ src/chordal/types.jl | 2 +- src/json.jl | 2 +- src/kktsolvers/kktsolver_directldl.jl | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/chordal/merge_strategy/clique_graph.jl b/src/chordal/merge_strategy/clique_graph.jl index 9609eb48..d3e06af6 100644 --- a/src/chordal/merge_strategy/clique_graph.jl +++ b/src/chordal/merge_strategy/clique_graph.jl @@ -627,7 +627,7 @@ end # Find all the cliques connected to `c` which are given by the nonzeros in `(c, 1:c-1)` and `(c+1:n, c)`. function find_neighbors(edges::SparseMatrixCSC, c::DefaultInt) - neighbors = zeros(Int, 0) + neighbors = zeros(DefaultInt, 0) _, n = size(edges) # find all nonzero columns in row c up to column c if c > 1 @@ -678,13 +678,13 @@ end # to floats to allow emperical edge weight functions. function compute_weights!( - rows::Vector{Int}, - cols::Vector{Int}, + rows::Vector{DefaultInt}, + cols::Vector{DefaultInt}, snode::Vector{VertexSet}, edge_weight::EdgeWeightMethod ) - weights = zeros(Int, length(rows)) + weights = zeros(DefaultInt, length(rows)) for k = 1:length(rows) c_1 = snode[rows[k]] diff --git a/src/chordal/merge_strategy/parent_child.jl b/src/chordal/merge_strategy/parent_child.jl index a8209884..0f1dbd29 100644 --- a/src/chordal/merge_strategy/parent_child.jl +++ b/src/chordal/merge_strategy/parent_child.jl @@ -1,8 +1,8 @@ mutable struct ParentChildMergeStrategy <: AbstractMergeStrategy stop::Bool - clique_index::Int - t_fill::Int - t_size::Int + clique_index::DefaultInt + t_fill::DefaultInt + t_size::DefaultInt # PJG: fill and size need to be settable function ParentChildMergeStrategy(; t_fill = 8, t_size = 8) @@ -32,7 +32,7 @@ end # Decide whether to merge the two clique candidates. -function evaluate(strategy::ParentChildMergeStrategy, t::SuperNodeTree, cand::Tuple{Int, Int}) +function evaluate(strategy::ParentChildMergeStrategy, t::SuperNodeTree, cand::Tuple{DefaultInt, DefaultInt}) strategy.stop && return false @@ -52,7 +52,7 @@ end function merge_two_cliques!( strategy::ParentChildMergeStrategy, t::SuperNodeTree, - cand::Tuple{Int, Int} + cand::Tuple{DefaultInt, DefaultInt} ) # determine which clique is the parent @@ -85,7 +85,7 @@ end function update_strategy!( strategy::ParentChildMergeStrategy, t::SuperNodeTree, - cand::Tuple{Int, Int}, + cand::Tuple{DefaultInt, DefaultInt}, do_merge::Bool ) # try to merge last node of order 1, then stop diff --git a/src/chordal/types.jl b/src/chordal/types.jl index c0dcb69a..8f21db9a 100644 --- a/src/chordal/types.jl +++ b/src/chordal/types.jl @@ -6,7 +6,7 @@ using DataStructures abstract type AbstractMergeStrategy end -VertexSet = OrderedSet{Int} +VertexSet = OrderedSet{DefaultInt} #PJG: make a settable option @enum EdgeWeightMethod begin diff --git a/src/json.jl b/src/json.jl index 4ceaa3dd..ffa48b1c 100644 --- a/src/json.jl +++ b/src/json.jl @@ -189,7 +189,7 @@ function parse(dict::AbstractDict, ::Type{Settings{T}}) where T if key == "GenPowerConeT" vals = dict[key] α = convert(Vector{Float64}, vals[1]) - dim2 = Int(vals[2]) + dim2 = DefaultInt(vals[2]) return coneT(α,dim2) else diff --git a/src/kktsolvers/kktsolver_directldl.jl b/src/kktsolvers/kktsolver_directldl.jl index 9a00770d..3c21be56 100644 --- a/src/kktsolvers/kktsolver_directldl.jl +++ b/src/kktsolvers/kktsolver_directldl.jl @@ -152,7 +152,7 @@ end #updates KKT matrix values function _update_values_KKT!( - KKT::SparseMatrixCSC{T,Int}, + KKT::SparseMatrixCSC{T,DefaultInt}, index::AbstractVector{Ti}, values::AbstractVector{T} ) where{T,Ti}