www.pudn.com > ghs1.2.rar > ghs.h


/*
 * Copyright (c) 2000-2003 Illinois Institute of Technology.
 *                         All rights reserved.
 *
 * This file is part of the GHS software package.  For license
 * information, see the LICENSE file in the top level directory of the
 * GHS source distribution.
 *
 * Released Date: August 18 2005
 * This is the GHS I release by the
 *   SCS Group,
 *   http://www.cs.iit.edu/~scs
 *   Department of Computer Science,
 *   Illinois Institute of Technology.
 *
 * This release has been tested under SUN OS 5.9.
 *
 * Supervisor
 * ----------
 * Illiniois Institute of Technology:
 * -Dr. Xian-He Sun
 *
 * Author(s)
 * -----------------
 * Illinois Institute of Technology:
 * -Ming Wu
 * -Xian-He Sun
 *
 */
#ifndef GHS_HEADER_FLAG
#define GHS_HEADER_FLAG

#include
#include

using namespace std;

const int DEBUG_ON = 0; 
const int INVALID_PARA_VALUE = -1;
const int BUF_SIZE = 120; // Buffer's size
const int MAX_WS_NUM = 100;
const int MAX_GJOB_NUM = 1000;
const int MAX_PROC_NUM = 10000; //maximum process number during a measuremnt time interval
const int XNUM = 100;
const int PHASE_NUM = 20;
const int MAX_HOUR_SIZE = 50;
const int MAX_DAY_SIZE = 50;
const int MAX_HOUR = 7200;

struct _JobStatistics
{
        double arrivalRate;
        double serviceRate;
        vector lifetimes;
};

class GHSScheduler
{
  protected: 
    int wsNum;

    vector serv_p, servtmp, arri_p, servstd_p, work_p, speed_p, util_p;

    vector mUtil, mArri, mServSTD, mWork;

    double totalWorkload;

    // a list of machines status, 1 stands for the machine will be used
    vector machID;

    // 
    vector currWorkload;

    // sort the machines with (1-utilization)*speed
    vector machsOrder;

    vector firstItemIndex, lastItemIndex;

    vector machName;
    vector taskName;

    void AddArray();
    int IsArrayFull();
    void SortMachID();
    void GenerateMachID(int machNum);
    virtual void PlanRecord() = 0;
    virtual double CalculateRuntime(vector& machineArray) = 0;

  public:
    void GetResoPara(char *configFile);
    virtual void Initialize()=0;
    double OptimalSchedule();
    double HeuristicSchedule();
    virtual void OutputSchedule(char *outputfile)=0;
};

#endif // GHS_HEADER_FLAG