Monday, May 21, 2007

Constraint Discovery Mechanism in COSA

A constraint is a temporal correlation between two events that must always be satisfied. There are only two possible temporal correlations between discrete events: they can be either sequential or concurrent. The COSA constraint discovery mechanism (CDM) is simply a collection of special learning cells similar to a layer of neurons in a neural network. As many of you already know, the COSA software model borrows heavily from my ongoing work in artificial intelligence and pulsed neural networks. The cells in the CDM detect either simultaneous or sequential sensory events.

Constraint discovery is an inductive learning process that takes place while the application is running. As such, not all discovered constraints are necessarily valid. It is up to the application designer to validate or reject every constraint. The outputs of the cells may be connected to an alarm component or a report generator that compiles pertinent information into a file or database in case of violations. The inputs of the CDM cells are initially not connected. A special component called a searcher periodically sweeps through the program being tested and randomly connects the outputs of a few sensory cells within the program to the inputs of the CDM cells. There is a reason why only a few sensory cells are chosen during a pass of the searcher: learning can sometime be CPU intensive and it makes sense not to slow down the application too much during testing,especially in real time environments. Eventually all sensory cells get connected. CDM cells use synaptic strengthening to establish a correlation. If the strength of a synapse reaches a predetermined value, the correlation is accepted. Learning can be extremely fast in deterministic systems because a single violation is enough to invalidate a synaptic connection.

During development, it is advisable to run the CDM as often as possible in order to prevent the introduction of inconsistencies. All violations should be corrected immediately. When it comes time to launch the application, the CDM must be removed from the release version for two reasons: it is no longer needed and the application runs faster without it.

P.S. In a future article, I will talk about a few COSA optimization techniques that should make a COSA program at least as fast as existing scripting languages.