# Killeen simulation program

[From Bruce Abbott (960106.1545 EST)]

Here is FOOD2.PAS, the program I promised for simulating Killeen's
"behavioral mechanics" model of ratio schedule responding. It is adapted
from Bill Powers's FOOD1.PAS and will compile and run in Turbo Pascal or
Borland Pascal.

Regards,

Bruce

···

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
program food2;

{ Simulates Killeen's (1995) ratio model

written by Bruce Abbott, adapted from FOOD1.PAS by Bill Powers
01/06/95 }

uses dos,crt;
{
Killeen's Model:

(1) rr = bb/n environment function (ratio schedule)
(2) d = d + (M*dt - m*rr) deprivation level (error signal)
(3) h = Y*d hunger level
(4) aa = v*h specific activation
(5) A = aa*rr arousal level: response-seconds incited
(6) bb = A/delta responses incited during time dt

Conversions:

(7) B = dd/dt response rate, rsp/sec
(8) R = rr/dt rate of incitement, rft/sec
(9) F = Fr - d amount of food in gut, grams

Starting Parameters:

m = 0.045 gram
t = 600 seconds [ten minutes into session]
F0 = 0 gram [empty gut]
Fr = 10 gram
M = 0 grams/sec [depletion rate would be negligible compared to repletion]
Y = 1.0 [converts d to hunger, h]
v = 1.5 response-sec [incitement value of incentive]
delta = 0.5 sec [minimum interresponse time = 2 resp/sec max rate]
B = 0.2 resp/sec [beginning response rate]
dt = 0.1 sec [time resolution of simulation]

Notes:

This simulation does not take into account the time required to collect and
ingest the reinforcer, which would decrease the average rate of behavior.
It could be improved another way by cumulating response-seconds until there
are delta seconds accumulated, then "emitting" one response and zeroing the
cumulated response-seconds. This version of the simulation treats rfts
and responses as continuous variables rather than as the discrete ones they
actually are, which does not affect the overall rates but does eliminate
the patterning of responses and reinforcers that would actually be
observed.

Also, this simulation assumes that I have correctly worked out how to
apply Killeen's mechanics in simulation, which required some adapting
of Killeen's formulas to make them suitable for iteration. If I'm wrong,
it's wrong.
}

var R,B,n,F,F0,Fr,mm,m,dt,d,Y,h,v,aa,A,delta,rr,bb,
Tbb, Trr, Tdt: real;
ch: char;
i,j,t: integer;
ratio: array[1..5] of real;

procedure InitSim;
begin
{ Simulation parameters }
mm := 0.045;
F0 := 0.0;
Fr := 10.0;
M := 0.00;
dt := 0.1;
Y := 1.0;
v := 1.5;
delta := 0.5;

{ t below must be an integer }
t := 600;

{ Ratios to test }
ratio := 1;
ratio := 2;
ratio := 5;
ratio := 10;
ratio := 20;
end;

begin
clrscr;
write('Ratio F d aa ');
writeln('rr bb R B');
InitSim;
for j := 1 to 5 do
begin
{ Initialize parameters for new ratio }
Tbb := 0.0; Trr := 0.0; Tdt:= 0.0;
n := ratio[j];
F := F0;
d := Fr - F;
B := 0.2;
bb := B*dt;
for i := 1 to t do
begin
{ Run the simulation for t iterations }
rr := bb/n; Trr := Trr + rr; Tbb := Tbb + bb; Tdt := Tdt + dt;
R := rr/dt;
d := d + (M*dt - mm*rr);
F := Fr - d;
h := Y*d;
aa := v*h;
A := aa*rr;
bb := A/delta;
if bb > dt/delta then bb := dt/delta;
B := bb/dt;
end;
{ Print the results to the screen }
writeln(Ratio[j]:5:0, F:10:3, d:10:3, aa:10:3, rr:10:4, bb:10:4, R:10:3,
B:10:3);
write(Ratio[j]:5:0);
write(' Session Average:');
writeln(Trr/Tdt:10:3, Tbb/Tdt:10:3);
writeln;
end;
gotoXY(1, 25); write('Press any key to quit . . .');
ch := readkey; { Hold screen until any key is pressed }
end.