Skip to content

Commit

Permalink
🤖 Format .jl files
Browse files Browse the repository at this point in the history
  • Loading branch information
paraynaud committed Jan 26, 2023
1 parent 1397b7c commit 33566ec
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/partitionedNLPModels/PBFGSNLPModels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ mutable struct PBFGSNLPModel{
name::Symbol
end

function PBFGSNLPModel(nlp::SupportedNLPModel; type::DataType = Float64, merging::Bool=true)
function PBFGSNLPModel(nlp::SupportedNLPModel; type::DataType = Float64, merging::Bool = true)
n = nlp.meta.nvar
ex = get_expression_tree(nlp)

Expand Down
2 changes: 1 addition & 1 deletion src/partitionedNLPModels/PCSNLPModels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ mutable struct PCSNLPModel{
name::Symbol
end

function PCSNLPModel(nlp::SupportedNLPModel; type::DataType = Float64, merging::Bool=true)
function PCSNLPModel(nlp::SupportedNLPModel; type::DataType = Float64, merging::Bool = true)
n = nlp.meta.nvar
ex = get_expression_tree(nlp)

Expand Down
2 changes: 1 addition & 1 deletion src/partitionedNLPModels/PLBFGSNLPModels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ mutable struct PLBFGSNLPModel{
name::Symbol
end

function PLBFGSNLPModel(nlp::SupportedNLPModel; type::DataType = Float64, merging::Bool=true)
function PLBFGSNLPModel(nlp::SupportedNLPModel; type::DataType = Float64, merging::Bool = true)
n = nlp.meta.nvar
ex = get_expression_tree(nlp)

Expand Down
2 changes: 1 addition & 1 deletion src/partitionedNLPModels/PLSENLPModels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ mutable struct PLSENLPModel{
name::Symbol
end

function PLSENLPModel(nlp::SupportedNLPModel; type::DataType = Float64, merging::Bool=true)
function PLSENLPModel(nlp::SupportedNLPModel; type::DataType = Float64, merging::Bool = true)
n = nlp.meta.nvar
ex = get_expression_tree(nlp)

Expand Down
2 changes: 1 addition & 1 deletion src/partitionedNLPModels/PLSR1NLPModels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ mutable struct PLSR1NLPModel{
name::Symbol
end

function PLSR1NLPModel(nlp::SupportedNLPModel; type::DataType = Float64, merging::Bool=true)
function PLSR1NLPModel(nlp::SupportedNLPModel; type::DataType = Float64, merging::Bool = true)
n = nlp.meta.nvar
ex = get_expression_tree(nlp)

Expand Down
2 changes: 1 addition & 1 deletion src/partitionedNLPModels/PSENLPModels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ mutable struct PSENLPModel{
name::Symbol
end

function PSENLPModel(nlp::SupportedNLPModel; type::DataType = Float64, merging::Bool=true)
function PSENLPModel(nlp::SupportedNLPModel; type::DataType = Float64, merging::Bool = true)
n = nlp.meta.nvar
ex = get_expression_tree(nlp)

Expand Down
2 changes: 1 addition & 1 deletion src/partitionedNLPModels/PSNLPModels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ mutable struct PSNLPModel{
name::Symbol
end

function PSNLPModel(nlp::SupportedNLPModel; type::DataType = Float64, merging::Bool=true)
function PSNLPModel(nlp::SupportedNLPModel; type::DataType = Float64, merging::Bool = true)
n = nlp.meta.nvar
ex = get_expression_tree(nlp)

Expand Down
2 changes: 1 addition & 1 deletion src/partitionedNLPModels/PSR1NLPModels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ mutable struct PSR1NLPModel{
name::Symbol
end

function PSR1NLPModel(nlp::SupportedNLPModel; type::DataType = Float64, merging::Bool=true)
function PSR1NLPModel(nlp::SupportedNLPModel; type::DataType = Float64, merging::Bool = true)
n = nlp.meta.nvar
ex = get_expression_tree(nlp)

Expand Down
11 changes: 7 additions & 4 deletions src/partitionedNLPModels/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ function partitioned_structure(
n::Int;
type::DataType = Float64,
name = :plse,
merging::Bool=true,
merging::Bool = true,
kwargs...,
) where {G}

Expand All @@ -116,14 +116,17 @@ function partitioned_structure(
)::Vector{Vector{Int}}

mem_dense_elements = sum((element_var -> length(element_var)^2).(element_variables))
mem_linear_operator_elements = sum((element_var -> length(element_var)*5*2).(element_variables))
max_authorised_mem = n^3/log(n) # mem limit
mem_linear_operator_elements =
sum((element_var -> length(element_var) * 5 * 2).(element_variables))
max_authorised_mem = n^3 / log(n) # mem limit
if merging && (mem_dense_elements > max_authorised_mem) && (name [:pbfgs, :pse, :psr1, :pcs])
@warn "mem usage to important, reduction to a unstructrued structure"
N = 1
vec_element_function = [expr_tree]
element_variables = [[1:n;]]
elseif merging && (mem_linear_operator_elements > max_authorised_mem) && (name [:plbfgs, :plse, :plsr1])
elseif merging &&
(mem_linear_operator_elements > max_authorised_mem) &&
(name [:plbfgs, :plse, :plsr1])
@warn "mem usage to important, reduction to a unstructrued structure"
N = 1
vec_element_function = [expr_tree]
Expand Down
11 changes: 5 additions & 6 deletions test/pqnnlp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,12 @@ end
@test ges_psnlp.status == :first_order
end


@testset "Merge, from a limit function" begin
function limit(x; n=length(x))
sum(sum( sum(x[j] for j in 1:n)^2 * x[i] * x[z] for i in 1:n) for z in 1:n)
function limit(x; n = length(x))
sum(sum(sum(x[j] for j = 1:n)^2 * x[i] * x[z] for i = 1:n) for z = 1:n)
end
start_limit(n :: Int) = ones(n)
start_limit(n::Int) = ones(n)

n = 10
adnlp = ADNLPModel(limit, start_limit(n))

Expand All @@ -99,4 +98,4 @@ end
psr1nlp = PSR1NLPModel(adnlp)
psenlp = PSENLPModel(adnlp)
psnlp = PSNLPModel(adnlp)
end
end

0 comments on commit 33566ec

Please sign in to comment.