def solve_ilqr(solver, x0, u_guess):
    """
    Convienience function for solving the optimization
    problem from the given initial state with the given
    guess of control inputs.
    """
    solver.SetInitialState(x0)
    solver.SetInitialGuess(u_guess)

    states, inputs, solve_time, optimal_cost = solver.Solve()
    return states, inputs, solve_time, optimal_cost