The Mountain Car Problem#

The mountain car problem proposes a vehicle stuck in a “well.” It lacks the power to directly climb out of the well, but instead must accelerate repeatedly forwards and backwards until it has achieved the energy necessary to exit the well.

The problem is a popular machine learning test case, though the methods in Dymos are capable of solving it. It first appeared in the PhD thesis of Andrew Moore in 1990. [Moo90]. The implementation here is based on that given by Melnikov, Makmal, and Briegel [MMB14].

State and control variables#

This system has two state variables, the position (\(x\)) and velocity (\(v\)) of the car.

This system has a single control variable (\(u\)), the effort put into moving. This control is contrained to the range \([-1 \, 1]\).

The dynamics of the system are governed by

(65)#\[\begin{align} \dot{x} &= v \\ \dot{v} &= 0.001 * u - 0.0025 * \cos(3 x) \end{align}\]

Problem Definition#

We seek to minimize the time required to exit the well in the positive direction.

(66)#\[\begin{align} \mathrm{Minimize} \, J &= t_f \end{align}\]

Subject to the initial conditions

(67)#\[\begin{align} x_0 &= -0.5 \\ v_0 &= 0.0 \end{align}\]

the control constraints

(68)#\[\begin{align} |u| \le 1 \end{align}\]

and the terminal constraints

(69)#\[\begin{align} x_f &= 0.5 \\ v_f &\ge 0.0 \end{align}\]

Defining the ODE#

The following code implements the equations of motion for the mountain car problem.

A few things to note:

  1. By providing the tag dymos.state_rate_source:{name}, we’re letting Dymos know what states need to be integrated, there’s no need to specify a rate source when using this ODE in our Phase.

  2. Pairing the above tag with dymos.state_units:{units} means we don’t have to specify units when setting properties for the state in our run script.

  3. We only use compute_partials to override the values of \(\frac{\partial \dot{v}}{\partial x}\) because \(\frac{\partial \dot{v}}{\partial u}\) and \(\frac{\partial \dot{x}}{\partial v}\) are constant and their value is specified during setup.

import numpy as np
import openmdao.api as om


class MountainCarODE(om.ExplicitComponent):
    
    def initialize(self):
        self.options.declare('num_nodes', types=int)
        
    def setup(self):
        nn = self.options['num_nodes']
        
        self.add_input('x', shape=(nn,), units='m')
        self.add_input('v', shape=(nn,), units='m/s')
        self.add_input('u', shape=(nn,), units='unitless')
        
        self.add_output('x_dot', shape=(nn,), units='m/s',
                        tags=['dymos.state_rate_source:x', 'dymos.state_units:m'])
        self.add_output('v_dot', shape=(nn,), units='m/s**2',
                        tags=['dymos.state_rate_source:v', 'dymos.state_units:m/s'])
        
        ar = np.arange(nn, dtype=int)
        
        self.declare_partials(of='x_dot', wrt='v', rows=ar, cols=ar, val=1.0)
        self.declare_partials(of='v_dot', wrt='u', rows=ar, cols=ar, val=0.001)
        self.declare_partials(of='v_dot', wrt='x', rows=ar, cols=ar)

    def compute(self, inputs, outputs):
        x = inputs['x']
        v = inputs['v']
        u = inputs['u']
        outputs['x_dot'] = v
        outputs['v_dot'] = 0.001 * u - 0.0025 * np.cos(3*x)

    def compute_partials(self, inputs, partials):
        x = inputs['x']
        partials['v_dot', 'x'] = 3 * 0.0025 * np.sin(3 * x)
        

Solving the minimum-time mountain car problem with Dymos#

The following script solves the minimum-time mountain car problem with Dymos. Note that this example requires the IPOPT optimizer via the pyoptsparse package. Scipy’s SLSQP optimizer is generally not capable of solving this problem.

To begin, import the packages we require:

import dymos as dm
import matplotlib.pyplot as plt
from matplotlib import animation

Next, we set two constants. U_MAX is the maximum allowable magnitude of the acceleration. The references show this problem being solved with \(-1 \le u \le 1\).

Variable NUM_SEG is the number of equally spaced polynomial segments into which time is being divided. Within each of these segments, the time-history of each state and control is being treated as a polynomial (we’re using the default order of 3).

# The maximum absolute value of the acceleration authority of the car
U_MAX = 1.0

# The number of segments into which the problem is discretized
NUM_SEG = 30

We then instantiate an OpenMDAO problem and set the optimizer and its options.

For IPOPT, setting option nlp_scaling_method to 'gradient-based' can substantially improve the convergence of the optimizer without the need for us to set all of the scaling manually.

The call to declare_coloring tells the optimizer to attempt to find a sparsity pattern that minimizes the work required to compute the derivatives across the model.

#
# Initialize the Problem and the optimization driver
#
p = om.Problem()
               
p.driver = om.pyOptSparseDriver(optimizer='IPOPT')
p.driver.opt_settings['print_level'] = 0
p.driver.opt_settings['max_iter'] = 500
p.driver.opt_settings['mu_strategy'] = 'adaptive'
p.driver.opt_settings['bound_mult_init_method'] = 'mu-based'
p.driver.opt_settings['tol'] = 1.0E-8
p.driver.opt_settings['nlp_scaling_method'] = 'gradient-based'  # for faster convergence

p.driver.declare_coloring()

Next, we add a Dymos Trajectory group to the problem’s model and add a phase to it.

In this case we’re using the Radau pseudospectral transcription to solve the problem.

#
# Create a trajectory and add a phase to it
#
traj = p.model.add_subsystem('traj', dm.Trajectory())
tx = transcription=dm.Radau(num_segments=NUM_SEG)
phase = traj.add_phase('phase0', dm.Phase(ode_class=MountainCarODE, transcription=tx))

At this point, we set the options on the main variables used in a Dymos phase.

In addition to time, we have two states (x and v) and a single control (u).

There are no parameters and no polynomial controls. We could have tried to use a polynomial control here, but as we will see the solution contains large discontinuities in the control value, which make it ill-suited for a polynomial control. Polynomial controls are modeled as a single (typically low-order) polynomial across the entire phase.

We’re fixing the initial time and states to whatever values we provide before executing the problem. We will constrain the final values with nonlinear constraints in the next step.

The scaler values (ref) are all set to 1 here. We’re using IPOPT’s gradient-based scaling option and will let it work the scaling out for us.

Bounds on time duration are guesses, and the bounds on the states and controls come from the implementation in the references.

Also, we don’t need to specify targets for any of the variables here because their names are the targets in the top-level of the model. The rate source and units for the states are obtained from the tags in the ODE component we previously defined.

#
# Set the variables
#
phase.set_time_options(fix_initial=True, duration_bounds=(.05, 10000), duration_ref=1)

phase.add_state('x', fix_initial=True, fix_final=False, lower=-1.2, upper=0.5, ref=1, defect_ref=1)
phase.add_state('v', fix_initial=True, fix_final=False, lower=-0.07, upper=0.07, ref=1, defect_ref=1)
phase.add_control('u', lower=-U_MAX, upper=U_MAX, ref=1, continuity=True, rate_continuity=False)

Next we define the optimal control problem by specifying the objective, boundary constraints, and path constraints.

Why do we have a path constraint on the control u when we’ve already specified its bounds?

Excellent question! In the Radau transcription, the \(n^{th}\) order control polynomial is governed by design variables provided at \(n\) points in the segment that do not contain the right-most endpoint. Instead, this value is interpolated based on the values of the first \((n-1)\). Since this value is not a design variable, it is necessary to constrain its value separately. We could forgo specifying any bounds on u since it’s completely covered by the path constraint, but specifying the bounds on the design variable values can sometimes help by telling the optimizer, “Don’t even bother trying values outside of this range.”.

Note that sometimes the opposite is true, and giving the optimizer the freedom to explore a larger design space, only to eventually be “reined-in” by the path constraint can sometimes be valuable.

The purpose of this interactive documentation is to let the user experiment. If you remove the path constraint, you might notice some outlying control values in the solution below.

#
# Minimize time at the end of the phase
#
phase.add_objective('time', loc='final', ref=1000)

phase.add_boundary_constraint('x', loc='final', lower=0.5)
phase.add_boundary_constraint('v', loc='final', lower=0.0)
phase.add_path_constraint('u', lower=-U_MAX, upper=U_MAX)

#
# Setup the Problem
#
p.setup()
<openmdao.core.problem.Problem at 0x7f624f10d6a0>

We then set the initial guesses for the variables in the problem and solve it.

Since fix_initial=True is set for time and the states, those values are not design variables and will remain at the values given below throughout the solution process.

We’re using the phase interp method to provide initial guesses for the states and controls. In this case, by giving it two values, it is linearly interpolating from the first value to the second value, and then returning the interpolated value at the input nodes for the given variable.

Finally, we use the dymos.run_problem method to execute the problem. This interface allows us to do some things that the standard OpenMDAO problem.run_driver interface does not. It will automatically record the final solution achieved by the optimizer in case named 'final' in a file called dymos_solution.db. By specifying simulate=True, it will automatically follow the solution with an explicit integration using scipy.solve_ivp. The results of the simulation are stored in a case named final in the file dymos_simulation.db. This explicit simulation demonstrates how the system evolved with the given controls, and serves as a check that we’re using a dense enough grid (enough segments and segments of sufficient order) to accurately represent the solution.

If those two solution didn’t agree reasonably well, we could rerun the problem with a more dense grid. Instead, we’re asking Dymos to automatically change the grid if necessary by specifying refine_method='ph'. This will attempt to repeatedly solve the problem and change the number of segments and segment orders until the solution is in reasonable agreement.

#
# Set the initial values
#
phase.set_time_val(initial=0.0, duration=500.0)

phase.set_state_val('x', [-0.5, 0.5])
phase.set_state_val('v', [0, 0.07])
phase.set_control_val('u', [0, np.sin(1.0)])

#
# Solve for the optimal trajectory
#
dm.run_problem(p, run_driver=True, simulate=True, refine_method='ph', refine_iteration_limit=5)

Hide code cell output

Jacobian shape: (332, 271)  (1.62% nonzero)
FWD solves: 9   REV solves: 0
Total colors vs. total size: 9 vs 271  (96.68% improvement)

Sparsity computed using tolerance: 1e-25.
Dense total jacobian for Problem 'problem' was computed 3 times.
Time to compute sparsity:   0.3595 sec
Time to compute coloring:   0.2619 sec
Memory to compute coloring:   0.3750 MB
Coloring created on: 2025-07-16 18:53:03
Optimization Problem -- Optimization using pyOpt_sparse
================================================================================
    Objective Function: _objfunc

    Solution: 
