Feed-back welcome :)
The score should be a Score instance of double. Add build-in support for HardAndSoftScore. Replace ScoreCalculator with ScoreHolder.
https://jira.jboss.org/jira/browse/JBRULES-1158
Solution should have a getScore() and the score rules need to calculate the correct score for a solution instead of filling some magic global variable
https://jira.jboss.org/jira/browse/JBRULES-1977
With kind regards,
Geoffrey De Smet
Geoffrey De Smet schreef:I am actually considering a couple of designs, which also happens to solve the problem of the magic name of the scoreCalculator.1) a score will no longer be a double, but an instance of a new interface Score. This will means that a score of an int hard and int soft will be represented as it should be: an int hard and an int soft. That has 2 advantages:- you could use implement their own Score, if the out-of-the-box types don't suffice, say int hard, BigDecimal soft, double verySoft.- it would be possible to decide the step, not on a normal compareTo, where hard is always higher then soft, but on (hard * hardAsSoftWeight + soft), where hardAsSoftWeight changes:it's normally very high, but when no hard constraints are broken in a long time, it temporarily goes down.This allows the local search to take steps that break a hard constraints for a while, passing through hard barriers. Experiments have proven that this gives better results.2) a Solution has a Score. That Score can be uninitialized or dirty.A Solution is also inserted into the working memory (along with it's facts).Every changing fact (Queen, Lesson, Exam, ...) will also need to hold a reference to it's Solution.That way every ConstraintOccurrence can hold a reference to it's Solution.Then the calculateScore rule will update the score in a solution, instead of putting it into a global. The solver still has a reference to the solution, so it can retrieve the score.This allows for multiple solution instances to be put into same working memory and there's no magic scoreCalculator.What do you think? Criticism welcome :)Of course, backward compatibility will be broken (as stated in the manual), but everything will be documented into an upgradeRecipe.txt,so it shouldn't be to hard to upgrade to a newer version.With kind regards,Geoffrey De SmetGreg Barton schreef:Actually, I was wishing for something similar last night, but for the names of entry-points. I think it would be nice if you could specify the names of things in DRL from the values of public static final Strings. (i.e. constants) Do you dev folk think that's possible enough to make a jira request for it?--- On Fri, 2/13/09, Geoffrey De Smet <ge0ffrey.spam@gmail.com> wrote:From: Geoffrey De Smet <ge0ffrey.spam@gmail.com>Subject: [rules-users] Re: drools-solver - magic name of scoreCalculatorTo: rules-users@lists.jboss.orgDate: Friday, February 13, 2009, 9:37 AMYes, it's not that good that it's a magic name.However, I don't know any other way to do it.Feel free to make a jira for it, especially if you know abetter way to do it :)With kind regards,Geoffrey De SmetAndrew Waterman schreef:Thanks Geoffrey! I patched this yesterday withslf4j-jcl and slf4j-nop for no loging. I'll post themavne dependencies later this morning in case others wish touse non-log4j implementations. :) I did noticeas well thatthe "scoreCalculator" global is referenced by namefrom the solver. Want me to file a jira issue on that? Itseems strange that the variable name shoudl be static likethat to me.best wishes,AndrewOn Fri, Feb 13, 2009 at 7:55 AM, Geoffrey De Smet<ge0ffrey.spam@gmail.com<mailto:ge0ffrey.spam@gmail.com>> wrote:Adding the slf4j-log4j12 dependency to yourpom.xml should fix it :)<dependency><groupId>org.slf4j</groupId><artifactId>slf4j-log4j12</artifactId><scope>runtime</scope></dependency>Not sure how changing anything indrools-solver-examples could fixit, normally your project wouldn't depend onit, only ondrools-solver-core.With kind regards,Geoffrey De SmetGreg Barton schreef:I was getting the error below running thebenchmarkNQueens.shscript in drools-solver-examples. I gotaround it by taking the"<scope>runtime</scope>"line out of the slf4j-log4j12dependency in drools-solver-examples/pom.xml.Not sure ifthat's the right way to get around it, butit worked. :)--- On Fri, 2/13/09, Geoffrey De Smet<ge0ffrey.spam@gmail.com<mailto:ge0ffrey.spam@gmail.com>>wrote:From: Geoffrey De Smet<ge0ffrey.spam@gmail.com<mailto:ge0ffrey.spam@gmail.com>>Subject: [rules-users] Re: drools-solver-- logger error(slf4j binding)?To: rules-users@lists.jboss.org<mailto:rules-users@lists.jboss.org>Date: Friday, February 13, 2009, 1:04 AMdrools-score (like hibernate and manyother lib projects)just depends on sl4j-api, which is alogging interface.It's up to the end-use product todecide which loggingimplementation to use under that and howto configure thelogging (where to log to, how much to log,...).In the drools solver examples I 'veput slf4j-log4junderneat it, because I am familiar withlog4j'sconfiguration, take a look at theirlog4j.xml files. Howeverthey say that the logback implementationis better thesedays.PS: I 'll take a look at the otherdiscussions thisafternoon.With kind regards,Geoffrey De SmetAndrew Waterman schreef:Hi,I'm using the drools-solver.M5build through Mavenand have gotten the following error whilerunning myproject:SLF4J: Failed to load class"org.slf4j.impl.StaticLoggerBinder".SLF4J: Seehttp://www.slf4j.org/codes.html#StaticLoggerBinder forfurther details.I've checked my dependency graph,anddrools-solver references the sl4j-api, butnoimplementation. I checked themvnrepository, and there areseveral other slf4j related projects.What is the preferredbinding for JDK1.6?best wishes,Andrew---------------------------------Andrew WatermanSan Cristóbal de las Casas, Chiapas,Mexico+52 1 967 107 5902+1 510 342 5693_______________________________________________rules-users mailing listrules-users@lists.jboss.org<mailto:rules-users@lists.jboss.org>https://lists.jboss.org/mailman/listinfo/rules-users_______________________________________________rules-users mailing listrules-users@lists.jboss.org<mailto:rules-users@lists.jboss.org>https://lists.jboss.org/mailman/listinfo/rules-users_______________________________________________rules-users mailing listrules-users@lists.jboss.org<mailto:rules-users@lists.jboss.org>https://lists.jboss.org/mailman/listinfo/rules-users_______________________________________________rules-users mailing listrules-users@lists.jboss.org<mailto:rules-users@lists.jboss.org>https://lists.jboss.org/mailman/listinfo/rules-users-- +1 510 342 5693PO Box 7775 #8750San Francisco, California 94120-7775"Warning: following standard input indefinitelyis ineffective"- /bin/tail error message"Against logic there is no armor likeignorance."- Laurence J. Pete------------------------------------------------------------------------_______________________________________________rules-users mailing listrules-users@lists.jboss.orghttps://lists.jboss.org/mailman/listinfo/rules-users_______________________________________________rules-users mailing listrules-users@lists.jboss.orghttps://lists.jboss.org/mailman/listinfo/rules-users_______________________________________________rules-users mailing listrules-users@lists.jboss.orghttps://lists.jboss.org/mailman/listinfo/rules-users_______________________________________________rules-users mailing listrules-users@lists.jboss.orghttps://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users