The problem was defined in the DMCommunity Risky Stocks challenge:

Real-world trading systems produce buy and sell recommendations based on many more rules; the challenge above represents only a small business case. More importantly, financial experts may change these rules every morning and even during the day. People who have used such systems know how difficult it is to maintain frequently changing rules, especially when they conflict with each other. Such systems are usually rules-based and contain both hard rules and soft rules (preferences) that can be violated when necessary.
Keeping these considerations in mind, we applied Rules and Constraints with Probabilities, supported by Rule Solver and designed for business analysts without programming skills.
We start with the following business glossary:

It has four input variables and two output variables, “Stock Is Risky” and “Buy Stock Shares,” with the possible values 1 for Yes and 0 for No.
The first three rules specify the conditions under which a stock may be risky. They can be implemented in Rule Solver by posting these constraints with different probabilities:

Rule Solver supports the following probability values:
NEVER, VERY_LOW, LOW, BELOW_MID, MID, ABOVE_MID, HIGH, VERY_HIGH, ALWAYS
Rule 4 specifies when to buy or not buy a stock. We can implement it using the following decision table:

As usual for Rule Solver, the top-level Define and Solve tables look as follows:

When Rule Solver executes the decision model, it looks for a solution that minimizes the total constraint violation: the higher a constraint’s probability, the more expensive its violation. The standard SolverFindSolution method called from the Solve table automatically decides which constraints will be violated while ensuring that the total constraint violation is minimal.
Here are the test cases for this decision model:

All results matched the challenge’s expected recommendations. Here is the execution protocol for Test E:

Conclusion. This challenge contains conflicting rules. When the number of rules is small, a pure rules-based solution may look sufficient. However, adding more rules can make conventional decision tables too difficult to understand and maintain. In such situations, it is more practical to apply rules with probabilities and find a solution that minimizes total rule violations.
