Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding ability to reduce the amount of text printed when displaying optimization results #395

Merged
merged 11 commits into from
May 8, 2024

Conversation

crecine
Copy link
Contributor

@crecine crecine commented May 1, 2024

When minimal_print is True, only variables and constraints with a non-empty status (for example a violated bound)

Purpose

When printing Structured Optimization Problems (the string representation of Optimization in pyOpt_optimization.py), large problems with lots of variables and constraints, it can be difficult to debug when it is hard to tell which variables or constraints are violating or riding constraints.
This PR adds a new method (summary_str) that will return the string representation of the optimization.
It has an an optional input called minimal_print which, if not set, will default to False and print everything as normal.

Expected time until merged

This is not urgent

Type of change

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (non-backwards-compatible fix or feature)
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no API changes)
  • Documentation update
  • Maintenance update
  • Other (please describe)

Testing

sol = Solution()
if hasattr(sol, 'summary_str'):
    print(sol.summary_str(minimal_print=True))
else:
    print('minimal_print is not available for this solution')
    print(sol)

Example results copy-pasted from the terminal (not reformatted for git) for a particular case:

minimal_print=False Optimization Problem -- Optimization using pyOpt_sparse ================================================================================ Objective Function: _objfunc
Solution:

Total Time:                    2.4042
   User Objective Time :       1.8477
   User Sensitivity Time :     0.5390
   Interface Time :            0.0113
   Opt Solver Time:            0.0062
Calls to Objective Function :       7
Calls to Sens Function :            6

Objectives
Index Name Value
0 mission:summary:fuel_burned 2.420137E+00