--------------------------------------------------------------------------------
    Total Time:                    3.9572
       User Objective Time :       0.1383
       User Sensitivity Time :     1.9241
       Interface Time :            0.6307
       Opt Solver Time:            1.2641
    Calls to Objective Function :      93
    Calls to Sens Function :           93


   Objectives
      Index  Name                     Value
          0  traj.phase0.t     1.027055E-01

   Variables (c - continuous, i - integer, d - discrete)
      Index  Name                        Type      Lower Bound            Value      Upper Bound     Status
          0  traj.phase0.t_duration_0       c     5.000000E-02     1.027055E+02     1.000000E+04           
          1  traj.phase0.states:x_0         c    -1.200000E+00    -4.993918E-01     5.000000E-01           
          2  traj.phase0.states:x_1         c    -1.200000E+00    -4.965749E-01     5.000000E-01           
          3  traj.phase0.states:x_2         c    -1.200000E+00    -4.952113E-01     5.000000E-01           
          4  traj.phase0.states:x_3         c    -1.200000E+00    -4.912601E-01     5.000000E-01           
          5  traj.phase0.states:x_4         c    -1.200000E+00    -4.839852E-01     5.000000E-01           
          6  traj.phase0.states:x_5         c    -1.200000E+00    -4.812613E-01     5.000000E-01           
          7  traj.phase0.states:x_6         c    -1.200000E+00    -4.743104E-01     5.000000E-01           
          8  traj.phase0.states:x_7         c    -1.200000E+00    -4.632080E-01     5.000000E-01           
          9  traj.phase0.states:x_8         c    -1.200000E+00    -4.593596E-01     5.000000E-01           
         10  traj.phase0.states:x_9         c    -1.200000E+00    -4.499012E-01     5.000000E-01           
         11  traj.phase0.states:x_10        c    -1.200000E+00    -4.363637E-01     5.000000E-01           
         12  traj.phase0.states:x_11        c    -1.200000E+00    -4.322699E-01     5.000000E-01           
         13  traj.phase0.states:x_12        c    -1.200000E+00    -4.247954E-01     5.000000E-01           
         14  traj.phase0.states:x_13        c    -1.200000E+00    -4.186817E-01     5.000000E-01           
         15  traj.phase0.states:x_14        c    -1.200000E+00    -4.177845E-01     5.000000E-01           
         16  traj.phase0.states:x_15        c    -1.200000E+00    -4.176174E-01     5.000000E-01           
         17  traj.phase0.states:x_16        c    -1.200000E+00    -4.216949E-01     5.000000E-01           
         18  traj.phase0.states:x_17        c    -1.200000E+00    -4.240203E-01     5.000000E-01           
         19  traj.phase0.states:x_18        c    -1.200000E+00    -4.311748E-01     5.000000E-01           
         20  traj.phase0.states:x_19        c    -1.200000E+00    -4.451029E-01     5.000000E-01           
         21  traj.phase0.states:x_20        c    -1.200000E+00    -4.504563E-01     5.000000E-01           
         22  traj.phase0.states:x_21        c    -1.200000E+00    -4.643312E-01     5.000000E-01           
         23  traj.phase0.states:x_22        c    -1.200000E+00    -4.869305E-01     5.000000E-01           
         24  traj.phase0.states:x_23        c    -1.200000E+00    -4.948559E-01     5.000000E-01           
         25  traj.phase0.states:x_24        c    -1.200000E+00    -5.142624E-01     5.000000E-01           
         26  traj.phase0.states:x_25        c    -1.200000E+00    -5.435816E-01     5.000000E-01           
         27  traj.phase0.states:x_26        c    -1.200000E+00    -5.533911E-01     5.000000E-01           
         28  traj.phase0.states:x_27        c    -1.200000E+00    -5.766415E-01     5.000000E-01           
         29  traj.phase0.states:x_28        c    -1.200000E+00    -6.101308E-01     5.000000E-01           
         30  traj.phase0.states:x_29        c    -1.200000E+00    -6.209737E-01     5.000000E-01           
         31  traj.phase0.states:x_30        c    -1.200000E+00    -6.460627E-01     5.000000E-01           
         32  traj.phase0.states:x_31        c    -1.200000E+00    -6.808767E-01     5.000000E-01           
         33  traj.phase0.states:x_32        c    -1.200000E+00    -6.918463E-01     5.000000E-01           
         34  traj.phase0.states:x_33        c    -1.200000E+00    -7.167113E-01     5.000000E-01           
         35  traj.phase0.states:x_34        c    -1.200000E+00    -7.500849E-01     5.000000E-01           
         36  traj.phase0.states:x_35        c    -1.200000E+00    -7.603375E-01     5.000000E-01           
         37  traj.phase0.states:x_36        c    -1.200000E+00    -7.831224E-01     5.000000E-01           
         38  traj.phase0.states:x_37        c    -1.200000E+00    -8.126995E-01     5.000000E-01           
         39  traj.phase0.states:x_38        c    -1.200000E+00    -8.215465E-01     5.000000E-01           
         40  traj.phase0.states:x_39        c    -1.200000E+00    -8.407829E-01     5.000000E-01           
         41  traj.phase0.states:x_40        c    -1.200000E+00    -8.647953E-01     5.000000E-01           
         42  traj.phase0.states:x_41        c    -1.200000E+00    -8.717406E-01     5.000000E-01           
         43  traj.phase0.states:x_42        c    -1.200000E+00    -8.865112E-01     5.000000E-01           
         44  traj.phase0.states:x_43        c    -1.200000E+00    -9.033494E-01     5.000000E-01           
         45  traj.phase0.states:x_44        c    -1.200000E+00    -9.075278E-01     5.000000E-01           
         46  traj.phase0.states:x_45        c    -1.200000E+00    -9.135009E-01     5.000000E-01           
         47  traj.phase0.states:x_46        c    -1.200000E+00    -9.137393E-01     5.000000E-01           
         48  traj.phase0.states:x_47        c    -1.200000E+00    -9.118764E-01     5.000000E-01           
         49  traj.phase0.states:x_48        c    -1.200000E+00    -9.041177E-01     5.000000E-01           
         50  traj.phase0.states:x_49        c    -1.200000E+00    -8.854928E-01     5.000000E-01           
         51  traj.phase0.states:x_50        c    -1.200000E+00    -8.777040E-01     5.000000E-01           
         52  traj.phase0.states:x_51        c    -1.200000E+00    -8.565062E-01     5.000000E-01           
         53  traj.phase0.states:x_52        c    -1.200000E+00    -8.197803E-01     5.000000E-01           
         54  traj.phase0.states:x_53        c    -1.200000E+00    -8.064055E-01     5.000000E-01           
         55  traj.phase0.states:x_54        c    -1.200000E+00    -7.727638E-01     5.000000E-01           
         56  traj.phase0.states:x_55        c    -1.200000E+00    -7.198820E-01     5.000000E-01           
         57  traj.phase0.states:x_56        c    -1.200000E+00    -7.016948E-01     5.000000E-01           
         58  traj.phase0.states:x_57        c    -1.200000E+00    -6.576999E-01     5.000000E-01           
         59  traj.phase0.states:x_58        c    -1.200000E+00    -5.923141E-01     5.000000E-01           
         60  traj.phase0.states:x_59        c    -1.200000E+00    -5.706634E-01     5.000000E-01           
         61  traj.phase0.states:x_60        c    -1.200000E+00    -5.197354E-01     5.000000E-01           
         62  traj.phase0.states:x_61        c    -1.200000E+00    -4.472328E-01     5.000000E-01           
         63  traj.phase0.states:x_62        c    -1.200000E+00    -4.239589E-01     5.000000E-01           
         64  traj.phase0.states:x_63        c    -1.200000E+00    -3.704651E-01     5.000000E-01           
         65  traj.phase0.states:x_64        c    -1.200000E+00    -2.970090E-01     5.000000E-01           
         66  traj.phase0.states:x_65        c    -1.200000E+00    -2.740402E-01     5.000000E-01           
         67  traj.phase0.states:x_66        c    -1.200000E+00    -2.222405E-01     5.000000E-01           
         68  traj.phase0.states:x_67        c    -1.200000E+00    -1.531485E-01     5.000000E-01           
         69  traj.phase0.states:x_68        c    -1.200000E+00    -1.319828E-01     5.000000E-01           
         70  traj.phase0.states:x_69        c    -1.200000E+00    -8.491756E-02     5.000000E-01           
         71  traj.phase0.states:x_70        c    -1.200000E+00    -2.341765E-02     5.000000E-01           
         72  traj.phase0.states:x_71        c    -1.200000E+00    -4.829314E-03     5.000000E-01           
         73  traj.phase0.states:x_72        c    -1.200000E+00     3.615594E-02     5.000000E-01           
         74  traj.phase0.states:x_73        c    -1.200000E+00     8.913341E-02     5.000000E-01           
         75  traj.phase0.states:x_74        c    -1.200000E+00     1.050566E-01     5.000000E-01           
         76  traj.phase0.states:x_75        c    -1.200000E+00     1.400830E-01     5.000000E-01           
         77  traj.phase0.states:x_76        c    -1.200000E+00     1.853435E-01     5.000000E-01           
         78  traj.phase0.states:x_77        c    -1.200000E+00     1.989849E-01     5.000000E-01           
         79  traj.phase0.states:x_78        c    -1.200000E+00     2.291199E-01     5.000000E-01           
         80  traj.phase0.states:x_79        c    -1.200000E+00     2.684861E-01     5.000000E-01           
         81  traj.phase0.states:x_80        c    -1.200000E+00     2.804879E-01     5.000000E-01           
         82  traj.phase0.states:x_81        c    -1.200000E+00     3.072965E-01     5.000000E-01           
         83  traj.phase0.states:x_82        c    -1.200000E+00     3.430993E-01     5.000000E-01           
         84  traj.phase0.states:x_83        c    -1.200000E+00     3.542309E-01     5.000000E-01           
         85  traj.phase0.states:x_84        c    -1.200000E+00     3.795258E-01     5.000000E-01           
         86  traj.phase0.states:x_85        c    -1.200000E+00     4.143692E-01     5.000000E-01           
         87  traj.phase0.states:x_86        c    -1.200000E+00     4.254779E-01     5.000000E-01           
         88  traj.phase0.states:x_87        c    -1.200000E+00     4.512448E-01     5.000000E-01           
         89  traj.phase0.states:x_88        c    -1.200000E+00     4.879814E-01     5.000000E-01           
         90  traj.phase0.states:x_89        c    -1.200000E+00     5.000000E-01     5.000000E-01          u
         91  traj.phase0.states:v_0         c    -7.000000E-02     9.987135E-04     7.000000E-02           
         92  traj.phase0.states:v_1         c    -7.000000E-02     2.356393E-03     7.000000E-02           
         93  traj.phase0.states:v_2         c    -7.000000E-02     2.777103E-03     7.000000E-02           
         94  traj.phase0.states:v_3         c    -7.000000E-02     3.717045E-03     7.000000E-02           
         95  traj.phase0.states:v_4         c    -7.000000E-02     4.944779E-03     7.000000E-02           
         96  traj.phase0.states:v_5         c    -7.000000E-02     5.312908E-03     7.000000E-02           
         97  traj.phase0.states:v_6         c    -7.000000E-02     6.112789E-03     7.000000E-02           
         98  traj.phase0.states:v_7         c    -7.000000E-02     7.105114E-03     7.000000E-02           
         99  traj.phase0.states:v_8         c    -7.000000E-02     7.389280E-03     7.000000E-02           
        100  traj.phase0.states:v_9         c    -7.000000E-02     8.059964E-03     7.000000E-02           
        101  traj.phase0.states:v_10        c    -7.000000E-02     7.867032E-03     7.000000E-02           
        102  traj.phase0.states:v_11        c    -7.000000E-02     7.181152E-03     7.000000E-02           
        103  traj.phase0.states:v_12        c    -7.000000E-02     5.108843E-03     7.000000E-02           
        104  traj.phase0.states:v_13        c    -7.000000E-02     2.165345E-03     7.000000E-02           
        105  traj.phase0.states:v_14        c    -7.000000E-02     1.221823E-03     7.000000E-02           
        106  traj.phase0.states:v_15        c    -7.000000E-02    -9.448477E-04     7.000000E-02           
        107  traj.phase0.states:v_16        c    -7.000000E-02    -3.913370E-03     7.000000E-02           
        108  traj.phase0.states:v_17        c    -7.000000E-02    -4.839336E-03     7.000000E-02           
        109  traj.phase0.states:v_18        c    -7.000000E-02    -6.919803E-03     7.000000E-02           
        110  traj.phase0.states:v_19        c    -7.000000E-02    -9.664862E-03     7.000000E-02           
        111  traj.phase0.states:v_20        c    -7.000000E-02    -1.049505E-02     7.000000E-02           
        112  traj.phase0.states:v_21        c    -7.000000E-02    -1.231170E-02     7.000000E-02           
        113  traj.phase0.states:v_22        c    -7.000000E-02    -1.459419E-02     7.000000E-02           
        114  traj.phase0.states:v_23        c    -7.000000E-02    -1.525502E-02     7.000000E-02           
        115  traj.phase0.states:v_24        c    -7.000000E-02    -1.664514E-02     7.000000E-02           
        116  traj.phase0.states:v_25        c    -7.000000E-02    -1.825856E-02     7.000000E-02           
        117  traj.phase0.states:v_26        c    -7.000000E-02    -1.869027E-02     7.000000E-02           
        118  traj.phase0.states:v_27        c    -7.000000E-02    -1.952984E-02     7.000000E-02           
        119  traj.phase0.states:v_28        c    -7.000000E-02    -2.033778E-02     7.000000E-02           
        120  traj.phase0.states:v_29        c    -7.000000E-02    -2.050693E-02     7.000000E-02           
        121  traj.phase0.states:v_30        c    -7.000000E-02    -2.073869E-02     7.000000E-02           
        122  traj.phase0.states:v_31        c    -7.000000E-02    -2.070879E-02     7.000000E-02           
        123  traj.phase0.states:v_32        c    -7.000000E-02    -2.061684E-02     7.000000E-02           
        124  traj.phase0.states:v_33        c    -7.000000E-02    -2.026466E-02     7.000000E-02           
        125  traj.phase0.states:v_34        c    -7.000000E-02    -1.947379E-02     7.000000E-02           
        126  traj.phase0.states:v_35        c    -7.000000E-02    -1.915480E-02     7.000000E-02           
        127  traj.phase0.states:v_36        c    -7.000000E-02    -1.831126E-02     7.000000E-02           
        128  traj.phase0.states:v_37        c    -7.000000E-02    -1.691377E-02     7.000000E-02           
        129  traj.phase0.states:v_38        c    -7.000000E-02    -1.642126E-02     7.000000E-02           
        130  traj.phase0.states:v_39        c    -7.000000E-02    -1.521386E-02     7.000000E-02           
        131  traj.phase0.states:v_40        c    -7.000000E-02    -1.339010E-02     7.000000E-02           
        132  traj.phase0.states:v_41        c    -7.000000E-02    -1.278055E-02     7.000000E-02           
        133  traj.phase0.states:v_42        c    -7.000000E-02    -1.141416E-02     7.000000E-02           
        134  traj.phase0.states:v_43        c    -7.000000E-02    -8.458173E-03     7.000000E-02           
        135  traj.phase0.states:v_44        c    -7.000000E-02    -6.915090E-03     7.000000E-02           
        136  traj.phase0.states:v_45        c    -7.000000E-02    -2.911314E-03     7.000000E-02           
        137  traj.phase0.states:v_46        c    -7.000000E-02     2.630496E-03     7.000000E-02           
        138  traj.phase0.states:v_47        c    -7.000000E-02     4.382061E-03     7.000000E-02           
        139  traj.phase0.states:v_48        c    -7.000000E-02     8.376856E-03     7.000000E-02           
        140  traj.phase0.states:v_49        c    -7.000000E-02     1.381961E-02     7.000000E-02           
        141  traj.phase0.states:v_50        c    -7.000000E-02     1.551747E-02     7.000000E-02           
        142  traj.phase0.states:v_51        c    -7.000000E-02     1.934066E-02     7.000000E-02           
        143  traj.phase0.states:v_52        c    -7.000000E-02     2.441559E-02     7.000000E-02           
        144  traj.phase0.states:v_53        c    -7.000000E-02     2.595996E-02     7.000000E-02           
        145  traj.phase0.states:v_54        c    -7.000000E-02     2.935249E-02     7.000000E-02           
        146  traj.phase0.states:v_55        c    -7.000000E-02     3.363027E-02     7.000000E-02           
        147  traj.phase0.states:v_56        c    -7.000000E-02     3.486800E-02     7.000000E-02           
        148  traj.phase0.states:v_57        c    -7.000000E-02     3.745593E-02     7.000000E-02           
        149  traj.phase0.states:v_58        c    -7.000000E-02     4.039299E-02     7.000000E-02           
        150  traj.phase0.states:v_59        c    -7.000000E-02     4.115260E-02     7.000000E-02           
        151  traj.phase0.states:v_60        c    -7.000000E-02     4.256515E-02     7.000000E-02           
        152  traj.phase0.states:v_61        c    -7.000000E-02     4.374409E-02     7.000000E-02           
        153  traj.phase0.states:v_62        c    -7.000000E-02     4.392749E-02     7.000000E-02           
        154  traj.phase0.states:v_63        c    -7.000000E-02     4.401872E-02     7.000000E-02           
        155  traj.phase0.states:v_64        c    -7.000000E-02     4.344021E-02     7.000000E-02           
        156  traj.phase0.states:v_65        c    -7.000000E-02     4.310093E-02     7.000000E-02           
        157  traj.phase0.states:v_66        c    -7.000000E-02     4.208286E-02     7.000000E-02           
        158  traj.phase0.states:v_67        c    -7.000000E-02     4.021940E-02     7.000000E-02           
        159  traj.phase0.states:v_68        c    -7.000000E-02     3.954271E-02     7.000000E-02           
        160  traj.phase0.states:v_69        c    -7.000000E-02     3.788101E-02     7.000000E-02           
        161  traj.phase0.states:v_70        c    -7.000000E-02     3.542495E-02     7.000000E-02           
        162  traj.phase0.states:v_71        c    -7.000000E-02     3.463052E-02     7.000000E-02           
        163  traj.phase0.states:v_72        c    -7.000000E-02     3.281297E-02     7.000000E-02           
        164  traj.phase0.states:v_73        c    -7.000000E-02     3.037524E-02     7.000000E-02           
        165  traj.phase0.states:v_74        c    -7.000000E-02     2.963561E-02     7.000000E-02           
        166  traj.phase0.states:v_75        c    -7.000000E-02     2.801759E-02     7.000000E-02           
        167  traj.phase0.states:v_76        c    -7.000000E-02     2.599539E-02     7.000000E-02           
        168  traj.phase0.states:v_77        c    -7.000000E-02     2.541413E-02     7.000000E-02           
        169  traj.phase0.states:v_78        c    -7.000000E-02     2.419781E-02     7.000000E-02           
        170  traj.phase0.states:v_79        c    -7.000000E-02     2.279996E-02     7.000000E-02           
        171  traj.phase0.states:v_80        c    -7.000000E-02     2.242906E-02     7.000000E-02           
        172  traj.phase0.states:v_81        c    -7.000000E-02     2.171339E-02     7.000000E-02           
        173  traj.phase0.states:v_82        c    -7.000000E-02     2.104175E-02     7.000000E-02           
        174  traj.phase0.states:v_83        c    -7.000000E-02     2.090773E-02     7.000000E-02           
        175  traj.phase0.states:v_84        c    -7.000000E-02     2.074700E-02     7.000000E-02           
        176  traj.phase0.states:v_85        c    -7.000000E-02     2.086973E-02     7.000000E-02           
        177  traj.phase0.states:v_86        c    -7.000000E-02     2.099435E-02     7.000000E-02           
        178  traj.phase0.states:v_87        c    -7.000000E-02     2.144097E-02     7.000000E-02           
        179  traj.phase0.states:v_88        c    -7.000000E-02     2.244081E-02     7.000000E-02           
        180  traj.phase0.states:v_89        c    -7.000000E-02     2.285374E-02     7.000000E-02           
        181  traj.phase0.controls:u_0       c    -1.000000E+00     9.999996E-01     1.000000E+00          u
        182  traj.phase0.controls:u_1       c    -1.000000E+00     9.999999E-01     1.000000E+00          u
        183  traj.phase0.controls:u_2       c    -1.000000E+00     9.999998E-01     1.000000E+00          u
        184  traj.phase0.controls:u_3       c    -1.000000E+00     9.999997E-01     1.000000E+00          u
        185  traj.phase0.controls:u_4       c    -1.000000E+00     9.999999E-01     1.000000E+00          u
        186  traj.phase0.controls:u_5       c    -1.000000E+00     9.999998E-01     1.000000E+00          u
        187  traj.phase0.controls:u_6       c    -1.000000E+00     9.999996E-01     1.000000E+00          u
        188  traj.phase0.controls:u_7       c    -1.000000E+00     9.999999E-01     1.000000E+00          u
        189  traj.phase0.controls:u_8       c    -1.000000E+00     9.999995E-01     1.000000E+00          u
        190  traj.phase0.controls:u_9       c    -1.000000E+00     9.999992E-01     1.000000E+00          u
        191  traj.phase0.controls:u_10      c    -1.000000E+00     9.999997E-01     1.000000E+00          u
        192  traj.phase0.controls:u_11      c    -1.000000E+00    -2.836272E-01     1.000000E+00           
        193  traj.phase0.controls:u_12      c    -1.000000E+00    -9.999915E-01     1.000000E+00           
        194  traj.phase0.controls:u_13      c    -1.000000E+00    -9.999994E-01     1.000000E+00          l
        195  traj.phase0.controls:u_14      c    -1.000000E+00    -9.999998E-01     1.000000E+00          l
        196  traj.phase0.controls:u_15      c    -1.000000E+00    -9.999974E-01     1.000000E+00           
        197  traj.phase0.controls:u_16      c    -1.000000E+00    -9.999999E-01     1.000000E+00          l
        198  traj.phase0.controls:u_17      c    -1.000000E+00    -9.999999E-01     1.000000E+00          l
        199  traj.phase0.controls:u_18      c    -1.000000E+00    -9.999990E-01     1.000000E+00          l
        200  traj.phase0.controls:u_19      c    -1.000000E+00    -9.999999E-01     1.000000E+00          l
        201  traj.phase0.controls:u_20      c    -1.000000E+00    -9.999999E-01     1.000000E+00          l
        202  traj.phase0.controls:u_21      c    -1.000000E+00    -9.999995E-01     1.000000E+00          l
        203  traj.phase0.controls:u_22      c    -1.000000E+00    -9.999999E-01     1.000000E+00          l
        204  traj.phase0.controls:u_23      c    -1.000000E+00    -9.999999E-01     1.000000E+00          l
        205  traj.phase0.controls:u_24      c    -1.000000E+00    -9.999997E-01     1.000000E+00          l
        206  traj.phase0.controls:u_25      c    -1.000000E+00    -1.000000E+00     1.000000E+00          l
        207  traj.phase0.controls:u_26      c    -1.000000E+00    -9.999999E-01     1.000000E+00          l
        208  traj.phase0.controls:u_27      c    -1.000000E+00    -9.999997E-01     1.000000E+00          l
        209  traj.phase0.controls:u_28      c    -1.000000E+00    -1.000000E+00     1.000000E+00          l
        210  traj.phase0.controls:u_29      c    -1.000000E+00    -9.999999E-01     1.000000E+00          l
        211  traj.phase0.controls:u_30      c    -1.000000E+00    -9.999997E-01     1.000000E+00          l
        212  traj.phase0.controls:u_31      c    -1.000000E+00    -1.000000E+00     1.000000E+00          l
        213  traj.phase0.controls:u_32      c    -1.000000E+00    -9.999999E-01     1.000000E+00          l
        214  traj.phase0.controls:u_33      c    -1.000000E+00    -9.999997E-01     1.000000E+00          l
        215  traj.phase0.controls:u_34      c    -1.000000E+00    -9.999999E-01     1.000000E+00          l
        216  traj.phase0.controls:u_35      c    -1.000000E+00    -9.999998E-01     1.000000E+00          l
        217  traj.phase0.controls:u_36      c    -1.000000E+00    -9.999997E-01     1.000000E+00          l
        218  traj.phase0.controls:u_37      c    -1.000000E+00    -9.999999E-01     1.000000E+00          l
        219  traj.phase0.controls:u_38      c    -1.000000E+00    -9.999997E-01     1.000000E+00          l
        220  traj.phase0.controls:u_39      c    -1.000000E+00    -9.999995E-01     1.000000E+00          l
        221  traj.phase0.controls:u_40      c    -1.000000E+00    -9.999999E-01     1.000000E+00          l
        222  traj.phase0.controls:u_41      c    -1.000000E+00    -9.999995E-01     1.000000E+00          l
        223  traj.phase0.controls:u_42      c    -1.000000E+00    -9.999992E-01     1.000000E+00          l
        224  traj.phase0.controls:u_43      c    -1.000000E+00    -9.999996E-01     1.000000E+00          l
        225  traj.phase0.controls:u_44      c    -1.000000E+00     2.836235E-01     1.000000E+00           
        226  traj.phase0.controls:u_45      c    -1.000000E+00     9.999857E-01     1.000000E+00           
        227  traj.phase0.controls:u_46      c    -1.000000E+00     9.999990E-01     1.000000E+00           
        228  traj.phase0.controls:u_47      c    -1.000000E+00     9.999998E-01     1.000000E+00          u
        229  traj.phase0.controls:u_48      c    -1.000000E+00     9.999958E-01     1.000000E+00           
        230  traj.phase0.controls:u_49      c    -1.000000E+00     9.999998E-01     1.000000E+00          u
        231  traj.phase0.controls:u_50      c    -1.000000E+00     9.999999E-01     1.000000E+00          u
        232  traj.phase0.controls:u_51      c    -1.000000E+00     9.999985E-01     1.000000E+00           
        233  traj.phase0.controls:u_52      c    -1.000000E+00     9.999999E-01     1.000000E+00          u
        234  traj.phase0.controls:u_53      c    -1.000000E+00     9.999999E-01     1.000000E+00          u
        235  traj.phase0.controls:u_54      c    -1.000000E+00     9.999994E-01     1.000000E+00          u
        236  traj.phase0.controls:u_55      c    -1.000000E+00     9.999999E-01     1.000000E+00          u
        237  traj.phase0.controls:u_56      c    -1.000000E+00     9.999999E-01     1.000000E+00          u
        238  traj.phase0.controls:u_57      c    -1.000000E+00     9.999997E-01     1.000000E+00          u
        239  traj.phase0.controls:u_58      c    -1.000000E+00     1.000000E+00     1.000000E+00          u
        240  traj.phase0.controls:u_59      c    -1.000000E+00     9.999999E-01     1.000000E+00          u
        241  traj.phase0.controls:u_60      c    -1.000000E+00     9.999997E-01     1.000000E+00          u
        242  traj.phase0.controls:u_61      c    -1.000000E+00     1.000000E+00     1.000000E+00          u
        243  traj.phase0.controls:u_62      c    -1.000000E+00     9.999999E-01     1.000000E+00          u
        244  traj.phase0.controls:u_63      c    -1.000000E+00     9.999998E-01     1.000000E+00          u
        245  traj.phase0.controls:u_64      c    -1.000000E+00     1.000000E+00     1.000000E+00          u
        246  traj.phase0.controls:u_65      c    -1.000000E+00     9.999999E-01     1.000000E+00          u
        247  traj.phase0.controls:u_66      c    -1.000000E+00     9.999998E-01     1.000000E+00          u
        248  traj.phase0.controls:u_67      c    -1.000000E+00     1.000000E+00     1.000000E+00          u
        249  traj.phase0.controls:u_68      c    -1.000000E+00     9.999998E-01     1.000000E+00          u
        250  traj.phase0.controls:u_69      c    -1.000000E+00     9.999997E-01     1.000000E+00          u
        251  traj.phase0.controls:u_70      c    -1.000000E+00     9.999999E-01     1.000000E+00          u
        252  traj.phase0.controls:u_71      c    -1.000000E+00     9.999998E-01     1.000000E+00          u
        253  traj.phase0.controls:u_72      c    -1.000000E+00     9.999997E-01     1.000000E+00          u
        254  traj.phase0.controls:u_73      c    -1.000000E+00     9.999999E-01     1.000000E+00          u
        255  traj.phase0.controls:u_74      c    -1.000000E+00     9.999998E-01     1.000000E+00          u
        256  traj.phase0.controls:u_75      c    -1.000000E+00     9.999996E-01     1.000000E+00          u
        257  traj.phase0.controls:u_76      c    -1.000000E+00     9.999999E-01     1.000000E+00          u
        258  traj.phase0.controls:u_77      c    -1.000000E+00     9.999997E-01     1.000000E+00          u
        259  traj.phase0.controls:u_78      c    -1.000000E+00     9.999994E-01     1.000000E+00          u
        260  traj.phase0.controls:u_79      c    -1.000000E+00     9.999999E-01     1.000000E+00          u
        261  traj.phase0.controls:u_80      c    -1.000000E+00     9.999995E-01     1.000000E+00          u
        262  traj.phase0.controls:u_81      c    -1.000000E+00     9.999992E-01     1.000000E+00          u
        263  traj.phase0.controls:u_82      c    -1.000000E+00     9.999998E-01     1.000000E+00          u
        264  traj.phase0.controls:u_83      c    -1.000000E+00     9.999992E-01     1.000000E+00          u
        265  traj.phase0.controls:u_84      c    -1.000000E+00     9.999987E-01     1.000000E+00           
        266  traj.phase0.controls:u_85      c    -1.000000E+00     9.999996E-01     1.000000E+00          u
        267  traj.phase0.controls:u_86      c    -1.000000E+00     9.999985E-01     1.000000E+00           
        268  traj.phase0.controls:u_87      c    -1.000000E+00     9.999976E-01     1.000000E+00           
        269  traj.phase0.controls:u_88      c    -1.000000E+00     9.999989E-01     1.000000E+00           
        270  traj.phase0.controls:u_89      c    -1.000000E+00     9.999905E-01     1.000000E+00           

   Constraints (i - inequality, e - equality)
      Index  Name                                          Type          Lower           Value           Upper    Status  Lagrange Multiplier
          0  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    1.110223E-16    0.000000E+00               1.23904E-02
          1  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    3.819428E-16    0.000000E+00               7.05561E-02
          2  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00   -4.454143E-17    0.000000E+00               6.43473E-02
          3  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    8.834051E-17    0.000000E+00               2.00810E-02
          4  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    4.105235E-16    0.000000E+00               1.03452E-01
          5  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    6.963310E-16    0.000000E+00               8.54789E-02
          6  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    1.370391E-15    0.000000E+00               2.60098E-02
          7  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    2.132050E-15    0.000000E+00               1.27261E-01
          8  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    2.898162E-15    0.000000E+00               9.91060E-02
          9  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    4.525409E-15    0.000000E+00               2.96571E-02
         10  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    6.823747E-15    0.000000E+00               1.39931E-01
         11  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    7.007852E-15    0.000000E+00               1.04120E-01
         12  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    5.781478E-15    0.000000E+00               3.07332E-02
         13  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    4.624885E-15    0.000000E+00               1.40595E-01
         14  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    5.518683E-15    0.000000E+00               1.00337E-01
         15  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    5.611849E-15    0.000000E+00               2.92247E-02
         16  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    5.138411E-15    0.000000E+00               1.29559E-01
         17  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    6.166019E-15    0.000000E+00               8.82394E-02
         18  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    6.115539E-15    0.000000E+00               2.52929E-02
         19  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    6.397634E-15    0.000000E+00               1.07675E-01
         20  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    6.897983E-15    0.000000E+00               6.85802E-02
         21  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    6.618857E-15    0.000000E+00               1.91749E-02
         22  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    6.452569E-15    0.000000E+00               7.62222E-02
         23  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    6.259556E-15    0.000000E+00               4.25987E-02
         24  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    6.022002E-15    0.000000E+00               1.12705E-02
         25  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    4.958946E-15    0.000000E+00               3.75068E-02
         26  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    4.002790E-15    0.000000E+00               1.25303E-02
         27  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    3.153533E-15    0.000000E+00               2.29059E-03
         28  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    1.324365E-15    0.000000E+00              -4.57934E-03
         29  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00   -8.373789E-16    0.000000E+00              -1.82447E-02
         30  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00   -1.662880E-15    0.000000E+00              -6.72827E-03
         31  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00   -4.270039E-15    0.000000E+00              -4.49200E-02
         32  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00   -7.215712E-15    0.000000E+00              -4.58922E-02
         33  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00   -8.308462E-15    0.000000E+00              -1.46638E-02
         34  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00   -1.117693E-14    0.000000E+00              -7.86505E-02
         35  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00   -1.424138E-14    0.000000E+00              -6.74047E-02
         36  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00   -1.557168E-14    0.000000E+00              -2.06935E-02
         37  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00   -1.869552E-14    0.000000E+00              -1.02853E-01
         38  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00   -2.206286E-14    0.000000E+00              -8.15806E-02
         39  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00   -2.400486E-14    0.000000E+00              -2.45504E-02
         40  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00   -2.681691E-14    0.000000E+00              -1.17247E-01
         41  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00   -2.997044E-14    0.000000E+00              -8.90302E-02
         42  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00   -3.283594E-14    0.000000E+00              -2.64800E-02
         43  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00   -3.866493E-14    0.000000E+00              -1.23534E-01
         44  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00   -1.983875E-14    0.000000E+00              -9.13645E-02
         45  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    1.327335E-15    0.000000E+00              -2.69735E-02
         46  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    2.683695E-14    0.000000E+00              -1.24068E-01
         47  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    1.530072E-14    0.000000E+00              -9.01343E-02
         48  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    1.900137E-14    0.000000E+00              -2.64578E-02
         49  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    2.463438E-14    0.000000E+00              -1.20196E-01
         50  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    1.807788E-14    0.000000E+00              -8.54446E-02
         51  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    1.847579E-14    0.000000E+00              -2.48732E-02
         52  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    1.813133E-14    0.000000E+00              -1.10513E-01
         53  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    1.316645E-14    0.000000E+00              -7.53007E-02
         54  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    1.284575E-14    0.000000E+00              -2.15620E-02
         55  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    1.042269E-14    0.000000E+00              -9.13387E-02
         56  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    6.390211E-15    0.000000E+00              -5.68799E-02
         57  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    5.333094E-15    0.000000E+00              -1.57189E-02
         58  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    3.432660E-15    0.000000E+00              -5.96718E-02
         59  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    3.682092E-16    0.000000E+00              -2.94257E-02
         60  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    1.900434E-16    0.000000E+00              -7.28575E-03
         61  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00   -6.651520E-16    0.000000E+00              -1.76952E-02
         62  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00   -1.864801E-15    0.000000E+00               2.85626E-03
         63  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00   -1.342182E-15    0.000000E+00               2.27022E-03
         64  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00   -6.889075E-16    0.000000E+00               2.53339E-02
         65  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    5.582526E-16    0.000000E+00               3.16894E-02
         66  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    1.342182E-15    0.000000E+00               1.04321E-02
         67  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    3.302005E-15    0.000000E+00               5.80403E-02
         68  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    5.796325E-15    0.000000E+00               5.01203E-02
         69  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    6.746542E-15    0.000000E+00               1.53311E-02
         70  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    9.038941E-15    0.000000E+00               7.46248E-02
         71  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    1.141448E-14    0.000000E+00               5.67621E-02
         72  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    1.245972E-14    0.000000E+00               1.68171E-02
         73  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    1.418199E-14    0.000000E+00               7.69476E-02
         74  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    1.584487E-14    0.000000E+00               5.48174E-02
         75  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    1.663474E-14    0.000000E+00               1.59626E-02
         76  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    1.788190E-14    0.000000E+00               7.06913E-02
         77  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    1.873710E-14    0.000000E+00               4.86439E-02
         78  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    1.930723E-14    0.000000E+00               1.40405E-02
         79  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    2.020399E-14    0.000000E+00               6.12447E-02
         80  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    2.076225E-14    0.000000E+00               4.15757E-02
         81  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    2.159369E-14    0.000000E+00               1.19700E-02
         82  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    2.240731E-14    0.000000E+00               5.21249E-02
         83  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    2.311997E-14    0.000000E+00               3.55399E-02
         84  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    2.432556E-14    0.000000E+00               1.02640E-02
         85  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    2.601220E-14    0.000000E+00               4.51780E-02
         86  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    2.853621E-14    0.000000E+00               3.14729E-02
         87  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    3.179664E-14    0.000000E+00               9.16647E-03
         88  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    3.552031E-14    0.000000E+00               4.12570E-02
         89  traj.phase0.collocation_constraint.defects:x     e   0.000000E+00    6.013093E-14    0.000000E+00               2.97968E-02
         90  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00    1.644507E-15    0.000000E+00               3.26171E-01
         91  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00    2.323578E-16    0.000000E+00               1.42617E+00
         92  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00    6.087329E-16    0.000000E+00               9.50057E-01
         93  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00    1.295784E-15    0.000000E+00               2.70176E-01
         94  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00    3.238533E-16    0.000000E+00               1.12610E+00
         95  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00    1.167728E-15    0.000000E+00               6.91683E-01
         96  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00    1.956668E-15    0.000000E+00               1.90692E-01
         97  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00    5.677177E-16    0.000000E+00               7.28236E-01
         98  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00    1.919550E-15    0.000000E+00               3.73373E-01
         99  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00    3.125881E-15    0.000000E+00               9.46973E-02
        100  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00    1.822951E-15    0.000000E+00               2.67496E-01
        101  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00   -2.156919E-15    0.000000E+00               2.29677E-02
        102  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00   -3.930410E-15    0.000000E+00              -9.42582E-03
        103  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00   -8.689291E-16    0.000000E+00              -2.16126E-01
        104  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00   -9.825097E-16    0.000000E+00              -3.29473E-01
        105  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00   -2.076002E-15    0.000000E+00              -1.12776E-01
        106  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00   -5.103706E-16    0.000000E+00              -6.81797E-01
        107  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00   -7.898681E-16    0.000000E+00              -6.54550E-01
        108  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00   -1.470238E-15    0.000000E+00              -2.06759E-01
        109  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00   -5.400649E-16    0.000000E+00              -1.09083E+00
        110  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00   -9.858503E-16    0.000000E+00              -9.25007E-01
        111  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00   -1.550784E-15    0.000000E+00              -2.83459E-01
        112  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00   -8.087982E-16    0.000000E+00              -1.40809E+00
        113  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00   -1.320653E-15    0.000000E+00              -1.11686E+00
        114  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00   -1.843644E-15    0.000000E+00              -3.36004E-01
        115  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00   -1.168841E-15    0.000000E+00              -1.60437E+00
        116  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00   -1.633371E-15    0.000000E+00              -1.21196E+00
        117  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00   -2.114976E-15    0.000000E+00              -3.59391E-01
        118  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00   -1.410850E-15    0.000000E+00              -1.66100E+00
        119  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00   -1.773584E-15    0.000000E+00              -1.20183E+00
        120  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00   -2.199604E-15    0.000000E+00              -3.51638E-01
        121  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00   -1.395608E-15    0.000000E+00              -1.57502E+00
        122  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00   -1.661581E-15    0.000000E+00              -1.09065E+00
        123  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00   -2.065980E-15    0.000000E+00              -3.14563E-01
        124  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00   -1.133579E-15    0.000000E+00              -1.36106E+00
        125  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00   -1.421428E-15    0.000000E+00              -8.94685E-01
        126  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00   -1.921035E-15    0.000000E+00              -2.53422E-01
        127  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00   -8.312545E-16    0.000000E+00              -1.04748E+00
        128  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00   -1.411407E-15    0.000000E+00              -6.37576E-01
        129  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00   -2.084168E-15    0.000000E+00              -1.75368E-01
        130  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00   -7.843004E-16    0.000000E+00              -6.68095E-01
        131  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00   -2.242290E-15    0.000000E+00              -3.43819E-01
        132  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00   -3.488336E-15    0.000000E+00              -8.75336E-02
        133  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00   -1.701483E-15    0.000000E+00              -2.53958E-01
        134  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00    3.234821E-14    0.000000E+00              -3.38199E-02
        135  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00    5.072675E-14    0.000000E+00               4.29635E-03
        136  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00    2.551482E-15    0.000000E+00               1.71218E-01
        137  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00    8.373789E-16    0.000000E+00               2.77755E-01
        138  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00    1.592802E-14    0.000000E+00               9.60107E-02
        139  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00    5.471172E-16    0.000000E+00               5.90638E-01
        140  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00    3.845410E-16    0.000000E+00               5.79486E-01
        141  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00    5.410299E-15    0.000000E+00               1.84248E-01
        142  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00    1.313972E-16    0.000000E+00               9.87669E-01
        143  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00    3.934493E-17    0.000000E+00               8.56621E-01
        144  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00    1.766810E-15    0.000000E+00               2.64360E-01
        145  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00   -3.385149E-16    0.000000E+00               1.33647E+00
        146  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00   -3.771175E-16    0.000000E+00               1.08555E+00
        147  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00    3.021394E-16    0.000000E+00               3.28990E-01
        148  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00   -6.005670E-16    0.000000E+00               1.59860E+00
        149  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00   -2.238207E-16    0.000000E+00               1.23554E+00
        150  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00    3.099341E-16    0.000000E+00               3.68997E-01
        151  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00   -2.318010E-16    0.000000E+00               1.73297E+00
        152  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00    3.893663E-16    0.000000E+00               1.28131E+00
        153  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00    9.288744E-16    0.000000E+00               3.77553E-01
        154  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00    4.368772E-16    0.000000E+00               1.71847E+00
        155  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00    8.756103E-16    0.000000E+00               1.21998E+00
        156  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00    1.335129E-15    0.000000E+00               3.55046E-01
        157  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00    5.291151E-16    0.000000E+00               1.57155E+00
        158  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00    6.788857E-16    0.000000E+00               1.07647E+00
        159  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00    9.984704E-16    0.000000E+00               3.09889E-01
        160  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00   -4.417025E-17    0.000000E+00               1.33979E+00
        161  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00    6.681215E-18    0.000000E+00               8.90464E-01
        162  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00    3.975323E-16    0.000000E+00               2.54002E-01
        163  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00   -7.846716E-16    0.000000E+00               1.07700E+00
        164  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00   -4.706545E-16    0.000000E+00               6.97659E-01
        165  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00    1.017029E-16    0.000000E+00               1.97420E-01
        166  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00   -1.195937E-15    0.000000E+00               8.22684E-01
        167  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00   -4.843881E-16    0.000000E+00               5.19901E-01
        168  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00    3.381437E-16    0.000000E+00               1.45917E-01
        169  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00   -1.173110E-15    0.000000E+00               5.96536E-01
        170  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00    6.959599E-17    0.000000E+00               3.65549E-01
        171  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00    1.254027E-15    0.000000E+00               1.01446E-01
        172  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00   -7.828157E-16    0.000000E+00               4.02901E-01
        173  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00    1.266925E-15    0.000000E+00               2.34009E-01
        174  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00    3.070018E-15    0.000000E+00               6.35373E-02
        175  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00    8.351518E-17    0.000000E+00               2.37118E-01
        176  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00    4.227863E-15    0.000000E+00               1.19936E-01
        177  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00    7.541050E-15    0.000000E+00               3.04718E-02
        178  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00    3.045428E-15    0.000000E+00               9.00958E-02
        179  traj.phase0.collocation_constraint.defects:v     e   0.000000E+00    3.428632E-14    0.000000E+00               1.57743E-02
        180  traj.phase0.continuity_comp.defect_controls:u    e   0.000000E+00    1.110223E-16    0.000000E+00              -2.80590E-04
        181  traj.phase0.continuity_comp.defect_controls:u    e   0.000000E+00   -1.110223E-16    0.000000E+00              -1.00448E-04
        182  traj.phase0.continuity_comp.defect_controls:u    e   0.000000E+00   -1.110223E-16    0.000000E+00               3.94604E-05
        183  traj.phase0.continuity_comp.defect_controls:u    e   0.000000E+00    0.000000E+00    0.000000E+00              -3.53562E-05
        184  traj.phase0.continuity_comp.defect_controls:u    e   0.000000E+00    2.220446E-16    0.000000E+00              -1.51852E-04
        185  traj.phase0.continuity_comp.defect_controls:u    e   0.000000E+00   -2.220446E-16    0.000000E+00              -1.57037E-04
        186  traj.phase0.continuity_comp.defect_controls:u    e   0.000000E+00   -2.220446E-16    0.000000E+00              -4.74539E-05
        187  traj.phase0.continuity_comp.defect_controls:u    e   0.000000E+00    1.110223E-16    0.000000E+00               1.11079E-04
        188  traj.phase0.continuity_comp.defect_controls:u    e   0.000000E+00    0.000000E+00    0.000000E+00               2.16709E-04
        189  traj.phase0.continuity_comp.defect_controls:u    e   0.000000E+00    2.220446E-16    0.000000E+00               2.36718E-04
        190  traj.phase0.continuity_comp.defect_controls:u    e   0.000000E+00    0.000000E+00    0.000000E+00               2.09434E-04
        191  traj.phase0.continuity_comp.defect_controls:u    e   0.000000E+00    1.110223E-16    0.000000E+00               1.68775E-04
        192  traj.phase0.continuity_comp.defect_controls:u    e   0.000000E+00   -1.110223E-16    0.000000E+00               1.19927E-04
        193  traj.phase0.continuity_comp.defect_controls:u    e   0.000000E+00    1.110223E-16    0.000000E+00               6.54857E-05
        194  traj.phase0.continuity_comp.defect_controls:u    e   0.000000E+00   -1.110223E-16    0.000000E+00               4.26750E-05
        195  traj.phase0.continuity_comp.defect_controls:u    e   0.000000E+00    2.220446E-16    0.000000E+00               1.57245E-04
        196  traj.phase0.continuity_comp.defect_controls:u    e   0.000000E+00   -1.110223E-16    0.000000E+00               1.41063E-04
        197  traj.phase0.continuity_comp.defect_controls:u    e   0.000000E+00    0.000000E+00    0.000000E+00              -6.05525E-05
        198  traj.phase0.continuity_comp.defect_controls:u    e   0.000000E+00    0.000000E+00    0.000000E+00              -3.81075E-04
        199  traj.phase0.continuity_comp.defect_controls:u    e   0.000000E+00    1.110223E-16    0.000000E+00              -5.38440E-04
        200  traj.phase0.continuity_comp.defect_controls:u    e   0.000000E+00    2.220446E-16    0.000000E+00              -3.25324E-04
        201  traj.phase0.continuity_comp.defect_controls:u    e   0.000000E+00   -1.110223E-16    0.000000E+00              -2.41618E-04
        202  traj.phase0.continuity_comp.defect_controls:u    e   0.000000E+00   -2.220446E-16    0.000000E+00              -2.04339E-04
        203  traj.phase0.continuity_comp.defect_controls:u    e   0.000000E+00    1.110223E-16    0.000000E+00              -1.71751E-04
        204  traj.phase0.continuity_comp.defect_controls:u    e   0.000000E+00    2.220446E-16    0.000000E+00              -1.36064E-04
        205  traj.phase0.continuity_comp.defect_controls:u    e   0.000000E+00   -2.220446E-16    0.000000E+00              -1.02139E-04
        206  traj.phase0.continuity_comp.defect_controls:u    e   0.000000E+00    0.000000E+00    0.000000E+00              -7.19512E-05
        207  traj.phase0.continuity_comp.defect_controls:u    e   0.000000E+00   -1.110223E-16    0.000000E+00              -4.54050E-05
        208  traj.phase0.continuity_comp.defect_controls:u    e   0.000000E+00   -1.110223E-16    0.000000E+00              -2.09996E-05
        209  traj.phase0.x[final]                             i   5.000000E-01    5.000000E-01    1.000000E+30         l    -3.95457E-02
        210  traj.phase0.v[final]                             i   0.000000E+00    2.285374E-02    1.000000E+30              -3.31049E-09
        211  traj.phase0.u[path]                              i  -1.000000E+00    9.999996E-01    1.000000E+00         u     1.79113E-04
        212  traj.phase0.u[path]                              i  -1.000000E+00    9.999999E-01    1.000000E+00         u     1.48819E-03
        213  traj.phase0.u[path]                              i  -1.000000E+00    9.999998E-01    1.000000E+00         u     3.45477E-04
        214  traj.phase0.u[path]                              i  -1.000000E+00    9.999997E-01    1.000000E+00         u     3.19710E-04
        215  traj.phase0.u[path]                              i  -1.000000E+00    9.999997E-01    1.000000E+00         u     3.19710E-04
        216  traj.phase0.u[path]                              i  -1.000000E+00    9.999999E-01    1.000000E+00         u     1.10239E-03
        217  traj.phase0.u[path]                              i  -1.000000E+00    9.999998E-01    1.000000E+00         u     3.49763E-04
        218  traj.phase0.u[path]                              i  -1.000000E+00    9.999996E-01    1.000000E+00         u     2.10491E-04
        219  traj.phase0.u[path]                              i  -1.000000E+00    9.999996E-01    1.000000E+00         u     2.10491E-04
        220  traj.phase0.u[path]                              i  -1.000000E+00    9.999999E-01    1.000000E+00         u     6.31151E-04
        221  traj.phase0.u[path]                              i  -1.000000E+00    9.999995E-01    1.000000E+00         u     3.05810E-04
        222  traj.phase0.u[path]                              i  -1.000000E+00    9.999992E-01    1.000000E+00         u     5.71141E-05
        223  traj.phase0.u[path]                              i  -1.000000E+00    9.999992E-01    1.000000E+00         u     5.71141E-05
        224  traj.phase0.u[path]                              i  -1.000000E+00    9.999997E-01    1.000000E+00         u     2.40190E-04
        225  traj.phase0.u[path]                              i  -1.000000E+00   -2.836272E-01    1.000000E+00               1.74910E-09
        226  traj.phase0.u[path]                              i  -1.000000E+00   -9.999915E-01    1.000000E+00              -1.01253E-05
        227  traj.phase0.u[path]                              i  -1.000000E+00   -9.999915E-01    1.000000E+00              -1.01253E-05
        228  traj.phase0.u[path]                              i  -1.000000E+00   -9.999994E-01    1.000000E+00         l    -1.32199E-04
        229  traj.phase0.u[path]                              i  -1.000000E+00   -9.999998E-01    1.000000E+00         l    -3.74240E-04
        230  traj.phase0.u[path]                              i  -1.000000E+00   -9.999974E-01    1.000000E+00              -3.34362E-05
        231  traj.phase0.u[path]                              i  -1.000000E+00   -9.999974E-01    1.000000E+00              -3.34362E-05
        232  traj.phase0.u[path]                              i  -1.000000E+00   -9.999999E-01    1.000000E+00         l    -5.49200E-04
        233  traj.phase0.u[path]                              i  -1.000000E+00   -9.999999E-01    1.000000E+00         l    -6.20231E-04
        234  traj.phase0.u[path]                              i  -1.000000E+00   -9.999990E-01    1.000000E+00         l    -7.99994E-05
        235  traj.phase0.u[path]                              i  -1.000000E+00   -9.999990E-01    1.000000E+00         l    -7.99994E-05
        236  traj.phase0.u[path]                              i  -1.000000E+00   -9.999999E-01    1.000000E+00         l    -9.82941E-04
        237  traj.phase0.u[path]                              i  -1.000000E+00   -9.999999E-01    1.000000E+00         l    -7.05487E-04
        238  traj.phase0.u[path]                              i  -1.000000E+00   -9.999995E-01    1.000000E+00         l    -1.58113E-04
        239  traj.phase0.u[path]                              i  -1.000000E+00   -9.999995E-01    1.000000E+00         l    -1.58113E-04
        240  traj.phase0.u[path]                              i  -1.000000E+00   -9.999999E-01    1.000000E+00         l    -1.36766E-03
        241  traj.phase0.u[path]                              i  -1.000000E+00   -9.999999E-01    1.000000E+00         l    -6.71864E-04
        242  traj.phase0.u[path]                              i  -1.000000E+00   -9.999997E-01    1.000000E+00         l    -2.53521E-04
        243  traj.phase0.u[path]                              i  -1.000000E+00   -9.999997E-01    1.000000E+00         l    -2.53521E-04
        244  traj.phase0.u[path]                              i  -1.000000E+00   -1.000000E+00    1.000000E+00         l    -1.61275E-03
        245  traj.phase0.u[path]                              i  -1.000000E+00   -9.999999E-01    1.000000E+00         l    -6.18499E-04
        246  traj.phase0.u[path]                              i  -1.000000E+00   -9.999997E-01    1.000000E+00         l    -3.20873E-04
        247  traj.phase0.u[path]                              i  -1.000000E+00   -9.999997E-01    1.000000E+00         l    -3.20873E-04
        248  traj.phase0.u[path]                              i  -1.000000E+00   -1.000000E+00    1.000000E+00         l    -1.67588E-03
        249  traj.phase0.u[path]                              i  -1.000000E+00   -9.999999E-01    1.000000E+00         l    -5.84206E-04
        250  traj.phase0.u[path]                              i  -1.000000E+00   -9.999997E-01    1.000000E+00         l    -3.33748E-04
        251  traj.phase0.u[path]                              i  -1.000000E+00   -9.999997E-01    1.000000E+00         l    -3.33748E-04
        252  traj.phase0.u[path]                              i  -1.000000E+00   -1.000000E+00    1.000000E+00         l    -1.57687E-03
        253  traj.phase0.u[path]                              i  -1.000000E+00   -9.999999E-01    1.000000E+00         l    -5.33481E-04
        254  traj.phase0.u[path]                              i  -1.000000E+00   -9.999997E-01    1.000000E+00         l    -3.03995E-04
        255  traj.phase0.u[path]                              i  -1.000000E+00   -9.999997E-01    1.000000E+00         l    -3.03995E-04
        256  traj.phase0.u[path]                              i  -1.000000E+00   -9.999999E-01    1.000000E+00         l    -1.35197E-03
        257  traj.phase0.u[path]                              i  -1.000000E+00   -9.999998E-01    1.000000E+00         l    -4.38779E-04
        258  traj.phase0.u[path]                              i  -1.000000E+00   -9.999997E-01    1.000000E+00         l    -2.50926E-04
        259  traj.phase0.u[path]                              i  -1.000000E+00   -9.999997E-01    1.000000E+00         l    -2.50926E-04
        260  traj.phase0.u[path]                              i  -1.000000E+00   -9.999999E-01    1.000000E+00         l    -1.03119E-03
        261  traj.phase0.u[path]                              i  -1.000000E+00   -9.999997E-01    1.000000E+00         l    -3.10295E-04
        262  traj.phase0.u[path]                              i  -1.000000E+00   -9.999995E-01    1.000000E+00         l    -1.82232E-04
        263  traj.phase0.u[path]                              i  -1.000000E+00   -9.999995E-01    1.000000E+00         l    -1.82232E-04
        264  traj.phase0.u[path]                              i  -1.000000E+00   -9.999999E-01    1.000000E+00         l    -6.46221E-04
        265  traj.phase0.u[path]                              i  -1.000000E+00   -9.999995E-01    1.000000E+00         l    -1.64204E-04
        266  traj.phase0.u[path]                              i  -1.000000E+00   -9.999992E-01    1.000000E+00         l    -1.01468E-04
        267  traj.phase0.u[path]                              i  -1.000000E+00   -9.999992E-01    1.000000E+00         l    -1.01468E-04
        268  traj.phase0.u[path]                              i  -1.000000E+00   -9.999996E-01    1.000000E+00         l    -2.33918E-04
        269  traj.phase0.u[path]                              i  -1.000000E+00    2.836235E-01    1.000000E+00               5.36092E-11
        270  traj.phase0.u[path]                              i  -1.000000E+00    9.999857E-01    1.000000E+00               5.51916E-06
        271  traj.phase0.u[path]                              i  -1.000000E+00    9.999857E-01    1.000000E+00               5.51916E-06
        272  traj.phase0.u[path]                              i  -1.000000E+00    9.999990E-01    1.000000E+00               8.45547E-05
        273  traj.phase0.u[path]                              i  -1.000000E+00    9.999998E-01    1.000000E+00         u     3.46071E-04
        274  traj.phase0.u[path]                              i  -1.000000E+00    9.999958E-01    1.000000E+00               1.81677E-05
        275  traj.phase0.u[path]                              i  -1.000000E+00    9.999958E-01    1.000000E+00               1.81677E-05
        276  traj.phase0.u[path]                              i  -1.000000E+00    9.999998E-01    1.000000E+00         u     4.66427E-04
        277  traj.phase0.u[path]                              i  -1.000000E+00    9.999999E-01    1.000000E+00         u     5.64291E-04
        278  traj.phase0.u[path]                              i  -1.000000E+00    9.999985E-01    1.000000E+00               5.33637E-05
        279  traj.phase0.u[path]                              i  -1.000000E+00    9.999985E-01    1.000000E+00               5.33637E-05
        280  traj.phase0.u[path]                              i  -1.000000E+00    9.999999E-01    1.000000E+00         u     9.35712E-04
        281  traj.phase0.u[path]                              i  -1.000000E+00    9.999999E-01    1.000000E+00         u     5.75181E-04
        282  traj.phase0.u[path]                              i  -1.000000E+00    9.999994E-01    1.000000E+00         u     1.42240E-04
        283  traj.phase0.u[path]                              i  -1.000000E+00    9.999994E-01    1.000000E+00         u     1.42240E-04
        284  traj.phase0.u[path]                              i  -1.000000E+00    9.999999E-01    1.000000E+00         u     1.44951E-03
        285  traj.phase0.u[path]                              i  -1.000000E+00    9.999999E-01    1.000000E+00         u     3.94851E-04
        286  traj.phase0.u[path]                              i  -1.000000E+00    9.999997E-01    1.000000E+00         u     3.04701E-04
        287  traj.phase0.u[path]                              i  -1.000000E+00    9.999997E-01    1.000000E+00         u     3.04701E-04
        288  traj.phase0.u[path]                              i  -1.000000E+00    1.000000E+00    1.000000E+00         u     1.81591E-03
        289  traj.phase0.u[path]                              i  -1.000000E+00    9.999999E-01    1.000000E+00         u     2.74950E-04
        290  traj.phase0.u[path]                              i  -1.000000E+00    9.999997E-01    1.000000E+00         u     4.66035E-04
        291  traj.phase0.u[path]                              i  -1.000000E+00    9.999997E-01    1.000000E+00         u     4.66035E-04
        292  traj.phase0.u[path]                              i  -1.000000E+00    1.000000E+00    1.000000E+00         u     1.80145E-03
        293  traj.phase0.u[path]                              i  -1.000000E+00    9.999999E-01    1.000000E+00         u     5.40402E-04
        294  traj.phase0.u[path]                              i  -1.000000E+00    9.999998E-01    1.000000E+00         u     3.88690E-04
        295  traj.phase0.u[path]                              i  -1.000000E+00    9.999998E-01    1.000000E+00         u     3.88690E-04
        296  traj.phase0.u[path]                              i  -1.000000E+00    1.000000E+00    1.000000E+00         u     1.73050E-03
        297  traj.phase0.u[path]                              i  -1.000000E+00    9.999999E-01    1.000000E+00         u     5.90226E-04
        298  traj.phase0.u[path]                              i  -1.000000E+00    9.999998E-01    1.000000E+00         u     3.41056E-04
        299  traj.phase0.u[path]                              i  -1.000000E+00    9.999998E-01    1.000000E+00         u     3.41056E-04
        300  traj.phase0.u[path]                              i  -1.000000E+00    1.000000E+00    1.000000E+00         u     1.56870E-03
        301  traj.phase0.u[path]                              i  -1.000000E+00    9.999998E-01    1.000000E+00         u     5.30423E-04
        302  traj.phase0.u[path]                              i  -1.000000E+00    9.999997E-01    1.000000E+00         u     2.97438E-04
        303  traj.phase0.u[path]                              i  -1.000000E+00    9.999997E-01    1.000000E+00         u     2.97438E-04
        304  traj.phase0.u[path]                              i  -1.000000E+00    9.999999E-01    1.000000E+00         u     1.33378E-03
        305  traj.phase0.u[path]                              i  -1.000000E+00    9.999998E-01    1.000000E+00         u     4.35124E-04
        306  traj.phase0.u[path]                              i  -1.000000E+00    9.999997E-01    1.000000E+00         u     2.48004E-04
        307  traj.phase0.u[path]                              i  -1.000000E+00    9.999997E-01    1.000000E+00         u     2.48004E-04
        308  traj.phase0.u[path]                              i  -1.000000E+00    9.999999E-01    1.000000E+00         u     1.06958E-03
        309  traj.phase0.u[path]                              i  -1.000000E+00    9.999998E-01    1.000000E+00         u     3.38782E-04
        310  traj.phase0.u[path]                              i  -1.000000E+00    9.999996E-01    1.000000E+00         u     1.95537E-04
        311  traj.phase0.u[path]                              i  -1.000000E+00    9.999996E-01    1.000000E+00         u     1.95537E-04
        312  traj.phase0.u[path]                              i  -1.000000E+00    9.999999E-01    1.000000E+00         u     8.15000E-04
        313  traj.phase0.u[path]                              i  -1.000000E+00    9.999997E-01    1.000000E+00         u     2.51166E-04
        314  traj.phase0.u[path]                              i  -1.000000E+00    9.999994E-01    1.000000E+00         u     1.46638E-04
        315  traj.phase0.u[path]                              i  -1.000000E+00    9.999994E-01    1.000000E+00         u     1.46638E-04
        316  traj.phase0.u[path]                              i  -1.000000E+00    9.999999E-01    1.000000E+00         u     5.88967E-04
        317  traj.phase0.u[path]                              i  -1.000000E+00    9.999995E-01    1.000000E+00         u     1.75825E-04
        318  traj.phase0.u[path]                              i  -1.000000E+00    9.999992E-01    1.000000E+00         u     1.03959E-04
        319  traj.phase0.u[path]                              i  -1.000000E+00    9.999992E-01    1.000000E+00         u     1.03959E-04
        320  traj.phase0.u[path]                              i  -1.000000E+00    9.999998E-01    1.000000E+00         u     3.95222E-04
        321  traj.phase0.u[path]                              i  -1.000000E+00    9.999992E-01    1.000000E+00         u     1.12212E-04
        322  traj.phase0.u[path]                              i  -1.000000E+00    9.999987E-01    1.000000E+00               6.76464E-05
        323  traj.phase0.u[path]                              i  -1.000000E+00    9.999987E-01    1.000000E+00               6.76464E-05
        324  traj.phase0.u[path]                              i  -1.000000E+00    9.999996E-01    1.000000E+00         u     2.28179E-04
        325  traj.phase0.u[path]                              i  -1.000000E+00    9.999985E-01    1.000000E+00               5.85434E-05
        326  traj.phase0.u[path]                              i  -1.000000E+00    9.999976E-01    1.000000E+00               3.56186E-05
        327  traj.phase0.u[path]                              i  -1.000000E+00    9.999976E-01    1.000000E+00               3.56186E-05
        328  traj.phase0.u[path]                              i  -1.000000E+00    9.999989E-01    1.000000E+00               7.96823E-05
        329  traj.phase0.u[path]                              i  -1.000000E+00    9.999905E-01    1.000000E+00               9.00675E-06
        330  traj.phase0.u[path]                              i  -1.000000E+00    9.999853E-01    1.000000E+00               5.76883E-06


   Exit Status
      Inform  Description
           0  Solve Succeeded
