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

stress-domain.cc

Go to the documentation of this file.
00001 /*
00002  *  Main authors:
00003  *     Christian Schulte <schulte@gecode.org>
00004  *
00005  *  Copyright:
00006  *     Christian Schulte, 2001
00007  *
00008  *  Last modified:
00009  *     $Date: 2006-08-03 13:51:17 +0200 (Thu, 03 Aug 2006) $ by $Author: schulte $
00010  *     $Revision: 3506 $
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 "examples/support.hh"
00023 
00030 class StressDomain : public Example {
00031 protected:
00033   IntVarArray x;
00034 public:
00036   StressDomain(const Options& opt)
00037     : x(this,5,0,5*opt.size) {
00038 
00039     // Cut holes: expand
00040     for (int i = 5; i--; ) {
00041       for (unsigned int j = 0; j <= 5*opt.size; j++)
00042         rel(this, x[i], IRT_NQ, 5*j);
00043       for (unsigned int j = 0; j <= 5*opt.size; j++)
00044         rel(this, x[i], IRT_NQ, 5*j+2);
00045       for (unsigned int j = 0; j <= 5*opt.size; j++)
00046         rel(this, x[i], IRT_NQ, 5*j+4);
00047     }
00048     // Contract
00049     for (unsigned int j = 0; j <= 5*opt.size/2; j++)
00050       for (unsigned int i = 5; i--; ) {
00051         rel(this, x[i], IRT_GQ, 5*j);
00052         rel(this, x[i], IRT_LQ, 5*(j + (5*opt.size/2)));
00053       }
00054   }
00055 
00057   StressDomain(bool share, StressDomain& s) : Example(share,s) {
00058     x.update(this, share, s.x);
00059   }
00060 
00062   virtual Space*
00063   copy(bool share) {
00064     return new StressDomain(share,*this);
00065   }
00066 
00068   virtual void
00069   print(void) {}
00070 };
00071 
00075 int
00076 main(int argc, char** argv) {
00077   Options opt("StressDomain");
00078   opt.iterations = 200;
00079   opt.size       = 1000;
00080   opt.parse(argc,argv);
00081   Example::run<StressDomain,DFS>(opt);
00082   return 0;
00083 }
00084 
00085 // STATISTICS: example-any
00086