“He who fails to plan, plans to Fail”- Some Proverb.
Those were the words that resonated with me during the first semester course on “Foundations of AI” by one of my Professors in School. As he taught the class on Planning and the importance of planning, I remembered those proverbs said to me by my father in Nigeria.
The professor talked about his time researching the army and their processes; and how planning was very vital to their processes. A very salient point he raised was that no matter how much effort you put into planning, you would not be able to cater for all the complexities of life.
During my assessment, I chose to select two techniques to solve the problems used. The first technique was using decision trees and then the second was using planning. During this assessment I had to create a way of translating the data from the decision trees to the planning software.
This planning software is available here.
The GitHub repository for the project is available here.
During this article, I will attempt to give my thought process on how I built the system, why planning is important and my future plans. Alot of my thought process on the subject matter is influenced from my knowledge in class 😅
Before we jump into code or anything, I’d like to mention the importance of planning. It is important to know that while AI techniques like prepositional logic and First Order logic can model trivial problems, they are seemingly insufficient for modelling complex life situations. This is where planning becomes very important. Planning has a characteristic or feature referred to as Factored Representation.
What is Factored Representation you ask? Well It’s basically a way of scaling down or standardizing the enviroment while abstracting it. Come to think of it, one way to look at problems and life (in general), is that there is always a state (whether you see it as continous or you discretize it) and multiple finite actions. Now ofcourse there are conditions / things that should occur before we perform actions (PREDCONDITONS) and there are consequences of our actions(EFFECTS).
Also, it is also important to note that in planning, we don’t bother to explicitly outline the status of other states not performed by an action. So for instance, In a dark room filled with chairs, If I switch on the lights I don’t need to state that the chairs are still stationary. We take things as if they are in a Continuous Flux. To put it in a better way, we view life as if we are looking through a Camera continuously taking photographs. In that way, only few things change between frames while others remain constant.
Using Factored Representation, planning attempts to abstract the problem with:
- States which are the various ways the enviroment can exist.
- Actions which represent the actions that can be performed in those states. Every action here has a Condition that must be met before it occurs(Precondition) and a consequence that occurs after performing the action(Effect).
- PDDL which is basically the language for encoding in planning. Want to learn more about this? Check out Damien Pellier’s GitHub Page
So in the problem I had to solve, an administrator would take the values of the state from the Decision Tree and supply values to my system. My system then generated a PDDL that he’d import in an online PDDL editor.
Now thats out of the way, here’s what holds up my PDDL generator.
My PDDL generator is available at http://pddlgenerator.emekaonyebuchi.com. It’s a fairly simple application and is built on the following “stacks”:
- CSS – both self written and Bootstrap 4
- A little bit of JS
- PHP -for the file generation and general backend processes
On my GitHub, there are procedures on how to install it.
How to Use The System/ General Overview
In the following steps, I will explore how to use the system, why I chose that process at that time and any other relevant information
This is where the user/administrator enters his name. This enables us to track his processes and also save his details in the database
Data Entry Phase
Here, the user enters the current state from the results he derived from the Decision Tree. It is important to remember that the current system was built specifically for a Decision Tree, although in the future we can implement some form of generic nature to it (yaay!!! who’s with me 😆).
For the sake of the demonstration, lets say the Current State is “B” and the new state is “A”
This is what does all the heavy lifting. Here I used some of PHP’s file creation module to create a PDDL based on the current and next state.
Fun fact: When writing PDDL’s there are two files required. The first one is the domain file and the second is the problem file.
The domain file (“as the name implies” 😅) specifies the world as it is. It specifies the actions that can be carried out in the world, the conditions for those actions to occur and the effects applying those conditions have.
The problem file initiates the actuators in the environment and specifies what the initial state and goal are(as at the time of the problem). Now notice I said “goal” and not “goal state”. Any state that has all the characteristics we require can be regarded as the goal. There necessarily isn’t a final state that we give the esteemed title of “goal state”
The logic for the file generator is a bit simple too:
- There is a finite number of states: 4 States (A,B,C,D) and the null states
- Make a variable for all these states
- In these variables created, One of them must always be given priority (New State) while the other must be stripped of priority (Current State)
- When the user enters input, assign the states as appropriate.
So yeah, we have our two files generated.
Download the files
Here, the administrator can download the PDDL files to run in a PDDL editor. Although showing the final result is out of the scope of this blog post, you can try your results out with this awesome online editor.
Alo note that the assessment needed sort of a foolproof plan, so this page reminds the administator when next to check on the states in the decision tree.
And Voila!! There we have it
I’m hopeful for collaborations and I’m optimistic that this PDDL generator will help someone out there. There’s a bucket load of stuff that could improve in the system, and I hope we keep improving it as the years go by.
I hope you have fun using my system, and if you have any question or opinion, feel free to leave a comment (all comments will be approved by the admin after submission).