本研究探讨了在批处理机器上运用分支限界法优化作业调度问题的方法与成效,旨在提高任务执行效率和资源利用率。
#include
#include
using namespace std;
class MinHeapNode {
friend class Flowshop;
public:
bool operator<(const MinHeapNode &a) const { return a.bb < bb; }
private:
void Init(int n);
void NewNode(MinHeapNode, int, int, int, int);
int s; // 已安排作业数
int f1; // 机器 1 上最后完成时间
int f2; // 机器 2 上最后完成时间
int sf2; // 当前机器 2 上的完成时间和
int bb; // 当前完成时间和下界
int *x; // 当前作业调度
};
void MinHeapNode::Init(int n) {
x = new int[n];
for (int i = 0; i < n; ++i)
x[i] = i;
}