April 15, 2014 3:34 pm

Santa Fe’s ant trail problem

 

I used genetic programming approach, specifically framework GP SDK for .NET for seamless implementation. “Ant” should visit “eat” as much points “food” as possible in specific time. Program of each “ant” is generated by evolving following instructions:

  • One step- Go();
  • Flag: ifFood
  • Turn left – Left();
  • Turn right – Right();
  • 2 commands – {}
  • 3 commands –  {}

 

Sample input:

 

Evolution:

Best solution found:

Ant’s program:


if(Food()) { if(Food()) { if(Food()) { if(Food()) { Go(); } else { Right(); } } else { Right(); } } else { Left(); } } else { { Right(); Go(); } } { Right(); Go(); } if(Food()) { { if(Food()) { Go(); } else { { Go(); Right(); } } if(Food()) { Left(); } else { Left(); } } } else { Right(); }}

 Download:

Tagy:

@cisary on twitter


Bitcoin, web applications, constraint processing, AI, soft-computing - evolution inspired algorithms, integration with the blockchain technology and more.    


Contact



Agile Software Development


cisary @ Github cisary @ Bitbutcket






Newest articles





Twitter & Delicious




  • New (beta) website