Generated on Fri Mar 20 15:55:58 2015 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: 2013-07-04 17:03:13 +0200 (Thu, 04 Jul 2013) $ by $Author: schulte $
00017  *     $Revision: 13801 $
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& 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& 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& 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& 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& 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 MeritActivitySize : public MeritBase<SetView,double> {
00162   protected:
00164     Activity activity;
00165   public:
00167     MeritActivitySize(Space& home, const VarBranch& vb);
00169     MeritActivitySize(Space& home, bool shared, MeritActivitySize& m);
00171     double operator ()(const Space& home, SetView x, int i);
00173     bool notice(void) const;
00175     void dispose(Space& home);
00176   };
00177 
00178 }}}
00179 
00180 #include <gecode/set/branch/merit.hpp>
00181 
00182 namespace Gecode { namespace Set { namespace Branch {
00183 
00185   GECODE_SET_EXPORT
00186   ViewSel<SetView>* viewsel(Space& home, const SetVarBranch& svb);
00187 
00188 }}}
00189 
00190 namespace Gecode { namespace Set { namespace Branch {
00191 
00210   class ValSelMin : public ValSel<SetView,int> {
00211   public:
00213     ValSelMin(Space& home, const ValBranch& vb);
00215     ValSelMin(Space& home, bool shared, ValSelMin& vs);
00217     int val(const Space& home, SetView x, int i);
00218   };
00219 
00226   class ValSelMax : public ValSel<SetView,int> {
00227   public:
00229     ValSelMax(Space& home, const ValBranch& vb);
00231     ValSelMax(Space& home, bool shared, ValSelMax& vs);
00233     int val(const Space& home, SetView x, int i);
00234   };
00235 
00242   class ValSelMed : public ValSel<SetView,int> {
00243   public:
00245     ValSelMed(Space& home, const ValBranch& vb);
00247     ValSelMed(Space& home, bool shared, ValSelMed& vs);
00249     int val(const Space& home, SetView x, int i);
00250   };
00251 
00258   class ValSelRnd : public ValSel<SetView,int> {
00259   protected:
00261     Rnd r;
00262   public:
00264     ValSelRnd(Space& home, const ValBranch& vb);
00266     ValSelRnd(Space& home, bool shared, ValSelRnd& vs);
00268     int val(const Space& home, SetView x, int i);
00270     bool notice(void) const;
00272     void dispose(Space& home);
00273   };
00274 
00275 }}}
00276 
00277 #include <gecode/set/branch/val-sel.hpp>
00278 
00279 namespace Gecode { namespace Set { namespace Branch {
00280 
00282   class IncNGL : public ViewValNGL<SetView,int,PC_SET_ANY> {
00283   public:
00285     IncNGL(Space& home, SetView x, int n);
00287     IncNGL(Space& home, bool share, IncNGL& ngl);
00289     GECODE_SET_EXPORT
00290     virtual NGL::Status status(const Space& home) const;
00292     GECODE_SET_EXPORT
00293     virtual ExecStatus prune(Space& home);
00295     GECODE_SET_EXPORT
00296     virtual NGL* copy(Space& home, bool share);
00297   };
00298 
00300   class ExcNGL : public ViewValNGL<SetView,int,PC_SET_ANY> {
00301   public:
00303     ExcNGL(Space& home, SetView x, int n);
00305     ExcNGL(Space& home, bool share, ExcNGL& ngl);
00307     GECODE_SET_EXPORT
00308     virtual NGL::Status status(const Space& home) const;
00310     GECODE_SET_EXPORT
00311     virtual ExecStatus prune(Space& home);
00313     GECODE_SET_EXPORT
00314     virtual NGL* copy(Space& home, bool share);
00315   };
00316 
00317 }}}
00318 
00319 #include <gecode/set/branch/ngl.hpp>
00320 
00321 namespace Gecode { namespace Set { namespace Branch {
00322 
00341   class ValCommitInc : public ValCommit<SetView,int> {
00342   public:
00344     ValCommitInc(Space& home, const ValBranch& vb);
00346     ValCommitInc(Space& home, bool shared, ValCommitInc& vc);
00348     ModEvent commit(Space& home, unsigned int a, SetView x, int i, int n);
00350     NGL* ngl(Space& home, unsigned int a, View x, int n) const;
00352     void print(const Space& home, unsigned int a, SetView x, int i, int n,
00353                std::ostream& o) const;
00354   };
00355 
00362   class ValCommitExc : public ValCommit<SetView,int> {
00363   public:
00365     ValCommitExc(Space& home, const ValBranch& vb);
00367     ValCommitExc(Space& home, bool shared, ValCommitExc& vc);
00369     ModEvent commit(Space& home, unsigned int a, SetView x, int i, int n);
00371     NGL* ngl(Space& home, unsigned int a, View x, int n) const;
00373     void print(const Space& home, unsigned int a, SetView x, int i, int n,
00374                std::ostream& o) const;
00375   };
00376 
00377 }}}
00378 
00379 #include <gecode/set/branch/val-commit.hpp>
00380 
00381 namespace Gecode { namespace Set { namespace Branch {
00382 
00384   GECODE_SET_EXPORT
00385   ValSelCommitBase<SetView,int>* 
00386   valselcommit(Space& home, const SetValBranch& svb);
00387 
00389   GECODE_SET_EXPORT
00390   ValSelCommitBase<SetView,int>* 
00391   valselcommit(Space& home, const SetAssign& ia);
00392 
00393 }}}
00394 
00395 #endif
00396 
00397 // STATISTICS: set-branch
00398