This paper presents a formulation of an optimization of uncertain systems and the solution technique. The optimization under uncertainties is formulated as an optimization problem which includes unknown variables in equality constraints called system equations as well as in an objective function and inequality constraints. As countermeasures against the uncertainties, a min-max criterion is applied to the objective function and robustness criteria are introduced to the inequality constraints. By differentiating state variables satisfying the equality constraints from the decision variables, we reformulate the optimization problem based on the worst-case scenario of the state variables corresponding to the uncertain variables and we propose a "constraints-relaxation procedure" based method considering the equality constraints to solve the reformulated problem. In this method, a constraints-relaxed problem is solved corresponding to a finite number of samples of uncertain variables. Furthermore, a new sample of uncertain variables is sequentially generated corresponding to the inequality constraint which the solution violates most, together with state variables satisfying the system equations at the new worst-case scenario. Finally, the effectiveness of the proposed method is illustrated by numerical examples including robust AC optimal power flow considering distributed energy resources.