Generated on Mon Nov 30 23:53:19 2009 for Gecode by doxygen 1.6.1

gist.hh

Go to the documentation of this file.
00001 /*
00002  *  Main authors:
00003  *     Guido Tack <tack@gecode.org>
00004  *
00005  *  Copyright:
00006  *     Guido Tack, 2006
00007  *
00008  *  Last modified:
00009  *     $Date: 2009-09-08 21:10:29 +0200 (Tue, 08 Sep 2009) $ by $Author: schulte $
00010  *     $Revision: 9692 $
00011  *
00012  *  This file is part of Gecode, the generic constraint
00013  *  development environment:
00014  *     http://www.gecode.org
00015  *
00016  * Permission is hereby granted, free of charge, to any person obtaining
00017  * a copy of this software and associated documentation files (the
00018  * "Software"), to deal in the Software without restriction, including
00019  * without limitation the rights to use, copy, modify, merge, publish,
00020  * distribute, sublicense, and/or sell copies of the Software, and to
00021  * permit persons to whom the Software is furnished to do so, subject to
00022  * the following conditions:
00023  *
00024  * The above copyright notice and this permission notice shall be
00025  * included in all copies or substantial portions of the Software.
00026  *
00027  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00028  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00029  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00030  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
00031  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
00032  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
00033  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00034  *
00035  */
00036 
00037 #ifndef __GECODE_GIST_HH__
00038 #define __GECODE_GIST_HH__
00039 
00040 #include <gecode/kernel.hh>
00041 #include <gecode/search.hh>
00042 
00043 /*
00044  * Configure linking
00045  *
00046  */
00047 
00048 #if !defined(GIST_STATIC_LIBS) && \
00049     (defined(__CYGWIN__) || defined(__MINGW32__) || defined(_MSC_VER))
00050 
00051 #ifdef GECODE_BUILD_GIST
00052 #define GECODE_GIST_EXPORT __declspec( dllexport )
00053 #else
00054 #define GECODE_GIST_EXPORT __declspec( dllimport )
00055 #endif
00056 
00057 #else
00058 
00059 #ifdef GECODE_GCC_HAS_CLASS_VISIBILITY
00060 #define GECODE_GIST_EXPORT __attribute__ ((visibility("default")))
00061 #else
00062 #define GECODE_GIST_EXPORT
00063 #endif
00064 
00065 #endif
00066 
00067 // Configure auto-linking
00068 #ifndef GECODE_BUILD_GIST
00069 #define GECODE_LIBRARY_NAME "Gist"
00070 #include <gecode/support/auto-link.hpp>
00071 #endif
00072 
00073 #include <string>
00074 #include <sstream>
00075 
00076 namespace Gecode {
00077 
00086   namespace Gist {
00087 
00096     class GECODE_GIST_EXPORT Inspector {
00097     public:
00099       virtual void inspect(const Space& node) = 0;
00101       virtual std::string name(void);
00103       virtual void finalize(void);
00105       virtual ~Inspector(void);
00106     };
00107     
00108     class TextOutput;
00109     
00111     class GECODE_GIST_EXPORT TextInspector : public Inspector {
00112     private:
00114       TextOutput *t;
00116       std::string n;
00117     protected:
00119       void init(void);
00121       std::ostream& getStream(void);
00123       void addHtml(const char* s);
00124     public:
00126       TextInspector(const std::string& name);
00128       virtual void finalize(void);
00130       virtual ~TextInspector(void);
00132       virtual std::string name(void);
00133     };
00134     
00136     template<class S>
00137     class Print : public TextInspector {
00138     public:
00140       Print(const std::string& name);
00142       virtual void inspect(const Space& node);
00143     };
00144     
00152     class Options : public Search::Options {
00153     public:
00155       class _I {
00156       private:
00157         Support::DynamicArray<Inspector*,Heap> _click;
00158         unsigned int n_click;
00159         Support::DynamicArray<Inspector*,Heap> _solution;
00160         unsigned int n_solution;
00161       public:
00163         _I(void);
00165         void click(Inspector* i);
00167         void solution(Inspector* i);
00168         
00170         Inspector* click(unsigned int i) const;
00172         Inspector* solution(unsigned int i) const;
00173       } inspect;
00175       GECODE_GIST_EXPORT static const Options def;
00177       Options(void);
00178     };
00179 
00180     
00182     GECODE_GIST_EXPORT int 
00183     explore(Space* root, bool bab, const Options& opt);
00184     
00189     int 
00190     dfs(Space* root, const Gist::Options& opt = Gist::Options::def);
00191     
00196     int 
00197     bab(Space* root, const Gist::Options& opt = Gist::Options::def);
00198     
00199   }     
00200 
00201 }
00202 
00203 #include <gecode/gist/gist.hpp>
00204 
00205 #endif
00206 
00207 // STATISTICS: gist-any