2 from __future__ 
import print_function, division
     4 from scipy.optimize 
import (
    18     Uses SciPy to solve a constrained TimeIndexedProblem. Options for SciPy minimize    20     https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.minimize.html    23     def __init__(self, problem=None, method=None, debug=False):
    24         print(
"Initialising SciPy Solver")
    37         self.problem.update(x)
    39         return self.problem.get_equality()
    42         self.problem.update(x)
    45             return self.problem.get_equality_jacobian().todense()
    47             return self.problem.get_equality_jacobian()
    50         self.problem.update(x)
    52         return -1.0 * self.problem.get_inequality()
    55         self.problem.update(x)
    58             return -1.0 * self.problem.get_inequality_jacobian().todense()
    60             return -1.0 * self.problem.get_inequality_jacobian()
    63         self.problem.update(x)
    64         return self.problem.get_cost(), self.problem.get_cost_jacobian()
    68         x0 = np.asarray(self.problem.initial_trajectory)[1:, :].flatten()
    69         x0 += np.random.normal(
    70             0.0, 1.0e-3, x0.shape[0]
    75         if self.
method != 
"trust-constr":
    76             if self.problem.inequality.length_Phi > 0:
    85             if self.problem.equality.length_Phi:
    94             if self.problem.inequality.length_Phi > 0:
   105             if self.problem.equality.length_Phi:
   118         if self.problem.use_bounds:
   120                 self.problem.get_bounds()[:, 0].repeat(self.problem.T - 1),
   121                 self.problem.get_bounds()[:, 1].repeat(self.problem.T - 1),
   135                 "initial_tr_radius": 1000.0,
   144         traj = np.zeros((self.problem.T, self.problem.N))
   145         traj[0, :] = self.problem.start_state
   146         for t 
in range(0, self.problem.T - 1):
   147             traj[t + 1, :] = res.x[t * self.problem.N : (t + 1) * self.problem.N]
 
def __init__(self, problem=None, method=None, debug=False)
def specifyProblem(self, problem)
def neq_constraint_jac(self, x)
def eq_constraint_jac(self, x)
def neq_constraint_fun(self, x)
def eq_constraint_fun(self, x)