miller_ocp.py
def _set_initial_states(self, X0: np.array = None):
        """
        Set the initial states of the optimal control problem.
        """
        if self.ode_solver.is_direct_shooting:
            if X0 is None:
                self.x_init.add([0] * (self.n_q + self.n_q))
            else:
                mesh_point_init = 0
                for i in range(self.n_phases):
                    self.x_init.add(
                        X0[:, mesh_point_init : mesh_point_init + self.n_shooting[i] + 1],
                        interpolation=InterpolationType.EACH_FRAME,
                    )
                    mesh_point_init += self.n_shooting[i]

        elif self.ode_solver.is_direct_collocation:
            mesh_point_init = 0
            for i in range(self.n_phases):
                xtemp = X0[:, mesh_point_init : mesh_point_init + self.n_shooting[i] + 1]
                n = self.ode_solver.polynomial_degree
                xtemp = np.repeat(xtemp, n + 1, axis=1)
                xtemp = xtemp[:, :-n]

                self.x_init.add(
                    xtemp,
                    interpolation=InterpolationType.EACH_FRAME,
                )
                mesh_point_init += self.n_shooting[i]

        Set the initial states of the optimal control problem.
        
Set the initial states of the optimal control problem.
Set the initial states of the optimal control problem .
def _set_initial_states(self, X0: np.array = None):
        if self.ode_solver.is_direct_shooting:
            if X0 is None:
                self.x_init.add([0] * (self.n_q + self.n_q))
            else:
                mesh_point_init = 0
                for i in range(self.n_phases):
                    self.x_init.add(
                        X0[:, mesh_point_init : mesh_point_init + self.n_shooting[i] + 1],
                        interpolation=InterpolationType.EACH_FRAME,
                    )
                    mesh_point_init += self.n_shooting[i]
        elif self.ode_solver.is_direct_collocation:
            mesh_point_init = 0
            for i in range(self.n_phases):
                xtemp = X0[:, mesh_point_init : mesh_point_init + self.n_shooting[i] + 1]
                n = self.ode_solver.polynomial_degree
                xtemp = np.repeat(xtemp, n + 1, axis=1)
                xtemp = xtemp[:, :-n]
                self.x_init.add(
                    xtemp,
                    interpolation=InterpolationType.EACH_FRAME,
                )
                mesh_point_init += self.n_shooting[i]
def _set_initial_states ( self , X0 : np . array = None ) : if self . ode_solver . is_direct_shooting : if X0 is None : self . x_init . add ( [ 0 ] * ( self . n_q + self . n_q ) ) else : mesh_point_init = 0 for i in range ( self . n_phases ) : self . x_init . add ( X0 [ : , mesh_point_init : mesh_point_init + self . n_shooting [ i ] + 1 ] , interpolation = InterpolationType . EACH_FRAME , ) mesh_point_init += self . n_shooting [ i ] elif self . ode_solver . is_direct_collocation : mesh_point_init = 0 for i in range ( self . n_phases ) : xtemp = X0 [ : , mesh_point_init : mesh_point_init + self . n_shooting [ i ] + 1 ] n = self . ode_solver . polynomial_degree xtemp = np . repeat ( xtemp , n + 1 , axis = 1 ) xtemp = xtemp [ : , : - n ] self . x_init . add ( xtemp , interpolation = InterpolationType . EACH_FRAME , ) mesh_point_init += self . n_shooting [ i ]
Set the initial states of the optimal control problem.
Set the initial states of the optimal control problem .
"""
        Set the initial states of the optimal control problem.
        """
self
X0
np.array