Generated on Mon May 5 05:53:56 2008 for Gecode by doxygen 1.5.5

linear-bool.cc

Go to the documentation of this file.
00001 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
00002 /*
00003  *  Main authors:
00004  *     Christian Schulte <schulte@gecode.org>
00005  *
00006  *  Copyright:
00007  *     Christian Schulte, 2006
00008  *
00009  *  Last modified:
00010  *     $Date: 2008-03-06 10:39:58 +0100 (Thu, 06 Mar 2008) $ by $Author: tack $
00011  *     $Revision: 6446 $
00012  *
00013  *  This file is part of Gecode, the generic constraint
00014  *  development environment:
00015  *     http://www.gecode.org
00016  *
00017  *  Permission is hereby granted, free of charge, to any person obtaining
00018  *  a copy of this software and associated documentation files (the
00019  *  "Software"), to deal in the Software without restriction, including
00020  *  without limitation the rights to use, copy, modify, merge, publish,
00021  *  distribute, sublicense, and/or sell copies of the Software, and to
00022  *  permit persons to whom the Software is furnished to do so, subject to
00023  *  the following conditions:
00024  *
00025  *  The above copyright notice and this permission notice shall be
00026  *  included in all copies or substantial portions of the Software.
00027  *
00028  *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00029  *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00030  *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00031  *  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
00032  *  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
00033  *  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
00034  *  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00035  *
00036  */
00037 
00038 #include "gecode/int/linear.hh"
00039 
00040 namespace Gecode {
00041 
00042   using namespace Int;
00043 
00044   void
00045   linear(Space* home, const BoolVarArgs& x, IntRelType r, int c,
00046          IntConLevel icl, PropKind pk) {
00047     if (home->failed()) return;
00048 
00049     int n=x.size();
00050     GECODE_AUTOARRAY(Linear::Term<BoolView>, t, n);
00051     for (int i=n; i--; ) {
00052       t[i].a=1; t[i].x=x[i];
00053     }
00054 
00055     Linear::post(home,t,n,r,c,icl,pk);
00056   }
00057 
00058   void
00059   linear(Space* home, const BoolVarArgs& x, IntRelType r, IntVar y,
00060          IntConLevel icl, PropKind pk) {
00061     if (home->failed()) return;
00062 
00063     int n=x.size();
00064     GECODE_AUTOARRAY(Linear::Term<BoolView>, t, n);
00065     for (int i=n; i--; ) {
00066       t[i].a=1; t[i].x=x[i];
00067     }
00068 
00069     Linear::post(home,t,n,r,y,0,icl,pk);
00070   }
00071 
00072   void
00073   linear(Space* home,
00074          const IntArgs& a, const BoolVarArgs& x, IntRelType r, int c,
00075          IntConLevel icl, PropKind pk) {
00076     if (a.size() != x.size())
00077       throw ArgumentSizeMismatch("Int::linear");
00078     if (home->failed()) 
00079       return;
00080 
00081     int n=x.size();
00082     GECODE_AUTOARRAY(Linear::Term<BoolView>, t, n);
00083     for (int i=n; i--; ) {
00084       t[i].a=a[i]; t[i].x=x[i];
00085     }
00086 
00087     Linear::post(home,t,n,r,c,icl,pk);
00088   }
00089 
00090   void
00091   linear(Space* home,
00092          const IntArgs& a, const BoolVarArgs& x, IntRelType r, IntVar y,
00093          IntConLevel icl, PropKind pk) {
00094     if (a.size() != x.size())
00095       throw ArgumentSizeMismatch("Int::linear");
00096     if (home->failed()) 
00097       return;
00098 
00099     int n=x.size();
00100     GECODE_AUTOARRAY(Linear::Term<BoolView>, t, n);
00101     for (int i=n; i--; ) {
00102       t[i].a=a[i]; t[i].x=x[i];
00103     }
00104 
00105     Linear::post(home,t,n,r,y,0,icl,pk);
00106   }
00107 
00108   void
00109   linear(Space* home, const BoolVarArgs& x, IntRelType r, int c,
00110          BoolVar b, IntConLevel icl, PropKind pk) {
00111     if (home->failed()) return;
00112 
00113     int n=x.size();
00114     GECODE_AUTOARRAY(Linear::Term<BoolView>, t, n);
00115     for (int i=n; i--; ) {
00116       t[i].a=1; t[i].x=x[i];
00117     }
00118 
00119     Linear::post(home,t,n,r,c,b,icl,pk);
00120   }
00121 
00122   void
00123   linear(Space* home, const BoolVarArgs& x, IntRelType r, IntVar y,
00124          BoolVar b, IntConLevel icl, PropKind pk) {
00125     if (home->failed()) return;
00126 
00127     int n=x.size();
00128     GECODE_AUTOARRAY(Linear::Term<BoolView>, t, n);
00129     for (int i=n; i--; ) {
00130       t[i].a=1; t[i].x=x[i];
00131     }
00132 
00133     Linear::post(home,t,n,r,y,b,icl,pk);
00134   }
00135 
00136   void
00137   linear(Space* home,
00138          const IntArgs& a, const BoolVarArgs& x, IntRelType r, int c,
00139          BoolVar b, IntConLevel icl, PropKind pk) {
00140     if (a.size() != x.size())
00141       throw ArgumentSizeMismatch("Int::linear");
00142     if (home->failed()) return;
00143 
00144     int n=x.size();
00145     GECODE_AUTOARRAY(Linear::Term<BoolView>, t, n);
00146     for (int i=n; i--; ) {
00147       t[i].a=a[i]; t[i].x=x[i];
00148     }
00149 
00150     Linear::post(home,t,n,r,c,b,icl,pk);
00151   }
00152 
00153   void
00154   linear(Space* home,
00155          const IntArgs& a, const BoolVarArgs& x, IntRelType r, IntVar y,
00156          BoolVar b, IntConLevel icl, PropKind pk) {
00157     if (a.size() != x.size())
00158       throw ArgumentSizeMismatch("Int::linear");
00159     if (home->failed()) return;
00160 
00161     int n=x.size();
00162     GECODE_AUTOARRAY(Linear::Term<BoolView>, t, n);
00163     for (int i=n; i--; ) {
00164       t[i].a=a[i]; t[i].x=x[i];
00165     }
00166 
00167     Linear::post(home,t,n,r,y,b,icl,pk);
00168   }
00169 
00170 
00171   namespace {
00172     using namespace Int;
00173     GECODE_REGISTER1(Linear::EqBoolInt<BoolView>::Memory);
00174     GECODE_REGISTER1(Linear::EqBoolInt<BoolView>::Speed);
00175     GECODE_REGISTER3(Linear::EqBoolScale<Linear::EmptyScaleBoolArray,Linear::EmptyScaleBoolArray,IntView>);
00176     GECODE_REGISTER3(Linear::EqBoolScale<Linear::EmptyScaleBoolArray,Linear::EmptyScaleBoolArray,ZeroIntView>);
00177     GECODE_REGISTER3(Linear::EqBoolScale<Linear::EmptyScaleBoolArray,Linear::ScaleBoolArray,IntView>);
00178     GECODE_REGISTER3(Linear::EqBoolScale<Linear::EmptyScaleBoolArray,Linear::ScaleBoolArray,ZeroIntView>);
00179     GECODE_REGISTER3(Linear::EqBoolScale<Linear::ScaleBoolArray,Linear::EmptyScaleBoolArray,IntView>);
00180     GECODE_REGISTER3(Linear::EqBoolScale<Linear::ScaleBoolArray,Linear::EmptyScaleBoolArray,ZeroIntView>);
00181     GECODE_REGISTER3(Linear::EqBoolScale<Linear::ScaleBoolArray,Linear::ScaleBoolArray,IntView>);
00182     GECODE_REGISTER3(Linear::EqBoolScale<Linear::ScaleBoolArray,Linear::ScaleBoolArray,ZeroIntView>);
00183     GECODE_REGISTER2(Linear::EqBoolView<BoolView,IntView>);
00184     GECODE_REGISTER2(Linear::EqBoolView<BoolView,MinusView>);
00185     GECODE_REGISTER1(Linear::GqBoolInt<BoolView>::Memory);
00186     GECODE_REGISTER1(Linear::GqBoolInt<BoolView>::Speed);
00187     GECODE_REGISTER1(Linear::GqBoolInt<NegBoolView>::Memory);
00188     GECODE_REGISTER1(Linear::GqBoolInt<NegBoolView>::Speed);
00189     GECODE_REGISTER2(Linear::GqBoolView<BoolView,IntView>);
00190     GECODE_REGISTER2(Linear::GqBoolView<BoolView,MinusView>);
00191     GECODE_REGISTER2(Linear::GqBoolView<NegBoolView,IntView>);
00192     GECODE_REGISTER2(Linear::GqBoolView<NegBoolView,MinusView>);
00193     GECODE_REGISTER3(Linear::LqBoolScale<Linear::EmptyScaleBoolArray,Linear::EmptyScaleBoolArray,IntView>);
00194     GECODE_REGISTER3(Linear::LqBoolScale<Linear::EmptyScaleBoolArray,Linear::EmptyScaleBoolArray,MinusView>);
00195     GECODE_REGISTER3(Linear::LqBoolScale<Linear::EmptyScaleBoolArray,Linear::EmptyScaleBoolArray,ZeroIntView>);
00196     GECODE_REGISTER3(Linear::LqBoolScale<Linear::EmptyScaleBoolArray,Linear::ScaleBoolArray,IntView>);
00197     GECODE_REGISTER3(Linear::LqBoolScale<Linear::EmptyScaleBoolArray,Linear::ScaleBoolArray,MinusView>);
00198     GECODE_REGISTER3(Linear::LqBoolScale<Linear::EmptyScaleBoolArray,Linear::ScaleBoolArray,ZeroIntView>);
00199     GECODE_REGISTER3(Linear::LqBoolScale<Linear::ScaleBoolArray,Linear::EmptyScaleBoolArray,IntView>);
00200     GECODE_REGISTER3(Linear::LqBoolScale<Linear::ScaleBoolArray,Linear::EmptyScaleBoolArray,MinusView>);
00201     GECODE_REGISTER3(Linear::LqBoolScale<Linear::ScaleBoolArray,Linear::EmptyScaleBoolArray,ZeroIntView>);
00202     GECODE_REGISTER3(Linear::LqBoolScale<Linear::ScaleBoolArray,Linear::ScaleBoolArray,IntView>);
00203     GECODE_REGISTER3(Linear::LqBoolScale<Linear::ScaleBoolArray,Linear::ScaleBoolArray,MinusView>);
00204     GECODE_REGISTER3(Linear::LqBoolScale<Linear::ScaleBoolArray,Linear::ScaleBoolArray,ZeroIntView>);
00205     GECODE_REGISTER1(Linear::NqBoolInt<BoolView>);
00206     GECODE_REGISTER3(Linear::NqBoolScale<Linear::EmptyScaleBoolArray,Linear::EmptyScaleBoolArray,IntView>);
00207     GECODE_REGISTER3(Linear::NqBoolScale<Linear::EmptyScaleBoolArray,Linear::EmptyScaleBoolArray,ZeroIntView>);
00208     GECODE_REGISTER3(Linear::NqBoolScale<Linear::EmptyScaleBoolArray,Linear::ScaleBoolArray,IntView>);
00209     GECODE_REGISTER3(Linear::NqBoolScale<Linear::EmptyScaleBoolArray,Linear::ScaleBoolArray,ZeroIntView>);
00210     GECODE_REGISTER3(Linear::NqBoolScale<Linear::ScaleBoolArray,Linear::EmptyScaleBoolArray,IntView>);
00211     GECODE_REGISTER3(Linear::NqBoolScale<Linear::ScaleBoolArray,Linear::EmptyScaleBoolArray,ZeroIntView>);
00212     GECODE_REGISTER3(Linear::NqBoolScale<Linear::ScaleBoolArray,Linear::ScaleBoolArray,IntView>);
00213     GECODE_REGISTER3(Linear::NqBoolScale<Linear::ScaleBoolArray,Linear::ScaleBoolArray,ZeroIntView>);
00214     GECODE_REGISTER2(Linear::NqBoolView<BoolView,IntView>);
00215     GECODE_REGISTER2(Linear::NqBoolView<BoolView,MinusView>);
00216   }
00217 
00218 }
00219 
00220 // STATISTICS: int-post