--------------------------------------------------------------------------------
==================================================
          Grid Refinement - Iteration 1           
--------------------------------------------------
    Phase: traj.phases.phase0
        Refinement Options:
            Allow Refinement = True
            Tolerance = 0.0001
            Min Order = 3
            Max Order = 14
        Original Grid:
            Number of Segments = 30
            Segment Ends = [-1.0, -0.9333, -0.8667, -0.8, -0.7333, -0.6667, -0.6, -0.5333, -0.4667, -0.4, -0.3333, -0.2667, -0.2, -0.1333, -0.0667, 0.0, 0.0667, 0.1333, 0.2, 0.2667, 0.3333, 0.4, 0.4667, 0.5333, 0.6, 0.6667, 0.7333, 0.8, 0.8667, 0.9333, 1.0]
            Segment Order = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]
            Error = [5.33e-07, 4.891e-07, 3.975e-07, 4.766e-05, 1.152e-06, 1.168e-06, 1.12e-06, 9.752e-07, 6.726e-07, 2.295e-07, 2.314e-07, 5.567e-07, 6.702e-07, 6.065e-07, 3.587e-05, 6.767e-07, 8.229e-07, 1.404e-06, 2.037e-06, 1.943e-06, 1.052e-06, 1.925e-06, 3.68e-06, 3.871e-06, 2.654e-06,  1.3e-06, 5.762e-07, 3.263e-07, 3.517e-07, 4.995e-07]
