Category Archives: Algorithm

Feeding the Machine

The famous Turing Machine1)It was first described in Turing’s, “On Computing Machines with an Application to the Entscheidungsproblem,” in 1937 which can be downloaded here: https://www.cs.virginia.edu/~robins/Turing_Paper_1936.pdf. Also a very good book on the subject is Charles Petzold’s, “The Annotated Turing: A Guided Tour through Alan Turing’s Historic Paper on Computability and the Turing Machine.” was a thought experiment and, until recently did not physically exist 2)Yes, somebody has built one and you can see what Turing described here: https://www.youtube.com/watch?v=E3keLeMwfHY . When computer scientists talk about machines we don’t mean the, “lumps of silicon that we use to heat our offices,” (thanks Mike Morton for this wonderful quote), but, rather, we mean the software programs that actually do the computing. When we talk about Machine Learning we don’t think that the physical hardware actually learns anything. This is because, as Alan Turing demonstrated in the above paper, the software functions as a virtual machine; albeit, much more efficiently than creating a contraption with pens, gears, rotors and an infinitely long paper strip.

When I talk about, “feeding the machine,” I mean giving the program (the AI for General Staff is called MATE: Machine Analysis of Tactical Environments and the initial research was funded by DARPA) more data to learn from. Yesterday, the subject at machine learning school was Quatre Bras.

Screen shot of the General Staff AI Editor after analysis of Quatre Bras and calculating the flanking Schwerpunkt or point of attack (blue square).  Click to enlarge.

The MATE tactical AI algorithms produce a plan of attack around a geographic point on the battlefield that has been calculated and tagged as the Schwerpunkt, or point where maximum effort is to be applied. In the above (Quatre Bras) scenario the point of attack is the extreme left flank of the Anglo-Allied (Red) army. I apply the ‘reasonableness test’ 3)Thank you Dennis Beranek for introducing me to the concept of ‘reasonableness test’. See https://www.general-staff.com/schwerpunkt/ for explanation and think, “Yes, this looks like a very reasonable plan of attack – a flanking maneuver on the opponent’s unanchored left flank – and, in fact, is a better plan than what Marhshal Ney actually executed.

It would be good at this point to step back and talk about the differences in ‘supervised’ and ‘unsupervised’ machine learning and how they work.

Supervised machine learning employs training methods. A classic example of supervised learning is the Netflix (or any other TV app’s) movie recommendations. You’re the trainer. Every time you pick a movie you train the system to your likes and dislikes. I don’t know if Netflix’s, or any of the others, use a weighting for how long (what percentage watched over total length of show) watched but that would be a good metric to add in, too. Anyway, that’s how those suggestions get flashed up on the screen: “Because you watched Das Boot you’ll love The Sound of Music!”  Well, yeah, they both got swastikas in them, so… 4)Part of the problem with Netflix’s system is that they hire out of work scriptwriters to tag each movie with a number of descriptive phrases. Correctly categorizing movies is more complex than this.

Supervised machine learning uses templates and reinforcement. The more the user picks this thing the more the user gets this thing. MATE is unsupervised machine learning. It doesn’t care how often a user does something, it cares about always making an optimal decision within an environment that it can compare to previously observed situations. Furthermore, MATE is a series of algorithms that I wrote and that I adjust after seeing how they react to new scenarios. For example, in the above Quatre Bras scenario, MATE originally suggested an attack on Red’s right-flank. This recommendation was probably influenced by the isolated Red infantry unit (1st Netherlands Brigade) in the Bois de Bossu woods.  After seeing this I added a series of hierarchical priorities with, “a flank attack in a woods (or swamp) is not as optimal as an attack on an exposed flank with clear terrain,” as a higher importance than pouncing on an isolated unit.  And so I, the designer, learn and MATE learns.

