int main() {
  circ = load_circuit();
  //print_circuit(circ);

  //print_tree(circ_tree, 600, 0);
  //print_tree(circ_tree, 600, 1);

  fprintf(stderr, "Cost: %lld\n", register_circuit(circ));
  anneal();

  //print_tree(c_tree, 650,0);

  print_circuit(circ);

}
Example #2
0
void tiernan(int start_node, int end_node){
	int k,i,j,ckt=0;
	//p[0] = 0;
	
	for(i = start_node; i<end_node; i++){
		visited_cnt = 0;
		ckt = 0;
		k = 0;
		//printf("Current i: %d\t Current k: %d\n",i,k);
		p[0] = i;
		

		while(1){
			if((j=path_extension(k)) > -1){
				k=k+1;
				p[k] = g[p[k-1]].edge[j];
				if(k == 1){
					add_to_visited(p[k]);
				}
			}
			else{
				if(belongs_toG(k) && length_of_circuit()!=2){ //circuit confirmation
					if(check_in_visited()){
						print_circuit();//circuit is reported
						ckt++;
					}
				}
				if(k == 0){	//vertex closure
				//	printf("For i: %d, Circuits: %d\n",i+1,ckt);
					break;
				}
				else{
					
					set_H(k,0);
					set_H(k,1);
					p[k] = -1;
					k--;				
				//	if(k < 5)
					//printf("Current K in Else: %d\n",k);
				}
			}
			
		}
		reset_H();
		reset_visited();

	}
}
Example #3
0
static void sweeping (int w) {
    for (int ll = 0; ll < w; ++ll) {
        Word llwire = wires[ll];
        linputs[w] = ll;
        if (w+1 == nwires)
            for (int rr = 0; rr <= ll; ++rr) {
                if ((mask & compute (llwire, wires[rr])) == target_output) {
                    found = 1;
                    rinputs[w] = rr;
                    print_circuit ();
                }
            }
        else
            for (int rr = 0; rr <= ll; ++rr) {
                wires[w] = compute (llwire, wires[rr]);
                rinputs[w] = rr;
                sweeping (w + 1);
            }
    }
}