now we use the permutation stuffs from EO

git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@959 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
liefooga 2008-02-15 13:25:56 +00:00
commit 0c8d0c5f08
6 changed files with 9 additions and 229 deletions

View file

@ -50,13 +50,10 @@ SET(FLOWSHOP_LIB_OUTPUT_PATH ${FLOWSHOP_BINARY_DIR}/lib)
SET(LIBRARY_OUTPUT_PATH ${FLOWSHOP_LIB_OUTPUT_PATH})
SET (FLOWSHOP_SOURCES FlowShopBenchmarkParser.cpp
FlowShopEval.cpp
FlowShopInit.cpp
FlowShopObjectiveVectorTraits.cpp
FlowShopOpCrossoverQuad.cpp
FlowShopOpMutationExchange.cpp
FlowShopOpMutationShift.cpp
FlowShop.cpp)
FlowShopEval.cpp
FlowShopObjectiveVectorTraits.cpp
FlowShopOpCrossoverQuad.cpp
FlowShop.cpp)
ADD_LIBRARY(flowshop STATIC ${FLOWSHOP_SOURCES})
ADD_DEPENDENCIES(flowshop moeo)

View file

@ -44,29 +44,6 @@
/**
* Initialization of a random genotype built by the default constructor of the FlowShop class
*/
class FlowShopInit : public eoInit<FlowShop>
{
public:
/**
* Ctor
* @param _N the number of jobs to schedule
*/
FlowShopInit(unsigned int _N);
/**
* builds a random genotype
* @param _flowshop a genotype that has been default-constructed
*/
void operator()(FlowShop & _flowshop);
private:
/** the number of jobs (size of a scheduling vector) */
unsigned int N;
};
typedef eoInitPermutation<FlowShop> FlowShopInit;
#endif /*FLOWSHOPINIT_H_*/

View file

@ -1,76 +0,0 @@
/*
* <FlowShopOpMutationExchange.cpp>
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
* (C) OPAC Team, LIFL, 2002-2007
*
* Arnaud Liefooghe
*
* This software is governed by the CeCILL license under French law and
* abiding by the rules of distribution of free software. You can use,
* modify and/ or redistribute the software under the terms of the CeCILL
* license as circulated by CEA, CNRS and INRIA at the following URL
* "http://www.cecill.info".
*
* As a counterpart to the access to the source code and rights to copy,
* modify and redistribute granted by the license, users are provided only
* with a limited warranty and the software's author, the holder of the
* economic rights, and the successive licensors have only limited liability.
*
* In this respect, the user's attention is drawn to the risks associated
* with loading, using, modifying and/or developing or reproducing the
* software by the user in light of its specific status of free software,
* that may mean that it is complicated to manipulate, and that also
* therefore means that it is reserved for developers and experienced
* professionals having in-depth computer knowledge. Users are therefore
* encouraged to load and test the software's suitability as regards their
* requirements in conditions enabling the security of their systems and/or
* data to be ensured and, more generally, to use and operate it in the
* same conditions as regards security.
* The fact that you are presently reading this means that you have had
* knowledge of the CeCILL license and that you accept its terms.
*
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
* Contact: paradiseo-help@lists.gforge.inria.fr
*
*/
//-----------------------------------------------------------------------------
#include <FlowShopOpMutationExchange.h>
std::string FlowShopOpMutationExchange::className() const
{
return "FlowShopOpMutationExchange";
}
bool FlowShopOpMutationExchange::operator()(FlowShop & _flowshop)
{
bool isModified;
FlowShop result = _flowshop;
// computation of the 2 random points
unsigned int point1, point2;
do
{
point1 = rng.random(result.size());
point2 = rng.random(result.size());
}
while (point1 == point2);
// swap
std::swap (result[point1], result[point2]);
// update (if necessary)
if (result != _flowshop)
{
// update
_flowshop.value(result);
// the genotype has been modified
isModified = true;
}
else
{
// the genotype has not been modified
isModified = false;
}
// return 'true' if the genotype has been modified
return isModified;
}

View file

