<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
I don't have the time budget to do a full code review for a
community question,<br>
but here are my initial thoughts:<br>
<br>
<br>
A) Is your average calculation count per second above 5000?<br>
If not, figure out which score rules are slowing you down.<br>
<br>
<br>
B) Your assessment of "Concept with timeslots has to many possible
order positions." might be correct.<br>
<br>
I've seen before on job shop scheduling problems,<br>
that having second grained accuracy on starting time, in cases with
days/weeks of running time,<br>
where each job (=order) takes minutes - is inefficient in a
straightforward model, currently.<br>
Specifically because the constraints want the jobs to be pasted
after each other.<br>
<br>
Here are (parts of) a solution for B):<br>
<br>
1) Use a smarter (more complex model) that leaves less pointless
combinations.<br>
Some idea's:<br>
- Look at the Project Job Scheduling example's source code.<br>
<a class="moz-txt-link-freetext" href="http://www.youtube.com/watch?v=_2zweB9JD7c">http://www.youtube.com/watch?v=_2zweB9JD7c</a><br>
If orders have dependencies on each other, this works well.<br>
- Look at Vehicle Routing with Time windows. Maybe this model works
for you:<br>
Each Vehicle = 1 of your machines. Each customer = 1 job.
ArrivalTime = startingOrderTime.<br>
Setup times etc are added automatically in the arrivalTime due to
the VariableListener.<br>
<br>
2) (Future) For OptaPlanner 6.1.0.Beta1 (which is coming soon), we
are working on numeric ValueRanges.<br>
<a class="moz-txt-link-freetext" href="https://issues.jboss.org/browse/PLANNER-160">https://issues.jboss.org/browse/PLANNER-160</a><br>
This way, if a the values are (00:01, 00:02, 00:03, ..., 00:55,
...),<br>
OptaPlanner understands that 00:02 is closer to 00:03 than to 00:55,<br>
and the generic change move selector will support a gaussian
distribution random close to it's current value.<br>
<br>
3) (Future) "CH based metaheuristics" (also called "indirect
metaheuristics" - or by me "feature L").<br>
Too hard to explain now, but research shows this is very promising
for these kind of use cases (a big leap forward).<br>
I am confident I can make it simple to use (despite it's inherit
complexity), hopefully for 6.1.<br>
It does have some drawbacks and limitations (especially if you rely
on a specific types of soft constraints).<br>
<br>
<br>
<div class="moz-cite-prefix">On 20-11-13 17:32, Mohr, Michael wrote:<br>
</div>
<blockquote
cite="mid:061987E4D707A946AE38FB38AB077C9C018D3EEF0BE1@lu-exchange.koehl.eu"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<meta name="Generator" content="Microsoft Word 14 (filtered
medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Sprechblasentext Zchn";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";
        mso-fareast-language:EN-US;}
span.SprechblasentextZchn
        {mso-style-name:"Sprechblasentext Zchn";
        mso-style-priority:99;
        mso-style-link:Sprechblasentext;
        font-family:"Tahoma","sans-serif";}
span.E-MailFormatvorlage19
        {mso-style-type:personal;
        font-family:"Tahoma","sans-serif";
        color:black;
        font-weight:normal;
        font-style:normal;
        text-decoration:none none;}
