In this paper, we consider an electricity market that consists of a day-ahead and a balancing settlement, and includes a number of stochastic producers. We first introduce two reference procedures for scheduling and pricing energy in the day-ahead market: on the one hand, a conventional network-constrained auction purely based on the least-cost merit order, where stochastic generation enters with its expected production and a low marginal cost; on the other, a counterfactual auction that also accounts for the projected balancing costs using stochastic programming. Although the stochastic clearing procedure attains higher market efficiency in expectation than the conventional day-ahead auction, it suffers from fundamental drawbacks with a view to its practical implementation. In particular, it requires flexible producers (those that make up for the lack or surplus of stochastic generation) to accept losses in some scenarios. Using a bilevel programming framework, we then show that the conventional auction, if combined with a suitable day-ahead dispatch of stochastic producers (generally different from their expected production), can substantially increase market efficiency and emulate the advantageous features of the stochastic optimization ideal, while avoiding its major pitfalls. A two-node power system serves as both an illustrative example and a proof of concept. Finally, a more realistic case study highlights the main advantages of a smart day-ahead dispatch of stochastic producers. 
Electricity market clearing with improved scheduling of stochastic production