Re: [rules-users] Drools Solver - Multiple Entries ScoreDrl

2010-04-29 Thread Antonio Neto
I think that there was a error in a package. It works now.

Thank you and congratulations by the framework

2010/4/28 Geoffrey De Smet ge0ffrey.s...@gmail.com

 That should work.
 Check your getFacts() method.
 If you can reproduce on trunk (and prove it by putting an error in the
 DRL which isn't loaded), feel free to open an issue.

 With kind regards,
 Geoffrey De Smet


 Antonio Neto schreef:
  Hi all,
 
  In the Drools Solver documentation there is a point that say we can add
  multiples entries ScoreDrl. But when I try do that, Drools Solver uses
  just one entry to calculate the score, and I need put 2 files in the
 input.
 
  Anybody could help me, please?
 
  Thank you
 
 
  
 
  ___
  rules-users mailing list
  rules-users@lists.jboss.org
  https://lists.jboss.org/mailman/listinfo/rules-users

 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Drools Solver - Multiple Entries ScoreDrl

2010-04-29 Thread shekharputtur puttur
Hi All,
I am  using drools API, and developed a webservice out of it.
I created rule binary package using BRMS Guvnor.
I used RuleAgent to acces the properties file.
ie RuleAgent agent = RuleAgent.newRuleAgent(/application.properties);
application.properties  file was stored in current working directory.
I executed my application using eclipse, it was fine .

For testing  purpose  i  deployed  the application in tomcat application
server.
Now  it is unable to find application.properties file. and shows following
in catalina.out file:
java.lang.NullPointerException
at java.util.Properties$LineReader.readLine(Properties.java:418)
at java.util.Properties.load0(Properties.java:337)
at java.util.Properties.load(Properties.java:325)
at org.drools.agent.RuleAgent.loadFromProperties(RuleAgent.java:299)
at org.drools.agent.RuleAgent.newRuleAgent(RuleAgent.java:256)
My question is, in which location should i keep the application.properties
file , so that RuleAgent can access it.

Could you please tell me the solution.

Thanks  Regards
Shekhar
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Drools Solver - Multiple Entries ScoreDrl

2010-04-29 Thread Premkumar Stephen
Hello Shekhar,

1) You need to read http://www.jboss.org/drools/lists.html (the list of
todos) if you expect folks to help you. You have replied to a totally
different thread!!

2) You don't need to create a webservice out of the Drools API. There is
already one, called drools-server. Read documentation and examples for it.

Regards,
Prem


2010/4/29 shekharputtur puttur shekharput...@gmail.com


 Hi All,
 I am  using drools API, and developed a webservice out of it.
 I created rule binary package using BRMS Guvnor.
 I used RuleAgent to acces the properties file.
 ie RuleAgent agent = RuleAgent.newRuleAgent(/application.properties);
 application.properties  file was stored in current working directory.
 I executed my application using eclipse, it was fine .

 For testing  purpose  i  deployed  the application in tomcat application
 server.
 Now  it is unable to find application.properties file. and shows
 following in catalina.out file:
 java.lang.NullPointerException
 at java.util.Properties$LineReader.readLine(Properties.java:418)
 at java.util.Properties.load0(Properties.java:337)
 at java.util.Properties.load(Properties.java:325)
 at
 org.drools.agent.RuleAgent.loadFromProperties(RuleAgent.java:299)
 at org.drools.agent.RuleAgent.newRuleAgent(RuleAgent.java:256)
 My question is, in which location should i keep the
 application.properties file , so that RuleAgent can access it.

 Could you please tell me the solution.

 Thanks  Regards
 Shekhar








 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Drools Solver - Multiple Entries ScoreDrl

2010-04-28 Thread Antonio Neto
Hi all,

In the Drools Solver documentation there is a point that say we can add
multiples entries ScoreDrl. But when I try do that, Drools Solver uses
just one entry to calculate the score, and I need put 2 files in the input.

Anybody could help me, please?

Thank you
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Drools Solver - Multiple Entries ScoreDrl

2010-04-28 Thread Geoffrey De Smet
That should work.
Check your getFacts() method.
If you can reproduce on trunk (and prove it by putting an error in the 
DRL which isn't loaded), feel free to open an issue.

With kind regards,
Geoffrey De Smet


Antonio Neto schreef:
 Hi all,
 
 In the Drools Solver documentation there is a point that say we can add 
 multiples entries ScoreDrl. But when I try do that, Drools Solver uses 
 just one entry to calculate the score, and I need put 2 files in the input.
 
 Anybody could help me, please?
 
 Thank you
 
 
 
 
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] drools-solver recover the score of last step

2010-01-22 Thread dmzpippo-drools
Hi all,

is possible in a DRL file, useded for droos-solver, recover the score of last 
step?
I need it because with the rule I calculate a function score f(n); to 
diverrsificate the research if f(n) is bigger then f(n) of last step then add a 
penality...

regards




  ___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] drools-solver NPE in DefaultSimpleScore

2009-11-27 Thread Andrew Waterman
Hi Geoffrey,

I'll check that out today for you and let you know what I find out  
with my case.  I'm using the following solver dependency:

 dependency
 groupIdorg.drools.solver/groupId
 artifactIddrools-solver-core/artifactId
 version5.1.0.M1/version
 /dependency

best wishes,

Andrew

On Nov 26, 2009, at 12:16 PM, Geoffrey De Smet wrote:

 Hi Andrew,

 I can't reproduce your problem.

 The BestSolution is not null although the best score is.

 The LocalSearchSolverScope cannot have a best solution and not a  
 best score.
 Could you debug to see where LocalSearchSolverScope.setBestSolution 
 () is
 called and why LocalSearchSolverScope.setBestScore() isn't called or  
 is
 called with a null argument?

 With kind regards,
 Geoffrey De Smet


 Andrew Waterman schreef:
 Hi,

 I migrated some solver code that I had working on 5.0M4 to the 5.1.0
 implementation.  I'm now seeing the following while running the  
 solver:

 java.lang.NullPointerException
  at org.drools.solver.core.score.DefaultSimpleScore.compareTo
 (DefaultSimpleScore.java:73)
  at org.drools.solver.core.score.DefaultSimpleScore.compareTo
 (DefaultSimpleScore.java:13)
  at
 org.drools.solver.core.localsearch.bestsolution.BestSolutionRecaller.stepTaken
 (BestSolutionRecaller.java:56)
  at
 org.drools.solver.core.localsearch.DefaultLocalSearchSolver.stepTaken
 (DefaultLocalSearchSolver.java:171)
  at
 org.drools.solver.core.localsearch.DefaultLocalSearchSolver.solveImplementation
 (DefaultLocalSearchSolver.java:121)
  at org.drools.solver.core.AbstractSolver.solve(AbstractSolver.java: 
 41)

 I ran my test with a debugger attached, and this call is returning a
 Null:

 Score bestScore = localSearchSolverScope.getBestScore();
  
 org.drools.solver.core.localsearch.bestsolution.BestSolutionRecaller:
 55

 The BestSolution is not null although the best score is.

 Should I file an issue on this in JIRA?  Or perhaps this reflects  
 some
 change to the old code that I didn't migrate properly?

 best wishes,

 Andrew



 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users


 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] drools-solver NPE in DefaultSimpleScore

2009-11-27 Thread Andrew Waterman
Hi Geoffrey,

My bad; when I migrated to the new Score implementation I failed to  
update my code to properly clone scores in my cloneSolution()  
implementation.  Thanks for letting me know where to look!

best wishes,

Andrew

