简体   繁体   中英

What if I set the constraint weight to zero in OptaPlanner?

If I set the weight of a constraint to zero, does that mean that this constraint does not take effect? look like below:

@ConstraintWeight("Speaker conflict")
private HardMediumSoftScore speakerConflict = HardMediumSoftScore.ofHard(0);

Functionally: yes, the constraint has no score impact so is effectively ignored.

Implementation wise:

  • In DRL score calculation in 7.20.0.Final that constraint rule still eats CPU power because Drools doesn't support disabling rules after building the KieBase at the moment.
  • In the ConstraintStreams prototype (long-term work in progress, not yet released) that constraint already automatically takes no CPU power because it isn't be added to the KieBase.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM