What thoughts come to mind when the words Artificial Intelligence are mentioned? Over promised and under delivered? Maybe shattered dreams aren't the first thought; perhaps it's the "Puppet Master" from Ghost in the Shell or The Matrix? It is unfortunate that Artificial Intelligence has been given such an inaccurate image. In reality, A.I. is a true possibility for the future. As with any other piece of technology, proper steps and clear understanding are needed in order to nurture it to the fullest potential.
This article has several goals:
Explain Artificial Intelligence
Describe the various techniques and disciplines of A.I.
Discuss different implementations of A.I. while demonstrating one using a simple credit card validation routine in C#
It is important to note that this article will not be source code intensive, as it is focusing more on the logic and application of the technology. This is not a philosophical debate, nor is it a science-fiction explanation. Many brilliant individuals have devoted themselves to the research and growth of this field, so please keep an open mind on this topic.
Subsequent articles will be much more source code intensive after the foundation has been set for the topic. The forum will be focusing on technique and real-world applications that take advantage of each of them. Unless otherwise specified, all source code examples will be utilizing C# as their base platform.
Overview
Although the history of A.I. is very interesting and allows a better understanding of how things came to be, this article will focus on the different methodologies of A.I. and specifically what A.I. represents.
So what is Artificial Intelligence? Although the general public is more accustomed to ideas from movies and science-fiction novels, its original foundation is based on the study of creating intelligent machines to help us understand more about ourselves. The belief is that mental processes are computational processes over formal elements, so A.I. embodies the study of creating intelligent programs or machines that are capable of problem solving to the same degree of humans.
What does that mean exactly? Intelligence is generally defined as absorption and application of knowledge gained through experience. Keeping that in mind, one might say that there are no A.I. based applications in existence because applications are not truly capable of learning from their experiences and applying it to other situations. Although justified, this argument does not consider that, theoretically, these A.I. based applications could contain all the experience they need in order to execute their specified tasks.
How can A.I. be applied to the commercial venue? Believe or not, the basic guidelines of artificial intelligence are used virtually everyday, whether it be virtual assistants, firewalls, grammar and spell checking, etc. Remember that at the core, A.I. is about intelligent programs and machines. Not all applications may exhibit learning or adaptation; however, the execution of a pre-defined set of instructions allows them to act intelligently.
Additional A.I. based solutions can also include:
Failure Prediction for network management solutions
Fraud Detection
Behavioral Analysis for market research
Anti-Virus Protection
Auto-System Analysis and Repair
Techniques
There are various schools of thought in A.I. research. Listed below are the three disciplines that this series will work with. Please bear in mind that each definition and example listed below is somewhat broad because there is often more than one way to explain each theory.
The DARPA Neural Network Study (1988, AFCEA International Press, p. 60):
"...a neural network is a system composed of many simple processing elements operating in parallel whose function is determined by network structure, connection strengths, and the processing performed at computing elements or nodes"
Imagine multiple programs, or a single program with multiple threads, which work together to complete common objectives. Each program, or thread, houses a subset of local data that they use when communicating with their peers. Typically an A.N.N. will be trained with a set of rules that helps the network learn by examples.
It's worth noting that Evolutionary Computation (E.C.) and Artificial Life (A.L.) are not technically classified under the umbrella of Artificial Intelligence. E.C. and A.L. are also not classified together, but typically go hand-in-hand. The reason why these have been placed in this article is because of two subsets of E.C. - Genetic Algorithms (G.A.) and Genetic Programming (G.P.).
First off, E.C. comes from the theory of biological evolution. It is a process that is used to create optimization procedures to assist in problem solving.
Genetic Algorithms use the methodologies of evolutionary theory as a foundation for problem solving. In short, it does this by generating multiple solutions for the problem at hand and through means of survival of the fittest the strongest solution survives. This is very useful in search-based algorithms.
Genetic Programming is accomplished by "genetically breeding a population of computer programs using the principles of natural selection" (paraphrased from genetic-programming.com "What is Genetic Programming"). G.P. poses the question of "How can computers be made to do what needs to be done, without being told exactly how to do it?"
Cellular Automata (C.A.) represents non-complex elements of spatially distributed processes. Cells are placed within a grid and manipulated according to the set of defined rules. For example, take the rules for John Conway's Game of Life:
Cells have two states: on / off (or alive / inactive)
If a cell has three neighbors that are in the on or alive state, that cell is turned on.
If a cell has two neighbors who are in the on or alive state and that cell is on, it will remain on.
If the cell has one or more than three neighbors which is in the on or alive state, that cell is turned off.
A neighboring cell is one that is touching in any direction (maximum of 8).
The Game of Life simulates the life cycle using a set of pre-defined rules. What is fascinating about this is how simple rules can cause chaotic and elaborate results. Relevant implementations of C.A. can include image processing or even game programming.
Implementations
Let's discuss three different categories in which A.I. can be currently implemented. Each category defines a set of functionality that allows an application to exhibit intelligence for its created task.
Defined Rule Sets
A defined rule set applies user-defined policies against specific data that determines the end result. Take a firewall for example:
An ACL (Access List) is the rule set
The firewall software applies the rule set to the incoming or outgoing packets
Based on the ACL, the packet is either allowed or denied passage
Illustrated below is a simple flow chart that shows the path a packet takes to determine whether or not it will be accepted or denied. Of course there are quite a few more steps, especially depending on the software used. This is simply meant to demonstrate rule sets.
Another example would be bandwidth management software where:
A rule set defines the specifications for how packets are rate limited
The bandwidth management software applies the rule set to the packet
The packet is either denied or limited to a specific speed
Below is a snippet of source code written in C# which demonstrates a rule-based system over credit card validation. In this snippet there is a reference made to the file rules.txt that contains the rules on how to validate the credit card. Listed below is the layout for the rules file, followed by the source code.
Rules.txt
Layout
[fieldNum] [validationType] [lenthOfValue]
Explanation
Type
Definition
FieldNum
Number that references the field we're validating.
0 = Credit Card Number (CCNUM)
1 = Expiration Month (EXPMO)
2 = Expiration Year (EXPYR)
ValidationType
Type of validation we're doing on fieldNum
LN = Length of value
CD = Verify Date
LengthOfValue
The total characters that fieldNum must be
Example
0 LN 16 // Check that the length of CCNUM is equal to 16 characters
1 LN 2 // Check that the length of EXPMO is equal to 2 characters
2 LN 4 // Check that the length of EXPYR is equal to 4 characters
1 CD // Verify that the card has not expired yet
Source Code
// This is a very simple application for credit card validation
// It is in NO WAY meant as a production level application in its original state
// and is only meant to demonstrate the purpose of defined rule sets
static void Main(string[] args)
{
// Local variable declarations
bool isValid = true; // Is the CC Valid?
string strFile = "C:\\rules.txt"; // Path to the rules file
string strRule; // Placeholder for each rule
int intMonth = DateTime.Today.Month; // Current Month
int intYear = DateTime.Today.Year; // Current Year
// Check to make sure that the sufficient amount of arguments is being passed
if (args.Length != 3)
{
Console.WriteLine("Simple Credit Card Validation");
Console.WriteLine("Uses a rules file to determine if credit card is
valid");
Console.WriteLine();
Console.WriteLine("Usage: <exe> <CCNUM>
<EXPMO> <EXPYR>");
return;
}
// Open rules file
StreamReader rulesFile = new StreamReader(strFile);
// Read in first line
strRule = rulesFile.ReadLine();
// Check to make sure we have data
if (strRule == null)
{
Console.WriteLine("Warning - rules not found!");
return;
}
// Begin looping through all the rules
do
{
// Write which rule we're checking
Console.WriteLine("Checking rule ({0})...", strRule);
// Split the rule
string [] lineRule = strRule.Split(Convert.ToChar(" "));
// Is this a length validation?
if (lineRule[1] == "LN")
{
// Inform user of current check
Console.Write("Length of Credit Card Number " + args[0]);
// Is the length sufficient?
if (args[Convert.ToInt16(lineRule[0])].Length !=
Convert.ToInt16(lineRule[2]))
{
isValid = false;
Console.WriteLine(" is INVALID...");
}
else
{
Console.WriteLine(" is VALID");
}
}
// Is this a Check Date rule?
if (lineRule[1] == "CD")
{
// Inform user of current check
Console.Write("Exp. Date is ");
// Go through the check date process
// First check year field, then check month field
if (intYear < Convert.ToInt16(args[2]))
{
isValid = false;
Console.WriteLine("INVALID [Year]");
}
else if (intYear == Convert.ToInt16(args[2]))
{
if (intMonth >= Convert.ToInt16(args[1]))
{
isValid = false;
Console.WriteLine("INVALID [Month]");
}
else
{
Console.WriteLine("VALID");
}
}
else
{
Console.WriteLine("VALID");
}
}
} while ((strRule = rulesFile.ReadLine()) != null);
Console.WriteLine("Is Credit Card valid? {0}", isValid.ToString());
}
This code is not optimized and is in no way meant as a production application. There are countless ways of handling the above scenario. Its intention was to simply demonstrate the concepts of using outside data sources as a means to extending functionality. The data source could just as easily been a database or a TCP/UDP port listening for requests.
Pattern Matching
Typically, pattern matching finds the correlation within a sample of data and determines the solution to the given problem. Depending on what the task is at hand, the data can either be numerical and used for things like failure prediction and market research, or it can be string based and used in search engines or textual processing. Genetic Algorithms are a good method to use for this type of category because of both its survival of the fittest model and its method of implementation.
If the task at hand were to build a failure prediction mechanism for network outages, all related data would have to be captured in order to effectively introduce this into a new or existing infrastructure. It would take time to acclimate the application to the network because without some sort of information it would not know what to look for.
So what does that mean exactly? Let's say that part of this project is to determine if the Ethernet interfaces of a router are gradually degrading. One approach would be to poll the total errors for the given interfaces and determine if a trend is forming.
"Agents"
Think of this as a service or daemon that sits in the background, hidden from the user and is triggered based off of events or environment changes. Agents will watch for relevant information and depending on what it observes is how it will react.
Take a Distributed Network Management/Monitoring environment as an example. Once the decision is made to have multiple monitoring servers, a solution must be created in order to collect data from those sources and placed in a centralized location, provided that trending occurs.
The diagram below is a sample layout that utilizes an Agent to report status from the distributed monitoring services to their appropriate management stations. In turn, the management stations use the Agent to issue commands to the monitoring servers. There is also interaction between the local Agent and a remote WAN which would allow the ability to centralize monitoring/management.
The Agent could also be granted permissions to automatically respond to specific issues if the circumstances are deemed necessary. An example of this would be if through trending analysis it discovers that there is an abnormal amount of IGMP traffic being generated from a server or any IGMP traffic if it is not implemented. Packet analysis can be queued, and if the results are categorized as malicious then perhaps IGMP is blocked for that port on the switch.
Conclusion
This article was written to offer an introduction to A.I. and its application in real-world scenarios to demonstrate that A.I. has a practical place in business because the concepts are already used in common applications and devices. A.I. encompasses various disciplines and likewise has many applications to commercial scenarios. Intelligent applications help us automate tasks within business processes that in the end save weeks of manual intervention.
To obtain additional information and in-depth explanations of the theories and ideas discussed in this article, please refer to the links in the References section. Supplementary Information has also been provided to help share some history on key figures in the fields of A.I. and A.L.
In the next article of this series the focus will be on Genetic Algorithms and various ways to introduce it into commercial applications.
Supplementary Information
Listed below are some important contributors to the fields of Artificial Intelligence and Artificial Life.
John McCarthy
American computer scientist/mathematician
Some of his contributions to Artificial Intelligence include conditional expressions, recursive functions, LISP (LIst Processor) programming language and coined the name Artificial Intelligence
Kurt Gödel
Czechoslovakian mathematician
At the age of 24, Gödel derived the Incompleteness Theorem, which discusses the consequences of self-referencing within a consistent system.
John Searle
American professor in the field of philosophy
One of things Searle is well known for is his stance on Artificial Intelligence, which was demonstrated in his Chinese Room Argument.
John Koza
American computer scientist
Koza is the inventor of Genetic Programming, which utilizes Genetic Algorithms/Evolutionary Computations to do problem solving
Alan Turing
English mathematician
Turing is considered the founder of Computer Science and is responsible for creating the Turing Machine and cracking the Enigma code.
John Holland
American professor in the field of cognition and perception
Holland was one of the founders of Evolutionary Computation, and more specifically Genetic Algorithms that was first brought to light in his book entitled Adaptation in Natural and Artificial Systems.
Ben Garcia is the President and Co-founder of Adaptive Innovations, LLC., a solution provider specializing in integration and artificial intelligence. He has more than 13 years of software development experience in many different facets of the industry. Please feel free to contact Ben at bgarcia@adaptiveinnovations.net.
Mailing List
Want to receive email when the next article is published? Just Click Here to sign up.