My main concern is that MATE must be able to ‘take care of itself’ out there, ‘in the wild’, and make optimal decisions when presented with previously unseen tactical situations. This is not writing an AI for a specific battle. This is a general purpose AI and it is much more difficult to write than a battle specific AI. One of the key aspects of the General Staff Wargaming System is that users can create new armies, maps and scenarios. MATE must make good decisions in unusual circumstances.

Previously, I have shown MATE’s analysis of 1st Bull Run and Antietam. Below is the battle of Little Bighorn in the General Staff AI Editor:

The battle of Little Bighorn in the General Staff AI Editor. Normally the MATE AI would decline to attack. However, when ordered to attack, this is MATE’s optimal plan. Click to enlarge.

I would like to expose MATE to at least thirty different tactical situations before releasing the General Staff Wargame. This is a slow process. Thanks to Glenn Frank Drover of Forbidden Games, Inc. for donating the superb Quatre Bras map. He also gave us maps for Ligny and Waterloo which will be the next two scenarios submitted to MATE. We still have a way to go to get up to thirty. If anybody is interested in helping to create more scenarios please contact me directly.

References

References
1 It was first described in Turing’s, “On Computing Machines with an Application to the Entscheidungsproblem,” in 1937 which can be downloaded here: https://www.cs.virginia.edu/~robins/Turing_Paper_1936.pdf. Also a very good book on the subject is Charles Petzold’s, “The Annotated Turing: A Guided Tour through Alan Turing’s Historic Paper on Computability and the Turing Machine.”
2 Yes, somebody has built one and you can see what Turing described here: https://www.youtube.com/watch?v=E3keLeMwfHY
3 Thank you Dennis Beranek for introducing me to the concept of ‘reasonableness test’. See https://www.general-staff.com/schwerpunkt/ for explanation
4 Part of the problem with Netflix’s system is that they hire out of work scriptwriters to tag each movie with a number of descriptive phrases. Correctly categorizing movies is more complex than this.

Schwerpunkt

I first encountered the German word Schwerpunkt in Major General F. W. von Mellenthin’s Panzer Battles many years ago. The word has a number of definitions but, for our purposes, we’ll use, “the point of maximum effort;” or the point where we should hit the enemy’s lines with all our strength. For von Mellenthin it was the point where his panzers would smash through the Allied lines in the 1940 Western Front blitzkrieg.

Many years later, when I was working on my doctoral research on tactical AI, I realized that calculating the Schwerpunkt was crucial for any offensive algorithm (it’s also a good thing to know your weak points when planning a defense). On every battlefield there is at least one Schwerpunkt but calculating that point first involves numerous algorithms to analyze the terrain, elevation, unit positions, 3D Line of Sight (3DLOS) and range of influence (ROI) of these units.

TIGER1)Tactical Inference GEneratoR was the program created from my doctoral research that performed battlefield analysis. Later, with a DARPA grant, it was expanded into MATE 2)Machine Analysis of Tactical Environments. One problem, that was discussed in my last blog post, was that after analysis MATE would come to the conclusion that some forces should not attack in specific situations (for example, Lee at Gettysburg). However, for General Staff,  we need an AI that will attack when we want it to.

My solution was to create the General Staff AI Editor (this may be rolled into the General Staff Scenario Editor for convenience) which allows the scenario designer to specify objectives for each army’s battle groups.

Screen shot of Antietam with battle groups, range of influence and objectives displayed. Blue indicates areas within Blue forces Range of Influence (ROI); meaning that their weapons can fire on these locations. The darker the color the more firepower they can concentrate at that location. The same is displayed for Red forces. Note that areas under both Red and Blue ROI cancel each other out (based on accuracy and firepower). Click to enlarge.

This output is just for debugging and won’t be displayed during the actual game but you can see how MATE made it’s decision to place the Schwerpunkt for Blue Battle Group #1. MATE starts by making a series of statements. These are  similar to predicates used in predicate logic but every statement is known to be true. MATE then constructs hypothetical syllogisms by combining these statements. In the series, below, MATE identifies the opposing force that must be dealt with to achieve its assigned objective, does strength analysis of the two opposing forces, determines if the defender has anchored or unanchored flanks, calculates the slope of the attack, etc., and then calculates the Schwerpunkt after analyzing the enemy’s flank positions, supporting forces and if the attacker has an unrestricted avenue of attack.

