Imperfect rationality, macroeconomic equilibrium and price rigidities