Beispiel #1
0
    def _set_optimization_variables_initials(self, pinit, xinit):

        xinit = inputchecks.check_states_data(xinit, \
            self._discretization.system.nx, \
            self._discretization.number_of_intervals)
        repretitions_xinit = \
            self._discretization.optimization_variables["X"][:,:-1].shape[1] / \
                self._discretization.number_of_intervals
        
        Xinit = ci.repmat(xinit[:, :-1], repretitions_xinit, 1)

        Xinit = ci.horzcat([ \

            Xinit.reshape((self._discretization.system.nx, \
                Xinit.size() / self._discretization.system.nx)),
            xinit[:, -1],

            ])

        pinit = inputchecks.check_parameter_data(pinit, \
            self._discretization.system.np)
        Pinit = pinit

        Vinit = np.zeros(self._discretization.optimization_variables["V"].shape)
        EPS_Uinit = np.zeros( \
            self._discretization.optimization_variables["EPS_U"].shape)

        self._optimization_variables_initials = ci.veccat([ \

                Pinit,
                Xinit,
                EPS_Uinit,
                Vinit,

            ])
Beispiel #2
0
    def __generate_simulation_ode(self, pdata, qdata):

        p = inputchecks.check_parameter_data(pdata, self.__system.np)
        q = inputchecks.check_constant_controls_data(qdata, self.__system.nq)

        ode_fcn = ci.mx_function("ode_fcn", \
            [self.__system.u, self.__system.q, self.__system.x, \
            self.__system.eps_u, self.__system.p], \
            [self.__system.f])

        # Needs to be changes for allowance of explicit time dependecy!

        self.__ode_parameters_applied = ode_fcn.call([ \
            self.__system.u, q, self.__system.x, \
            np.zeros(self.__system.neps_u), p])[0]
Beispiel #3
0
    def __generate_simulation_ode(self, pdata, qdata):

        p = inputchecks.check_parameter_data(pdata, self.__system.np)
        q = inputchecks.check_constant_controls_data(qdata, self.__system.nq)

        ode_fcn = ci.mx_function(
            "ode_fcn",
            [self.__system.u, self.__system.q, self.__system.x, self.__system.eps_u, self.__system.p],
            [self.__system.f],
        )

        # Needs to be changes for allowance of explicit time dependency!

        self.__ode_parameters_applied = ode_fcn(
            [self.__system.u, q, self.__system.x, np.zeros(self.__system.neps_u), p]
        )[0]
Beispiel #4
0
    def _set_optimization_variables_initials(self, pinit, xinit):

        xinit = inputchecks.check_states_data(xinit, \
            self._discretization.system.nx, \
            self._discretization.number_of_intervals)
        repretitions_xinit = \
            self._discretization.optimization_variables["X"][:,:-1].shape[1] / \
                self._discretization.number_of_intervals

        Xinit = ci.repmat(xinit[:, :-1], repretitions_xinit, 1)

        Xinit = ci.horzcat([ \

            Xinit.reshape((self._discretization.system.nx, \
                Xinit.numel() / self._discretization.system.nx)),
            xinit[:, -1],

            ])

        pinit = inputchecks.check_parameter_data(pinit, \
            self._discretization.system.np)
        Pinit = pinit

        Vinit = np.zeros(
            self._discretization.optimization_variables["V"].shape)
        EPS_Uinit = np.zeros( \
            self._discretization.optimization_variables["EPS_U"].shape)

        self._optimization_variables_initials = ci.veccat([ \

                Pinit,
                Xinit,
                Vinit,
                EPS_Uinit,

            ])
Beispiel #5
0
    def _set_parameter_guess(self, pdata):

        self._pdata = inputchecks.check_parameter_data(pdata, \
            self._discretization.system.np)
Beispiel #6
0
    def _set_parameter_guess(self, pdata):

        self._pdata = inputchecks.check_parameter_data(pdata, \
            self._discretization.system.np)