Consumer theory

How do you decide what to produce or trade? How can you maximize happiness in a world of scarcity. What are you giving up when you choose something (i.e., opportunity cost)?