On Nov 26, 2009, at 12:16 PM, Geoffrey De Smet wrote:

 Hi Andrew,

 I can't reproduce your problem.

 The BestSolution is not null although the best score is.

 The LocalSearchSolverScope cannot have a best solution and not a  
 best score.
 Could you debug to see where LocalSearchSolverScope.setBestSolution 
 () is
 called and why LocalSearchSolverScope.setBestScore() isn't called or  
 is
 called with a null argument?

 With kind regards,
 Geoffrey De Smet


 Andrew Waterman schreef:
 Hi,

 I migrated some solver code that I had working on 5.0M4 to the 5.1.0
 implementation.  I'm now seeing the following while running the  
 solver:

 java.lang.NullPointerException
  at org.drools.solver.core.score.DefaultSimpleScore.compareTo
 (DefaultSimpleScore.java:73)
  at org.drools.solver.core.score.DefaultSimpleScore.compareTo
 (DefaultSimpleScore.java:13)
  at
 org.drools.solver.core.localsearch.bestsolution.BestSolutionRecaller.stepTaken
 (BestSolutionRecaller.java:56)
  at
 org.drools.solver.core.localsearch.DefaultLocalSearchSolver.stepTaken
 (DefaultLocalSearchSolver.java:171)
  at
 org.drools.solver.core.localsearch.DefaultLocalSearchSolver.solveImplementation
 (DefaultLocalSearchSolver.java:121)
  at org.drools.solver.core.AbstractSolver.solve(AbstractSolver.java: 
 41)

 I ran my test with a debugger attached, and this call is returning a
 Null:

 Score bestScore = localSearchSolverScope.getBestScore();
  
 org.drools.solver.core.localsearch.bestsolution.BestSolutionRecaller:
 55

 The BestSolution is not null although the best score is.

 Should I file an issue on this in JIRA?  Or perhaps this reflects  
 some
 change to the old code that I didn't migrate properly?

 best wishes,

 Andrew



 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users


 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] drools-solver NPE in DefaultSimpleScore

2009-11-26 Thread Andrew Waterman
Hi,

I migrated some solver code that I had working on 5.0M4 to the 5.1.0  
implementation.  I'm now seeing the following while running the solver:

java.lang.NullPointerException
at org.drools.solver.core.score.DefaultSimpleScore.compareTo 
(DefaultSimpleScore.java:73)
at org.drools.solver.core.score.DefaultSimpleScore.compareTo 
(DefaultSimpleScore.java:13)
at  
org.drools.solver.core.localsearch.bestsolution.BestSolutionRecaller.stepTaken 
(BestSolutionRecaller.java:56)
at  
org.drools.solver.core.localsearch.DefaultLocalSearchSolver.stepTaken 
(DefaultLocalSearchSolver.java:171)
at  
org.drools.solver.core.localsearch.DefaultLocalSearchSolver.solveImplementation 
(DefaultLocalSearchSolver.java:121)
at org.drools.solver.core.AbstractSolver.solve(AbstractSolver.java:41)

I ran my test with a debugger attached, and this call is returning a  
Null:

Score bestScore = localSearchSolverScope.getBestScore();
org.drools.solver.core.localsearch.bestsolution.BestSolutionRecaller:  
55

The BestSolution is not null although the best score is.

Should I file an issue on this in JIRA?  Or perhaps this reflects some  
change to the old code that I didn't migrate properly?

best wishes,

Andrew



___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] drools-solver NPE in DefaultSimpleScore

2009-11-26 Thread Geoffrey De Smet
Hi Andrew,

I can't reproduce your problem.

  The BestSolution is not null although the best score is.

The LocalSearchSolverScope cannot have a best solution and not a best score.
Could you debug to see where LocalSearchSolverScope.setBestSolution() is 
called and why LocalSearchSolverScope.setBestScore() isn't called or is 
called with a null argument?

With kind regards,
Geoffrey De Smet


Andrew Waterman schreef:
 Hi,
 
 I migrated some solver code that I had working on 5.0M4 to the 5.1.0  
 implementation.  I'm now seeing the following while running the solver:
 
 java.lang.NullPointerException
   at org.drools.solver.core.score.DefaultSimpleScore.compareTo 
 (DefaultSimpleScore.java:73)
   at org.drools.solver.core.score.DefaultSimpleScore.compareTo 
 (DefaultSimpleScore.java:13)
   at  
 org.drools.solver.core.localsearch.bestsolution.BestSolutionRecaller.stepTaken
  
 (BestSolutionRecaller.java:56)
   at  
 org.drools.solver.core.localsearch.DefaultLocalSearchSolver.stepTaken 
 (DefaultLocalSearchSolver.java:171)
   at  
 org.drools.solver.core.localsearch.DefaultLocalSearchSolver.solveImplementation
  
 (DefaultLocalSearchSolver.java:121)
   at org.drools.solver.core.AbstractSolver.solve(AbstractSolver.java:41)
 
 I ran my test with a debugger attached, and this call is returning a  
 Null:
 
 Score bestScore = localSearchSolverScope.getBestScore();
 org.drools.solver.core.localsearch.bestsolution.BestSolutionRecaller:  
 55
 
 The BestSolution is not null although the best score is.
 
 Should I file an issue on this in JIRA?  Or perhaps this reflects some  
 change to the old code that I didn't migrate properly?
 
 best wishes,
 
 Andrew
 
 
 
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users
 

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] drools-solver NPE in DefaultSimpleScore

2009-11-26 Thread Geoffrey De Smet
By the way, if you turn on info logging,
it logs each time a new best solution is found.
If you see a null in there, that's the problem.

However, that logging guarantee doesn't apply if you hooked in a custom 
BestSolutionRecaller etc

With kind regards,
Geoffrey De Smet


Geoffrey De Smet schreef:
 Hi Andrew,
 
 I can't reproduce your problem.
 
   The BestSolution is not null although the best score is.
 
 The LocalSearchSolverScope cannot have a best solution and not a best score.
 Could you debug to see where LocalSearchSolverScope.setBestSolution() is 
 called and why LocalSearchSolverScope.setBestScore() isn't called or is 
 called with a null argument?
 
 With kind regards,
 Geoffrey De Smet
 
 
 Andrew Waterman schreef:
 Hi,

 I migrated some solver code that I had working on 5.0M4 to the 5.1.0  
 implementation.  I'm now seeing the following while running the solver:

 java.lang.NullPointerException
  at org.drools.solver.core.score.DefaultSimpleScore.compareTo 
 (DefaultSimpleScore.java:73)
  at org.drools.solver.core.score.DefaultSimpleScore.compareTo 
 (DefaultSimpleScore.java:13)
  at  
 org.drools.solver.core.localsearch.bestsolution.BestSolutionRecaller.stepTaken
  
 (BestSolutionRecaller.java:56)
  at  
 org.drools.solver.core.localsearch.DefaultLocalSearchSolver.stepTaken 
 (DefaultLocalSearchSolver.java:171)
  at  
 org.drools.solver.core.localsearch.DefaultLocalSearchSolver.solveImplementation
  
 (DefaultLocalSearchSolver.java:121)
  at org.drools.solver.core.AbstractSolver.solve(AbstractSolver.java:41)

 I ran my test with a debugger attached, and this call is returning a  
 Null:

 Score bestScore = localSearchSolverScope.getBestScore();
 org.drools.solver.core.localsearch.bestsolution.BestSolutionRecaller:  
 55

 The BestSolution is not null although the best score is.

 Should I file an issue on this in JIRA?  Or perhaps this reflects some  
 change to the old code that I didn't migrate properly?

 best wishes,

 Andrew



 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users

 
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users
 

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Drools solver info = provide DSL instead of DRL to Drools Solver

2009-11-22 Thread Geoffrey De Smet
dmzpippo-dro...@yahoo.it schreef:
 Hi Geoffrey,
 I have modified the LocalSearchSolverConfig class to accept the 
 scoreDsl tag.

Thanks for the patch!
If you want credit, state your full name, and I 'll add an @author tag 
in the javadoc.

 To use this tag need gonfigure the XML solverConfig file adding the path 
 of Drl file and Dsl file associated in two line consecutive in the 
 configuration file. This code is not the best but is a start

It seems a bit wierd to me add both the drl and the dsl in the 
scoreDsl, so like this:

scoreDsl/org/.../file1.drl/scoreDsl
scoreDsl/org/.../file2.dsl/scoreDsl

I am going experiment with this instead, and use it in one the examples, 
before I commit the changes.

scoreDrl/org/.../file1.drl/scoreDrl
scoreDsl/org/.../file2.dsl/scoreDsl

Just watch this issue to get notified when it's committed on trunk:
   https://jira.jboss.org/jira/browse/JBRULES-2333

 
 I send you the code if it can be useful.
 I would also ask when it launches the new version of the solver, and if 
 this will also include other local search algorithms than Tabu Search