Screen shot of the output from the General Staff AI Editor showing the analysis for Blue Battle Group #1 at Antietam. The top section, “Statements about the tactical situation,” are the results of MATE algorithms that analyze unit positions, strengths, 3D Line of Sight, etc. The bottom section, “Tactical Analysis,” are conclusions drawn from the above statements. Click to enlarge.

The Schwerpunkt for Blue Battle Group #1 is displayed on the map as a blue square.

Screen shot from the General Staff AI Editor showing the location of Blue Battle Group #1s schwerpunkt (marked by a blue square). Click to enlarge.

I have written before 3)https://www.general-staff.com/antietam-ai/ about the American Civil War battle of Antietam and I frequently use it as a ‘baseline’ for my AI work. This is because I am very familiar with the battlefield having walked it numerous times, as well as having studied it in depth. So, I know the area that MATE has indicated where Blue Battle Group #1 (Union I and XII corps) should concentrate their attack: west of the West Woods at J. R. Jones’ Confederate Division’s exposed left flank.

The original caption, “Photograph shows four Union soldiers looking at dead Confederate soldiers on Miller Farm, looking toward the west woods on September 19, 1862.” From the US Library of Congress. Click to enlarge.

Many years ago I had an accountant who would apply what he called, ‘the Reasonable Test’, to Profit & Loss statements. He would look at the P&L statement and ask out loud, “does this look reasonable?” Is this a reasonable number for income? Is this a reasonable number of expenses? So, I ask, “is this a reasonable place for the Union I Corps to attack at Antietam?” And, I have to conclude, yes, it is. I can’t mathematically prove that this is the best place to attack; but I think it’s pretty good. In general, MATE will always attempt to outflank enemy positions and, I think, this is a very solid approach to offensive tactics. Indeed, I’m reminded of Wellington’s comments about Napoleon’s tactics at Waterloo, “Never did I see such a pounding match. Both were what the boxers call gluttons. Napoleon did not manoeuvre at all. He just moved forward in the old style, in columns, and was driven off in the old style.” 4)“Wellington: The Years of the Sword,” p, 488 Longford, Elizabeth For MATE, pounding is a last resort. This is the case at Burnside’s Bridge:

MATE analysis for Blue Battle Group #4 (Union IX Corps) at Antietam. Note that MATE recognizes the choke point (Burnside’s Bridge) and orders up an artillery barrage before the assault. Click to enlarge.

In the Tactical Analysis section (above) look at statement #8: “Blue Battle Group #4 has a severely restricted Avenue of Attack (Bridge).” MATE recognizes that there is no way to maneuver around to the objective (Snavely’s Ford is not on this battle map so there really isn’t any other option except over the bridge). Frontal Assault is MATE’s maneuver of last resort. Consequently, MATE first orders up the artillery to positions within distance (> 50% accuracy as set in the General Staff Army Editor for these units) and with a clear Line of Sight (3DLOS) of the target. MATE will order the artillery to bombard enemy forces that control the bridge for an hour before ordering an infantry assault).

Let’s look at MATE’s analysis of First Bull Run:

Screen shot from the General Staff AI Editor showing objective set for Union forces at the battle of First Bull Run. The Union Schwerpunkt is the blue square to the west of the Confederate left flank. Click to enlarge.

Here Blue Battle Group #2 (Heeintzelman’s and Hunter’s Union divisions) are assigned the objective of capturing the Henry House Hill (historically accurate). MATE set’s their Schwerpunkt to the west of the Confederate left flank. This is very close to Union commander McDowell’s original strategy. Again, MATE will attempt to outflank strong positions rather than attack them directly. MATE is not a pounder.

