算法设计——贪心算法——多机调度问题
发布时间
阅读量:
阅读量
针对此类问题,可通过采用贪心策略来构建性能较为优越的近似求解方法,但需注意该方法并不能保证获得全局最优解。
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<algorithm>
using namespace std;
typedef struct Node
{
int hour;//记录该作业的所需要完成的时间
int number;//记录该作业在原来的序列的顺序
}node;
bool cmp(node x,node y)
{
if(x.hour>y.hour)
return true;
else
return false;
}
void MultiMachine(Node node[], int machine_number, int *machine_operation, int *machine_time[],int job_number)
{
int rear[job_number];
//安排前机器数(机器的个数)个作业
for (int
全部评论 (0)
还没有任何评论哟~
