Tips for Designing and Implementing a Stimulus Response Agent

brain
(Original Image by everyone’s idle.)

This post was a originally published on Luma Labs, now dead.

As old as stimulus-response techniques are, they still form an important part of many AI systems, even if it is a thin layer underneath a sophisticated decision, planning, or learning system. In this tutorial I give some advice to their design and implementation, mostly out of experience gained from implementing the AI for some racing games.

A stimulus response agent (or a reactive agent) is an agent that takes inputs from its world through sensors, and then takes action based on those inputs through actuators. Between the stimulus and response, there is a processing unit that can be arbitrarily complex. An example of such an agent is one that controls a vehicle in a racing game: the agent “looks” at the road and nearby vehicles, and then decides how much to turn and break.

Continue reading “Tips for Designing and Implementing a Stimulus Response Agent”

A Reference for Functional Equations

1052727062_0ec2c67ea4_smallI have not posted in a while; one reason is that I got sucked into some interesting mathematics; the work-in-progress Reference for Functional Equations is the result. If you are interested in such things – have a look.

Difference and Functional Equations Reference

1052727062_0ec2c67ea4

Original image by openDemocracy.

The document below contains tables and formulas useful for working with functional equations, especially di fference equations, and to a lesser extent, quotient equations (where differences are replaced by quotients).

The reference contains tables for forward differences, (indefinite) sums, quotients, and products. There is also a table of z-transforms, binomial transfroms, formulas for converting certain kinds of functional equations to difference equations and some discrete Taylor series. There are more than 500 formulas in its 65 pages.

This is a work in progress, so be sure to read the preface (which highlights some of the issues with this document). If you find any errors, please comment below.

Changes

Version 1.1

  • Added Exponential Sums to differences and sums.
  • Additions to the z-transform table.
  • Added Binomial Transform pairs.

Version 1.2

  • Expanded the section on the discrete power functions.
  • Expanded the section that explain the sue of constants in the table.
  • Added forms involving the following expressions to the sum (x + h) tables:
    • ax + b
    • x^2 + a^2
  • Updated all the graphs, and added some new ones.
  • Reorganized slightly, and fixed some typos.
  • Added a few examples, explanations, and additional notations in the sum (x + h) tables.

Version 1.3

  • Made several corrections.
  • Added the chain and substitution rules for arithmetic differences.
  • Added table of functions for reference.
  • Expanded the introduction somewhat.
  • Added definition for arithmetic difference analogs.
  • Added rules for manipulating arithmetic difference analogs.
  • Added several new entries, including several functions whose sums can be expressed as the sum of E(x) = 1/(eix + 1).
  • Expressed the G-function (sum of the Gamma function) as a product of known functions, and replaced its notation. The notation G(x) is now used for the Barnes G-function.

Version 1.4

  • Made, as always, a few corrections.
  • Made some minor additions to many of the tables.
  • Added the tangent sum function. There are still many details to sort out for this and related functions (cot, sec, csc, their hyperbolic counterparts, 1/(ex+1), and so on), and hence these sections are still messy. These will be cleaned up as the details become clear.
  • Replaced some of the statements on periodic, odd, and even functions with precise versions. The previous ones were only correct up to a periodic function.
  • Added the derangement function (expressed in terms of the incomplete gamma function), as well as some related Taylor series.
  • Since I included the definitions of analog functions, I discovered that the intuitive notion of analogs did not correspond to the definition. Thus, the analogs of ln x and atan x have been removed / replaced. These might re-appear if the definition of analog functions is suitably adjusted.
  • Made many statements on the z-transform more precise.
  • Made some notations more consistent with standard notation.

Version 1.5

  • Made a small correction for the binomial law for discrete powers.

Download

DiscreteCalculusTables_1_5 (PDF 4.6 MB).

Generating Random Numbers with Arbitrary Distributions

For many applications, detailed statistical models are overkill. Instead, we can get away with a rough description of the distribution – not in mathematical formula form, but just as a graph with a few sample points.

For example, when trying to model the traffic around a school, you might know that the graph looks something like this:

school

The input is the number of minutes before the first bell rings, and the output the number of children dropped off at that time. You know that most kids are brought before the bell rings, and that the closer to the bell, the more kids are being brought every minute. Only a few kids are late.

This tutorial describes how to generate random numbers that can generate a distribution described by an arbitrary (piece-wise linear) curve, as the one above.

Continue reading “Generating Random Numbers with Arbitrary Distributions”