# How to debug "Initial guess is not an interior point" in Optim.jl?

**URL:** <https://discourse.julialang.org/t/how-to-debug-initial-guess-is-not-an-interior-point-in-optim-jl/75554>\
**Category:** Optimization (Mathematical)\
**Tags:** optim\
**Created:** [January 31, 2022, 11:19pm UTC](https://discourse.julialang.org/t/how-to-debug-initial-guess-is-not-an-interior-point-in-optim-jl/75554 "2022-01-31T23:19:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ForceBru](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/forcebru/32/21389_2.png) [@ForceBru](https://discourse.julialang.org/u/ForceBru)\
**Post date:** [January 31, 2022, 11:19pm UTC](https://discourse.julialang.org/t/how-to-debug-initial-guess-is-not-an-interior-point-in-optim-jl/75554/1 "2022-01-31T23:19:11Z")

</div>

I’m trying to do constrained optimization using `IPointNewton` in Optim.jl, but running `optimize(objective, dfc, θ0, IPNewton(), autodiff=:forward)` produces:

> Initial guess is not an interior point

…and then the results are all `NaN`s.

However, I’m pretty sure the initial point `θ0` is fine:

1. It lies within its boundaries: `all(θ0 .≥ θ_lo) == true` and `all(θ0 .≤ θ_hi) == true`
2. Constraints also lie within boundaries at this point: `all(constr(θ0) .≥ constr_lo) == true` and `all(constr(θ0) .≤ constr_hi) == true`
3. The objective function is well-defined at this point: `objective(θ0) == 124.83061652726853`

Here, `constr` returns a vector of two constraints like `[c1, c2]`.

What else should I check?

---

<div class="post-metadata">

**Author:** ![ForceBru](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/forcebru/32/21389_2.png) [@ForceBru](https://discourse.julialang.org/u/ForceBru)\
**Post date:** [January 31, 2022, 11:23pm UTC](https://discourse.julialang.org/t/how-to-debug-initial-guess-is-not-an-interior-point-in-optim-jl/75554/2 "2022-01-31T23:23:27Z")

</div>

I posted to the wrong category by mistake. Is it possible to move this post to “Optimization”?

---

<div class="post-metadata">

**Author:** ![cvanaret](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cvanaret/32/11594_2.png) [@cvanaret](https://discourse.julialang.org/u/cvanaret)\
**Post date:** [January 31, 2022, 11:36pm UTC](https://discourse.julialang.org/t/how-to-debug-initial-guess-is-not-an-interior-point-in-optim-jl/75554/3 "2022-01-31T23:36:43Z")

</div>

In this context, interior point means **strictly** interior. That is l\_i \< x\_i \< u\_i for all i.

---

<div class="post-metadata">

**Author:** ![ForceBru](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/forcebru/32/21389_2.png) [@ForceBru](https://discourse.julialang.org/u/ForceBru)\
**Post date:** [January 31, 2022, 11:41pm UTC](https://discourse.julialang.org/t/how-to-debug-initial-guess-is-not-an-interior-point-in-optim-jl/75554/4 "2022-01-31T23:41:11Z")

</div>

Right, I found the `isinterior` function in Optim whose documentation comment [says](https://github.com/JuliaNLSolvers/Optim.jl/blob/68237d87334d082d835b48f949a76e864fd42539/src/multivariate/solvers/constrained/ipnewton/interior.jl#L830-L837):

```nohighlight
Return `true` if point `x` is on the interior of the allowed region,
given the `constraints` which specify bounds `lx`, `ux`, `lc`, and
`uc`. `x` is in the interior if
    lx[i] < x[i] < ux[i]
    lc[i] < c[i] < uc[i]
for all possible `i`.

```

Indeed, the inequalities are strict, but one of my `theta`s was right on the boundary of the parameter space (exactly equal to zero). I changed it to `1e-5`, and now everything works fine.
