English Français

Documentation / Developer's manual

Available modules

Calibration,  DataServer,  Launcher,  MetaModelOptim,  Modeler,  Optimizer,  ReLauncher,  Reliability,  ReOptimizer,  Sampler,  Sensitivity,  UncertModeler,  XmlProblem,   Uranie / ReOptimizer: TNloptShare.h Source File
Uranie / ReOptimizer v4.9.0
/* @license-end */
TNloptShare.h
Go to the documentation of this file.
1
2// 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 by
6// 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 1.5 $
22// $State$
24
32#ifndef __NLOPTSHARE__
33#define __NLOPTSHARE__
34
35#include <vector>
36#include <map>
37
38//ROOT
39#include "Rtypes.h"
40
41//Uranie
42#include "Reoptimizer.h"
43#include "TOptimShare.h"
44
45#include "DataServer.h"
46#include "TEval.h"
47#include "TOptimFit.h"
48#include "TFitGetter.h"
49
50struct nlopt_opt_s;
51/* opaque structure, defined internally */
52typedef struct nlopt_opt_s *nlopt_opt;
53struct nlopt_work;
54
55
56namespace URANIE
57{
58namespace Reoptimizer
59{
60
62{
63public:
64 virtual ~TNloptSolver() {}
65 virtual nlopt_opt build(int, int, int, double, nlopt_opt*) = 0;
66
67 ClassDef(URANIE::Reoptimizer::TNloptSolver, ID_REOPTIMIZER)
68};
69
71{
72private:
73 void create();
74
75protected:
77 TObjArray _equal;
79 std::vector<double *> _guess;
80 int _id, _max; //, _coef;
81 std::vector<std::vector<URANIE::DataServer::UEntry *>> _codi, _codo, _codg;
82
83 virtual void build();
84 // abstrack methods
85 virtual void buildSolver(int siz, struct nlopt_work *) = 0;
86 virtual void cleanSolver(struct nlopt_work *) = 0;
87 virtual void put(struct nlopt_work *, Bool_t, const double *) = 0;
88 virtual int get(long &) = 0;
89 //void gradFromCode(double *code, double *solv);
90 // solver
91 void solver(struct nlopt_work *, int, double*,
92 vector<URANIE::DataServer::UEntry*>&,
93 vector<URANIE::DataServer::UEntry*>&,
94 vector<URANIE::DataServer::UEntry*>&
95 );
96 void calcul(struct nlopt_work *, Bool_t, const double *);
97 void fillOptimum(struct nlopt_work *);
98 void fill(struct nlopt_work *, URANIE::DataServer::TDataServer *tds, int id);
99
100public:
102 {
103 };
104
105 TNloptShare(URANIE::DataServer::TDataServer *tds, URANIE::Relauncher::TRun *run,
106 TNloptSolver *algo);
107 TNloptShare(URANIE::DataServer::TDataServer *tds, URANIE::Relauncher::TEval *fun,
108 TNloptSolver *algo);
109 virtual ~TNloptShare();
110
111 // initialisation
112 void setStartingPoint(double *pt);
113 void setStartingPoint(int nb, double *pt);
114 void setMaximumEval(int max)
115 {
116 _max = max;
117 }
118
119 // callback methode
120 virtual int critere(struct nlopt_work*, const double *ini, double *out,
121 double *grad) = 0;
122 virtual int inequality(struct nlopt_work*, const double *in, double *out,
123 double *grad) = 0;
124 virtual int equality(struct nlopt_work*, const double *in, double *out,
125 double *grad) = 0;
126 void run(struct nlopt_work *);
127
130 {
131 return _retOptim;
132 }
133
135 {
136 return _guess.size();
137 }
138
139
140 virtual void solverLoop();
141
142 ClassDef(URANIE::Reoptimizer::TNloptShare, ID_REOPTIMIZER)
143};
144
145#ifdef HIDE
146double nlopt_crit(unsigned, const double*, double*, void *);
147void nlopt_inequal(unsigned, double *, unsigned, const double*, double*, void*);
148void nlopt_equal(unsigned, double *, unsigned, const double*, double*, void*);
149//void nlopt_run(void*);
150#endif
151
152}
153} //namespace
154#endif
155
recuperation de sortie transformées
struct nlopt_opt_s * nlopt_opt
Definition TNloptShare.h:52
objectifs et contraintes standards
methodes communes aux algo d optimisation
Definition TFitGetter.h:51
Definition TNloptShare.h:71
void fillOptimum(struct nlopt_work *)
Definition TNloptShare.cxx:410
std::vector< std::vector< URANIE::DataServer::UEntry * > > _codi
Definition TNloptShare.h:81
int _id
Definition TNloptShare.h:80
virtual void put(struct nlopt_work *, Bool_t, const double *)=0
void setMaximumEval(int max)
Definition TNloptShare.h:114
void solver(struct nlopt_work *, int, double *, vector< URANIE::DataServer::UEntry * > &, vector< URANIE::DataServer::UEntry * > &, vector< URANIE::DataServer::UEntry * > &)
Definition TNloptShare.cxx:241
virtual void build()
Definition TNloptShare.cxx:110
std::vector< std::vector< URANIE::DataServer::UEntry * > > _codg
Definition TNloptShare.h:81
void calcul(struct nlopt_work *, Bool_t, const double *)
Definition TNloptShare.cxx:188
std::vector< std::vector< URANIE::DataServer::UEntry * > > _codo
Definition TNloptShare.h:81
TObjArray _equal
Definition TNloptShare.h:77
void setStartingPoint(double *pt)
Definition TNloptShare.cxx:119
virtual int equality(struct nlopt_work *, const double *in, double *out, double *grad)=0
void run(struct nlopt_work *)
Definition TNloptShare.cxx:310
virtual void cleanSolver(struct nlopt_work *)=0
virtual int critere(struct nlopt_work *, const double *ini, double *out, double *grad)=0
virtual void solverLoop()
Definition TNloptShare.cxx:342
int _retOptim
Definition TNloptShare.h:128
void create()
Definition TNloptShare.cxx:99
virtual void buildSolver(int siz, struct nlopt_work *)=0
std::vector< double * > _guess
Definition TNloptShare.h:79
virtual int inequality(struct nlopt_work *, const double *in, double *out, double *grad)=0
TFitGetter * _crit
Definition TNloptShare.h:76
void fill(struct nlopt_work *, URANIE::DataServer::TDataServer *tds, int id)
Definition TNloptShare.cxx:417
TNloptSolver * _solv
Definition TNloptShare.h:78
virtual ~TNloptShare()
Definition TNloptShare.cxx:82
int getReturnOptim()
Definition TNloptShare.h:129
int getNStartingPoint()
Definition TNloptShare.h:134
virtual int get(long &)=0
int _max
Definition TNloptShare.h:80
Definition TNloptShare.h:62
virtual ~TNloptSolver()
Definition TNloptShare.h:64
virtual nlopt_opt build(int, int, int, double, nlopt_opt *)=0
Definition TOptimShare.h:53
void nlopt_inequal(unsigned, double *, unsigned, const double *, double *, void *)
Definition TNloptShare.cxx:169
double nlopt_crit(unsigned, const double *, double *, void *)
Definition TNloptShare.cxx:159
void nlopt_equal(unsigned, double *, unsigned, const double *, double *, void *)
Definition TNloptShare.cxx:178
Definition TCMAES.h:70