Psychologist Robert Kurzban has observed an apparent paradox in human motivation: Many activities which promote our evolutionary fitness—such as eating and sex—are pleasurable, and their pleasantness motivates us to do them. However, other fitness-enhancing activities which require involved, effortful work produce a feeling of mental exertion, which is unpleasant, and encourages us not to do them, or only do them as much as we need to. In short, it’s often painful to advance our own well being. If it’s good for us, why isn’t it fun to concentrate on work, or defer gratification now under the promise of greater rewards later?
Reviewing the literature on the question, Kurzban summarizes his own theory, by which boredom and the strain of attention are crude efforts to represent the magnitude of the opportunity costs agents incur by working on a single task for a long period of time:
Kurzban et al. [24••] have advanced a similar proposal, but, according to this view, the costs of exerting self-control are neither intrinsic  nor energetic . Instead, their focus is on opportunity costs. To see the structure of the argument, consider the habituation paradigm, used to measure what pre-verbal infants find novel. Day and McKenzie , for instance, presented infants with images of cubes from different angles, finding that their young subjects decreased their looking time at these cubes, as much as they did to a cube being presented from the same orientation repeatedly. The idea behind the use of looking time is that a tableau the baby finds familiar will be boring, and thus will not be worthy of much continued attention; a surprising scene, in contrast, merits more attention, in the same way that an adult might let her gaze linger on something they were not expecting to see. More attention translates to greater looking time indicates greater surprise; less attention connotes boredom.
A key function of the systems that direct attention likely has to do with the value of gathering information: information carries value, so organisms’ brains have design features that motivate them to attend to more informative stimuli over less informative stimuli . Boredom, on this construal, is the feeling the baby gets when little additional information is to be gained from continued attention [28 and 29]. The marginal benefit of attending elsewhere is greater than the marginal benefit of continuing to inspect the experimenter’s scene. Foraging organisms move to a new patch when the opportunity cost of staying is overtaken by the expected benefit of moving on . Similarly,information foraging organisms such as humans move on in an adaptive way. The (opportunity) cost of gathering no new information explains why boredom is unpleasant; looking away reduces this unpleasant sensation.
The habituation paradigm illustrates the problem of simultaneity. Because one cannot look in more than one place at once, looking at one thing carries the cost of looking at everything else. Related, some computational systems in the brain can, in principle, be used for many different tasks–e.g., executive systems–necessitating decisions regarding which task to prioritize. Similarly, memory systems, which can maintain only a finite number data structures [ 31]. This limit requires decisions about which structures to keep in working memory.
According to the opportunity cost view, when systems that can be used for multiple purposes are engaged in a task, the potential benefit of ending the present task in order to perform some other task is computed. This computation is the opportunity cost of persisting in whatever it is that one is doing, which increases over time (e.g., ). When this cost is sufficiently great, outweighing the computation of the (potentially long term benefits of persisting), the task is abandoned [12•].
The reason, according to this view, that even some fitness-good tasks are unpleasant is that the system or systems that compute the costs and benefits of persisting seem to be designed to favor short-term benefits. Tasks that recruit executive systems might be fitness-good in the long term, but they do not yield short-term gains, or associated phenomenological reward. The increasingly aversive sensation over time is due to the aggregation of opportunity costs . It is plausible that similar arguments might be marshalled to explain the unpleasant sensation of resisting other temptations, such as marshmallows; not eating a sweet carries the (short term) cost of the foregone calories .