Simulated annealing and great deluge are available, but they aren't 
production-ready.
Take a look at SimulatedAnnealingAccepter and GreatDelugeAccepter.
I've also written a testcase for both.
Patches welcome :)
I am focusing on conflict based statistics and 
multi-threading/clustering first.

PS: If a patch is more then one file, do use create patch in your 
Eclipse/IntelliJ or svn diff  jiraNumber.patch.
Also, attach it to the jira issue pls.

 
 with kind regards,
 Marco


With kind regards,
Geoffrey De Smet

 
 LocalSearchSolverConfig class Code
 
 
 /**
  * @author Geoffrey De Smet
  */
 @XStreamAlias(localSearchSolver)
 public class LocalSearchSolverConfig {
 
 private Long randomSeed = null;
 
 @XStreamImplicit(itemFieldName = scoreDrl)
 private ListString scoreDrlList = null;
 @XStreamImplicit(itemFieldName = scoreDsl)//FIXME adding DslList
 private ListString scoreDslList = null;
 @XStreamAlias(scoreDefinition)
 private ScoreDefinitionConfig scoreDefinitionConfig = new 
 ScoreDefinitionConfig();
 
 private StartingSolutionInitializer startingSolutionInitializer = null;
 private ClassStartingSolutionInitializer 
 startingSolutionInitializerClass = null;
 
 @XStreamAlias(termination)
 private TerminationConfig terminationConfig = new 
 TerminationConfig(); // TODO this new is pointless due to xstream
 
 @XStreamAlias(deciderScoreComparatorFactory)
 private DeciderScoreComparatorFactoryConfig 
 deciderScoreComparatorFactoryConfig
 = new DeciderScoreComparatorFactoryConfig();
 @XStreamAlias(selector)
 private SelectorConfig selectorConfig = new SelectorConfig();
 @XStreamAlias(accepter)
 private AccepterConfig accepterConfig = new AccepterConfig();
 @XStreamAlias(forager)
 private ForagerConfig foragerConfig = new ForagerConfig();
 
 public Long getRandomSeed() {
 return randomSeed;
 }
 
 public void setRandomSeed(Long randomSeed) {
 this.randomSeed = randomSeed;
 }
 
 public ListString getScoreDrlList() {
 return scoreDrlList;
 }
 
 public void setScoreDrlList(ListString scoreDrlList) {
 this.scoreDrlList = scoreDrlList;
 }
 
 public ListString getScoreDslList() {
 return scoreDslList;
 }
 
 public void setScoreDslList(ListString scoreDslList) {
 this.scoreDslList = scoreDslList;
 }
 
 public ScoreDefinitionConfig getScoreDefinitionConfig() {
 return scoreDefinitionConfig;
 }
 
 public void setScoreDefinitionConfig(ScoreDefinitionConfig 
 scoreDefinitionConfig) {
 this.scoreDefinitionConfig = scoreDefinitionConfig;
 }
 
 public StartingSolutionInitializer getStartingSolutionInitializer() {
 return startingSolutionInitializer;
 }
 
 public void 
 setStartingSolutionInitializer(StartingSolutionInitializer 
 startingSolutionInitializer) {
 this.startingSolutionInitializer = startingSolutionInitializer;
 }
 
 public ClassStartingSolutionInitializer 
 getStartingSolutionInitializerClass() {
 return startingSolutionInitializerClass;
 }
 
 public void 
 setStartingSolutionInitializerClass(ClassStartingSolutionInitializer 
 startingSolutionInitializerClass) {
 this.startingSolutionInitializerClass = 
 startingSolutionInitializerClass;
 }
 
 public TerminationConfig getTerminationConfig() {
 return terminationConfig;
 }
 
 public void setTerminationConfig(TerminationConfig terminationConfig) {
 this.terminationConfig = terminationConfig;
 }
 
 public DeciderScoreComparatorFactoryConfig 
 getDeciderScoreComparatorFactoryConfig() {
 return deciderScoreComparatorFactoryConfig;
 }
 
 public void setDeciderScoreComparatorFactoryConfig(
 DeciderScoreComparatorFactoryConfig 
 

Re: [rules-users] Drools solver info = provide DSL instead of DRL to Drools Solver

2009-11-17 Thread dmzpippo-drools
Hi Geoffrey,
I have modified the LocalSearchSolverConfig class to accept the scoreDsl tag. 
To use this tag need gonfigure the XML solverConfig file adding the path of Drl 
file and Dsl file associated in two line consecutive in the configuration file. 
This code is not the best but is a start

I send you the code if it can be useful. 
I
would also ask when it launches the new version of the solver, and if
this will also include other local search algorithms than Tabu Search

with kind regards,
Marco

LocalSearchSolverConfig class Code


/**
 * @author Geoffrey De Smet
 */
@XStreamAlias(localSearchSolver)
public class LocalSearchSolverConfig {

    private Long randomSeed = null;

    @XStreamImplicit(itemFieldName = scoreDrl)
    private ListString scoreDrlList = null;
    @XStreamImplicit(itemFieldName = scoreDsl)//FIXME adding DslList
    private ListString scoreDslList = null;
    @XStreamAlias(scoreDefinition)
    private ScoreDefinitionConfig scoreDefinitionConfig = new 
ScoreDefinitionConfig();

    private StartingSolutionInitializer
 startingSolutionInitializer = null;
    private ClassStartingSolutionInitializer startingSolutionInitializerClass 
= null;

    @XStreamAlias(termination)
    private TerminationConfig terminationConfig = new TerminationConfig(); // 
TODO this new is pointless due to xstream

    @XStreamAlias(deciderScoreComparatorFactory)
    private DeciderScoreComparatorFactoryConfig 
deciderScoreComparatorFactoryConfig
    = new DeciderScoreComparatorFactoryConfig();
    @XStreamAlias(selector)
    private SelectorConfig selectorConfig = new SelectorConfig();
    @XStreamAlias(accepter)
    private AccepterConfig accepterConfig = new AccepterConfig();
    @XStreamAlias(forager)
   
 private ForagerConfig foragerConfig = new ForagerConfig();

    public Long getRandomSeed() {
    return randomSeed;
    }

    public void setRandomSeed(Long randomSeed) {
    this.randomSeed = randomSeed;
    }

    public ListString getScoreDrlList() {
    return scoreDrlList;
    }

    public void setScoreDrlList(ListString scoreDrlList) {
    this.scoreDrlList = scoreDrlList;
    }

    public ListString getScoreDslList() {
        return scoreDslList;
    }

    public void setScoreDslList(ListString
 scoreDslList) {
        this.scoreDslList = scoreDslList;
    }

    public ScoreDefinitionConfig getScoreDefinitionConfig() {
    return scoreDefinitionConfig;
    }

    public void setScoreDefinitionConfig(ScoreDefinitionConfig 
scoreDefinitionConfig) {
    this.scoreDefinitionConfig = scoreDefinitionConfig;
    }

    public StartingSolutionInitializer getStartingSolutionInitializer() {
    return startingSolutionInitializer;
    }

    public void setStartingSolutionInitializer(StartingSolutionInitializer 
startingSolutionInitializer) {
    this.startingSolutionInitializer =
 startingSolutionInitializer;
    }

    public ClassStartingSolutionInitializer 
getStartingSolutionInitializerClass() {
    return startingSolutionInitializerClass;
    }

    public void 
setStartingSolutionInitializerClass(ClassStartingSolutionInitializer 
startingSolutionInitializerClass) {
    this.startingSolutionInitializerClass = 
startingSolutionInitializerClass;
    }

    public TerminationConfig getTerminationConfig() {
    return terminationConfig;
    }

    public void setTerminationConfig(TerminationConfig terminationConfig) {
    this.terminationConfig = terminationConfig;
   
 }

    public DeciderScoreComparatorFactoryConfig 
getDeciderScoreComparatorFactoryConfig() {
    return deciderScoreComparatorFactoryConfig;
    }

    public void setDeciderScoreComparatorFactoryConfig(
    DeciderScoreComparatorFactoryConfig 
deciderScoreComparatorFactoryConfig) {
    this.deciderScoreComparatorFactoryConfig = 
deciderScoreComparatorFactoryConfig;
    }

    public SelectorConfig getSelectorConfig() {
    return selectorConfig;
    }

    public void setSelectorConfig(SelectorConfig selectorConfig) {
    this.selectorConfig = selectorConfig;
   
 }

    public AccepterConfig getAccepterConfig() {
    return accepterConfig;
    }

    public void setAccepterConfig(AccepterConfig accepterConfig) {
    this.accepterConfig = accepterConfig;
    }

    public ForagerConfig getForagerConfig() {
    return foragerConfig;
    }

    public void setForagerConfig(ForagerConfig foragerConfig) {
    this.foragerConfig = foragerConfig;
    }

    // 
    // Builder methods
    //
 

    public LocalSearchSolver buildSolver() {
    DefaultLocalSearchSolver localSearchSolver = new 
DefaultLocalSearchSolver();
    if (randomSeed != null) {
    localSearchSolver.setRandomSeed(randomSeed);
    } else {
    localSearchSolver.setRandomSeed(0L);
    }
    

Re: [rules-users] Drools solver info = provide DSL instead of DRL to Drools Solver

2009-11-17 Thread dmzpippo-drools
Hi Geoffrey,
I have modified the LocalSearchSolverConfig class to accept the scoreDsl tag. 
To
use this tag need gonfigure the XML solverConfig file adding the path
of Drl file and Dsl file associated in two line consecutive in the
configuration file. This code is not the best but is a start

I send you the code if it can be useful.
 
I
would also ask when it launches the new version of the solver, and if
this will also include other local search algorithms than Tabu Search

with kind regards,
Marco

LocalSearchSolverConfig class Code


/**
 * @author Geoffrey De Smet
 */
@XStreamAlias(localSearchSolver)
public class LocalSearchSolverConfig {

    private Long randomSeed = null;

    @XStreamImplicit(itemFieldName = scoreDrl)
    private ListString scoreDrlList = null;
    @XStreamImplicit(itemFieldName = scoreDsl)//FIXME adding DslList
    private ListString scoreDslList = null;
    @XStreamAlias(scoreDefinition)
    private ScoreDefinitionConfig scoreDefinitionConfig = new 
ScoreDefinitionConfig();

    private StartingSolutionInitializer
 startingSolutionInitializer = null;
    private ClassStartingSolutionInitializer startingSolutionInitializerClass 
= null;

    @XStreamAlias(termination)
    private TerminationConfig terminationConfig = new TerminationConfig(); // 
TODO this new is pointless due to xstream

    @XStreamAlias(deciderScoreComparatorFactory)
    private DeciderScoreComparatorFactoryConfig 
deciderScoreComparatorFactoryConfig
    = new DeciderScoreComparatorFactoryConfig();
    @XStreamAlias(selector)
    private SelectorConfig selectorConfig = new SelectorConfig();
    @XStreamAlias(accepter)
    private AccepterConfig accepterConfig = new AccepterConfig();
    @XStreamAlias(forager)
   
 private ForagerConfig foragerConfig = new ForagerConfig();

    public Long getRandomSeed() {
    return randomSeed;
    }

    public void setRandomSeed(Long randomSeed) {
    this.randomSeed = randomSeed;
    }

    public ListString getScoreDrlList() {
    return scoreDrlList;
    }

    public void setScoreDrlList(ListString scoreDrlList) {
    this.scoreDrlList = scoreDrlList;
    }

    public ListString getScoreDslList() {
        return scoreDslList;
    }

    public void setScoreDslList(ListString
 scoreDslList) {
        this.scoreDslList = scoreDslList;
    }

    public ScoreDefinitionConfig getScoreDefinitionConfig() {
    return scoreDefinitionConfig;
    }

    public void setScoreDefinitionConfig(ScoreDefinitionConfig 
scoreDefinitionConfig) {
    this.scoreDefinitionConfig = scoreDefinitionConfig;
    }

    public StartingSolutionInitializer getStartingSolutionInitializer() {
    return startingSolutionInitializer;
    }

    public void setStartingSolutionInitializer(StartingSolutionInitializer 
startingSolutionInitializer) {
    this.startingSolutionInitializer =
 startingSolutionInitializer;
    }

    public ClassStartingSolutionInitializer 
getStartingSolutionInitializerClass() {
    return startingSolutionInitializerClass;
    }

    public void 
setStartingSolutionInitializerClass(ClassStartingSolutionInitializer 
startingSolutionInitializerClass) {
    this.startingSolutionInitializerClass = 
startingSolutionInitializerClass;
    }

    public TerminationConfig getTerminationConfig() {
    return terminationConfig;
    }

    public void setTerminationConfig(TerminationConfig terminationConfig) {
    this.terminationConfig = terminationConfig;
   
 }

    public DeciderScoreComparatorFactoryConfig 
getDeciderScoreComparatorFactoryConfig() {
    return deciderScoreComparatorFactoryConfig;
    }

    public void setDeciderScoreComparatorFactoryConfig(
    DeciderScoreComparatorFactoryConfig 
deciderScoreComparatorFactoryConfig) {
    this.deciderScoreComparatorFactoryConfig = 
deciderScoreComparatorFactoryConfig;
    }

    public SelectorConfig getSelectorConfig() {
    return selectorConfig;
    }

    public void setSelectorConfig(SelectorConfig selectorConfig) {
    this.selectorConfig = selectorConfig;
   
 }

    public AccepterConfig getAccepterConfig() {
    return accepterConfig;
    }

    public void setAccepterConfig(AccepterConfig accepterConfig) {
    this.accepterConfig = accepterConfig;
    }

    public ForagerConfig getForagerConfig() {
    return foragerConfig;
    }

    public void setForagerConfig(ForagerConfig foragerConfig) {
    this.foragerConfig = foragerConfig;
    }

    // 
    // Builder methods
    //
 

    public LocalSearchSolver buildSolver() {
    DefaultLocalSearchSolver localSearchSolver = new 
DefaultLocalSearchSolver();
    if (randomSeed != null) {
    localSearchSolver.setRandomSeed(randomSeed);
    } else {
    localSearchSolver.setRandomSeed(0L);
    }
    

Re: [rules-users] Drools solver info = provide DSL instead of DRL to Drools Solver

2009-11-12 Thread Geoffrey De Smet
Hi Marco,

[I've send this answer to the drools user list,
please post any follow ups on the user list instead of mailing it 
directly to me.
You can use nntp://news.gmane.org #gmane.comp.java.drools.user if you 
want to keep your mailbox clean.]

Drools Solver's xml configuration doesn't support scoreDsl entry's yet
That shouldn't be to much work. I just created a JIRA for it:
  https://jira.jboss.org/jira/browse/JBRULES-2333
Patch welcome (attached to that jira) and I would apply it within a week 
on trunk.

Short of doing the patch on trunk, you can do this workaround:
- build the Solver directly yourself (basically just fisheye.jboss.org 
for XmlSolverConfigurer's code). Not recommended.
- supply a an empty drl to scoreDrl, build the Solver, cast it to 
DefaultLocalSearchSolver and replace the rulebase.
Both are not ideal in the long run though.

With kind regards,
Geoffrey De Smet



Marco caminiti schreef:
 Hi Geoffrey,
 I'm Marco Caminiti an Italian student of computer engineering. I'm 
 using drools solver for my thesis and I have a problem.

 For the thesis I made a model of bin packing writing the rules on a 
 drl file, and thus far, so good.

 Now I want to rewrite the rules that must use the solver in a specific 
 language, but if I put in the configuration file of the solver the URL 
 of the file DSL (or file DSLR) the solver crashes because it can not 
 be configured.

 I ask whether you can use the solver with DSL tool and if so how could 
 I do.

 Sorry to bother you but on this argument I have not found 
 documentation on the Internet, more than anything else I'm sorry for 
 my English.

 Thanks from now for the answer.
 Marco Caminiti



___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] [drools-solver] help for defining my drools model / moves

2009-06-29 Thread Laurent Michenaud
Hi,

Here is my test :
I have an appointment to schedule on a customer availability.
I have a list of customer availabilities.
A customer availability is a period.
An appointment needs an exact number of persons.
A resource is composed of persons ( between 1 and n ) and has availabilities 
too.

The problem is to schedule the appointment : it has to choose the
right resource availabilities that matches one of the customer availabilities 
and 
the total number of persons inside chosen resources must match exactly the 
needed number of persons of the appointment.

My moves are for the moment :
- Change the customer availability.
- Add a resource to the list of chosen resources.

My init is :
- One of the customer availability is taken
- 0 resource taken.

First, i don't know if my model and my init are ok.
Secondly, the solver does the following :

- At the beginning, the score is bad because there is no resource.
So, it begins adding resource and the score is getting better
but when it changes the availability, the score gets very bad either because
the chosen resources don't match the new availability or it has no resource
inside. The solver doesnot seem to interest in the new chosen availibity with no
resource, but i wish it does.

Thanks for your remarks/help

Best regards






___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] drools solver for 2d knapsack problem

2009-05-08 Thread Olaf Raether
Hey , i would like to use drools solver for a 2d knapsack problem.
Has anyone expirience with that ?
Is drools solver made for such a task ?

Thank for hints

Olaf Raether

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] drools solver for 2d knapsack problem

2009-05-08 Thread Wolfgang Laun
Rectangles or simple polygons or worse?
-W

On Fri, May 8, 2009 at 9:02 AM, Olaf Raether o.raet...@epro.de wrote:

 Hey , i would like to use drools solver for a 2d knapsack problem.
 Has anyone expirience with that ?
 Is drools solver made for such a task ?

 Thank for hints

 Olaf Raether

 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] drools solver for 2d knapsack problem

2009-05-08 Thread Olaf Raether

Rectangles within a Rectangle

OR


Wolfgang Laun-2 wrote:
 
 Rectangles or simple polygons or worse?
 -W
 
 On Fri, May 8, 2009 at 9:02 AM, Olaf Raether o.raet...@epro.de wrote:
 
 Hey , i would like to use drools solver for a 2d knapsack problem.
 Has anyone expirience with that ?
 Is drools solver made for such a task ?

 Thank for hints

 Olaf Raether

 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users

 
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users
 
 

-- 
View this message in context: 
http://www.nabble.com/drools-solver-for-2d-knapsack-problem-tp23441149p23441743.html
Sent from the drools - user mailing list archive at Nabble.com.

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] drools solver for 2d knapsack problem

2009-05-08 Thread Wolfgang Laun
I've researched this, a long time ago (trying to find a solution for a
problem from the worse class). Even then, several results could be found
in the literature for the cutting sheet problem for rectangles, showing
that certain parameters (w.r.t. to rectangle dimensions being multiples of
each other, replication factors, etc.) influence the problem space
considerably. (Cutting random rectangles from a sheet is hardly an industry
problem.)

Having said that, drools-solver should be able to handle this problem.

However, it is very likely that there is an algorithm that solves your
particular problem more efficiently.

-W


On Fri, May 8, 2009 at 9:59 AM, Olaf Raether o.raet...@epro.de wrote:


 Rectangles within a Rectangle

 OR


 Wolfgang Laun-2 wrote:
 
  Rectangles or simple polygons or worse?
  -W
 
  On Fri, May 8, 2009 at 9:02 AM, Olaf Raether o.raet...@epro.de wrote:
 
  Hey , i would like to use drools solver for a 2d knapsack problem.
  Has anyone expirience with that ?
  Is drools solver made for such a task ?
 
  Thank for hints
 
  Olaf Raether
 
  ___
  rules-users mailing list
  rules-users@lists.jboss.org
  https://lists.jboss.org/mailman/listinfo/rules-users
 
 
  ___
  rules-users mailing list
  rules-users@lists.jboss.org
  https://lists.jboss.org/mailman/listinfo/rules-users
 
 

 --
 View this message in context:
 http://www.nabble.com/drools-solver-for-2d-knapsack-problem-tp23441149p23441743.html
 Sent from the drools - user mailing list archive at Nabble.com.

 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] drools solver for 2d knapsack problem

