source: trunk/Algorithm/IpIpoptAlg.hpp @ 2

Last change on this file since 2 was 2, checked in by andreasw, 15 years ago

Initial revision

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.0 KB
Line 
1// Copyright (C) 2004, International Business Machines and others.
2// All Rights Reserved.
3// This code is published under the Common Public License.
4//
5// $Id: IpIpoptAlg.hpp 2 2004-10-21 01:03:09Z andreasw $
6//
7// Authors:  Carl Laird, Andreas Waechter     IBM    2004-08-13
8
9#ifndef __IPIPOPTALG_HPP__
10#define __IPIPOPTALG_HPP__
11
12#include "IpUtils.hpp"
13#include "IpSmartPtr.hpp"
14#include "IpAlgStrategy.hpp"
15#include "IpPDSystemSolver.hpp"
16#include "IpLineSearch.hpp"
17#include "IpMuUpdate.hpp"
18#include "IpConvCheck.hpp"
19#include "IpOptionsList.hpp"
20#include "IpIterateInitializer.hpp"
21#include "IpIterationOutput.hpp"
22
23namespace Ipopt
24{
25
26  /** forward declarations */
27
28  /** The main ipopt algorithm class.
29   *  Main Ipopt algorithm class, contains the main optimize method,
30   *  handles the execution of the optimization.
31   *  The constructor initializes the data structures through the nlp,
32   *  and the Optimize method then assumes that everything is
33   *  initialized and ready to go.
34   *  After an optimization is complete, the user can access the
35   *  solution through the passed in ip_data structure.
36   *  Multiple calls to the Optimize method are allowed as long as the
37   *  structure of the problem remains the same (i.e. starting point
38   *  or nlp parameter changes only).
39   */
40  class IpoptAlgorithm : public AlgorithmStrategyObject
41  {
42  public:
43    /**@name Enumerations */
44    //@{
45    /** enum for the return from the optimize algorithm
46     *  (obviously we need to add more) */
47    enum SolverReturn {
48      SUCCESS,
49      MAXITER_EXCEEDED,
50      FAILED
51    };
52    //@}
53
54    /**@name Constructors/Destructors */
55    //@{
56    /** Constructor. (The IpoptAlgorithm uses smart pointers for these
57     *  passed-in pieces to make sure that a user of IpoptAlgoroithm
58     *  cannot pass in an object created on the stack!)
59     */
60    IpoptAlgorithm(const SmartPtr<PDSystemSolver>& pd_solver,
61                   const SmartPtr<LineSearch>& line_search,
62                   const SmartPtr<MuUpdate>& mu_update,
63                   const SmartPtr<ConvergenceCheck>& conv_check,
64                   const SmartPtr<IterateInitializer>& iterate_initializer,
65                   const SmartPtr<IterationOutput>& iter_output);
66
67    /** Default destructor */
68    virtual ~IpoptAlgorithm();
69    //@}
70
71
72    /** overloaded from AlgorithmStrategyObject */
73    virtual bool InitializeImpl(const OptionsList& options,
74                                const std::string& prefix);
75
76    /** Main solve method. */
77    SolverReturn Optimize();
78
79  private:
80    /**@name Default Compiler Generated Methods
81     * (Hidden to avoid implicit creation/calling).
82     * These methods are not implemented and
83     * we do not want the compiler to implement
84     * them for us, so we declare them private
85     * and do not define them. This ensures that
86     * they will not be implicitly created/called. */
87    //@{
88    /** Default Constructor */
89    IpoptAlgorithm();
90
91    /** Copy Constructor */
92    IpoptAlgorithm(const IpoptAlgorithm&);
93
94    /** Overloaded Equals Operator */
95    void operator=(const IpoptAlgorithm&);
96    //@}
97
98    /** @name Strategy objects */
99    //@{
100    SmartPtr<PDSystemSolver> pd_solver_;
101    SmartPtr<LineSearch> line_search_;
102    SmartPtr<MuUpdate> mu_update_;
103    SmartPtr<ConvergenceCheck> conv_check_;
104    SmartPtr<IterateInitializer> iterate_initializer_;
105    SmartPtr<IterationOutput> iter_output_;
106    //@}
107
108    /** @name Main steps of the algorthim */
109    //@{
110    /** Method for updating the current Hessian.  This can either just
111     *  evaluate the exact Hessian (based on the current iterate), or
112     *  perform a quasi-Newton update.
113     */
114    void ActualizeHessian();
115
116    /** Method to update the barrier parameter
117     * ( this may later be made a strategy object
118     *   and passed in ) */
119    void UpdateBarrierParameter();
120
121    /** Method to setup the call to the PDSystemSolver */
122    void ComputeSearchDirection();
123
124    /** Method computing the new iterate (usually vialine search).
125     *  The acceptable point is the one in trial after return.
126     */
127    void ComputeAcceptableTrialPoint();
128
129    /** Method for accepting the trial point as the new iteration,
130     *  possibly after adjusting the variable bounds in the NLP. */
131    void AcceptTrialPoint();
132
133    /** Do all the output for one iteration */
134    void OutputIteration();
135
136    /** Sets up initial values for the iterates,
137     * Corrects the initial values for x and s (force in bounds)
138     */
139    void InitializeIterates();
140
141    /** Print the problem size statistics */
142    void PrintProblemStatistics();
143    //@}
144
145    /** @name internal flags */
146    //@{
147    /** Flag indicating if the statistic should not be printed */
148    bool skip_print_problem_stats_;
149    //@}
150
151    /** @name auxilliary functions */
152    //@{
153    void calc_number_of_bounds(
154      const Vector& x,
155      const Vector& x_L,
156      const Vector& x_U,
157      const Matrix& Px_L,
158      const Matrix& Px_U,
159      Index& n_tot,
160      Index& n_only_lower,
161      Index& n_both,
162      Index& n_only_upper);
163    //@}
164  };
165
166} // namespace Ipopt
167
168#endif
Note: See TracBrowser for help on using the repository browser.