MATE’s analysis for the Union’s right flank: they have an unrestricted Avenue of Attack and Red’s left flank is unanchored. Click to enlarge.

MATE recognizes that the Confederate’s left flank is unanchored and is a perfect target for an envelopment maneuver and places the Schwerpunkt at the end of Red’s line appropriately.

I still have work to do on MATE’s ability to construct defensive lines and that will be the next thing to add to the AI. But, as you can see, great progress has been made. I believe that the MATE tactical AI is unique and I know that there is nothing similar even among the wargames used by US and NATO allies. As always, please feel free to contact me directly if you have any questions or comments.

References

References
1 Tactical Inference GEneratoR
2 Machine Analysis of Tactical Environments
3 https://www.general-staff.com/antietam-ai/
4 “Wellington: The Years of the Sword,” p, 488 Longford, Elizabeth

Antietam & AI

MATE AI selected Objectives for Blue, 3D Line of Sight (3DLOS) and Range of Influence (ROI) displayed for the Antietam: Dawn General Staff scenario. Screen shot from General Staff Sand Box. Click to enlarge.

The author walking across Burnside’s Bridge in 1966 (age 12).

I have been thinking about creating an artificial intelligence (AI) that could make good tactical decisions for the battle of Antietam (September 17, 1862, Sharpsburg, Maryland) for over fifty years. At the time there was little thought of computers playing wargames.1)However, it is important to note that Arthur Samuel had begun research in 1959 into a computer program that could play checkers. See. “Samuel, Arthur L. (1959). “Some Studies in Machine Learning Using the Game of Checkers”. IBM Journal of Research and Development.” What I was envisioning was a board wargame with some sort of look-up tables and coffee grinder slide rules that properly configured (not sure how, actually) would display what we now call a Course of Action (COA), or a set of tactical orders. I didn’t get too far on that project but I did create an Antietam board wargame when I was 13 though it was hardly capable of solitaire play.

The Antietam scenario from The War College (1992). This featured 128 pre-rendered 3D views generated from USGS Digital Elevation Model Maps.

In 1992 I created my first wargame with an Antietam scenario: The War College (above). It used a scripted AI that isn’t worth talking about. However, in 2003 when I began my doctoral research into tactical AI I had the firm goal in my mind of creating software that could ‘understand‘ the battle of Antietam.

TIGER Analysis of the battle of Antietam showing Range of Influence of both armies, battle lines and RED’s avenue of retreat. TIGER screen shot. Appears in doctoral thesis, “TIGER: A Machine Learning Tactical Inference Generator,” University of Iowa 2009

The TIGER program met that goal (the definition of ‘understand’ being: performing a tactical analysis that is statistically indistinguishable from a tactical analysis performed by 25 subject matter experts; e.g.. active duty command officers, professors of tactics at military institutes, etc.).

In the above screen shot we get a snapshot of how TIGER sees the battlefield. The darker the color the greater the firepower that one side or the other can train on that area. Also shown in the above screen shot is that RED has a very restricted Avenue of Retreat; the entire Confederate army would have to get across the Potomac using only one ford (that’s the red line tracing the road net to the Potomac).  Note how overlapping ROIs cancel each other out. In my research I discovered that ROIs are very important for determining how battles are described. For example, some terms to describe tactical positions include:

  • Restricted Avenue of Attack
  • Restricted Avenue of Retreat
  • Anchored Flanks
  • Unanchored Flanks
  • Interior Lines
  • No Interior Lines

A Predicate Statement list generated by MATE for the battle of Antietam.

Between the time that I received my doctorate in computer science for this research and the time I became a Principal Investigator for DARPA on this project the name changed from TIGER to MATE (Machine Analysis of Tactical Environments) because DARPA already had a project named TIGER. MATE expanded on the TIGER AI research and added the concept of Predicate Statements. Each statement is a fact ascertained by the AI about the tactical situation on that battlefield. The most important statements appear in bold.

