I understand that its against the grain of whats there already, but i would be shocked if it took more calculations than what you're doing already. Because the number of calculations that this should take is going to be pretty close to the minimum calculations in order to supply markets with half of the information you're suggesting they need to be supplied with.
There is only a "dynamic" price matching equilibrium when quantity is determinate*. If quantity is indeterminate then there is a corner solution price matching equilibrium.
That is, each market is only making a check against what the smaller of its own production price(which is a fixed value per unit) and the import price of other planets are (which is the sum of their production price plus the travel cost multiplied by the tariff, all of which are fixed values per unit) and then using that as its buying and selling price. This is consistent with a full economic model only if in that model supply and demand are both horizontal lines and never the two shall meet. I.E. quantity is indeterminate and price is equal to the supply price per unit. You're looking at the calculation under the assumption that a full model provides determinate price and quantity. But we don't need determinate quantity because we don't care.
Ahhh, gotcha, thank you for elaborating. Yes, I was indeed thinking of quantity being determinate (and that making it unfeasible). There's an added factor where the supply of one commodity feeds into the supply of another - i.e. need Ore to make Metals, need Metals to make Heavy Machinery, and... also need Heavy Machinery to mine Ore, which makes a quantity-based model pretty much not reach an equilibrium.
So! The new economy system (that is, the one in the dev build) is ... basically what you describe. Quantity is indeterminate, but there are tiers, i.e. a supply of 4 Ore can't satisfy a demand for 5 Ore, and this just acts as an extra filter when finding the best supplier. "Accessibility" maps pretty directly to "travel cost" in what you describe.
But for player-facing stuff, not dealing with quantity I think goes against the player being able to, say, have some sort of impact by bringing in a commodity if there's a shortage, that sort of thing. They could still make money by bringing it in, right, but not actually end the shortage - quantities have to be involved there - and then it gets weird since they could, say, just buy the theoretically in-shortage good from that very same colony. Or from a tiny market nearby that couldn't reasonably provide enough, in theory.
It's also nice to be able to say that, for example, "bringing X units of Y to your colony will keep it supplied for Z months". If everywhere has unlimited everything and it's just a matter of price... well, I could definitely see it working, it sounds like a reasonable system. I'm just not sure I like the feel of that for Starsector specifically.
(Also, say you need supplies: create a colony, instantly buy what you need. Then abandon it. Could be worked around, of course - but the point is, there are complications to this system as well, much like the stuff I'm working through now, just of a different flavor.)
But, yeah - thank you for the idea and elaborating on it, I'll keep it in mind as I'm thinking these things through.
**I am actually not that proficient in understanding big O notation structure I know that some calculations are easier/harder so its not quite right for me to call this O(n^2). A minimum check should be faster than a multiplication but slower than a sum (each one essentially has its own big O value which is on a different scale than the final algorithm. As an example solving a simultaneous linear equation is O(n^3) for small matrices. There are n^2 multiplications and sums to solve which makes n^3. But if those values are large each multiplication itself is technically in n^2 you're just on different n scale and here is where the technicalities of the definition get beyond the point where I care because i don't expect the individual values of any matrix i want to calculate to be large enough where the difficulty of doing the multiplication matters compared to the number of them i have to do given the size of my matrix n). My assumption is that min(1,2...n) is O(n) and so doing that n times is O(n^2). Min(1,2....n) could for all i know be O(n^0) and so the whole thing would be O(n)
(Yeah, I think you've got a good handle on it. One would just use a different letter than "n" for a different parameter. For example, the price calculation as you outline it could be called O(m * n^2), where m is the number of commodities, and n is the number of markets. But if the number of commodities is considered a constant, then as far as big O notation is concerned, it's the same as O(n^2). But of course for practical applications, the constant factor *does* matter.)