Constraint-based modeling has been widely used on metabolic networks analysis, such as biosynthetic prediction and flux optimization. The linear constraints, like mass conservation constraint, reversibility constraint, biological capacity constraint, can be imposed on linear algorithms. However, recently a non-linear constraint based on the second thermodynamic law, known as loop law, has emerged and challenged the existing algorithms. Proven to be unfeasible with linear solutions, this non-linear constraint has been successfully imposed on the sampling process. In this place, Monte - Carlo sampling with Metropolis criterion and Simulated Annealing has been introduced to optimize the Biomass synthesis of genome scale metabolic network of Helicobacter pylori (iIT341 GSM / GPR) under mass conservation constraint, biological capacity constraint, and thermodynamic constraints including reversibility and loop law. The sampling method has also been employed to optimize a non-linear objective function, the Biomass synthetic rate, which is unified by the total income number of reducible electrons. To verify whether a sample contains internal loops, an automatic solution has been developed based on solving a set of inequalities. In addition, a new type of pathway has been proposed here, the Futile Pathway, which has three properties: 1) its mass flow could be self-balanced; 2) it has exchange reactions; 3) it is independent to the biomass synthesis. To eliminate the fluxes of the Futile Pathways in the sampling results, a linear programming based method has been suggested and the results have showed improved correlations among the reaction fluxes in the pathways related to Biomass synthesis.