Only the smallest tank for each fuel-mass ratio is considered, larger ones are just multiples of those. The cost is calculated using larger tanks' discounts when possible.
To save fuel, low Isp engines can be turned off once enough fuel has burned that the thrust-weight ratio will stay above the minimum without them.
The search time gets a lot longer as max engines increases, and too many engines won't be useful for most single stage crafts.
The algorithm assumes the atmosphere is uniform for the entire flight, but it's not. Use results for bodies with atmosphere at your Kerbals' risk.