Walking motion planning based on Divergent Component of Motion (DCM) and Linear Inverted Pendulum Model (LIPM) is one of the alternatives that could be implemented to generate online humanoid robot gait trajectories. This algorithm requires different parameters to be adjusted. Herein, we developed a framework to attain optimal parameters to achieve a stable and energy-efficient trajectory for real robot's gait. To find the optimal trajectory, four cost functions representing energy consumption, the sum of joints velocity and applied torque at each lower limb joint of the robot, and a cost function based on the Zero Moment Point (ZMP) stability criterion were considered. Genetic algorithm was employed in the framework to optimize each of these cost functions. Although the trajectory planning was done with the help of the simplified model, the values of each cost function were obtained by considering the full dynamics model and foot-ground contact model in Bullet physics engine simulator. The results of this optimization yield that walking with the most stability and walking in the most efficient way are in contrast with each other. Therefore, in another attempt, multi-objective optimization for ZMP and energy cost functions at three different speeds was performed. Finally, we compared the designed trajectory, which was generated using optimal parameters, with the simulation results in Choreonoid simulator.