Sie sind auf Seite 1von 8

CURSO:

TALLER DE CONSULTORA EN INGENIERA DE


SISTEMAS E INFORMTICA

DISEO DE INTERFAZ DE SISTEMAS DE


REDES NEURONALES
Elaborado por: Ing. Miguel ngel Crdova Sols

2011

IMPLEMENTACIN DEL CASO DE


MOVIMIENTO DE ROBOT
1. INTERFAZ EN VISUAL BASIC 2005

Los cuadros de texto son: s1, s2, s3, s4 = para las entradas
Los cuadros de texto s5 y s6 = para las salidas
1.1 Cdigo fuente
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim a, b, c, d, fe, f As Integer
Dim aa, netsum, bb, cc, dd, ee, ff As Double
a
b
c
d

=
=
=
=

Val(Me.s1.Text)
Val(Me.s2.Text)
Val(Me.s3.Text)
Val(Me.s4.Text)

If (a < -1) Then a = -1


If (a > 1) Then a = 1
a = (a + 1) / 2
If (b < -1) Then b = -1
If (b > 1) Then b = 1
b = (b + 1) / 2
If (c < -1) Then c = -1
If (c > 1) Then c = 1
c = (c + 1) / 2

If (d < -1) Then d = -1


If (d > 1) Then d = 1
d = (d + 1) / 2
netsum
netsum
netsum
netsum
netsum
aa = 1

=
=
=
=
=
/

-1.330392
netsum + a * 2.926372
netsum + b * -1.385469
netsum + c * 0.9289459
netsum + d * -2.592151
(1 + Math.Exp(-netsum))

netsum
netsum
netsum
netsum
netsum
bb = 1

=
=
=
=
=
/

-0.4652821
netsum + a * 1.027407
netsum + b * 1.289586
netsum + c * -0.5926775
netsum + d * -0.2162392
(1 + Math.Exp(-netsum))

netsum
netsum
netsum
netsum
netsum
cc = 1

=
=
=
=
=
/

0.1058821
netsum + a * 3.624191
netsum + b * -0.3397036
netsum + c * 3.768384
netsum + d * -4.29038
(1 + Math.Exp(-netsum))

netsum
netsum
netsum
netsum
netsum
dd = 1

=
=
=
=
=
/

-0.9695665
netsum + a * 6.3301
netsum + b * -1.951468
netsum + c * 2.166127
netsum + d * -5.255601
(1 + Math.Exp(-netsum))

netsum
netsum
netsum
netsum
netsum
ee = 1

=
=
=
=
=
/

4.025523
netsum + a * -1.696793
netsum + b * -1.019784
netsum + c * -0.9487106
netsum + d * -0.7426738
(1 + Math.Exp(-netsum))

netsum
netsum
netsum
netsum
netsum
ff = 1

=
=
=
=
=
/

2.288605
netsum + a * 2.178661
netsum + b * -1.648965
netsum + c * -0.5265731
netsum + d * -2.888947
(1 + Math.Exp(-netsum))

netsum
netsum
netsum
netsum
netsum
netsum
netsum
fe = 1

=
=
=
=
=
=
=
/

-3.614517
netsum + aa * 2.570479
netsum + bb * -3.188636
netsum + cc * -0.4802296
netsum + dd * 2.160472
netsum + ee * 3.783415
netsum + ff * 2.693977
(1 + Math.Exp(-netsum))

netsum
netsum
netsum
netsum
netsum

=
=
=
=
=

2.898355
netsum +
netsum +
netsum +
netsum +

aa
bb
cc
dd

*
*
*
*

1.91013
-0.5968674
-3.42756
-4.566801

netsum = netsum + ee * 0.7463915


netsum = netsum + ff * 1.604252
f = 1 / (1 + Math.Exp(-netsum))
fe = 2 * (fe - 0.1) / 0.8 + -1
If (fe < -1) Then fe = -1
If (fe > 1) Then fe = 1
f = 2 * (f - 0.1) / 0.8 + -1
If (f < -1) Then f = -1
If (f > 1) Then f = 1
s5.Text = fe
s6.Text = f
End Sub
End Class

1.2 Validacin de conocimiento


Se verifica las entradas 1, 1, 1, 1 debe mostrar como salida -1, -1

1.3 Verificacin de aprendizaje


Se prueban valores que en un inicio no se haba previsto cuyas entradas son: -1,
-1, -1, 1, el sistema es capaz de mostrar resultado, en este caso -1, 1

2. INTERFAZ EN VISUAL C++ 2005

2.1 Cdigo fuente