2009-05-08 Thread Olaf Raether

I think it´s more a knapsack problem. And the rectangles have to follow some
business rules,
so that´s the reason try to using solver. Here´s an image of the problem.

http://www.nabble.com/file/p23443994/2dknapsack.jpg 2dknapsack.jpg 

The big rectangle is the load area of a truck und the small ones are racks.
And i have to 
put them on the truck. And the Business rules come into the play, cause the
racks can only 
mounted in a special manner on the track.

Any hint is welcome



Wolfgang Laun-2 wrote:
 
 I've researched this, a long time ago (trying to find a solution for a
 problem from the worse class). Even then, several results could be found
 in the literature for the cutting sheet problem for rectangles, showing
 that certain parameters (w.r.t. to rectangle dimensions being multiples of
 each other, replication factors, etc.) influence the problem space
 considerably. (Cutting random rectangles from a sheet is hardly an
 industry
 problem.)
 
 Having said that, drools-solver should be able to handle this problem.
 
 However, it is very likely that there is an algorithm that solves your
 particular problem more efficiently.
 
 -W
 
 
 On Fri, May 8, 2009 at 9:59 AM, Olaf Raether o.raet...@epro.de wrote:
 

 Rectangles within a Rectangle

 OR


 Wolfgang Laun-2 wrote:
 
  Rectangles or simple polygons or worse?
  -W
 
  On Fri, May 8, 2009 at 9:02 AM, Olaf Raether o.raet...@epro.de wrote:
 
  Hey , i would like to use drools solver for a 2d knapsack problem.
  Has anyone expirience with that ?
  Is drools solver made for such a task ?
 
  Thank for hints
 
  Olaf Raether
 
  ___
  rules-users mailing list
  rules-users@lists.jboss.org
  https://lists.jboss.org/mailman/listinfo/rules-users
 
 
  ___
  rules-users mailing list
  rules-users@lists.jboss.org
  https://lists.jboss.org/mailman/listinfo/rules-users
 
 

 --
 View this message in context:
 http://www.nabble.com/drools-solver-for-2d-knapsack-problem-tp23441149p23441743.html
 Sent from the drools - user mailing list archive at Nabble.com.

 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users

 
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users
 
 

