[rules-users] SimpleScoreCalculator

Geoffrey De Smet ge0ffrey.spam at gmail.com
Thu Feb 21 11:34:22 EST 2013


Op 21-02-13 12:54, André Fróes schreef:
> Sure. My sorting by worktime and skills is partially working, if I do 
> my planning with a certain number of engineers/workorders that fits in 
> each other, it works perfectly, If i overcome that, it breaks the 
> planning, it keeps showing the data that shouldn't be displayed and, 
> in consequence, breaks the optimal solution.
>
> Example:
> Engineer Andre, WT(8 hours), Skills ABC1, ABC2
>
> Workorder 1, required WT(2), required Skills ABC2
> Workorder 2, required WT(3), required Skills ABC2
> Workorder 3, required WT(1), required Skills ABC1
>
> with these 3 WO it should work perfectly, results:
> ID: 104[Skills: ABC 2,]   -   Andre(8)[Skills: ABC 1,ABC 2,] ------ 
> Feasible(0)
> ID: 105[Skills: ABC 2,]   -   Andre(8)[Skills: ABC 1,ABC 2,] ------ 
> Feasible(0)
> ID: 106[Skills: ABC 1,]   -   Andre(8)[Skills: ABC 1,ABC 2,] ------ 
> Feasible(0)
>
> Adding this workorder that exceed in time and skill
>
> Workorder 1, required WT(5), required Skills ABC2, ABC3
>
> this is the outcome:
>
> ID: 104[Skills: ABC 2,]   -   Andre(8)[Skills: ABC 1,ABC 2,] ------ 
> Feasible(0)
> ID: 105[Skills: ABC 2,]   -   Andre(8)[Skills: ABC 1,ABC 2,] ------ 
> Feasible(0)
> ID: 107[Skills: ABC 1,ABC 3,]   -   Andre(8)[Skills: ABC 1,ABC 2,] 
> ------ Broken(1)
> ID: 106[Skills: ABC 1,]   -   Andre(8)[Skills: ABC 1,ABC 2,] ------ 
> Feasible(0)
What do you want to happen with that extra workorder ID: 107[Skills: ABC 
1,ABC 3,]?
- Assign it to different engineer - because there's another engineer 
available which has time (or it doesn't matter that engineers are 
overloaded)
- Leave it "unassigned" because you are doing "over-constrained 
planning." For 6.0, planner will support "nullable planner variables", 
but in 5.5, you need to emulate this behavior by creating special 
Engineer called Unassigned and adjusting your score constraints to not 
trigger when that UnassignedEngineer is involved. There's been some 
previous mails about this topic in this mail archive.
>
> it shows all not excluding the workorder that is not to be assigned to 
> engineer. I did it by simplescorecalculator:
>
> public HardAndSoftScore calculateScore(Distributor distributor) {
> int hardScore = 0;
> int softScore = 0;
>
> for (Engineer e : distributor.getEngineerList()) {
> int requiredWorktime = 0;
> List<Skill> requiredSkillList = new ArrayList<Skill>();
>
> for (WorkOrder o : distributor.getWorkOrderList()) {
> if (e.equals(o.getEngineer())) {
> requiredWorktime += o.getRequiredWorktime();
> for (SkillWorkOrder swo : o.getRequiredSkills()) {
> requiredSkillList.add(swo.getSkill());
> }
> }
> }
>
> int engineerAvailableTime = e.getWorktime() - requiredWorktime;
> if (engineerAvailableTime < 0) {
> hardScore += engineerAvailableTime;
> }
>
> List<Skill> tempEngSkillList = new ArrayList<Skill>();
> for (SkillEngineer se : e.getSkillEngineerList()){
> tempEngSkillList.add(se.getSkill());
> }
> if (tempEngSkillList.containsAll(requiredSkillList)){
> hardScore += 1;
> }
> }
>
> return DefaultHardAndSoftScore.valueOf(hardScore, softScore);
> }
>
> that's the problem happening, after that i'll start working on 
> priority by the tip you provided in the previous post, but i'll try by 
> simplescorecalculator to, i'm not getting along (yet) with drools 
> rules system (drl), it's a bit harder to use it with planner.
>
> thanks for the help Geoffrey!
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20130221/6cf1aa59/attachment-0001.html 


More information about the rules-users mailing list