The key facts about the tactical situation at Antietam that MATE recognized were:

  • REDFOR’s flanks are anchored. There’s no point in attempting to turn the Confederate flanks because it can’t be done.
  • REDFOR has interior lines. Interior lines are in important tactical advantage. It allows Red to quickly shift troops from one side of the battlefield to the other while the attacker, Blue, has a much greater distance to travel.
  • REDFOR’s avenue of retreat is severely restricted. If Blue can capture the area that Red must traverse in a retreat, the entire Red army could be captured if defeated. Lee certainly was aware of this during the battle.
  • BLUEFOR’s avenue of attack is not restricted. Even though the Blue forces had two bridges (Middle Bridge and Burnside’s Bridge) before them, MATE determined that Blue had the option of a wide maneuver to the north and then west to attack Red (see below screen shot):

MATE analysis shows that Blue units are not restricted to just the two bridge crossings to attack Red. MATE screen shot.

  • BLUEFOR has the superior force. The Union army was certainly larger in men and materiel at Antietam.
  • BLUEFOR is attacking across level ground. Blue is not looking at storming a ridge like at the battle of Fredericksburg.

MATE AI selects these objectives for Blue’s attack. General Staff Sand Box screen shot. Click to enlarge.

We now come to General Staff which uses the MATE AI. General Staff clearly has a much higher resolution than the original TIGER program (1155 x 805 terrain / elevation data points versus 102 x 66, or approximately 138 times the resolution / detail). In the above screen shot the AI has selected five Objectives for Blue. I’ve added the concept of a ‘battle group’ – units that share a contiguous battle line – which in this case works out as one or two corps. Each battle group has been assigned an objective. How each battle group achieves its objective is determined by research that I did earlier on offensive tactical maneuvers 2)See, “Implementing the Five Canonical Offensive Maneuvers in a CGF Environment.” link to paper.

As always, I appreciate comments and questions. Please feel free to email me directly with either.

References

References
1 However, it is important to note that Arthur Samuel had begun research in 1959 into a computer program that could play checkers. See. “Samuel, Arthur L. (1959). “Some Studies in Machine Learning Using the Game of Checkers”. IBM Journal of Research and Development.”
2 See, “Implementing the Five Canonical Offensive Maneuvers in a CGF Environment.” link to paper.

Wargame AI Continued: Range of Influence

In two previous blogs I wrote about how Artificial Intelligence (AI) for wargames perceive battle lines and terrain and elevation. Today the topic is how computer AI has changed ‘Range of Influence’  (ROI) or ‘Zone of Control’ (ZOC) analysis. Range of Influence  and Zone of Control are terms that can be used interchangeably. Basically, what they mean is, “how far can this unit project its power.”

One of the first appearances of range as a wargame variable was in Livermore’s 1882 American Kriegsspiel: A Game for Practicing the Art of War Upon a Topographical Map (superb article on American Kriegsspiel here).  Note that incorporated into the ‘range ruler’ (below) is also a linear ‘effectiveness scale’.

Detail of Plate IV, “The Firing Board,” from the American Kriegsspil showing a ruler for artillery range printed on the top. Note the accuracy declines (apparently linearly) proportional to the distance. Click to enlarge.

The introduction of hexagon wargames (first at RAND and then later by Roberts at Avalon Hill; see here) created the now familiar 6 hexagon ‘ring’ for a Zone of Control:

Zone of Control explained in the Avalon Hill Waterloo (1962) manual. Author’s Collection.

I seem to remember an Avalon Hill game where artillery had a 2 hex range; but I may well be mistaken.

Ever since the first computer wargames that I wrote back in the ’80s I have earnestly tried to make the simulations as accurate as possible by including every reasonable variable. With the General Staff Wargaming System we’ve added two new variables to ROI: 3D Line of Sight and an Accuracy curve.

Order of Battle for Antietam showing Hamilton’s battery being edited. Screen shot from the General Staff Army Editor. Click to enlarge.

