fmincon Optimizer

Feature Spec and Test Procedures

Lead:  Steve C

Developer:  Darrel

STE/GUI Tester:  Tom

 

Explore

Failing Tests

Other Findings

Requirements

Interface/Functional Spec

Overview

Description

Fields

GUI

Remarks

Examples

Test Procedures

Assumptions

Existing Tests

Recommended Additional Tests

Appendix A - Miscellaneous Data

NOTES

 

Explore

 

Known bugs/issues committed in JIRA against this feature:

 

 

JIRA ID

Summary

Comment

GMT-3114

 

Show cost function value in message window during optimization

Looks like message window shows

(1) objective function

(2)  Deviation from meeting constraints.  Is this an absolute value?  Darrel added text to the message to make it clear that it is a Delta. 

 

Closed 11/21/12

GMT-1993

FminconOptimizer DiffMinChange, DiffMaxChange validation incomplete

Closed 11/25/12

GMT-2061

Choose a File dialog cann't show all file

Fix version is “Someday.”  No further action required. 

GMT-2828

build suggestion for libMatlabInterface and libFminconOptimizer

Listed as an improvement with no fix version.  No further action required. 

GMT-2917

Error messages for fmincon optimizer fields vague

P2 bug with 2013A fix version.  As of 11/25/12, assigned to SPH who will fix error message.  

GMT-2918

Numbers for fmincon have single quotes around them in show script

The actual script has single quotes around them as well.  This includes numbers - I am surprised GMAT allows this without generating an error.  

 

As of 11/25/12, issue still open (2013A fix version, assigned to SPH. 

GMT-3116

Fmincon does not work within a For loop

Regression test, Vary_optimizer_fmincon_InitialGuess_ForLoopVariable.script, still fails as of 11/24/12 run. 

 

As of 11/25/12, bug still open (R2013A) and assigned to Linda Jun. 

GMT-3214

Message window, for Fmincon use, does not display converged status

Issue closed 11/25/12.

 

Note that GMT-2641 is the fmincon Optimizer QA task (not a bug).  

 

Failing Tests

Run Identification: [Gmat-buildtest] Test results: 2012-10-25 (Win7-64/GMAT-32/M2010a/VS)

 

These tests run to completion but fail:

 

                          fmincon_Report (script) [no warn or err]

Comments/Actions Taken:

      I don’t know why the GMAT test system says it ran to completion.  When I run locally, I get the following error message:

                            ***** file: C:\GMAT\JAZZ TEST DOWNLOAD\script\input\Resources\FRR-20_fminconOptimizer\scripts\fmincon_ShowProgress.script

1: **** ERROR **** Solver subsystem exception: The value entered for the optimizer tolerance on SQPfmincon is not an allowed value. The allowed value is: [Real > 0.0]. in line:

" 20: GMAT SQPfmincon.Tolerance = 0;"

      Tolerance should be > 0.  But, in any case, Tolerance is a” hidden” field and we should not be setting it anyway - See GMT-3262,   Tolerance and SourceType (another hidden field) were commented out but still get run to completion error. 

      In this case, the test system uses the  Matlab, REGEXP Match regular expression., command to analyze the message window output.

      Truth file

/Iteration.*\d+/

/Variable\s*Values.*\d+\s*\d+/

/Equality\s*Constraint\s*Values.*\d+/

/Objective\s*function\s*value.*\d+/

      There were several problem with the truth file.  For example,  the truth file was looking for the text, ‘Variable Values’ but the actual GMAT output only had the text,  ‘Variables.’  Joel fixed this problem and others with the truth file.  Test now passes.  

 

 

                          fmincon_ShowProgress (script) [#2 failed]

Comments/Actions Taken:

      This test also uses matlab regexp command to analyze the message window output.  Truth file

/Iteration.*\d+/

/Variable\s*Values.*\d+\s*\d+/

/Equality\s*Constraint\s*Values.*\d+/

/Objective\s*function\s*value.*\d+/

      This test had same problem as the previous test.  Joel fixed it. 

      Update 11/25/12.  Had to change “Constraint Values” to “Constraint Deltas” in the truth files. 

 

 

 

Note that the same two tests failed locally using the 10/26/12 build.  Joel fixed truth files for both tests on 11/15/12. 

 

Other Findings

 

1         Submitted bug, GMT-3214 , Message window, for Fmincon use, does n ot display converged status.  Issue closed 11/25/12.

2         It is possible for an Optimization sequence to be defined and run without error and containing neither a NonlinearContraint command nor a Minimize command.  Should this be allowed?  Submitted bug, GMT-3216 , Optimization sequence Contents.

Create FminconOptimizer SQP1;

SQP1.MaximumIterations = 50;

Create Variable x y Circle

BeginMissionSequence;

Optimize SQP1;

   Vary SQP1(x = 1);

   Vary SQP1(y = 1);

   Circle = x*x + y*y

   %NonlinearConstraint SQP1(Circle = 1);               

  %Minimize SQP1(y);

EndOptimize;

     Resolution:  Issue closed 11/21/12.

3         Submitted bug, GMT-3225 , GMAT Stop button doesnt work, in some situations, when using fmincon

      Resolution:  As of 11/25/12, issue still open, assigned to DJC.  

4         Submitted bug, GMT-3261 , Problem setting "Max. Iterations" when using fmincon

      Resolution:  Issue closed 11/25/12.

5         Submitted bug, GMT-3262, User wrongly has access to certain FminconOptimizer fields .  Resolution:  P2 bug, no further action required. 

6         Submitted bug, GMT-3267 , Fmincon ShowProgress field does not work

      Resolution:  Closed 11/25/12.

7         Submitted bug, GMT-3268 - Fmincon report appears to repeat initial data

      Resolution:  As of 11/25/12, bug still open, assigned to DJC. 

8         Submitted bug, GMT-3269 , Optimizers append data to file

      Resolution:  As of 11/25/12, bug still open, assigned to DJC. 

9         Submitted bug, GMT-3274 , Fmincon output data Requirements

      Resolution:  Still open as of 11/24/12, assigned to DJC.  

Requirements

These are working requirements.  They are included here for review and convenience purposes.  After review, requirements are maintained in the formal SRS located at SourceForge in /trunk/doc/SystemDocs/Requirements. 

 

ID

Requirement

FRR-20.1.0

The system shall allow the user to create and configure an fmincon optimizer with the following properties:

FRR-20.1.1

1)                 Maximum iterations

FRR-20.1.2

2)                 Maximum function evaluations

