I’m trying to use Sigmoidal Programming to solve an optimization problem which is minimize (sum of concave functions) subject to linear constraints.
When I input problem = LinearSP(fs, dfs, z, A, b)
it seems to read and create the problem correctly. The output after executing this line is
LinearSP(Function[var"#1#2"{Int64}(1), var"#1#2"{Int64}(2), var"#1#2"{Int64}(3), var"#1#2"{Int64}(4), var"#1#2"{Int64}(5), var"#1#2"{Int64}(6), var"#1#2"{Int64}(7), var"#1#2"{Int64}(8), var"#1#2"{Int64}(9), var"#1#2"{Int64}(10), var"#1#2"{Int64}(11), var"#1#2"{Int64}(12), var"#1#2"{Int64}(13), var"#1#2"{Int64}(14), var"#1#2"{Int64}(15), var"#1#2"{Int64}(16), var"#1#2"{Int64}(17), var"#1#2"{Int64}(18), var"#1#2"{Int64}(19), var"#1#2"{Int64}(20)], Function[var"#3#4"{Int64}(1), var"#3#4"{Int64}(2), var"#3#4"{Int64}(3), var"#3#4"{Int64}(4), var"#3#4"{Int64}(5), var"#3#4"{Int64}(6), var"#3#4"{Int64}(7), var"#3#4"{Int64}(8), var"#3#4"{Int64}(9), var"#3#4"{Int64}(10), var"#3#4"{Int64}(11), var"#3#4"{Int64}(12), var"#3#4"{Int64}(13), var"#3#4"{Int64}(14), var"#3#4"{Int64}(15), var"#3#4"{Int64}(16), var"#3#4"{Int64}(17), var"#3#4"{Int64}(18), var"#3#4"{Int64}(19), var"#3#4"{Int64}(20)], [-Inf, -Inf, -Inf, -Inf, -Inf, -Inf, -Inf, -Inf, -Inf, -Inf, -Inf, -Inf, -Inf, -Inf, -Inf, -Inf, -Inf, -Inf, -Inf, -Inf], [1.0 1.0 … 1.0 1.0; 1.0 1.0 … 0.0 0.0; … ; -0.0 -0.0 … -0.3 -0.0; -0.0 -0.0 … 0.3 1.0], [1.0, Inf, 0.1, 0.0, 0.0, 0.0, 0.0, 0.0, -1.0, -0.5, Inf, -0.0, -0.0, -0.0, -0.0, -0.0], Matrix{Float64}(undef, 0, 20), Float64[])
However, when I try to solve it, using the code mentioned in the git repo,
pq, bestnodes, lbs, ubs = solve_sp(l, u, problem)
# the best node found yet is the top node on the priority queue
node = dequeue!(pq)
# println("best node has node.ub = $(node.ub) and solution $(node.x)")
# lbs and ubs record the upper and lower bounds on the optimal value
# found at each iteration
println("lbs: ",lbs)
println("ubs: ",ubs)
It throws the following error.
┌ Warning: The GLPK constants have been renamed from `GLPK.XXX` to `GLPK.GLP_XXX` in order to better match the C API. For example, `GLPK.MSG_OFF` is now `GLPK.GLP_MSG_OFF`. Support for the old constants will be removed in a future release.
└ @ GLPK C:\Users\user\.julia\packages\GLPK\JpN1q\src\MOI_wrapper\deprecated_constants.jl:19
MethodError: no method matching ^(::Float64, ::Vector{Float64})
Closest candidates are:
^(::Number, ::Missing) at missing.jl:124
^(::T, ::Rational) where T<:AbstractFloat at rational.jl:482
^(::AbstractFloat, ::ForwardDiff.Dual{Ty}) where Ty at C:\Users\user\.julia\packages\ForwardDiff\vXysl\src\dual.jl:145
...
Stacktrace:
[1] (::var"#1#2"{Int64})(x::Float64)
@ Main .\In[6]:2
[2] macro expansion
@ C:\Users\user\.julia\packages\MutableArithmetics\0Y9ZS\src\rewrite.jl:279 [inlined]
[3] macro expansion
@ C:\Users\user\.julia\packages\JuMP\qhoVb\src\macros.jl:440 [inlined]
[4] model_problem(l::Vector{Float64}, u::Vector{Float64}, w::Vector{Float64}, problem::LinearSP, m::JuMP.Model)
@ SigmoidalProgramming C:\Users\user\.julia\packages\SigmoidalProgramming\kLcUj\src\sp.jl:91
[5] model_problem(l::Vector{Float64}, u::Vector{Float64}, w::Vector{Float64}, problem::LinearSP)
@ SigmoidalProgramming C:\Users\user\.julia\packages\SigmoidalProgramming\kLcUj\src\sp.jl:71
[6] SigmoidalProgramming.Node(l::Vector{Float64}, u::Vector{Float64}, problem::LinearSP, init_x::Type; kwargs::Base.Pairs{Symbol, Float64, Tuple{Symbol}, NamedTuple{(:TOL,), Tuple{Float64}}})
@ SigmoidalProgramming C:\Users\user\.julia\packages\SigmoidalProgramming\kLcUj\src\sp.jl:209
[7] solve_sp(l::Vector{Float64}, u::Vector{Float64}, problem::LinearSP, init_x::Type; TOL::Float64, maxiters::Int64, verbose::Int64, maxiters_noimprovement::Float64)
@ SigmoidalProgramming C:\Users\user\.julia\packages\SigmoidalProgramming\kLcUj\src\sp.jl:250
[8] solve_sp (repeats 2 times)
@ C:\Users\user\.julia\packages\SigmoidalProgramming\kLcUj\src\sp.jl:247 [inlined]
[9] top-level scope
@ In[8]:1
I cannot figure out what the error is or how to solve this error. Can anyone help me out?