In the above image we are editing a Confederate battery in Longstreet’s corps. Every unit can have a unique unit range and accuracy. You can select an accuracy curve from the drop-down menu or you can create a custom accuracy curve by clicking on the pencil (Edit) icon.

Window for editing the artillery accuracy curve. There are 100 points and you can set each one individually. This also supports a digitizing pen and drawing tablet. Screen shot from General Staff Army Editor. Click to enlarge.

In the above screen shot from the General Staff Wargaming System Army Editor the accuracy curve for this particular battery is being edited. There are 100 points that can be edited. As you move across the curve the accuracy at the range is displayed in the upper right hand corner. Note: every unit in the General Staff Wargaming System can have a unique accuracy curve as well as range and every other variable.

Screen shot showing the Range of Influence fields for a scenario from the 1882 American Kriegsspiel book. Click to enlarge.

In the above screen shot from the General Staff Sand Box (which is used to test AI and combat) we see the ROI for a rear guard scenario from the original American Kriegsspiel 1882. Notice that the southern-most Red Horse Artillery unit has a mostly unobstructed field of vision and you can clearly see how accuracy diminishes as range increases. Also, notice how the ROI for the one Blue Horse Artillery unit is restricted by the woods which obstructs its line of sight.

Screen shot of Antietam (dawn) showing Red and Blue ROI and battle lines. Click to enlarge.

In the above screen shot we see the situation at Antietam at dawn. Blue and Red units are rushing on to the field and establishing battle lines. Again, notice how terrain and elevation effects ROI. In the above screen shot Blue artillery’s ROI is restricted by the North Woods.

The above ROI maps (screen shots) were created by the General Staff Sand Box program to visually ‘debug’ the ROI (confirm that it’s working properly). We probably won’t include this feature in the actual General Staff Wargame unless users would like to see it added.

This is a topic that is very near and dear to my heart. Please feel free to contact me directly if you have any questions or comments.

What’s Wrong With This Picture?

Computer AI representation of battle lines for Antietam, dawn September 17, 1862. The AI is locating the Schwerpunkt or place to attack. Click to enlarge.

I was looking at this screen shot I posted as an illustration in my blog post, Battle Lines, Commanders & Computers (link) and something didn’t look right. Specifically, it was the Flank markers for Stewart’s cavalry on the Confederate left flank. And, the more I looked, the more I noticed other problems: Stewart’s cavalry was captioned as being in two groups (Group 6 and Group 7). There was an extra Flank marker with the Confederate reinforcements entering the field at the bottom of the map, the Flank markers for Union Group 2 were clearly wrong, too.

This began a two week long bug hunt that took me places I didn’t expect to revisit. To make a long story short – and how often have you heard that phrase but this is actually one of those few occasions when it’s true – I had to go back and look at my original computer code that I wrote in grad school and it turns out that there was a ‘worst case’ bug that just happened to pop up with the Antietam scenario.

This is what the battle lines and Flank markers should really look like (note: the map layer is turned on here and you can’t see the elevation layer like the top screen shot):

Correct battle lines and Flank markers for the battle of Antietam. Screen shot from the General Staff Sand Box AI test program. Click to enlarge.

I also discovered a logic flaw – a mental bug, if you will – in my definition of Flank units. Previously, I defined them as as the ‘maximally separated units of a MST (battle line) group’. That seems correct but if you think about it there are rare circumstances when this is not correct (think of the horseshoe lines at Gettysburg for example). I changed the definition of Flank units to: the ‘maximally separated units of a MST group with only one neighbor (i.e. they are at the end of a battle line and, therefore, have only one neighbor).

I thought I would finish this blog post with something that is truly unique: the very first computer bug:

On September 9, 1947 Grace Murray Hopper records ‘the first computer bug’ in the Harvard Mark II computer’s log book. Apparently, the moth was caught in a relay switch. And, yes, this is where the term comes from. Click to enlarge.