heur_listscheduling.c
Go to the documentation of this file.
18 * @brief scheduling specific primal heuristic which is based on bidirectional serial generation scheme.
23 * The heuristic performs a serial SGS (schedule generation scheme), see Kolisch and Hartmann 2006.
24 * Therefore, the jobs are considered in a topological order (e.g., sorted by their earliest start) and are scheduled
25 * according to that order as early as possible respecting the precedence and resource constraints.
27 * The serial generation scheme is extended to bidirectional SGS; see Li and Willis 1992. The first obtained
28 * schedule is the so-called forward schedule. Then, all jobs are sorted in non-increasing order of their completion
29 * times in the forward schedule. According to that ordering, a backward schedule is created by scheduling all jobs as
30 * late as possible again with respect to precedence and resource constraints. It gets clear from the way the algorithm
31 * works, that if a feasible forward schedule has been found, a feasible backward schedule can be obtained, since no job
32 * needs to be scheduled earlier as in the forward schedule. Recreating a forward schedule by sorting the jobs
33 * according to their start times in the backward schedule leads to a makespan not larger than the one in the first
38 * -# Rainer Kolisch and Sönke Hartmann. Experimental investigation of heuristics for resource-constrained
39 * project scheduling: An update. <em>European Journal of Operational Research</em>, 174(1):23–37, 2006.
44 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
58 #define HEUR_DESC "scheduling specific primal heuristic which is based on bidirectional serial generation scheme"
78 int** resourcedemands; /**< resource demands matrix (job i needs resourcedemands[i][j] units of resource j) */
132 SCIPdebug( SCIPdigraphPrintComponents(heurdata->precedencegraph, SCIPgetMessagehdlr(scip), NULL) );
134 SCIP_CALL( SCIPduplicateBlockMemoryArray(scip, &heurdata->capacities, capacities, nresources) );
141 SCIP_CALL( SCIPduplicateBlockMemoryArray(scip, &heurdata->resourcedemands[j], resourcedemands[j], nresources) );/*lint !e866*/
232 SCIP_CALL( SCIPprofileInsertCore(profiles[p], starttime, starttime + duration, demands[p], &pos, infeasible) );
239 /** retruns for the given job (duration and demands) the earliest feasible start time w.r.t. all profiles */
266 start = SCIPprofileGetEarliestFeasibleStart(profiles[r], est, lst, duration, demands[r], infeasible);
290 /** retruns for the given job (duration and demands) the earliest feasible start time w.r.t. all profiles */
312 start = SCIPprofileGetLatestFeasibleStart(profiles[r], 0, lst, duration, demands[r], infeasible);
335 /** collect earliest and latest start times for all variables in the order given in the variables array */
357 if( SCIPgetStage(scip) == SCIP_STAGE_SOLVING && SCIPgetLPSolstat(scip) == SCIP_LPSOLSTAT_OPTIMAL )
370 /** propagate the earliest start time of the given job via the precedence graph to all successors jobs*/
405 /** propagate the latest start time of the given job via the precedence graph w.r.t. all successors jobs */
429 /** perform forward scheduling, that is, assigned jobs (in the given ordering) to their earliest start time, propagate
481 starttimes[idx] = profilesFindEarliestFeasibleStart(profiles, nresources, starttimes[idx], lsts[idx], duration, demands, infeasible);
490 SCIP_CALL( profilesInsertJob(scip, profiles, nresources, starttimes[idx], duration, demands, infeasible) );
512 /** perform backward scheduling, that is, schedule jobs (in the ordering of their latest completion time) to their and
563 starttimes[idx] = profilesFindLatestFeasibleStart(profiles, nresources, starttimes[idx], duration, demands, infeasible);
568 SCIP_CALL( profilesInsertJob(scip, profiles, nresources, starttimes[idx], duration, demands, infeasible) );
672 if( SCIPgetStage(scip) == SCIP_STAGE_SOLVING && SCIPgetLPSolstat(scip) == SCIP_LPSOLSTAT_OPTIMAL )
680 /* in case the LP relaxation was solved to optimality we use the LP solution as initialized permutation */
694 /* in case the LP was not solved we use the topologically sorted variables w.r.t. precedences graph */
699 /* collect earliest and latest start times for all variables in the order given in the variables array */
709 * STEP 1: perform forward scheduling, that is, shift all jobs to the left as much as possible in the given ordering
711 SCIP_CALL( performForwardScheduling(scip, heurdata, starttimes, lsts, perm, &makespan, &infeasible) );
725 /* get permutation w.r.t. earliest start time given by the starttimes and reset the start time to the earliest start time */
728 SCIP_CALL( performForwardScheduling(scip, heurdata, starttimes, lsts, perm, &makespan, &infeasible) );
789 /** solving process initialization method of primal heuristic (called when branch and bound process is about to begin) */
792 /** solving process deinitialization method of primal heuristic (called before branch and bound process data is freed) */
850 SCIP_CALL( SCIPincludeHeurBasic(scip, &heur, HEUR_NAME, HEUR_DESC, HEUR_DISPCHAR, HEUR_PRIORITY,
888 SCIP_CALL( heurdataInit(scip, heurdata, precedencegraph, vars, durations, resourcedemands, capacities, njobs, nresources) );
static SCIP_RETCODE executeHeuristic(SCIP *scip, SCIP_HEUR *heur, SCIP_RESULT *result)
Definition: heur_listscheduling.c:645
void SCIPsortRealInt(SCIP_Real *realarray, int *intarray, int len)
static SCIP_DECL_HEURFREE(heurFreeListScheduling)
Definition: heur_listscheduling.c:759
Definition: type_result.h:33
Definition: type_result.h:47
Definition: struct_scip.h:59
SCIP_RETCODE SCIPdigraphComputeUndirectedComponents(SCIP_DIGRAPH *digraph, int minsize, int *components, int *ncomponents)
Definition: misc.c:7991
int * SCIPdigraphGetSuccessors(SCIP_DIGRAPH *digraph, int node)
Definition: misc.c:7721
static SCIP_RETCODE performBackwardScheduling(SCIP *scip, SCIP_HEURDATA *heurdata, int *starttimes, int *perm, SCIP_Bool *infeasible)
Definition: heur_listscheduling.c:516
Definition: struct_var.h:198
static SCIP_RETCODE heurdataInit(SCIP *scip, SCIP_HEURDATA *heurdata, SCIP_DIGRAPH *precedencegraph, SCIP_VAR **vars, int *durations, int **resourcedemands, int *capacities, int njobs, int nresources)
Definition: heur_listscheduling.c:94
static SCIP_RETCODE heurdataFree(SCIP *scip, SCIP_HEURDATA *heurdata)
Definition: heur_listscheduling.c:152
int SCIPprofileGetEarliestFeasibleStart(SCIP_PROFILE *profile, int est, int lst, int duration, int demand, SCIP_Bool *infeasible)
Definition: misc.c:7042
static SCIP_RETCODE getEstPermutation(SCIP *scip, int *starttimes, int *ests, int *perm, int njobs)
Definition: heur_listscheduling.c:589
void SCIPdigraphPrintComponents(SCIP_DIGRAPH *digraph, SCIP_MESSAGEHDLR *messagehdlr, FILE *file)
Definition: misc.c:8525
static SCIP_RETCODE constructSolution(SCIP *scip, SCIP_SOL *sol, SCIP_VAR **vars, int *starttimes, int nvars)
Definition: heur_listscheduling.c:188
void SCIPsortDownIntInt(int *intarray1, int *intarray2, int len)
int SCIPdigraphGetNComponents(SCIP_DIGRAPH *digraph)
Definition: misc.c:8186
SCIP_RETCODE SCIPincludeHeurBasic(SCIP *scip, SCIP_HEUR **heur, const char *name, const char *desc, char dispchar, int priority, int freq, int freqofs, int maxdepth, SCIP_HEURTIMING timingmask, SCIP_Bool usessubscip, SCIP_DECL_HEUREXEC((*heurexec)), SCIP_HEURDATA *heurdata)
Definition: scip_heur.c:108
SCIP_RETCODE SCIPprofileInsertCore(SCIP_PROFILE *profile, int left, int right, int demand, int *pos, SCIP_Bool *infeasible)
Definition: misc.c:6922
static SCIP_RETCODE performForwardScheduling(SCIP *scip, SCIP_HEURDATA *heurdata, int *starttimes, int *lsts, int *perm, int *makespan, SCIP_Bool *infeasible)
Definition: heur_listscheduling.c:433
void SCIPdigraphGetComponent(SCIP_DIGRAPH *digraph, int compidx, int **nodes, int *nnodes)
Definition: misc.c:8199
#define SCIPduplicateBufferArray(scip, ptr, source, num)
Definition: scip_mem.h:123
void SCIPheurSetData(SCIP_HEUR *heur, SCIP_HEURDATA *heurdata)
Definition: heur.c:1362
static void propagateEst(SCIP_DIGRAPH *precedencegraph, int *ests, int *lsts, int pred, int duration, SCIP_Bool *infeasible)
Definition: heur_listscheduling.c:372
SCIP_RETCODE SCIPdigraphTopoSortComponents(SCIP_DIGRAPH *digraph)
Definition: misc.c:8120
SCIP_RETCODE SCIPcreateOrigSol(SCIP *scip, SCIP_SOL **sol, SCIP_HEUR *heur)
Definition: scip_sol.c:556
Definition: struct_sol.h:64
static SCIP_DECL_HEUREXEC(heurExecListScheduling)
Definition: heur_listscheduling.c:798
SCIP_RETCODE SCIPincludeHeurListScheduling(SCIP *scip)
Definition: heur_listscheduling.c:834
#define SCIPduplicateBlockMemoryArray(scip, ptr, source, num)
Definition: scip_mem.h:96
Definition: type_result.h:35
void SCIPsortIntInt(int *intarray1, int *intarray2, int len)
SCIP_RETCODE SCIPsetHeurFree(SCIP *scip, SCIP_HEUR *heur, SCIP_DECL_HEURFREE((*heurfree)))
Definition: scip_heur.c:169
static int profilesFindEarliestFeasibleStart(SCIP_PROFILE **profiles, int nprofiles, int est, int lst, int duration, int *demands, SCIP_Bool *infeasible)
Definition: heur_listscheduling.c:241
static int profilesFindLatestFeasibleStart(SCIP_PROFILE **profiles, int nprofiles, int lst, int duration, int *demands, SCIP_Bool *infeasible)
Definition: heur_listscheduling.c:292
Definition: type_retcode.h:33
SCIP_RETCODE SCIPprofileCreate(SCIP_PROFILE **profile, int capacity)
Definition: misc.c:6657
Definition: struct_heur.h:88
Definition: type_lp.h:34
SCIP_RETCODE SCIPsetSolVal(SCIP *scip, SCIP_SOL *sol, SCIP_VAR *var, SCIP_Real val)
Definition: scip_sol.c:1212
public data structures and miscellaneous methods
int SCIPdigraphGetNSuccessors(SCIP_DIGRAPH *digraph, int node)
Definition: misc.c:7706
SCIP_RETCODE SCIPtrySolFree(SCIP *scip, SCIP_SOL **sol, SCIP_Bool printreason, SCIP_Bool completely, SCIP_Bool checkbounds, SCIP_Bool checkintegrality, SCIP_Bool checklprows, SCIP_Bool *stored)
Definition: scip_sol.c:3231
Definition: struct_misc.h:200
SCIP_RETCODE SCIPinitializeHeurListScheduling(SCIP *scip, SCIP_DIGRAPH *precedencegraph, SCIP_VAR **vars, int *durations, int **resourcedemands, int *capacities, int njobs, int nresources)
Definition: heur_listscheduling.c:861
static SCIP_RETCODE getLctPermuataion(SCIP *scip, int *starttimes, int *durations, int *perm, int njobs)
Definition: heur_listscheduling.c:617
Definition: type_set.h:44
int SCIPprofileGetLatestFeasibleStart(SCIP_PROFILE *profile, int est, int lst, int duration, int demand, SCIP_Bool *infeasible)
Definition: misc.c:7191
SCIPallocBlockMemory(scip, subsol))
static void collectEstLst(SCIP *scip, SCIP_VAR **vars, int *ests, int *lsts, int nvars)
Definition: heur_listscheduling.c:337
Definition: objbenders.h:33
Definition: struct_misc.h:210
SCIP_Real SCIPgetSolVal(SCIP *scip, SCIP_SOL *sol, SCIP_VAR *var)
Definition: scip_sol.c:1352
SCIP_RETCODE SCIPcopyDigraph(SCIP *scip, SCIP_DIGRAPH **targetdigraph, SCIP_DIGRAPH *sourcedigraph)
Definition: scip_datastructures.c:629
scheduling specific primal heuristic which is based on bidirectional serial generation scheme...
static SCIP_RETCODE profilesInsertJob(SCIP *scip, SCIP_PROFILE **profiles, int nprofiles, int starttime, int duration, int *demands, SCIP_Bool *infeasible)
Definition: heur_listscheduling.c:215
static void propagateLst(SCIP_DIGRAPH *precedencegraph, int *lsts, int pred, int duration)
Definition: heur_listscheduling.c:407