Sorry about this, my fault, I missed a line in the log. The initial
score is getting calculated properly:
Feb 12, 2009 6:07:04 PM mx.edu.multigame.drools.SolverTest
testSolverWithUndevelopedSolution
INFO: Invoking solver, this should take a few minutes...
Feb 12, 2009 6:07:04 PM org.slf4j.impl.JCLLoggerAdapter info
INFO: Solving with random seed (0).
Undeveloped territory constraint tripped! 39
Feb 12, 2009 6:07:04 PM org.slf4j.impl.JCLLoggerAdapter info
INFO: Initialization time spend (14) for score (-5000004.0).
Updating best solution and best score.
Undeveloped territory constraint tripped! 39
I definitely see your point with regards to my loop insertion; the
solution continues to degrade. I like your final suggested rule as
well, I'll try that out today.
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 (-5000004.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(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users