1 // Copyright (C) 2006-2013 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #include "PluginSimplex.hxx"
21 #include "TypeCode.hxx"
26 #include "solution.hxx"
30 using namespace YACS::ENGINE;
32 PluginSimplex::PluginSimplex(Pool *pool):OptimizerAlgSync(pool),_tc(0)
35 TypeCode *tctmp=new TypeCode(Double);
36 _tc=new TypeCodeSeq("", "", tctmp);
39 dst = (SalomeEventLoop *) NULL;
40 dec = (LinearDecoder *) NULL;
41 mtr = (Maestro *) NULL;
43 solv = (Simplex *) NULL;
47 PluginSimplex::~PluginSimplex()
58 TypeCode *PluginSimplex::getTCForIn() const
63 TypeCode *PluginSimplex::getTCForOut() const
68 void PluginSimplex::parseFileToInit(const std::string& fileName)
70 std::vector<std::pair<double, double> > dom(NBGENE);
73 // domaine de recherche
74 for (i=0; i<NBGENE; i++) {
75 dom[i].first = BORNEMIN;
76 dom[i].second = BORNEMAX;
79 dst = new SalomeEventLoop(_pool);
80 dec = new LinearDecoder(dom);
81 mtr = new Maestro((Decoder &) *dec, (Critere *) NULL, (Distrib &) *dst);
83 solv = new Simplex(NBNODE, NBGENE, *mtr);
85 solv->setStop(NBEVAL);
88 void PluginSimplex::start()
93 void PluginSimplex::takeDecision()
99 void PluginSimplex::initialize(const Any *input) throw(YACS::Exception)
103 void PluginSimplex::finish()
108 res = solv->solution();
112 OptimizerAlgBase *PluginSimplexFactory(Pool *pool)
114 return new PluginSimplex(pool);