FRR-20.1.3

3)                 Tolerance on the constraint functions

FRR-20.1.4

4)                 Tolerance on the cost function

FRR-20.1.5

5)                 Tolerance on the optimization state vector

FRR-20.1.6

6)                 Maximum perturbation for finite differencing of derivatives

FRR-20.1.7

7)                 Minimum perturbation for finite differencing of derivatives

FRR-20.2.0

The system shall optionally show progress of an fmincon optimizer in the message window that includes all of the following parameters:

FRR-20.2.1

1)                 Current value of control variables

FRR-20.2.2

2)                 Achieved and desired values of the constraints

FRR-20.2.3

3)                 Cost function value

FRR-20.2.4

4)                 Iteration number

FRR-20.3

The system shall optionally create a report file containing information on each iteration of the fmincon optimizer containing all data listed in FRR-20.2.

 

 

Interface/Functional Spec

Overview

The Sequential Quadratic Processor (SQP) optimizer, fmincon, used to optimize mission parameters. 

Description

 

fmincon is a Nonlinear Programming solver provided in MATLAB's Optimization Toolbox. fmincon performs nonlinear constrained optimization and supports linear and nonlinear constraints.  To use this solver, you must configure the solver options including convergence criteria, maximum iterations, and how the gradients will be calculated. In the mission sequence, you implement an optimizer such as fmincon by using an Optimize/EndOptimize sequence. Within this sequence, you define optimization variables by using the Vary command, and define cost and constraints by using the Minimize and NonlinearConstraint commands respectively.

Fields

See the User Interface Spec spreadsheet for reference information for fields.  

 

Notes

 

1          

GUI

The FminconOptimizer dialog box allows you to specify properties of a FminconOptimizer such as maximum iterations, maximum function evaluations, control variable termination tolerance, constraint tolerance, cost function tolerance, finite difference algorithm parameters, and choice of reporting options.

 

To create a FminconOptimizer resource, navigate to the Resources tree, expand the Solvers folder, highlight and then right-click on the Optimizers sub-folder, point to Add and then select SQP (fmincon) .  This will create a new FminconOptimizer resource, SQP1 .  Double-click on SQP1 to bring up the FminconOptimizer dialog box shown below. 

 

Figure 1 FminconOptimizer dialog box

 

Remarks

 

fmincon Optimizer Availability

 

This optimizer is only available if you have access to both MATLAB and MATLAB's Optimization toolbox.  GMAT contains an interface to the fmincon optimizer and it will appear to you that fmincon is a built in optimizer in GMAT. Field names for this object have been copied from those used in MATLAB’S optimset function for consistency with MATLAB in contrast with other solvers in GMAT.

 

Object and Command Interactions

 

The FminconOptimizer object can only be used in the context of optimization-type commands. Please see the documentation for Optimize , Vary , NonlinearConstraint, and Minimize for more information and worked examples.

 

Examples

 

Create a FminconOptimizer resource named SQP1. 

Create FminconOptimizer SQP1;

GMAT SQP1.ShowProgress = true;

GMAT SQP1.ReportStyle = Normal;

GMAT SQP1.ReportFile = 'FminconOptimizerSQP1.data';

GMAT SQP1.MaximumIterations = 25;

GMAT SQP1.DiffMaxChange = '0.1000';

GMAT SQP1.DiffMinChange = '1.0000e-08';

GMAT SQP1.MaxFunEvals = '1000';

GMAT SQP1.TolX = '1.0000e-04';

GMAT SQP1.TolFun = '1.0000e-04';

GMAT SQP1.TolCon = '1.0000e-04';

 

For an example of how a FminconOptimizer resource can be used within an optimize sequence, see the Optimize Command examples. 

Test Procedures

Assumptions

None.

Existing Tests

There are 14 files of the form *.tc. 

 

Test Name

Description

fmincon_ConstraintTolerance

 

fmincon_Validation_DuplicateNames

 

fmincon_Validation_ReportFile

 

fmincon_Report

 

fmincon_Validation_MaxFuncEvals

 

fmincon_Validation_ShowProgress

 

fmincon_ShowProgress                             

 

fmincon_Validation_MaxIterations                 

 

fmincon_Validation_StateTolerance                

 

fmincon_Validation_ConstraintTolerance

 

fmincon_Validation_MaxPerturb                    

 

fmincon_Validation_UndefinedField                

 

fmincon_Validation_CostTolerance                

 

fmincon_Validation_MinPerturb

 

 

 

 

 

Recommended Additional Tests

1          

             

 

Unique Validation

Test Name

Summary

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Appendix A - Miscellaneous Data

Note that this data is primarily for the internal use of the feature lead.  It does not need to be reviewed by the SDE and STE.  

NOTES

 

1