Successfully completed grid refinement.
==================================================
Simulating trajectory traj
Done simulating trajectory traj
Problem: problem
Driver:  pyOptSparseDriver
  success     : True
  iterations  : 94
  runtime     : 4.6878E+00 s
  model_evals : 94
  model_time  : 8.9955E-02 s
  deriv_evals : 93
  deriv_time  : 9.4083E-01 s
  exit_status : SUCCESS

Plotting the solution#

The recommended practice is to obtain values from the recorded cases. While the problem object can also be queried for values, building plotting scripts that use the case recorder files as the data source means that the problem doesn’t need to be solved just to change a plot. Here we load values of various variables from the solution and simulation for use in the animation to follow.

sol = om.CaseReader(p.get_outputs_dir() / 'dymos_solution.db').get_case('final')
sim = om.CaseReader(traj.sim_prob.get_outputs_dir() / 'dymos_simulation.db').get_case('final')

t = sol.get_val('traj.phase0.timeseries.time')
x = sol.get_val('traj.phase0.timeseries.x')
v = sol.get_val('traj.phase0.timeseries.v')
u = sol.get_val('traj.phase0.timeseries.u')
h = np.sin(3 * x) / 3

t_sim = sim.get_val('traj.phase0.timeseries.time')
x_sim = sim.get_val('traj.phase0.timeseries.x')
v_sim = sim.get_val('traj.phase0.timeseries.v')
u_sim = sim.get_val('traj.phase0.timeseries.u')
h_sim = np.sin(3 * x_sim) / 3

