Free Energy For A Class Of Combinatorial Optimization Problems And Its Asymptotics