XStreamAlias
by André Fróes
What is this @XStreamAlias(...) that i see in mostly of example pojos? I
did my pojos without it and worked the same way. Is it for performance?
13 years, 5 months
Confusion with using predicates in spreadsheets
by starfish15
Hello,
In Drools 5.2, Web Guided DTs, i have worked with calculation types as
*Predicate*. How can the same be used in a spreadsheet DT.
Just to give an idea, i need to compare values in 2 facts. So in the DT,
Condition was written as factA.attrib1 == factB.attrib1, Bt i am stuck as to
what should be written in the value for this condition.
In Web Guided DTs, this cud be done using predicates, where neither the
field nor the operator was required. Simply when penning down this condition
in the table we wrote the value as, factA.attrib1 == factB.attrib1
And that solved the condition thing, however am not sure how this should be
written in spread sheets
Kindly help with usual spread sheets how can this be handled.
Regards,
starfish
--
View this message in context: http://drools.46999.n3.nabble.com/Confusion-with-using-predicates-in-spre...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 5 months
Drools rule [Planner]
by André Fróes
Is there a way to debug my project monitoring if it passes by my rule?
In my console i don't see the score of hard constraint of this rule:
----
rule "requiredWorktimeToFinish"
when
$engineer : Engineer($worktime : worktime)
$requiredWorktimeTotal : Number(intValue < $worktime) from accumulate(
WorkOrder (
engineer == $engineer,
$requiredWorktime : requiredWorktime),
sum($requiredWorktime)
)
then
insertLogical(new IntConstraintOccurrence("requiredWorktimeToFinish",
ConstraintType.NEGATIVE_HARD,
$requiredWorktimeTotal.intValue() - $worktime,
$engineer));
end
rule "hardConstraintsBroken"
salience -1
when
$hardTotal : Number() from accumulate(
IntConstraintOccurrence(constraintType ==
ConstraintType.NEGATIVE_HARD, $weight : weight),
sum($weight)
)
then
scoreHolder.setHardConstraintsBroken($hardTotal.intValue());
end
----
in my console it points no score
----
17:02:49.009 [main] INFO o.d.p.core.solver.DefaultSolver - Solving
started: time spend (127), score (null), new best score (null), random seed
(0).
17:02:49.041 [main] DEBUG o.d.p.c.c.g.DefaultGreedyFitSolverPhase -
Step index (0), time spend (164), score (0hard/0soft), initialized planning
entity ([WorkOrder-7]).
17:02:49.042 [main] DEBUG o.d.p.c.c.g.DefaultGreedyFitSolverPhase -
Step index (1), time spend (165), score (0hard/0soft), initialized planning
entity ([WorkOrder-9]).
17:02:49.043 [main] DEBUG o.d.p.c.c.g.DefaultGreedyFitSolverPhase -
Step index (2), time spend (166), score (0hard/0soft), initialized planning
entity ([WorkOrder-8]).
17:02:49.045 [main] DEBUG o.d.p.c.c.g.DefaultGreedyFitSolverPhase -
Step index (3), time spend (168), score (0hard/0soft), initialized planning
entity ([WorkOrder-6]).
17:02:49.045 [main] INFO o.d.p.c.c.g.DefaultGreedyFitSolverPhase - Phase
constructionHeuristic ended: step total (4), time spend (168), best score
(0hard/0soft).
17:02:49.274 [main] DEBUG o.d.p.c.l.DefaultLocalSearchSolverPhase -
Step index (0), time spend (397), score (0hard/0soft), best score
(0hard/0soft), accepted/selected move count (1000/1000) for picked step
([WorkOrder-7] => [Engineer-5]).
17:02:49.592 [main] DEBUG o.d.p.c.l.DefaultLocalSearchSolverPhase -
Step index (1), time spend (715), score (0hard/0soft), best score
(0hard/0soft), accepted/selected move count (1000/1926) for picked step
([WorkOrder-8] => [Engineer-3]).
17:02:50.045 [main] DEBUG o.d.p.c.l.DefaultLocalSearchSolverPhase -
Step index (2), time spend (1168), score (0hard/0soft), best score
(0hard/0soft), accepted/selected move count (1000/3686) for picked step
([WorkOrder-6] => [Engineer-2]).
17:02:50.464 [main] DEBUG o.d.p.c.l.DefaultLocalSearchSolverPhase -
Step index (3), time spend (1587), score (0hard/0soft), best score
(0hard/0soft), accepted/selected move count (1000/7516) for picked step
([WorkOrder-9] => [Engineer-2]).
17:02:53.877 [main] DEBUG o.d.p.c.l.DefaultLocalSearchSolverPhase -
Step index (4), time spend (5000), score (0hard/0soft), best score
(0hard/0soft), accepted/selected move count (0/350227) for picked step
([WorkOrder-7] => [Engineer-4]).
17:02:53.877 [main] INFO o.d.p.c.l.DefaultLocalSearchSolverPhase - Phase
localSearch ended: step total (5), time spend (5000), best score
(0hard/0soft).
17:02:53.878 [main] INFO o.d.p.core.solver.DefaultSolver - Solving ended:
time spend (5000), best score (0hard/0soft), average calculate count per
second (72872).
13 years, 5 months
Question about caching of MoveListFactory
by Michiel Vermandel
Hi,
Is it possible to use caching on a custom created MoveListFactory?
I mean, I created a custom MoveListFactory and configured it like this:
<moveListFactory>
<moveListFactoryClass>my.planner.solver.ProjectShiftFactory</moveListFactoryClass>
</moveListFactory>
I noticed that the createMoveList method is called upon every step.
Though, if I get things right, in the case that the step did not result in a better score, the solution will not be cloned and thus (in my case) the
calling of the createMoveList in the next step will result in exactly the same list containing the same object instances.
I think it would be OK if the createMoveListis only called when a better score is reached and a cloneSolution will be executed (and thus my object instances get obsolete).
1) I hope my theory makes sense end if so my question is: can I cache the list on the level as described?
2) One more question about steps: if a step does not result in a better score, what happens then?
- A new number of moves is launched up to the limit defined by minimalAcceptedSelection?
But what is the difference with the previous step?
Is it the fact that a "different" solution with the same score will be used as starting point of the new step (given that one uses tabu)?
Thanks,
Michiel
-----------------
http://www.codessentials.com - Your essential software, for free!
Follow us at http://twitter.com/#!/Codessentials
13 years, 5 months
Re: [rules-users] [JBRULES-3703] Error parsing negative numbers in decision table
by metatech
Hi,
(Attempt #2 after registering to the mailing list ...).
For some reason, I do not have permission to add a comment in JIRA.
Please add this answer in a comment on the case JBRULES-3703. Thanks.
===============
The reason of the exception is because the number is treated as a float, ie
"-1.0".
The workaround is to add a single quote before the number and it will work.
===============
Lubos Pechac wrote
> Compiling attached .xls table results in exception, K12 column contains
> "-1". This worked in drools 5.0.1
> org.drools.template.parser.DecisionTableParseException: Priority is not an
> integer literal, in cell K12
> at
> org.drools.decisiontable.parser.DefaultRuleSheetListener.nextDataCell(DefaultRuleSheetListener.java:607)
--
View this message in context: http://drools.46999.n3.nabble.com/Re-JBRULES-3703-Error-parsing-negative-...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 5 months
Heap space
by André Fróes
Hello! After trying cloudComputer example i'm trying to implement my own
schedule distributor, but now i'm facing heap space error, but i see that
it does distribute some work orders. Here's the console error:
-------------------
17:05:02.776 [main] INFO o.d.p.core.solver.DefaultSolver - Solving
started: time spend (255), score (null), new best score (null), random seed
(0).
17:05:02.821 [main] DEBUG o.d.p.c.c.g.DefaultGreedyFitSolverPhase -
Step index (0), time spend (309), score (0hard/0soft), initialized planning
entity ([Engineer-5]).
17:05:02.822 [main] DEBUG o.d.p.c.c.g.DefaultGreedyFitSolverPhase -
Step index (1), time spend (310), score (0hard/0soft), initialized planning
entity ([Engineer-4]).
17:05:02.824 [main] DEBUG o.d.p.c.c.g.DefaultGreedyFitSolverPhase -
Step index (2), time spend (311), score (0hard/0soft), initialized planning
entity ([Engineer-3]).
17:05:02.824 [main] DEBUG o.d.p.c.c.g.DefaultGreedyFitSolverPhase -
Step index (3), time spend (312), score (0hard/0soft), initialized planning
entity ([Engineer-2]).
17:05:02.825 [main] DEBUG o.d.p.c.c.g.DefaultGreedyFitSolverPhase -
Step index (4), time spend (313), score (0hard/0soft), initialized planning
entity ([Engineer-1]).
17:05:02.825 [main] INFO o.d.p.c.c.g.DefaultGreedyFitSolverPhase - Phase
constructionHeuristic ended: step total (5), time spend (313), best score
(0hard/0soft).
17:05:03.020 [main] DEBUG o.d.p.c.l.DefaultLocalSearchSolverPhase -
Step index (0), time spend (508), score (0hard/0soft), best score
(0hard/0soft), accepted/selected move count (1000/1000) for picked step
([Engineer-3] => [WorkOrder-12]).
17:05:03.315 [main] DEBUG o.d.p.c.l.DefaultLocalSearchSolverPhase -
Step index (1), time spend (803), score (0hard/0soft), best score
(0hard/0soft), accepted/selected move count (1000/1703) for picked step
([Engineer-4] => [WorkOrder-8]).
17:05:03.736 [main] DEBUG o.d.p.c.l.DefaultLocalSearchSolverPhase -
Step index (2), time spend (1224), score (0hard/0soft), best score
(0hard/0soft), accepted/selected move count (1000/2657) for picked step
([Engineer-1] => [WorkOrder-8]).
17:05:03.951 [main] DEBUG o.d.p.c.l.DefaultLocalSearchSolverPhase -
Step index (3), time spend (1439), score (0hard/0soft), best score
(0hard/0soft), accepted/selected move count (1000/4315) for picked step
([Engineer-5] => [WorkOrder-9]).
17:05:04.251 [main] DEBUG o.d.p.c.l.DefaultLocalSearchSolverPhase -
Step index (4), time spend (1739), score (0hard/0soft), best score
(0hard/0soft), accepted/selected move count (1000/9309) for picked step
([Engineer-2] => [WorkOrder-9]).
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Unknown Source)
at java.util.Arrays.copyOf(Unknown Source)
at java.util.ArrayList.grow(Unknown Source)
at java.util.ArrayList.ensureCapacityInternal(Unknown Source)
at java.util.ArrayList.add(Unknown Source)
at
org.drools.planner.core.localsearch.decider.forager.AcceptedForager.addToMaxScoreUnacceptedList(AcceptedForager.java:143)
at
org.drools.planner.core.localsearch.decider.forager.AcceptedForager.addMove(AcceptedForager.java:101)
at
org.drools.planner.core.localsearch.decider.DefaultDecider.processMove(DefaultDecider.java:164)
at
org.drools.planner.core.localsearch.decider.DefaultDecider.doMove(DefaultDecider.java:144)
at
org.drools.planner.core.localsearch.decider.DefaultDecider.decideNextStep(DefaultDecider.java:116)
at
org.drools.planner.core.localsearch.DefaultLocalSearchSolverPhase.solve(DefaultLocalSearchSolverPhase.java:62)
at
org.drools.planner.core.solver.DefaultSolver.runSolverPhases(DefaultSolver.java:190)
at
org.drools.planner.core.solver.DefaultSolver.solve(DefaultSolver.java:155)
at com.swa.planner.domain.WorkOrderTest.main(WorkOrderTest.java:66)
------------------------
it does distribute some engineers to work orders, but after a while, it
just show the error.
The drl is very simple:
--------------------------
import
org.drools.planner.core.score.buildin.hardandsoft.HardAndSoftScoreHolder;
import org.drools.planner.core.score.constraint.IntConstraintOccurrence;
import org.drools.planner.core.score.constraint.ConstraintType;
import com.swa.planner.domain.Distributor;
import com.swa.planner.domain.Engineer;
import com.swa.planner.domain.WorkOrder;
global HardAndSoftScoreHolder scoreHolder;
rule "requiredTimeToFinish"
when
$workOrder : WorkOrder($time : time)
$requiredTimeTotal : Number(intValue > $time) from accumulate(
Engineer (
workOrder == $workOrder,
$requiredTime : worktime),
sum($requiredTime)
)
then
insertLogical(new IntConstraintOccurrence("requiredTimeToFinish",
ConstraintType.NEGATIVE_HARD,
$requiredTimeTotal.intValue() - $time,
$workOrder));
end
rule "hardConstraintBroken"
salience -1
when
$hardTotal : Number() from accumulate(
IntConstraintOccurrence(constraintType == ConstraintType.NEGATIVE_HARD,
$weight : weight)
sum($weight)
)
then
scoreHolder.setHardConstraintsBroken($hardTotal.intValue());
end
--------------------------
i guess no error there, i believe that i'm missing when doing the strenght
and difficulty comparators dince i didn't really understood the
getMultiplicand thing of CloudComputer.
here's the implementation, also kept as simple as possible (and probably
wrong):
------------
public class WorkOrderStrengthComparator implements Comparator<WorkOrder> {
public int compare(WorkOrder a, WorkOrder b) {
return new CompareToBuilder().append(a.getTime(), b.getTime())
.append(b.getId(), a.getId())
.toComparison();
}
}
------------
public class EngineerDifficultyComparator implements Comparator<Engineer> {
public int compare(Engineer a, Engineer b) {
return new CompareToBuilder().append(a.getWorktime(), b.getWorktime())
.append(a.getId(), b.getId())
.toComparison();
}
}
------------
i'm missing something at these comparators ain't I?
13 years, 5 months
Custom UI to create rules and inserting them via REST API
by benq2188
Hi everyone,
I would like to implement an Expert System which I can have my own UI to
generate user defined rules, and I am planning to use REST API to
insert/update/delete the rules,which are in the guvnor repository. Inside
the guvnor, I would like to store my rules in .drl format. So I was
wondering two thing:
- Is that possible to create a brl file in XStream xml format as output of
the UI, and store it in the repository as .drl format?. (I know the
conversion from .brl to .drl is possible by using BRDRLPersistance object.)
If it is possible then which object is the key point to create it from the
"package org.drools.ide.common.client.modeldriven.brl"?
-Another problem, by using REST API I can update and retrieve an asset in
text/plain format, however I could not succeed to insert new asset into
repository by using POST method. So how can I insert a new .drl rule into
repository via REST.
I will appreciate if you have some sample code for any of them and will be
greatful for any help,
Thanks,
Bengi.
--
View this message in context: http://drools.46999.n3.nabble.com/Custom-UI-to-create-rules-and-inserting...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 5 months
My posts have not been accepted yet
by pooja.ghosh@accenture.com
Hello,
I have posted some 2 or 3 Queries. They haven't been accepted yet. Kindly look into this and post it PLEASE. This is sort of URGENT. :(
Thanking in anticipation.
Regards,
starfisj
________________________________
This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the e-mail by you is prohibited.
Where allowed by local law, electronic communications with Accenture and its affiliates, including e-mail and instant messaging (including content), may be scanned by our systems for the purposes of information security and assessment of internal compliance with Accenture policy.
______________________________________________________________________________________
www.accenture.com
13 years, 5 months
Planner: localSearch > unionMoveSelector
by Michiel Vermandel
Hi,
If I have a default unionMoveSelector in my configuration:
<unionMoveSelector>
<...MoveSelector/>
<...MoveSelector/>
<...MoveSelector/>
...
</unionMoveSelector>
then is the next move selected by random amongst the different move selectors.
I think I can understand that from the manual, though want to verify that.
Thanks
Michiel
-----------------
http://www.codessentials.com - Your essential software, for free!
Follow us at http://twitter.com/#!/Codessentials
13 years, 5 months