- Main Page
- Classes
- Files

- Search for |

# moItRandNextMove.h

    00001 // -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
    00002
    00003 // "moNextMove.h"
    00004
    00005 // (c) OPAC Team, LIFL, 2003-2006
    00006
    00007 /* LICENCE TEXT
    00008
    00009    Contact: paradiseo-help@lists.gforge.inria.fr
    00010 */
    00011
    00012 #ifndef __moItRandNextMove_h
    00013 #define __moItRandNextMove_h
    00014
    00015 #include "moNextMove.h"
    00016 #include "moRandMove.h"
    00017
    00019
    00022 template < class M > class moItRandNextMove:public moNextMove < M >
    00023 {
    00024
    00026   typedef typename M::EOType EOT;
    00027
    00028 public:
    00029
    00031
    00037   moItRandNextMove (moRandMove < M > &__rand_move,
    00038                     unsigned __max_iter):rand_move (__rand_move),
    00039     max_iter (__max_iter), num_iter (0)
    00040   {
    00041
    00042   }
    00043
    00045
    00052   bool operator   () (M & __move, const EOT & __sol)
    00053   {
    00054
    00055     if (num_iter++ > max_iter)
    00056       {
    00057
    00058         num_iter = 0;
    00059         return false;
    00060       }
    00061     else
    00062       {
    00063
    00064         /* The given solution is discarded here */
    00065         rand_move (__move);
    00066         num_iter++;
    00067         return true;
    00068       }
    00069   }
    00070
    00071 private:
    00072
    00074   moRandMove < M > &rand_move;
    00075
    00077   unsigned max_iter;
    00078
    00080   unsigned num_iter;
    00081
    00082 };
    00083
    00084 #endif