Forecasting Solar Power is an important aspect for power trading company. It helps in energy bidding, planning and control. The challenge in forecasting is to predict non-linear data, which can be fulfilled by Computation technique and Machine Learning model. To further enhance the ML model optimization technique is used for training. Artificial Neural Network (ANN) is used as a ML model and optimization-based model is developed named as Optimized Artificial Neural Network (OANN). This paper also presents how the computation technique is incorporated in machine learning model, and a comparison is shown between these two models. Two OANN models are developed based on Crow Search Algorithm (CSA-ANN) and Seagull Optimization Algorithm (SOA-ANN). These models are forecasted for a day ahead, three days ahead and a week ahead solar power generation by considering time, irradiation and temperature as input parameter for the model. ANN gives best result for short-term prediction but unable to predict for mid-term and long-term prediction. This demerit of ANN is overcome by SOA-ANN, which is measured with statistical parameters such as Mean Absolute Error (MAE), Mean Square Error (MSE), Mean Absolute Percentage Error (MAPE) and Co-relation of determination (R2). The percentage improvement of SOA-ANN is obtained with these statistical parameter as 6.54%, 16.05%, 1.67% and 3.61%. The results associated with CSA-ANN is not much efficient as SOA-ANN, but it can predict better for low frequency values, but its overall performance is poor. SOA-ANN exhibit improved performance over ANN and CSA-ANN for forecasting.