It would also depend on how many times you plan to retrain your techs, and how you plan to retrain them. Any ID level will have a breakeven point.
If, say, you are thinking to go from ID 30 to 31, which would be my next upgrade, it would cost
18,790,481,920,000 naquadah and mean the difference between dividing costs by 30 or by 31. So:
(Costs of upcoming retrains @ ID30) - (Costs of upcoming retrains @ ID 31) > 18,790,481,920,000
then it's a good buy. For this case, that would mean that it would pay off for me to upgrade if I would eventually spend more than 17,475,148,185,600,000 naq (pre-ID), or 582,504,939,520,000
at the current ID30. You could use this generic formula if you like:
if X > Y/(1/ID_old - 1/ID_new), then buy
X = Total cost of future retraining without ID
Y = Cost of upgrading ID
ID_old = current level of ID
ID_new = next level of ID
If you have an idea of the costs of future retrains in terms of your current tech costs only, just multiply that number by the current ID level to calculate X (i.e., X = X'*ID_old where X' = cost of future upgrades at current prices).
And that is my procrastination time for now. Back to real work.