﻿ Variable and Constraint Structure

# Variable and Constraint Structure

Top  Previous  Next

The basic variable and constraint structures for solving an optimization problem are as follows:

## Variable Vector Structure

The Optimizer variable vector includes:

oExamples of generic state variables can be found in the Using the Optimizer page of the Optimization Guide.

TrajectoryPhase variables, in the order the TrajectoryPhases are added to the Optimizer.

oThe TrajectoryPhase object contains TrajectoryNodes. Each TrajectoryNode contains: Cartesian position variables (X, Y, Z), Cartesian velocity variables (VX, VY, VZ), a mass variable, an epoch variable, and any control variables associated with the Control Model. The example below demonstrates retrieving TrajectoryPhase variables for a series of nodes added to the TrajectoryPhase.

 While (opt.IsRunning());           // Restore saved objects    // Update and retrieve state variables    // Perform analysis    // Update constraints    // Minimize or maximize objective function              // Evaluating a nominal case    If (opt.OptimizationPhase == 1);                    Report opt.TrajectoryPhases[0].Nodes[i].Position, opt.TrajectoryPhases[0].Nodes[i].Velocity,                          opt.TrajectoryPhases[0].Nodes[i].Mass, opt.TrajectoryPhases[0].Nodes[i].Epoch, opt.TrajectoryPhases[0].Nodes[i].ControlVariables;    End; End;

## Constraint Vector Structure

Constraint vectors include:

oExamples of generic constraints can be found in the Using the Optimizer page of the Optimization Guide.

Inter-Phase constraints all in the order they are added

TrajectoryPhase constraints:

1.Defect constraints

a.The defect constraints enforce the dynamics (force model and control model) along the trajectory path.

b.Each collocation point represents velocity defects (Vx, Vy, Vz), acceleration defects (Ax, Ay, Az), and mass flow rate defect.

2.Node Spacing constraints

a.These constraints enforce that the node spacing be constant.

3.Control model path constraints (dependent on Control Model)

Simple Thruster Control Model path constraints:

PhaseSimpleThrusterOptions.ApplyNormConstraint - determines whether to constrain the norm of the Cartesian control variable vector to the bounds in the SimpleThrusterOptions.NormConstraintBounds property

PhaseSimpleThrusterOptions.NormConstraintBounds - the array containing the lower (first element) and upper (second element) bounds to apply to the norm constraint. The norm constraint is only applied if the PhaseSimpleThrusterOptions.ApplyNormConstraint property is set to true (1)

If ControlModel.ShadowingBodies is not empty, shadow constraints will be applied which prevent thrust from being applied when in shadow.

Note: Setting the PhaseSimpleThrusterOptions.ApplyNormConstraint to false (0) will often result in an ill-conditioned and/or non-physical problem unless the control variables are constrained directly by the user.

 // Initialize TrajectoryPhase object TrajectoryPhase phase;   // Simple Thruster phase.ControlModel.ControlType = 1;   phase.ControlModel.SimpleThrusterOptions.NormConstraintBounds = {0,1}; phase.ControlModel.SimpleThrusterOptions.ApplyNormConstraint = 1;

Ideal Sail Control Model path constraints:

PhaseIdealSolarSailOptions.ApplyNormConstraint - determines whether to constrain the norm of the Cartesian control variable vector equal to 1.

PhaseIdealSolarSailOptions.ApplySunPointingConstraint - determines whether the dot product of the Cartesian control variable vector and the position vector with respect to the sun will be constrained to be greater than or equal to 0.

Note: Setting the PhaseSimpleThrusterOptions.ApplySunPointingConstraint to false (0) will often result in a non-physical problem unless the Cartesian control variable vector is constrained directly by the user to never point towards the Sun.

 // Initialize TrajectoryPhase object TrajectoryPhase phase;   // Ideal Sail phase.ControlModel.ControlType = 2;   phase.ControlModel.IdealSolarSailOptions.ApplyNormConstraint = 1; phase.ControlModel.IdealSolarSailOptions.ApplySunPointingConstraint = 1;

4. Time of flight constraint

By default, this constraint has a lower bound of zero and an upper bound of infinity.

TrajectoryPhase.SetTimeOfFlightBounds() - sets bounds for the time of flight of the TrajectoryPhase

 // Initialize TrajectoryPhase object TrajectoryPhase phase;   // Bound time of flight between 0 and 1 day phase.SetTimeOfFlightBounds(TimeSpan.FromDays(0), TimeSpan.FromDays(1));

5. State boundary constraints

TrajectoryPhase.AddRadiusConstraint() - constrains the radius (with respect to the central body) at the node(s) associated with the passed range.

TrajectoryPhase.AddRotatingStateConstraint() - adds a constraint on the TrajectoryPhase's position and velocity variables in a rotating frame of reference. The Cartesian position and velocity variables are transformed into the rotating frame in order to produce the values constrained by the lower and upper bound.

6. State path constraints

TrajectoryPhase.AddRadiusConstraint() - constrains the radius (with respect to the central body) at the node(s) associated with the passed range

 // Initialize TrajectoryPhase object TrajectoryPhase phase;   // Radius Constraint // Constrains the radius w.r.t. the Central Body along the path between 7000 and 10000 km phase.AddRadiusConstraint("path", 7000, 10000);