Selective TSP?
by rengana
Hi,
i'm evaluating Drools Planner as a solver for a "normal" OP problem but i
can't find any example of drools usage on problems with partial set as a
feasible solution, all drools examples and use cases seems to always try to
plan every object even if that makes the solution unfeasible.
I was able to model a OP problem using a modified version of the vehicle
routing example using two vehicles, one for containing the customers visited
(real solution) and a second vehicle for containing customers not visited.
It works OK but this approach seems very dirty...
Doesn't Drools Planner support a partial set solution that is feasible but
doesn't have to contain all problem facts? Maybe a parameter to allow
partial set solutions, and if so, be able to define the minimal problem
facts needed to consider a posible solution.
I was expecting that at least in the contruction phase the planner found
some feasible solutions, since each step it is putting one element in the
solution and then evaluating score, but found that the best solution passed
to local seach isn't the best feasible solution of the contruction phase but
always a unfeasible solution because somehow it's forcing to contains all
problem facts.
Is this correct?
Best regards,
Rui
--
View this message in context: http://drools.46999.n3.nabble.com/Selective-TSP-tp4022903.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years
How can I select planning-entities in the accumulate source-pattern based on a list of planning-variables?
by Michiel Vermandel
Hi,
I am kind of stuck in writing a rule :
I have PeopleMatch facts in working memory.
Each PeopleMatch has a number of persons: PeopleMatch().getPeople = List<Person>
I have planning-entities (Tasks) which have a planning-variable Person.
Now I would like to create a rule to loop over the PeopleMatch objects, gather all Tasks for the people of this match and do some calculation with all tasks.
This is what I have for the moment:
rule "matchPeopleTasks"
when
$match : PeopleMatch()
$people : List() from $match .people
$match: Number( intValue < 0 )
from accumulate( $task : Task(handler == $people),
init( Matcher matcher = $match.getMatcher()),
action( matcher.addTask( $task ); ),
reverse( matcher.removeTask( $task ); ),
result( matcher.getMatch() ) );
then
...
end
The problem area is of course the "accumulate( $task : ProjectTask(handler == $people),"
How do I select all tasks in the accumulate function, based on a list of people?
Thanks,
Michiel
-----------------
http://www.codessentials.com - Your essential software, for free!
Follow us at http://twitter.com/#!/Codessentials
13 years
Rule activation when using from
by wumb
Hi,
is there a way to make drools re-evaluate the LHS of a rule when using
from? What I try to achieve is, that following rule is evaluated for
every call of fireAllRules() :
global java.util.Calendar cal
rule "test"
when
java.util.Calendar() from cal
then
System.out.println("here we go");
end
Drools evaluates the rule only in the first call of fireAllRules().
Kind regards
13 years
lua
by jigna
Is it possible to use sliding window with 'exists' conditional element?
I need to write if pattern existing has ocuured in last one hour, how should
this be written?
For eg. following is the pattern with 'exists' CE which I need to check if
has occured in last one hr.
rule "Fault"
when
exists(
ErrorPatternData
(
(errorCode(=="1200007" || =="1190002" || =="1944" || =="2a23"))
)from entry-point ErrorEntryPoint
&&
ErrorPatternData
(
(errorCode == "76004101")
)from entry-point ErrorEntryPoint
)
then
System.out.println("Fault - Rule-Has Passed");
end
--
View this message in context: http://drools.46999.n3.nabble.com/lua-tp4022851.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years
How to use global variables
by goforcrazy
Hi All,
My rule file is as shown below:
global Integer count;
rule "Rule1"
when eval(1==1)
then
for(int a = 0; a<10; a++)
{
System.out.println("1 COUNT: " + count);
count++;
}
rule "Rule 2"
when eval(1==1)
then
for(int a = 0; a<10; a++)
{
System.out.println("2 COUNT: " + count);
count++;
}
As shown above I have created a global variable count in my drools file. In
my Java file I have included ksession.setGlobal("count", 1); to start the
count from 1 for first rule but after Rule 1 gets executed and before the
beginning of rule 2 I find that count value is again taken as 1. It does not
remember the last count value at the end of the loop.
I understand I need to use the workingMemory function to update the result
of count but I am not sure on how and where to update the same.
Any help regarding this will be greatly appreciated.
Thanks and Regards,
Malathi
--
View this message in context: http://drools.46999.n3.nabble.com/How-to-use-global-variables-tp4022860.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years
Issue in writing business rule with Drools Guvnor 5.5.0 and Jboss as 7.0.2
by mahesh_kharat
I am using drools guvnor 5.5.0 with jboss as 7.0.2.
I want to write one business rule but I am getting following issues :
1. When I am selecting "From entry-point" from list of facts, guvnor
doesn’t give facility to add "Any of the following are true" condition in
add pattern of "From entry-point".
2. When I am selecting "Any of the following are true" from list of
facts, guvnor doesn’t give facility to add "From entry-point" condition in
add pattern of "Any of the following true".
Has anyone faced the same situation? Please provide your throughts on
this issue, how to overcome the issue?
- Mahesh
--
View this message in context: http://drools.46999.n3.nabble.com/Issue-in-writing-business-rule-with-Dro...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years
Business rule for accumulate function with Number fact using Guvnor
by mahesh_kharat
Hi,
I have written one business rule like following in my drl:
package ruleTest
import com.test.model.ErrorInfo
declare ErrorInfo
@role(event)
@timestamp(errorTimeStamp)
end
rule "Disk Capacity Threshold Error Rule"
when
Number( $totalDiskErrors:intValue,intValue == 5)
from accumulate($errorCount: ErrorInfo(errorCode=="00000011")
over window:time(60s)
from entry-point diskErrorEntryPoint,count($errorCount))
then
System.out.println("Disk Capacity Threshold Error Rule - Has
passed");
end
ErrorInfo is my fact which I have defined it to be of type event. In my
application, if many event comes having errorCode field's value as
"00000011" & count of those events has reached 5 over a window size of 60s
then print statement action should be carried out.This piece of rule is
working properly.
Now, I want to achieve same thing using Guvnor wherein I can define my
business rule. I tried creating fact Number & business rule for it but some
how it is not working. I am not getting any errors also. I have attached
images of my business rule & source of it.
So I have following doubts
1. How would I create new fact Number? Is it available in guvnor by default?
2. How to bind the result of accumulate with this fact Number?
If anyone knows about this, please do reply.
Thanks.
-Mahesh <http://drools.46999.n3.nabble.com/file/n4022861/DiskErrorRule.jpg>
<http://drools.46999.n3.nabble.com/file/n4022861/DiskErrorRuleSource.jpg>
--
View this message in context: http://drools.46999.n3.nabble.com/Business-rule-for-accumulate-function-w...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years