-- 
View this message in context: 
http://www.nabble.com/drools-solver-for-2d-knapsack-problem-tp23441149p23443994.html
Sent from the drools - user mailing list archive at Nabble.com.


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] drools solver for 2d knapsack problem

2009-05-08 Thread Wolfgang Laun
That's indeed more like a problem for using rules (and far from the plain
cutting sheet I had in mind), From the examples, itc2007 and
lessonsschedule might give you an idea how to approach your problem.
-W


On Fri, May 8, 2009 at 1:05 PM, Olaf Raether o.raet...@epro.de wrote:


 I think it´s more a knapsack problem. And the rectangles have to follow
 some
 business rules,
 so that´s the reason try to using solver. Here´s an image of the problem.

 http://www.nabble.com/file/p23443994/2dknapsack.jpg 2dknapsack.jpg

 The big rectangle is the load area of a truck und the small ones are racks.
 And i have to
 put them on the truck. And the Business rules come into the play, cause the
 racks can only
 mounted in a special manner on the track.

 Any hint is welcome



 Wolfgang Laun-2 wrote:
 
  I've researched this, a long time ago (trying to find a solution for a
  problem from the worse class). Even then, several results could be
 found
  in the literature for the cutting sheet problem for rectangles, showing
  that certain parameters (w.r.t. to rectangle dimensions being multiples
 of
  each other, replication factors, etc.) influence the problem space
  considerably. (Cutting random rectangles from a sheet is hardly an
  industry
  problem.)
 
  Having said that, drools-solver should be able to handle this problem.
 
  However, it is very likely that there is an algorithm that solves your
  particular problem more efficiently.
 
  -W
 
 
  On Fri, May 8, 2009 at 9:59 AM, Olaf Raether o.raet...@epro.de wrote:
 
 
  Rectangles within a Rectangle
 
  OR
 
 
  Wolfgang Laun-2 wrote:
  
   Rectangles or simple polygons or worse?
   -W
  
   On Fri, May 8, 2009 at 9:02 AM, Olaf Raether o.raet...@epro.de
 wrote:
  
   Hey , i would like to use drools solver for a 2d knapsack problem.
   Has anyone expirience with that ?
   Is drools solver made for such a task ?
  
   Thank for hints
  
   Olaf Raether
  
   ___
   rules-users mailing list
   rules-users@lists.jboss.org
   https://lists.jboss.org/mailman/listinfo/rules-users
  
  
   ___
   rules-users mailing list
   rules-users@lists.jboss.org
   https://lists.jboss.org/mailman/listinfo/rules-users
  
  
 
  --
  View this message in context:
 
 http://www.nabble.com/drools-solver-for-2d-knapsack-problem-tp23441149p23441743.html
  Sent from the drools - user mailing list archive at Nabble.com.
 
  ___
  rules-users mailing list
  rules-users@lists.jboss.org
  https://lists.jboss.org/mailman/listinfo/rules-users
 
 
  ___
  rules-users mailing list
  rules-users@lists.jboss.org
  https://lists.jboss.org/mailman/listinfo/rules-users
 
 

 --
 View this message in context:
 http://www.nabble.com/drools-solver-for-2d-knapsack-problem-tp23441149p23443994.html
 Sent from the drools - user mailing list archive at Nabble.com.


 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Drools-solver: upgrading recipe for backwards incompatible changes in 5.0.1

