Image 01

21st Century AI

A blog about achieving meaningful Artificial Intelligence

Posts Tagged ‘Line of Sight’

Are we making the dinosaurs too smart?

Saturday, July 27th, 2013

Traces of the artificial intelligence (AI) calculations for dinosaurs' optimal paths to food. The AI chooses paths with least steep slopes and avoids terrain (like swamps) that would unnecessarily slow the dinosaur down. Screen capture.

Traces of the artificial intelligence (AI) calculations for dinosaurs’ optimal paths to food. The AI chooses paths with least steep slopes and avoids terrain (like swamps) that would unnecessarily slow the dinosaur down. Screen capture.

This article is reposted from my Dinosaur Island blog here.

Yes, I know in Jurassic Park velociraptors could open doors (I would post a picture, but I’m worried about lawsuits so here’s a link to the clip instead). Luckily, on Dinosaur Island we don’t have any doors, kitchens, cages, Land Rovers or electric fences so we don’t have to worry about writing the artificial intelligence (AI) routines for the dinosaurs to deal with these objects.

Instead, we’re interested in if the dinosaur can see the food (I discussed 3D line of sight algorithms in, “Dinosaurs, tanks and light of sight algorithms,” here). And, if and only if, the dinosaur can see the food, how does the dinosaur get to the food? The fastest way for the dinosaur to get to the food can be solved using a least weighted path algorithm which I discussed in this blog here.

Now, the question is, “are we making the dinosaurs too smart?” The image at the top of today’s blog is a screen capture of the AI ‘looking’ at different ways to get to the objective (in this case, food that has been identified previously using the 3D line of sight algorithm). From literally thousands of possible routes (some only deviating by a meter from another possible route) the optimal, or fastest route across the landscape (avoiding steep hills and terrain that would slow the dinosaur down) is chosen.

Is this really how a dinosaur thought?

Probably not. What I suspect, and again, I’m a computer scientist, not a paleontologist, is that dinosaurs, especially a dinosaur pursuing prey, ran straight towards the target until it encountered something (an obstacle, a steep hill, swampy land) and only then considered going on an alternative path.

So, I will probably rewrite the AI so it’s not optimal. But for now, we’ve got some really smart predators on Dinosaur Island. Not opening doors smart. But smarter than the real thing.

SmallRule

Below is a screen capture of the optimized AI least weighted path algorithm.

Screen shot of optimal least weighted path algorithms (taking slope and terrain into effect). Dark red lines: 3D Line of sight (the food that the dinosaur is looking at). Orange lines: final path for dinosaur. Yellow areas: alternative paths that were evaluated and discarded. Screen capture (click to enlarge).

Screen shot of optimal least weighted path algorithms (taking slope and terrain into effect). Dark red lines: 3D Line of sight (the food that the dinosaur is looking at). Orange lines: final path for dinosaur. Yellow areas: alternative paths that were evaluated and discarded. Screen capture (click to enlarge).

Thirst or hunger? What is more important to a dinosaur?

Tuesday, July 16th, 2013

A drinking hadrosaur from a set of 1916 German collector cards "Tiere der Urwelt" (Animals of the Prehistoric World) by Heinrich Harder, from here. (Copyright expired.)

A drinking hadrosaur from a set of 1916 German collector cards “Tiere der Urwelt” (Animals of the Prehistoric World) by Heinrich Harder, from here. (Copyright expired.)

(This blog is reposted from my other site: Dinosaur-Island.com) What is more important to an animal that is very hungry and very thirsty: water or food? I just encountered this problem when writing the AI code for dinosaurs finding food and water. When ‘new’ dinosaurs are currently created in Dinosaur Island they haven’t yet eaten or drunk water so the stored values for every new animal is ’0′. Obviously, we can, and will, change that so ‘new’ dinosaurs are created with some values (these ‘new’ dinosaurs are not ‘just hatched’ dinosaurs but rather adult animals that are created and placed on Dinosaur Island for testing purposes).

Screen capture showing a very thirsty Edmontosaurus named Gertie who is now walking towards the closest observable water (click to enlarge).

Screen capture showing a very thirsty Edmontosaurus named Gertie who is now walking towards the closest observable water (click to enlarge).

The above screen capture from Dinosaur Island shows a very thirsty Edmontosaurus, named Gertie, that can see fresh water (solid blue line) in a nearby tributary. It is interesting to note that because of the height of the river bank Gertie can only see the water on the far side of the tributary. Nonetheless, Gertie is now moving towards the water she can see and will stop and drink as soon as she encounters it.

While working on the AI routines for a dinosaur finding water (see also Dinosaurs, tanks and line of sight algorithms here) I realized that some dinosaurs travel in herds and that where the herd goes is the decision of the leader. Consequently, we will need to have the ability to designate one dinosaur in a group as the leader and the others as followers. Were dinosaur herds matriarchal (led by the senior female, like elephants)? Were dinosaur herds patriarchal (like buffalo)? We just don’t know the answer to these questions but we will be able to explore the possibilities by using Dinosaur Island and observing the results.SmallRule

