Программа --АКСОН
1. Общее
2. Входной сигнал
3. Скачать программу --АКСОН
Приложение 1
const
Приложение 2
матрица f
Приложение 3
матрица s
Приложение 4
матрица p
Приложение 5
edit 1 -3
Приложение 6
программа WORD
1. Общее
Программа -- АКСОН – развитие программы -+АКСОН.
Изменено формирование входного сигнала.
В остальном две программы совпадают.
2. Входной сигнал
В программе --АКСОН предусмотрены два вида входного сигнала.
Вес случайный и вес постоянный.
Переключатель: const k.
К= 1 – случайный входной сигнал: const a1
a1>0
Диапазон: 0 – а1-1.
К=2 – постоянный входной сигнал: const a2.
a2>0.
Входной сигнал подается одного веса на несколько нейронов.
Период подачи для случайного и постоянного сигнала – const v.
Задание знака входного сигнала: const vv.
Входной сигнал – матрица f[1..n].
f[i] – вес входного сигнала на нейрон –i.
3. Скачать программу --АКСОН
Программа --АКСОН на Дельфи 7.
Ввод в программе –const.
Распечатка программы в WORD: Приложение 6
Для скачивания вариант с постоянными величинами вероятностей при разных входах в программу.
// initialization
//randomize;
Скачать программу --АКСОН
https://yadi.sk/d/QL-S1enHzSMo2A
Приложение 6
программа WORD
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Grids, StdCtrls;
type
TForm1 = class(TForm)
StringGrid1: TStringGrid;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button5: TButton;
Label1: TLabel;
StringGrid2: TStringGrid;
StringGrid3: TStringGrid;
StringGrid4: TStringGrid;
Button4: TButton;
Edit1: TEdit;
Edit2: TEdit;
Label4: TLabel;
Label5: TLabel;
Edit3: TEdit;
Label2: TLabel;
Label3: TLabel;
Label7: TLabel;
Label6: TLabel;
procedure Button1Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
const
n =20;// ÷èñëî íåéðîíîâ
t1 =15000 ;// ìàêñèìàëüíîå ÷èñëî èòåðàöèé
a1 = 200;// àáñîëþòíûé âåñ ñâÿçè àêñîí - äåíäðèò
//âåðîÿòíîñòíîå çàäàíèå âåñà
a2 = 40;// àáñîëþòíûé âåñ ñâÿçè àêñîí - äåíäðèò
// âåñ ïîñòîÿííûé
a3 =20;// âåñ âõîäíîãî ñèãíàëà
//âåðîÿòíîñòíîå çàäàíèå âåñà
a4=40 ;// ïîñòîÿííûé âåñ âõîäíîãî ñèãíàëà
k=2 ; // ïåðåêëþ÷àòåëü ñâÿçè àêñîí - äåíäðèò
pp=1;// ïåðåêëþ÷àòåëü òèïà âõîäíîãî ñèãíàëà.
v=2;// ôîðìèðîâàíèå âõîäíîãî ñèãíàëà
//ïåðèîäè÷íîñòü íóëåé
m=9;// îòñóòñòâèå ñâÿçè ìæäó íåéðîíàìè
z= 500; // ììàêñèìàëüíûé âåñ íåéðîíà
z1= -500;// ìèíèìàëüíûé âåñ íåéðîíà
nn=2;// Ñâÿçü àêñîí - äåíäðèò: + èëè -
vv =5;// +- âõîäíîé ñèãíàë
var
Tick: Cardinal;
s:array [1..n, 1 ..n] of integer;// ñâÿçè àêñîí - äåíäðèòû
p : array [1..t1,1..n] of integer;// ñîñòîÿíèå íåéðîíîâ
f : array [1..n] of integer;// ñîñòîÿíèå âõîäíîãî ñèãíàëà
a, u, x,x1, c, b1, d1, t, d, g, q,i,j,h,i1,i2,hh : integer; //
j1,j2,j3,j4,j5,j6,j7,j8, i3,i4,i5,i6,i7,i8,i0: integer; //
w, e, e1, z2, z3: integer;//
m1 ,m2,m3,m4,m5, m6,m7 ,m8,m9,m10: integer;//
t3: integer;
ia, ib,ic, id ,it,iw, iu, ju, ja, jb, jc, jd ,jt, jw: integer;//
zz ,ss, ww, sss, uu ,u1,u2,u3 :integer;//
r, r1, r2, r3, r4, r5, r6{, r7, r8, r9} : integer;//
ff ,tt ,c1, g1,cc,ccc, mm , kk: integer;//
l1, l2 ,l3,l4: variant;//
procedure TForm1.Button1Click(Sender: TObject);
// îêàíòîâêà
begin
for q:=1 to n //íóìåðàöèÿ ïî ãîðèçîíòàëè â òàáë ¹1 ,
do StringGrid1.Cells[q,0]:=IntToStr(q);
for q:=1 to 5 // íóìåðàöèÿ ïî âåðòèêàëè â òàáë ¹1 ,
do StringGrid1.Cells[0,q]:=IntToStr(q);
for q:=1 to n //íóìåðàöèÿ ïî ãîðèçîíòàëè â òàáë ¹2,
do StringGrid2.Cells[q,0]:=IntToStr(q);
for q:=1 to t1 // íóìåðàöèÿ ïî âåðòèêàëè â òàáë ¹2 ,
do StringGrid2.Cells[0,q]:=IntToStr(q);
for q:=1 to n //íóìåðàöèÿ ïî ãîðèçîíòàëè â òàáë ¹4,
do StringGrid4.Cells[q,0]:=IntToStr(q);
for q:=1 to n // íóìåðàöèÿ ïî âåðòèêàëè â òàáë ¹4 ,
do StringGrid4.Cells[0,q]:=IntToStr(q);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
// Ôîðìèðîâàíèå ìàòðèöû s
for i:=1 to n do
for j:= 1 to n do
if i<>j then
begin
if k=1 then
s[i,j] := random ( a1);
if k=2 then s[i,j] := a2;
mm:= random (nn);
if mm = 0 then s[i,j] := (- s[i,j]);
h:= random (m);
if h>3 then s[i,j] := 0;
end;
for iu :=1 to n do
for ju := 1 to n do
begin
if s[iu,ju] >0 then u1 := u1 +1;
if s[iu,ju] =0 then u2 := u2 +1;
if s[iu,ju] <0 then u3 := u3 +1;
end;
// Ôîðìèðîâàíèå âõîäíîî ñèãíàëà
if pp = 1 then
for j:= 1 to n do begin
W:=w+1;
f[j] := random ( a3);
hh:= random (vv);
d:= w mod v ;
if d> 0 then f[j] := 0;
if hh>3 then f[j] := -f[j];
end;
if pp=2 then
for j:=1 to n do
begin
W:=w+1;
d:= w mod v ;
if d = 0 then f[j] :=a4;
if d> 0 then f[j] := 0;
hh:= random (vv);
if hh>3 then f[j] := -f[j];
end;
for jw :=1 to n do begin
if f[jw]>0 then m8 := m8+1;
if f[jw]=0 then m9 := m9+1;
if f[jw]<0 then m10 := m10+1;
end;
// Îñíîâíîé öèêë
for j:=1 to n do begin
p[1,j] := f[j] ;
end;
//îñíîâíîé öèêë
for i:=1 to t1 do
begin
c:= c+1;
Form1.Caption:=IntToStr(GetTickCount-Tick);
if i>= 2 then begin
for ia:= 1 to n do
for ib := 1 to n do
if p[i-1,ib] <> 0
then if ib<>ia then
p[i,ia]:= p[i-1,ia]+ s[ib ,ia];
for it := 1 to n do begin
if p[i,it]>z then p[i,it]:=z;
if p[i,it]<z1 then p[i,it]:=z1;
end;
kk:=0;
for iw:=1 to n do
if (( p[c-3,iw]<>p[c-1,iw] )
or(p[c-1,iw]<>p[c,iw]) )then kk :=1;
if kk =0 then begin uu:=777;ww:=c-1; break;end;
end;
end;
for ic:=1 to n do begin
if p[c-3,ic]= 0 then u:= u +1;
if p[c-3,ic]=z then x:= x +1;
if p[c-3,ic]=z1 then x1:= x1 +1;
if p[c-3,ic]= a3 then ccc:= ccc +1;
if ( ((p[c-3,ic]<>0) and ( p[c-3,ic]<>z))
and ((p[c-3,ic]<>a3 ) and (p[c-3,ic]<>z1)) )
then g1:= g1+1;
if p[c,ic]= 0 then r:= r +1;
if p[c,ic]= z then e:= e +1;
if p[c,ic]= z1 then e1:= e1 +1;
if p[c,ic]= a3 then cc:= cc +1;
if (((p[c,ic]<>0) and ( p[c,ic]<>z))
and ((p[c,ic]<>a3 ) and ( p[c,ic]<>z1)))
then g:= g+1;
end;
t:= u+x+ccc+g;
Form1.Caption:=IntToStr(GetTickCount-Tick);
for i:=1 to n do
for j:=1 to n do
begin
if s[i,j] = 0 then m1 := m1+1;
if s[i,j] >0 then m2 := m2+1 ;
if s[i,j] < 0 then m3 := m3+1 ;
if s[i,j] >0 then m4 := m4+s[i,j];
if s[i,j] <0 then m5 := m5+s[i,j];
END;
m7 := m1+m2+m3;
l1:= r/n;
l2:= e/n;
l3 := cc/n;
l4 := g/n;
for i:=1 to n do
for j:=1 to n do
StringGrid4.Cells[j,i]:=
IntToStr( s[i,j]);
for j:= 1 to n do
StringGrid1.Cells[j,1]:=
IntToStr( f[j]);
for i:=1 to t1 do
for j:= 1 to n do
StringGrid2.Cells[j,i]:=
IntToStr( p[i,j]);
Edit1.Text := 'm='+'---'+IntToStr(m)+' ' +
'n='+'---'+IntToStr(n)+' ' +
't1='+'---'+IntToStr(t1)+' ' +
'a1='+'---'+IntToStr(a1)+' ' +
'a2='+'---'+IntToStr(a2)+' ' +
'a3='+'---' +IntToStr(a3) +' ' +
'k='+'---' +IntToStr(k) +' ' +
'nn='+'---' +IntToStr(nn) +' ' +
'v='+'---' +IntToStr(v) +' ' +
'c='+'---' +IntToStr(c) +' ' +
'z='+'---' +IntToStr(z)
+' ' +
'm8='+'---' +IntToStr(m8) +' ' +
'm9='+'---' +IntToStr(m9) +' ' +
'm10='+'---' +IntToStr(m10);
Edit2.Text := 'r='+'---'+IntToStr(r)+' ' +
'e='+'---'+IntToStr(e)+' ' +
'e1='+'---'+IntToStr(e1)+' ' +
'cc='+'---'+IntToStr(cc)+' ' +
'g='+'---'+IntToStr(g)+' ' +
't='+'---'+IntToStr(t)+' ' +
'u='+'---'+IntToStr(u)+' ' +
'x='+'---'+IntToStr(x) +' ' +
'x1='+'---'+IntToStr(x1) +' ' +
'ccc='+'---'+IntToStr(ccc)+' ' +
'g1='+'---'+IntToStr(g1)
+' ' +
'ff='+'---'+IntToStr(ff)
+' ' +
'u1='+'---'+IntToStr(u1)+' ' +
'u2='+'---'+IntToStr(u2)
+' ' +
'u3='+'---'+IntToStr(u3)
;
Edit3.Text :=
'l1='+'---'+ FormatFloat('0.000',l1) +' ' +
'l2='+'---'+ FormatFloat('0.000',l2) +' ' +
'l3='+'---'+ FormatFloat('0.000',l3) +' ' +
'l4='+'---'+ FormatFloat('0.000',l4) +' ' +
'tt='+'---'+IntToStr(tt)+' ' +
'uu='+'---'+IntToStr(uu)+' ' +
'ww='+'---'+IntToStr(ww) +' ' +
'm1='+'---'+IntToStr(m1)+' ' +
'm2='+'---'+IntToStr(m2)+' ' +
'm3='+'---'+IntToStr(m3)+' ' +
'm4='+'---'+IntToStr(m4)+' ' +
'm5='+'---'+IntToStr(m5)
+' ' +
'm7='+'---'+IntToStr(m7)
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
end;
///////// ///////////////////////////////////////////////////////
procedure TForm1.Button5Click(Sender: TObject);
begin
close
end;
// initialization
//randomize;
end.
Отредактировано ABC (2020-12-30 23:50:41)