There are four sources from which the electricity demand can be fulfilled. There are certain constraints on the max electricity we can use from a source. Developed an algorithm to solve the optimization problem with an objective to minimize the daily electricity bill of the as a whole. The bid quantities and bid prices for each hour are the decision variables of the optimization problem. Bidding happens a day ahead, the actual electricity demand of the day and the output of the sources are not know. These were also predicted using a neural network after extracting interesting features from the data.