Generated on Tue Apr 18 10:21:36 2017 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  *  Last modified:
00016  *     $Date: 2017-02-28 08:29:39 +0100 (Tue, 28 Feb 2017) $ by $Author: schulte $
00017  *     $Revision: 15527 $
00018  *
00019  *  This file is part of Gecode, the generic constraint
00020  *  development environment:
00021  *     http://www.gecode.org
00022  *
00023  *  Permission is hereby granted, free of charge, to any person obtaining
00024  *  a copy of this software and associated documentation files (the
00025  *  "Software"), to deal in the Software without restriction, including
00026  *  without limitation the rights to use, copy, modify, merge, publish,
00027  *  distribute, sublicense, and/or sell copies of the Software, and to
00028  *  permit persons to whom the Software is furnished to do so, subject to
00029  *  the following conditions:
00030  *
00031  *  The above copyright notice and this permission notice shall be
00032  *  included in all copies or substantial portions of the Software.
00033  *
00034  *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00035  *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00036  *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00037  *  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
00038  *  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
00039  *  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
00040  *  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00041  *
00042  */
00043 
00044 #ifndef __GECODE_SET_BRANCH_HH__
00045 #define __GECODE_SET_BRANCH_HH__
00046 
00047 #include <gecode/set.hh>
00048 
00054 namespace Gecode { namespace Set { namespace Branch {
00055 
00074   class MeritMin : public MeritBase<SetView,int> {
00075   public:
00077     MeritMin(Space& home, const VarBranch<Var>& vb);
00079     MeritMin(Space& home, bool shared, MeritMin& m);
00081     int operator ()(const Space& home, SetView x, int i);
00082   };
00083 
00090   class MeritMax : public MeritBase<SetView,int> {
00091   public:
00093     MeritMax(Space& home, const VarBranch<Var>& vb);
00095     MeritMax(Space& home, bool shared, MeritMax& m);
00097     int operator ()(const Space& home, SetView x, int i);
00098   };
00099 
00106   class MeritSize : public MeritBase<SetView,unsigned int> {
00107   public:
00109     MeritSize(Space& home, const VarBranch<Var>& vb);
00111     MeritSize(Space& home, bool shared, MeritSize& m);
00113     unsigned int operator ()(const Space& home, SetView x, int i);
00114   };
00115 
00122   class MeritDegreeSize : public MeritBase<SetView,double> {
00123   public:
00125     MeritDegreeSize(Space& home, const VarBranch<Var>& vb);
00127     MeritDegreeSize(Space& home, bool shared, MeritDegreeSize& m);
00129     double operator ()(const Space& home, SetView x, int i);
00130   };
00131 
00138   class MeritAFCSize : public MeritBase<SetView,double> {
00139   protected:
00141     AFC afc;
00142   public:
00144     MeritAFCSize(Space& home, const VarBranch<Var>& vb);
00146     MeritAFCSize(Space& home, bool shared, MeritAFCSize& m);
00148     double operator ()(const Space& home, SetView x, int i);
00150     bool notice(void) const;
00152     void dispose(Space& home);
00153   };
00154 
00161   class MeritActionSize : public MeritBase<SetView,double> {
00162   protected:
00164     Action action;
00165   public:
00167     MeritActionSize(Space& home, const VarBranch<Var>& vb);
00169     MeritActionSize(Space& home, bool shared, MeritActionSize& m);
00171     double operator ()(const Space& home, SetView x, int i);
00173     bool notice(void) const;
00175     void dispose(Space& home);
00176   };
00177 
00184   class MeritCHBSize : public MeritBase<SetView,double> {
00185   protected:
00187     CHB chb;
00188   public:
00190     MeritCHBSize(Space& home, const VarBranch<Var>& vb);
00192     MeritCHBSize(Space& home, bool shared, MeritCHBSize& m);
00194     double operator ()(const Space& home, SetView x, int i);
00196     bool notice(void) const;
00198     void dispose(Space& home);
00199   };
00200 
00201 }}}
00202 
00203 #include <gecode/set/branch/merit.hpp>
00204 
00205 namespace Gecode { namespace Set { namespace Branch {
00206 
00208   GECODE_SET_EXPORT
00209   ViewSel<SetView>* viewsel(Space& home, const SetVarBranch& svb);
00210 
00211 }}}
00212 
00213 namespace Gecode { namespace Set { namespace Branch {
00214 
00233   class ValSelMin : public ValSel<SetView,int> {
00234   public:
00236     ValSelMin(Space& home, const ValBranch<Var>& vb);
00238     ValSelMin(Space& home, bool shared, ValSelMin& vs);
00240     int val(const Space& home, SetView x, int i);
00241   };
00242 
00249   class ValSelMax : public ValSel<SetView,int> {
00250   public:
00252     ValSelMax(Space& home, const ValBranch<Var>& vb);
00254     ValSelMax(Space& home, bool shared, ValSelMax& vs);
00256     int val(const Space& home, SetView x, int i);
00257   };
00258 
00265   class ValSelMed : public ValSel<SetView,int> {
00266   public:
00268     ValSelMed(Space& home, const ValBranch<Var>& vb);
00270     ValSelMed(Space& home, bool shared, ValSelMed& vs);
00272     int val(const Space& home, SetView x, int i);
00273   };
00274 
00281   class ValSelRnd : public ValSel<SetView,int> {
00282   protected:
00284     Rnd r;
00285   public:
00287     ValSelRnd(Space& home, const ValBranch<Var>& vb);
00289     ValSelRnd(Space& home, bool shared, ValSelRnd& vs);
00291     int val(const Space& home, SetView x, int i);
00293     bool notice(void) const;
00295     void dispose(Space& home);
00296   };
00297 
00298 }}}
00299 
00300 #include <gecode/set/branch/val-sel.hpp>
00301 
00302 namespace Gecode { namespace Set { namespace Branch {
00303 
00305   class IncNGL : public ViewValNGL<SetView,int,PC_SET_ANY> {
00306   public:
00308     IncNGL(Space& home, SetView x, int n);
00310     IncNGL(Space& home, bool share, IncNGL& ngl);
00312     GECODE_SET_EXPORT
00313     virtual NGL::Status status(const Space& home) const;
00315     GECODE_SET_EXPORT
00316     virtual ExecStatus prune(Space& home);
00318     GECODE_SET_EXPORT
00319     virtual NGL* copy(Space& home, bool share);
00320   };
00321 
00323   class ExcNGL : public ViewValNGL<SetView,int,PC_SET_ANY> {
00324   public:
00326     ExcNGL(Space& home, SetView x, int n);
00328     ExcNGL(Space& home, bool share, ExcNGL& ngl);
00330     GECODE_SET_EXPORT
00331     virtual NGL::Status status(const Space& home) const;
00333     GECODE_SET_EXPORT
00334     virtual ExecStatus prune(Space& home);
00336     GECODE_SET_EXPORT
00337     virtual NGL* copy(Space& home, bool share);
00338   };
00339 
00340 }}}
00341 
00342 #include <gecode/set/branch/ngl.hpp>
00343 
00344 namespace Gecode { namespace Set { namespace Branch {
00345 
00364   class ValCommitInc : public ValCommit<SetView,int> {
00365   public:
00367     ValCommitInc(Space& home, const ValBranch<Var>& vb);
00369     ValCommitInc(Space& home, bool shared, ValCommitInc& vc);
00371     ModEvent commit(Space& home, unsigned int a, SetView x, int i, int n);
00373     NGL* ngl(Space& home, unsigned int a, View x, int n) const;
00375     void print(const Space& home, unsigned int a, SetView x, int i, int n,
00376                std::ostream& o) const;
00377   };
00378 
00385   class ValCommitExc : public ValCommit<SetView,int> {
00386   public:
00388     ValCommitExc(Space& home, const ValBranch<Var>& vb);
00390     ValCommitExc(Space& home, bool shared, ValCommitExc& vc);
00392     ModEvent commit(Space& home, unsigned int a, SetView x, int i, int n);
00394     NGL* ngl(Space& home, unsigned int a, View x, int n) const;
00396     void print(const Space& home, unsigned int a, SetView x, int i, int n,
00397                std::ostream& o) const;
00398   };
00399 
00400 }}}
00401 
00402 #include <gecode/set/branch/val-commit.hpp>
00403 
00404 namespace Gecode { namespace Set { namespace Branch {
00405 
00407   GECODE_SET_EXPORT
00408   ValSelCommitBase<SetView,int>*
00409   valselcommit(Space& home, const SetValBranch& svb);
00410 
00412   GECODE_SET_EXPORT
00413   ValSelCommitBase<SetView,int>*
00414   valselcommit(Space& home, const SetAssign& ia);
00415 
00416 }}}
00417 
00418 #endif
00419 
00420 // STATISTICS: set-branch
00421