Edited version of a message by David Myers to Rick Cooney: I was worrying about trading algorithms this morning at work, especially with regard to the 5 point method described in TWTIPS. There are 2 assumptions made, which can be described as follows: 1) That the best price does not fluctuate except in units of your ship holds. (I can't test this yet). 2) That DIFF, the difference between the best price and our best price estimate, differs by a fraction x diff, the difference between consecutive offers by the port. This is a kind of linear difference model, that can be described by the equation DIFF = f*diff. Now in general any well-behaved function describing DIFF can be expressed in terms of diff by a series expansion of the form (this is a Taylor series expansion for those of you who follow the calculus): DIFF = f*diff + g*diff^2 + h*diff^3 + ... So assertion (2) amounts to suggesting that g, h, and all higher terms can be ignored. This turns out to be testable. ---------------------------------------------------------------- A port in which g, h, and higher terms can be ignored is called a linear port. ---------------------------------------------------------------- HOW DO YOU TEST THE LINEARITY HYPOTHESIS ??? 1. Overestimate the best price. 2. Estimate new prices by the formula NEWOFFER = OLDOFFER - factor*diff make factor a small number and don't vary it. 1.5 should work. what you will end up with are a series of port offers and counter bids by us: PORT: orig_offer US: bid 1 PORT: offer2 US: bid 2 PORT: offer3 US: bid 3 PORT: offer4 let diff = offer2 - orig_offer diff2 = offer3 - offer2 diff3 = offer4 - offer3 now in the linear difference model, factor is related to f by the equation factor = (1/f - 1). So, the "optimal" 5 point f value of 0.3 translates into a factor of 2.33333333 etc. So our chosen factor leads to an estimate of the best f, which we will call f(est).. however.. diff2/diff = f(est) - f, so f = diff2/diff + f(est). In other words, if we know the f(est) value we used in our second bid, the differences between a trio of consecutive port offers nails f, *IF* the linear difference model is correct. It also allows exact calculation of margins, which leads to the possibility that you get more trading information by initially overestimating the port price, and underestimating factor, than by relying on the Psychic Probe. WHEN IS THE LINEAR DIFFERENCE MODEL CORRECT? The LDM is true if and only if diff3/diff2 = diff2/diff. David Myers. Edited version of a letter from David Myers to Steve Whitis: Eugene Hung left Tradewars with a legacy of rules for getting at the 5 point price of a port. Unfortunately, in my mind, he also left as many questions as answers. Q:Why is it that his rules fail on certain ports? Q:Why do you have to modify the psychic probe price to get some 5 point pricing to work, or in other words, why does a psychic probe lie? Q:Why is it that the difference between the first port offer and the second port offer follows the rule : abs(first-second) = 0.3*abs(best possible port price - our best estimate)? The answer to the first question is that Hung's rules aren't complete and cannot be used as an exact description of all ports. The take-home lesson of the second question is that blind reliance on the psychic probe to obtain all your information about the port and pricing is, in essence, handing your confidence over to a liar (unless of course, someone comes up with a rule for determining the nature and extent of the lie). But the answer to the third question is that this proposition can be tested. It leads to the question that currently consumes me, i.e. whether it is possible to describe accurately the trading practices of a single product at a single port in a relatively short number of observations. Can this be done in general for any trading game? How do we go about finding this kind of information? As best I can determine (and I don't claim to know everything yet), the secret to getting a port to divulge as many secrets as you can is by OVERBIDDING. If the port is a linear port (I won't get into that here, suffice it to say a "true" 5 point port is a linear port), ---------------------------------------------------------------------- Editing note: Actually, a "true" 5 point port isn't a "true" linear port because of stochastic elements in its initial offer and the need to "quantize" the offers in order to get at the true best value of the port. In a sense a 5 point port is an extension of a linear port but can't be thought of as one in the strict sense of the term. ---------------------------------------------------------------------- then the overbid can be corrected with the formula (when selling a product): NEW BID = FIRST BID - FACTOR*(OFFER2 - OFFER) Where New Bid is your second bid, First Bid is your first offer to the port, Offer2 is the port's second offer, and Offer is the ports original offer. FACTOR turns out to be related to that number 0.3 by the formula (assuming 0.3 to be true) FACTOR = 1/0.3 - 1 = 2.3333333333 But since we aren't assuming 0.3 is true, we'll call the element in the denominator f and we then have the formula FACTOR = 1/f - 1 So lets go to the example. We will estimate a margin of 10%, i.e. we will multiply the first offer by a 10% margin to get our first bid. We will estimate FACTOR to be 2. Offer 10,000 Our Bid 11,000 Offer2 10,150 Bid 2 10,700 Offer3 10,160 Now, the fact that the port made a third offer means that (a) margin is in error, and (b) FACTOR (and thus f) is in error. If the factor f is known to precision, and the linear model true, you should never see a third bid. So what is the error in f? Our estimate of f is 1/(factor + 1) = one third. The difference in price between the third offer and the second offer is 10, the difference between the second offer and the first offer is 150. 10/150 = 1/15. To correct f: f(actual) = f(est) - 10/150 = 0.3333 - 0.0666 = 0.2667 To correct margin: new margin = (Our Bid - 150/f) Offer = (11,000 - 438)/10,000 = 1.0562 This, at least, is a step toward the idea of modeling all price behavior of all ports, and provides more information than just a psychic probe report. David. Final note: The program TWFT is designed to allow tests of the above hypotheses. The trade algorithm has an implementation of second order corrections to FACTOR via a variety of methods. You can SET factor in the program through the F10 command. If you have time and a quiet game to try this in, I'd set factor to different values and see if it converges to a certain range of values. That would give you a functional definition of what values factor must be in order to be effective.