The optimal defense hypothesis attempts to explain how the kinds of defenses a particular plant might use reflect the threats each individual plant faces. This model considers three main factors, namely: risk of attack, value of the plant part, and the cost of defense.
The first factor determining optimal defense is risk: how likely is it that a plant or certain plant parts will be attacked? This is also related to the plant apparency hypothesis, which states that a plant will invest heavily in broadly effective defenses when the plant is easily found by herbivores. Examples of apparent plants that produce generalized protections include long-living trees, shrubs, and perennial grasses. Unapparent plants, such as short-lived plants of early successional stages, on the other hand, preferentially invest in small amounts of qualitative toxins that are effective against all but the most specialized herbivores.
The second factor is the value of protection: would the plant be less able to survive and reproduce after removal of part of its structure by a herbivore? Not all plant parts are of equal evolutionary value, thus valuable parts contain more defenses. A plant's stage of development at the time of feeding also affects the resulting change in fitness. Experimentally, the fitness value of a plant structure is determined by removing that part of the plant and observing the effect. In general, reproductive parts are not as easily replaced as vegetative parts, terminal leaves have greater value than basal leaves, and the loss of plant parts mid-season has a greater negative effect on fitness than removal at the beginning or end of the season. Seeds in particular tend to be very well protected. For example, the seeds of many edible fruits and nuts contain cyanogenic glycosides such as amygdalin. This results from the need to balance the effort needed to make the fruit attractive to animal dispersers while ensuring that the seeds are not destroyed by the animal.
The final consideration is cost: how much will a particular defensive strategy cost a plant in energy and materials? This is particularly important, as energy spent on defense cannot be used for other functions, such as reproduction and growth. The optimal defense hypothesis predicts that plants will allocate more energy towards defense when the benefits of protection outweigh the costs, specifically in situations where there is high herbivore pressure.