# ParadisEO-MOEOMovingObjects: make_genotype_FlowShop.h Source File

# make_genotype_FlowShop.h

    00001 // -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
    00002
    00003 //-----------------------------------------------------------------------------
    00004 // make_genotype_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_GENOTYPE_FLOWSHOP_H_
    00014 #define MAKE_GENOTYPE_FLOWSHOP_H_
    00015
    00016 #include <utils/eoParser.h>
    00017 #include <utils/eoState.h>
    00018 #include <FlowShop.h>
    00019 #include <FlowShopInit.h>
    00020 #include <FlowShopBenchmarkParser.h>
    00021
    00022 /*
    00023  * This function creates an eoInit<eoFlowShop> that can later be used to initialize the population (see make_pop.h).
    00024  * @param eoParser& _parser  to get user parameters
    00025  * @param eoState& _state  to store the memory
    00026  */
    00027 eoInit<FlowShop> & do_make_genotype(eoParser& _parser, eoState& _state)
    00028 {
    00029     // benchmark file name
    00030     std::string benchmarkFileName = _parser.getORcreateParam(std::string(), "BenchmarkFile", "Benchmark file name (benchmarks are available at www.lifl.fr/~liefooga/benchmarks/)", 'B',"Representation", true).value();
    00031     if (benchmarkFileName == "") {
    00032         std::string stmp = "*** Missing name of the benchmark file\n";
    00033         stmp += "   Type '-B=the_benchmark_file_name' or '--BenchmarkFile=the_benchmark_file_name'\n";
    00034         stmp += "   Benchmarks files are available at www.lifl.fr/~liefooga/benchmarks";
    00035         throw std::runtime_error(stmp.c_str());
    00036     }
    00037     // reading of number of jobs to schedule contained in the benchmark file
    00038     FlowShopBenchmarkParser fParser(benchmarkFileName);
    00039     unsigned int N = fParser.getN();
    00040     // build of the initializer (a pointer, stored in the eoState)
    00041     eoInit<FlowShop>* init = new FlowShopInit(N);
    00042     // store in state
    00043     _state.storeFunctor(init);
    00044     // and return a reference
    00045     return *init;
    00046 }
    00047
    00048 #endif /*MAKE_GENOTYPE_FLOWSHOP_H_*/