Tuesday, October 21, 2008

What is optimization?

As per wikipedia, "Optimization (mathematics), trying to find maxima and minima of a function".

So as per my understanding optimization is basically a search problem/function. For me optimization is the process of searching the maxima or minima into the given n-dimensional space where search is driven by the constraints imposed by the problem definition and/or environment.

Thursday, September 4, 2008

ACO Vs. PSO. What to use when?

Lot of literature is available introducing ACO and PSO. At very first time when I read them, I thought that they are different ways of solving same problems. I mean I was thinking that, they can be applied on same set of problems. Then I ran into another thought, "Then why do we need both of them?". For getting answer of this question, I read their introductions again. I got my answer. The answer is:

ACO is mostly used for discrete optimization problems.
PSO is mostly used for continuous optimization problems.

Reason behind this is:
ACO is driven by two parameters : heuristic value and pheromone value. Mostly these values are derived from parameters having discrete values.
PSO is driven by neighbor's velocity. Velocity is continuous parameter. As one of the parameters used for deriving velocity is time and time is continuous.

ACO fits better at graph searching problems while PSO fits better at ANN learning as well as pattern recognition. Reason behind this is, parameters used for graph searching are mostly discrete parameters while parameters used for learning/recognition are continuous parameters.

Friday, July 18, 2008

Can we apply Ant Colony Optmization on Tic-Tac-Toe?

Question:
I need to implement ACO in tic-tac-toc game playing. The problem is when i studied the algorithm that was on static graph called TSP problem. But in T-T-T there will be dynamic graph or tree.

My Answer:
You can always apply Ant Colony Optimization(ACO) on any search graph. Actually basic fundamental behind this concept is the Ant's foraging nature. Path from nest to food is never a static search graph. When Ant starts searching for food from its nest, it even don't know where the food is?

I have applied ACO on routing in Mobile Adhoc Network(MANETs). MANETs by nature are dynamic so its search graph is always dynamic.

For solving this problem, you need to know best heuristic for solving Tic-Tac-Toe. Once that is known to you, I can really help you out in solving your problem.

One heuristic for Tic-Tac-Toe game is the position. If you are at the centre position then you have highest chances to win(Say 3 points). Then if you are at corner position then you have lesser chances to win(Say 2 points). If you are at any other postion then you have even lesser chances to win(Say 1 point). So a heuristic you can apply is, try to go for the postion which does not make you loose as well as gives highest points. As you have at max 4 corner postions so in that case your selection of any of the available corner postion should be driven by Pheromone. I mean the postion which has highest pheromone value should be considered. So this is the postion which is good as per heurustic values and better as per prior experience(having higher pheromone intensity). I guess Tic-Tac-Toe is solved using ACO. Isn't it???

You can always apply other better Heurisitics. Also you can try to apply different weightage on Heuristics and Pheromone by changing values of Alpha and Beta.

Hope you will be in a postion to start your implementation. You are very welcome to ask your doubts here, if any.

Saturday, June 14, 2008

Ant Colony Optimization(ACO)

Introduction of Ant Colony Optimization(ACO):
Ant Colony Optimization is a probabilistic technique for searching based on Ant's foraging behavior. The concept was derived by Macro Dorigo. It best used for solving combinatorial optimization problems. Best suitable for minimization of multiple paths from a search graph.

Example applications are: TSP, Intelligent Routing, Classification etc.

Usage of Comparable interface in core Java:

Comparable interface is used to make your object comparable to other objects. Comparable interface has int compareTo(Object object). One can override this method to provide appropriate comparison of this object to the other object which is sent as an argument to this method.

Example:
Class Empoyee impements Comparable{

String name;

public int compareTo(Object otherObject){
int retValue = -1;
if(otherObject instanceOf Employee){
retValue = getName().compareTo(otherObject .getName());
}

return retValue;
}

}