#include <stdio.h>
#include <math.h>
#include<conio.h>
void main()
{
double netsum, feature2[6],outarray[2],inarray[4];
int outarrayok[2],inarrayok[4];
printf("Ingrese primera posicion de sensor 1:");
scanf("%d",&inarrayok[0]);
printf("Ingrese primera posicion de sensor 2:");
scanf("%d",&inarrayok[1]);
printf("Ingrese primera posicion de sensor 3:");
scanf("%d",&inarrayok[2]);
printf("Ingrese primera posicion de sensor 4:");
scanf("%d",&inarrayok[3]);
inarray[0]=inarrayok[0];
inarray[1]=inarrayok[1];
inarray[2]=inarrayok[2];
inarray[3]=inarrayok[3];
/* inarray[0] is S1 */
/* inarray[1] is S2 */
/* inarray[2] is S3 */
/* inarray[3] is S4 */
/* outarray[0] is M1 */
/* outarray[1] is M2 */
if (inarray[0]<-1) inarray[0] = -1;
if (inarray[0]> 1) inarray[0] = 1;
inarray[0] = (inarray[0] + 1) / 2;
if (inarray[1]<-1) inarray[1] = -1;
if (inarray[1]> 1) inarray[1] = 1;
inarray[1] = (inarray[1] + 1) / 2;
if (inarray[2]<-1) inarray[2] = -1;
if (inarray[2]> 1) inarray[2] = 1;
inarray[2] = (inarray[2] + 1) / 2;
if (inarray[3]<-1) inarray[3] = -1;
if (inarray[3]> 1) inarray[3] = 1;
inarray[3] = (inarray[3] + 1) / 2;
netsum = -1.330392;
netsum += inarray[0]
netsum += inarray[1]
netsum += inarray[2]
netsum += inarray[3]
feature2[0] = 1 / (1

* 2.926372;
* -1.385469;
* 0.9289459;
* -2.592151;
+ exp(-netsum));

netsum
netsum
netsum
netsum
netsum

* 1.027407;
* 1.289586;
* -0.5926775;
* -0.2162392;

= -0.4652821;
+= inarray[0]
+= inarray[1]
+= inarray[2]
+= inarray[3]

feature2[1] = 1 / (1 + exp(-netsum));
netsum = 0.1058821;
netsum += inarray[0]
netsum += inarray[1]
netsum += inarray[2]
netsum += inarray[3]
feature2[2] = 1 / (1

* 3.624191;
* -.3397036;
* 3.768384;
* -4.29038;
+ exp(-netsum));

netsum = -0.9695665;
netsum += inarray[0]
netsum += inarray[1]
netsum += inarray[2]
netsum += inarray[3]
feature2[3] = 1 / (1

* 6.3301;
* -1.951468;
* 2.166127;
* -5.255601;
+ exp(-netsum));

netsum = 4.025523;
netsum += inarray[0]
netsum += inarray[1]
netsum += inarray[2]
netsum += inarray[3]
feature2[4] = 1 / (1

*
*
*
*
+

-1.696793;
-1.019784;
-0.9487106;
-0.7426738;
exp(-netsum));

netsum = 2.288605;
netsum += inarray[0]
netsum += inarray[1]
netsum += inarray[2]
netsum += inarray[3]
feature2[5] = 1 / (1

*
*
*
*
+

2.178661;
-1.648965;
-.5265731;
-2.888947;
exp(-netsum));

netsum = -3.614517;
netsum += feature2[0] * 2.570479;
netsum += feature2[1] * -3.188636;
netsum += feature2[2] * -0.4802296;
netsum += feature2[3] * 2.160472;
netsum += feature2[4] * 3.783415;
netsum += feature2[5] * 2.693977;
outarray[0] = 1 / (1 + exp(-netsum));
netsum = 2.898355;
netsum += feature2[0] * 1.91013;
netsum += feature2[1] * -.5968674;
netsum += feature2[2] * -3.42756;
netsum += feature2[3] * -4.566801;
netsum += feature2[4] * 0.7463915;
netsum += feature2[5] * 1.604252;
outarray[1] = 1 / (1 + exp(-netsum));
outarray[0] = 2 * (outarray[0] - 0.1) / 0.8
if (outarray[0]<0)outarrayok[0] = -1;
else outarrayok[0] = 1;

+ -1;

outarray[1] = 2 * (outarray[1] - 0.1) / 0.8


if (outarray[1]<0)
outarrayok[1] = -1;
else
outarrayok[1] = 1;

+ -1;

printf("Posicion de robot 1: %d \n",outarrayok[0]);


printf("Posicion de robot 2: %d \n",outarrayok[1]);
getch();
}

2.2 Validacin de conocimiento


Se verifica las entradas 1, 1, 1, 1 debe mostrar como salida -1, -1

2.3 Verificacin de aprendizaje


Se prueban valores que en un inicio no se haba previsto cuyas entradas son: -1,
-1, -1, 1, el sistema es capaz de mostrar resultado, en este caso -1, 1

Das könnte Ihnen auch gefallen