Objectives and Constraints
Objectives and Constraints
How do these two concepts interrelate in software development? We look at it from a mathematical perspective and go from there.
Join the DZone community and get the full member experience.Join For Free
[Latest Guide] Ship faster because you know more, not because you are rushing. Get actionable insights from 7 million commits and 85,000+ software engineers, to increase your team's velocity. Brought to you in partnership with GitPrime.
Objectives and constraints are symmetrical in a mathematical sense but are asymmetrical in a psychological sense. By taking dual formulations, you can reverse the mathematical role of objectives and constraints, but in application objectives are more obvious than constraints.
In the question "What is the minimum value of x² over the interval [1, 5]?" the function f( x) = x² is the objective function and 1 ≤ x ≤ 5 is the constraint. If someone says the minimum is 0, they've minimized the objective function but ignored the constraint. This is clear in a such a simple problem, but failure to consider constraints can be much more subtle.
Objectives tend to be easily quantifiable
Maximize profit, minimize energy consumption, etc., but constraints tend to be less quantifiable. The solution has to be testable and maintainable, has to be legal, has to be something people will buy or vote for, etc.
When children ask, "Why don't you just ..." It's because they see a way to improve some objective, but the "just" part shows that they are either completely unaware of a relevant constraint or are unaware of how difficult it would be to overcome the constraint. As you mature, you become aware of more constraints. You realize that things that seem grossly subopitmal are actually close to optimal when you consider the necessary constraints. There may be room for improvement, but not as much as you imagined and at a higher cost.
Big opportunities open up when constraints change
Maybe an idea was abandoned because it would require more calculation than anyone could carry out by hand, and now's the time to revisit it. Or maybe an idea was never developed because it would require instantaneous communication between people at multiple points on the globe. No problem now.
In both the examples above, a constraint was relaxed: computation and communication have gotten far less expensive. Increased constraints create opportunities as well. When the price of something goes up, its alternatives become more economical by comparison. Whether an oil field is worth developing, for example, depends on the current price of oil.
If I ask "Why hasn't someone done this before?" I'm skeptical if the answer is "Because I'm smarter than everyone else who has tried." But if the answer is "Because constraints have changed" then I'm much more receptive.
Published at DZone with permission of John Cook , DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.