We propose a novel simulation-based optimization method to solve the biorefinery location problem in competitive corn markets. As the feedstock cost is the largest cost component for producing ethanol, it is critical to consider the formation of corn prices in the local markets around biorefineries. The corn prices are determined by competition among biorefineries, among farmers, between biorefineries and the food market. However, the competition is often ignored in previous studies. In this work, we formulate the competition in the biorefinery location problem by agent-based modelling and simulation of the local corn markets. The corn prices are determined by double auction mechanism in which the biorefineries and the food market are buyers and the farmers are the sellers. The determined prices are then imported to the optimization problem, which is solved by a genetic algorithm. The proposed method is demonstrated by a case study on biorefinery locations in Illinois.