Variables (c - continuous, i - integer, d - discrete)
Index Name Type Lower Bound Value Upper Bound Status
0 mission:design:gross_mass_0 c 7.407407E-02 1.215277E+00 1.481481E+00
1 traj.climb.t_duration_0 c 5.000000E-01 5.000000E-01 1.500000E+00 l
2 traj.climb.states:mass_0 c 0.000000E+00 7.936223E+00 1.000000E+17
3 traj.climb.states:mass_1 c 0.000000E+00 7.912448E+00 1.000000E+17
4 traj.climb.states:mass_2 c 0.000000E+00 7.905482E+00 1.000000E+17
5 traj.climb.states:mass_3 c 0.000000E+00 7.875551E+00 1.000000E+17
6 traj.climb.states:mass_4 c 0.000000E+00 7.838787E+00 1.000000E+17
7 traj.climb.states:mass_5 c 0.000000E+00 7.827686E+00 1.000000E+17
8 traj.climb.states:mass_6 c 0.000000E+00 7.798290E+00 1.000000E+17
9 traj.climb.states:mass_7 c 0.000000E+00 7.758426E+00 1.000000E+17
10 traj.climb.states:mass_8 c 0.000000E+00 7.745731E+00 1.000000E+17
11 traj.climb.states:mass_9 c 0.000000E+00 7.721254E+00 1.000000E+17
12 traj.climb.states:mass_10 c 0.000000E+00 7.687171E+00 1.000000E+17
13 traj.climb.states:mass_11 c 0.000000E+00 7.676305E+00 1.000000E+17
14 traj.climb.states:mass_12 c 0.000000E+00 7.664044E+00 1.000000E+17
15 traj.climb.states:mass_13 c 0.000000E+00 7.647013E+00 1.000000E+17
16 traj.climb.states:mass_14 c 0.000000E+00 7.641582E+00 1.000000E+17
17 traj.climb.states:distance_0 c 0.000000E+00 1.145842E-02 1.000000E+15
18 traj.climb.states:distance_1 c 0.000000E+00 2.910629E-02 1.000000E+15
19 traj.climb.states:distance_2 c 0.000000E+00 3.513185E-02 1.000000E+15
20 traj.climb.states:distance_3 c 0.000000E+00 6.608263E-02 1.000000E+15
21 traj.climb.states:distance_4 c 0.000000E+00 1.161466E-01 1.000000E+15
22 traj.climb.states:distance_5 c 0.000000E+00 1.337327E-01 1.000000E+15
23 traj.climb.states:distance_6 c 0.000000E+00 1.857543E-01 1.000000E+15
24 traj.climb.states:distance_7 c 0.000000E+00 2.672273E-01 1.000000E+15
25 traj.climb.states:distance_8 c 0.000000E+00 2.952907E-01 1.000000E+15
26 traj.climb.states:distance_9 c 0.000000E+00 3.523428E-01 1.000000E+15
27 traj.climb.states:distance_10 c 0.000000E+00 4.373778E-01 1.000000E+15
28 traj.climb.states:distance_11 c 0.000000E+00 4.657761E-01 1.000000E+15
29 traj.climb.states:distance_12 c 0.000000E+00 4.984472E-01 1.000000E+15
30 traj.climb.states:distance_13 c 0.000000E+00 5.449429E-01 1.000000E+15
31 traj.climb.states:distance_14 c 0.000000E+00 5.599959E-01 1.000000E+15
32 traj.cruise.t_duration_0 c 5.000000E-01 1.500000E+00 1.500000E+00 u
33 traj.cruise.states:mass_0 c 0.000000E+00 7.615825E+00 1.000000E+17
34 traj.cruise.states:mass_1 c 0.000000E+00 7.580437E+00 1.000000E+17
35 traj.cruise.states:mass_2 c 0.000000E+00 7.569273E+00 1.000000E+17
36 traj.cruise.states:mass_3 c 0.000000E+00 7.517294E+00 1.000000E+17
37 traj.cruise.states:mass_4 c 0.000000E+00 7.446195E+00 1.000000E+17
38 traj.cruise.states:mass_5 c 0.000000E+00 7.423842E+00 1.000000E+17
39 traj.cruise.states:mass_6 c 0.000000E+00 7.363349E+00 1.000000E+17
40 traj.cruise.states:mass_7 c 0.000000E+00 7.280748E+00 1.000000E+17
41 traj.cruise.states:mass_8 c 0.000000E+00 7.254813E+00 1.000000E+17
42 traj.cruise.states:mass_9 c 0.000000E+00 7.205142E+00 1.000000E+17
43 traj.cruise.states:mass_10 c 0.000000E+00 7.137209E+00 1.000000E+17
44 traj.cruise.states:mass_11 c 0.000000E+00 7.115854E+00 1.000000E+17
45 traj.cruise.states:mass_12 c 0.000000E+00 7.091992E+00 1.000000E+17
46 traj.cruise.states:mass_13 c 0.000000E+00 7.059207E+00 1.000000E+17
47 traj.cruise.states:mass_14 c 0.000000E+00 7.048862E+00 1.000000E+17
48 traj.cruise.states:distance_0 c 0.000000E+00 6.517630E-01 1.000000E+15
49 traj.cruise.states:distance_1 c 0.000000E+00 7.783276E-01 1.000000E+15
50 traj.cruise.states:distance_2 c 0.000000E+00 8.183714E-01 1.000000E+15
51 traj.cruise.states:distance_3 c 0.000000E+00 1.005556E+00 1.000000E+15
52 traj.cruise.states:distance_4 c 0.000000E+00 1.263601E+00 1.000000E+15
53 traj.cruise.states:distance_5 c 0.000000E+00 1.345215E+00 1.000000E+15
54 traj.cruise.states:distance_6 c 0.000000E+00 1.567270E+00 1.000000E+15
55 traj.cruise.states:distance_7 c 0.000000E+00 1.873334E+00 1.000000E+15
56 traj.cruise.states:distance_8 c 0.000000E+00 1.970122E+00 1.000000E+15
57 traj.cruise.states:distance_9 c 0.000000E+00 2.156436E+00 1.000000E+15
58 traj.cruise.states:distance_10 c 0.000000E+00 2.413278E+00 1.000000E+15
59 traj.cruise.states:distance_11 c 0.000000E+00 2.494511E+00 1.000000E+15
60 traj.cruise.states:distance_12 c 0.000000E+00 2.585561E+00 1.000000E+15
61 traj.cruise.states:distance_13 c 0.000000E+00 2.711136E+00 1.000000E+15
62 traj.cruise.states:distance_14 c 0.000000E+00 2.750867E+00 1.000000E+15
63 traj.descent.t_duration_0 c 5.000000E-01 1.308204E+00 1.500000E+00
64 traj.descent.states:mass_0 c 0.000000E+00 7.040586E+00 1.000000E+17
65 traj.descent.states:mass_1 c 0.000000E+00 7.029221E+00 1.000000E+17
66 traj.descent.states:mass_2 c 0.000000E+00 7.025641E+00 1.000000E+17
67 traj.descent.states:mass_3 c 0.000000E+00 7.008897E+00 1.000000E+17
68 traj.descent.states:mass_4 c 0.000000E+00 6.985870E+00 1.000000E+17
69 traj.descent.states:mass_5 c 0.000000E+00 6.978625E+00 1.000000E+17
70 traj.descent.states:mass_6 c 0.000000E+00 6.958924E+00 1.000000E+17
71 traj.descent.states:mass_7 c 0.000000E+00 6.931930E+00 1.000000E+17
72 traj.descent.states:mass_8 c 0.000000E+00 6.923449E+00 1.000000E+17
73 traj.descent.states:mass_9 c 0.000000E+00 6.907324E+00 1.000000E+17
74 traj.descent.states:mass_10 c 0.000000E+00 6.885617E+00 1.000000E+17
75 traj.descent.states:mass_11 c 0.000000E+00 6.878896E+00 1.000000E+17
76 traj.descent.states:mass_12 c 0.000000E+00 6.871477E+00 1.000000E+17
77 traj.descent.states:mass_13 c 0.000000E+00 6.861406E+00 1.000000E+17
78 traj.descent.states:mass_14 c 0.000000E+00 6.858255E+00 1.000000E+17
79 traj.descent.states:distance_0 c 0.000000E+00 2.791288E+00 1.000000E+15
80 traj.descent.states:distance_1 c 0.000000E+00 2.846064E+00 1.000000E+15
81 traj.descent.states:distance_2 c 0.000000E+00 2.863155E+00 1.000000E+15
82 traj.descent.states:distance_3 c 0.000000E+00 2.941477E+00 1.000000E+15
83 traj.descent.states:distance_4 c 0.000000E+00 3.045061E+00 1.000000E+15
84 traj.descent.states:distance_5 c 0.000000E+00 3.076724E+00 1.000000E+15
85 traj.descent.states:distance_6 c 0.000000E+00 3.160104E+00 1.000000E+15
86 traj.descent.states:distance_7 c 0.000000E+00 3.268137E+00 1.000000E+15
87 traj.descent.states:distance_8 c 0.000000E+00 3.300576E+00 1.000000E+15
88 traj.descent.states:distance_9 c 0.000000E+00 3.360607E+00 1.000000E+15
89 traj.descent.states:distance_10 c 0.000000E+00 3.438008E+00 1.000000E+15
90 traj.descent.states:distance_11 c 0.000000E+00 3.461159E+00 1.000000E+15
91 traj.descent.states:distance_12 c 0.000000E+00 3.486334E+00 1.000000E+15
92 traj.descent.states:distance_13 c 0.000000E+00 3.519691E+00 1.000000E+15
93 traj.descent.states:distance_14 c 0.000000E+00 3.529912E+00 1.000000E+15
94 traj.reserve_cruise.states:mass_0 c 0.000000E+00 6.853949E+00 1.000000E+17
95 traj.reserve_cruise.states:mass_1 c 0.000000E+00 6.848020E+00 1.000000E+17
96 traj.reserve_cruise.states:mass_2 c 0.000000E+00 6.846146E+00 1.000000E+17
97 traj.reserve_cruise.states:mass_3 c 0.000000E+00 6.837405E+00 1.000000E+17
98 traj.reserve_cruise.states:mass_4 c 0.000000E+00 6.825394E+00 1.000000E+17
99 traj.reserve_cruise.states:mass_5 c 0.000000E+00 6.821606E+00 1.000000E+17
100 traj.reserve_cruise.states:mass_6 c 0.000000E+00 6.811320E+00 1.000000E+17
101 traj.reserve_cruise.states:mass_7 c 0.000000E+00 6.797200E+00 1.000000E+17
102 traj.reserve_cruise.states:mass_8 c 0.000000E+00 6.792747E+00 1.000000E+17
103 traj.reserve_cruise.states:mass_9 c 0.000000E+00 6.784194E+00 1.000000E+17
104 traj.reserve_cruise.states:mass_10 c 0.000000E+00 6.772441E+00 1.000000E+17
105 traj.reserve_cruise.states:mass_11 c 0.000000E+00 6.768732E+00 1.000000E+17
106 traj.reserve_cruise.states:mass_12 c 0.000000E+00 6.764580E+00 1.000000E+17
107 traj.reserve_cruise.states:mass_13 c 0.000000E+00 6.758861E+00 1.000000E+17
108 traj.reserve_cruise.states:mass_14 c 0.000000E+00 6.757053E+00 1.000000E+17
109 traj.reserve_cruise.states:distance_0 c 0.000000E+00 3.546154E+00 1.000000E+15
110 traj.reserve_cruise.states:distance_1 c 0.000000E+00 3.568555E+00 1.000000E+15
111 traj.reserve_cruise.states:distance_2 c 0.000000E+00 3.575642E+00 1.000000E+15
112 traj.reserve_cruise.states:distance_3 c 0.000000E+00 3.608772E+00 1.000000E+15
113 traj.reserve_cruise.states:distance_4 c 0.000000E+00 3.654444E+00 1.000000E+15
114 traj.reserve_cruise.states:distance_5 c 0.000000E+00 3.668889E+00 1.000000E+15
115 traj.reserve_cruise.states:distance_6 c 0.000000E+00 3.708190E+00 1.000000E+15
116 traj.reserve_cruise.states:distance_7 c 0.000000E+00 3.762361E+00 1.000000E+15
117 traj.reserve_cruise.states:distance_8 c 0.000000E+00 3.779492E+00 1.000000E+15
118 traj.reserve_cruise.states:distance_9 c 0.000000E+00 3.812467E+00 1.000000E+15
119 traj.reserve_cruise.states:distance_10 c 0.000000E+00 3.857926E+00 1.000000E+15
120 traj.reserve_cruise.states:distance_11 c 0.000000E+00 3.872304E+00 1.000000E+15
121 traj.reserve_cruise.states:distance_12 c 0.000000E+00 3.888419E+00 1.000000E+15
122 traj.reserve_cruise.states:distance_13 c 0.000000E+00 3.910644E+00 1.000000E+15
123 traj.reserve_cruise.states:distance_14 c 0.000000E+00 3.917676E+00 1.000000E+15

