A generalization of the maximal entropy method for solving ill-posed problems