What is hard constraint?
In an optimization model, a hard constraint is a constraint that must be satisfied by any feasible solution to the model.
Remember, no solution breaks hard constraints. At the same time, you must write Hard Constraints that do not violate any rules by themselves.
For example, consider following hard constraints.
1)Σx(i)>=3
2)Σx(i)<=2
It is clear no solution satisfies both 1) and 2). You may think it is silly to write such constraints. Indeed, it is a clear case that you can detect easily in a simple problem. However, there are so many constraints in actual nurse scheduling problems that implicitly violate the rule if you write rules only with Hard Constraints.
On the other hand, there are soft constraints. You can violate soft constraint rules. However, a weighted cost will incur if you violate the rules. Since the system tries to minimize the total cost, it tries to follow the soft constraints as much as possible, especially on more significant weight constraints..
So your question may arise why not just make everything with soft constraints? It is unreasonable that there is no solution.
The answer is a good system has an appropriate mix of hard and soft constraints.
Technically speaking, soft constraints do not reduce the search space, but they increase the solution space significantly. As an optimizing solution designer, this is not something I am happy about. On the other hand, a hard constraint can dramatically reduce the search space. From this alone, we are happy, but at the same time, it also reduces the solution space. Therefore, it also increases the possibility of not finding a solution.
Even with supercomputers, only a few random binary variables are known to be solvable, about 70 variables by enumerating all combinations. However, thanks to the Hard Constraints, we can sometimes solve the nurse scheduling problem on a scale more significant than the Search Space 1googol=1e100.