Constraints (i - inequality, e - equality)
Index Name Type Lower Value Upper Status Lagrange Multiplier (N/A)
0 mission:constraints:range_residual e 0.000000E+00 -4.547474E-15 0.000000E+00 9.00000E+100
1 mission:constraints:mass_residual e 0.000000E+00 -2.153030E-08 0.000000E+00 9.00000E+100
2 traj.climb.collocation_constraint.defects:mass e 0.000000E+00 -5.649190E-17 0.000000E+00 9.00000E+100
3 traj.climb.collocation_constraint.defects:mass e 0.000000E+00 3.624435E-07 0.000000E+00 9.00000E+100
4 traj.climb.collocation_constraint.defects:mass e 0.000000E+00 -8.338418E-08 0.000000E+00 9.00000E+100
5 traj.climb.collocation_constraint.defects:mass e 0.000000E+00 -1.851050E-07 0.000000E+00 9.00000E+100
6 traj.climb.collocation_constraint.defects:mass e 0.000000E+00 -2.257367E-07 0.000000E+00 9.00000E+100
7 traj.climb.collocation_constraint.defects:mass e 0.000000E+00 -2.445950E-07 0.000000E+00 9.00000E+100
8 traj.climb.collocation_constraint.defects:mass e 0.000000E+00 -2.945610E-07 0.000000E+00 9.00000E+100
9 traj.climb.collocation_constraint.defects:mass e 0.000000E+00 9.226740E-08 0.000000E+00 9.00000E+100
10 traj.climb.collocation_constraint.defects:mass e 0.000000E+00 -3.195652E-07 0.000000E+00 9.00000E+100
11 traj.climb.collocation_constraint.defects:mass e 0.000000E+00 -2.818044E-07 0.000000E+00 9.00000E+100
12 traj.climb.collocation_constraint.defects:mass e 0.000000E+00 -3.045445E-07 0.000000E+00 9.00000E+100
13 traj.climb.collocation_constraint.defects:mass e 0.000000E+00 3.545411E-07 0.000000E+00 9.00000E+100
14 traj.climb.collocation_constraint.defects:mass e 0.000000E+00 -2.027067E-07 0.000000E+00 9.00000E+100
15 traj.climb.collocation_constraint.defects:mass e 0.000000E+00 -2.127603E-07 0.000000E+00 9.00000E+100
16 traj.climb.collocation_constraint.defects:mass e 0.000000E+00 -2.423630E-07 0.000000E+00 9.00000E+100
17 traj.climb.collocation_constraint.defects:distance e 0.000000E+00 4.695118E-09 0.000000E+00 9.00000E+100
18 traj.climb.collocation_constraint.defects:distance e 0.000000E+00 4.254169E-09 0.000000E+00 9.00000E+100
19 traj.climb.collocation_constraint.defects:distance e 0.000000E+00 3.771352E-09 0.000000E+00 9.00000E+100
20 traj.climb.collocation_constraint.defects:distance e 0.000000E+00 7.437516E-09 0.000000E+00 9.00000E+100
21 traj.climb.collocation_constraint.defects:distance e 0.000000E+00 6.419266E-09 0.000000E+00 9.00000E+100
22 traj.climb.collocation_constraint.defects:distance e 0.000000E+00 5.421601E-09 0.000000E+00 9.00000E+100
23 traj.climb.collocation_constraint.defects:distance e 0.000000E+00 6.149460E-09 0.000000E+00 9.00000E+100
24 traj.climb.collocation_constraint.defects:distance e 0.000000E+00 5.477071E-09 0.000000E+00 9.00000E+100
25 traj.climb.collocation_constraint.defects:distance e 0.000000E+00 4.780551E-09 0.000000E+00 9.00000E+100
26 traj.climb.collocation_constraint.defects:distance e 0.000000E+00 3.869530E-09 0.000000E+00 9.00000E+100
27 traj.climb.collocation_constraint.defects:distance e 0.000000E+00 3.612760E-09 0.000000E+00 9.00000E+100
28 traj.climb.collocation_constraint.defects:distance e 0.000000E+00 3.318907E-09 0.000000E+00 9.00000E+100
29 traj.climb.collocation_constraint.defects:distance e 0.000000E+00 1.585364E-09 0.000000E+00 9.00000E+100
30 traj.climb.collocation_constraint.defects:distance e 0.000000E+00 1.543646E-09 0.000000E+00 9.00000E+100
31 traj.climb.collocation_constraint.defects:distance e 0.000000E+00 1.490506E-09 0.000000E+00 9.00000E+100
32 traj.cruise.collocation_constraint.defects:mass e 0.000000E+00 5.513725E-10 0.000000E+00 9.00000E+100
33 traj.cruise.collocation_constraint.defects:mass e 0.000000E+00 5.521448E-10 0.000000E+00 9.00000E+100
34 traj.cruise.collocation_constraint.defects:mass e 0.000000E+00 5.534461E-10 0.000000E+00 9.00000E+100
35 traj.cruise.collocation_constraint.defects:mass e 0.000000E+00 1.131252E-09 0.000000E+00 9.00000E+100
36 traj.cruise.collocation_constraint.defects:mass e 0.000000E+00 1.136475E-09 0.000000E+00 9.00000E+100
37 traj.cruise.collocation_constraint.defects:mass e 0.000000E+00 1.145704E-09 0.000000E+00 9.00000E+100
38 traj.cruise.collocation_constraint.defects:mass e 0.000000E+00 1.366185E-09 0.000000E+00 9.00000E+100
39 traj.cruise.collocation_constraint.defects:mass e 0.000000E+00 1.381414E-09 0.000000E+00 9.00000E+100
40 traj.cruise.collocation_constraint.defects:mass e 0.000000E+00 5.624325E-09 0.000000E+00 9.00000E+100
41 traj.cruise.collocation_constraint.defects:mass e 0.000000E+00 3.040196E-08 0.000000E+00 9.00000E+100
42 traj.cruise.collocation_constraint.defects:mass e 0.000000E+00 8.070184E-08 0.000000E+00 9.00000E+100
43 traj.cruise.collocation_constraint.defects:mass e 0.000000E+00 1.519352E-07 0.000000E+00 9.00000E+100
44 traj.cruise.collocation_constraint.defects:mass e 0.000000E+00 8.564826E-08 0.000000E+00 9.00000E+100
45 traj.cruise.collocation_constraint.defects:mass e 0.000000E+00 9.838856E-08 0.000000E+00 9.00000E+100
46 traj.cruise.collocation_constraint.defects:mass e 0.000000E+00 6.422332E-10 0.000000E+00 9.00000E+100
47 traj.cruise.collocation_constraint.defects:distance e 0.000000E+00 -1.188433E-18 0.000000E+00 9.00000E+100
48 traj.cruise.collocation_constraint.defects:distance e 0.000000E+00 1.697762E-19 0.000000E+00 9.00000E+100
49 traj.cruise.collocation_constraint.defects:distance e 0.000000E+00 -3.055971E-18 0.000000E+00 9.00000E+100
50 traj.cruise.collocation_constraint.defects:distance e 0.000000E+00 3.814043E-18 0.000000E+00 9.00000E+100
51 traj.cruise.collocation_constraint.defects:distance e 0.000000E+00 -3.467312E-19 0.000000E+00 9.00000E+100
52 traj.cruise.collocation_constraint.defects:distance e 0.000000E+00 7.628087E-18 0.000000E+00 9.00000E+100
53 traj.cruise.collocation_constraint.defects:distance e 0.000000E+00 -4.122291E-18 0.000000E+00 9.00000E+100
54 traj.cruise.collocation_constraint.defects:distance e 0.000000E+00 2.473375E-18 0.000000E+00 9.00000E+100
55 traj.cruise.collocation_constraint.defects:distance e 0.000000E+00 -4.122291E-19 0.000000E+00 9.00000E+100
56 traj.cruise.collocation_constraint.defects:distance e 0.000000E+00 -1.040194E-18 0.000000E+00 9.00000E+100
57 traj.cruise.collocation_constraint.defects:distance e 0.000000E+00 -1.386925E-18 0.000000E+00 9.00000E+100
58 traj.cruise.collocation_constraint.defects:distance e 0.000000E+00 -1.005521E-17 0.000000E+00 9.00000E+100
59 traj.cruise.collocation_constraint.defects:distance e 0.000000E+00 1.460075E-17 0.000000E+00 9.00000E+100
60 traj.cruise.collocation_constraint.defects:distance e 0.000000E+00 -3.735076E-18 0.000000E+00 9.00000E+100
61 traj.cruise.collocation_constraint.defects:distance e 0.000000E+00 1.375187E-17 0.000000E+00 9.00000E+100
62 traj.descent.collocation_constraint.defects:mass e 0.000000E+00 1.886688E-07 0.000000E+00 9.00000E+100
63 traj.descent.collocation_constraint.defects:mass e 0.000000E+00 1.818293E-07 0.000000E+00 9.00000E+100
64 traj.descent.collocation_constraint.defects:mass e 0.000000E+00 1.870963E-07 0.000000E+00 9.00000E+100
65 traj.descent.collocation_constraint.defects:mass e 0.000000E+00 3.122895E-07 0.000000E+00 9.00000E+100
66 traj.descent.collocation_constraint.defects:mass e 0.000000E+00 2.715872E-07 0.000000E+00 9.00000E+100
67 traj.descent.collocation_constraint.defects:mass e 0.000000E+00 2.408365E-07 0.000000E+00 9.00000E+100
68 traj.descent.collocation_constraint.defects:mass e 0.000000E+00 2.248759E-07 0.000000E+00 9.00000E+100
69 traj.descent.collocation_constraint.defects:mass e 0.000000E+00 1.835306E-07 0.000000E+00 9.00000E+100
70 traj.descent.collocation_constraint.defects:mass e 0.000000E+00 1.226950E-07 0.000000E+00 9.00000E+100
71 traj.descent.collocation_constraint.defects:mass e 0.000000E+00 1.120320E-07 0.000000E+00 9.00000E+100
72 traj.descent.collocation_constraint.defects:mass e 0.000000E+00 9.785530E-08 0.000000E+00 9.00000E+100
73 traj.descent.collocation_constraint.defects:mass e 0.000000E+00 8.679865E-08 0.000000E+00 9.00000E+100
74 traj.descent.collocation_constraint.defects:mass e 0.000000E+00 3.854721E-08 0.000000E+00 9.00000E+100
75 traj.descent.collocation_constraint.defects:mass e 0.000000E+00 3.417508E-08 0.000000E+00 9.00000E+100
76 traj.descent.collocation_constraint.defects:mass e 0.000000E+00 2.896123E-08 0.000000E+00 9.00000E+100
77 traj.descent.collocation_constraint.defects:distance e 0.000000E+00 1.735070E-09 0.000000E+00 9.00000E+100
78 traj.descent.collocation_constraint.defects:distance e 0.000000E+00 1.761032E-09 0.000000E+00 9.00000E+100
79 traj.descent.collocation_constraint.defects:distance e 0.000000E+00 1.799066E-09 0.000000E+00 9.00000E+100
80 traj.descent.collocation_constraint.defects:distance e 0.000000E+00 3.699944E-09 0.000000E+00 9.00000E+100
81 traj.descent.collocation_constraint.defects:distance e 0.000000E+00 3.828304E-09 0.000000E+00 9.00000E+100
82 traj.descent.collocation_constraint.defects:distance e 0.000000E+00 4.029728E-09 0.000000E+00 9.00000E+100
83 traj.descent.collocation_constraint.defects:distance e 0.000000E+00 4.874695E-09 0.000000E+00 9.00000E+100
84 traj.descent.collocation_constraint.defects:distance e 0.000000E+00 5.125172E-09 0.000000E+00 9.00000E+100
85 traj.descent.collocation_constraint.defects:distance e 0.000000E+00 5.535193E-09 0.000000E+00 9.00000E+100
86 traj.descent.collocation_constraint.defects:distance e 0.000000E+00 4.780654E-09 0.000000E+00 9.00000E+100
87 traj.descent.collocation_constraint.defects:distance e 0.000000E+00 5.047111E-09 0.000000E+00 9.00000E+100
88 traj.descent.collocation_constraint.defects:distance e 0.000000E+00 5.482400E-09 0.000000E+00 9.00000E+100
89 traj.descent.collocation_constraint.defects:distance e 0.000000E+00 2.761606E-09 0.000000E+00 9.00000E+100
90 traj.descent.collocation_constraint.defects:distance e 0.000000E+00 2.854676E-09 0.000000E+00 9.00000E+100
91 traj.descent.collocation_constraint.defects:distance e 0.000000E+00 2.995993E-09 0.000000E+00 9.00000E+100
92 traj.reserve_cruise.collocation_constraint.defects:mass e 0.000000E+00 6.828760E-11 0.000000E+00 9.00000E+100
93 traj.reserve_cruise.collocation_constraint.defects:mass e 0.000000E+00 6.814167E-11 0.000000E+00 9.00000E+100
94 traj.reserve_cruise.collocation_constraint.defects:mass e 0.000000E+00 6.797487E-11 0.000000E+00 9.00000E+100
95 traj.reserve_cruise.collocation_constraint.defects:mass e 0.000000E+00 1.387327E-10 0.000000E+00 9.00000E+100
96 traj.reserve_cruise.collocation_constraint.defects:mass e 0.000000E+00 1.384365E-10 0.000000E+00 9.00000E+100
97 traj.reserve_cruise.collocation_constraint.defects:mass e 0.000000E+00 1.379184E-10 0.000000E+00 9.00000E+100
98 traj.reserve_cruise.collocation_constraint.defects:mass e 0.000000E+00 1.635809E-10 0.000000E+00 9.00000E+100
99 traj.reserve_cruise.collocation_constraint.defects:mass e 0.000000E+00 1.629930E-10 0.000000E+00 9.00000E+100
100 traj.reserve_cruise.collocation_constraint.defects:mass e 0.000000E+00 1.627021E-10 0.000000E+00 9.00000E+100
101 traj.reserve_cruise.collocation_constraint.defects:mass e 0.000000E+00 1.368726E-10 0.000000E+00 9.00000E+100
102 traj.reserve_cruise.collocation_constraint.defects:mass e 0.000000E+00 1.370407E-10 0.000000E+00 9.00000E+100
103 traj.reserve_cruise.collocation_constraint.defects:mass e 0.000000E+00 1.375285E-10 0.000000E+00 9.00000E+100
104 traj.reserve_cruise.collocation_constraint.defects:mass e 0.000000E+00 2.847835E-12 0.000000E+00 9.00000E+100
105 traj.reserve_cruise.collocation_constraint.defects:mass e 0.000000E+00 2.858009E-12 0.000000E+00 9.00000E+100
106 traj.reserve_cruise.collocation_constraint.defects:mass e 0.000000E+00 2.878223E-12 0.000000E+00 9.00000E+100
107 traj.reserve_cruise.collocation_constraint.defects:distance e 0.000000E+00 -3.317397E-17 0.000000E+00 9.00000E+100
108 traj.reserve_cruise.collocation_constraint.defects:distance e 0.000000E+00 -2.445979E-17 0.000000E+00 9.00000E+100
109 traj.reserve_cruise.collocation_constraint.defects:distance e 0.000000E+00 -2.103422E-19 0.000000E+00 9.00000E+100
110 traj.reserve_cruise.collocation_constraint.defects:distance e 0.000000E+00 -4.817416E-17 0.000000E+00 9.00000E+100
111 traj.reserve_cruise.collocation_constraint.defects:distance e 0.000000E+00 -1.478977E-17 0.000000E+00 9.00000E+100
112 traj.reserve_cruise.collocation_constraint.defects:distance e 0.000000E+00 8.837044E-18 0.000000E+00 9.00000E+100
113 traj.reserve_cruise.collocation_constraint.defects:distance e 0.000000E+00 -3.020581E-17 0.000000E+00 9.00000E+100
114 traj.reserve_cruise.collocation_constraint.defects:distance e 0.000000E+00 -2.225308E-17 0.000000E+00 9.00000E+100
115 traj.reserve_cruise.collocation_constraint.defects:distance e 0.000000E+00 1.933464E-17 0.000000E+00 9.00000E+100
116 traj.reserve_cruise.collocation_constraint.defects:distance e 0.000000E+00 1.276462E-17 0.000000E+00 9.00000E+100
117 traj.reserve_cruise.collocation_constraint.defects:distance e 0.000000E+00 -1.258051E-17 0.000000E+00 9.00000E+100
118 traj.reserve_cruise.collocation_constraint.defects:distance e 0.000000E+00 1.699904E-17 0.000000E+00 9.00000E+100
119 traj.reserve_cruise.collocation_constraint.defects:distance e 0.000000E+00 2.004260E-17 0.000000E+00 9.00000E+100
120 traj.reserve_cruise.collocation_constraint.defects:distance e 0.000000E+00 -8.714176E-19 0.000000E+00 9.00000E+100
121 traj.reserve_cruise.collocation_constraint.defects:distance e 0.000000E+00 -1.875050E-17 0.000000E+00 9.00000E+100
122 traj.phases.climb->path_constraint->throttle i 0.000000E+00 5.654843E-01 1.000000E+00 9.00000E+100
123 traj.phases.climb->path_constraint->throttle i 0.000000E+00 5.231614E-01 1.000000E+00 9.00000E+100
124 traj.phases.climb->path_constraint->throttle i 0.000000E+00 4.867573E-01 1.000000E+00 9.00000E+100
125 traj.phases.climb->path_constraint->throttle i 0.000000E+00 4.788972E-01 1.000000E+00 9.00000E+100
126 traj.phases.climb->path_constraint->throttle i 0.000000E+00 4.788972E-01 1.000000E+00 9.00000E+100
127 traj.phases.climb->path_constraint->throttle i 0.000000E+00 4.603338E-01 1.000000E+00 9.00000E+100
128 traj.phases.climb->path_constraint->throttle i 0.000000E+00 4.706284E-01 1.000000E+00 9.00000E+100
129 traj.phases.climb->path_constraint->throttle i 0.000000E+00 4.788337E-01 1.000000E+00 9.00000E+100
130 traj.phases.climb->path_constraint->throttle i 0.000000E+00 4.788337E-01 1.000000E+00 9.00000E+100
131 traj.phases.climb->path_constraint->throttle i 0.000000E+00 5.172412E-01 1.000000E+00 9.00000E+100
132 traj.phases.climb->path_constraint->throttle i 0.000000E+00 5.924367E-01 1.000000E+00 9.00000E+100
133 traj.phases.climb->path_constraint->throttle i 0.000000E+00 6.216921E-01 1.000000E+00 9.00000E+100
134 traj.phases.climb->path_constraint->throttle i 0.000000E+00 6.216921E-01 1.000000E+00 9.00000E+100
135 traj.phases.climb->path_constraint->throttle i 0.000000E+00 6.823581E-01 1.000000E+00 9.00000E+100
136 traj.phases.climb->path_constraint->throttle i 0.000000E+00 7.841853E-01 1.000000E+00 9.00000E+100
137 traj.phases.climb->path_constraint->throttle i 0.000000E+00 8.199459E-01 1.000000E+00 9.00000E+100
138 traj.phases.climb->path_constraint->throttle i 0.000000E+00 8.199459E-01 1.000000E+00 9.00000E+100
139 traj.phases.climb->path_constraint->throttle i 0.000000E+00 8.643829E-01 1.000000E+00 9.00000E+100
140 traj.phases.climb->path_constraint->throttle i 0.000000E+00 9.245716E-01 1.000000E+00 9.00000E+100
141 traj.phases.climb->path_constraint->throttle i 0.000000E+00 9.444546E-01 1.000000E+00 9.00000E+100
142 traj.phases.cruise->initial_boundary_constraint->throttle i 0.000000E+00 7.419784E-01 1.000000E+00 9.00000E+100
143 traj.phases.cruise->final_boundary_constraint->throttle i 0.000000E+00 7.555855E-01 1.000000E+00 9.00000E+100
144 traj.phases.descent->path_constraint->throttle i 0.000000E+00 5.826584E-01 1.000000E+00 9.00000E+100
145 traj.phases.descent->path_constraint->throttle i 0.000000E+00 5.460572E-01 1.000000E+00 9.00000E+100
146 traj.phases.descent->path_constraint->throttle i 0.000000E+00 5.021060E-01 1.000000E+00 9.00000E+100
147 traj.phases.descent->path_constraint->throttle i 0.000000E+00 4.898912E-01 1.000000E+00 9.00000E+100
148 traj.phases.descent->path_constraint->throttle i 0.000000E+00 4.898912E-01 1.000000E+00 9.00000E+100
149 traj.phases.descent->path_constraint->throttle i 0.000000E+00 4.318375E-01 1.000000E+00 9.00000E+100
150 traj.phases.descent->path_constraint->throttle i 0.000000E+00 3.660179E-01 1.000000E+00 9.00000E+100
151 traj.phases.descent->path_constraint->throttle i 0.000000E+00 3.475731E-01 1.000000E+00 9.00000E+100
152 traj.phases.descent->path_constraint->throttle i 0.000000E+00 3.475731E-01 1.000000E+00 9.00000E+100
153 traj.phases.descent->path_constraint->throttle i 0.000000E+00 3.034017E-01 1.000000E+00 9.00000E+100
154 traj.phases.descent->path_constraint->throttle i 0.000000E+00 2.527695E-01 1.000000E+00 9.00000E+100
155 traj.phases.descent->path_constraint->throttle i 0.000000E+00 2.369947E-01 1.000000E+00 9.00000E+100
156 traj.phases.descent->path_constraint->throttle i 0.000000E+00 2.369947E-01 1.000000E+00 9.00000E+100
157 traj.phases.descent->path_constraint->throttle i 0.000000E+00 2.090236E-01 1.000000E+00 9.00000E+100
158 traj.phases.descent->path_constraint->throttle i 0.000000E+00 1.747371E-01 1.000000E+00 9.00000E+100
159 traj.phases.descent->path_constraint->throttle i 0.000000E+00 1.653359E-01 1.000000E+00 9.00000E+100
160 traj.phases.descent->path_constraint->throttle i 0.000000E+00 1.653359E-01 1.000000E+00 9.00000E+100
161 traj.phases.descent->path_constraint->throttle i 0.000000E+00 1.551377E-01 1.000000E+00 9.00000E+100
162 traj.phases.descent->path_constraint->throttle i 0.000000E+00 1.425361E-01 1.000000E+00 9.00000E+100
163 traj.phases.descent->path_constraint->throttle i 0.000000E+00 1.387885E-01 1.000000E+00 9.00000E+100
164 traj.phases.reserve_cruise->initial_boundary_constraint->throttle i 0.000000E+00 6.980069E-01 1.000000E+00 9.00000E+100
165 traj.phases.reserve_cruise->final_boundary_constraint->throttle i 0.000000E+00 7.460802E-01 1.000000E+00 9.00000E+100


