Version: 9.16.0
saclass.cxx
Go to the documentation of this file.
1// Copyright (C) 2006-2026 CEA, EDF
2//
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, or (at your option) any later version.
7//
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.
12//
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
16//
17// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18//
19
20#include "saclass.hxx"
21
22#include <utility>
23
24#include "topologie.hxx"
25
26#include "saconst.h"
27
28
29
31{
32 super = &t;
33 rnd1 = (SpherePositif *) NULL;
34 st1 = (Traditionnel *) NULL;
35 rnd2 = (Sphere *) NULL;
36 st2 = (Pivot *) NULL;
37 // distribution
38 dst = (SalomeEventLoop *) NULL;
39 dec = (LinearDecoder *) NULL;
40 mtr = (Maestro *) NULL;
41 // swarm
42 swrm = (MonoSwarm *) NULL;
43
44}
45
47{
48 delete rnd1;
49 delete rnd2;
50 delete st1;
51 delete st2;
52 // distribution
53 delete dst;
54 delete dec;
55 delete mtr;
56 // swarm
57 delete swrm;
58}
59
60void SalomeTest::readFromFile(std::string rien)
61{
62 std::vector<std::pair<double, double> > dom(NBGENE);
63 long i;
64
65 // domaine de recherche
66 for (i=0; i<NBGENE; i++) {
67 dom[i].first = BORNEMIN;
68 dom[i].second = BORNEMAX;
69 }
70 // topologie
71 Plan top(COTE,COTE);
72 // operateur stochastique
74 st1 = new Traditionnel(NBGENE, *rnd1);
75 rnd2 = new Sphere(NBGENE);
76 st2 = new Pivot(NBGENE, *rnd2);
77 // distribution
79 dec = new LinearDecoder(dom);
80 mtr = new Maestro((Decoder &) *dec, (Critere *) NULL, (Distrib &) *dst);
81 // swarm
82 swrm = new MonoSwarm(PLAN, NBGENE, (Topologie &) top, (Movement &) *st1, (Movement &) *st1, *mtr);
83
84 swrm->setStop(NBEVAL);
85}
86
88{
89 swrm->start();
90}
91
93{
94 int rien;
95 rien = swrm->next();
96}
97
99{
100 Solution *res;
101
102 swrm->finish();
103 res = swrm->solution();
104 dec->echo(*res);
105}
106
void echo(Solution &)
Definition: decode.cxx:25
Traditionnel * st1
Definition: saclass.hxx:41
MonoSwarm * swrm
Definition: saclass.hxx:48
~SalomeTest(void)
Definition: saclass.cxx:46
SalomeEventLoop * dst
Definition: saclass.hxx:44
Pivot * st2
Definition: saclass.hxx:42
SpherePositif * rnd1
Definition: saclass.hxx:39
LinearDecoder * dec
Definition: saclass.hxx:45
void readFromFile(std::string)
Definition: saclass.cxx:60
SalomeTest(Superviseur &)
Definition: saclass.cxx:30
void start(void)
Definition: saclass.cxx:87
Sphere * rnd2
Definition: saclass.hxx:40
Superviseur * super
Definition: saclass.hxx:38
Maestro * mtr
Definition: saclass.hxx:46
void finish(void)
Definition: saclass.cxx:98
void next(void)
Definition: saclass.cxx:92
Definition: aleas.hxx:55
#define COTE
Definition: saconst.h:32
#define NBEVAL
Definition: saconst.h:34
#define BORNEMAX
Definition: saconst.h:56
#define NBGENE
Definition: saconst.h:50
#define PLAN
Definition: saconst.h:31
#define BORNEMIN
Definition: saconst.h:55