Generated on Mon Nov 30 11:16:18 2009 for Gecode by doxygen 1.5.5

layered-graph.hpp

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, 2004
00008  *
00009  *  Last modified:
00010  *     $Date: 2009-11-25 18:36:58 +0100 (Wed, 25 Nov 2009) $ by $Author: tack $
00011  *     $Revision: 10129 $
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 <climits>
00039 #include <algorithm>
00040 
00041 namespace Gecode { namespace Int { namespace Extensional {
00042 
00043   /*
00044    * States
00045    */
00046   template<class View, class Val, class Degree, class StateIdx>
00047   forceinline
00048   LayeredGraph<View,Val,Degree,StateIdx>::State::State(void) 
00049     : i_deg(0), o_deg(0) {}
00050 
00051 
00052   /*
00053    * Value iterator
00054    */
00055   template<class View, class Val, class Degree, class StateIdx>
00056   forceinline
00057   LayeredGraph<View,Val,Degree,StateIdx>::LayerValues::LayerValues(void) {}
00058   template<class View, class Val, class Degree, class StateIdx>
00059   forceinline
00060   LayeredGraph<View,Val,Degree,StateIdx>::LayerValues
00061   ::LayerValues(const Layer& l)
00062     : s1(l.support), s2(l.support+l.size) {}
00063   template<class View, class Val, class Degree, class StateIdx>
00064   forceinline void
00065   LayeredGraph<View,Val,Degree,StateIdx>::LayerValues::init(const Layer& l) {
00066     s1=l.support; s2=l.support+l.size;
00067   }
00068   template<class View, class Val, class Degree, class StateIdx>
00069   forceinline bool
00070   LayeredGraph<View,Val,Degree,StateIdx>::LayerValues
00071   ::operator ()(void) const {
00072     return s1<s2;
00073   }
00074   template<class View, class Val, class Degree, class StateIdx>
00075   forceinline void
00076   LayeredGraph<View,Val,Degree,StateIdx>::LayerValues::operator ++(void) {
00077     s1++;
00078   }
00079   template<class View, class Val, class Degree, class StateIdx>
00080   forceinline int
00081   LayeredGraph<View,Val,Degree,StateIdx>::LayerValues::val(void) const {
00082     return s1->val;
00083   }
00084 
00085 
00086   /*
00087    * Index advisors
00088    *
00089    */
00090   template<class View, class Val, class Degree, class StateIdx>
00091   forceinline
00092   LayeredGraph<View,Val,Degree,StateIdx>::Index::Index(Space& home, Propagator& p,
00093                                                        Council<Index>& c,
00094                                                        StateIdx i0)
00095     : Advisor(home,p,c), i(i0) {}
00096 
00097   template<class View, class Val, class Degree, class StateIdx>
00098   forceinline
00099   LayeredGraph<View,Val,Degree,StateIdx>::Index::Index(Space& home, bool share,
00100                                                        Index& a)
00101     : Advisor(home,share,a), i(a.i) {}
00102 
00103 
00104   /*
00105    * Index ranges
00106    *
00107    */
00108   template<class View, class Val, class Degree, class StateIdx>
00109   forceinline
00110   LayeredGraph<View,Val,Degree,StateIdx>::IndexRange::IndexRange(void)
00111     : _fst(INT_MAX), _lst(INT_MIN) {}
00112   template<class View, class Val, class Degree, class StateIdx>
00113   forceinline void
00114   LayeredGraph<View,Val,Degree,StateIdx>::IndexRange::reset(void) {
00115     _fst=INT_MAX; _lst=INT_MIN;
00116   }
00117   template<class View, class Val, class Degree, class StateIdx>
00118   forceinline void
00119   LayeredGraph<View,Val,Degree,StateIdx>::IndexRange::add(int i) {
00120     _fst=std::min(_fst,i); _lst=std::max(_lst,i);
00121   }
00122   template<class View, class Val, class Degree, class StateIdx>
00123   forceinline int
00124   LayeredGraph<View,Val,Degree,StateIdx>::IndexRange::fst(void) const {
00125     return _fst;
00126   }
00127   template<class View, class Val, class Degree, class StateIdx>
00128   forceinline int
00129   LayeredGraph<View,Val,Degree,StateIdx>::IndexRange::lst(void) const {
00130     return _lst;
00131   }
00132 
00133 
00134 
00135   /*
00136    * The layered graph
00137    *
00138    */
00139 
00140   template<class View, class Val, class Degree, class StateIdx>
00141   template<class Var>
00142   forceinline
00143   LayeredGraph<View,Val,Degree,StateIdx>::LayeredGraph(Home home,
00144                                                        const VarArgArray<Var>& x, 
00145                                                        const DFA& dfa)
00146     : Propagator(home), c(home), n(x.size()), n_states(dfa.n_states()) {
00147     assert(n > 0);
00148   }
00149 
00150   template<class View, class Val, class Degree, class StateIdx>
00151   template<class Var>
00152   forceinline ExecStatus
00153   LayeredGraph<View,Val,Degree,StateIdx>::initialize(Space& home,
00154                                                      const VarArgArray<Var>& x, 
00155                                                      const DFA& dfa) {
00156     // Allocate memory
00157     layers = home.alloc<Layer>(n+2)+1;
00158     states = home.alloc<State>((n+1)*n_states);
00159 
00160     // Mark initial state as being reachable
00161     states[0].i_deg = 1;
00162 
00163     // Mark final states as reachable as well
00164     for (int s = dfa.final_fst(); s < dfa.final_lst(); s++)
00165       states[n*n_states + s].o_deg = 1;
00166 
00167     // Temporary memory for edges
00168     Region r(home);
00169     Edge* edges = r.alloc<Edge>(dfa.max_degree());
00170 
00171     // Forward pass: add transitions
00172     for (int i=0; i<n; i++) {
00173       layers[i].x = x[i];
00174       layers[i].support = home.alloc<Support>(layers[i].x.size());
00175       unsigned int j=0;
00176       // Enter links leaving reachable states (indegree != 0)
00177       for (ViewValues<View> nx(layers[i].x); nx(); ++nx) {
00178         Degree n_edges=0;
00179         for (DFA::Transitions t(dfa,nx.val()); t(); ++t)
00180           if (states[i*n_states + t.i_state()].i_deg != 0) {
00181             StateIdx i_s = static_cast<StateIdx>(i*n_states + t.i_state());
00182             states[i_s].o_deg++;
00183             StateIdx o_s = static_cast<StateIdx>((i+1)*n_states +  t.o_state());
00184             states[o_s].i_deg++;
00185             edges[n_edges].i_state = i_s;
00186             edges[n_edges].o_state = o_s;
00187             n_edges++;
00188           }
00189         assert(n_edges <= dfa.max_degree());
00190         // Found support for value
00191         if (n_edges > 0) {
00192           layers[i].support[j].val = static_cast<Val>(nx.val());
00193           layers[i].support[j].n_edges = n_edges;
00194           layers[i].support[j].edges = home.alloc<Edge>(n_edges);
00195           for (Degree d=n_edges; d--; )
00196             layers[i].support[j].edges[d] = edges[d];
00197           j++;
00198         }
00199       }
00200       if ((layers[i].size = j) == 0)
00201         return ES_FAILED;
00202     }
00203 
00204     // Backward pass: prune all transitions that do not lead to final state
00205     for (int i=n; i--; ) {
00206       unsigned int k=0;
00207       for (unsigned int j=0; j<layers[i].size; j++) {
00208         for (Degree d=layers[i].support[j].n_edges; d--; )
00209           if (states[layers[i].support[j].edges[d].o_state].o_deg == 0) {
00210             // Adapt states
00211             states[layers[i].support[j].edges[d].i_state].o_deg--;
00212             states[layers[i].support[j].edges[d].o_state].i_deg--;
00213             // Unreachable, prune edge
00214             layers[i].support[j].edges[d] = 
00215               layers[i].support[j].edges[--layers[i].support[j].n_edges];
00216           }
00217         // Value has support, copy the support information
00218         if (layers[i].support[j].n_edges > 0)
00219           layers[i].support[k++]=layers[i].support[j];
00220       }
00221       if ((layers[i].size = k) == 0)
00222         return ES_FAILED;
00223       LayerValues lv(layers[i]);
00224       GECODE_ME_CHECK(layers[i].x.narrow_v(home,lv,false));
00225       if (!layers[i].x.assigned())
00226         layers[i].x.subscribe(home, *new (home) Index(home,*this,c,i));
00227     }
00228     // Schedule if subsumption is needed
00229     if (c.empty())
00230       View::schedule(home,*this,ME_INT_VAL);
00231     return ES_OK;
00232   }
00233 
00234   template<class View, class Val, class Degree, class StateIdx>
00235   ExecStatus
00236   LayeredGraph<View,Val,Degree,StateIdx>::advise(Space& home,
00237                                              Advisor& _a, const Delta& d) {
00238     // Check whether state information has already been created
00239     if (states == NULL) {
00240       states = home.alloc<State>((n+1)*n_states);
00241       for (int i=n; i--; )
00242         for (unsigned int j=layers[i].size; j--; )
00243           for (Degree d=layers[i].support[j].n_edges; d--; ) {
00244             states[layers[i].support[j].edges[d].i_state].o_deg++;
00245             states[layers[i].support[j].edges[d].o_state].i_deg++;
00246           }
00247     }
00248     
00249     Index& a = static_cast<Index&>(_a);
00250     Layer& l = layers[a.i];
00251 
00252     if (l.size <= l.x.size()) {
00253       // Propagator has already done everything
00254       if (View::modevent(d) == ME_INT_VAL) {
00255         a.dispose(home,c);
00256         return c.empty() ? ES_NOFIX : ES_FIX;
00257       } else {
00258         return ES_FIX;
00259       }
00260     }
00261 
00262     bool i_mod = false;
00263     bool o_mod = false;
00264 
00265     if (View::modevent(d) == ME_INT_VAL) {
00266       Val n = static_cast<Val>(l.x.val());
00267       unsigned int j=0;
00268       for (; l.support[j].val < n; j++)
00269         // Supported value not any longer in view
00270         for (Degree d=l.support[j].n_edges; d--; ) {
00271           // Adapt states
00272           o_mod |= ((--states[l.support[j].edges[d].i_state].o_deg) == 0);
00273           i_mod |= ((--states[l.support[j].edges[d].o_state].i_deg) == 0);
00274         }
00275       assert(l.support[j].val == n);
00276       l.support[0] = l.support[j++];
00277       unsigned int s=l.size;
00278       l.size = 1;
00279       for (; j<s; j++)
00280         for (Degree d=l.support[j].n_edges; d--; ) {
00281           // Adapt states
00282           o_mod |= ((--states[l.support[j].edges[d].i_state].o_deg) == 0);
00283           i_mod |= ((--states[l.support[j].edges[d].o_state].i_deg) == 0);
00284         }
00285     } else if (l.x.any(d)) {
00286       unsigned int j=0;
00287       unsigned int k=0;
00288       unsigned int s=l.size;
00289       for (ViewRanges<View> rx(l.x); rx() && (j<s);)
00290         if (l.support[j].val < static_cast<Val>(rx.min())) {
00291           // Supported value not any longer in view
00292           for (Degree d=l.support[j].n_edges; d--; ) {
00293             // Adapt states
00294             o_mod |= ((--states[l.support[j].edges[d].i_state].o_deg) == 0);
00295             i_mod |= ((--states[l.support[j].edges[d].o_state].i_deg) == 0);
00296           }
00297           ++j;
00298         } else if (l.support[j].val > static_cast<Val>(rx.max())) {
00299           ++rx;
00300         } else {
00301           l.support[k++]=l.support[j++];
00302         }
00303       assert(k > 0);
00304       l.size = k;
00305       // Remove remaining values
00306       for (; j<s; j++)
00307         for (Degree d=l.support[j].n_edges; d--; ) {
00308           // Adapt states
00309           o_mod |= ((--states[l.support[j].edges[d].i_state].o_deg) == 0);
00310           i_mod |= ((--states[l.support[j].edges[d].o_state].i_deg) == 0);
00311         }
00312     } else {
00313       Val min = static_cast<Val>(l.x.min(d));
00314       unsigned int j=0;
00315       // Skip values smaller than min (to keep)
00316       for (; l.support[j].val < min; j++) {}
00317       Val max = static_cast<Val>(l.x.max(d));
00318       unsigned int k=j;
00319       unsigned int s=l.size;
00320       // Remove pruned values
00321       for (; (j<s) && (l.support[j].val <= max); j++)
00322         for (Degree d=l.support[j].n_edges; d--; ) {
00323           // Adapt states
00324           o_mod |= ((--states[l.support[j].edges[d].i_state].o_deg) == 0);
00325           i_mod |= ((--states[l.support[j].edges[d].o_state].i_deg) == 0);
00326         }
00327       // Keep remaining values
00328       while (j<s)
00329         l.support[k++]=l.support[j++];
00330       l.size =k;
00331       assert(k > 0);
00332     }
00333 
00334     bool fix = true;
00335     if (o_mod && (a.i > 0)) {
00336       o_ch.add(a.i-1); fix = false;
00337      }
00338     if (i_mod && (a.i+1 < n)) {
00339       i_ch.add(a.i+1); fix = false;
00340     }
00341     if (fix) {
00342       if (View::modevent(d) == ME_INT_VAL) {
00343         a.dispose(home,c);
00344         return c.empty() ? ES_NOFIX : ES_FIX;
00345       }
00346       return ES_FIX;
00347     } else {
00348       return (View::modevent(d) == ME_INT_VAL)
00349         ? ES_SUBSUMED_NOFIX(a,home,c) : ES_NOFIX;
00350     }
00351   }
00352 
00353   template<class View, class Val, class Degree, class StateIdx>
00354   ExecStatus
00355   LayeredGraph<View,Val,Degree,StateIdx>::propagate(Space& home,
00356                                                     const ModEventDelta&) {
00357     // Forward pass
00358     for (int i=i_ch.fst(); i<=i_ch.lst(); i++) {
00359       bool i_mod = false;
00360       bool o_mod = false;
00361       unsigned int j=0;
00362       unsigned int k=0;
00363       unsigned int s=layers[i].size;
00364       do {
00365         for (Degree d=layers[i].support[j].n_edges; d--; )
00366           if (states[layers[i].support[j].edges[d].i_state].i_deg == 0) {
00367             // Adapt states
00368             o_mod |= ((--states[layers[i].support[j].edges[d].i_state].o_deg)
00369                       == 0);
00370             i_mod |= ((--states[layers[i].support[j].edges[d].o_state].i_deg)
00371                       == 0);
00372             // Remove edge
00373             layers[i].support[j].edges[d] = 
00374               layers[i].support[j].edges[--layers[i].support[j].n_edges];
00375           }
00376         // Check whether value is still supported
00377         if (layers[i].support[j].n_edges == 0) {
00378           layers[i].size--;
00379           GECODE_ME_CHECK(layers[i].x.nq(home,layers[i].support[j++].val));
00380         } else {
00381           layers[i].support[k++]=layers[i].support[j++];
00382         }
00383       } while (j<s);
00384       assert(k > 0);
00385       // Update modification information
00386       if (o_mod && (i > 0))
00387         o_ch.add(i-1);
00388       if (i_mod && (i+1 < n))
00389         i_ch.add(i+1);
00390     }
00391     i_ch.reset();
00392 
00393     // Backward pass
00394     for (int i=o_ch.lst(); i>=o_ch.fst(); i--) {
00395       bool o_mod = false;
00396       unsigned int j=0;
00397       unsigned int k=0;
00398       unsigned int s=layers[i].size;
00399       do {
00400         for (Degree d=layers[i].support[j].n_edges; d--; )
00401           if (states[layers[i].support[j].edges[d].o_state].o_deg == 0) {
00402             // Adapt states
00403             o_mod |= ((--states[layers[i].support[j].edges[d].i_state].o_deg) 
00404                       == 0);
00405             --states[layers[i].support[j].edges[d].o_state].i_deg;
00406             // Remove edge
00407             layers[i].support[j].edges[d] = 
00408               layers[i].support[j].edges[--layers[i].support[j].n_edges];
00409           }
00410         // Check whether value is still supported
00411         if (layers[i].support[j].n_edges == 0) {
00412           layers[i].size--;
00413           GECODE_ME_CHECK(layers[i].x.nq(home,layers[i].support[j++].val));
00414         } else {
00415           layers[i].support[k++]=layers[i].support[j++];
00416         }
00417       } while (j<s);
00418       assert(k > 0);
00419       // Update modification information
00420       if (o_mod && (i > 0))
00421         o_ch.add(i-1);
00422     }
00423     o_ch.reset();
00424 
00425     // Check subsumption
00426     if (c.empty()) {
00427       c.dispose(home);
00428       return ES_SUBSUMED(*this,sizeof(*this));
00429     }
00430     return ES_FIX;
00431   }
00432 
00433 
00434   template<class View, class Val, class Degree, class StateIdx>
00435   forceinline size_t
00436   LayeredGraph<View,Val,Degree,StateIdx>::dispose(Space& home) {
00437     c.dispose(home);
00438     (void) Propagator::dispose(home);
00439     return sizeof(*this);
00440   }
00441 
00442   template<class View, class Val, class Degree, class StateIdx>
00443   template<class Var>
00444   ExecStatus
00445   LayeredGraph<View,Val,Degree,StateIdx>::post(Home home, 
00446                                                const VarArgArray<Var>& x,
00447                                                const DFA& dfa) {
00448     if (x.size() == 0) {
00449       // Check whether the start state 0 is also a final state
00450       if ((dfa.final_fst() <= 0) && (dfa.final_lst() >= 0))
00451         return ES_OK;
00452       return ES_FAILED;
00453     }
00454     assert(x.size() > 0);
00455     for (int i=x.size(); i--; ) {
00456       DFA::Symbols s(dfa);
00457       typename VarViewTraits<Var>::View xi(x[i]);
00458       GECODE_ME_CHECK(xi.inter_v(home,s,false));
00459     }
00460     LayeredGraph<View,Val,Degree,StateIdx>* p =
00461       new (home) LayeredGraph<View,Val,Degree,StateIdx>(home,x,dfa);
00462     return p->initialize(home,x,dfa);
00463   }
00464 
00465   template<class View, class Val, class Degree, class StateIdx>
00466   forceinline
00467   LayeredGraph<View,Val,Degree,StateIdx>
00468   ::LayeredGraph(Space& home, bool share,
00469                  LayeredGraph<View,Val,Degree,StateIdx>& p)
00470     : Propagator(home,share,p), n(p.n), n_states(p.n_states),
00471       layers(home.alloc<Layer>(n+2)+1), states(NULL) {
00472     c.update(home,share,p.c);
00473     // The states are not copied but reconstructed when needed (advise)
00474     // Copy layers
00475     for (int i=n; i--; ) {
00476       layers[i].x.update(home,share,p.layers[i].x);
00477       assert(layers[i].x.size() == p.layers[i].size);
00478       layers[i].size = p.layers[i].size;
00479       layers[i].support = home.alloc<Support>(layers[i].size);
00480       for (unsigned int j=layers[i].size; j--; ) {
00481         layers[i].support[j].val = p.layers[i].support[j].val;
00482         layers[i].support[j].n_edges = p.layers[i].support[j].n_edges;
00483         assert(layers[i].support[j].n_edges > 0);
00484         layers[i].support[j].edges = 
00485           home.alloc<Edge>(layers[i].support[j].n_edges);
00486         for (Degree d=layers[i].support[j].n_edges; d--; )
00487           layers[i].support[j].edges[d] = p.layers[i].support[j].edges[d];
00488       }
00489     }
00490   }
00491 
00492   template<class View, class Val, class Degree, class StateIdx>
00493   PropCost
00494   LayeredGraph<View,Val,Degree,StateIdx>::cost(const Space&,
00495                                                const ModEventDelta&) const {
00496     return PropCost::linear(PropCost::HI,n);
00497   }
00498 
00499   template<class View, class Val, class Degree, class StateIdx>
00500   Actor*
00501   LayeredGraph<View,Val,Degree,StateIdx>::copy(Space& home, bool share) {
00502     // Eliminate an assigned prefix
00503     if (layers[0].size == 1) {
00504       /*
00505        * The state information is always available: either the propagator
00506        * has been created (hence, also the state information has been
00507        * created), or the first variable become assigned and hence
00508        * an advisor must have been run (which then has created the state
00509        * information).
00510        */
00511       assert(states != NULL);
00512       // Skip all layers corresponding to assigned views
00513       StateIdx k = 1;
00514       while (layers[k].size == 1)
00515         k++;
00516       // There is only a single edge
00517       assert((layers[k-1].support[0].n_edges == 1) &&
00518              (states[layers[k-1].support[0].edges[0].o_state].i_deg == 1));
00519       // Eliminate assigned layers
00520       n -= k; layers += k;
00521       // Update advisor indices
00522       for (Advisors<Index> as(c); as(); ++as)
00523         as.advisor().i -= k;
00524       // Update states
00525       states += k*n_states;
00526       for (int i=n; i--; )
00527         for (unsigned int j=layers[i].size; j--; )
00528           for (Degree d=layers[i].support[j].n_edges; d--; ) {
00529             layers[i].support[j].edges[d].i_state -= k*n_states;
00530             layers[i].support[j].edges[d].o_state -= k*n_states;
00531           }
00532     }
00533     return new (home) LayeredGraph<View,Val,Degree,StateIdx>(home,share,*this);
00534   }
00535 
00537   template<class Var>
00538   forceinline ExecStatus
00539   post_lgp(Home home, const VarArgArray<Var>& x, const DFA& dfa) {
00540     Gecode::Support::IntType t_state_idx =
00541       Gecode::Support::s_type((x.size()+2)*dfa.n_states());
00542     Gecode::Support::IntType t_degree =
00543       Gecode::Support::u_type(dfa.max_degree());
00544     Gecode::Support::IntType t_val = 
00545       std::max(Support::s_type(dfa.symbol_min()),
00546                Support::s_type(dfa.symbol_max()));
00547     switch (t_val) {
00548     case Gecode::Support::IT_CHAR:
00549     case Gecode::Support::IT_SHRT:
00550       switch (t_state_idx) {
00551       case Gecode::Support::IT_CHAR:
00552         switch (t_degree) {
00553         case Gecode::Support::IT_CHAR:
00554           return Extensional::LayeredGraph
00555             <typename VarViewTraits<Var>::View,short int,unsigned char,signed char>
00556             ::post(home,x,dfa);
00557         case Gecode::Support::IT_SHRT:
00558           return Extensional::LayeredGraph
00559             <typename VarViewTraits<Var>::View,short int,unsigned short int,signed char>
00560             ::post(home,x,dfa);
00561         case Gecode::Support::IT_INT:
00562           return Extensional::LayeredGraph
00563             <typename VarViewTraits<Var>::View,short int,unsigned int,signed char>
00564             ::post(home,x,dfa);
00565         default: GECODE_NEVER;
00566         }
00567         break;
00568       case Gecode::Support::IT_SHRT:
00569         switch (t_degree) {
00570         case Gecode::Support::IT_CHAR:
00571           return Extensional::LayeredGraph
00572             <typename VarViewTraits<Var>::View,short int,unsigned char,short int>
00573             ::post(home,x,dfa);
00574         case Gecode::Support::IT_SHRT:
00575           return Extensional::LayeredGraph
00576             <typename VarViewTraits<Var>::View,short int,unsigned short int,short int>
00577             ::post(home,x,dfa);
00578         case Gecode::Support::IT_INT:
00579           return Extensional::LayeredGraph
00580             <typename VarViewTraits<Var>::View,short int,unsigned int,short int>
00581             ::post(home,x,dfa);
00582         default: GECODE_NEVER;
00583         }
00584         break;
00585       case Gecode::Support::IT_INT:
00586         switch (t_degree) {
00587         case Gecode::Support::IT_CHAR:
00588           return Extensional::LayeredGraph
00589             <typename VarViewTraits<Var>::View,short int,unsigned char,int>
00590             ::post(home,x,dfa);
00591         case Gecode::Support::IT_SHRT:
00592           return Extensional::LayeredGraph
00593             <typename VarViewTraits<Var>::View,short int,unsigned short int,int>
00594             ::post(home,x,dfa);
00595         case Gecode::Support::IT_INT:
00596           return Extensional::LayeredGraph
00597             <typename VarViewTraits<Var>::View,short int,unsigned int,int>
00598             ::post(home,x,dfa);
00599         default: GECODE_NEVER;
00600         }
00601         break;
00602       default: GECODE_NEVER;
00603       }
00604 
00605     case Gecode::Support::IT_INT:
00606       switch (t_state_idx) {
00607       case Gecode::Support::IT_CHAR:
00608         switch (t_degree) {
00609         case Gecode::Support::IT_CHAR:
00610           return Extensional::LayeredGraph
00611             <typename VarViewTraits<Var>::View,int,unsigned char,signed char>
00612             ::post(home,x,dfa);
00613         case Gecode::Support::IT_SHRT:
00614           return Extensional::LayeredGraph
00615             <typename VarViewTraits<Var>::View,int,unsigned short int,signed char>
00616             ::post(home,x,dfa);
00617         case Gecode::Support::IT_INT:
00618           return Extensional::LayeredGraph
00619             <typename VarViewTraits<Var>::View,int,unsigned int,signed char>
00620             ::post(home,x,dfa);
00621         default: GECODE_NEVER;
00622         }
00623         break;
00624       case Gecode::Support::IT_SHRT:
00625         switch (t_degree) {
00626         case Gecode::Support::IT_CHAR:
00627           return Extensional::LayeredGraph
00628             <typename VarViewTraits<Var>::View,int,unsigned char,short int>
00629             ::post(home,x,dfa);
00630         case Gecode::Support::IT_SHRT:
00631           return Extensional::LayeredGraph
00632             <typename VarViewTraits<Var>::View,int,unsigned short int,short int>
00633             ::post(home,x,dfa);
00634         case Gecode::Support::IT_INT:
00635           return Extensional::LayeredGraph
00636             <typename VarViewTraits<Var>::View,int,unsigned int,short int>
00637             ::post(home,x,dfa);
00638         default: GECODE_NEVER;
00639         }
00640         break;
00641       case Gecode::Support::IT_INT:
00642         switch (t_degree) {
00643         case Gecode::Support::IT_CHAR:
00644           return Extensional::LayeredGraph
00645             <typename VarViewTraits<Var>::View,int,unsigned char,int>
00646             ::post(home,x,dfa);
00647         case Gecode::Support::IT_SHRT:
00648           return Extensional::LayeredGraph
00649             <typename VarViewTraits<Var>::View,int,unsigned short int,int>
00650             ::post(home,x,dfa);
00651         case Gecode::Support::IT_INT:
00652           return Extensional::LayeredGraph
00653             <typename VarViewTraits<Var>::View,int,unsigned int,int>
00654             ::post(home,x,dfa);
00655         default: GECODE_NEVER;
00656         }
00657         break;
00658       default: GECODE_NEVER;
00659       }
00660 
00661     default: GECODE_NEVER;
00662     }
00663     return ES_OK;
00664   }
00665 
00666 }}}
00667 
00668 // STATISTICS: int-prop
00669