What is a neural network, anyways?
In brief, the classic computer neural network is one or more input "neurons", connected to some number of "hidden" neurons, which are usually connected to one or more output neurons (there may be more than one hidden layer of neurons, but this requires much more complicated algorithms). The inputs and outputs are simple True/False or single numbers for each input/output. The neural network is then "trained" by presenting it a large variety of inputs that represent various situations, and then strengthening or weakening the connections between the neurons so that the correct output is given. A well trained neural network should then be able to give correct outputs for inputs it has never seen before, but this is highly dependent on the diversity and accuracy of the training, the ability of the problem to be broken down this way, and even the initial setup of the neural network.
Basically, it's a very touchy and difficult to set up method that only makes sense to use in some uncommon situations.
For details see the Neural network
Wikipedia entry. The type of neural network I described above is also called a Multilayer perceptron
, if you want to read the details on that. For details on training a neural network, see Backpropagation
I can understand being enamored of the idea of a technique which can make a program learn something itself, but a Dwarf Fortress AI is not a good area for its use due to the difficulty in obtaining a training set diverse enough, with simple enough inputs and outputs, and with clear enough "right" and "wrong" answers for its use.
As far as combat goes, it seems a combination of a neural network to determine the best overall make up of combat dwarves, scored against combined strength, skills, and levels. We will have a combat ANN event that is triggered when there is either an 'announcement' or 'mega-announcement' that decides the amount of force required to protect against the current threat again from the historical encounters.
This cannot work with a neural network. First of all, the "best overall make up of combat dwarves" is dependent on your definition of "best". If, for example, "best" means "highest odds to defeat the opponent", then the answer is always "use every dwarf you have." Furthermore, there is no way to describe the makeup of your military dwarves and their opponents to a neural network in anything but the simplest of terms. Finally, even if you could somehow describe it through the neural network's inputs and outputs, there is no way to train it to learn the "best" way for all of the various types, sizes, and combinations of units (your own and the enemies) in a time period that is shorter than your lifespan.
It makes far more sense to make an expert system
for something like this, where there are "rules of thumb" for squad makeup and size versus various types of units determine the minimum squad requirements to safely attack. Those "rules of thumb" can be tweaked as necessary when they don't work, but should give you an adequate method for determining if you can deal with a threat or threats in a reasonable amount of programming time.
Note: I'm not saying neural nets are universally terrible, but I'm hard pressed to think of a situation in DF where some other technique wouldn't be better.