Set packing and set covering problems are among the classical models in combinatorial optimization. We introduce instances in which these problems are integral or total dual integral: we introduce ideal, max-flow min-cut matrices and perfect matrices. We then describe cases (mostly graph-theoretic problems: coloring, packing circuits etc.) in which these matrices arise.