def pymoo2fun(pb):
    """
    Takes a pymoo problem and makes of it a funtion optimizable thanks to MOO

    Parameters
    ----------
    pb : pymoo.problems
        Pymoo problem, such as those obtained thanks to get_problem from pymoo.factory.

    Returns
    -------
    f_equiv : function
        Callable function, equivalent to the one of the problem : ndarray[ne,nx] -> ndarray[ne,ny].

    """

    def f_equiv(x):
        output = {}
        pb._evaluate(x, output)
        return output["F"]

    return f_equiv