Generated on Mon Aug 25 11:35:33 2008 for Gecode by doxygen 1.5.6

array.cc

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  *     Gabor Szokoli <szokoli@gecode.org>
00007  *
00008  *  Copyright:
00009  *     Guido Tack, 2004
00010  *     Christian Schulte, 2004
00011  *     Gabor Szokoli, 2004
00012  *
00013  *  Last modified:
00014  *     $Date: 2008-02-01 15:22:09 +0100 (Fri, 01 Feb 2008) $ by $Author: tack $
00015  *     $Revision: 6042 $
00016  *
00017  *  This file is part of Gecode, the generic constraint
00018  *  development environment:
00019  *     http://www.gecode.org
00020  *
00021  *  Permission is hereby granted, free of charge, to any person obtaining
00022  *  a copy of this software and associated documentation files (the
00023  *  "Software"), to deal in the Software without restriction, including
00024  *  without limitation the rights to use, copy, modify, merge, publish,
00025  *  distribute, sublicense, and/or sell copies of the Software, and to
00026  *  permit persons to whom the Software is furnished to do so, subject to
00027  *  the following conditions:
00028  *
00029  *  The above copyright notice and this permission notice shall be
00030  *  included in all copies or substantial portions of the Software.
00031  *
00032  *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00033  *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00034  *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00035  *  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
00036  *  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
00037  *  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
00038  *  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00039  *
00040  */
00041 
00042 
00043 
00044 #include "gecode/set.hh"
00045 
00046 namespace Gecode {
00047 
00048   SetVarArray::SetVarArray(Space* home, int n)
00049     : VarArray<SetVar>(home,n) {
00050     for (int i = size(); i--; )
00051       x[i].init(home);
00052   }
00053 
00054   SetVarArray::SetVarArray(Space* home,int n,
00055                            int lbMin,int lbMax,int ubMin,int ubMax,
00056                            unsigned int minCard,
00057                            unsigned int maxCard)
00058     : VarArray<SetVar>(home,n) {
00059     Set::Limits::check(lbMin,"SetVarArray::SetVarArray");
00060     Set::Limits::check(lbMax,"SetVarArray::SetVarArray");
00061     Set::Limits::check(ubMin,"SetVarArray::SetVarArray");
00062     Set::Limits::check(ubMax,"SetVarArray::SetVarArray");
00063     Set::Limits::check(maxCard,"SetVarArray::SetVarArray");
00064     if (minCard > maxCard)
00065       throw Set::VariableEmptyDomain("SetVarArray::SetVarArray");
00066     for (int i = size(); i--; )
00067       x[i].init(home,lbMin,lbMax,ubMin,ubMax,minCard,maxCard);    
00068   }
00069 
00070   SetVarArray::SetVarArray(Space* home,int n,
00071                            const IntSet& glb,int ubMin,int ubMax,
00072                            unsigned int minCard,unsigned int maxCard)
00073     : VarArray<SetVar>(home,n) {
00074     Set::Limits::check(glb,"SetVarArray::SetVarArray");
00075     Set::Limits::check(ubMin,"SetVarArray::SetVarArray");
00076     Set::Limits::check(ubMax,"SetVarArray::SetVarArray");
00077     Set::Limits::check(maxCard,"SetVarArray::SetVarArray");
00078     if (minCard > maxCard)
00079       throw Set::VariableEmptyDomain("SetVarArray::SetVarArray");
00080     for (int i = size(); i--; )
00081       x[i].init(home,glb,ubMin,ubMax,minCard,maxCard);
00082   }
00083 
00084   SetVarArray::SetVarArray(Space* home,int n,
00085                            int lbMin,int lbMax,const IntSet& lub,
00086                            unsigned int minCard,unsigned int maxCard)
00087     : VarArray<SetVar>(home,n) {
00088     Set::Limits::check(lbMin,"SetVarArray::SetVarArray");
00089     Set::Limits::check(lbMax,"SetVarArray::SetVarArray");
00090     Set::Limits::check(lub,"SetVarArray::SetVarArray");
00091     Set::Limits::check(maxCard,"SetVarArray::SetVarArray");
00092     if (minCard > maxCard)
00093       throw Set::VariableEmptyDomain("SetVarArray::SetVarArray");
00094     for (int i = size(); i--; )
00095       x[i].init(home,lbMin,lbMax,lub,minCard,maxCard);
00096   }
00097 
00098   SetVarArray::SetVarArray(Space* home,int n,
00099                            const IntSet& glb, const IntSet& lub,
00100                            unsigned int minCard, unsigned int maxCard)
00101     : VarArray<SetVar>(home,n) {
00102     Set::Limits::check(glb,"SetVarArray::SetVarArray");
00103     Set::Limits::check(lub,"SetVarArray::SetVarArray");
00104     Set::Limits::check(maxCard,"SetVarArray::SetVarArray");
00105     for (int i = size(); i--; )
00106       x[i].init(home,glb,lub,minCard,maxCard);
00107     if (minCard > maxCard)
00108       throw Set::VariableEmptyDomain("SetVar");
00109   }
00110 
00111 }
00112 
00113 // STATISTICS: set-other
00114