Animating the Solution#

The collapsed code cell below contains the code used to produce an animation of the mountain car solution using Matplotlib.

The green area represents the hilly terrain the car is traversing. The black circle is the center of the car, and the orange arrow is the applied control.

The applied control generally has the same sign as the velocity and is ‘bang-bang’, that is, it wants to be at its maximum possible magnitude. Interestingly, the sign of the control flips shortly before the sign of the velocity changes.

Hide code cell source

fig = plt.figure(constrained_layout=True, figsize=(12, 6))
gs = fig.add_gridspec(3, 2)

anim_ax = fig.add_subplot(gs[:, 0])
anim_ax.set_aspect('equal')

x_ax = fig.add_subplot(gs[0, 1:])
v_ax = fig.add_subplot(gs[1, 1:])
u_ax = fig.add_subplot(gs[2, 1:])

x_ax.set_ylabel('x')
v_ax.set_ylabel('v')
u_ax.set_ylabel('u')
u_ax.set_xlabel('t')

# set up the subplots as needed
anim_ax.set_xlim((-1.75, 0.75))          
anim_ax.set_ylim((-1.25, 1.25))
anim_ax.set_xlabel('x')
anim_ax.set_ylabel('h')

x_sol_line, = x_ax.plot(t, x, 'o', ms=1, label='solution')
v_ax.plot(t, v, 'o', ms=1)
u_ax.plot(t, u, 'o', ms=1)