span.E-MailFormatvorlage20
        {mso-style-type:personal-reply;
        font-family:"Tahoma","sans-serif";
        color:black;
        font-weight:normal;
        font-style:normal;
        text-decoration:none none;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US">Hi,<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span
lang="EN-US"><br>
I must find start and end times for orders on different
equipment’s in requirement of a stock.<br>
What can I do better to get faster a solution.<br>
<br>
I read the forum entries but it don't helps.<br>
- Scheduling events with varying durations - corrupted score<br>
- Time Slots vs Time Periods<o:p></o:p></span></p>
<p class="MsoNormal"><b><span style="color:black" lang="EN-US">Graphics</span></b><b><span
lang="EN-US">
<span style="color:black">and detail </span>description
in the pdf. <o:p></o:p></span></b></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Domain model<br>
<br>
@PlanningEntity<br>
EquipmentAllocation has a Equipment<br>
EquipmentAllocation has a Order<br>
EquipmentAllocation has a TimeSlot<br>
------------------------------------------------------<br>
@PlanningVariable<br>
Order<br>
Attribute: quantity<br>
------------------------------------------------------<br>
TimeSlot<br>
Attribute: startTime, endTime, duration, sequenceNumber<br>
------------------------------------------------------<br>
Material<br>
Attribute: stock, minStock, maxStock<br>
------------------------------------------------------<br>
Material Demand has a TimeSlot<br>
Attribute: quantity<br>
------------------------------------------------------<br>
<br>
Conditions:<br>
- Order is executable on each equipment.<br>
- Orders has different sizes.<br>
- Order running time is depending of the material and
the equipment.<br>
- Gaps between orders are possible if there is no
demand.<br>
- Gaps between orders are possible when there is a
equipment setup time.<br>
- Parallel orders with same material on different
equipment’s are possible.<br>
<br>
Target:<br>
- Calculate start and endtims for an order.<br>
- Start and endtime is precisely one minute (maximum
five minutes if runtime is to long).<br>
- Satisfy only the demand of a material.<br>
- Good result in 5 minutes.<br>
- No exceed min or max stock.<br>
<br>
Plan data:<br>
- Plan for 24 hours.<br>
- Plan 35 orders (normal order time is 2 hours).<br>
- Plan 5 demands with different materials (7 orders
per demand).<br>
- Plan 3 equipment’s.<br>
<br>
Problem:<br>
- No result in 5 minutes.<br>
- Concept with timeslots has to many possible order
positions.<br>
- No restrictions are possible to find the best
solution.<br>
<br>
Use a pillar swap to create the possible order positions on
each equipment.<br>
Use a pillar swap to lay the order over a lot of timeslots
on a equipment.<br>
<br>
Example:<br>
- 1 order (with 2 hours)<br>
- 1 equipment<br>
- 24 hours planning time with 1 timeslot per minute<br>
- Possible order positions = 22 * 60 = 1320 (on one
equipment)<br>
- Possible order positions = 1320 * 3 = 3960 (on
three equipment)<br>
- Possible order positions = 3960 * 35 = 138.600 (all
orders on all equipment)<br>
<br>
<br>
rule "Check order not allocate to less."<br>
<br>
when<br>
$f : Order( $quantity : quantity , $m :
material )<br>
<br>
$result : Number( (intValue > 0)
&& ( intValue < $quantity ) )<br>
from accumulate(<br>
EquipmentAllocation( order != null
&& order == $f , $sp : equipment.speedMap ),<br>
sum($sp.get($m))<br>
)<br>
then<br>
int hard = $result.intValue() - $quantity;<br>
scoreHolder.addHardConstraintMatch(kcontext,
hard );<br>
end<br>
<br>
<br>
rule "Check order not allocate to many."<br>
<br>
when<br>
$f : Order( $quantity : quantity , $m :
material )<br>
<br>
$result : Number( (intValue > 0)
&& ( intValue > $quantity ) )<br>
from accumulate(<br>
EquipmentAllocation(order != null
&& order == $f , $map : equipment.orderMap )<br>
sum( $map.get( $f ))<br>
)<br>
then<br>
int hard = $quantity - $result.intValue();<br>
scoreHolder.addHardConstraintMatch(kcontext,
hard );<br>
end<br>
<br>
<br>
rule "Check demand"<br>
<br>
when<br>
$m : Material( $stock : stock )<br>
<br>
$t : TimeSlot( $sequence : sequence )<br>
<br>
$sumDemand : Number( )<br>
from accumulate (<br>
Demand ( timeSlot.sequence <=
$sequence , material == $m , $quantity : quantity )<br>
sum( $quantity )<br>
)<br>
<br>
$sumAllocation : Number( ($stock + intValue
- $sumDemand.intValue()) < 0 )<br>
from accumulate (<br>
EquipmentAllocation( (order != null
&& order.material == $m) , timeSlot.sequence <=
$sequence , $sp : equipment.speedMap),<br>
sum( $sp.get($m) )<br>
)<br>
then<br>
scoreHolder.addHardConstraintMatch(kcontext, -1);<br>
end<br>
<br>
<br>
rule "Check min stock"<br>
<br>
when<br>
$m : Material( $stock : stock , $minStock :
minStock, $maxStock : maxStock )<br>
<br>
$t : TimeSlot( $sequenceT : sequence )<br>
<br>
$sumDemand : Number( )<br>
from accumulate (<br>
Demand ( timeSlot.sequence <=
$sequenceT , material == $m , $quantityDemand : quantity )<br>
sum( $quantityDemand )<br>
)<br>
<br>
$sumAllocation : Number( ($stock +
(intValue) - $sumDemand.intValue()) < $minStock )<br>
from accumulate (<br>
EquipmentAllocation( order != null
, order.material == $m , timeSlot.sequence <= $sequenceT
, $sp : equipment.speedMap ),<br>
sum( $sp.get($m) )<br>
)<br>
then<br>
scoreHolder.addHardConstraintMatch(kcontext, -1);<br>
end<br>
<br>
<br>
rule "Check max stock"<br>
<br>
when<br>
$t : TimeSlot( $sequence : sequence )<br>
<br>
$m : Material( $stock : stock , $maxStock :
maxStock )<br>
<br>
$sumDemand : Number( )<br>
from accumulate (<br>
Demand ( timeSlot.sequence <=
$sequence , material == $m, $quantityDemand : quantity)<br>
sum( $quantityDemand )<br>
)<br>
<br>
$sumAllocation : Number( ($stock + intValue
- $sumDemand.intValue()) > $maxStock )<br>
from accumulate (<br>
EquipmentAllocation( (order != null
&& order.material == $m) , timeSlot.sequence <=
$sequence , $sp : equipment.speedMap ),<br>
sum( $sp.get($m) )<br>
)<br>
then<br>
scoreHolder.addHardConstraintMatch(kcontext, -1);<br>
end</span><span
style="font-family:"Tahoma","sans-serif";color:black"
lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-family:"Tahoma","sans-serif";color:black"
lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"
style="mso-margin-top-alt:auto;margin-bottom:12.0pt"><span
style="font-family:"Tahoma","sans-serif";color:black;mso-fareast-language:DE">Gruß<br>
<br>
</span><b><span
style="font-size:12.0pt;font-family:"Tahoma","sans-serif";color:black;mso-fareast-language:DE">Michael
Mohr</span></b><b><span
style="font-size:12.0pt;font-family:"Arial","sans-serif";color:black;mso-fareast-language:DE"> </span></b><span
style="font-size:14.0pt;font-family:"Arial","sans-serif";color:black;mso-fareast-language:DE"><br>
</span><span
style="font-family:"Tahoma","sans-serif";color:black;mso-fareast-language:DE">Software
Engineer
</span><span
style="font-size:12.0pt;font-family:"Arial","sans-serif";color:black;mso-fareast-language:DE"><o:p></o:p></span></p>
<table class="MsoNormalTable" style="width:300.0pt"
cellpadding="0" border="0" width="400">
<tbody>
<tr>
<td style="width:37.5pt;padding:0cm 0cm 0cm 0cm"
width="50"><br>
</td>
<td style="padding:0cm 0cm 0cm 0cm"><br>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<br>
<hr>
<font color="Gray" face="Arial" size="1">CONFIDENTIALITY : This
e-mail and any attachments are confidential and may be
privileged. If you are not a named recipient, please notify the
sender immediately and delete the e-mail from your system. You
are not authorized to disclose the contents to another person,
to use it for any purpose or store or copy the information in
any medium.<br>
</font>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
rules-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a></pre>
</blockquote>
<br>
</body>
</html>