Tackling the decision-making problem faced by a prosumer (i.e., a producer thatis simultaneously a consumer) when selling and buying energy in the emergingsmart electricity grid, is of utmost importance for the economic profitability ofsuch a business entity. In this thesis, we model, for the first time, this problemas a factored Markov Decision process (MDP). Our model successfully capturesthe main aspects of the business decisions of a prosumer corresponding to a com-munity microgrid of any size. Moreover, it includes appropriate sub-models forprosumer production and consumption prediction.Employing this model, we are able to represent the problem compactly, andto provide an exact optimal solution via dynamic programming—notwithstandingits large size. In addition, we show how to use approximate MDP solution meth-ods for taking decisions in this domain, without the need of discretizing the statespace. Specifically, we employ fitted value iteration, a sampling-based approxi-mation method that is known to be well behaved. By so doing, we generalize ourfactored MDP solution method to continuous state spaces.Our experimental simulations verify the effectiveness of our approach. Theyshow that our exact value iteration solution matches that of a state-of-the-artmethod for stochastic planning in very large environments, while outperforming itin terms of computation time. Furthermore, we evaluate our approximate solutionmethod via using a variety of basis functions over different state sample sizes,and comparing its performance to that of our exact value iteration algorithm. Ourapproximation method is shown to exhibit stable performance in terms of accu-mulated reward, which for certain basis functions reaches 90% of that gathered bythe exact algorithm.