diff --git a/compiler/generate_precompile.jl b/compiler/generate_precompile.jl index 2482667..f8dd6b3 100644 --- a/compiler/generate_precompile.jl +++ b/compiler/generate_precompile.jl @@ -94,7 +94,7 @@ ubx::Vector{Float64} = [ Inf, Inf] lbg::Vector{Float64} = [0.0] ubg::Vector{Float64} = [0.0] -max_iters::Int64 = 1000 +max_iter::Int64 = 1000 print_level::Int64 = 3 minimize::Bool = true user_data::Ptr{Cvoid} = 0 @@ -123,7 +123,7 @@ dual_feas::Vector{Float64} = [] cases::Vector{Tuple{Int,Int,Int}} = [(0,3,10),(1,3,10),(2,3,10)] # cases::Vector{Tuple{Int,Int,Int}} = [(0,3,10),(2,2,1000),(1,1,1000),(0,0,1000)] -for (lin_solver_id,print_level, max_iters) in cases +for (lin_solver_id,print_level, max_iter) in cases nlp_interface = MadnlpCInterface( @cfunction(eval_f,Cint,(Ptr{Cdouble},Ptr{Cdouble},Ptr{Cvoid})), @cfunction(eval_g,Cint,(Ptr{Cdouble},Ptr{Cdouble},Ptr{Cvoid})), @@ -157,7 +157,7 @@ for (lin_solver_id,print_level, max_iters) in cases copyto!(unsafe_wrap(Array, in_c.ubg, (ncon,)), ubg) madnlp_c_set_option_int(s, unsafe_convert(Ptr{Int8},"lin_solver_id"), lin_solver_id) - madnlp_c_set_option_int(s, unsafe_convert(Ptr{Int8},"max_iters"), max_iters) + madnlp_c_set_option_int(s, unsafe_convert(Ptr{Int8},"max_iter"), max_iter) madnlp_c_set_option_int(s, unsafe_convert(Ptr{Int8},"print_level"), print_level) madnlp_c_set_option_bool(s, unsafe_convert(Ptr{Int8},"minimize"), Int64(minimize)) diff --git a/src/MadNLP_C.jl b/src/MadNLP_C.jl index 0ac69f9..467fa54 100644 --- a/src/MadNLP_C.jl +++ b/src/MadNLP_C.jl @@ -105,7 +105,7 @@ end mutable struct MadnlpCSolver nlp_interface::MadnlpCInterface lin_solver_id::Int64 - max_iters::Int64 + max_iter::Int64 print_level::Int64 minimize::Bool in_c::MadnlpCNumericIn{Ptr{Cdouble}} @@ -255,9 +255,9 @@ function set_option(s::Ptr{MadnlpCSolver}, name::String, value::Any) if value > 5 value = 5 end if value < 0 value = 0 end s_jl.lin_solver_id = Int(value) - elseif name == "max_iters" + elseif name == "max_iter" if value < 0 value = 0 end - s_jl.max_iters = Int(value) + s_jl.max_iter = Int(value) elseif name == "minimize" s_jl.minimize = Bool(value) else @@ -278,7 +278,7 @@ Base.@ccallable function madnlp_c_create(nlp_interface::Ptr{MadnlpCInterface}):: solver = MadnlpCSolver() solver.nlp_interface = unsafe_load(nlp_interface) solver.lin_solver_id = 0 - solver.max_iters = 3000 + solver.max_iter = 3000 solver.print_level = 3 solver.minimize = true @@ -551,7 +551,7 @@ Base.@ccallable function madnlp_c_solve(s::Ptr{MadnlpCSolver})::Cint ) madnlp_solver = MadNLPSolver(nlp; print_level = madnlp_log, linear_solver = linear_solver) - res = MadNLP.solve!(madnlp_solver, max_iter = Int(solver.max_iters)) + res = MadNLP.solve!(madnlp_solver, max_iter = Int(solver.max_iter)) solver.stats_c.iter = res.iter solver.stats_c.status = Integer(res.status) diff --git a/tests/main.cpp b/tests/main.cpp index aef2f5e..660beeb 100644 --- a/tests/main.cpp +++ b/tests/main.cpp @@ -85,7 +85,7 @@ int main(int argc, char** argv) { struct MadnlpCSolver* solver = madnlp_c_create(&interf); - madnlp_c_set_option_int(solver, "max_iters", 10); + madnlp_c_set_option_int(solver, "max_iter", 10); madnlp_c_set_option_int(solver, "print_level", 3); madnlp_c_set_option_int(solver, "lin_solver_id", 1); @@ -100,13 +100,13 @@ int main(int argc, char** argv) { printf("Solving\n"); madnlp_c_solve(solver); - madnlp_c_set_option_int(solver, "max_iters", 10); + madnlp_c_set_option_int(solver, "max_iter", 10); madnlp_c_set_option_int(solver, "print_level", 3); madnlp_c_set_option_int(solver, "lin_solver_id", 2); madnlp_c_solve(solver); - madnlp_c_set_option_int(solver, "max_iters", 10); + madnlp_c_set_option_int(solver, "max_iter", 10); madnlp_c_set_option_int(solver, "print_level", 3); madnlp_c_set_option_int(solver, "lin_solver_id", 0);