2009-04-27 Thread Geoffrey De Smet

Hi all,

Just a heads up: drools-solver (not drools itself) will have a couple of 
backwards incompatible changes in 5.0.1, but they are easy to fix with 
the upgrading recipe:


http://fisheye.jboss.org/browse/JBossRules/trunk/drools-solver/src/main/assembly/docs/UpgradeFromPreviousVersionRecipe.txt?r=trunk

--
With kind regards,
Geoffrey De Smet

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] drools-solver [StartingSolutionInitializer]

2009-02-17 Thread Andrew Waterman

Hi,

Thanks for the rules suggestions, using a simple generated id has  
radically improved my solver times (and my scoring).  I'm now looking  
into using the StartingSolutionInitializer code to feed  
startingSolutions into the solver.


I'm a little confused about the intended functionality in the  
interface, and wanted to get some feedback.  Basically, the simple  
solver that we had used previously to find our solution space, didn't  
take into account any of the topographical constraints of our game  
board.  The solutions it offered are not highly specific, in the sense  
that one doesn't know where all the tokens should be placed.  What it  
does offer are distributions of tokens on the game board.  For example:


4 tokens of managed forest per territory.
4 tokens of moderate pasture per territory.
4 tokens of intensive pasture per territory.

I'd like to use the startingSolutionInitializer to take a suggested  
distribution, populate our board with those values, and then pass it  
back to the solver to solve.


Is the initializer the right place to do this?  Or should I simply  
view the initializer as a deterministic entry point for ordering and  
composing an incomplete solution before passing it off to the solver?


best wishes,

Andrew

-
Andrew Waterman
San Cristóbal de las Casas, Chiapas, Mexico
+52 1 967 107 5902
+1 510 342 5693

On Feb 13, 2009, at 8:50 AM, Geoffrey De Smet wrote:



With kind regards,
Geoffrey De Smet


Andrew Waterman schreef:

Hi,
I've been looking through my solver logs and on a problem i have  
posed, the solver seems to first initialize and setup a best score:
INFO: Initialization time spend (3) for score (-504.0).  
Updating best solution and best score.
However, this score is not correct.  I use collect to load Tokens  
of a certain type for my game, and those that are found, penalize  
the system with a constraint:

rule Too much unclaimed territory
   when
   $list : ArrayList ( size  2) from collect  (
   Token ($type : type == TokenType.UNDEVELOPED))
   then
   for (int i = 0; i  $list.size(); i++) {
   insertLogical (new IntConstraintOccurrence (
   Too much unclaimed territory,  
ConstraintType.NEGATIVE_SOFT, 3, $list));


Doesn't this insert the same logical fact in a loop? So only 1  
instance actually remains in the working memory?

If you want to have to list.size() affect the score, just do:
 3 * list.size()


   }
end


Why use collect anyway?

when
$t1 : Token ($type : type == TokenType.UNDEVELOPED, id1 : id)
$t2 : Token ($type : type == TokenType.UNDEVELOPED, id   
id1, id2 : id)
$t3 : Token ($type : type == TokenType.UNDEVELOPED, id   
id2, id3 : id)


// maybe you need things like this: not Token ($type : type ==  
TokenType.UNDEVELOPED, id  id3)

then
 insertLogical (new IntConstraintOccurrence (Too much unclaimed  
territory,  ConstraintType.NEGATIVE_SOFT, 3, $t1, $t2, $t3));


However, the initial score does not seem to account  for these  
inserted facts.  Due to this, all improving solutions are rejected,  
and I see no change in the solution the solver finds and my  
starting solution.  Any suggestions on how to delay  
initialization?  Or get the starting score to take into account  
this constraint (I've made it SOFT so the values aren't so hard to  
follow in the logs, it was initially a HARD constraint).  I'd love  
to find a way around this problem, I've spent most of the day  
playing with different configurations (acceptors and foragers)  
trying to find a configuration that works for this base problem.

best wishes,
Andrew
-
Andrew Waterman
San Cristóbal de las Casas, Chiapas, Mexico
+52 1 967 107 5902
+1 510 342 5693

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] drools-solver (initialization and starting score)

2009-02-12 Thread Andrew Waterman

Hi,

I've been looking through my solver logs and on a problem i have  
posed, the solver seems to first initialize and setup a best score:


	INFO: Initialization time spend (3) for score (-504.0). Updating  
best solution and best score.


However, this score is not correct.  I use collect to load Tokens of a  
certain type for my game, and those that are found, penalize the  
system with a constraint:


rule Too much unclaimed territory
when
$list : ArrayList ( size  2) from collect  (
Token ($type : type == TokenType.UNDEVELOPED))
then
for (int i = 0; i  $list.size(); i++) {
insertLogical (new IntConstraintOccurrence (
Too much unclaimed territory,  
ConstraintType.NEGATIVE_SOFT, 3, $list));

}
end

However, the initial score does not seem to account  for these  
inserted facts.  Due to this, all improving solutions are rejected,  
and I see no change in the solution the solver finds and my starting  
solution.


Any suggestions on how to delay initialization?  Or get the starting  
score to take into account this constraint (I've made it SOFT so the  
values aren't so hard to follow in the logs, it was initially a HARD  
constraint).  I'd love to find a way around this problem, I've spent  
most of the day playing with different configurations (acceptors and  
foragers) trying to find a configuration that works for this base  
problem.


best wishes,

Andrew

-
Andrew Waterman
San Cristóbal de las Casas, Chiapas, Mexico
+52 1 967 107 5902
+1 510 342 5693








___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Drools-solver performance optimizations?

2009-02-11 Thread Wim Vancroonenburg
Hi,

I'm a student currently evaluating Drools Solver for my dissertation. I am
currently trying to solve an optimization problem with two different solvers
(one of which is Drools Solver) and I am comparing the results with earlier
obtained results from literature. However I am having some troubles with the
performance of Drools Solver, and I was hoping if someone could look at my
rules to see if they could be tuned:

rule patientsToBeAssignedToRoomsOfAppropriateSex
when
$n : Night();
$room : Room(sexRestriction == Sex.Dependent  capacity 
1);
$genders : ArrayList(size1) from collect(
PatientStay(bed.room == $room, night == $n) );
exists PatientStay(bed.room == $room, night == $n, $a :
admission,
eval(((PatientStay)$genders.get(0)).getAdmission().getPatient().getSex() !=
$a.getPatient().getSex()));
then
insertLogical(new
IntConstraintOccurrence(patientsToBeAssignedToRoomsOfAppropriateSex,ConstraintType.NEGATIVE_HARD,50,$room,$n));
end

rule hasRequiredRoomProperties
when
$pr : RequiredRoomPropertiesConstraint($a : admission, $r :
room, $w : weight );
$ps : PatientStay(admission == $a, bed.room == $r);
then
insertLogical(new
IntConstraintOccurrence(hasPreferredRoomProperties,ConstraintType.NEGATIVE_SOFT,50*$w,$ps));
end