minimal_print=True Optimization Problem -- Optimization using pyOpt_sparse ================================================================================ Objective Function: _objfunc
Solution:

Total Time:                    2.3533
   User Objective Time :       1.8091
   User Sensitivity Time :     0.5289
   Interface Time :            0.0109
   Opt Solver Time:            0.0044
Calls to Objective Function :       7
Calls to Sens Function :            6

Objectives
Index Name Value
0 mission:summary:fuel_burned 2.420137E+00

Variables (c - continuous, i - integer, d - discrete)
Index Name Type Lower Bound Value Upper Bound Status
1 traj.climb.t_duration_0 c 5.000000E-01 5.000000E-01 1.500000E+00 l
32 traj.cruise.t_duration_0 c 5.000000E-01 1.500000E+00 1.500000E+00 u

Constraints (i - inequality, e - equality)
Index Name Type Lower Value Upper Status Lagrange Multiplier (N/A)


Checklist

  • I have run flake8 and black to make sure the Python code adheres to PEP-8 and is consistently formatted
  • I have formatted the Fortran code with fprettify or C/C++ code with clang-format as applicable
  • I have run unit and regression tests which pass locally with my changes
  • I have added new tests that prove my fix is effective or that my feature works
  • I have added necessary documentation

crecine and others added 2 commits May 1, 2024 12:32
When minimal_print it True, only variables and constraints with a
non-empty status (for example a violated bound)
Copy link

