The terms "soft constraints" and "hard constraints" are used in the context of optimization modeling.
Is there any standard way to figure out which is which in some of the complicated models?
Operations Research Stack Exchange is a question and answer site for operations research and analytics professionals, educators, and students. It only takes a minute to sign up.
Sign up to join this communityThe terms "soft constraints" and "hard constraints" are used in the context of optimization modeling.
Is there any standard way to figure out which is which in some of the complicated models?
In an optimization model, a hard constraint is a constraint that must be satisfied by any feasible solution to the model. On the other hand, a soft constraint can be violated, but violating the constraint incurs a penalty in the objective function (often, the greater the amount by which the constraint is violated, the greater the penalty). So, a good way to start looking for soft constraints in models is to find constraints that have associated penalty terms in the objective function.
For example, suppose you are a manager, and you are planning one of your salaried employee’s schedule for the next week. Suppose that $x \geq 0$ is the total number of hours the employee is to work Monday through Friday, and $y \geq 0$ is the total number of hours the employee is to work on Saturday and Sunday.
A hard constraint in this scenario might be - “by her contract, this salaried employee is allowed to work no more than 40 hours per week”: $x+y \leq 40$. A similar soft constraint might be - “this employee should work no more than 40 hours per week, but must be paid £150 per hour for every hour she works over 40”: $x + y - z \leq 40$, where $z \geq 0$ is the number of hours over 40 the employee is scheduled to work. Then, in the model’s objective function, you would include a term “$+150z$” (assuming some type of cost minimization objective).
Note that a particular function of the decision variables can appear in both hard and soft constraints in the same model. For instance, the total hours worked by an individual worker in a week might have a hard upper limit of 60, with a goal of at most (or exactly) 40 and objective penalties for exceeding 40.
Out of many implementations of these terms in the literature, an example of categorization of the constraint into soft and hard constraints can be found in the paper by Ilham Berrada et al., where they categorized their constraints in a nurse scheduling problem as either soft or hard. They stated that:
"Some hard constraints must be satisfied by all feasible solutions. They are related to administrative and union contract specifications. Other constraints (so-called soft constraints) are concerned with days off, the number of consecutive working days, and other specific nurses' wishes".
These soft constraints are treated as goals to be reached, where the overall objective is to get as close as possible to these goals.
Paper: Berrada, Ilham, Jacques A. Ferland, and Philippe Michelon. "A multi-objective approach to nurse scheduling with both hard and soft constraints." Socio-economic planning sciences 30.3 (1996): 183-193.