x_sim_line, = x_ax.plot([], [], '-', linewidth=3, label='simulation')
v_sim_line, = v_ax.plot([], [], '-', linewidth=3)
u_sim_line, = u_ax.plot([], [], '-', linewidth=3)

plt.figlegend(ncol=2, handles=[x_sol_line, x_sim_line], loc='upper center',
              bbox_to_anchor=(0.78,0.98))

x_ax.grid(alpha=0.2)
txt_x = x_ax.text(0.8, 0.1, f'x = {x_sim[0, 0]:6.3f}', horizontalalignment='left',
                  verticalalignment='center', transform=x_ax.transAxes)

v_ax.grid(alpha=0.2)
txt_v = v_ax.text(0.8, 0.1, f'v = {v_sim[0, 0]:6.3f}', horizontalalignment='left',
                  verticalalignment='center', transform=v_ax.transAxes)

u_ax.grid(alpha=0.2)
txt_u = u_ax.text(0.8, 0.1, f'u = {u_sim[0, 0]:6.3f}', horizontalalignment='left',
                  verticalalignment='center', transform=u_ax.transAxes)

x_terrain = np.linspace(-1.75, 0.75, 100)
h_terrain = np.sin(3 * x_terrain) / 3
terrain_line, = anim_ax.plot(x_terrain, h_terrain, '-', color='tab:gray', lw=2)
terrain = anim_ax.fill_between(x_terrain, h_terrain, -1.25*np.ones_like(x_terrain), color='tab:green')
car, = anim_ax.plot([], [], 'ko', ms=12)
u_vec = anim_ax.quiver(x_sim[0] + 0.005, h_sim[0] + 0.005, u_sim[0], [0], scale=10, angles='xy', color='tab:orange')

