support.hh
Go to the documentation of this file.00001 /* 00002 * Main authors: 00003 * Christian Schulte <schulte@gecode.org> 00004 * 00005 * Copyright: 00006 * Christian Schulte, 2004 00007 * 00008 * Last modified: 00009 * $Date: 2006-08-04 16:06:52 +0200 (Fri, 04 Aug 2006) $ by $Author: schulte $ 00010 * $Revision: 3517 $ 00011 * 00012 * This file is part of Gecode, the generic constraint 00013 * development environment: 00014 * http://www.gecode.org 00015 * 00016 * See the file "LICENSE" for information on usage and 00017 * redistribution of this file, and for a 00018 * DISCLAIMER OF ALL WARRANTIES. 00019 * 00020 */ 00021 00022 #ifndef __GECODE_EXAMPLES_SUPPORT_HH__ 00023 #define __GECODE_EXAMPLES_SUPPORT_HH__ 00024 00025 #include <iostream> 00026 #include <iomanip> 00027 00028 #include <cstdlib> 00029 #include <cstring> 00030 00031 #include "gecode/kernel.hh" 00032 #include "gecode/int.hh" 00033 #include "gecode/search.hh" 00034 00035 #include "examples/timer.hh" 00036 00037 /* 00038 * Options for running the examples 00039 * 00040 */ 00041 00042 using namespace Gecode; 00043 00045 enum ExampleMode { 00046 EM_SOLUTION, 00047 EM_TIME, 00048 EM_STAT 00049 }; 00050 00052 class Options { 00053 public: 00054 IntConLevel icl; 00055 unsigned int c_d; 00056 unsigned int a_d; 00057 ExampleMode mode; 00058 bool quiet; 00059 unsigned int samples; 00060 unsigned int iterations; 00061 unsigned int solutions; 00062 int fails; 00063 int time; 00064 bool naive; 00065 unsigned int size; 00066 const char* name; 00067 00069 Options(const char* s); 00071 void parse(int argc, char** argv); 00072 }; 00073 00074 00083 class Example : public Space { 00084 public: 00085 Example(void) {} 00086 Example(bool share, Example& e) : Space(share,e) {} 00087 virtual void print(void) {} 00088 template <class Script, template<class> class Engine> 00089 static void run(const Options&); 00090 private: 00091 explicit Example(Example& e); 00092 }; 00093 00094 #include "examples/support.icc" 00095 00096 #endif 00097 00098 // STATISTICS: example-any