Skip to content

Commit

Permalink
Update InferenceApplication.java
Browse files Browse the repository at this point in the history
  • Loading branch information
dickensc committed May 21, 2024
1 parent 3c229bf commit bc7ca3d
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -258,16 +258,18 @@ public void close() {
* Relax hard constraints into weighted rules.
*/
protected void relaxHardConstraints() {
float largestWeight = 0.0f;
float largestWeight = 1.0f;
boolean hasUnweightedRule = false;

for (Rule rule : rules) {
if (rule instanceof WeightedRule) {
Weight weight = ((WeightedRule)rule).getWeight();

if ((!weight.isDeep()) && (1.0f > largestWeight)) {
if (weight.isDeep() && (1.0f > largestWeight)) {
// 1.0f is the largest possible value of a deep weight.
largestWeight = 1.0f;
} else if ((!weight.isDeep()) && (weight.getValue() > largestWeight)) {
largestWeight = weight.getValue();
}
} else {
hasUnweightedRule = true;
Expand Down

0 comments on commit bc7ca3d

Please sign in to comment.