After posting yesterday’s blog I received an email from my friend, Siobhan, who wrote, “I think dinosaurs are closer to elephants than buffalo, and thus require a matriarch.  Please tell me who I need to pay off and how to see a matriarch implemented! (that’s me subtly casting a vote).

Bribery isn’t necessary. We believe Dinosaur Island should be flexible enough to allow the user to set up any scenario they wish. Today we added the following to the ‘Dinosaur Species’ dialog box:

The just added Herd Leadership variable (Matriarch, Patriarch or Neither in bottom right). Edmontonsosaurus, by default, is now a matriarchal herd. Screen capture (click to enlarge).

The just added Herd Leadership variable (Matriarch, Patriarch or Neither in bottom right). Edmontonsosaurus, by default, is now a matriarchal herd. Screen capture (click to enlarge).

Edmontosaurus regalis is now, by default, a matriarchal herd which means that the senior female decides where the herd goes, where it eats, where it drinks, where it rests and how to avoid predators. The default for Tyrannosaurus rex is ‘Neither’ or no herd leadership.

 

Dinosaurs, tanks and line of sight algorithms

Sunday, July 14th, 2013

A screen capture of MATE (Machine Analysis of Tactical Environments). Note the blue armor unit (labeled '0') just left of the center of the screen. Click to enlarge.

A screen capture of MATE (Machine Analysis of Tactical Environments). Note the blue armor unit (labeled ’0′) just left of the center of the screen. Click to enlarge.

MATE screen capture showing the calculated line of sight of Armor Unit 0 (click to enlarge).

MATE screen capture showing the calculated line of sight of Armor Unit 0 (click to enlarge).

 

Adjusting the height of an object in MATE to calculate its line of sight.

Adjusting the height of an object in MATE to calculate its line of sight.

(This article is cross-posted in my “Dinosaur Island” blog).

My doctoral research involved ‘computational military reasoning’¹, a phrase that I coined that means, “computers making tactical combat decisions.” My research was supported in part by DARPA (Defense Advanced Research Projects Agency, the people that really invented the internet). I was able to demonstrate in my MATE (Machine Analysis of Tactical Environments) program that a computer could make what computer scientist John Laird, called, “Human-Level” decisions and could do so very rapidly (see here for more information about MATE). Indeed, my friend, retired Lieutenant Colonel Mike Robel, once said that a computer Course of Action (COA) program like MATE was vitally important because “it’s hard to make your best decision when someone is trying to kill you.”

When I first began working on the design of Dinosaur Island I joked with some colleagues that the AI (Artificial Intelligence) wouldn’t be too difficult as I would just use my MATE program and cross out ‘tank’ and insert ‘triceratops’. There is some truth to that, as we will see today.

One of the first AI routines that I’m adding to Dinosaur Island enables the dinosaurs to find food and water. How does a dinosaur do this? Well, there are actually three ways that a dinosaur finds food and water:

  1. The dinosaur looks around for food or water.
  2. The dinosaur smells food or water.
  3. The dinosaur remembers where it last found food or water.

Right now we’re interested in the first option: looking around (this will also come in handy for spotting predators, too). How does a computer dinosaur ‘look around’?

Luckily, I’ve already solved this problem some years ago in grad school with TIGER (the predecessor of MATE). The solution is a 3D Bresenham line algorithm (I’m not going to write out the algorithm because you can see it here). The Bresenham line algorithm was invented by Jack Bresenham in 1962 when he was working at IBM and it was originally used for controlling a pen plotter (a type of printer that would pick up colored pens with a mechanical arm and draw on rolls of paper). However, if we have a 3D landscape (and we do in Dinosaur Island), we can take Bresenham’s two dimensional algorithm and extrapolate it into three dimensional space to determine if the terrain blocks an object’s view in a particular direction. If we do this in all 360 degrees and plot what can be seen (and what is obscured) we’ll have an image like the second screen shot, above.

Now, in MATE, I had to add a little dialog box so the user could input the height of the observer (the third screen shot showing the height of a tank). But in Dinosaur Island I realized that not only the height of every dinosaur can be calculated (just like the length and weight) but that taller dinosaurs, like the giant sauropods, might have a great advantage because they’ll be able to see farther. This will help them find food and water and see predators before the predators can see them.

Next, I’ll work on the ‘smell algorithm’ which will involve wind direction and speed. Luckily, I solved that problem a long time ago with a game/simulation I did in 1989 called, “UMS II: Nations at War.”

SmallRule

1) My doctoral thesis, “TIGER: An Unsupervised Machine Learning Tactical inference Generator,” can be download here. TIGER was an earlier version of MATE.