@ -38,28 +38,12 @@
#ifndef FLOWSHOPOPMUTATIONEXCHANGE_H_
#define FLOWSHOPOPMUTATIONEXCHANGE_H_
#include <eoOp.h>
#include <eoSwapMutation.h>
#include <FlowShop.h>
/**
* Exchange mutation operator for the flow-shop
*/
class FlowShopOpMutationExchange : public eoMonOp<FlowShop>
{
public:
/**
* the class name (used to display statistics)
*/
std::string className() const;
/**
* modifies the parent with an exchange mutation
* @param _flowshop the parent genotype (will be modified)
*/
bool operator()(FlowShop & _flowshop);
};
typedef eoSwapMutation<FlowShop> FlowShopOpMutationExchange;
#endif /*FLOWSHOPOPMUTATIONEXCHANGE_H_*/

View file

@ -1,86 +0,0 @@
/*
* <FlowShopOpMutationShift.cpp>
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
* (C) OPAC Team, LIFL, 2002-2007
*
* Arnaud Liefooghe
*
* This software is governed by the CeCILL license under French law and
* abiding by the rules of distribution of free software. You can use,
* modify and/ or redistribute the software under the terms of the CeCILL
* license as circulated by CEA, CNRS and INRIA at the following URL
* "http://www.cecill.info".
*
* As a counterpart to the access to the source code and rights to copy,
* modify and redistribute granted by the license, users are provided only
* with a limited warranty and the software's author, the holder of the
* economic rights, and the successive licensors have only limited liability.
*
* In this respect, the user's attention is drawn to the risks associated
* with loading, using, modifying and/or developing or reproducing the
* software by the user in light of its specific status of free software,
* that may mean that it is complicated to manipulate, and that also
* therefore means that it is reserved for developers and experienced
* professionals having in-depth computer knowledge. Users are therefore
* encouraged to load and test the software's suitability as regards their
* requirements in conditions enabling the security of their systems and/or
* data to be ensured and, more generally, to use and operate it in the
* same conditions as regards security.
* The fact that you are presently reading this means that you have had
* knowledge of the CeCILL license and that you accept its terms.
*
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
* Contact: paradiseo-help@lists.gforge.inria.fr
*
*/
//-----------------------------------------------------------------------------
#include <FlowShopOpMutationShift.h>
std::string FlowShopOpMutationShift::className() const
{
return "FlowShopOpMutationShift";
}
bool FlowShopOpMutationShift::operator()(FlowShop & _flowshop)
{
bool isModified;
int direction;
unsigned int tmp;
FlowShop result = _flowshop;
// computation of the 2 random points
unsigned int point1, point2;
do
{
point1 = rng.random(result.size());
point2 = rng.random(result.size());
}
while (point1 == point2);
// direction
if (point1 < point2)
direction = 1;
else
direction = -1;
// mutation
tmp = result[point1];
for (unsigned int i=point1 ; i!=point2 ; i+=direction)
result[i] = result[i+direction];
result[point2] = tmp;
// update (if necessary)
if (result != _flowshop)
{
// update
_flowshop.value(result);
// the genotype has been modified
isModified = true;
}
else
{
// the genotype has not been modified
isModified = false;
}
// return 'true' if the genotype has been modified
return isModified;
}

View file

@ -38,28 +38,12 @@
#ifndef FLOWSHOPOPMUTATIONSHIFT_H_
#define FLOWSHOPOPMUTATIONSHIFT_H_
#include <eoOp.h>
#include <eoShiftMutation.h>
#include <FlowShop.h>
/**
* Shift mutation operator for flow-shop
*/
class FlowShopOpMutationShift : public eoMonOp < FlowShop >
{
public:
/**
* the class name (used to display statistics)
*/
std::string className() const;
/**
* modifies the parent with a shift mutation
* @param _flowshop the parent genotype (will be modified)
*/
bool operator()(FlowShop & _flowshop);
};
typedef eoShiftMutation<FlowShop> FlowShopOpMutationShift;
#endif /*FLOWSHOPOPMUTATIONSHIFT_H_*/