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 (-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@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

Reply via email to