That fixed the error for SCIP, thanks. When I try to use Alpine instead, I get the following error.
using JuMP
#using SCIP
N1 = 5
N = 10
zp = 2
M = zp*N
Br = rand(M,N1)
Bi = rand(M,N1)
s = rand(M,1)
#model = Model(SCIP.Optimizer)
using JuMP, Alpine, Ipopt, HiGHS, Juniper
ipopt = optimizer_with_attributes(Ipopt.Optimizer, "print_level" => 0)
highs = optimizer_with_attributes(HiGHS.Optimizer, "output_flag" => false)
juniper = optimizer_with_attributes(
Juniper.Optimizer,
MOI.Silent() => true,
"mip_solver" => highs,
"nl_solver" => ipopt,
)
model = Model(
optimizer_with_attributes(
Alpine.Optimizer,
"nlp_solver" => ipopt,
"mip_solver" => highs,
"minlp_solver" => juniper
),
)
@variable(model, y[1:N1], Bin)
@expression(model, yh[n=1:N1], y[n]-.5)
@expression(model, spec_r, Br*yh)
@expression(model, spec_i, Bi*yh)
@NLexpression(model, spec_sq_mag[m in 1:M], spec_r[m]^2 + spec_i[m]^2)
@variable(model, gamma)
@NLconstraint(model, gamma >= sum((spec_sq_mag[m]-s[m])^2 for m in 1:M))
@objective(model, Min, gamma)
optimize!(model)
ERROR: LoadError: type Symbol has no field head
Stacktrace:
[1] getproperty
@ ./Base.jl:37 [inlined]
[2] traverse_expr_linear_to_affine(expr::Symbol, lhscoeffs::Vector{Any}, lhsvars::Vector{Any}, rhs::Float64, bufferVal::Nothing, bufferVar::Nothing, sign::Float64, coef::Float64, level::Int64)
@ Alpine ~/.julia/packages/Alpine/2DP5q/src/nlexpr.jl:356
[3] traverse_expr_linear_to_affine(expr::Expr, lhscoeffs::Vector{Any}, lhsvars::Vector{Any}, rhs::Float64, bufferVal::Nothing, bufferVar::Nothing, sign::Float64, coef::Float64, level::Int64) (repeats 4 times)
@ Alpine ~/.julia/packages/Alpine/2DP5q/src/nlexpr.jl:374
[4] traverse_expr_linear_to_affine(expr::Expr)
@ Alpine ~/.julia/packages/Alpine/2DP5q/src/nlexpr.jl:332
[5] expr_linear_to_affine(expr::Expr)
@ Alpine ~/.julia/packages/Alpine/2DP5q/src/nlexpr.jl:287
[6] expr_conversion(m::Alpine.Optimizer)
@ Alpine ~/.julia/packages/Alpine/2DP5q/src/nlexpr.jl:103
[7] process_expr(m::Alpine.Optimizer)
@ Alpine ~/.julia/packages/Alpine/2DP5q/src/nlexpr.jl:10
[8] load!(m::Alpine.Optimizer)
@ Alpine ~/.julia/packages/Alpine/2DP5q/src/main_algorithm.jl:110
[9] optimize!(m::Alpine.Optimizer)
@ Alpine ~/.julia/packages/Alpine/2DP5q/src/main_algorithm.jl:151
[10] optimize!
@ ~/.julia/packages/MathOptInterface/2CULs/src/Bridges/bridge_optimizer.jl:380 [inlined]
[11] optimize!
@ ~/.julia/packages/MathOptInterface/2CULs/src/MathOptInterface.jl:85 [inlined]
[12] optimize!(m::MathOptInterface.Utilities.CachingOptimizer{MathOptInterface.Bridges.LazyBridgeOptimizer{Alpine.Optimizer}, MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Utilities.Model{Float64}}})
@ MathOptInterface.Utilities ~/.julia/packages/MathOptInterface/2CULs/src/Utilities/cachingoptimizer.jl:316
[13] optimize!(model::Model; ignore_optimize_hook::Bool, _differentiation_backend::MathOptInterface.Nonlinear.SparseReverseMode, kwargs::@Kwargs{})
@ JuMP ~/.julia/packages/JuMP/Gwn88/src/optimizer_interface.jl:457
[14] optimize!(model::Model)
@ JuMP ~/.julia/packages/JuMP/Gwn88/src/optimizer_interface.jl:409
[15] top-level scope
@ ~/julia_code/Gen7_BPM/simple_model.jl:44
in expression starting at /home/stuart/julia_code/Gen7_BPM/simple_model.jl:44