#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 n_4 (make-object neuron_entrada% 'n_4))
(define n_5 (make-object neuron_entrada% 'n_5))
(define n_6 (make-object neuron_entrada% 'n_6))
(define n_7 (make-object neuron_entrada% 'n_7))

(define o_1 
  (make-object neurona% 'o_1
    6 propagacion_lineal lineal escalon_1))
(define o_2 
  (make-object neurona% 'o_2
    -9 propagacion_lineal lineal escalon_1))
(define o_3 
  (make-object neurona% 'o_3
    -3 propagacion_lineal lineal escalon_1))
(define o_4 
  (make-object neurona% 'o_4
    4 propagacion_lineal lineal escalon_1))
(define o_5 
  (make-object neurona% 'o_5
    4 propagacion_lineal lineal escalon_1))
(define o_6 
  (make-object neurona% 'o_6
    -9 propagacion_lineal lineal escalon_1))
(define o_7 
  (make-object neurona% 'o_7
    5 propagacion_lineal lineal escalon_1))

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

;(require "Training-comparar.rkt")

(define estimulos->red
  (lambda (red estimulos);estimulos : training_set
    (printf "(_ _ _ _ _ _ _) ==>  Deseada  ==>   Real~n")
    (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)) )
            (printf "~a ==> ~a ==> ~a~n" input deseada resp)
;            (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%
         comparar_anterior)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;(estimulos->red comparar_anterior training)