codecov bot commented May 1, 2024

Codecov Report

Attention: Patch coverage is 71.42857% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 62.81%. Comparing base (e17f1ee) to head (d19b6ee).

Files Patch % Lines
pyoptsparse/pyOpt_optimization.py 71.42% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main     #395       +/-   ##
===========================================
- Coverage   74.10%   62.81%   -11.30%     
===========================================
  Files          22       22               
  Lines        3290     3294        +4     
===========================================
- Hits         2438     2069      -369     
- Misses        852     1225      +373     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@crecine crecine marked this pull request as ready for review May 1, 2024 21:07
@crecine crecine requested a review from a team as a code owner May 1, 2024 21:07
@crecine crecine requested review from lamkina and sseraj May 1, 2024 21:07
@ewu63
Copy link
Collaborator

ewu63 commented May 1, 2024

I'm okay with this change, however I would prefer a slightly different implementation (that does not introduce additional class attributes).

  1. have a summary_str() method which would be identical to the current __str__() method
  2. have __str__() simply call summary_str()
  3. add a new arg to summary_str() which implements this minimal_print feature, but default to False

That way, the logic for how you want to format this string can be separated from the rest of the class, and we can add/alter this logic in the future without changing the class itself.

@crecine
Copy link
Contributor Author

crecine commented May 1, 2024

