# Problems

Bilevel optimization involves optimizing two interrelated optimization tasks, where one problem (the upper level) depends on optimal solutions of another at the lower level. This part presents test problems for bilevel optimization, including single and multi-objective scenarios.

`BilevelHeuristics.TestProblems.get_problem`

— Function`get_problem(problem)`

Return `F, f, bounds_ul, bounds_ll, Ψ, o`

where

`F`

is the upper-level objective function.`f`

is the lower-level objective function.`bounds_ul`

is the upper-level bounds.`bounds_ll`

is the lower-level bounds.`Ψ`

-mapping that receives upper-level decision vector and return a Matrix containing lower-level optimal solutions.`o`

contain a sampled optimal solutions.

**Example**

```
using BilevelHeuristics
using DelimitedFiles
F, f, bounds_ul, bounds_ll, _ = TestProblems.get_problem("TP1")
algorithm = SMS_MOBO(;
ul = SMS_EMOA(;N = 100), # upper level optimizer
ll = NSGA2(;N = 50), # lower level optimizer
ul_offsprings = 10,
options_ul = Options(iterations = 100, f_calls_limit=Inf),
options_ll = Options(iterations = 50, f_calls_limit=Inf)
)
res = optimize(F, f, bounds_ul, bounds_ll, algorithm)
final_archive = algorithm.parameters.archive
final_archive[1][1] # upper level (solution #1)
final_archive[1][2] # lower level (solution #1)
ul_front = fvals([sol[1] for sol in final_archive])
writedlm("data.csv", ul_front, ',')
```