# See https://brushingupscience.com/2019/08/01/elaborate-matplotlib-animations/ for quiver animation

ANIM_DURATION = 5
PAUSE_DURATION = 2
ANIM_FPS = 20

num_points = t_sim.size
num_frames = ANIM_DURATION * ANIM_FPS
pause_frames = PAUSE_DURATION * ANIM_FPS

idx_from_frame_num = np.linspace(0, num_points-1, num_frames, dtype=int)

def drawframe(n):

    if n >= idx_from_frame_num.size:
        idx = num_points - 1
    else:
        idx = idx_from_frame_num[n]

    x = x_sim[idx]
    v = v_sim[idx]
    u = u_sim[idx]
    h = np.sin(3 * x) / 3 + 0.025
    car.set_data(x, h)
    
    dh_dx = np.cos(3 * x)

    u_vec.set_offsets(np.atleast_2d(np.asarray([x + 0.005, h + 0.005]).T))
    u_vec.set_UVC(u * np.cos(dh_dx), u * np.sin(dh_dx))

    x_sim_line.set_data(t_sim[:idx], x_sim[:idx])
    v_sim_line.set_data(t_sim[:idx], v_sim[:idx])
    u_sim_line.set_data(t_sim[:idx], u_sim[:idx])

    txt_x.set_text(f'x = {x[0]:6.3f}')
    txt_v.set_text(f'v = {v[0]:6.3f}')
    txt_u.set_text(f'u = {u[0]:6.3f}')
    
    return car, u_vec, x_sim_line, v_sim_line, u_sim_line

# # blit=True re-draws only the parts that have changed.
# # repeat_delay has no effect when using to_jshtml, so pad drawframe to show the final frame for PAUSE_FRAMES extra frames.
anim = animation.FuncAnimation(fig, drawframe, frames=num_frames + pause_frames, interval=1000/ANIM_FPS, blit=True)
plt.close()  # Don't let jupyter display the un-animated plot

from IPython.display import HTML
js = anim.to_jshtml()
with open('mountain_car_anim.html', 'w') as f:
    print(js, file=f)
HTML(filename='mountain_car_anim.html')

References#

[MMB14]

Alexey A Melnikov, Adi Makmal, and Hans J Briegel. Projective simulation applied to the grid-world and the mountain-car problem. arXiv preprint arXiv:1405.5459, 2014.

[Moo90]

Andrew William Moore. Efficient memory-based learning for robot control. Technical Report UCAM-CL-TR-209, University of Cambridge, Computer Laboratory, November 1990. URL: https://www.cl.cam.ac.uk/techreports/UCAM-CL-TR-209.pdf, doi:10.48456/tr-209.