source: branches/devel/Bonmin/src/Interfaces/BonCurvatureEstimator.hpp @ 104

Last change on this file since 104 was 98, checked in by andreasw, 13 years ago

first version of BonChooseVariable? for Hessian-based strong branching; minor corrections

  • Property svn:eol-style set to native
  • Property svn:keywords set to "Author Date Id Revision"
File size: 4.7 KB
Line 
1// Copyright (C) 2006 International Business Machines and others.
2// All Rights Reserved.
3// This code is published under the Common Public License.
4//
5// $Id: BonCurvatureEstimator.hpp 98 2006-10-30 21:29:42Z pbonami $
6//
7// Author:   Andreas Waechter                 IBM    2006-10-11
8
9#ifndef __BONCURVATUREESTIMATOR_HPP__
10#define __BONCURVATUREESTIMATOR_HPP__
11
12#include "IpTNLP.hpp"
13#include "IpCompoundSymMatrix.hpp"
14#include "IpCompoundVector.hpp"
15#include "IpTSymLinearSolver.hpp"
16#include <vector>
17
18namespace Bonmin
19{
20  using namespace Ipopt;
21  /**
22   */
23  class CurvatureEstimator: public ReferencedObject
24  {
25  public:
26    /** @name Constructor/Destructor */
27    //@{
28    /** Constructor.  It is given the options list to extract options
29     *  specifying linear solver options. */
30    CurvatureEstimator(
31      SmartPtr<Journalist> jnlst,
32      SmartPtr<OptionsList> options,
33      SmartPtr<TNLP> tnlp);
34
35    /** Destructor */
36    virtual ~CurvatureEstimator();
37    //@}
38
39    /** Method for computing a direction projected_d related to the
40        given direction orig_d and the two-sided product of
41        projected_d with Hessian of Lagrangian.  The arrays x, y_c,
42        and y_d constain the primal and dual variables definiting the
43        Lagrangian Hessian. The vectors active_d and active_x contain
44        the indices of active inequality and bound constraints,
45        respectively.  A positive index number is interpreted to
46        belong to an upper bound, and a negative number to a lower
47        bound.  The return status is false if the computation was not
48        possible, and true otherwise. */
49
50    bool ComputeNullSpaceCurvature(
51      bool new_bounds,
52      int n,
53      const Number* x,
54      bool new_x,
55      const Number* z_L,
56      const Number* z_U,
57      int m,
58      const Number* lam,
59      bool new_mults,
60      const Number* orig_d,
61      Number* projected_d,
62      Number& gradLagTd,
63      Number& dTHLagd);
64
65  private:
66    /**@name Default Compiler Generated Methods
67     * (Hidden to avoid implicit creation/calling).
68     * These methods are not implemented and
69     * we do not want the compiler to implement
70     * them for us, so we declare them private
71     * and do not define them. This ensures that
72     * they will not be implicitly created/called. */
73    //@{
74    /** Default Constructor */
75    CurvatureEstimator();
76
77    /** Copy Constructor */
78    CurvatureEstimator(const CurvatureEstimator&);
79
80    /** Overloaded Equals Operator */
81    void operator=(const CurvatureEstimator&);
82    //@}
83
84    /** @name Items related to handling the linear solver object */
85    //@{
86    SmartPtr<Journalist> jnlst_;
87    SmartPtr<OptionsList> options_;
88    /** prefix to be used when parsion the options for the linear
89     *  solver */
90    std::string prefix_;
91    /** Strategy object for solving the projection matrix */
92    SmartPtr<TSymLinearSolver> tsymlinearsolver_;
93    //@}
94
95    /** @name Information about the tnlp */
96    //@{
97    SmartPtr<TNLP> tnlp_;
98    Index n_;
99    Number* grad_f_;
100    Index m_;
101    Index nnz_jac_;
102    Index* irows_jac_;
103    Index* jcols_jac_;
104    Number* jac_vals_;
105    Index nnz_hess_;
106    Index* irows_hess_;
107    Index* jcols_hess_;
108    Number* hess_vals_;
109    Number* x_l_;
110    Number* x_u_;
111    Number* g_l_;
112    Number* g_u_;
113    //@}
114
115    /** @name Information about activities */
116    //@{
117    /** Number of free x variables */
118    Index nx_free_;
119    /** Map for pointing from the original x space to the one without
120     *  fixed variables.  */
121    Index* x_free_map_;
122    /** Number of active constraints */
123    Index ng_fixed_;
124    /** Map for pointing from the original constraint space to the one
125     *  with only active constraints */
126    Index* g_fixed_map_;
127    //@}
128
129    /** Space for most recent computed least-square multipliers */
130    Number* lambda_;
131
132    /** @name Items for handling the projection system */
133    //@{
134    /** Compound Matrix space for storing the linear system for the
135     *  projection */
136    SmartPtr<CompoundSymMatrixSpace> comp_proj_matrix_space_;
137    /** Compound Matrix storing the current projection matrix */
138    SmartPtr<CompoundSymMatrix> comp_proj_matrix_;
139    /** Compound Vector space for storing right hand side and solution
140     *  for the projection system */
141    SmartPtr<CompoundVectorSpace> comp_vec_space_;
142    //@}
143
144    /** Storing the activities */
145    //@{
146    std::vector<int> active_x_;
147    std::vector<int> active_g_;
148    //@}
149
150    bool initialized_;
151
152    bool Initialize();
153
154    bool PrepareNewMatrixStructure(bool new_activities);
155
156    bool PrepareNewMatrixValues(
157      bool new_activities,
158      const Number* x,
159      bool new_x);
160
161    bool SolveSystem(const Number* rhs_x, const Number* rhs_g,
162                     Number* sol_x, Number* sol_g);
163
164    bool Compute_dTHLagd(
165      const Number* d, const Number* x, bool new_x, const Number* lambda,
166      bool new_lambda,  Number& dTHLagd);
167  };
168
169} // namespace Ipopt
170#endif
Note: See TracBrowser for help on using the repository browser.