After using VS Code debugger (compiled mode), error message of Optimization.jl appeared for a previously working code

I have a working Julia code, which was converted from a working Matlab code. There were some minor differences in the results. I wanted to confirm whether they were due to an imperfect conversion of Matlab’s fmincon function. To achieve this, I started learning to use the VS Code debugger and realized from some post that enabling the complied mode will speed things up. I have some programming experience, mainly in R, but have not had the experience of using a debugger (even for R).

As said, my Julia code was working before using VS Code debugger (compiled mode). But the debugger halted due to an exception (caused by an error with the message provided further below) that I could not step over. I was surprised and tried to run the code without the debugger. But the error below still appeared.

It is an error concerning using box constraints with the algorithm Opt of Optimization.jl. But it seems to be caused by the previous use of VS Code debugger (compiled mode). I confirmed this by running the code in another Windows 10 pc with Julia 1.8.2. The code ran through without throwing an error.

My questions:

  1. How can I use the VS Code debugger (compiled mode) without causing the issue here?
    • Using the VS Code debugger without the compiled mode appears to be very slowly
  2. What is the easiest way to reset my VS Code setup back to the state before using the VS Code debugger (compiled mode), without a reinstallation of everything?
  3. Is there a straightforward one-function equivalent in Julia for Matlab’s fmincon() with only lower- & upper-bound box constraints?
    • My current converson using Optimization.jl is a bit unnecessarily complicated – eg, I have no parameters in the objective function but Optimization.jl seems to require specifying a parameter vector anyway.

I am new to Julia. Any advice would be very much appreciated. Thanks.

ERROR: The algorithm Opt does not support box constraints. Either remove the `lb` or `ub` bounds passed to `OptimizationProblem` or use a different algorithm.
Stacktrace:
 [1] solve(::OptimizationProblem{true, OptimizationFunction{true, Optimization.AutoForwardDiff{nothing}, var"#fn#5", Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, Vector{Float64}, SciMLBase.NullParameters, Vector{Float64}, Vector{Float64}, Nothing, Nothing, Nothing, Nothing, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}, ::Opt; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ SciMLBase C:\Users\sbbg070\.julia\packages\SciMLBase\pmQ12\src\solve.jl:79
 [2] solve(::OptimizationProblem{true, OptimizationFunction{true, Optimization.AutoForwardDiff{nothing}, var"#fn#5", Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, Vector{Float64}, SciMLBase.NullParameters, Vector{Float64}, Vector{Float64}, Nothing, Nothing, Nothing, Nothing, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}, ::Opt)
   @ SciMLBase C:\Users\sbbg070\.julia\packages\SciMLBase\pmQ12\src\solve.jl:78
 [3] top-level scope
   @ d:\github\DynamicPanel\Application\app1\main_app.jl:217
1 Like