00001 /* 00002 * Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007 00003 * (C) OPAC Team, LIFL, 2002-2007 00004 * 00005 * (c) Antonio LaTorre <atorre@fi.upm.es>, 2007 00006 * 00007 * This software is governed by the CeCILL license under French law and 00008 * abiding by the rules of distribution of free software. You can use, 00009 * modify and/ or redistribute the software under the terms of the CeCILL 00010 * license as circulated by CEA, CNRS and INRIA at the following URL 00011 * "http://www.cecill.info". 00012 * 00013 * As a counterpart to the access to the source code and rights to copy, 00014 * modify and redistribute granted by the license, users are provided only 00015 * with a limited warranty and the software's author, the holder of the 00016 * economic rights, and the successive licensors have only limited liability. 00017 * 00018 * In this respect, the user's attention is drawn to the risks associated 00019 * with loading, using, modifying and/or developing or reproducing the 00020 * software by the user in light of its specific status of free software, 00021 * that may mean that it is complicated to manipulate, and that also 00022 * therefore means that it is reserved for developers and experienced 00023 * professionals having in-depth computer knowledge. Users are therefore 00024 * encouraged to load and test the software's suitability as regards their 00025 * requirements in conditions enabling the security of their systems and/or 00026 * data to be ensured and, more generally, to use and operate it in the 00027 * same conditions as regards security. 00028 * The fact that you are presently reading this means that you have had 00029 * knowledge of the CeCILL license and that you accept its terms. 00030 * 00031 * ParadisEO WebSite : http://paradiseo.gforge.inria.fr 00032 * Contact: paradiseo-help@lists.gforge.inria.fr 00033 * 00034 */ 00035 00036 #ifndef _eoVRPEvalFunc_h 00037 #define _eoVRPEvalFunc_h 00038 00039 // General includes 00040 #include <stdexcept> 00041 #include <fstream> 00042 00043 // The base definition of eoEvalFunc 00044 #include "eoEvalFunc.h" 00045 00046 // Utilities for the VRP-TW problem 00047 #include "eoVRPUtils.h" 00048 00054 class eoVRPEvalFunc : public eoEvalFunc<eoVRP> { 00055 00056 public: 00057 00062 eoVRPEvalFunc () { 00063 00064 } 00065 00066 00072 void operator () (eoVRP& _eo) { 00073 00074 double fit = 0.0; 00075 00076 if (_eo.decoded ()) { 00077 00078 if (_eo.invalid ()) { 00079 00080 std::cerr << "Warning: invalid individual presents decoding information." << std::endl; 00081 fit = _eo.decode (); 00082 00083 } 00084 else 00085 fit = _eo.length (); 00086 00087 } 00088 else { 00089 00090 if (!_eo.invalid ()) { 00091 00092 std::cerr << "Warning: valid individual does not present decoding information." << std::endl; 00093 std::cerr << " Proceeding to decode..." << std::endl; 00094 00095 } 00096 00097 fit = _eo.decode (); 00098 00099 } 00100 00101 _eo.fitness (fit); 00102 00103 } 00104 00105 00106 private: 00107 00108 00109 }; 00110 00111 #endif
1.4.7