/** IDEAL ENERGY LANDSCAPE OF HORN CLAUSES **/
/** Bipolar Sigmoid Activation Function **/
#include
#include
#include
#include
#define NN 10 /** Neurons **/
#define Nc1 2 /** First order **/
#define Nc2 2 /** Second second order **/
#define Nc3 2 /** Third order **/
#define NH 100 /** Number of Hebbian Learning **/
#define RELAX 100 /** Relaxation time **/
#define NT 100 /** Number of trial **/
#define COMBMAX 100 /**Maximum combination for neurons **/
#define TOL 0.001 /** Tolerance value **/
#define TRUE 1
#define FALSE 0
#define NEGBIAS -0.0
#define NCHCHECK 5
void main()
{
time_tstart,end;
doubledif;
int c3[Nc3][3],c2[Nc2][2],c1[Nc1],i,j,k,l,y,z,n,m,NS[NN],Nbef[NN],iev,ievn,p,comb;
int NI[NN],NF[NN];
floatzM,yM,nrelaxM,nrelaxMM;
float J1[NN],J2[NN][NN],J3[NN][NN][NN];
float Erg1,Erg2,Erg3,E1,E2,E3;
floatdevG,devHD,devHG,devHL;
float ES;
floatEav;
float min;
float h[NN];
floatEavM;
floatvarians,variansR;
floatsp,spR;
float EM,EAM;
floatHamming_Distance,HDG,HDL,HDGlobal,HDLocal;
intchange,nchange,nrelax;
floatnR,NRE,htaf;
time (&start);
FILE *outf;
srand(time(NULL));
outf=fopen("ss_mine.txt","w");
printf(" hebb logic v 2.1 \n");
printf(" ---------------- \n\n");
printf("Ideal energy landscape of horn clauses \n\n");
fprintf(outf,"Ideal energy landscape of horn clauses \n\n");
printf(" no. of neurons: %d\n no. of learning events: %d\n RELAX time: %d\n no.of trials: %d\n COMBMAX: %d\n ",NN,NH,RELAX,NT,COMBMAX);
fprintf(outf," hebb logic v 2.1 \n");
fprintf(outf," ---------------- \n\n");
fprintf(outf," no. of neurons: %d\n no. of learning events: %d\n RELAX time: %d\n no.of trials: %d\n COMBMAX: %d\n",NN,NH,RELAX,NT,COMBMAX);
printf(" Nc1= %d Nc2= %d Nc3= %d \n",Nc1,Nc2,Nc3);
fprintf(outf," Nc1= %d Nc2= %d Nc3= %d \n",Nc1,Nc2,Nc3);
printf(" TOL = %f \n",TOL);
fprintf(outf," TOL = %f \n",TOL);
/**Initialize average energy **/
EavM=0; //average synaptic energy for NT
zM=0; //average global minima for synaptic
yM=0; //average local minima for synaptic
ES=-NN*NEGBIAS; //minimum energy suppose for synaptic
EM=0; //calculation of varians
EAM=0;
z=0; //global minima
y=0; //local minima
Eav=0; //energy average
HDG=0;
HDL=0;
HDGlobal=0;
HDLocal=0;
nrelaxM=0.0;
nrelaxMM=0.0;
Hamming_Distance=0;
nR=0;
NRE=0;
/** Generating minimum energy suppose to be **/
/** For first order **/
for(i=0;i