Thanks for the feedback, I just noticed that I forgot to push the version that set the default to False (I had it as true while I was testing some things)
Your suggested implementation is fine with me, I'll make those changes

@crecine
Copy link
Contributor Author

crecine commented May 6, 2024

I'm confused by the change in coverage of these files: https://app.codecov.io/gh/mdolab/pyoptsparse/pull/395/indirect-changes
In particular, how def _getInforms() -> Dict[int, str]: (in pyoptsparse/pySNOPT/pySNOPT.py) can be untested even though informs = { and return informs are both covered

@sseraj
Copy link
Collaborator

sseraj commented May 7, 2024

SNOPT is not tested on PRs from forks because the code is not open source. The coverage on this PR does not reflect the actual coverage.

@crecine
Copy link
Contributor Author

crecine commented May 7, 2024

Thank you, so I don't need to worry about the failing test here, correct?

@crecine
Copy link
Contributor Author

crecine commented May 7, 2024

@sseraj and @lamkina could I get a final review on this? Is there anything else that needs to be done?

@sseraj
Copy link
Collaborator

sseraj commented May 7, 2024

Thank you, so I don't need to worry about the failing test here, correct?

Yes, that's right.

Is there anything else that needs to be done?

Can you update the PR description and testing sections to reflect the new changes? It would also be good if you could add examples of the output with and without the minimal printing.

@crecine
Copy link
Contributor Author

crecine commented May 7, 2024

Thank you for the feedback.
I've updated the PR purpose and testing sections

Copy link
Collaborator

@sseraj sseraj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One other comment from me

pyoptsparse/pyOpt_optimization.py Show resolved Hide resolved
@ewu63 ewu63 merged commit 0fd3dd7 into mdolab:main May 8, 2024
11 of 12 checks passed
@crecine crecine deleted the add_minimal_print branch May 8, 2024 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants