Generated on Wed Nov 1 15:04:30 2006 for Gecode by doxygen 1.4.5

assign.cc

Go to the documentation of this file.
00001 /*
00002  *  Main authors:
00003  *     Christian Schulte <schulte@gecode.org>
00004  *
00005  *  Copyright:
00006  *     Christian Schulte, 2002
00007  *
00008  *  Last modified:
00009  *     $Date: 2006-07-19 12:57:59 +0200 (Wed, 19 Jul 2006) $ by $Author: schulte $
00010  *     $Revision: 3402 $
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 #include "gecode/int/branch.hh"
00023 
00024 namespace Gecode { namespace Int { namespace Branch {
00025 
00026   size_t
00027   AssignDesc::size(void) const {
00028     return sizeof(*this);
00029   }
00030 
00031 
00032   bool
00033   Assign::status(const Space*) const {
00034     for (int i = pos; i<x.size(); i++)
00035       if (!x[i].assigned()) {
00036         pos = i;
00037         return true;
00038       }
00039     return false;
00040   }
00041   ExecStatus
00042   Assign::commit(Space* home, const BranchingDesc* _d, unsigned int) {
00043     const AssignDesc* d = static_cast<const AssignDesc*>(_d);
00044     return me_failed(x[d->pos()].eq(home,d->val())) ? ES_FAILED : ES_OK;
00045   }
00046 
00047 
00048   Actor*
00049   AssignMin::copy(Space* home, bool share) {
00050     return new (home) AssignMin(home,share,*this);
00051   }
00052   const BranchingDesc*
00053   AssignMin::description(const Space*) const {
00054     assert(!x[pos].assigned());
00055     return new AssignDesc(this, pos, x[pos].min());
00056   }
00057 
00058 
00059   Actor*
00060   AssignMed::copy(Space* home, bool share) {
00061     return new (home) AssignMed(home,share,*this);
00062   }
00063   const BranchingDesc*
00064   AssignMed::description(const Space*) const {
00065     assert(!x[pos].assigned());
00066     return new AssignDesc(this, pos, x[pos].med());
00067   }
00068 
00069 
00070   Actor*
00071   AssignMax::copy(Space* home, bool share) {
00072     return new (home) AssignMax(home,share,*this);
00073   }
00074   const BranchingDesc*
00075   AssignMax::description(const Space*) const {
00076     assert(!x[pos].assigned());
00077     return new AssignDesc(this, pos, x[pos].max());
00078   }
00079 
00080 }}}
00081 
00082 // STATISTICS: int-branch
00083