# Frameworks, or libraries to use for feasibility problems?

**URL:** <https://discourse.julialang.org/t/frameworks-or-libraries-to-use-for-feasibility-problems/93114>\
**Category:** Optimization (Mathematical)\
**Tags:** question, package, optimization\
**Created:** [January 17, 2023, 9:12pm UTC](https://discourse.julialang.org/t/frameworks-or-libraries-to-use-for-feasibility-problems/93114 "2023-01-17T21:12:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rakshith95](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rakshith95/32/44606_2.png) [@rakshith95](https://discourse.julialang.org/u/rakshith95)\
**Post date:** [January 17, 2023, 9:12pm UTC](https://discourse.julialang.org/t/frameworks-or-libraries-to-use-for-feasibility-problems/93114/1 "2023-01-17T21:12:05Z")

</div>

Hello,  
I have a problem where I need to find the closest (min norm) point to my data which is feasible under some (non convex) polynomial constraints. What would be the best framework/ libraries to use for a problem like this?

---

<div class="post-metadata">

**Author:** ![ParadaCarleton](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/paradacarleton/32/20005_2.png) [@ParadaCarleton](https://discourse.julialang.org/u/ParadaCarleton)\
**Post date:** [January 18, 2023, 8:11pm UTC](https://discourse.julialang.org/t/frameworks-or-libraries-to-use-for-feasibility-problems/93114/2 "2023-01-18T20:11:38Z")

</div>

JuMP.jl is probably your best bet for the framework. You can look at the nonlinear solvers offered there.

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [January 19, 2023, 2:31am UTC](https://discourse.julialang.org/t/frameworks-or-libraries-to-use-for-feasibility-problems/93114/3 "2023-01-19T02:31:35Z")

</div>

@rakshith95, here’s something to get you started:

```julia
using JuMP, Ipopt
N = 10
point = rand(N)
model = Model(Ipopt.Optimizer)
@variable(model, x[1:N])
@objective(model, Min, sum((x[i] - point[i])^2 for i in 1:N))
@NLconstraint(model, x[1]^2 - x[2]^2 <= 1) # Or something
optimize!(model)
value.(x)

```

---

<div class="post-metadata">

**Author:** ![dpo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dpo/32/3335_2.png) [@dpo](https://discourse.julialang.org/u/dpo)\
**Post date:** [January 21, 2023, 4:24pm UTC](https://discourse.julialang.org/t/frameworks-or-libraries-to-use-for-feasibility-problems/93114/4 "2023-01-21T16:24:09Z")

</div>

It would be easy to model your problem in pure Julia using [ADNLPModels](https://github.com/JuliaSmoothOptimizers/ADNLPModels.jl) provided the constraints are smooth. You will also want to minimize the squared distance (assuming you are talking about Euclidean distance).

Then you can pass your model to [Percival](https://github.com/JuliaSmoothOptimizers/Percival.jl) or [Ipopt](https://github.com/JuliaSmoothOptimizers/NLPModelsIpopt.jl) for solution.

---

<div class="post-metadata">

**Author:** ![rakshith95](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rakshith95/32/44606_2.png) [@rakshith95](https://discourse.julialang.org/u/rakshith95)\
**Post date:** [January 23, 2023, 10:53am UTC](https://discourse.julialang.org/t/frameworks-or-libraries-to-use-for-feasibility-problems/93114/5 "2023-01-23T10:53:49Z")

</div>

Thank you for the suggestions. I tried JuMP+Ipopt but it’s a bit slower than I need, and has too many parameters I need to look at, so I’m just going to write an iterative algorithm for my problem.
