An agent-based model is used to determine market equilibrium with price-setting firms in an oligopoly market. The agent-based model is designed to match the experimental rules that Brandts and Guillen (J Ind Econ 55:453–474, 2007) used with human subjects. Their model uses posted prices and advance production of a perishable good. When the marginal cost is zero, the analytical Bertrand solution is almost perfect competition. When the marginal cost is nonzero, the game does not have a theoretical equilibrium in pure strategies. The agent-based model results show that with one or two firms, prices are at or near the monopoly level, which matches the human experiments. With four firms, prices are always at the perfectly competitive level when particle swarm optimization is used. Results using a genetic algorithm, however, are noisier than those using the particle swarm optimization, and the genetic algorithm falls short of the competitive solution. The triopoly market changes from mostly monopoly to a price in between monopoly and perfect competition when a marginal cost is added. The computerized agents tend to overproduce so that profits are negative in the three- and four-firm cases when production is costly. While the prices in the simulation are close to those observed in experiments with human subjects, the inefficiency due to overproduction is much greater in the agent-based model results. This result suggests that human agents are able to reach solutions, perhaps through social norms, that are missed by the simple agent-based rules used here.