rule unplannedTransfers
when
$ps : PatientStay($a : admission, $b : bed, $n : night);
$ps2 : PatientStay(admission == $a, bed != $b, $n2 :
night,eval($n.getIndex()+1 == $n2.getIndex()));
then
insertLogical(new
IntConstraintOccurrence(unplannedTransfers,ConstraintType.NEGATIVE_SOFT,110,$ps,$ps2));
end

rule hasPreferredRoomProperties
when
$pr : PreferredRoomPropertiesConstraint($a : admission, $r :
room, $w : weight );
$ps : PatientStay(admission == $a, bed.room == $r);
then
insertLogical(new
IntConstraintOccurrence(hasPreferredRoomProperties,ConstraintType.NEGATIVE_SOFT,20*$w,$ps));
end

rule meetsRoomPreference
when
$mr : MeetsRoomPreferenceConstraint($a : admission, $r :
room);
$ps : PatientStay(admission == $a, bed.room == $r);
then
insertLogical(new
IntConstraintOccurrence(meetsRoomPreference,ConstraintType.NEGATIVE_SOFT,8,$ps));
end

rule inGoodDepartment
when
$gd : GoodDepartmentConstraint($a : admission, $d :
department);
$ps : PatientStay(admission == $a, $b : bed,
eval($b.getRoom().getDepartment().equals($d)));
then
insertLogical(new
IntConstraintOccurrence(inGoodDepartment,ConstraintType.NEGATIVE_SOFT,10,$ps));
end

rule inGoodRoom
when
$gr : GoodRoomConstraint($a : admission, $r : room, $w :
weight);
$ps : PatientStay(admission == $a, bed.room == $r);
then
insertLogical(new
IntConstraintOccurrence(inGoodRoom,ConstraintType.NEGATIVE_SOFT,10*$w,$ps));

end

rule calcScore
salience -10
when
$count : Number() from accumulate(
IntConstraintOccurrence($w : weight) ,

 sum($w) );
then
scoreCalculator.setScore(-$count.doubleValue());
end

The classes with **Constraint in it are possible combinations that cause a
constraint to be violated, and are calculated and inserted at initialization
time (and are never changed). I know that the rule
patientsToBeAssignedToRoomsOfAppropriateSex is fairly complex, but even
when I remove it, the performance is not fantastic. Is there anything else I
can do to get better performance? I'm already using JDK 1.6 and -server
mode. Furthermore, all classes used here have their default equals and
hashCode methods, so they don't have an impact on performance.

Sincerely,

Wim Vancroonenburg
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Drools-solver performance optimizations?

2009-02-11 Thread Andrew Waterman

Hi Wim,

I'm just starting to use the solver as well on a project.  Have you  
ensured that the algorithm implemented by the other solver is the same  
as the local search your using for drools-solver?  You may want to  
think about tuning that piece, by switching to Geoffrey's tabu  
implementation.


I believe there are a few other examples in drools-solver-examples  
that show some different approaches to both using the MoveFactory  
(small-grained moves versus rough-grain moves) as well as with a  
StartingSolutionInitializer.


Anyway, thought I'd pass on a few ideas from my limited experience  
with the project and interacting on the list.


best,

A

-
Andrew Waterman
San Cristóbal de las Casas, Chiapas, Mexico
+52 1 967 107 5902
+1 510 342 5693








On Feb 11, 2009, at 12:59 PM, Wim Vancroonenburg wrote:


Hi,

I'm a student currently evaluating Drools Solver for my  
dissertation. I am currently trying to solve an optimization problem  
with two different solvers (one of which is Drools Solver) and I am  
comparing the results with earlier obtained results from literature.  
However I am having some troubles with the performance of Drools  
Solver, and I was hoping if someone could look at my rules to see if  
they could be tuned:


rule patientsToBeAssignedToRoomsOfAppropriateSex
when
$n : Night();
$room : Room(sexRestriction == Sex.Dependent   
capacity  1);
$genders : ArrayList(size1) from  
collect( PatientStay(bed.room == $room, night == $n) );
exists PatientStay(bed.room == $room, night == $n,  
$a : admission, eval(((PatientStay) 
$genders.get(0)).getAdmission().getPatient().getSex() !=  
$a.getPatient().getSex()));

then
insertLogical(new  
IntConstraintOccurrence 
(patientsToBeAssignedToRoomsOfAppropriateSex 
,ConstraintType.NEGATIVE_HARD,50,$room,$n));

end

rule hasRequiredRoomProperties
when
$pr : RequiredRoomPropertiesConstraint($a :  
admission, $r : room, $w : weight );

$ps : PatientStay(admission == $a, bed.room == $r);
then
insertLogical(new  
IntConstraintOccurrence 
(hasPreferredRoomProperties,ConstraintType.NEGATIVE_SOFT,50*$w, 
$ps));

end

rule unplannedTransfers
when
$ps : PatientStay($a : admission, $b : bed, $n :  
night);
$ps2 : PatientStay(admission == $a, bed != $b, $n2 :  
night,eval($n.getIndex()+1 == $n2.getIndex()));

then
insertLogical(new  
IntConstraintOccurrence 
(unplannedTransfers,ConstraintType.NEGATIVE_SOFT,110,$ps,$ps2));

end

rule hasPreferredRoomProperties
when
$pr : PreferredRoomPropertiesConstraint($a :  
admission, $r : room, $w : weight );

$ps : PatientStay(admission == $a, bed.room == $r);
then
insertLogical(new  
IntConstraintOccurrence 
(hasPreferredRoomProperties,ConstraintType.NEGATIVE_SOFT,20*$w, 
$ps));

end

rule meetsRoomPreference
when
$mr : MeetsRoomPreferenceConstraint($a : admission,  
$r : room);

$ps : PatientStay(admission == $a, bed.room == $r);
then
insertLogical(new  
IntConstraintOccurrence 
(meetsRoomPreference,ConstraintType.NEGATIVE_SOFT,8,$ps));

end

rule inGoodDepartment
when
$gd : GoodDepartmentConstraint($a : admission, $d :  
department);
$ps : PatientStay(admission == $a, $b : bed,  
eval($b.getRoom().getDepartment().equals($d)));

then
insertLogical(new  
IntConstraintOccurrence 
(inGoodDepartment,ConstraintType.NEGATIVE_SOFT,10,$ps));

end

rule inGoodRoom
when
$gr : GoodRoomConstraint($a : admission, $r : room,  
$w : weight);

$ps : PatientStay(admission == $a, bed.room == $r);
then
insertLogical(new  
IntConstraintOccurrence(inGoodRoom,ConstraintType.NEGATIVE_SOFT,10* 
$w,$ps));

end

rule calcScore
salience -10
when
$count : Number() from  
accumulate( IntConstraintOccurrence($w : weight) ,
 sum 
($w) );

then
scoreCalculator.setScore(-$count.doubleValue());
end

The classes with **Constraint in it are possible combinations that  
cause a constraint to be violated, and are calculated and inserted  
at initialization time (and are never changed). I know that the rule  
patientsToBeAssignedToRoomsOfAppropriateSex is fairly complex, but  
even when I remove it, the performance is not fantastic. Is there  
anything else I can do to get better performance? I'm already using  
JDK 1.6 and -server mode. Furthermore, all classes used here have  
their default equals and hashCode methods, so they don't have an  
impact on performance.


Sincerely,

Wim Vancroonenburg

[rules-users] drools-solver -- logger error (slf4j binding)?

2009-02-11 Thread Andrew Waterman

Hi,

I'm using the drools-solver.M5 build through Maven and have gotten the  
following error while running my project:


SLF4J: Failed to load class org.slf4j.impl.StaticLoggerBinder.
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for  
further details.


I've checked my dependency graph, and drools-solver references the  
sl4j-api, but no implementation.  I checked the mvnrepository, and  
there are several other slf4j related projects.  What is the preferred  
binding for JDK1.6?


best wishes,

Andrew

-
Andrew Waterman
San Cristóbal de las Casas, Chiapas, Mexico
+52 1 967 107 5902
+1 510 342 5693









___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Drools-solver -- solution questions

2009-02-07 Thread tim tim
hi

you could use a solution taboo, on all solutions found so far and let the
solver solve again.

