A general framework for inverse modeling in microstructural materials design