That's some impressive amount of input.
Some thoughts on the retreating into town part: would you imageine that there is any disadvantge to doing that? For example, more damage to the town parts the enemy soldiers run through freely? Because without any disadvanteages, it seems to me, the optimal way to play the siege defense would always be
1. Do maximum damage with archers and siege from walls while the attackers approach
2. Retreat into town to barricades, defednign to (presumably) more manageable chokepoints.
Therefore making it not a decison of whether one retreats to the barricades, but when one retreats to the barricades, which seems kinda one-dimensional to me.