World time

<script src="http://www.clocklink.com/embed.js"></script><script type="text/javascript" language="JavaScript">obj=new Object;obj.clockfile="world001-blue.swf";obj.TimeZone="GMT-0800";obj.width=480;obj.height=250;obj.wmode="transparent";showClock(obj);</script>

time

obj=new Object;obj.clockfile=”world001-blue.swf”;obj.TimeZone=”GMT-0800″;obj.width=480;obj.height=250;obj.wmode=”transparent”;showClock(obj);

A Simple Example

mangosteen.cs.ttu.edu$ csp.out -f 3 3 3 3 1 3 1
The parameters of the random instances
  (n=3, d=3, e=3 , f=3 , t=1, # of instances=1, seed=3)
 
Instance 0:
The cn address is 0x960f0c8
nt=9  ft=3
——-all possible constraints——–
0 1
0 2
1 2
——–C/e constraints————–
1 2
0 1
0 2
——–2*C constraints———–
1 2
2 1
0 1
1 0
0 2
2 0
———F constraints————–
0 1
2 1
1 0
functional: 2 1
 
0 : 2
1 : 0
2 : 0
 
 
 Transpose:1 2:
before cn
I am after cn
0 : 2 1
1 :
2 : 0
 
 
 
 
Bijection: 0 1
 
0 1:
<0,1>   <2,0>   <1,2>   
Bijection Transpose:1 0:
<1,0>   <0,2>   <2,1>   
 
nonfunctional: 0 2
 
before cn
I am after cn
0 : 1 0 2
1 : 1 0 2
2 : 1 0 2
 
before cn
I am after cn
 
nonfuntional Traspose:2 0
0 : 2 0 1
1 : 0 2 1
2 : 2 0 1
 
 
 
 
adjGF:
0 : 1
1 : 0
2 : 1
 
 
funcross_link_list:
0 : 1 2
1 : 0 2
2 : 0 1
 
 
————CSP:cn———
 
0,2:
(0,0)(0,1)(0,2)
(1,0)(1,1)(1,2)
(2,0)(2,1)(2,2)
 
——-
 
1,2:
(0,1)(0,2)
 
(2,0)
 
——-
 
2,0:
(0,0)(0,1)(0,2)
(1,0)(1,1)(1,2)
(2,0)(2,1)(2,2)
 
——-
 
————CSP:fCN———
 
0,1:
(0,1)  (1,2)  (2,0)  
——-
 
1,0:
(0,2)  (1,0)  (2,1)  
——-
 
2,1:
(0,2)  (1,0)  (2,0)  
——-
n:3
 
adjGF:
0 : 1
1 : 0
2 : 1
 
 
adjTGF:
0 : 1
1 : 0 2
2 :
 
finished u=1
finished u=0
finished u=2
 
———-HERE DFS() done—————-
u=2 numComp=0
u=0 numComp=1
Components graph:
0 : 2
1 : 0 1
2 :
 
numComp=2
 
 Node2Component:
Node:0 , Component:1
Node:1 , Component:1
Node:2 , Component:0
 
 
———-HERE DFST() done—————
adjSCC:
0 : 1
1 :
 
 
———-HERE findSCCGF() done———-
finished u: 1
finished u: 0
 
———-HERE DFSSCC() done————-
 
Component:0
order[0] = 2
 
Component:1
order[1] = 0
order[2] = 1
 
———-HERE finalOrder() done———
O.Qlength=3
head=2
adjGF[i]: 1
O print:
0->1->NULL
end: O print
L print:
1->NULL
end: L print
 J : 1
————after array—————-
————after array set up—————-
————as previous link list—————-
i=2  j=1 k=0
functional[j*n+k] && (!wasIn[k])1—1
++++6+++++++++++++++++++++++++K 0
0->NULL
+++++7+++++++  k +++++++++++++++++0
————Origin cij:———
cij[0]2
cij[1]0
cij[2]0
————Origin cik:———
cjk[0]2
cjk[1]0
cjk[2]1
————Newcomposed CSP begin:———
v:0
c_{2,1}[0]2
cjk[v]2
cjk[cij[v]]1
c_ik[v]1
————Newcomposed CSP begin:———
v:1
c_{2,1}[1]0
cjk[v]0
cjk[cij[v]]2
c_ik[v]2
————Newcomposed CSP begin:———
v:2
c_{2,1}[2]0
cjk[v]1
cjk[cij[v]]2
c_ik[v]2
fCN[i*n+k][v]   :: 1
fCN[i*n+k][v]   :: 2
fCN[i*n+k][v]   :: 2
c_{2,0}: [ 0 1]
c_{2,0}: [ 1 2]
c_{2,0}: [ 2 2]
++++++++++++++++++
here we go: cik=fCN[i*n+k]
reviseDomain(i,k);
 
adjGF:
0 :
1 :
2 : 1 0
 
 
funcross_link_list:
0 : 2
1 : 2
2 : 0 1
 
 
————CSP:cn———
 
0,2:
(0,1)
(1,2)
(2,2)
 
——-
 
1,2:
(0,1)(0,2)
 
(2,0)
 
——-
 
————CSP:fCN———
 
2,0:
(0,1)  (1,2)  (2,2)  
——-
 
2,1:
(0,2)  (1,0)  (2,0)  
——-
————as previous link list—————-
i=2  j=1 k=2
functional[j*n+k] && (!wasIn[k])0—1
L.QLength() : 1
Queue is empty.
++++++8+++++++++++++++++++++++
O.Qlength=2
head=0
adjGF[i]: 0
O print:
1->NULL
end: O print
L print:
Queue is empty.
end: L print
++++++8+++++++++++++++++++++++
O.Qlength=1
head=1
adjGF[i]: 0
O print:
Queue is empty.
end: O print
L print:
Queue is empty.
end: L print
++++++8+++++++++++++++++++++++
start: translation
end: translation
delete:fCN
 
————CSP:cn———
 
0,2:
(0,1)
(1,2)
(2,2)
 
——-
 
1,2:
(0,1)(0,2)
 
(2,0)
 
——-
 
2,0:
 
(1,0)
(2,1)(2,2)
 
——-
 
2,1:
(0,2)
(1,0)
(2,0)
 
——-
 
————CSP:fCN———
Checking Solution Against Constraint Graph
Solution Acceptable.
# of values removed before search:# of values removed:# of constraint checks:# of domain checks
2:6:39:0
[BT::statistics()] #backtracks=0 maxPhase=3
number of failed assignments:0
number of pruned values:0
:Time used:0.0s
average cchecks+dchecks+ochecks: average backtracks: average search depth
39+0+0:0:3
the consistent instances are (%d)
1
 %d0
the inconsistent instances are (%d)
0
 
Total time:0.0s
mangosteen.cs.ttu.edu$ csp.out -f 3 3 3 3 1 3 1

adjGF

adjGF:
0 : 8
1 :
2 : 5
3 : 4
4 : 3 6
5 : 7 8
6 :
7 :
8 : 3  
funcross_link_list:
0 : 8
1 : 6
2 : 4 5
3 : 4 8
4 : 2 3 6
5 : 2 7 8
6 : 1 4
7 : 5
8 : 0 3 5
—————————fc(0,8,3)
adjGF:
0 : 8 3
1 :
2 : 5
3 : 4
4 : 3 6
5 : 7 8
6 :
7 :
8 :   
funcross_link_list:
0 : 8 3
1 : 6
2 : 4 5
3 : 4 0
4 : 2 3 6
5 : 2 7 8
6 : 1 4
7 : 5
8 : 0 5
============================nfc(0,8,5)
adjGF:
0 : 8 3
1 :
2 : 5
3 : 4
4 : 3 6
5 : 7 8
6 :
7 :
8 :

funcross_link_list:
0 : 8 3 5
1 : 6
2 : 4 5
3 : 4 0
4 : 2 3 6
5 : 2 7 0
6 : 1 4
7 : 5
8 : 0

segmentation debug

————Newcomposed CSP begin:——— v:8 c_{3,4}[8]-1 cjk[v]-1 cjk[cij[v]]41 c_ik[v]-1 c_{3,6}: [ 0 8] c_{3,6}: [ 1 1] c_{3,6}: [ 2 3] c_{3,6}: [ 3 -1] c_{3,6}: [ 4 -1] c_{3,6}: [ 5 3] c_{3,6}: [ 6 4] c_{3,6}: [ 7 -1] c_{3,6}: [ 8 -1] ++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++ typecons=:2 removed v : 0 reviseDomain(i,k); L.QLength() : 1 Queue is empty. ++++++8+++++++++++++++++++++++ O.Qlength=6 head=4 adjGF[i]: 2 O print: 7->8->6->5->2->NULL end: O print L print: 3->6->NULL end: L print starting L.QLength() : 1 i=4 j=3 k=4 functional[j*n+k] && (wasIn[k])1—1 ++++6+++++++++++++++++++++++++K 4 i=4 j=3 k=8 functional[j*n+k] && (wasIn[k])0—1 +++++7+++++++ k +++++++++++++++++8 L.QLength() : 2 4->NULL starting L.QLength() : 0 i=4 j=4 k=2 functional[j*n+k] && (wasIn[k])0—1 i=4 j=4 k=3 functional[j*n+k] && (wasIn[k])1—0 i=4 j=4 k=6 functional[j*n+k] && (wasIn[k])1—0 L.QLength() : 0 Queue already empty. Queue is empty. ++++++8+++++++++++++++++++++++ O.Qlength=5 head=7 adjGF[i]: 0 O print: 8->6->5->2->NULL end: O print L print: Queue is empty. end: L print ++++++8+++++++++++++++++++++++ O.Qlength=4 head=8 adjGF[i]: 1 O print: 6->5->2->NULL end: O print L print: 3->NULL end: L print starting L.QLength() : 0 i=8 j=3 k=4 functional[j*n+k] && (wasIn[k])1—0 +++++7+++++++ k +++++++++++++++++4 ————Origin cij:———

Neural network -matlab implement

function sigmoid = sigmoid(var)
   sigmoid = 2/(1+exp(-var)) - 1;
end
function dsigmoid = dsigmoid(var)
   dsigmoid = 0.5 * (1 + sigmoid(var)) * (1 - sigmoid(var));
end

[x,y,t] = textread(’hw3data.txt’,'%f %f %f’);
m=1;n=1;
for i =1 : length(t)
    if t(i) == 1
        x1(m) = x(i);
        y1(m) = y(i);
        m = m + 1;
    else
        x2(n) = x(i);
        y2(n) = y(i);
        n = n + 1;
    end
end

 P1 = 5;
 P2 = 5;
 U = rand(3,5);
 V = rand(6,5);
 W = rand(6,1);
 dU = rand(3,5);
 dV = rand(6,5);
 dW = rand(6,1);
 alpha = 0.4;
 epach = 0;
 i = 1;
 max=10000;
 
 while(i<max) && stopping_cond < 30
     E(i) = 0;
     epach = epach + 1;
     for i = 1 : 600
         %feed forward: set p1=5 p2=5
         for j1 = 1 : P1
             z_in(j1) = sum(x(i)*U(i))
             z(j1) = 2/(1+exp(-z_in(j1))) - 1;
             for j2 = 1 : P2
                 zz_in(j2) = sum(z(j1)* V(j1,j2));
                 %when should I add ";" after finishing a line
                 zz(j2) = 2/(1 + exp(- z_in(j2)) - 1;
                 y_in = sum(zz(j2)*W(j2,1));
                 y = 2/(1 + exp(- y_in)) - 1;
             end
         end
         
         %error
         E(i) = E(i) + (t(i) - y(i))^2;
         stopping_cond=E(i);
         %—————-BP
         %1. set up delta
         for k = 1 : 600
             delta(k) = (t(k)-y(k)) * dsigmoid(y_in(k));
             k = k + 1;
         end         
         
         dW(0,1) = alpha * delta(0);
         for j2 = 1 : P2
             dW(j2,1) = alpha * delta(zz(j2));
             delta(zz_in(j2))= delta(j2)*W(j2,1);
             %???delta(zz(j2)) or delta(j2)
             delta(zz(j2))=delta(zz_in(j2))*dsigmoid(zz_in(j2));
             dV(0,j2)=alpha*delta(zz(j2))
             for j1 = 1 : P1
                 dV(j1,j2)=alpha*delta(zz(j2))*z(j1);                 
             end      
         end         
         %——
         for j1=1:P1
             for j2=1:P2
                 delta(z_in(j1))=delta(z_in(j1))+delta(zz(j2))*V(j1,j2);
             end
             delta(z(j1))=delta(z_in(j1))*dsigmoid(z_in(j1));
             dU(0,j1)=alpha*delta(z(j1));
             dU(i,j1)=alpha*delta(z(j1))*x(i);
         end         
         
         %—update weight and bias:U = U + DU;…
         for j1=1:P1
             for j2=1:P2
                 W(j2,1)=W(j2,1)+dW(j2,1);
                 V(j1,j2)=V(j1,j2)+dV(j1,j2);
             end
             U(i,j1)=U(i,j1)+dU(i,j1);
         end
                  
         U
         V
         W
     end
     i = i + 1;
 end
 
 scatter(x1,y1,’+b’)
 hold on
 scatter(x2,y2,’+r’)
 axis([-0.5,1.5,-0.5,1.5])
 x = -0.5 : 0.005 : 1.5
 y = -0.5 : 0.005 : 1.5
 [ X, Y ] = meshgrid(x, y);
 
 %how to make the following?
 %newx = [x’ size(y)];
 %newy = [y’ size(y)];
 k = 1;
 for i = 1 : 401
     for j = 1 : 401
         newx(k) = X(i,j);
         newy(k) = Y(i,j);
         k = k + 1;
     end
 end
 
 for i= 1 : length(newx)
     %feed forward: set p1=5 p2=5
         for j1 = 1 : P1
             z_in(j1) = sum(x(i)*U(i))
             z(j1) = 2/(1+exp(-z_in(j1))) - 1;
             for j2 = 1 : P2
                 z_in(j2) = sum(z(j1)* V(j1,j2));
                 %when should I add ";" after finishing a line
                 zz(j2) = 2/(1 + exp(- z_in(j2)) - 1;
                 y_in = sum(zz(j2)*W(j2,1));
                 y(i) = 2/(1 + exp(- y_in(i))) - 1;
             end
         end
 end
 Z = y;
 contour(newx,newy,Z)
 
 hold off    
 legend(’data +1′, ‘data -1′)
 title(’HW3:NN’)    
 
    

P.R.

load HW2pos.dat

load HW2neg.dat

x1=HW2pos(:1);

x1=HW2pos(:,1);

y1=HW2pos(:,2);

x2=HW2neg(:,1);

y2=HW2neg(:,2);

scatter(x1,y1,’+r’,x2,y2,’+b’)

scatters(x1,y1,’+r’,x2,y2,’+b’)

scatter(x1,y1,’+r’,x2,y2,’+b’)

scatter(x1,y1,’+r’)

hold on

scatter(x2,y2,’+g’)

title(’Homework2′)

legend(’+r, data +1′,’+g, data -1′)

legend(’data +1′,’ data -1′)

x1minusu=x1-4.0034;

y1minusu=y1+0.0637;

class1minusu1=[x1minusu y1minusu];

m=class1minusu1*class1minusu1′;

sumofm=sum(m);

hold off

%——————— –%

sumA=0

for i=1:300

A=[x1minusu(i) y1minusu(i)]’*[x1minusu(i) y1minusu(i)]

sumA=sumA+A

end

sumA

sumA./299

sigma1=sumA./299

inv(sigma1)

inv6=inv(sigma1)

W1=inv6.*(-0.5)

x2minusu=x2.-4.0025

x2minusu=x2-4.0025

y2minusu=y2-2.0047

sumB=0

for i=1:300

B=[x2minusu(i) y2minusu(i)]’*[x2minusu(i) y2minusu(i)]

sumB=sumB+B

end

sigma2=sumB./299

sumB

inv62=inv(sigma2)

W2=inv62*.(-0.5)

W2=inv62.*(-0.5)

W1-W2

norm(sigma1)

(-0.5)*lnnorm(sigma1)

(-0.5)*ln(norm(sigma1))

(-0.5)*log(norm(sigma1))

u1=[4.0034 -0.0637]

u2=[4.0025 2.0047]

W100=(-0.5)* u1 * inv6 * u1′

W100+0.0414+0.5

W200=(-0.5)* u2 inv62 * u2′

W200=(-0.5)* u2 * inv62 * u2′

W200+(-0.5) * log(norm(sigma2)) +0.5

(W1-W2)’

w1=inv6*u1

w1=inv6*u1′

w2= inv62* u2′

w1-w2

-377.0874-(-25.2259)

f=-0.8412

g=f

h=0.4546

w22=2.6536;

w11=173.5067;

w0=-351.8615;

e=-21.1271;

for i=1 :300

a=h

b=(f+g)* x1(i)+ w22

for i=1 :300

a=h

b=(f+g)* x1(i)+ w22;

Errata of Dr. Gelfond’ Notes

Here only list some important one.

Then–>Than

Lower Bound Algorithm condition 3. Condition should be stronged as the one and the only one to fuarantee the conclusion.

Example2 for the  Lower Bound Algorithm. It should stop in the previous step. There is a contradiction in the final step.

 For other errors please contact licody202 at yahoo. com. cn. These errors are as of 12/01/2007 from Dr. Gelfond lecture notes for CS5368 Intelligent System.

Any comments are welcome! 

 

Example of LE

SCC1:(A,B) (B,C)(C,D)(D,A)
SCC2:(G,E)(E,F)(F,G)(E,H)(H,E)
NonScc:(C,E)
Suppose  A  is the base point(choose randomly),  the time of composition is at least 3.
However, if we choose C as the base point , we only need 2 compositions around SCC1.  The similar situation happen to SCC2.
we delete B(composition (A,C)), and then C(composition (A,D);composition (A,E)): —> we have 2 choice
1. continute composition with A as the base point. In this case, we continue to composition (A,H)composition (A,F) composition (A,G) ? Is this the different method to do the composition? The idea is that before we want to delete one vertex in the graph, we have to finish all the composition between the base point and another point that is reachable from  the current vertex to guarantee that we can remove the current vertex safely, namely, we reserve the same resolution (space).
2. move to SCC2 select E as base point to minimize the times of composition…

Which is the one we should select? 

Linear Elimination Algorithm

Linear Elimination(inout(N,D,C)) // What does inout mean?
{
  Found_Strongly_connected(GF); // the function is try to find all the SCC of GF of                                     //   (N,D,C)
  for(m=1;m<number_SCC;m++)   // in each SCC?
  {
   SCC(m);
   substitution=i;            //choose any var i belong to SCC
   L=all_reachable(i); // directly,
all_reachable(i) return a set that is     
     //  directly reachable from i.

   While(!empty(L))
     { j=
reachable(i);
       delete(j);
       for(p=1;p<n_constraint(j)&&C!=C(j,i);p++)   //hoe to express except C(j,i)    
       {
         compose(i,j,k) ;
         update(C);
         modify(L);
        
       }
     }
 
  }
  for(n=1;n<n_eliminated;n++)
  {
   delete(eliminated);
   delete(edges);
  }
  o=topsort(left); // functional ??
  while(!empty(o))
  {
    i=first(o);
    delete(i);
    L=all_reachable(i);
    while(!empty(L))
      {
         j=reachable(i);
         delete(j);
        
for(p=1;p<n_constraint(j)&&C!=C(j,i);p++)   //hoe to express except C(j,i)    
           {
             compose(i,j,k) ;
             update(GF);
             modify(L);
        
           }

      }
   
  }

}