流水作业调度-动态规划

#include 
#include 

#define N 100

using namespace std;

/*----------作业*/
class Jobtype{
                public:
                        int operator <= (Jobtype a) const{
                                return (key <= a.key);
                        };
                        int key , index;
                        bool job;
};

Jobtype d[N];

/*----------排序*/
int cmp(Jobtype a , Jobtype b)
{
        return a.key < b.key;
}

/*--------------johnson算法*/
int FlowShop(int n , int a[] , int b[] , int c[])
{

        for(int i = 0 ; i < n ; i++){
                d[i].key = a[i] > b[i] ? b[i] : a[i];//按Johnson法则分别取对应的b[i]或a[i]值作为关键字
                d[i].job = a[i] <= b[i];//给符合条件a[i]>n;
        int a[n] , b[n] , c[n];
        cout<<"请输入作业在 M1 M2 上的作业时间:"<>a[i]>>b[i];
        int mintime = FlowShop(n , a , b , c);
        cout<<"作业完成最短时间为:"<

你可能感兴趣的:(算法,动态规划)