Commit 97a82b26 authored by EYRAUD-DUBOIS Lionel's avatar EYRAUD-DUBOIS Lionel

New online algorithm: ECT

parent c31c2af0
......@@ -4,6 +4,7 @@
#include <OnlineZhang.h>
#include <TrueHeteroPrio.h>
#include <OnlineQA.h>
#include <OnlineECT.h>
#include "algorithm.h"
#include "listAlgorithm.h"
......@@ -298,6 +299,8 @@ Algorithm* createAlg(const string& name, const AlgOptions& options) {
alg = new ReproduceAlgorithm(options);
if(name == "qa")
alg = new OnlineQA(options);
if(name == "ect")
alg = new OnlineECT(options);
#ifdef WITH_CPLEX
if(name == "lp")
alg = new SchedLPIndep(options);
......
//
// Created by eyraud on 31/08/18.
//
#ifndef PMTOOL_ONLINEECT_H
#define PMTOOL_ONLINEECT_H
#include "OnlineGeneric.h"
class OnlineECT : public OnlineGeneric {
public:
OnlineECT(const AlgOptions &options);
public:
int assignTask(int task, double now) override;
};
#endif //PMTOOL_ONLINEECT_H
......@@ -27,7 +27,7 @@ protected:
std::vector<int> nbScheduledPredecessors;
int getEarliestWorker(int type);
int getEarliestWorker();
int getEarliestFinishWorker(int task, double now);
int verbosity;
};
......
......@@ -15,7 +15,7 @@ set(SCHED_SRC
availSequence.cpp
GreedyAlgorithm.cpp
HeftAlgorithm.cpp
OnlineZhang.cpp ../include/OnlineZhang.h GreedyPerType.cpp ../include/GreedyPerType.h TrueHeteroPrio.cpp ../include/TrueHeteroPrio.h OnlineGeneric.cpp ../include/OnlineGeneric.h OnlineQA.cpp ../include/OnlineQA.h)
OnlineZhang.cpp ../include/OnlineZhang.h GreedyPerType.cpp ../include/GreedyPerType.h TrueHeteroPrio.cpp ../include/TrueHeteroPrio.h OnlineGeneric.cpp ../include/OnlineGeneric.h OnlineQA.cpp ../include/OnlineQA.h OnlineECT.cpp ../include/OnlineECT.h)
if(CPLEX_FOUND)
set(SCHED_SRC ${SCHED_SRC} SchedLPIndep.cpp ../include/SchedLPIndep.h AreaRound.cpp ../include/AreaRound.h)
......
//
// Created by eyraud on 31/08/18.
//
#include "OnlineECT.h"
int OnlineECT::assignTask(int task, double now) {
return getEarliestFinishWorker(task, now);
}
OnlineECT::OnlineECT(const AlgOptions &options) : OnlineGeneric(options) {
}
......@@ -62,11 +62,17 @@ int OnlineGeneric::getEarliestWorker(int type) {
return res;
}
int OnlineGeneric::getEarliestWorker() {
int res = 0;
for(int w = 1; w < ins->totalWorkers; ++w)
if(finishTimes[w] < finishTimes[res])
res = w;
int OnlineGeneric::getEarliestFinishWorker(int task, double now) {
int res = getEarliestWorker(0);
double best = max(now, finishTimes[res]) + ins->execType(0, task);
for(int w = 1; w < ins->nbWorkerTypes; ++w) {
double worker = getEarliestWorker(w);
double endTime = max(now, finishTimes[worker]) + ins->execType(w, task);
if(endTime < best) {
res = worker;
best = endTime;
}
}
return res;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment