SEclone basic classes for tagging

Are still missing the following classes of our first list



TZF          to store primary weak links and data required to trace back a chain

TDB         the table of “bit field “collecting all weak links in “implication form”

TCHOIX to store all sets to check for set eliminations or derived weak links.


The next one to study is TDB, which is basically a table of bit fields CB1024 where implications are settled.


We will see that the class TZF holds several occurrences (phases)  of a pair of TDB

 . One with the primary weak links (implications)

 . One with expanded implications


Each cycle of derivation generate a new couple/(phase) of TDB; the current pair is the basis to locate eliminations or loops. The other tables are kept to solve nested chains when it will come.



A table of implications: class   TDB


The class can be summarized as


. The table CB1024  t[640], storing the implications in bit fields of lemaximul used length 640 bits

. All necessary stuff to find a path


   These data are mostly static due to the fact that we have only one process and many TDBs

   As some functions are obsolete, I’ll summarize the main ones


   InitD() is the expansion of implications

   Set() Plus() Entre() are for the building phase of primary weak links

   Parents() create the reverse table of all ‘x’ -> “y”


   Direct_Path() is the main entry to extract a path in tags form

   Direct_Step() is the recursive searh for such a path

   Length() search the equivalent SE length of a path


  Yloop() and Loop-Layer()  are the entry points to find the corresponding eliminations


  The last 2 functions IsActiveOr() and  CleanOr() are part of the process of a path.


class TDB{


static CB1024 done[50]; // already in the path

static USHORT ich,mode,length,mmfin,maxlength,mincluded;

static PATH path, pathr[2];


CB1024 t[640],parents;      



void Init(){t[0].Init();for(int i=1;i<2048;i++) {t[i]=t[0];} }

void InitD(int np=30);

inline void Set(int i, int m) {t[i].Set(m);};

void KillGroupe(USHORT t);


inline int Is(int i,int m){return t[i].Isch(m);};

inline int IsConflit(int m1, int m2) {return Is(m1,m2^1);}

inline int IsOu (int m1, int m2) {return Is(m1^1,m2);}

void TDB::Parents(USHORT x){parents.Init();

                          for(int i=2;i<col;i++) if(t[i].On(x)) parents.Set(i);}

void Copy_Path(int x){pathr[x]=path;}

void Copy_Back(int x){path=pathr[x];}                



void Direct_Path(int m1, int m2, CB1024 & parents,USHORT modee);

void Direct_Step();

int Length(int print); //length of an identified chain



void Yloop(int m1,int m2, CB1024 & loop);

void Loop_Layer();


int IsActiveOr(USHORT m1,USHORT m2);

void CleanOr(USHORT m1,USHORT m2);



int Plus (int m1,int m2)  {if (!t[m1].Isch(m2))

                { t[m1].Set(m2);  return 1; }else return 0;};

int  Entre(int m1,int m2){ return (Plus(m1,m2^1)+ Plus(m2,m1^1));};

void Image();



 CB1024 TDB::done[50];

USHORT  TDB::ich, TDB::mode, TDB::length, TDB::mmfin, TDB::maxlength, TDB::mincluded;

PATH   TDB::path,TDB::pathr[2];




Finding a path recursive search Direct_Step()



The search of a path is slightly more complex than within a layer.


First of all, we can never predict what will be the additional pieces of path added thru the layers


Very often, we are not looking for the shortest loop, but for an active loop

  . crossing 2 candidates.

  . Not crossing an identified target


“Y”  mode and “aligned exclusion” have no pieces of path in the layers


And we want to stop as soon as possible

  .if we have passed the shorter rating

  . If we have passed specified limits (aligned pair exclusion)


This gives the following code for the recursive routine where parents play a key role.


/* parents is a CB1024 containing all the parents of the target

   done[]  is a CB1024 containing all tags already in the path

   ich is the last index of the known path

   path is the current path

   mmfin is the target 

   maxlength is a filter to stop the search as soon as possible

   mincluded must be in the past if mode = Y loop

   mode value  0 get length standard

               1 direct chain, finish as elimination


               3 and more, "y" mode, no need to go in the layers

                        3 Y chain

                        4 Y loop

                        5 aligned pair exclusion

                        6 aligned triplet exclusion



void TDB::Direct_Step()


  {E$.E("direct step ich ="); E$.E(ich );

            done[ich].ImageMarques(" done =",0);

                     t[path.Get(ich)].ImageMarques(" new =",0); E$.Enl();}

       for(int i=2;i<col;i++)   // look for next possible tag

  { if(parents.On(i)  &&   // must be a parent of the target

    t[path.Get(ich)].On(i) &&   // must be a direct implication for the last tag

       done[ich].Off(i))      // still free (no return)

                    // so we got one tag to go ahead

     { path.Add(i);ich++;       // we enter it in the current path


           {if(  ((mode>3) && ich>12)  // y  too big

                    || ((mode==5) && ich>1) ) // pair exclusion  too big




          Direct_Step();ich--;path.Back(); }  // continue if the target is not reached  

         else // we got one path, check length  if < store it

            {if(  (mode==4) && done[ich-1].Off(mincluded) )                     

                        {ich--;path.Back();continue;} // y  loop must contain mincluded

                     USHORT ll; if(mode<3)   ll=Length(0); else ll=path.ipth;

                           // ici il manque le stock du bon zpln

             if(ll<length) {length=ll;Copy_Path(0);      }



   }//end for



In the standard call, we assume some data have been set before (mincluded)

Maxlength is not yet in use and tests are still ongoing for  that process.


void TDB::Direct_Path(int m1, int m2, CB1024 & start,USHORT modee)


     {E$.E("direct path "); mms.ev(m1);E$.E("->");mms.ev(m2);

           start.ImageMarques(" start =",0);E$.Enl();}

mmfin=m2;   ich=0; path.Init(); path.Add(m1);

mode=modee; length=100;   parents=start; 

done[0].Init(); if(m1-m2)done[0].Set(m1);



if(length>50) {length=0;return;}

Copy_Back(0); // get the final path in mch

if(o$.ot)// to get the final print  a revoir pas stocké le bon zpln



       {case 0:  return;                                       // partial chain             

        case 1:   if(!tchain.Chaine(length,path.GetFirst())) return;    // direct chain                




        case 2:                                // direct loop






And the Length() call is what remains form the code previously written : a call to the relevant process in TZPTLN.


/* a path has been found    compute the path length in SE mode

      we have to add what is done in layers

       printing for test is done in option */


int TDB::Length(int print)

{int pr=(o$.ot && print);

 int wl=zpln.Find_Length(path,0);

 if(pr) zpln.pathr.PrintPath();

 return wl;}



The missing code for that class is in tdb.;cpp.