IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

C++ Discussion :

Erreur: Fin de fichier inattendue.


Sujet :

C++

  1. #1
    Membre à l'essai
    Profil pro
    Inscrit en
    Mars 2006
    Messages
    57
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2006
    Messages : 57
    Points : 15
    Points
    15
    Par défaut Erreur: Fin de fichier inattendue.
    Bonjour,

    Je suis en train de récupérer une bibliothèque C++ datant de 1995, mais lorsque j'essaie de compiler les fichiers j'obtiens ce genre d'erreur:

    c:\Documents and Settings\Fabrice\Bureau\Project\GATest\ga\GATreeGenome.C(350) : fatal error C1010: fin de fichier inattendue lors de la recherche d'une directive d'en-tête précompilé
    Voici par exemple un des fichiers incriminés:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
     
    // $Header: /home/cvs/galib/ga/GATreeGenome.C,v 1.3 2004/12/28 22:17:30 mwall Exp $
    /* ----------------------------------------------------------------------------
    tree.C
    mbwall 25feb95
    Copyright (c) 1995 Massachusetts Institute of Technology
    all rights reserved
    DESCRIPTION:
    Source file for the tree genome.
    ---------------------------------------------------------------------------- */
    #ifndef _ga_tree_C_
    #define _ga_tree_C_
    #include <stdio.h>
    #include <stdlib.h>
    #include <ga/GATreeGenome.h>
    #include <ga/garandom.h>
     
    extern int _GATreeCompare(GANodeBASE * anode, GANodeBASE * bnode);
    template <class T> const char *
    GATreeGenome<T>::className() const {return "GATreeGenome";}
    template <class T> int
    GATreeGenome<T>::classID() const {return GAID::TreeGenome;}
    template <class T>
    GATreeGenome<T>::GATreeGenome(GAGenome::Evaluator f, void * u) : 
    GATree<T>(),
    GAGenome(DEFAULT_TREE_INITIALIZER,
    DEFAULT_TREE_MUTATOR,
    DEFAULT_TREE_COMPARATOR) {
    evaluator(f);
    userData(u);
    crossover(DEFAULT_TREE_CROSSOVER);
    }
     
    template <class T>
    GATreeGenome<T>::GATreeGenome(const GATreeGenome<T> & orig) : 
    GATree<T>(),
    GAGenome() {
    GATreeGenome<T>::copy(orig);
    }
     
    template <class T>
    GATreeGenome<T>::~GATreeGenome() { }
     
    template <class T> GAGenome *
    GATreeGenome<T>::clone(GAGenome::CloneMethod flag) const {
    GATreeGenome<T> *cpy = new GATreeGenome<T>();
    if(flag == (int)CONTENTS){cpy->copy(*this);} // cast is for metrowerks...
    else{cpy->GAGenome::copy(*this);}
    return cpy;
    }
     
    template <class T> void
    GATreeGenome<T>::copy(const GAGenome & orig) {
    if(&orig == this) return;
    const GATreeGenome<T>* c = DYN_CAST(const GATreeGenome<T>*, &orig);
    if(c) {
    GAGenome::copy(*c);
    GATree<T>::copy(*c);
    }
    }
     
    #ifdef GALIB_USE_STREAMS
    // Traverse the tree (breadth-first) and dump the contents as best we can to
    // the stream. We don't try to write the contents of the nodes - we simply 
    // write a . for each node in the tree.
    // We allocate space for x,y coord pair for each node in the tree. Then we
    // do a depth-first traversal of the tree and assign coords to the nodes in the
    // order we get them in the traversal. Each coord pair is measured relative to
    // the parent of the node.
    template <class T> void
    _tt(STD_OSTREAM & os, GANode<T> * n)
    {
    if(!n) return;
    GANodeBASE * node = DYN_CAST(GANodeBASE*, n);
    os.width(10); os << node << " ";
    os.width(10); os << node->parent << " ";
    os.width(10); os << node->child << " ";
    os.width(10); os << node->next << " ";
    os.width(10); os << node->prev << " ";
    os.width(10); os << &(n->contents) << "\n";
    _tt(os, DYN_CAST(GANode<T>*, node->child));
    for(GANodeBASE * tmp=node->next; tmp && tmp != node; tmp=tmp->next){
    os.width(10); os << tmp << " ";
    os.width(10); os << tmp->parent << " ";
    os.width(10); os << tmp->child << " ";
    os.width(10); os << tmp->next << " ";
    os.width(10); os << tmp->prev << " ";
    os.width(10); os << &(DYN_CAST(GANode<T>*, tmp)->contents) << "\n";
    _tt(os, DYN_CAST(GANode<T>*, tmp->child));
    }
    }
    template <class T> int
    GATreeGenome<T>::write(STD_OSTREAM & os) const 
    {
    os << "node parent child next prev contents\n";
    _tt(os, (GANode<T> *)(this->rt));
    return 0;
    }
    #endif
     
    template <class T> int 
    GATreeGenome<T>::equal(const GAGenome & c) const
    {
    if(this == &c) return 1;
    const GATreeGenome<T>& b = DYN_CAST(const GATreeGenome<T>&, c);
    return _GATreeCompare(this->rt, b.rt) ? 0 : 1;
    }
     
     
     
     
     
     
     
     
     
     
    /* ----------------------------------------------------------------------------
    Operator definitions
    ---------------------------------------------------------------------------- */
    // This mutation method is destructive. We randomly pick a node in the tree
    // then delete the subtree and node at that point. Each node in the tree has
    // a pmut probability of getting nuked.
    // After the mutation the iterator is left at the root of the tree.
    template <class T> int
    GATreeGenome<T>::DestructiveMutator(GAGenome & c, float pmut)
    {
    GATreeGenome<T> &child=DYN_CAST(GATreeGenome<T> &, c);
    register int n, i;
    if(pmut <= 0.0) return 0;
    n = child.size();
    float nMut = pmut * STA_CAST(float,n);
    if(nMut < 1.0){ // we have to do a flip test for each node
    nMut = 0;
    for(i=0; i<n; i++){
    if(GAFlipCoin(pmut) && child.warp(i)){
    child.destroy();
    nMut++;
    }
    }
    }
    else{ // only nuke the number of nodes we need to
    for(i=0; i<nMut; i++){
    if(child.warp(GARandomInt(0, n-1)))
    child.destroy();
    }
    }
    child.root(); // set iterator to root node
    return(STA_CAST(int,nMut));
    }
     
    // This is a rearranging mutation operator. It randomly picks two nodes in the
    // tree and swaps them. Any node has a pmut chance of getting
    // swapped, and the swap could happen to any other node. And in the case of
    // nMut < 1, the swap may generate a swap partner that is the same node, in 
    // which case no swap occurs (we don't check).
    // After the mutation the iterator is left at the root of the tree.
    template <class T> int
    GATreeGenome<T>::SwapNodeMutator(GAGenome & c, float pmut)
    {
    GATreeGenome<T> &child=DYN_CAST(GATreeGenome<T> &, c);
    register int n, i;
    if(pmut <= 0.0) return 0;
    n = child.size();
    float nMut = pmut * STA_CAST(float,n);
    nMut *= 0.5; // swapping one node swaps another as well
    if(nMut < 1.0){ // we have to do a flip test for each node
    nMut = 0;
    for(i=0; i<n; i++){
    if(GAFlipCoin(pmut)){
    child.swap(i,GARandomInt(0,n-1));
    nMut++;
    }
    }
    }
    else{ // only nuke the number of nodes we need to
    for(i=0; i<nMut; i++)
    child.swap(GARandomInt(0,n-1),GARandomInt(0,n-1));
    }
    child.root(); // set iterator to root node
    return(STA_CAST(int,nMut*2));
    }
     
     
    // This is a rearranging mutation operator with subtree swap. It does the same
    // thing as the rearranging mutator above, but swaps subtrees as well as the
    // nodes that are selected.
    // After the mutation the iterator is left at the root of the tree.
    // We check to make sure that we don't try to swap ancestral nodes. If it is
    // an ancestral swap, we give up and don't do anything to the tree. This could
    // result in mutation rates that are lower than the specified rate!
    // *** mutation rates are not exact!
    template <class T> int
    GATreeGenome<T>::SwapSubtreeMutator(GAGenome & c, float pmut)
    {
    GATreeGenome<T> &child=DYN_CAST(GATreeGenome<T> &, c);
    register int n, i;
    int a, b;
    if(pmut <= 0.0) return 0;
    n = child.size();
    float nMut = pmut * STA_CAST(float,n);
    nMut *= 0.5; // swapping one node swaps another as well
    if(nMut < 1.0){ // we have to do a flip test for each node
    nMut = 0;
    for(i=0; i<n; i++){
    if(GAFlipCoin(pmut)){
    b = GARandomInt(0,n-1);
    if(!child.ancestral(i,b)) child.swaptree(i,b);
    nMut++;
    }
    }
    }
    else{ // only nuke the number of nodes we need to
    for(i=0; i<nMut; i++){
    a = GARandomInt(0,n-1);
    b = GARandomInt(0,n-1);
    if(!child.ancestral(a,b)) child.swaptree(a,b);
    }
    }
    child.root(); // set iterator to root node
    return(STA_CAST(int, nMut*2));
    }
     
    // We use the recursive tree function to compare the tree structures. This
    // does not compare the contents of the nodes.
    template <class T> float
    GATreeGenome<T>::TopologyComparator(const GAGenome& a, const GAGenome& b) 
    {
    if(&a == &b) return 0;
    const GATreeGenome<T>& sis=DYN_CAST(const GATreeGenome<T>&, a);
    const GATreeGenome<T>& bro=DYN_CAST(const GATreeGenome<T>&, b);
    return STA_CAST(float, _GATreeCompare(sis.rt, bro.rt));
    }
     
     
     
     
     
     
     
     
    // The default crossover operator takes a node from parent a (with its entire
    // sub-tree) and replaces it with a node from parent b (with its entire sub-
    // tree). If the crossover site is not set, then we pick a random site based
    // on the trees in the genomes we're going to cross. Once we have a valid
    // crossover site, we copy the trees from the two genomes.
    // If the crossover site is out of bounds (ie refers to a node not in the
    // tree) then we don't do anything to the child.
    // We allow crossover at ANY site in the genomes (including at the root
    // node).
    // *** we should be able to speed this up. there is an extra traversal when we
    // do the check to see if the crossover site is valid.
    template <class T> int
    GATreeGenome<T>::
    OnePointCrossover(const GAGenome& p1, const GAGenome& p2, 
    GAGenome* c1, GAGenome* c2){
    const GATreeGenome<T> &mom=DYN_CAST(const GATreeGenome<T> &, p1);
    const GATreeGenome<T> &dad=DYN_CAST(const GATreeGenome<T> &, p2);
    int nc=0;
    unsigned int a = GARandomInt(0, mom.size()-1);
    unsigned int b = GARandomInt(0, dad.size()-1);
    GATreeIter<T> momiter(mom), daditer(dad);
    GATree<T> * tree;
    if(c1 && c2){
    GATreeGenome<T> &sis=DYN_CAST(GATreeGenome<T> &, *c1);
    GATreeGenome<T> &bro=DYN_CAST(GATreeGenome<T> &, *c2);
    // first do the sister...
    if(momiter.warp(a) && daditer.warp(b)){
    sis.GATree<T>::copy(mom);
    tree = dad.GATree<T>::clone(b);
    sis.warp(a);
    sis.swaptree(tree);
    delete tree;
    sis.warp(0);
    }
    // ...now do the brother.
    if(momiter.warp(a) && daditer.warp(b)){
    bro.GATree<T>::copy(dad);
    tree = mom.GATree<T>::clone(a);
    bro.warp(b);
    bro.swaptree(tree);
    delete tree;
    bro.warp(0);
    }
    nc = 2;
    }
    else if(c1){
    GATreeGenome<T> &sis=DYN_CAST(GATreeGenome<T> &, *c1);
    if(GARandomBit()){
    if(momiter.warp(a) && daditer.warp(b)){
    sis.GATree<T>::copy(mom);
    tree = dad.GATree<T>::clone(b);
    sis.warp(a);
    sis.swaptree(tree);
    delete tree;
    sis.warp(0);
    }
    }
    else{
    if(momiter.warp(a) && daditer.warp(b)){
    sis.GATree<T>::copy(dad);
    tree = mom.GATree<T>::clone(a);
    sis.warp(b);
    sis.swaptree(tree);
    delete tree;
    sis.warp(0);
    }
    }
    nc = 1;
    }
    return nc;
    }
    #endif
    J'ai l'impression que l'erreur vient des #ifndef, peut-être que cette formulation n'est plus adaptée aujourd'hui, mais je ne sais pas quoi mettre à la place.

    Avez-vous une idée de comment je pourrais corriger cette erreur?

    Merci d'avance pour votre aide.

  2. #2
    Expert éminent
    Avatar de Swoög
    Profil pro
    Inscrit en
    Janvier 2003
    Messages
    6 045
    Détails du profil
    Informations personnelles :
    Âge : 36
    Localisation : France

    Informations forums :
    Inscription : Janvier 2003
    Messages : 6 045
    Points : 8 339
    Points
    8 339
    Par défaut
    C'est bizarre, perso, la seule fois où j'ai eu ce style d'erreur, ça venait d'un problème de configuration du compilateur...

    quel est ton IDE/compilateur ?

    as-tu essayé d'enlever les .h de la librairie que tu utilises (en déclarant/définissant à la barbare les fonctions dont tu as besoin) pour voir si le problème venait de là ?

    (quand je dis à la barbare, c'est, exemple tu as besoin de la fonction init qui renvoie un int et qui prend un float et un char en paramètre, au lieu du include tu mets ça :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    int init(float, char) { return 0; }
    )
    C'est juste pour voir si ça compile
    Rédacteur "éclectique" (XML, Cours PHP, Cours JavaScript, IRC, Web...)
    Les Règles du Forum - Mon Site Web sur DVP.com (Développement Web, PHP, (X)HTML/CSS, SQL, XML, IRC)
    je ne répondrai à aucune question technique via MP, MSN ou Skype : les Forums sont là pour ça !!! Merci de me demander avant de m'ajouter à vos contacts sinon je bloque !
    pensez à la balise [ code ] (bouton #) et au tag (en bas)

  3. #3
    Membre à l'essai
    Profil pro
    Inscrit en
    Mars 2006
    Messages
    57
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2006
    Messages : 57
    Points : 15
    Points
    15
    Par défaut
    Citation Envoyé par Swoög
    C'est bizarre, perso, la seule fois où j'ai eu ce style d'erreur, ça venait d'un problème de configuration du compilateur...

    quel est ton IDE/compilateur ?
    Je compile avec Visual C++ sous WinXP (Win 32).

    Citation Envoyé par Swoög
    as-tu essayé d'enlever les .h de la librairie que tu utilises (en déclarant/définissant à la barbare les fonctions dont tu as besoin) pour voir si le problème venait de là ?

    (quand je dis à la barbare, c'est, exemple tu as besoin de la fonction init qui renvoie un int et qui prend un float et un char en paramètre, au lieu du include tu mets ça :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    int init(float, char) { return 0; }
    )
    C'est juste pour voir si ça compile
    Le problème est que la librairie comporte 32 fichiers .c et 32 fichiers .h leur correspondant, avec des références croisées. Je me vois mal recopier tous les .h dans les .c à la main.


    Voilà par exemple le .h du code que j'ai donné au-dessus:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
     
    // $Header: /home/cvs/galib/ga/GATreeGenome.h,v 1.3 2004/12/28 18:18:27 mwall Exp $
    /* ----------------------------------------------------------------------------
    tree.h
    mbwall 25feb95
    Copyright (c) 1995 Massachusetts Institute of Technology
    all rights reserved
    DESCRIPTION:
    This header defines the interface for the tree genome.
    ---------------------------------------------------------------------------- */
    #ifndef _ga_tree_h_
    #define _ga_tree_h_
    #include <ga/GATree.h>
    #include <ga/GAGenome.h>
     
    /* ----------------------------------------------------------------------------
    TreeGenome
    -------------------------------------------------------------------------------
    Beware that the tree genome can grow unbounded - there is no size limit
    on the tree, so if you have an objective function that encourages size the tree
    will grow until you run out of memory.
    ---------------------------------------------------------------------------- */
    template <class T>
    class GATreeGenome : public GATree<T>, public GAGenome {
    public:
    GADeclareIdentity();
    static int DestructiveMutator(GAGenome &, float);
    static int SwapNodeMutator(GAGenome &, float);
    static int SwapSubtreeMutator(GAGenome &, float);
    static int OnePointCrossover(const GAGenome&, const GAGenome&, 
    GAGenome*, GAGenome*);
    static float TopologyComparator(const GAGenome&, const GAGenome&);
    // static float NodeComparator(const GAGenome&, const GAGenome&);
    public:
    GATreeGenome(GAGenome::Evaluator f=NULL, void * u=NULL);
    GATreeGenome(const GATreeGenome<T> &);
    GATreeGenome<T> & operator=(const GAGenome & orig)
    {copy(orig); return *this;}
    virtual ~GATreeGenome();
    virtual GAGenome *clone(GAGenome::CloneMethod flag=CONTENTS) const;
    virtual void copy(const GAGenome &);
    #ifdef GALIB_USE_STREAMS
    virtual int write (STD_OSTREAM &) const;
    #endif
    virtual int equal(const GAGenome & c) const;
    // Here we do inlined versions of the access members of the super class. We
    // do our own here so that we can set/unset the _evaluated flag appropriately.
    int destroy() { _evaluated = gaFalse; return GATree<T>::destroy(); }
    int swaptree(GATree<T> * t)
    { _evaluated = gaFalse; return GATree<T>::swaptree(t); }
    int swaptree(unsigned int i, unsigned int j)
    { _evaluated = gaFalse; return GATree<T>::swaptree(i,j); }
    int swap(unsigned int i, unsigned int j)
    { _evaluated = gaFalse; return GATree<T>::swap(i,j); }
    GATree<T> * remove() { _evaluated = gaFalse; return GATree<T>::remove(); }
    int insert(GATree<T> * t, GATreeBASE::Location where=GATreeBASE::BELOW)
    { _evaluated = gaFalse; return GATree<T>::insert(t, where); }
    int insert(const T & t, GATreeBASE::Location where=GATreeBASE::BELOW)
    { _evaluated = gaFalse; return GATree<T>::insert(t, where); }
    };
    #ifdef GALIB_USE_BORLAND_INST
    #include <ga/GATreeGenome.C>
    #endif
    #endif

  4. #4
    Expert éminent
    Avatar de Swoög
    Profil pro
    Inscrit en
    Janvier 2003
    Messages
    6 045
    Détails du profil
    Informations personnelles :
    Âge : 36
    Localisation : France

    Informations forums :
    Inscription : Janvier 2003
    Messages : 6 045
    Points : 8 339
    Points
    8 339
    Par défaut
    Citation Envoyé par Berzerk_
    Je compile avec Visual C++ sous WinXP (Win 32)
    Ok, bon, ça me rassure, alors, perso je sais que ça se produisait avec VC++ également... par contre c'était y'a un bout de temps, et je ne sais plus ce qu'il faut modifier, essaie de mettre ton message d'erreur dans google, ou de tester les options de compilation (une qui doit avoir un rapport avec les directives précompilées je saurais presque la retrouvée si je pouvais la chercher moi-même, mais j'ai plus VC++, essaie de chercher un truc en rapport avec les directives précompilées dans les options du projet/de la solution )

    pour la librairie, ça fait effectivement beaucoup lol

    le problème doit venir d'ailleurs...
    Rédacteur "éclectique" (XML, Cours PHP, Cours JavaScript, IRC, Web...)
    Les Règles du Forum - Mon Site Web sur DVP.com (Développement Web, PHP, (X)HTML/CSS, SQL, XML, IRC)
    je ne répondrai à aucune question technique via MP, MSN ou Skype : les Forums sont là pour ça !!! Merci de me demander avant de m'ajouter à vos contacts sinon je bloque !
    pensez à la balise [ code ] (bouton #) et au tag (en bas)

  5. #5
    Membre à l'essai
    Profil pro
    Inscrit en
    Mars 2006
    Messages
    57
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2006
    Messages : 57
    Points : 15
    Points
    15
    Par défaut
    Ok je vais essayer de chercher de ce côté, merci.

    En attendant si quelqu'un d'autre a une idée, qu'il n'hésite pas à me le faire savoir.

  6. #6
    Rédacteur
    Avatar de Laurent Gomila
    Profil pro
    Développeur informatique
    Inscrit en
    Avril 2003
    Messages
    10 651
    Détails du profil
    Informations personnelles :
    Âge : 40
    Localisation : France, Moselle (Lorraine)

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Avril 2003
    Messages : 10 651
    Points : 15 920
    Points
    15 920
    Par défaut
    Il faut désactiver l'utilisation des en-têtes précompilés dans les options du projet, voir la FAQ C++ si tu ne trouves pas.

  7. #7
    Membre éclairé
    Profil pro
    Inscrit en
    Octobre 2004
    Messages
    633
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2004
    Messages : 633
    Points : 711
    Points
    711
    Par défaut
    Bonjour,
    Citation Envoyé par Laurent Gomila
    Il faut désactiver l'utilisation des en-têtes précompilés dans les options du projet, voir la FAQ C++ si tu ne trouves pas.
    OU ajouter
    dans ton fichier
    Compilation sans erreur ne signifie pas programme sans erreur.
    L'indentation n'a pas été imaginée pour faire beau, mais pour faciliter la lecture des programmes.

  8. #8
    Rédacteur
    Avatar de Laurent Gomila
    Profil pro
    Développeur informatique
    Inscrit en
    Avril 2003
    Messages
    10 651
    Détails du profil
    Informations personnelles :
    Âge : 40
    Localisation : France, Moselle (Lorraine)

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Avril 2003
    Messages : 10 651
    Points : 15 920
    Points
    15 920
    Par défaut
    Citation Envoyé par thewho
    OU ajouter
    dans ton fichier
    En général lorsqu'on ne comprend rien à cette erreur c'est qu'on ne comprend rien aux en-têtes précompilés, et qu'on ne voulait donc pas spécialement s'en servir.

    Tant qu'à les utiliser alors autant le faire bien et se documenter avant (la FAQ VC++ doit avoir quelque chose à ce sujet).

  9. #9
    Membre à l'essai
    Profil pro
    Inscrit en
    Mars 2006
    Messages
    57
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2006
    Messages : 57
    Points : 15
    Points
    15
    Par défaut
    Merci pour vos réponses, j'avais effectivement retrouvé le conseil de désactiver les directives d'en-tête précompilé sur ce site et c'est ce que j'ai fait.

    Ca a résolu le problème, mais de nouvelles erreurs apparaîssent:



    c:\Documents and Settings\Fabrice\Bureau\Project\GATest\ga\GATreeGenome.C(16) : fatal error C1083: Impossible d'ouvrir le fichier include : 'ga/GATreeGenome' : No such file or directory
    GATreeBASE.C
    J'ai cherché sur ce site, et j'ai trouvé une erreur correspondante dans le cas de #include <iostream.h> où l'on me conseille d'enlever le .h et de rajouter:
    using namespace std;

    J'ai essayé de transposer cette indication à

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    #include <ga/GATree.h>
    #include <ga/GAGenome.h>
    dans le fichier GATreeGenome.h

    et

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
     
    #include <ga/GATreeGenome.h>
    #include <ga/garandom.h>
    dans le fichier GaTreeGenome.c.

    Les remplaçant respectivement par:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
     
    #include <ga/GATree>
    #include <ga/GAGenome>
    using namespace std;
    et par:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
     
    #include <ga/GATreeGenome>
    #include <ga/garandom>
    using namespace std;
    Mais l'erreur demeure (enfin les 32 erreurs correspondant aux 32 fichiers .h et .c).

    Sauriez-vous comment réparer ça?

  10. #10
    Rédacteur
    Avatar de Laurent Gomila
    Profil pro
    Développeur informatique
    Inscrit en
    Avril 2003
    Messages
    10 651
    Détails du profil
    Informations personnelles :
    Âge : 40
    Localisation : France, Moselle (Lorraine)

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Avril 2003
    Messages : 10 651
    Points : 15 920
    Points
    15 920
    Par défaut
    J'ai cherché sur ce site, et j'ai trouvé une erreur correspondante dans le cas de #include <iostream.h> où l'on me conseille d'enlever le .h et de rajouter: using namespace std;

    J'ai essayé de transposer cette indication
    Dans le cas d'iostream.h, c'est parce que le nom du fichier est maintenant iostream. C'est le cas de pas mal d'en-têtes standards.
    Mais si ton fichier à toi s'appelle GATree.h il n'y a aucune raison de retirer le .h. Là le compilo ne risque pas de le retrouver.

    c:\Documents and Settings\Fabrice\Bureau\Project\GATest\ga\GATreeGenome.C(16) : fatal error C1083: Impossible d'ouvrir le fichier include : 'ga/GATreeGenome' : No such file or directory
    Ca c'est l'erreur que tu as en retirant les .h. Quelle est l'erreur lorsque tu les remets ?

  11. #11
    Membre à l'essai
    Profil pro
    Inscrit en
    Mars 2006
    Messages
    57
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2006
    Messages : 57
    Points : 15
    Points
    15
    Par défaut
    Citation Envoyé par Laurent Gomila
    Ca c'est l'erreur que tu as en retirant les .h. Quelle est l'erreur lorsque tu les remets ?
    c:\Documents and Settings\Fabrice\Bureau\Project\GATest\ga\GATreeGenome.C(16) : fatal error C1083: Impossible d'ouvrir le fichier include : 'ga/GATreeGenome.h' : No such file or directory
    Exactement la même (avec le .h en plus).

  12. #12
    Rédacteur
    Avatar de Laurent Gomila
    Profil pro
    Développeur informatique
    Inscrit en
    Avril 2003
    Messages
    10 651
    Détails du profil
    Informations personnelles :
    Âge : 40
    Localisation : France, Moselle (Lorraine)

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Avril 2003
    Messages : 10 651
    Points : 15 920
    Points
    15 920
    Par défaut
    Donc il n'y a pas 36 explications : le compilo ne trouve pas le fichier, soit parce qu'il n'existe pas, soit parce qu'il ne sait pas où aller le chercher.

    "c:\Documents and Settings\Fabrice\Bureau\Project\GATest" fait-il bien partie des répertoires prédéfinis du compilo ?

  13. #13
    Membre à l'essai
    Profil pro
    Inscrit en
    Mars 2006
    Messages
    57
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2006
    Messages : 57
    Points : 15
    Points
    15
    Par défaut
    Citation Envoyé par Laurent Gomila
    "c:\Documents and Settings\Fabrice\Bureau\Project\GATest" fait-il bien partie des répertoires prédéfinis du compilo ?
    Que veux-tu dire par répertoire prédéfini? J'ai utilisé la fonction Ajouter un Elément existant de Visual C++ pour ajouter tous les fichiers de ma bibliothèque au projet. Ils sont maintenant présents dans les dossiers Source Files et Header Files de l'Explorateur de Solutions. Donc j'ai supposé qu'ils étaient bien connus par le compilateur.

    Il y a une autre manipulation à effectuer?

    Voilà un aperçu de l'explorateur de solutions (qui montre bien également que je travaille dans GATest):


  14. #14
    Rédacteur
    Avatar de Laurent Gomila
    Profil pro
    Développeur informatique
    Inscrit en
    Avril 2003
    Messages
    10 651
    Détails du profil
    Informations personnelles :
    Âge : 40
    Localisation : France, Moselle (Lorraine)

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Avril 2003
    Messages : 10 651
    Points : 15 920
    Points
    15 920
    Par défaut
    Les seuls répertoires dans lesquels le compilo ira chercher, sont le répertoire du fichier en cours de compilation ainsi que les répertoires que tu lui as fourni, soit au niveau des options de ton projet soit au niveau des options globales de l'EDI.

    Le plus simple sera dans ton cas d'ajouter "c:\Documents and Settings\Fabrice\Bureau\Project\GATest" aux options de ton projet, rubrique "C / C++", "General", "Additional include directories" (valable pour VS 2003 et 2005). Attention aux guillements, sinon il n'aimera pas les espaces.

  15. #15
    Membre à l'essai
    Profil pro
    Inscrit en
    Mars 2006
    Messages
    57
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2006
    Messages : 57
    Points : 15
    Points
    15
    Par défaut
    Comme le montre la capture d'écran que j'ai rajoutée dans mon précédent message, je travaillais déjà dans le répertoire GATest, où se situait le dossier ga.

    Mais j'ai quand même effectué la manipulation que tu m'as conseillé et celà semble résoudre le problème... pour en amener un autre:


    ------ Début de la génération : Projet : GATest, Configuration : Debug Win32 ------
    Compilation...
    stdafx.cpp
    Compilation...
    GATreeGenome.C
    c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\cerrno(18) : error C2143: erreur de syntaxe : absence de '{' avant ':'
    c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\cerrno(18) : error C2059: erreur de syntaxe : ':'
    c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\cstdio(17) : error C2143: erreur de syntaxe : absence de '{' avant ':'
    c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\cstdio(17) : error C2059: erreur de syntaxe : ':'
    c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\cstdio(17) : error C2143: erreur de syntaxe : absence de '{' avant ':'

    (...)

    (19) : fatal error C1003: le nombre d'erreurs est supérieur à 100 ; arrêt de la compilation
    GATreeBASE.C
    c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\cerrno(18) : error C2143: erreur de syntaxe : absence de '{' avant ':'
    c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\cerrno(18) : error C2059: erreur de syntaxe : ':'
    c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\cstdio(17) : error C2143: erreur de syntaxe : absence de '{' avant ':'
    c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\cstdio

    (...)

    (28) : fatal error C1003: le nombre d'erreurs est supérieur à 100 ; arrêt de la compilation
    GAStatistics.C
    c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\cerrno(18) : error C2143: erreur de syntaxe : absence de '{' avant ':'
    c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\cerrno(18) : error C2059: erreur de syntaxe : ':'

    (...)
    Pourtant il me semble que les librairies citées (cerrno et cstdio) font partie des librairies standards de Visual C++, donc il ne devrait pas y avoir de problème avec elles.

  16. #16
    Rédacteur
    Avatar de Laurent Gomila
    Profil pro
    Développeur informatique
    Inscrit en
    Avril 2003
    Messages
    10 651
    Détails du profil
    Informations personnelles :
    Âge : 40
    Localisation : France, Moselle (Lorraine)

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Avril 2003
    Messages : 10 651
    Points : 15 920
    Points
    15 920
    Par défaut
    Comme le montre la capture d'écran que j'ai rajoutée dans mon précédent message, je travaillais déjà dans le répertoire GATest, où se situait le dossier ga.
    Comme je te l'ai dit ça ne change rien pour les répertoires de recherche.

    Mais j'ai quand même effectué la manipulation que tu m'as conseillé et celà semble résoudre le problème... pour en amener un autre:
    .C ce n'est pas génial comme extension pour des fichiers C++.
    Sinon, tu as peut-être aussi une erreur de syntaxe dans un fichier qui est inclus avant ces en-têtes standards.

  17. #17
    Membre à l'essai
    Profil pro
    Inscrit en
    Mars 2006
    Messages
    57
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2006
    Messages : 57
    Points : 15
    Points
    15
    Par défaut
    Citation Envoyé par Laurent Gomila
    .C ce n'est pas génial comme extension pour des fichiers C++.
    Oui, cette bibliothèque a 10 ans, est-ce que renommer les fichiers en .cpp permettrait de résoudre des problèmes?

    Citation Envoyé par Laurent Gomila
    Sinon, tu as peut-être aussi une erreur de syntaxe dans un fichier qui est inclus avant ces en-têtes standards.
    Le problème est que les seuls en-têtes standards que je vois dans les .c sont stdio et stdlib, et aucun fichier n'est inclu avant elles. Donc il ne peut pas y avoir d'erreur avant, non?

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    #ifndef _ga_tree_C_
    #define _ga_tree_C_
     
    #include <stdio.h>
    #include <stdlib.h>
    #include <ga/GATreeGenome.h>
    #include <ga/garandom.h>

  18. #18
    Membre à l'essai
    Profil pro
    Inscrit en
    Mars 2006
    Messages
    57
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2006
    Messages : 57
    Points : 15
    Points
    15
    Par défaut
    Le problème des erreurs de syntaxe n'est toujours pas résolu. Pour simplifier la recherche d'erreur j'ai essayé de minimiser le nombre de fichiers de la bibliothèque que j'intégre dans mon projet.

    J'ai toujours les erreurs de syntaxe, mais j'ai également trouvé un problème d'identificateur qui pourrait être la cause des autres erreurs.

    GASimpleGA.C
    c:\Documents and Settings\Fabrice\Bureau\Project\GATest\ga\gaid.h(29) : error C2061: erreur de syntaxe : identificateur 'GAID'
    c:\Documents and Settings\Fabrice\Bureau\Project\GATest\ga\gaid.h(29) : error C2059: erreur de syntaxe : ';'
    c:\Documents and Settings\Fabrice\Bureau\Project\GATest\ga\gaid.h(29) : error C2449: trouvé '{' au niveau de la portée du fichier (en-tête de fonction manquant ?)
    c:\Documents and Settings\Fabrice\Bureau\Project\GATest\ga\gaid.h(56) : error C2059: erreur de syntaxe : '}'
    c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\cerrno(18) : error C2143: erreur de syntaxe : absence de '{' avant ':'
    c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\cerrno(18) : error C2059: erreur de syntaxe : ':'

    (...)
    Voilà le fichier gaid.h (sachant que GaTest.cpp appelle GaSimpleGA.h, qui appelle GABaseGA.h, qui appelle gaid.h, qui plante à la compilation...), l'identificateur GAID incriminé est en gras:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    // $Header: /home/cvs/galib/ga/gaid.h,v 1.1.1.1 1999/11/11 18:56:03 mbwall Exp $
    /* ----------------------------------------------------------------------------
      id.h
      mbwall 7may95
      Copyright (c) 1995 Massachusetts Institute of Technology
                         all rights reserved
    
     DESCRIPTION:
      This defines the identifiers for polymorphic classes.  The IDs are used 
    primarily for checking to be see if the two objects are the same type before
    doing a copy, for example.  The name is often used when printing out error
    messages so you'll know where things are happening.
      I hate to derive so many classes from the same base class, especially when 
    the derived classes are completely unrelated.  But this is a convenient way to
    enumerate the built-in classes, and they DO share the polymorphic behaviour
    (even if they do NOT share any other attributes).
    
     TO DO:
      I leave the id/classname implementation for backward compatibility.  Also, 
    as of fall98 there are still some systems that do not support RTTI (or environs
    that do not want to use RTTI for some reason or another).
      This whole thing will be replaced with a proper RTTI implementation as soon
    as RTTI is stable on all the platforms (and as soon as I have time to do the
    update).  So for now, I apologize for the 'hack'iness of this implementation.
    ---------------------------------------------------------------------------- */
    #ifndef _ga_id_h_
    #define _ga_id_h_
    
    class GAID {
    public:
      enum {
        BaseGA=0, SimpleGA, SteadyStateGA, IncrementalGA, DemeGA,
    
        Population=10, 
    
        Scaling=15, 
        NoScaling, LinearScaling, SigmaTruncationScaling, PowerLawScaling, Sharing,
    
        Selection=40,
        RankSelection, RouletteWheelSelection, TournamentSelection,
        UniformSelection, SRSSelection, DSSelection,
    
        Genome=50, 
        BinaryStringGenome, BinaryStringGenome2D, BinaryStringGenome3D, 
        Bin2DecGenome, 
        ListGenome,
        TreeGenome, 
        ArrayGenome, ArrayGenome2D, ArrayGenome3D, 
        ArrayAlleleGenome, ArrayAlleleGenome2D, ArrayAlleleGenome3D, 
        StringGenome, FloatGenome, IntGenome, DoubleGenome
      };
    
      int sameClass(const GAID &b) const {return(classID() == b.classID());} 
      virtual const char * className() const {return "no class";} 
      virtual int classID() const {return 0;}
    };
    
    
    // Here are the ID values for the GA library:
    //
    //    class                                  range
    //    ---------------------------------------------
    //    reserved                                0-199
    //    anyone can use these                     200-
    //
    // The ID numbers for built-in classes are enumerated in the GAID class.  Sorry
    // but I had to do the dimension at the end of the names rather than at the
    // beginning since you cannot use a digit to start a variable name.  
    //   If you derive your own polymorphic class or specialize a
    // template class, then give it its own ID number and class name in the
    // specialization (see the string and real number specializations for examples)
    //   Use these macros to define the identity for your class.  If you do not use
    // these macros then your object will be identity-less.
    //   Here's how to use the macro.
    //
    //     class GASimpleGA : public GA {
    //     public:
    //        GADefineClassIdentity("GASimpleGA", 1);
    //       ...
    //     };
    //
    //   Notice that your template classes will all have the same name using this
    // method unless you specialize.  For example, GA1DArrayGenome<char> and 
    // GA1DArrayGenome<int> will both have the name GA1DArrayGenome as well as 
    // the same number.  Beware.
    
    #define GADefineIdentity(name,id) \
         const char * className() const {return name;} \
         int classID() const {return id;}
    
    #define GADeclareIdentity() \
         const char * className() const; \
         int classID() const
    
    #define GADefineIdentitySRC(clss,name,id) \
    const char * clss :: className() const {return name;} \
    int clss :: classID() const {return id;}
    
    #endif

  19. #19
    Rédacteur
    Avatar de Laurent Gomila
    Profil pro
    Développeur informatique
    Inscrit en
    Avril 2003
    Messages
    10 651
    Détails du profil
    Informations personnelles :
    Âge : 40
    Localisation : France, Moselle (Lorraine)

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Avril 2003
    Messages : 10 651
    Points : 15 920
    Points
    15 920
    Par défaut
    Je ne vois rien de louche là-dedans. Est-ce que quelque part dans les inclusions, il pourrait y avoir un en-tête inclus avant celui-ci, et dont par exemple une erreur en fin de fichier pourrait provoquer une l'erreur que tu constates au début de gaid.h ?

  20. #20
    Membre à l'essai
    Profil pro
    Inscrit en
    Mars 2006
    Messages
    57
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2006
    Messages : 57
    Points : 15
    Points
    15
    Par défaut
    Citation Envoyé par Laurent Gomila
    Je ne vois rien de louche là-dedans. Est-ce que quelque part dans les inclusions, il pourrait y avoir un en-tête inclus avant celui-ci, et dont par exemple une erreur en fin de fichier pourrait provoquer une l'erreur que tu constates au début de gaid.h ?
    Je vais reprendre les #include dans l'ordre pour être sûr de ne rien oublier.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    GATest.cpp
    
    #include <stdio.h>
    #include <math.h>
    
    #include <ga/GASimpleGA.h>
    #include <ga/GABin2DecGenome.h>
    #include <ga/std_stream.h>
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    GASimpleGA.h
    
    #ifndef _ga_gasimple_h_
    #define _ga_gasimple_h_
    
    #include <ga/GABaseGA.h>
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    GABaseGA.h
    
    #ifndef _ga_gabase_h_
    #define _ga_gabase_h_
    
    #include <ga/gaconfig.h>
    #include <ga/gaid.h>
    #include <ga/GAParameter.h>
    #include <ga/GAStatistics.h>
    #include <ga/GAGenome.h>
    #include <ga/GAPopulation.h>
    Donc, à priori gaconfig.h passe avant gaid.h.

    Je suis en train de lire et relire gaconfig.h, mais je ne vois rien qui me choque dedans, il n'y a que des #define ou des déclarations dans le genre.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    444
    445
    446
    447
    448
    449
    450
    451
    452
    453
    454
    455
    456
    457
    458
    459
    460
    461
    462
    463
    464
    465
    466
    467
    468
    469
    470
    471
    472
    473
    474
    475
    476
    477
    478
    479
    480
    481
    482
    483
    484
    485
    486
    487
    488
    489
    490
    491
    492
    493
    494
    495
    496
    497
    498
    499
    500
    501
    502
    503
    504
    505
    506
    507
    508
    509
    510
    511
    512
    513
    514
    515
    516
    517
    518
    519
    520
    521
    522
    523
    524
    525
    526
    527
    528
    529
    530
    531
    532
    533
    534
    535
    536
    537
    538
    539
    540
    541
    542
    543
    544
    545
    546
    547
    548
    549
    550
    551
    552
    553
    554
    555
    556
    557
    558
    559
    560
    561
    562
    563
    564
    565
    566
    567
    568
    569
    570
    571
    572
    573
    574
    575
    576
    577
    578
    579
    580
    581
    582
    583
    584
    585
    586
    587
    588
    589
    590
    591
    592
    593
    594
    595
    596
    597
    598
    599
    600
    601
    602
    603
    604
    605
    606
    607
    608
    609
    610
    611
    612
    613
    614
    615
    616
    617
    618
    // $Header: /home/cvs/galib/ga/gaconfig.h,v 1.17 2005/01/31 15:46:09 mwall Exp $
    /* ----------------------------------------------------------------------------
      config.h
      mbwall 27jun95
      Copyright (c) 1995-1996 Massachusetts Institute of Technology
                              all rights reserved
      Copyright (c) 1998-2005 Matthew Wall
                              all rights reserved
    ---------------------------------------------------------------------------- */
    #ifndef _ga_config_h_
    #define _ga_config_h_
     
     
    /* ----------------------------------------------------------------------------
    PREPROCESSOR DIRECTIVES
     
      Here are the preprocessor directives that the library understands.
     
      Some of these are already set up for the OSes with which I am familiar.  See
    below for the pre-defined sets.  If you come up with a compiler/platform 
    configuration that is not listed here, please send it to me so that i can 
    incorporate it into the code base.
     
      GALIB_USE_ANSI_HEADERS
     
                          Some operating systems/compilers have old-style headers
                          (e.g. <iostream.h>) while others have new-school
    		      headers (e.g. <iostream>).  The default is to use
    		      ANSI headers.  If you are using an older compiler,
    		      make sure this variable is not defined.
     
      GALIB_USE_NAMED_TEMPLATES
      GALIB_USE_EMPTY_TEMPLATES
      GALIB_USE_COMP_OPERATOR_TEMPLATES
     
                          Some older compilers do not require strict, ansi template
    		      definitions.  And some compilers require slightly 
    		      different ways of specifying templates.  And to make it
    		      even more complicated, some depend very much on the type
    		      of instantiation method that is defined.  Sigh.
     
      GALIB_USE_STD_NAMESPACE
     
                          Some platforms need to explicitly use the std namespace
    		      when referring to streams and other std components, but
    		      others do not.
     
      GALIB_USE_STREAMS
     
                          For systems/environments in which streams are not desired
                          and/or required.  If this is not defined, it turns off 
                          errors and all of the read/write routines for the 
                          classes.
     
      GALIB_USE_RTTI
     
                          If your compiler supports RTTI, or if you turn on
                          the RTTI abilities of your compiler, then define this
                          macro.  Without RTTI, if improper casts are made,
    		      things will die horribly rather than dropping out in an
    		      RTTI-induced exception.
     
      GALIB_USE_PID
     
                         Define this if the system has a getpid function that
                         returns something sane and useful.
     
      GALIB_USE_NO_TEMPLATES
     
                          For compilers that do not do templates.  The only type
                          of genome available when this is defined is binary 
                          string and any derived classes.  list, tree, and array 
    		      all use templates.  You can still use the template code,
    		      but you will have to hack it yourself to make it work.
     
      GALIB_USE_BORLAND_INST
     
                          For compilers that use the Borland instantiation model.
                          These compilers expect all of the template code to be
    		      in the header file.  The Cfront model, on the other
                          hand, expects source files with names similar to the
    		      header files, but all of the template code does not
    		      need to be in the header files.
     
    		      When you define this flag, the source file that 
    		      corresponds to the header file is explicitly included
    		      at the end of the header file for all headers that
    		      contain templates.
     
      GALIB_USE_AUTO_INST
     
                          For compilers that do not do automatic instantiation
                          (such as g++ version 2.6.8) you will have to force
                          instantiations.  When this flag is not defined, GAlib
    		      forces an instantiation of all of the template classes
    		      that it uses (such as real genome and string genome).
     
      GALIB_HAVE_NOT_ASSERT
     
                          Some platforms do not have assert.  So for those
    		      platforms we define our own simple version of it.
     
     
     
      USE_GALIB_AS_LIB       For windows shared libraries, one must define whether
      USE_GALIB_AS_DLL       static member data are imported or exported.  You 
                             define one or the other of these, but not both.  The
    		  	 default is USE_GALIB_AS_LIB (if you define neither).
     
      COMPILE_GALIB_AS_LIB   If you are compiling the dome library, define one of
      COMPILE_GLAIB_AS_DLL   these to indicate the windows exports.  The default
                             is USE_GALIB_AS_LIB (if you define neither).
     
                    
       
      GALIB_USE_RAN1      These specify which random number function to use.  Only
      GALIB_USE_RAN2      one of these may be specified.  You may have to tweak 
      GALIB_USE_RAN3      random.h a bit as well (these functions are not defined 
      GALIB_USE_RAND      the same way on each platform).  For best results, use
      GALIB_USE_RANDOM    ran2 or ran3 (performance is slightly slower than most
      GALIB_USE_RAND48    system RNGs, but you'll get better results).
     
                          If you want to use another random number generator you
                          must hack random.h directly (see the comments in that
                          file).
     
      GALIB_BITBASE       The built-in type to use for bit conversions.  This 
                          should be set to the type of the largest integer that
                          your system supports.  If you have long long int then
                          use it.  If you don't plan to use more than 16 or 32
                          bits to represent your binary-to-decimal mappings then
                          you can use something smaller (long int for example).
                          If you do not set this, GAlib will automatically use
                          the size of a long int.  The bitbase determines the
    		      maximum number of bits you can use to represent a
    		      decimal number in the binary-to-decimal genomes.
     
      GALIB_BITS_IN_WORD  How many bits are in a word?  For many systems, a word is
                          a char and is 8 bits long.
     
    ---------------------------------------------------------------------------- */
     
    // This is a bare-bones os-cpu-compiler detection with no dependencies on any
    // other header files or macros.  We try to detect everything based on what we
    // will get by default from the compilers.  The result of this is three macros
    //   GALIB_OS
    //   GALIB_CPU
    //   GALIB_COMPILER
     
    // determine the operating system
    #if defined(__linux__)
    #define GALIB_OS "linux"
    #elif defined(__sgi)
    #define GALIB_OS "irix"
    #elif defined(WIN32)
    #define GALIB_OS "win32"
    #elif defined(sun)
    #define GALIB_OS "solaris"
    #elif defined(__APPLE__) && defined(__MACH__) && defined(__ppc__)
    #define GALIB_OS "macosx"
    #elif defined(macintosh)
    #define GALIB_OS "macos"
    #elif defined(HPUX10)
    #define GALIB_OS "hpux10"
    #elif defined(HPUX11)
    #define GALIB_OS "hpux11"
    #elif defined(_AIX) || defined(AIX)
    #define GALIB_OS "aix"
    #else
    #define GALIB_OS "unknown"
    #endif
     
    // determine the cpu
    #if defined(__INTEL__) || defined(__i386__) || \
        defined(__x86__) || defined(_M_IX86)
    #define GALIB_CPU "i386"
    #elif defined(__POWERPC__) || defined(__PPC__) || \
          defined(__powerpc__) || defined(__ppc__) || \
          defined(_POWER)
    #define GALIB_CPU "ppc"
    #elif defined(__m68k__)
    #define GALIB_CPU "68k"
    #elif defined(__sgi)
    #define GALIB_CPU "mips"
    #elif defined(sparc) || defined(__sparc__)
    #define GALIB_CPU "sparc"
    #elif defined(__HP_aCC)
    #define GALIB_CPU "hppa"
    #else
    #define GALIB_CPU "unknown"
    #endif
     
    // determine the compiler
    #if defined(__GNUG__) || defined(__GNUC__)
    #if __GNUC__ == 3
    #define GALIB_COMPILER "gcc3"
    #elif __GNUC__ == 2
    #define GALIB_COMPILER "gcc2"
    #else
    #define GALIB_COMPILER "gcc"
    #endif
    #elif defined(__BORLANDC__)
    #if __BORLANDC__ < 0x500
    #define GALIB_COMPILER "bcc4"
    #elif __BORLANDC__ < 0x530
    #define GALIB_COMPILER "bcc52"
    #elif __BORLANDC__ < 0x540
    #define GALIB_COMPILER "bcc53"
    #elif __BORLANDC__ < 0x550
    #define GALIB_COMPILER "bcc54"
    #elif __BORLANDC__ < 0x560
    #define GALIB_COMPILER "bcc55"
    #else
    #define GALIB_COMPILER "bcc"
    #endif
    #elif defined(__WATCOMC__)
    #define GALIB_COMPILER "watcom"
    #elif defined(_MIPS_SIM)
    #define GALIB_COMPILER "mipscc"
    #elif defined(__MWERKS__)
    #define GALIB_COMPILER "mwerks"
    #elif defined(_MSC_VER)
    #if _MSC_VER == 1300
    #define GALIB_COMPILER "vcpp7"
    #elif _MSC_VER == 1200
    #define GALIB_COMPILER "vcpp6"
    #else
    #define GALIB_COMPILER "vcpp"
    #endif
    #elif defined(__HP_aCC)
    #define GALIB_COMPILER "acc"
    #elif defined(__IBMCPP__)
    #define GALIB_COMPILER "xlc"
    #else
    #define GALIB_COMPILER "unknown"
    #endif
     
     
     
    // ----------------------------------------------------------------------------
    // Here are the defines needed for some of the compilers/OSes on which I have
    // been able to test the GA library.  You may have to remove and/or modify
    // these to get things to work on your system.
    // ----------------------------------------------------------------------------
     
    // ----------------------------------------------------------------------------
    // Metrowerks' Codewarrior for MacOS, PalmOS, or Win32 (I have not tested CW
    // on other platforms yet).
    #if defined(__MWERKS__)
    #define GALIB_USE_STREAMS
    #define GALIB_USE_BORLAND_INST
    #define GALIB_USE_AUTO_INST
    #if __option(RTTI)
    #define GALIB_USE_RTTI
    #endif
     
     
    // ----------------------------------------------------------------------------
    // Symantec C++ for mac.  This compiler does not handle templates very well, 
    // so if you want to use any of the template components of GAlib then you will
    // probably have to do some hacking to get things to work.
    #elif defined(__SC__)
    #define GALIB_USE_STREAMS
    #define GALIB_USE_BORLAND_INST
     
     
    // ----------------------------------------------------------------------------
    // THINK for mac
    #elif defined(THINK_C)
    #define GALIB_USE_STREAMS
    #define GALIB_USE_BORLAND_INST
    #define GALIB_USE_COMP_OPERATOR_TEMPLATES
     
     
    // ----------------------------------------------------------------------------
    // borland c++ compiler
    //
    // You may or may not need the BORLAND_INST flag defined when you use a borland
    // compiler.  I did not need it when I compiled using version 4.0, but I did
    // need it when I compiled with an earlier version (I think it was 3.x but I
    // do not remember for certain).
    //   Note that the default random number generator when using a borland (or
    // any PC compiler, for that matter) is the basic system's RNG.
    // I did this because of the hassles of 16- vs 32-bit DOS/Windows rubbish.  If
    // you want a better RNG, you can use the others in GAlib, but you'll have to
    // do a bit of checking to make sure it works with your DOS/Windows config.
    // All of the RNGs work fine under all of the 32-bit OSes I've tried, but they
    // don't do so well in a 16-bit OS.
    //  Use the randtest example to check GAlib's RNG after you compile everything.
    #elif defined(__BORLANDC__)
    //#define GALIB_USE_RAND	// comment this if you're using a 32-bit OS
    #define GALIB_USE_RTTI
    #define GALIB_USE_BORLAND_INST
    #define GALIB_USE_STREAMS
    //#define GALIB_USE_PID
    #define GALIB_USE_EMPTY_TEMPLATES
    //#define GALIB_USE_ANSI_HEADERS
    //#define GALIB_USE_STD_NAMESPACE
    //#define GALIB_USE_COMP_OPERATOR_TEMPLATES
     
    //#pragma warning (disable : 8027)    // switch statements are not inlined
    //#pragma warning (disable : 8004)    // unused variable warnings are lame
     
     
    // ----------------------------------------------------------------------------
    // MicroSoft's Visual C++ programming environment.
    //
    // this has been test with:
    //   vcpp6 (12.00.8804)
    //   vcpp6 (12.00.8168)
    //   vcpp7 (13.00.9466)
    //   vcpp7 (13.10.3077)
    //
    #elif defined(_MSC_VER)
    // visual studio uses the borland model of template instantiation.
    #define GALIB_USE_BORLAND_INST
    // let visual studio do its own instantations, so by default do not force them.
    #define GALIB_USE_AUTO_INST
    // use ansi headers with vcpp7.  it is a good idea to use them in vcpp6 as well
    // but some vcpp6 apps are built with non-ansi headers, in which case you 
    // should build with the non-ansi headers so that you do not cross the streams.
    #define GALIB_USE_ANSI_HEADERS
    // beware of using streams in an MFC application.  many nasties lurk therein...
    #define GALIB_USE_STREAMS
    // we default to using std things in the std namespace, but depending on the
    // version of vcpp you are using and depending on the libraries with which you
    // will use GAlib, you might have to turn this one off.
    #define GALIB_USE_STD_NAMESPACE
    // use the pid only on winnt and derivatives.  win95/98/ME do not have it.
    // this requires unistd.h, which you may or may not have (depending on the 
    // way that you installed the compiler).
    //#define GALIB_USE_PID
    // GAlib behaves much better in unknown conditions when rtti is enabled, but
    // you might have to disable it, depending on the linkage and compilation 
    // options you need for other components you are using with GAlib.
    #if defined(_CPPRTTI)
    #define GALIB_USE_RTTI
    #else
    #undef GALIB_USE_RTTI
    #endif
     
    // there are many warnings from vcpp, many of which we can safely ignore.
    //#pragma warning (disable : 4244)    // int-to-float warnings
    #pragma warning (disable : 4305)    // double-to-float warnings
    #pragma warning (disable : 4355)    // allow us to use this in constructors
    //#pragma warning (disable : 4250)    // dominated multiple inherits
     
     
    // ----------------------------------------------------------------------------
    // GNU compiler
    //
    // there are some subtle differences in the way the gcc compiler handles
    // templates from one version to another.  the latest versions are much more
    // strictly adherant to the c++ standards, although you can relax that with
    // the permissive option.  we try to build this library without the use of the
    // permissive option.
    //
    // there are significant changes between the 3.3 and 3.4 releases of gcc.  and
    // of course there are major differences between the 2.x and 3.x versions, but
    // those affect us mostly with respect to the use of the std libraries.
    #elif defined(__GNUG__)
    #define GALIB_USE_RTTI
    #define GALIB_USE_BORLAND_INST
    #define GALIB_USE_STREAMS
    #define GALIB_USE_PID
    #define GALIB_USE_EMPTY_TEMPLATES
    #define GALIB_NEED_INSTANTIATION_PREFIX
    #if __GNUC__ == 3
    #define GALIB_USE_ANSI_HEADERS
    #define GALIB_USE_STD_NAMESPACE
    #define GALIB_USE_COMP_OPERATOR_TEMPLATES
    #endif
     
     
    // ----------------------------------------------------------------------------
    // irix 5.3 and irix 6.x
    #elif defined(__sgi)
    #define GALIB_USE_STREAMS
    #define GALIB_USE_PID
     
    #include <sgidefs.h>
    #if (_MIPS_SIM == _MIPS_SIM_NABI32)
    #define GALIB_USE_RTTI
    #define GALIB_USE_AUTO_INST
    #define GALIB_USE_BORLAND_INST
    #elif (_MIPS_SIM == _MIPS_SIM_ABI64)
    #define GALIB_USE_RTTI
    #elif (_MIPS_SIM == _MIPS_SIM_ABI32)
    #define GALIB_USE_AUTO_INST
    #endif
     
     
    // ----------------------------------------------------------------------------
    // IBM visual age c++ compiler
    #elif defined(__IBMCPP__)
    // the -qrtti option turns rtti on and off, but i do not know the
    // corresponding preprocessor directive to sense it.
    #define GALIB_USE_RTTI
    #define GALIB_USE_BORLAND_INST
    #define GALIB_USE_AUTO_INST
    #define GALIB_USE_ANSI_HEADERS
    #define GALIB_USE_STREAMS
    #define GALIB_USE_STD_NAMESPACE
    #define GALIB_USE_PID
    #define GALIB_USE_NAMED_TEMPLATES
     
     
    // ----------------------------------------------------------------------------
    // HP aCC compiler
    #elif defined(__HP_aCC)
    #define GALIB_USE_RTTI
    #define GALIB_USE_BORLAND_INST
    #define GALIB_USE_AUTO_INST
    //#define GALIB_USE_ANSI_HEADERS
    #define GALIB_USE_STREAMS
    //#define GALIB_USE_STD_NAMESPACE
    #define GALIB_USE_PID
     
    //#pragma disable warning 829 // do not care about string literal conversions
     
     
    // ----------------------------------------------------------------------------
    // This is an unknown/untested platform and/or compiler.  The defaults below 
    // might work for you, but then again, they might not.  You may have to adjust
    // the values of the macros until everything works properly.  Comment out the
    // #error directive to allow things to compile properly.
    #else
    #error   Unknown/untested compiler/operating system!  Check these settings!
     
    #define GALIB_USE_RTTI
    #define GALIB_USE_BORLAND_INST
    #define GALIB_USE_AUTO_INST
    #define GALIB_USE_ANSI_HEADERS
    #define GALIB_USE_STREAMS
    #define GALIB_USE_STD_NAMESPACE
    #define GALIB_USE_PID
    #endif
     
     
     
     
     
     
     
     
     
     
     
    // deal with assertions.  at some point we might want a proper definition of 
    // assert here for platforms that do not have it.
    #if defined(GALIB_HAVE_NOT_ASSERT)
    #include <stdlib.h>
    #define assert(x) \
      { \
        if(! (x)) { \
          fprintf(stderr, "assertion failed at line %d in file %s\n", \
    	      __LINE__, __FILE__); \
          exit(1); \
        } \
      }
    #else
    #include <assert.h>
    #endif
     
     
    // some compilers use one syntax, others use a different syntax.
    #if defined(GALIB_NEED_INSTANTIATION_PREFIX)
    #define GALIB_INSTANTIATION_PREFIX template class
    #else
    #define GALIB_INSTANTIATION_PREFIX
    #endif
     
     
    // If no RNG has been selected, use the ran2 generator by default
    #if !defined(GALIB_USE_RAND) && \
        !defined(GALIB_USE_RANDOM) && \
        !defined(GALIB_USE_RAND48) && \
        !defined(GALIB_USE_RAN2) && \
        !defined(GALIB_USE_RAN3)
    #define GALIB_USE_RAN2
    #endif
     
     
    // This defines how many bits are in a single word on your system.  Most 
    // systems have a word length of 8 bits.
    #ifndef GALIB_BITS_IN_WORD
    #define GALIB_BITS_IN_WORD 8
    #endif
     
     
    // Use this to set the maximum number of bits that can be used in binary-to-
    // decimal conversions.  You should make this type the largest integer type 
    // that your system supports.
    #ifndef GALIB_BITBASE
    #define GALIB_BITBASE long int
    #endif
     
     
    // If the system/compiler understands C++ casts, then we use them.  Otherwise
    // we default to the C-style casts.  The macros make explicit the fact that we
    // are doing casts.
    #if defined(GALIB_USE_RTTI)
    #define DYN_CAST(type,x) (dynamic_cast<type>(x))
    #define CON_CAST(type,x) (const_cast<type>(x))
    #define STA_CAST(type,x) (static_cast<type>(x))
    #define REI_CAST(type,x) (reinterpret_cast<type>(x))
    #else
    #define DYN_CAST(type,x) ((type)(x))
    #define CON_CAST(type,x) ((type)(x))
    #define STA_CAST(type,x) ((type)(x))
    #define REI_CAST(type,x) ((type)(x))
    #endif
     
     
    // Windows is brain-dead about how to export things, so we do this to keep the
    // code (somewhat) cleaner but still accomodate windows' stupidity.
    #if defined(COMPILE_GALIB_AS_DLL)
    #define GA_DLLDECL __declspec(dllexport)
    #elif defined(USE_GALIB_AS_DLL)
    #define GA_DLLDECL __declspec(dllimport)
    #else
    #define GA_DLLDECL
    #endif
     
     
     
     
     
     
    /* ----------------------------------------------------------------------------
    DEFAULT OPERATORS
     
      These directives determine which operators will be used by default for each
    of the objects in GAlib.
    ---------------------------------------------------------------------------- */
    // scaling schemes
    #define USE_LINEAR_SCALING           1
    #define USE_SIGMA_TRUNC_SCALING      1
    #define USE_POWER_LAW_SCALING        1
    #define USE_SHARING                  1
     
    // selection schemes
    #define USE_RANK_SELECTOR            1
    #define USE_ROULETTE_SELECTOR        1
    #define USE_TOURNAMENT_SELECTOR      1
    #define USE_DS_SELECTOR              1
    #define USE_SRS_SELECTOR             1
    #define USE_UNIFORM_SELECTOR         1
     
    // These are the compiled-in defaults for various genomes and GA objects
    #define DEFAULT_SCALING              GALinearScaling
    #define DEFAULT_SELECTOR             GARouletteWheelSelector
    #define DEFAULT_TERMINATOR           TerminateUponGeneration
     
    #define DEFAULT_1DBINSTR_INITIALIZER UniformInitializer
    #define DEFAULT_1DBINSTR_MUTATOR     FlipMutator
    #define DEFAULT_1DBINSTR_COMPARATOR  BitComparator
    #define DEFAULT_1DBINSTR_CROSSOVER   OnePointCrossover
    #define DEFAULT_2DBINSTR_INITIALIZER UniformInitializer
    #define DEFAULT_2DBINSTR_MUTATOR     FlipMutator
    #define DEFAULT_2DBINSTR_COMPARATOR  BitComparator
    #define DEFAULT_2DBINSTR_CROSSOVER   OnePointCrossover
    #define DEFAULT_3DBINSTR_INITIALIZER UniformInitializer
    #define DEFAULT_3DBINSTR_MUTATOR     FlipMutator
    #define DEFAULT_3DBINSTR_COMPARATOR  BitComparator
    #define DEFAULT_3DBINSTR_CROSSOVER   OnePointCrossover
     
    #define DEFAULT_BIN2DEC_ENCODER      GABinaryEncode
    #define DEFAULT_BIN2DEC_DECODER      GABinaryDecode
    #define DEFAULT_BIN2DEC_COMPARATOR   BitComparator
     
    #define DEFAULT_1DARRAY_INITIALIZER  NoInitializer
    #define DEFAULT_1DARRAY_MUTATOR      SwapMutator
    #define DEFAULT_1DARRAY_COMPARATOR   ElementComparator
    #define DEFAULT_1DARRAY_CROSSOVER    OnePointCrossover
    #define DEFAULT_2DARRAY_INITIALIZER  NoInitializer
    #define DEFAULT_2DARRAY_MUTATOR      SwapMutator
    #define DEFAULT_2DARRAY_COMPARATOR   ElementComparator
    #define DEFAULT_2DARRAY_CROSSOVER    OnePointCrossover
    #define DEFAULT_3DARRAY_INITIALIZER  NoInitializer
    #define DEFAULT_3DARRAY_MUTATOR      SwapMutator
    #define DEFAULT_3DARRAY_COMPARATOR   ElementComparator
    #define DEFAULT_3DARRAY_CROSSOVER    OnePointCrossover
     
    #define DEFAULT_1DARRAY_ALLELE_INITIALIZER  UniformInitializer
    #define DEFAULT_1DARRAY_ALLELE_MUTATOR      FlipMutator
    #define DEFAULT_1DARRAY_ALLELE_COMPARATOR   ElementComparator
    #define DEFAULT_1DARRAY_ALLELE_CROSSOVER    OnePointCrossover
    #define DEFAULT_2DARRAY_ALLELE_INITIALIZER  UniformInitializer
    #define DEFAULT_2DARRAY_ALLELE_MUTATOR      FlipMutator
    #define DEFAULT_2DARRAY_ALLELE_COMPARATOR   ElementComparator
    #define DEFAULT_2DARRAY_ALLELE_CROSSOVER    OnePointCrossover
    #define DEFAULT_3DARRAY_ALLELE_INITIALIZER  UniformInitializer
    #define DEFAULT_3DARRAY_ALLELE_MUTATOR      FlipMutator
    #define DEFAULT_3DARRAY_ALLELE_COMPARATOR   ElementComparator
    #define DEFAULT_3DARRAY_ALLELE_CROSSOVER    OnePointCrossover
     
    #define DEFAULT_STRING_INITIALIZER   UniformInitializer
    #define DEFAULT_STRING_MUTATOR       FlipMutator
    #define DEFAULT_STRING_COMPARATOR    ElementComparator
    #define DEFAULT_STRING_CROSSOVER     UniformCrossover
     
    #define DEFAULT_REAL_INITIALIZER     UniformInitializer
    #define DEFAULT_REAL_MUTATOR         GARealGaussianMutator
    #define DEFAULT_REAL_COMPARATOR      ElementComparator
    #define DEFAULT_REAL_CROSSOVER       UniformCrossover
     
    #define DEFAULT_TREE_INITIALIZER     NoInitializer
    #define DEFAULT_TREE_MUTATOR         SwapSubtreeMutator
    #define DEFAULT_TREE_COMPARATOR      TopologyComparator
    #define DEFAULT_TREE_CROSSOVER       OnePointCrossover
     
    #define DEFAULT_LIST_INITIALIZER     NoInitializer
    #define DEFAULT_LIST_MUTATOR         SwapMutator
    #define DEFAULT_LIST_COMPARATOR      NodeComparator
    #define DEFAULT_LIST_CROSSOVER       OnePointCrossover
     
    #endif

+ Répondre à la discussion
Cette discussion est résolue.
Page 1 sur 2 12 DernièreDernière

Discussions similaires

  1. Réponses: 3
    Dernier message: 10/02/2016, 12h42
  2. [HTML 5] Fin de fichier inattendue
    Par Fused dans le forum Balisage (X)HTML et validation W3C
    Réponses: 2
    Dernier message: 03/05/2011, 09h44
  3. [Flex] flex.. fin de fichier inattendue
    Par lellaBaya dans le forum Générateurs de compilateur
    Réponses: 3
    Dernier message: 19/11/2008, 14h29
  4. Erreur fin de fichier atteinte
    Par VLDG dans le forum Firebird
    Réponses: 8
    Dernier message: 01/04/2008, 23h08
  5. "error : fin de fichier inattendue" en C++
    Par mateo.14 dans le forum MFC
    Réponses: 9
    Dernier message: 28/01/2005, 09h30

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo