OK I believe I got this, I would start with the following.
For each position
divide the total cost for board by number of positions left to fill.
get best possible player for this position based on value above.
return the highest stats unit with cost thats under the amount allowed
remove cost of from total cost.
set player chosen for this position.
This would mean that at every point we recheck the max cost for a player for a position, By changing the definition of best player you can manipulate how placement is done.