TAS:Pokročilé/Kurýr/en: Porovnání verzí
(založena nová stránka s textem „The following code will be needed in PostImportJobsCompute:“) |
(Stránka aktualizována, aby odpovídala nové verzi zdrojové stránky) |
||
(Není zobrazena jedna mezilehlá verze od jednoho dalšího uživatele.) | |||
Řádek 1: | Řádek 1: | ||
<languages /> | <languages /> | ||
The courier module is not a "classic" module, it is a modification of [https://wiki.solvertech.cz/wiki/TAS:Pokro%C4%8Dil%C3%A9/Pluginy/Input,_Output/Import/ScenarioImporter ScenarioImporter] and possibly [https://wiki.solvertech.cz/wiki/TAS:Pokro%C4%8Dil%C3%A9/Pluginy/Input,_Output/Import/SolverTech.Tasha.PlugIns.Commands.PostImportJobsCompute PostImportJobsCompute] so that Tasha finds the prices of each carrier, finds the cheapest one (mostly) and compares it with the price of the shipment. | The courier module is not a "classic" module, it is a modification of [https://wiki.solvertech.cz/wiki/TAS:Pokro%C4%8Dil%C3%A9/Pluginy/Input,_Output/Import/ScenarioImporter ScenarioImporter] and possibly [https://wiki.solvertech.cz/wiki/TAS:Pokro%C4%8Dil%C3%A9/Pluginy/Input,_Output/Import/SolverTech.Tasha.PlugIns.Commands.PostImportJobsCompute PostImportJobsCompute] so that Tasha finds the prices of each carrier, finds the cheapest one (mostly) and compares it with the price of the shipment. | ||
Aktuální verze z 24. 3. 2023, 10:18
The courier module is not a "classic" module, it is a modification of ScenarioImporter and possibly PostImportJobsCompute so that Tasha finds the prices of each carrier, finds the cheapest one (mostly) and compares it with the price of the shipment.
General
Within the ScenarioImporter you need to add the dynamic columns needed for the calculation. We can only recommend a "civilized" naming of the columns so that it is clear what is contained in the column. The "price1" column probably doesn't tell much, the "geis1zone" column is better.
Comment on the code. Courier is one of the more complex calculations, and when you return to the code after a long time (or a colleague has to deal with it), you will appreciate the comments.
Determining the carrier's price using the weight of the shipment
One of the most common calculations.
Let's work from the carrier DPD with the following price list:
Weight | Price |
to 15 kg | 79 Kč |
16 - 50 kg | 119 Kč |
51 - 100 kg | 159 Kč |
Within ScenarioImporter you will need the following code (demand1 is the weight of the shipment and is already defined):
<ColumnsCalculated> <string>dynamic;dpdcena;dynamic;dpdcena;stop1;demand1;;stop1demand1<101?159:dynamicdpdcena</string> <string>dynamic;dpdcena;dynamic;dpdcena;stop1;demand1;;stop1demand1<51?119:dynamicdpdcena</string> <string>dynamic;dpdcena;dynamic;dpdcena;stop1;demand1;;stop1demand1<16?79:dynamicdpdcena</string> </ColumnsCalculated>
The code says that if the weight of the shipment is less than 101 kg, the value 159 is entered in the dpdprice column. When evaluating the conditions, it is necessary to proceed either from the highest possible weight or from the lowest possible weight (then ">" is used).
'Determining the carrier's price when using zones
Let's work from the carrier Geis with the following price list:
to 15 kg | to 50 kg | to 100 kg | |
Prague | 59 | 119 | 159 |
Bohemia | 69 | 159 | 199 |
Moravia | 79 | 199 | 259 |
In ScenarioImporter you will need the following code:
<ColumnsCalculated> <string>dynamic;geiszona;dynamic;geiszona;dynamic;psc;;dynamicpsc>59999?3:dynamicgeiszona</string> <string>dynamic;geiszona;dynamic;geiszona;dynamic;psc;;dynamicpsc<60000?2:dynamicgeiszona</string> <string>dynamic;geiszona;dynamic;geiszona;dynamic;psc;;dynamicpsc<20000?1:dynamicgeiszona</string>
<string>dynamic;geis1zona;dynamic;geis1zona;stop1;demand1;;stop1demand1<101?159:dynamicgeis1zona</string> <string>dynamic;geis1zona;dynamic;geis1zona;stop1;demand1;;stop1demand1<51?119:dynamicgeis1zona</string> <string>dynamic;geis1zona;dynamic;geis1zona;stop1;demand1;;stop1demand1<16?59:dynamicgeis1zona</string>
<string>dynamic;geis2zona;dynamic;geis2zona;stop1;demand1;;stop1demand1<101?199:dynamicgeis2zona</string> <string>dynamic;geis2zona;dynamic;geis2zona;stop1;demand1;;stop1demand1<51?159:dynamicgeis2zona</string> <string>dynamic;geis2zona;dynamic;geis2zona;stop1;demand1;;stop1demand1<16?69:dynamicgeis2zona</string>
<string>dynamic;geis3zona;dynamic;geis3zona;stop1;demand1;;stop1demand1<101?259:dynamicgeis3zona</string> <string>dynamic;geis3zona;dynamic;geis3zona;stop1;demand1;;stop1demand1<51?199:dynamicgeis3zona</string> <string>dynamic;geis3zona;dynamic;geis3zona;stop1;demand1;;stop1demand1<16?79:dynamicgeis3zona</string>
<string>dynamic;cenageis;dynamic;cenageis;dynamic;geiszona;dynamic;geis1zona;;dynamicgeiszona==1?dynamicgeis1zona:dynamiccenageis</string> <string>dynamic;cenageis;dynamic;cenageis;dynamic;geiszona;dynamic;geis2zona;;dynamicgeiszona==2?dynamicgeis2zona:dynamiccenageis</string> <string>dynamic;cenageis;dynamic;cenageis;dynamic;geiszona;dynamic;geis3zona;;dynamicgeiszona==3?dynamicgeis3zona:dynamiccenageis</string> </ColumnsCalculated>
Determining price using distances
Let's work from the carrier TopTrans with the following price list:
to 100 km | to 300 km | to 700 km | |
to 15 kg | 59 | 119 | 159 |
16 - 50 kg | 69 | 159 | 199 |
51 - 100 kg | 79 | 199 | 259 |
In this case it is necessary to calculate both in ScenarioImporter and in PostImportJobsCompute.
In ScenarioImporter you will need the following code:
<ColumnsCalculated> <string>dynamic;toptrans100km;dynamic;toptrans100km;stop1;demand1;;stop1demand1<101?79:dynamictoptrans100km</string> <string>dynamic;toptrans100km;dynamic;toptrans100km;stop1;demand1;;stop1demand1<51?69:dynamictoptrans100km</string> <string>dynamic;toptrans100km;dynamic;toptrans100km;stop1;demand1;;stop1demand1<16?59:dynamictoptrans100km</string>
<string>dynamic;toptrans300km;dynamic;toptrans300km;stop1;demand1;;stop1demand1<101?199:dynamictoptrans300km</string> <string>dynamic;toptrans300km;dynamic;toptrans300km;stop1;demand1;;stop1demand1<51?159:dynamictoptrans300km</string> <string>dynamic;toptrans300km;dynamic;toptrans300km;stop1;demand1;;stop1demand1<16?119:dynamictoptrans300km</string>
<string>dynamic;toptrans700km;dynamic;toptrans700km;stop1;demand1;;stop1demand1<101?259:dynamictoptrans700km</string> <string>dynamic;toptrans700km;dynamic;toptrans700km;stop1;demand1;;stop1demand1<51?199:dynamictoptrans700km</string> <string>dynamic;toptrans700km;dynamic;toptrans700km;stop1;demand1;;stop1demand1<16?159:dynamictoptrans700km</string> </ColumnsCalculated>
The following code will be needed in PostImportJobsCompute:
<Equations> <string>cenatoptrans;cenatoptrans;toptrans700km;distance;;distance<701?toptrans700km:cenatoptrans</string> <string>cenatoptrans;cenatoptrans;toptrans300km;distance;;distance<701?toptrans300km:cenatoptrans</string> <string>cenatoptrans;cenatoptrans;toptrans100km;distance;;distance<701?toptrans100km:cenatoptrans</string> </Equations>
If the distance calculation is used, it is necessary to click on "Calculations of orders" after loading the orders (and correct calculation of the distance matrix).
If Tasha is to determine the optimal carrier, it is necessary to compare the prices of different carriers and props the lowest one into jobs.notservedpenalty (if PostImportJobsCompute is used, the comparison and assignment should be done there). During the solution process, Tasha will then decide whether it is more cost-effective to serve the shipment or leave it unserved (i.e. notservedpenalty will be less than the cost of the shipment).