the problem is that you never know when to stop this algorithm.
that is, when you found the last valid solution.
but you could stop the solver after a certain amount of time and
decide that you have all solutions.

best, tim

On Wed, Feb 4, 2009 at 11:36 PM, Andrew Waterman
andrew.water...@gmail.com wrote:
 Hello,

 I'm starting to work with the drools-solver to help on a gaming project.
  Basically, we have a game that works in two modes:  1) a competitive game
 where humans (or agents) compete with one another on a well defined game
 board to achieve 24 points by using three (or four) agricultural development
 tokens.  2.  A puzzle, where all 4 players work cooperatively to create an
 equitable solution, where all 4 players win with at least 24 points by means
 of our agricultural development tokens.

 I am starting to work with drools-solver to address the puzzle part of our
 game.  Basically, we are interested in having the solver do two things for
 us:  a)  find the optimal solution for our game/puzzle, based upon our
 requirements [this part seems quite straightforward] and b) getting  the
 total number of solutions that satisfy our constraints.  We would like, as
 well, to be able to inspect these other, sub-optimal, solutions, in order to
 explore our game and puzzle further.  From my reading of the Solver API ,
 it looks like we will only be able to get the optimal solution.  Does anyone
 have any suggestions for a workaround in this case?  Or is there some
 functionality in the solver that I am missing?

 I look forward to your feedback.

 best wishes,

 Andrew

 -
 Andrew Waterman
 San Cristóbal de las Casas, Chiapas, Mexico








 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] drools-solver results question

2009-02-05 Thread Andrew Waterman

Hello,

I'm starting to work with the drools-solver to help on a gaming  
project.  Basically, we have a game that works in two modes:  1) a  
competitive game where humans (or agents) compete with one another on  
a well defined game board to achieve 24 points by using three (or  
four) agricultural development tokens. 2.  A puzzle, where all 4  
players work cooperatively to create an equitable solution, where all  
4 players win with at least 24 points by means of our agricultural  
development tokens.


I am starting to work with drools-solver to address the puzzle part of  
our game.  Basically, we are interested in having the solver do two  
things for us:  a) find the optimal solution for our game/puzzle,  
based upon our requirements [this part seems quite straightforward]  
and b) getting  the total number of solutions that satisfy our  
constraints.  We would like, as well, to be able to inspect these  
other, sub-optimal, solutions, in order to explore our game and puzzle  
further.  From my reading of the Solver API , it looks like we will  
only be able to get the optimal solution.  Does anyone have any  
suggestions for a workaround in this case?  Or is there some  
functionality in the solver that I am missing?


I look forward to your feedback.

best wishes,

Andrew

-
Andrew Waterman
San Cristóbal de las Casas, Chiapas, Mexico








___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] drools-solver XML schema/detailed description?

2009-02-05 Thread Andrew Waterman

Hi,

My apologies for my earlier double post, I'm having some troubles with  
my mail client.


I'm writing to see if anyone has any detailed information on an XML- 
schema, or, a more detailed break-down of the drools-solver  
configuration files.  Basically, I'm trying to find out the set of  
available tags in drools-solver without going through the XML parsing  
code.  In particular, I'm curious about the options with regards to  
the selector tag.  In the curriculumCourseSolverConfig.xml file  
for the curriculum drools-solver example, the sub-tag topSize' is  
used in the selector configuration:


selector
selector
topSize10/topSize
/selector
selector
selector
moveFactoryClass
org 
.drools 
.solver 
.examples 
.itc2007.curriculumcourse.solver.move.factory.RoomChangeMoveFactory

/moveFactoryClass
relativeSelection0.002/relativeSelection
/selector
 [list of further move factories]
/selector

In addition, the relativeSelection subtag is used as well.

What do these subtags mean?  Is there a way to let the selector move  
through different weighted MoveFactories?


Thanks!

best wishes,

Andrew
-
Andrew Waterman
San Cristóbal de las Casas, Chiapas, Mexico
+52 1 967 107 5902
+1 510 342 5693







___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Drools-solver -- solution questions

2009-02-04 Thread Andrew Waterman

Hello,

I'm starting to work with the drools-solver to help on a gaming  
project.  Basically, we have a game that works in two modes:  1) a  
competitive game where humans (or agents) compete with one another on  
a well defined game board to achieve 24 points by using three (or  
four) agricultural development tokens.  2.  A puzzle, where all 4  
players work cooperatively to create an equitable solution, where all  
4 players win with at least 24 points by means of our agricultural  
development tokens.


I am starting to work with drools-solver to address the puzzle part of  
our game.  Basically, we are interested in having the solver do two  
things for us:  a)  find the optimal solution for our game/puzzle,  
based upon our requirements [this part seems quite straightforward]  
and b) getting  the total number of solutions that satisfy our  
constraints.  We would like, as well, to be able to inspect these  
other, sub-optimal, solutions, in order to explore our game and puzzle  
further.  From my reading of the Solver API , it looks like we will  
only be able to get the optimal solution.  Does anyone have any  
suggestions for a workaround in this case?  Or is there some  
functionality in the solver that I am missing?


I look forward to your feedback.

best wishes,

Andrew

-
Andrew Waterman
San Cristóbal de las Casas, Chiapas, Mexico








___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] drools solver move factory crash

2008-10-13 Thread tim tim
hello

the new version of the drools-solver supports multiple move factories.

i happily split my move factory to take advantage of the
relativeSelection parameter.

now the problem is that not all move factories can produce moves for
every possible
current solution. and the

org.drools.solver.core.localsearch.decider.selector.MoveFactorySelector

crashes, when a move factory does not return a single move.

public final ListMove selectMoveList(StepScope stepScope) {
ListMove moveList =
moveFactory.createMoveList(stepScope.getWorkingSolution());
if (shuffle) {
Collections.shuffle(moveList, stepScope.getWorkingRandom());
}
if (relativeSelection != null) {
int selectionSize = (int) Math.ceil(relativeSelection *
moveList.size());
if (selectionSize == 0) {
selectionSize = 1;
}
moveList = moveList.subList(0, selectionSize);  // --
CRASH, if moveList is empty
}
return moveList;
}

currently i solve it by always returning at least a null-move.

but a better solution would be to change the
MoveFactorySelector.selectMoveList(), so that it tests for an
empty list.

best, tim
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Drools-solver

2007-09-24 Thread Geoffrey De Smet

Drools-solver solves planning problems.
It has moved to trunk and the reference manual is now available at:
http://users.telenet.be/geoffrey/tmp/solver/manual/html_single/
It's still experimental though.

We even made 2 blogs about it for the price of one:
http://blog.athico.com/2007/09/drools-solver.html
http://blog.athico.com/2007/09/drools-solver-in-nutshell.html

Have fun.

--
With kind regards,
Geoffrey De Smet

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Drools-solver

2007-09-24 Thread Paul Browne
Geoffrey,

In a bizarre co-incidence I had just finished reading the Drools solver
docs. It's very good - it's taken one of the ideas that I'd been mulling
over and implemented it a (good) way that makes me realise I'm hardly out of
Kindergarten with this stuff :-)

One comment on the documentation; I know you explain what the NQueens
problem is (about 1/4 of the way down in the documentation), but is it
possible to move the explanation beside the NQueens Diagram (which appears
very early in the article), and which people like me who aren't familiar
with NQueens will want to understand?

The other comment is to push what Drools solver can do to the top of the
manual (e.g.the Timetabling , routing problems) to make people sit up and
listen to what the technology can do.

It might be good to blow your own trumpet a bit more and explain why the
(Rule based) solver is better / faster than a 'code your own'  solution.

Just remember the rest of us after you make your first million - running
this to solve the problem of 'what sort of shares should I buy?' :-)

Paul

On 9/24/07, Geoffrey De Smet [EMAIL PROTECTED] wrote:

 Drools-solver solves planning problems.
 It has moved to trunk and the reference manual is now available at:
 http://users.telenet.be/geoffrey/tmp/solver/manual/html_single/
 It's still experimental though.

 We even made 2 blogs about it for the price of one:
 http://blog.athico.com/2007/09/drools-solver.html
 http://blog.athico.com/2007/09/drools-solver-in-nutshell.html

 Have fun.

 --
 With kind regards,
 Geoffrey De Smet

 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users