This file is indexed.

/usr/include/trilinos/MoochoPack_MoochoThyraSolver.hpp is in libtrilinos-dev 10.4.0.dfsg-1ubuntu2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
// @HEADER
// ***********************************************************************
// 
// Moocho: Multi-functional Object-Oriented arCHitecture for Optimization
//                  Copyright (2003) Sandia Corporation
// 
// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
// license for use of this work by or on behalf of the U.S. Government.
// 
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//  
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
//  
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA
// Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov) 
// 
// ***********************************************************************
// @HEADER

#ifndef MOOCHOPACK_MOOCHO_THYRA_SOLVER_HPP
#define MOOCHOPACK_MOOCHO_THYRA_SOLVER_HPP

#include "MoochoPack_MoochoSolver.hpp"
#include "Thyra_ModelEvaluator.hpp"
#include "Thyra_DirectionalFiniteDiffCalculator.hpp"
#include "Thyra_DefaultNominalBoundsOverrideModelEvaluator.hpp"
#include "Thyra_DefaultFinalPointCaptureModelEvaluator.hpp"
#include "Thyra_MultiVectorFileIOBase.hpp"
#include "Thyra_ParameterDrivenMultiVectorInput.hpp"
#include "Teuchos_StandardMemberCompositionMacros.hpp"

