Supplemental Material 2. Description of the Genetic algorithm We developed a genetic algorithm to search the set of feasible market designs. The algorithm is comprised of five steps. Step 1: Initialization of population The basic building block in an optimal scale analysis is a market design, which defines trading zones. A market design corresponds to a partition of the set of WWTP. For example, assuming there are 10 WWTP in total, a sample market design and corresponding trading zones are defined as In our genetic algorithm, each individual in the population corresponds to a particular market design. The population size refers to the number of individuals in the population. Suppose the population size is m. In determining the initial population, instead of picking them randomly, we have defined a probability method to determine whether two WWTP should belong to a same trading zone. If there are mf WWTP in total, for firm i, the probability of putting it into the same zone with j is πππ = (1 − ππ ππ ππ ) π max{ππ }1 max{ππ }1 π + ππ π max{ππ }1 π minβ‘(π·π,π , π·π,π ) ( ) maxβ‘(π·π,π , π·π,π ) t where D= ABA and ππ is the variance of uncertainty about firm i’s costs. Start by choosing firm1 as the base of zone 1. For all the other WWTP (in our example for WWTP 2-10) use this formula sequentially to determine whether they belong to the same trading zone with firm 1. Then take WWTP not assigned to any trading zone as a new set, picking the first element in that set as the base of a new trading zone. Use the formula sequentially again in constructing the new trading zone. Repeat this process until only one firm is left not assigned to any trading zone or until all WWTP are assigned to trading zones. This process gives us one market design, i.e. one member of the population. Then repeat m times to generate the initial population. The initial population is denoted as generation 0. Step 2: Crossover For each generation (with a population size m), we do a crossover between each randomly picked pair of individuals (market designs) and exchange their information set. For any particular market design, its information set contains two kinds of information: size of this market design and firm information. Firm information is interpreted as the structure of the trading zones (see the example below). 1 There are two possible ways to do the crossover. We either need to expand or reduce the size of each partition in generating the new offspring. In the example above, for offspring 1, we need to reduce the size of "father" from 5 to 3. In reducing the partition size, first randomly pick 3 trading zones from "father". Then for all the WWTP left, using the probability method to decide which zone they belong to. For offspring 2, we need to expand the partition size, in our example, from 3 to 5. First in the 3 trading zones of "mother", randomly pick one trading zone and calculate the number of WWTP in that zone, (denoted as ma). Then randomly pick mb WWTP from this zone, where mb is a random number and ππ ∈ [1, ππ − 1]. Finally using the probability method to decide the probability of separating the chosen mb WWTP from the ma – mb WWTP. Then using a random process to decide whether we will create new trading zones based on our choice. Repeat this process until the partition is expanded to our targeted size. After crossover, we would have a new generation with size m. Step 3: Selection Then the new population group is denoted as the union of old population group (generation n) and their offspring (generation n+1). The new population starts with a population size of 2m. Calculate the total cost for each partition in the new population group. Then keep the first m partitions with the lowest total cost. After that the population size would be reduced to m. The partition with the lowest cost is denoted as best_partition. Step 4: Mutation The next step is to incorporate mutation for each individual (partition). The probability of mutation is pm for each individual. If a mutation happens, there is a probability of 0.5 that the mutation happens through reducing the partition size. Mutation through reducing partition size is implemented as follows. First randomly pick two trading zones in each partition and then combine them into one trading zone. There is another 0.5 probability that the mutation happens through increasing the partition size. Mutation through increasing partition size is implemented as follows. First choose the 2 largest trading zone in the partition (where the mutation happens), then randomly pick half of the WWTP in that trading zone and create a new trading zone for the chosen WWTP. Step 5: Repeat step 2 - 4 for n generations. Repeat step 2 - 4 and keep track of the best partition. After all n steps we obtain a low-cost market design from the genetic algorithm. This is obtained by evaluating between (n m) and (2 n m) distinct market designs. Testing. We tested the algorithm for accuracy using the 10 firm example in Yates et al (2013). Here it is feasible to enumerate the total costs of all the partitions. We used a population size of 50 and let the algorithm run for 20 generations. This took a few seconds on a personal computer. The algorithm almost always converged to one of the five partitions with the lowest costs (by evaluating between 1000 and 2000 out of a total of 115,975 partitions). For the 51 firm case in the paper, we used population size of 1500 and let the algorithm run for 150 generations. This took around a day on a personal computer. The construction of the Pareto frontier also provided an additional testing scheme. When the weight on abatement cost is zero, the optimal market design is no trading. When the weight on abatement cost is one, the optimal market design is full trading. The algorithm correctly found the optimal market design in both cases. 3