We present a day-ahead scheduling strategy for an Energy Storage System (ESS) in a microgrid using two algorithms-Genetic Algorithm (GA) and Particle Swarm Optimization (PSO). The scheduling strategy aims to minimize the cost paid by consumers in a microgrid subject to dynamic pricing. We define an objective function for the optimization problem, present its search space, and study its structural properties. We prove that the search space has a magnification of at least 50 × (B c − B d + 1), where B c and B d are the maximum depths of charge and discharge in an hour (in percentage) of the ESS respectively. In a simulation involving load, energy generation, and grid price forecasts for three microgrids of different sizes, we obtain ESS schedules that provide average cost reductions of 11.31% (using GA) and 14.31% (using PSO) over the ESS schedule obtained using Net Power Based Algorithm.