src/puzzle.cpp
/*
    warning
	                  ================================
	that process and upstream search should be extended to dynamic forcing chain
	and dynamic nested forcing chain
	it seems this does not exist in serate so chould be an option 
	                   ==============================

Dynamic search in nested mode for a candidate
   do both contradiction, 
   direct  a -> x and a -> ~x so 'a' is false
   indirect x -> ~a   and ~x -> ~a  'a' is false
     (also x -> ~a and y -> ~a if xy is a bivalue
   and "set contradiction" 2 a for each start "true" of the set
   tagnot is
     0 if no indirect search has to be done
	 pointer to tag expanded to do a direct check

   zcf.h is refreshed for each new entry from zcf.h_one
   zcf.h.dp follows the dynamic forward process 
     each new link is loaded in the dp table
*/
warning
that process and upstream search should be extended to dynamic forcing chain
and dynamic nested forcing chain
it seems this does not exist in serate so chould be an option



zcf.h is refreshed for each new entry from zcf.h_one
zcf.h.dp follows the dynamic forward process
each new link is loaded in the dp table
warning that process and upstream search should be extended to dynamic forcing chain and dynamic nested forcing chain it seems this does not exist in serate so chould be an option zcf . h is refreshed for each new entry from zcf . h_one zcf . h . dp follows the dynamic forward process each new link is loaded in the dp table
int PUZZLE::GoNestedCase1(USHORT cand) {
	opp = 0; 
	USHORT tag = cand << 1; 
	if(rbase>90){
	   zcf.StartNestedOne();
	   zcx.StartNestedOne();
	   zcxb.StartNestedOne();
	}
	BFTAG tt = zcf.h.d.t[tag]; 
	if( opp) {
		    EE.E("go nested for cand ");
		    zpln.Image(cand);
		    EE.Enl();
	         }
	tcandgo.Init(); 
	tstore.Init(); 
	hdp_base_nested=zcf.hdp_base;
	to = zcf.hdp_dynamic.t; 
	for(int i = 0; i < 640; i++)
		tsets[i] = 0;
	npas = 0;
	steps[0].SetAll_0();
	steps[0].Set(tag); 
	allsteps = cumsteps[0] = steps[0];  
	tx[0][0] = tag;
	itx[0] = 1; 
	nested_aig = 1;
	int maxpas = pasmax;  
	while(nested_aig && npas++ <= maxpas) {
		nested_aig = 0; 
		cum = &cumsteps[npas - 1];
		step = &steps[npas];
		ta = tx[npas-1];
		ita = itx[npas - 1];
		GoNestedWhile(tag);                    
		if(nested_aig){
		  cumsteps[npas] = allsteps;   
		  (*step) = allsteps;
		  (*step)-=(*cum);  
		  (*step).String(tx[npas],itx[npas] );
		  }
	    else 
			break; 
		if( opp) {  
			EE.E("end step=");
			EE.E(npas);
			Image((*step),"step ", 0);
			Image(allsteps,"all", 0);
			EE.E(" tbuf.istore=");EE.E( tstore.ibuf);
			EE.E(" tbuf.ise=");EE.E( tstore.ise);
			EE.E(" tbuf.ise2=");EE.Enl( tstore.ise2);
		}
		USHORT * tb=tx[npas];
		for(int i = 0; i < itx[npas]; i++) {
			USHORT tgx = tb[i];
			if(allsteps.On(tgx) && allsteps.On(tgx ^ 1)) {
				if(0 && opp) {
					EE.E("\n\nfound active a -> x and a -> ~x");
					zpln.ImageTag(tgx);
					EE.E(" step=");
					EE.Enl(npas);   
				}
				if(maxpas > npas + 2)
					maxpas = npas + 2; 
				if(maxpas > pasmax)
					maxpas = pasmax;
				nested_print_option = 0;
				tstore_final.Init(); 
				int l1 = GoBackNested(tgx), 
					l2 = GoBackNested(tgx ^ 1);
				if(stop_rating) return 1;
				if((!l1) || (!l2))
					continue; 
				int ratch = tchain.GetRating(l1 + l2, tag >> 1);
				if(ratch) { 
					if(options.ot && ratch<120) { 
				        tstore_final.Init(); 
						nested_print_option=1;
						EE.E("\n\nchain plus killing ");
						zpln.Image(tag >> 1);
						EE.E(" computed length = ");
						EE.Enl(l1+l2);	     
						EE.E("chain 1 ");
						GoBackNested(tgx);
						EE.E("chain 2 ");
						GoBackNested(tgx ^ 1);
					}
					tchain.LoadChain(ratch, "chain plus", cand);
				}
             if(tchain.cycle_elims.On(cand)) break;
			} 
		}
		if(0 && !nested_aig) {
			EE.E("fin aig=0 pour step=");
			EE.Enl(npas);
		}
     if(tchain.cycle_elims.On(cand)) break;
	}
	return 0; 
}
int PUZZLE :: GoNestedCase1 ( USHORT cand ) { opp = 0 ; USHORT tag = cand << 1 ; if ( rbase > 90 ) { zcf . StartNestedOne ( ) ; zcx . StartNestedOne ( ) ; zcxb . StartNestedOne ( ) ; } BFTAG tt = zcf . h . d . t [ tag ] ; if ( opp ) { EE . E ( " " ) ; zpln . Image ( cand ) ; EE . Enl ( ) ; } tcandgo . Init ( ) ; tstore . Init ( ) ; hdp_base_nested = zcf . hdp_base ; to = zcf . hdp_dynamic . t ; for ( int i = 0 ; i < 640 ; i ++ ) tsets [ i ] = 0 ; npas = 0 ; steps [ 0 ] . SetAll_0 ( ) ; steps [ 0 ] . Set ( tag ) ; allsteps = cumsteps [ 0 ] = steps [ 0 ] ; tx [ 0 ] [ 0 ] = tag ; itx [ 0 ] = 1 ; nested_aig = 1 ; int maxpas = pasmax ; while ( nested_aig && npas ++ <= maxpas ) { nested_aig = 0 ; cum = & cumsteps [ npas - 1 ] ; step = & steps [ npas ] ; ta = tx [ npas - 1 ] ; ita = itx [ npas - 1 ] ; GoNestedWhile ( tag ) ; if ( nested_aig ) { cumsteps [ npas ] = allsteps ; ( * step ) = allsteps ; ( * step ) -= ( * cum ) ; ( * step ) . String ( tx [ npas ] , itx [ npas ] ) ; } else break ; if ( opp ) { EE . E ( " " ) ; EE . E ( npas ) ; Image ( ( * step ) , " " , 0 ) ; Image ( allsteps , " " , 0 ) ; EE . E ( " " ) ; EE . E ( tstore . ibuf ) ; EE . E ( " " ) ; EE . E ( tstore . ise ) ; EE . E ( " " ) ; EE . Enl ( tstore . ise2 ) ; } USHORT * tb = tx [ npas ] ; for ( int i = 0 ; i < itx [ npas ] ; i ++ ) { USHORT tgx = tb [ i ] ; if ( allsteps . On ( tgx ) && allsteps . On ( tgx ^ 1 ) ) { if ( 0 && opp ) { EE . E ( " \n \n " ) ; zpln . ImageTag ( tgx ) ; EE . E ( " " ) ; EE . Enl ( npas ) ; } if ( maxpas > npas + 2 ) maxpas = npas + 2 ; if ( maxpas > pasmax ) maxpas = pasmax ; nested_print_option = 0 ; tstore_final . Init ( ) ; int l1 = GoBackNested ( tgx ) , l2 = GoBackNested ( tgx ^ 1 ) ; if ( stop_rating ) return 1 ; if ( ( ! l1 ) || ( ! l2 ) ) continue ; int ratch = tchain . GetRating ( l1 + l2 , tag >> 1 ) ; if ( ratch ) { if ( options . ot && ratch < 120 ) { tstore_final . Init ( ) ; nested_print_option = 1 ; EE . E ( " \n \n " ) ; zpln . Image ( tag >> 1 ) ; EE . E ( " " ) ; EE . Enl ( l1 + l2 ) ; EE . E ( " " ) ; GoBackNested ( tgx ) ; EE . E ( " " ) ; GoBackNested ( tgx ^ 1 ) ; } tchain . LoadChain ( ratch , " " , cand ) ; } if ( tchain . cycle_elims . On ( cand ) ) break ; } } if ( 0 && ! nested_aig ) { EE . E ( " " ) ; EE . Enl ( npas ) ; } if ( tchain . cycle_elims . On ( cand ) ) break ; } return 0 ; }
warning
that process and upstream search should be extended to dynamic forcing chain
and dynamic nested forcing chain
it seems this does not exist in serate so chould be an option
warning that process and upstream search should be extended to dynamic forcing chain and dynamic nested forcing chain it seems this does not exist in serate so chould be an option
//if(1 && rbase>95)opp=1; // intital storage for strong links and nested eliminations // start with an empty table of chains stored //now go forward  till nothing or a contradiction // we use the table without derivations // initial is tag to go forward //ret_code = 0; // will be reduced to "one more" if something found //--------------------- loop  forward // prepare the call to GoNestedWhileShort // reasonnable stop for crazy cases // could surely be set lower //		if(cum->Count()>250) break; // nothing more to find /// en cours verif sur test // while cycle // something happenned // nothing to do // check for a contradiction in that lot  // we compute back the length and show the sequence  // limit the process to 2 more step //if(couprem==3)nested_print_option=1;  // start with an empty table of chains used // push back error code  // should not be // chain is accepted load it (more comments in test mode) //don't develop if >119 never seen used // start with an empty table of chains used // end load chain // stop as soon as elimination has been done // end one source for elimination // end for i // stop as soon as elimination has been done // end while //ret_code;