Generated on Tue May 22 09:39:41 2018 for Gecode by doxygen 1.6.3

branch.hh

Go to the documentation of this file.
00001 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
00002 /*
00003  *  Main authors:
00004  *     Guido Tack <tack@gecode.org>
00005  *     Christian Schulte <schulte@gecode.org>
00006  *
00007  *  Contributing authors:
00008  *     Gabor Szokoli <szokoli@gecode.org>
00009  *
00010  *  Copyright:
00011  *     Guido Tack, 2004
00012  *     Christian Schulte, 2004
00013  *     Gabor Szokoli, 2004
00014  *
00015  *  This file is part of Gecode, the generic constraint
00016  *  development environment:
00017  *     http://www.gecode.org
00018  *
00019  *  Permission is hereby granted, free of charge, to any person obtaining
00020  *  a copy of this software and associated documentation files (the
00021  *  "Software"), to deal in the Software without restriction, including
00022  *  without limitation the rights to use, copy, modify, merge, publish,
00023  *  distribute, sublicense, and/or sell copies of the Software, and to
00024  *  permit persons to whom the Software is furnished to do so, subject to
00025  *  the following conditions:
00026  *
00027  *  The above copyright notice and this permission notice shall be
00028  *  included in all copies or substantial portions of the Software.
00029  *
00030  *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00031  *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00032  *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00033  *  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
00034  *  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
00035  *  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
00036  *  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00037  *
00038  */
00039 
00040 #ifndef __GECODE_SET_BRANCH_HH__
00041 #define __GECODE_SET_BRANCH_HH__
00042 
00043 #include <gecode/set.hh>
00044 
00050 namespace Gecode { namespace Set { namespace Branch {
00051 
00070   class MeritMin : public MeritBase<SetView,int> {
00071   public:
00073     MeritMin(Space& home, const VarBranch<Var>& vb);
00075     MeritMin(Space& home, MeritMin& m);
00077     int operator ()(const Space& home, SetView x, int i);
00078   };
00079 
00086   class MeritMax : public MeritBase<SetView,int> {
00087   public:
00089     MeritMax(Space& home, const VarBranch<Var>& vb);
00091     MeritMax(Space& home, MeritMax& m);
00093     int operator ()(const Space& home, SetView x, int i);
00094   };
00095 
00102   class MeritSize : public MeritBase<SetView,unsigned int> {
00103   public:
00105     MeritSize(Space& home, const VarBranch<Var>& vb);
00107     MeritSize(Space& home, MeritSize& m);
00109     unsigned int operator ()(const Space& home, SetView x, int i);
00110   };
00111 
00118   class MeritDegreeSize : public MeritBase<SetView,double> {
00119   public:
00121     MeritDegreeSize(Space& home, const VarBranch<Var>& vb);
00123     MeritDegreeSize(Space& home, MeritDegreeSize& m);
00125     double operator ()(const Space& home, SetView x, int i);
00126   };
00127 
00134   class MeritAFCSize : public MeritBase<SetView,double> {
00135   protected:
00137     AFC afc;
00138   public:
00140     MeritAFCSize(Space& home, const VarBranch<Var>& vb);
00142     MeritAFCSize(Space& home, MeritAFCSize& m);
00144     double operator ()(const Space& home, SetView x, int i);
00146     bool notice(void) const;
00148     void dispose(Space& home);
00149   };
00150 
00157   class MeritActionSize : public MeritBase<SetView,double> {
00158   protected:
00160     Action action;
00161   public:
00163     MeritActionSize(Space& home, const VarBranch<Var>& vb);
00165     MeritActionSize(Space& home, MeritActionSize& m);
00167     double operator ()(const Space& home, SetView x, int i);
00169     bool notice(void) const;
00171     void dispose(Space& home);
00172   };
00173 
00180   class MeritCHBSize : public MeritBase<SetView,double> {
00181   protected:
00183     CHB chb;
00184   public:
00186     MeritCHBSize(Space& home, const VarBranch<Var>& vb);
00188     MeritCHBSize(Space& home, MeritCHBSize& m);
00190     double operator ()(const Space& home, SetView x, int i);
00192     bool notice(void) const;
00194     void dispose(Space& home);
00195   };
00196 
00197 }}}
00198 
00199 #include <gecode/set/branch/merit.hpp>
00200 
00201 namespace Gecode { namespace Set { namespace Branch {
00202 
00204   GECODE_SET_EXPORT
00205   ViewSel<SetView>* viewsel(Space& home, const SetVarBranch& svb);
00206 
00207 }}}
00208 
00209 namespace Gecode { namespace Set { namespace Branch {
00210 
00229   class ValSelMin : public ValSel<SetView,int> {
00230   public:
00232     ValSelMin(Space& home, const ValBranch<Var>& vb);
00234     ValSelMin(Space& home, ValSelMin& vs);
00236     int val(const Space& home, SetView x, int i);
00237   };
00238 
00245   class ValSelMax : public ValSel<SetView,int> {
00246   public:
00248     ValSelMax(Space& home, const ValBranch<Var>& vb);
00250     ValSelMax(Space& home, ValSelMax& vs);
00252     int val(const Space& home, SetView x, int i);
00253   };
00254 
00261   class ValSelMed : public ValSel<SetView,int> {
00262   public:
00264     ValSelMed(Space& home, const ValBranch<Var>& vb);
00266     ValSelMed(Space& home, ValSelMed& vs);
00268     int val(const Space& home, SetView x, int i);
00269   };
00270 
00277   class ValSelRnd : public ValSel<SetView,int> {
00278   protected:
00280     Rnd r;
00281   public:
00283     ValSelRnd(Space& home, const ValBranch<Var>& vb);
00285     ValSelRnd(Space& home, ValSelRnd& vs);
00287     int val(const Space& home, SetView x, int i);
00289     bool notice(void) const;
00291     void dispose(Space& home);
00292   };
00293 
00294 }}}
00295 
00296 #include <gecode/set/branch/val-sel.hpp>
00297 
00298 namespace Gecode { namespace Set { namespace Branch {
00299 
00301   class IncNGL : public ViewValNGL<SetView,int,PC_SET_ANY> {
00302   public:
00304     IncNGL(Space& home, SetView x, int n);
00306     IncNGL(Space& home, IncNGL& ngl);
00308     GECODE_SET_EXPORT
00309     virtual NGL::Status status(const Space& home) const;
00311     GECODE_SET_EXPORT
00312     virtual ExecStatus prune(Space& home);
00314     GECODE_SET_EXPORT
00315     virtual NGL* copy(Space& home);
00316   };
00317 
00319   class ExcNGL : public ViewValNGL<SetView,int,PC_SET_ANY> {
00320   public:
00322     ExcNGL(Space& home, SetView x, int n);
00324     ExcNGL(Space& home, ExcNGL& ngl);
00326     GECODE_SET_EXPORT
00327     virtual NGL::Status status(const Space& home) const;
00329     GECODE_SET_EXPORT
00330     virtual ExecStatus prune(Space& home);
00332     GECODE_SET_EXPORT
00333     virtual NGL* copy(Space& home);
00334   };
00335 
00336 }}}
00337 
00338 #include <gecode/set/branch/ngl.hpp>
00339 
00340 namespace Gecode { namespace Set { namespace Branch {
00341 
00360   class ValCommitInc : public ValCommit<SetView,int> {
00361   public:
00363     ValCommitInc(Space& home, const ValBranch<Var>& vb);
00365     ValCommitInc(Space& home, ValCommitInc& vc);
00367     ModEvent commit(Space& home, unsigned int a, SetView x, int i, int n);
00369     NGL* ngl(Space& home, unsigned int a, View x, int n) const;
00371     void print(const Space& home, unsigned int a, SetView x, int i, int n,
00372                std::ostream& o) const;
00373   };
00374 
00381   class ValCommitExc : public ValCommit<SetView,int> {
00382   public:
00384     ValCommitExc(Space& home, const ValBranch<Var>& vb);
00386     ValCommitExc(Space& home, ValCommitExc& vc);
00388     ModEvent commit(Space& home, unsigned int a, SetView x, int i, int n);
00390     NGL* ngl(Space& home, unsigned int a, View x, int n) const;
00392     void print(const Space& home, unsigned int a, SetView x, int i, int n,
00393                std::ostream& o) const;
00394   };
00395 
00396 }}}
00397 
00398 #include <gecode/set/branch/val-commit.hpp>
00399 
00400 namespace Gecode { namespace Set { namespace Branch {
00401 
00403   GECODE_SET_EXPORT
00404   ValSelCommitBase<SetView,int>*
00405   valselcommit(Space& home, const SetValBranch& svb);
00406 
00408   GECODE_SET_EXPORT
00409   ValSelCommitBase<SetView,int>*
00410   valselcommit(Space& home, const SetAssign& ia);
00411 
00412 }}}
00413 
00414 #endif
00415 
00416 // STATISTICS: set-branch
00417