Sparse Nonlinear Optimizer (SNOPT) Profile
The SNOPT Optimizer search profile uses the SNOPT (Sparse Nonlinear OPTimizer) programming solver to achieve a certain goal - represented by a cost function and a set of constraint functions. The profile iteratively modifies a set of decision variables or controls to find a feasible, optimum solution.
SNOPT is a software package for solving large-scale optimization problems (linear and nonlinear programs). It employs a sparse Sequential Quadratic Programming (SQP) algorithm with limited-memory quasi-Newton approximations to the Hessian of Lagrangian. SNOPT is especially effective for nonlinear problems whose functions and gradients are expensive to evaluate. The functions should be smooth but need not be convex. An augmented Lagrangian merit function ensures convergence from an arbitrary point. Infeasible problems are treated methodically via elastic bounds on the nonlinear constraints. SNOPT allows the nonlinear constraints to be violated (if necessary) and minimizes the sum of such violations.
UCSD/Stanford Optimization Software, https://ccom.ucsd.edu/~optimizers/solvers/snopt/
The SNOPT profile is comprised of five tabs:
Variables
This tab allows the configuration of two types of quantities, the Controls - optimizer Decision Variables - and the Results - comprised of the Objective Function and the Constraints. A profile must have at least one decision variable and one objective defined to execute properly. Objectives and constraints are derived from the same source and defined in the same manner, but are different in terms of how they are applied to the problem; an objective is a quantity that the optimizer attempts to minimize or maximize, while constraints define the set of acceptable (feasible) solutions.
Selecting Decision Variables, Objectives, and Constraints
Any element of a nested MCS segment or linked component that is available
for selection as a decision variable will be identified with a target icon displayed adjacent to it. To select an element as a decision variable, click the associated target icon; a check mark will appear over the icon. To remove a selected element as a decision variable, click the target icon a second time and the check mark will disappear. You can select decision variables in more
than one nested segment and, in each, you can select as many decision variables
as you need. Plugins publish their inputs to Astrogator, so you
can also select these inputs as decision variables. To target an input, you may need to double-click it to expose the window for editing its value; the target icon will appear in that window next
to the editable field.
If the "Restore nominal values as soon as target sequence completes" MCS Option is selected and an element of a linked component is selected as an decision variable, the changed value that is produced will only be applied to subsequent segments nested within the same target sequence. Segments that are outside of the target sequence will use the value that the element held at the beginning of the MCS. If you apply corrections after running the MCS, then on the next run all segments within the MCS will use the value produced by the target sequence.
Objectives and constraints are defined in terms of Astrogator's extensive repertoire of Calculation Objects (to which you can add). To select objectives and constraints for a given nested MCS segment, click Results.... This will bring up the User-Selected Results window for that segment, where Calculation Objects can be selected as objectives and constraints.
The sections below describe the definition of decision variables and objectives and constraints:
Configuring Decision Variables
Each decision variable that you have selected is listed in the Decision Variables section of the Variables tab, along with the following information:
- Use - If the box is checked, the decision variable is being used.
- Name - The name of the element selected as a decision variable.
- Initial Value - The element's initial guess value (as provided by you).
- Current Value - The element's final value from the last run of the optimizer; if the optimizer hasn't run, this value is the same as the initial value.
- Lower Bound - The lowest value that you want to allow the optimizer to use for the element; double-click the field to edit it.
- Upper Bound - The highest value that you want to allow the optimizer to use for the element; double-click the field to edit it.
- Object - The segment or component to which the element belongs.
- Custom Display Unit - Select to use a unit other than the default when displaying results in the status window and graphs.
- Display Unit - The unit to be displayed if the Custom Display Unit option has been selected.
Graphs cannot display DMS or HMS angle units and will use the scenario unit instead
If you have multiple decision variables, select the Hide Inactive field to hide decision variables that are not currently selected for use.
The following fields, some of which can be edited, appear below the Decision Variables list:
Field | Description |
---|---|
Initial Value | The nominal value of the element selected as a parameter. |
Current Value | The element's final value from the last run of the optimizer; if the optimizer hasn't run, this value is the same as the initial value. |
Scaling Value | Enter a value to be used for scaling; the default is no scaling (i.e., scale by 1, specified by internal units). Scaling improves numerical behavior if the parameters have very different magnitudes. When scaling is used, the current value is divided by the scaling value before being passed to the optimizer algorithm. Because the scaling value has units, the value passed to the optimizer algorithm is unitless. |
Configuring Objectives and Constraints (Results)
Each objective or constraint that you have selected is listed in the Objectives and Constraints (Results) section of the Variables tab, along with the following information:
- Use - If the box is checked, the Calculation Object will be used as a Result component.
- Name - The name of the Calculation Object used as a Result component.
- Current Value - The value achieved for this quantity in the last optimizer run. You can copy the value in this field by right-clicking it and selecting the Copy command that appears.
- Weight - The relative significance of the element compared to other components of the objective function; this value will be applied to the calculations to allow you to favor achieving one goal over another; this field only applies if the element is set to be minimized in the Goal field. Double-click the field to edit it.
- Lower Bound - The lower limit achievable by this quantity in the optimizer's iteration history. This field only applies if the result is set to be a Bound (or constraint) in the Goal field. Set the Upper Bound and Lower Bound to be equal to indicate an equality constraint. Double-click the field to edit it.
- Upper Bound - The upper limit achievable by this quantity in the optimizer's iteration history. This field only applies if the result is set to be a Bound (or constraint) in the Goal field. Set the Upper Bound and Lower Bound to be equal to indicate an equality constraint. Double-click the field to edit it.
- Object - The segment or component to which the element belongs.
- Goal - The role of the element in the problem; click the field once and select Bound to employ the element as a constraint, and Minimize to use it as part of the objective. If you select multiple Minimize objectives for the same profile, then SNOPT will optimize the sum of the values (with each individual value multiplied by its weight and divided by its scale factor).
- Custom Display Unit - Select to use a unit other than the default when displaying results in the status window and graphs.
- Display Unit - The unit to be displayed if the Custom Display Unit option has been selected.
Graphs cannot display DMS or HMS angle units and will use the scenario unit instead
If you have multiple objectives and constraints, select the Hide Inactive field to hide objectives and constraints that are not currently selected for use.
Options
A few relatively common SNOPT options can be set through the interface under the Options tab. These are the Major and Minor Iteration Limits and Tolerances.
If you require an extremely accurate solution, and are willing to wait for a longer amount of time, then the iteration values can be increased, and the tolerance values should be decreased.
If you do not want to wait for a longer amount of time, and are willing to sacrifice accuracy for speed, then the tolerance values should be increased.
The value for both iterations and tolerances is dependent on the problem that you are trying to solve, and if one set of values is not providing good enough answers, or is not converging, then they can always be changed to better suit the problem at hand. The Iteration Limits and Tolerances section allows you to change the most common settings, but a SNOPT option specifications file can change all of SNOPT’s options.
A sample file, which contains all of the possible options, and their default values, can be found in the published SNOPT manual (PDF), starting on page 63. The entire list of possible options, along with their descriptions, can be found starting on page 68 of the SNOPT manual (PDF).
Field | Description |
---|---|
Reset controls before each run |
When this option is checked, the optimizer is automatically reset each time that it is run, discarding information that was computed the last time it was run. |
Maximum major iterations |
“This is the maximum number of major iterations allowed. It is intended to guard against an excessive number of linearizations of the constraints. If this value is 0, both feasibility and optimality are checked.” |
Major feasibility tolerance |
“This specifies how accurately the nonlinear constraints should be satisfied.” Consideration should be given to the internal units of your variables when selecting this value (i.e., meters, seconds, etc.). |
Major optimality tolerance |
“This specifies the final accuracy of the dual variables.” Consideration should be given to the internal units of your variables when selecting this value (i.e., meters, seconds, etc.). |
Maximum minor iterations |
“If the number of minor iterations for the optimality phase of the QP subproblem exceeds k, then all nonbasic QP variables that have not yet moved are frozen at their current values and the reduced QP is solved to optimality.” |
Minor feasibility tolerance |
“SNOPT tries to ensure that all variables eventually satisfy their upper and lower bounds to within [the specified tolerance].” Consideration should be given to the internal units of your variables when selecting this value (i.e., meters, seconds, etc.). |
Minor optimality tolerance |
Provided for completeness. |
SNOPT option specifications file |
Providing a specifications file allows you to specify a myriad of options described in the User’s Guide for SNOPT Version 7.6 (PDF). A specifications file starts with the keyword Begin, and stops with the keyword End. It is written in free-format, with each line specifying a single option. Any line with an asterisk (*) signifies a comment. The file can include any number of options, so the sample file from the manual can be shortened significantly if you are only interested in a few options. If you want to customize further, these files provide many options that can tailor SNOPT to your specific needs. In terms of STK specifically, the default values in the sample file are used every time SNOPT is run, unless an options file is used that changes those values. These default settings are not shown in the options tab because often the only values that need to be changed are the iteration and tolerance values. A reason, among many, to use the specifications file would be to shorten and customize the Log. An example of log customization is detailed in the Log Customization through a SNOPT Option Specifications File section. |
Quoted text in this table is from the User’s Guide for SNOPT Version 7.6 (PDF) (also linked in the paragraph above the table).
Log
The Log tab displays the detailed SNOPT iteration log, including the algorithm options. The log is made up of Print and Summary files, which are generated internally by SNOPT when it is run. When SNOPT is using the default specification options, there are six key features of the log that can be easily identified. These are the Parameters, Matrix Statistics, Major Iteration Log (page 86 of SNOPT manual (PDF)), Exit Summary (page 94), Constraints (page 99), and Variables (page 101) sections.
Log Customization through a SNOPT Option Specifications File
All six of the important sections are displayed in the log because the default SNOPT options are set to include them. You can create a log that displays user-specified information, which is done by creating a custom options file. A sample custom options specifications file is shown below, which can be used to toggle the six important sections on and off.
BEGIN TestLogCustomization Major print level 0 Minor print level 0 Solution Yes End TestLogCustomization
If this file is used as is in the options tab, the Exit Summary, Constraints, and Variables would all be displayed in the log, while the Major Iteration Log, Parameters, and Matrix Statistics would not be displayed. This is because the three sections that would not be displayed are embedded in the Major print level function, which has a value of zero, while the Constraints and Variables are embedded in the Solution function. The Exit Summary is always displayed unless a Print file function is called with a zero value. In that case, the Exit Summary is not displayed, and the entire log will be empty. In order to only display the Exit Summary, the Major print level function value needs to be zero, and the Solution function needs to be No. If you change the Major print level function value to 1, while the Solution function is Yes, then all six important sections will be displayed. If the Major print level function value is changed to 1, and the Solution function is changed to No, then only the Parameters, Matrix Statistics, Major Iteration Log, and Exit Summary sections will be displayed.
Graphs
The Graphs tab allows you to define a variety of graphs of the optimizer profile's performance that can be generated manually when desired or automatically whenever the MCS is run. The tab is divided into two general areas - a table that displays the graphs that have been assigned to the profile and the collection of properties that define the graph that is currently selected in the table.
Graphs Table
You can add, copy, delete and perform other actions on graphs by right-clicking in the table that lists them or by using the following toolbar buttons:
Button | Name | Function |
---|---|---|
![]() |
New... | Inserts a new graph with default properties settings. |
![]() |
Cut | Removes the currently selected graph from the list and copies it to the clipboard. |
![]() |
Copy | Makes a copy of the currently selected graph to the clipboard. |
![]() |
Paste | Inserts a copy of the graph that is currently on the clipboard. |
![]() |
Delete | Deletes the currently selected graph. |
The graphs table displays the following information for each graph:
- Name - The name given by the user to the graph or, if one was not given, the default name.
- Generate on run - Select to have Astrogator generate the graph automatically each time that the MCS is run.
- User Comment - a description of the graph supplied by the user or, if one was not supplied, a default description.
Graph Properties
Each graph can display the values of any number of the active Controls and Objectives and Constraints defined for the profile against an X axis of the number of iterations performed or any single active Control or Objective or Constraint defined for the profile.
The Independent variable field defines the X axis of the graph. If the X axis is one of the active Controls or Objectives or Constraints, you can select Label Iterations to have each of the points on the graph labeled according to its iteration number.
The active Controls defined for the profile are listed in a table that you can use to specify their display characteristics in the graph:
- Name - The name of the element selected as a control.
- Object - The segment or component to which the element belongs.
- Graph Value - Select to include the value in the graph.
- Line Color - The color of line that will be used to represent the control's value in the graph.
- Point Style - The style of marker that will be used to represent iteration points along the control's line in the graph.
- Y Axis - Select Y1 or Y2 to display a range of values suitable to the control on the left or right side, respectively, of the graph.
The active Objectives and Constraints (Results) defined for the profile are also listed in a table that you can use to specify their display characteristics in the graph:
- Name - The name of the Calculation Object used as an Objective or Constraint.
- Object - The segment or component for which this Objective or Constraint has been selected.
- Graph Option - Select Don't graph to leave the Objective or Constraint out of the graph or Graph value to use the Objective's or Constraint's value in the graph.
- Line Color - The color of line that will be used to represent the Objective's or Constraint's value in the graph.
- Point Style - The style of marker that will be used to represent iteration points along the Objective's or Constraint's line in the graph.
- Y Axis - Select Y1 or Y2 to display a range of values suitable to the Objective or Constraint on the left or right side, respectively, of the graph.
Click Generate Graph to produce the currently selected graph. To produce a report of the graph data, click Generate Report.
Scripting
The Scripting tab contains an embedded instance of the Scripting Tool. A script entered here will be executed before the sequence is run. The script will be executed each time that the profile runs the sequence. Parameters that are defined in the Scripting Tool are available for use as controls by the optimizer profile.