English Français

Documentation / Developer's manual

Available modules

Calibration,  DataServer,  Launcher,  MetaModelOptim,  Modeler,  Optimizer,  ReLauncher,  Reliability,  ReOptimizer,  Sampler,  Sensitivity,  UncertModeler,  XmlProblem,   Uranie / Optimizer: TOptimizerOpt.h Source File
Uranie / Optimizer  v4.10.0
/* @license-end */
TOptimizerOpt.h
Go to the documentation of this file.
1 // Copyright (C) 2013-2024 CEA/DES
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Lesser General Public License as published
6 // by the Free Software Foundation, either version 3 of the License, or any
7 // later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Lesser General Public License for more details.
13 //
14 // You should have received a copy of the GNU Lesser General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
18 // $Id$
19 // $Author$
20 // $Date$
21 // $Revision$
22 // $State$
24 
41 #ifndef TOPTIMIZEROPT_H
42 #define TOPTIMIZEROPT_H
43 
44 #include <iostream>
45 
46 //ROOT
47 #include "Rtypes.h"
48 #include "TMethodCall.h"
49 
50 // Uranie
51 #include "Optimizer.h"
52 #include "TDataServer.h"
53 // Newmat
54 
55 #include "newmat.h"
56 #include "opt++.h"
57 //using namespace OPTPP;
58 #ifdef HAVE_NAMESPACES
59 using namespace NEWMAT;
60 #endif
61 
62 // Opt++
63 //extern typedef void(* OPTPP::USERFCN2)(int, int, const NEWMAT::ColumnVector &, real &, NEWMAT::ColumnVector &, NEWMAT::SymmetricMatrix &, int &);
64 
65 namespace URANIE
66 {
67 namespace Optimizer
68 {
69 class TOptimizerOpt: public TNamed
70 {
71 public:
73  {
74  kFunction, kSumOfSquare
75  };
76 private:
77  Bool_t _blog;
78  URANIE::DataServer::TDataServer *_tds;
79 
80 //fga 2015/01/12 void * _function; //! rem : Do not process by rootcint
81 //fga 2015/01/12 OPTPP::USERFCN2 _MyOptFunction; //! rem : Do not process by rootcint
82 //fga 2015/01/12 OPTPP::OPTPPINITFCN _MyOptInitFunction; //! rem : Do not process by rootcint
83 
84  TString _sLibrary;
85  TString _sFunctionName;
87 
88  Int_t _niter;
89 
90  // OPTPP::USERFCN0 *_theFunction ;
92  TMethodCall *_fMethodCall;
93  void (*_fMethod)(Double_t *gin, Double_t *f);
94 // void (*_fMethodOpt)(int mode, int n, const NEWMAT::ColumnVector& x, double& fx, NEWMAT::ColumnVector& g, NEWMAT::SymmetricMatrix& H, int &result);
95  void (*_fMethodOpt)(int n, const ColumnVector& x, double& fx, int& result);
96 
97  TString _sname;
98 public:
99  //---------------------------------------------
103  TOptimizerOpt();
106 // TOptimizerOpt (URANIE::DataServer::TDataServer *tds, void *function = NULL);
107  TOptimizerOpt(URANIE::DataServer::TDataServer *tds, const char *functionname);
108  TOptimizerOpt(URANIE::DataServer::TDataServer *tds, TString slibrary,
109  TString sfunction, TString sinit = "");
111  virtual ~TOptimizerOpt();
113 
114  //---------------------------------------------
118  virtual void init(Option_t *option = "");
121  // virtual void optimize(void *fj, Option_t *option ="");
122  virtual void optimize(Option_t *option = "");
124  virtual void terminate(Option_t *option = "");
126  virtual void clean(Option_t *option = "");
127 
128  void run(Option_t *option = "");
129 // void run();
130 
131  TMethodCall *getMethodCall() const
132  {
133  return _fMethodCall;
134  }
136  {
137  _niter++;
138  }
139  Int_t getIteration()
140  {
141  return _niter;
142  }
144 
145  //---------------------------------------------
149  void setLog()
150  {
151  _blog = kTRUE;
152  }
153  void unsetLog()
154  {
155  _blog = kFALSE;
156  }
157  void changeLog()
158  {
159  _blog = _blog ? kFALSE : kTRUE;
160  }
161  Bool_t getLog()
162  {
163  return _blog;
164  }
165  virtual void printLog(Option_t *option = "");
167 
168  ClassDef(URANIE::Optimizer::TOptimizerOpt, ID_OPTIMIZER)
169  //Classe de
170 };
171 
172 } // Fin du namespace Optimizer
173 } // Fin du namespace URANIE
174 
176 #endif
Rosenbrock&#39;s function (n=2) with first and second order derivatives.
Definition: TBestEstimate.h:57
R__EXTERN URANIE::Optimizer::TOptimizerOpt * gOptOptimizer
Definition: TOptimizerOpt.h:175
NEWMAT::ColumnVector & x
Definition: TOptimizerOpt.cxx:70
result
Definition: TOptimizerOpt.cxx:132
void incrementIteration()
Definition: TOptimizerOpt.h:135
TMethodCall * _fMethodCall
OPTPP::USERFCN0 *_theOptFunction ; ///< The function.
Definition: TOptimizerOpt.h:92
TString _sname
Definition: TOptimizerOpt.h:97
URANIE::DataServer::TDataServer * _tds
Definition: TOptimizerOpt.h:78
Bool_t getLog()
Definition: TOptimizerOpt.h:161
Description of the class TOptimizerOpt.
Definition: TOptimizerOpt.h:69
Int_t _niter
Definition: TOptimizerOpt.h:88
TString _sFunctionName
Definition: TOptimizerOpt.h:85
EOptimType
Definition: TOptimizerOpt.h:72
void unsetLog()
Definition: TOptimizerOpt.h:153
void changeLog()
Definition: TOptimizerOpt.h:157
fx
Definition: TOptimizerOpt.cxx:131
TString _sLibrary
Pointer vers un TDS.
Definition: TOptimizerOpt.h:84
Int_t getIteration()
Definition: TOptimizerOpt.h:139
void setLog()
Definition: TOptimizerOpt.h:149
Bool_t _blog
Boolean to edit the log.
Definition: TOptimizerOpt.h:77
TMethodCall * getMethodCall() const
Definition: TOptimizerOpt.h:131
TString _sInitFunctionName
Definition: TOptimizerOpt.h:86