---------------------------------------------------------------------------
-- Frustrated Inhibitive Synapse Learning (FISL)
-- package specification
-- Copyright 1994 David W. Croft.  All rights reserved.
-- CompuServe [76600, 102]
-- Internet CroftDW@Portia.Caltech.Edu
---------------------------------------------------------------------------

package FISL is
---------------------------------------------------------------------------
---------------------------------------------------------------------------
type Setup_Type is
  record
    Input_Count  : natural  := 2;
    Output_Count : positive := 1;
    Total_Count  : positive := 3;
    No_Self,
    Layered,
    Forward : boolean := true;
  end record;
---------------------------------------------------------------------------
type Phase_Type is
  record
    Membrane_Voltage    : float := 0.0;
    Activated_Sodium    : float := 0.0; -- non-negative float
    Activated_Potassium : float := 0.0; -- non-negative float
  end record;
Cold : constant Phase_Type := ( -1.0, 0.0, 0.0 );
Rest : constant Phase_Type := (  0.0, 0.0, 0.0 );
Ooze : constant Phase_Type := (  0.5, 0.5, 0.5 );
Fire : constant Phase_Type := ( +1.0, 1.0, 2.0 );
--Tire : constant Phase_Type := ( +0.5, 0.0, 1.5 );
--Dgen : constant Phase_Type := ( -0.5, 0.0, 0.5 );
--Warm : constant Phase_Type := ( +1.0, 1.0, 2.0 );
type Phases_Type is array ( positive range <> ) of Phase_Type;
---------------------------------------------------------------------------
subtype Input_Type is float; -- non-negative float;
type Inputs_Type is array ( positive range <> ) of Input_Type;
---------------------------------------------------------------------------
subtype Transmitter_Type is float; -- non-negative float
type Transmitters_Type is array ( positive range <>, positive range <> )
       of Transmitter_Type;
---------------------------------------------------------------------------
type Weight_Type is
  record
    Excitatory : float;
    Inhibitory : float;
  end record;
Weight_Disconnected : Weight_Type
  := ( Excitatory => 0.0, Inhibitory => 0.0 );
Weight_Inhibitory   : Weight_Type
  := ( Excitatory => 0.5, Inhibitory => 2.0 );
Weight_Connected    : Weight_Type
  := ( Excitatory => 1.0, Inhibitory => 1.0 );
Weight_Excitatory   : Weight_Type
  := ( Excitatory => 2.0, Inhibitory => 0.5 );
type Weights_Type is array ( positive range <>, positive range <> )
  of Weight_Type;
---------------------------------------------------------------------------
type Network_Type ( Neuron_Count : positive ) is
  record
    Inputs : Inputs_Type ( 1..Neuron_Count ) := ( others => 0.0 );
    Phases : Phases_Type ( 1..Neuron_Count ) := ( others => Rest );
    Transmitters : Transmitters_Type ( 1..Neuron_Count, 1..Neuron_Count )
      := ( others => ( others => 0.0 ) );
    Weights : Weights_Type ( 1..Neuron_Count, 1..Neuron_Count )
      := ( others => ( others => Weight_Connected ) );
  end record;
---------------------------------------------------------------------------
procedure Initialize (
  Network      :    out Network_Type;
  Setup        : in     Setup_Type );
procedure Update (
  Inputs       :    out Inputs_Type;
  Transmitters : in     Transmitters_Type;
  Weights      : in     Weights_Type );
procedure Update (
  Network : in out Network_Type );
procedure Update (
  Phases       : in out Phases_Type;
  Inputs       : in     Inputs_Type );
procedure Update (
  Transmitters :    out Transmitters_Type;
  Phases       : in     Phases_Type );
procedure Update (
  Weights      : in out Weights_Type;
  Phases       : in     Phases_Type;
  Transmitters : in     Transmitters_Type );
---------------------------------------------------------------------------
---------------------------------------------------------------------------
end FISL;
