#lang racket

;;Ajustada con un AG
(require "Clases-neuron-capa-red.rkt")

;;;;;;;;;;;;;;INSTANCIAS
;;;NEURONAS
(define n_1 (make-object neuron_entrada% 'n_1))
(define n_2 (make-object neuron_entrada% 'n_2))
(define n_3 (make-object neuron_entrada% 'n_3))

(define o_1 
  (make-object neurona% '0_1
    -5 propagacion_lineal lineal escalon_1))
(define o_2 
  (make-object neurona% '0_2
    0 propagacion_lineal lineal escalon_1))
(define o_3 
  (make-object neurona% '0_3
    2 propagacion_lineal lineal escalon_1))

(define s_1 
  (make-object neurona% 's_1
    4 propagacion_lineal lineal escalon_1))
(define s_2 
  (make-object neurona% 's_2
    9 propagacion_lineal lineal escalon_1))
(define s_3 
  (make-object neurona% 's_3
    6 propagacion_lineal lineal escalon_1))
;;;CAPAS
(define capa_1 
  (make-object capa_entrada% 'c_1
    (list n_1 n_2 n_3) ))
(define capa_2 
  (make-object capa% 'c_2
    (list o_1 o_2 o_3) 
    '((-7 0 -1) (2 -9 0) (0 2 -9))
    ))
(define capa_3 
  (make-object capa% 'c_3
    (list s_1 s_2 s_3) 
    '((8 -3 -2) (-6 9 5) (-3 0 7))
    ))
;;;RED
(define discriminacion_tactil (make-object red% (list capa_1 capa_2 capa_3)))
;;;;;;;;

(require "Training-tacto.rkt")

(define estimulos->red
  (lambda (red estimulos);estimulos : training_set
    (let go ((i 0)
             (j (length estimulos))
             )
      (if (= i j)
          #t
          (let* ((input (car (list-ref estimulos i)))
                 (deseada (second (list-ref estimulos i)))
                 (resp (send red proceso! input)) )
            (if (equal? deseada resp)
                (printf "~a --> ~a~n" input resp)
                (printf "~a ==> ~a ==> ~a~n" input deseada resp)       
                )
            (go (add1 i) j)
            )
          )
      )
    )
  )


(provide red% capa% capa_entrada% neurona% neuron_entrada%
         discriminacion_tactil)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;(estimulos->red discriminacion_tactil training)

