Writing Custom Batch Separation Rules

The Scheduler uses separation rules to define how arriving jobs are to be separated into batches.
Note:  See Writing a Custom Scheduler Rule for a summary of the steps required to create custom rules. For more details about the functions described in this topic, see the Scheduling Customization Guide, available for download from our Support site.

Batch Separation Rule Logic

Before you create custom batch separation rules and write the corresponding batch separation functions, you should understand the logic used by the batch separation function. When a job arrives at an operation with a batch definition specified, the batch separation function is called.

When the batch separation function is called, it determines which forming batch the arriving job should be placed into based on some characteristic such as item number, color, etc. If there are other jobs waiting to be processed by the batch, the arriving job can be combined with them; otherwise it creates a new forming batch.

Naming the Function

Your custom batch separation function can have any name that is not a standard user-callable function name.

Arguments


#include "factor.h"
FORMBAT *bsrl(ldp, batch)
LOAD *ldp;        /* pointer to the load */
BATCHDEF *batch;  /* pointer to the batch definition */

The function accepts two arguments, a pointer to load (Type: LOAD *) and a pointer to the batch (Type: BATCHDEF *).

Return Value

The function returns a pointer to the forming batch that this job should be should be added into, or NULL if it starts a new forming batch (Type: FORMBAT *).

Here is an example of a batch separation function based on item:


FORMBAT *bsrl (LOAD *ldp, BATCHDEF *batch)
/*-----------------------------------------------------------------
     Batch separation rule which separates arriving jobs into
     different batches based on the item number.
     ARGS:
       ldp - pointer to the arriving load (job)
       batch - pointer to the batch that this load will follow
     RETURNS: pointer to the forming batch
-----------------------------------------------------------------*/
{
     FORMBAT *fb;
     for ( fb = (FORMBAT *) csfsls(batch->btfmls);
           fb != NULL;
           fb = (FORMBAT *) csnxls((CSENTITY *) fb) )
     {
         /* Return this forming batch if its children have the same
            part as the load passed in, and the new quantity will be
            less than or equal to the maximum.  */
         if ((strcmp(fb->fbldp->loordp->orptpt->panum,
                     ldp->loordp->orptpt->panum) == 0) &&
             (fb->fbquant + sequfb(ldp, batch, batch->btqurl)
              <_ batch-="batch-">btmax))
         {
              Return(fb);
         }
     }
     /* return NULL if we couldn't find one */
     Return(NULL);
{
</_>

Installing the Custom Function

To make your custom separation function available to the Scheduler, you must "install" it from ucini1 by calling the function sedfsb. This function has two arguments in the following order:

  • The number of the batch separation rule for which your function contains custom logic.
  • The address of your batch separation function.

For example, to install the above example rule "bsrl" in rule position 39:


sedfsb (39, bsrl);