- Main Page
- Classes
- Files

- Search for |

# make_eval_FlowShop.h

    00001 // -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
    00002
    00003 //-----------------------------------------------------------------------------
    00004 // make_eval_FlowShop.h
    00005 // (c) OPAC Team (LIFL), Dolphin Project (INRIA), 2007
    00006 /*
    00007     This library...
    00008
    00009     Contact: paradiseo-help@lists.gforge.inria.fr, http://paradiseo.gforge.inria.fr
    00010  */
    00011 //-----------------------------------------------------------------------------
    00012
    00013 #ifndef MAKE_EVAL_FLOWSHOP_H_
    00014 #define MAKE_EVAL_FLOWSHOP_H_
    00015
    00016
    00017 #include <utils/eoParser.h>
    00018 #include <utils/eoState.h>
    00019 #include <eoEvalFuncCounter.h>
    00020 #include <FlowShop.h>
    00021 #include <FlowShopBenchmarkParser.h>
    00022 #include <FlowShopEval.h>
    00023
    00024 /*
    00025  * This function creates an eoEvalFuncCounter<eoFlowShop> that can later be used to evaluate an individual.
    00026  * @param eoParser& _parser  to get user parameters
    00027  * @param eoState& _state  to store the memory
    00028  */
    00029 eoEvalFuncCounter<FlowShop> & do_make_eval(eoParser& _parser, eoState& _state)
    00030 {
    00031     // benchmark file name
    00032     std::string benchmarkFileName = _parser.getORcreateParam(std::string(), "BenchmarkFile", "Benchmark file name (benchmarks are available at www.lifl.fr/~liefooga/benchmarks)", 'B',"Representation", true).value();
    00033     if (benchmarkFileName == "") {
    00034         std::string stmp = "*** Missing name of the benchmark file\n";
    00035         stmp += "    Type '-B=the_benchmark_file_name' or '--BenchmarkFile=the_benchmark_file_name'\n";
    00036         stmp += "    Benchmarks files are available at www.lifl.fr/~liefooga/benchmarks";
    00037         throw std::runtime_error(stmp.c_str());
    00038     }
    00039     // reading of the parameters contained in the benchmark file
    00040     FlowShopBenchmarkParser fParser(benchmarkFileName);
    00041     unsigned int M = fParser.getM();
    00042     unsigned int N = fParser.getN();
    00043     std::vector< std::vector<unsigned int> > p = fParser.getP();
    00044     std::vector<unsigned int> d = fParser.getD();
    00045     // build of the initializer (a pointer, stored in the eoState)
    00046     FlowShopEval* plainEval = new FlowShopEval(M, N, p, d);
    00047     // turn that object into an evaluation counter
    00048     eoEvalFuncCounter<FlowShop>* eval = new eoEvalFuncCounter<FlowShop> (* plainEval);
    00049     // store in state
    00050     _state.storeFunctor(eval);
    00051     // and return a reference
    00052     return *eval;
    00053 }
    00054
    00055 #endif /*MAKE_EVAL_FLOWSHOP_H_*/