namespace MoochoPack {

/** \brief . */
using Teuchos::RCP;

/** \brief MOOCHO NLP Solver class for models represented through
 * <tt>Thyra::ModelEvaluator</tt>.
 *
 * The parameters this class accepts are shown below in different format:
 * <ul>
 * <li> \ref HumanReadableWithDocumentation "Human readable format (with documentation) for valid parameters accepted by this class"
 * <li> \ref HumanReadableWithoutDocumentation "Human readable format (without documentation) for valid parameters accepted by this class"
 * <li> \ref XmlFormat "XML format for valid parameters accepted by this class"
 * </ul>
 *
 * <b>\anchor HumanReadableWithDocumentation Human readable format (with documentation) for valid parameters accepted by this class</b>
 *
 * \verbinclude NLPThyraEpetraAdvDiffReactOpt.params.readabledoc.out
 *
 * <b>\anchor HumanReadableWithoutDocumentation Human readable format (without documentation) for valid parameters accepted by this class</b>
 *
 * \verbinclude NLPThyraEpetraAdvDiffReactOpt.params.readable.out
 *
 * <b>\anchor XmlFormat XML format for valid parameters accepted by this class</b>
 *
 * \verbinclude NLPThyraEpetraAdvDiffReactOpt.params.xml.out
 *
 * ToDo: Finish documetation!
 */
class MoochoThyraSolver
  : virtual public Teuchos::ParameterListAcceptor
{
public:

  /** \name Public types */
  //@{

  /** \brief . */
  enum ESolveMode {
    SOLVE_MODE_FORWARD    ///< Do a forward solve for the states only.
    ,SOLVE_MODE_OPTIMIZE  ///< Solve an optimization problem for states and parameters.
  };

  //@}

  /** \name Constructors/initialization. */
  //@{

  /** \brief Construct with default settings.
   *
   * <b>Warning!</b> Do not change the defaults by passing then into this
   * constructor.  Instead, use the member functions to set them after
   * <tt>*this</tt> is constructed.  This will help to avoid problems with
   * updates to the ordering of the arguments.
   */
  MoochoThyraSolver(
    const std::string    &paramsXmlFileName                = ""
    ,const std::string   &extraParamsXmlString             = ""
    ,const std::string   &paramsUsedXmlOutFileName         = ""
    ,const std::string   &paramsXmlFileNameOption          = "moocho-thyra-params-file"
    ,const std::string   &extraParamsXmlStringOption       = "extra-moocho-thyra-params"
    ,const std::string   &paramsUsedXmlOutFileNameOption   = "moocho-thyra-params-used-file"
    );
  
  /** \brief . */
  ~MoochoThyraSolver();
  
  /** \brief The name an XML file that will be read to get XML parameters (if
   * not "").
   */
  STANDARD_MEMBER_COMPOSITION_MEMBERS(std::string,paramsXmlFileName);
    
  /** \brief An XML string that will be used to update the parameters (if not
   * "").
   */
  STANDARD_MEMBER_COMPOSITION_MEMBERS(std::string,extraParamsXmlString);

  /** \brief The name of an XML file that will be written (if not "") for the
   * parameters actually used.
   */
  STANDARD_MEMBER_COMPOSITION_MEMBERS(std::string,paramsUsedXmlOutFileName);

  /** \brief The name of the option that will be added the the commandline
   * processor that will set <tt>paramsXmlFileName()</tt> .
   */
  STANDARD_MEMBER_COMPOSITION_MEMBERS(std::string,paramsXmlFileNameOption);

  /** \brief The name of the option that will be added the the commandline
   * processor that will set <tt>extraParamsXmlString()</tt> .
   */
  STANDARD_MEMBER_COMPOSITION_MEMBERS(std::string,extraParamsXmlStringOption);

  /** \brief The name of the option that will be added the the commandline
   * processor that will set <tt>paramsUsedXmlOutFileName()</tt> .
   */
  STANDARD_MEMBER_COMPOSITION_MEMBERS(std::string,paramsUsedXmlOutFileNameOption);

  /** \brief MultiVectorFileIOBase object used to read and write state vectors
   * to and from files.
   *
   * The default implementation used is
   * <tt>Thyra::DefaultSpmdMultiVectorFileIO</tt>.  See
   * <tt>Thyra::DefaultSpmdMultiVectorFileIO::DefaultSpmdMultiVectorFileIO()</tt>
   * for the default conditions of such an object.
   */
  STANDARD_NONCONST_COMPOSITION_MEMBERS( Thyra::MultiVectorFileIOBase<value_type>, stateVectorIO );

  /** \brief MultiVectorFileIOBase object used to read and write parameter vectors
   * to and from files.
   *
   * The default implementation used is
   * <tt>Thyra::DefaultSpmdMultiVectorFileIO</tt>.  See
   * <tt>Thyra::DefaultSpmdMultiVectorFileIO::DefaultSpmdMultiVectorFileIO()</tt>
   * for the default conditions.
   *
   * ToDo: You may need to change this to set different the
   * MultiVectorFileIOBase objects for each parameter subvector for each index
   * l=0...Np-1!
   */
  STANDARD_NONCONST_COMPOSITION_MEMBERS( Thyra::MultiVectorFileIOBase<value_type>, parameterVectorIO );
  
  /** \brief Sets up the commandline for reading in the parameter list for
   * this object (minus the options for MoochoSolver).
   *
   * The commandline arguments <tt>--moocho-thyra-params-file</tt> and
   * <tt>--moocho-thyra-extra-params</tt> will be added to <tt>*clp</tt> that
   * will allow the parameters to be read from a file or from the commandline
   * itself in XML format.
   */
  void setupCLP(
    Teuchos::CommandLineProcessor *clp
    );

  /** \brief Force the parameters to be read from a file or from the
   * commandline arguments.
   *
   * If no parameter XML file name or parameters XML string was specified on
   * the commandline, then this function will exist immediately and do
   * nothing.
   *
   * If an XML file name or XML parameter list string was specified on the
   * commandline.
   *
   * If <tt>this->getParameterList().get()==0</tt> before this function is
   * called then 
   * 
   * <b>Postconditions:</b><ul>
   * <li>If the parameters were read from a file or a commandline argument string
   *     then <tt>this->getParameterList()</tt> will be non-NULL and will contain
   *     the updated parameters.
   * 
   */
  void readParameters( std::ostream *out );

  //@}

  /** @name Overridden from ParameterListAcceptor */
  //@{

  /** \brief . */
  void setParameterList(RCP<Teuchos::ParameterList> const& paramList);
  /** \brief . */
  RCP<Teuchos::ParameterList> getNonconstParameterList();
  /** \brief . */
  RCP<Teuchos::ParameterList> unsetParameterList();
  /** \brief . */
  RCP<const Teuchos::ParameterList> getParameterList() const;
  /** \brief . */
  RCP<const Teuchos::ParameterList> getValidParameters() const;

  //@}

  /** \name Misc Access/Setup */
  //@

  /** \brief . */
  void setSolveMode( const ESolveMode solveMode );

  /** \brief . */
  ESolveMode getSolveMode() const;
  
  /** \brief . */
  MoochoSolver& getSolver();
  
  /** \brief . */
  const MoochoSolver& getSolver() const;

  //@}

  /** \name Model specification, setup, solve, and solution extraction. */
  //@{
  
  /** \brief . */
  void setModel(
    const RCP<Thyra::ModelEvaluator<value_type> > &origModel,
    const int p_idx  = 0,
    const int g_idx  = 0
    );
  
  /** \brief . */
  const RCP<Thyra::ModelEvaluator<value_type> >
  getOrigModel() const;
  
  /** \brief . */
  const RCP<Thyra::ModelEvaluator<value_type> >
  getOuterModel() const;
    
  /** \brief . */
  void readInitialGuess(
    std::ostream *out = NULL
    );
    
  /** \brief . */
  void setInitialGuess(
    const RCP<const Thyra::ModelEvaluatorBase::InArgs<value_type> > &initialGuess
    );
    
  /** \brief . */
  void setInitialGuess(
    const Thyra::ModelEvaluatorBase::InArgs<value_type> &initialGuess
    );
  
  /** \brief . */
  MoochoSolver::ESolutionStatus	solve();
    
  /** \brief Return the final point. */
  const Thyra::ModelEvaluatorBase::InArgs<value_type>& getFinalPoint() const;
  
  /** \brief Write the final solution to a file specified by the parameter
   * list option ???.
   */
  void writeFinalSolution(
    std::ostream *out = NULL
    ) const;

  /** \brief Write the parameters list for a this object to a file after the
   * parameters are read in order to show defaults and create a new list for
   * input the next time.
   *
   * If <tt>outputXmlFileName!=""</tt> then the parameter list with be written
   * to the file <tt>outputXmlFileName</tt> in XML format. If
   * <tt>outputXmlFileName==""</tt>, but
   * <tt>this->paramsUsedXmlOutFileNameOption()!=""</tt> then the parameter
   * list will be written to the file
   * <tt>this->paramsUsedXmlOutFileNameOption()</tt>.  If both
   * <tt>outputXmlFileName==""</tt> and
   * <tt>this->paramsUsedXmlOutFileNameOption()==""</tt> then no file is
   * written.
   */
  void writeParamsFile(
    const std::string &outputXmlFileName  = "" 
    ) const;

  //@}

public:

  // I am just making these public so that I can access them from
  // the anonymous namespace in the *.cpp file
  enum ENLPType { NLP_TYPE_FIRST_ORDER, NLP_TYPE_DIRECT };

private:

  typedef value_type Scalar;

  MoochoSolver solver_;
 
  RCP<Thyra::ModelEvaluator<value_type> > origModel_;
  int p_idx_;
  int g_idx_;

  mutable Thyra::ParameterDrivenMultiVectorInput<value_type> x_reader_;
  mutable Thyra::ParameterDrivenMultiVectorInput<value_type> p_reader_;
  mutable Thyra::ParameterDrivenMultiVectorInput<value_type> p_l_reader_;
  mutable Thyra::ParameterDrivenMultiVectorInput<value_type> p_u_reader_;

  RCP<Teuchos::ParameterList> paramList_;
 
  RCP<Thyra::DefaultNominalBoundsOverrideModelEvaluator<value_type> >
  nominalModel_;
 
  RCP<Thyra::DefaultFinalPointCaptureModelEvaluator<value_type> >
  finalPointModel_;

  RCP<Thyra::ModelEvaluator<value_type> > outerModel_;

  ESolveMode solveMode_;
  ENLPType nlpType_;
  bool nonlinearlyElimiateStates_;
  bool use_finite_diff_for_obj_;
  bool use_finite_diff_for_con_;
  double fwd_newton_tol_;
  int fwd_newton_max_iters_;
  bool fwd_newton_dampening_;
  int fwd_newton_max_ls_iters_;
  bool useInvObjFunc_;
  bool useParameterLumping_;
  std::string outputFileTag_;
  bool showModelEvaluatorTrace_;
  std::string stateSoluFileBase_;
  std::string paramSoluFileBase_;

};

} // namespace MoochoPack

#endif	// MOOCHOPACK_MOOCHO_THYRA_SOLVER_HPP