Commit 68759622 authored by EYRAUD-DUBOIS Lionel's avatar EYRAUD-DUBOIS Lionel
Browse files

Option to NSHP to give a disturbed instance to the underlying THP

Used to test if the idea works in a disturbed environment
parent 83a23a85
......@@ -14,6 +14,7 @@ class NoStealHeteroPrio : public GreedyAlgorithm {
private:
int min_queue_size = 2;
double threshold;
double disturb;
std::vector<std::vector<int>> queues;
std::vector<double> expectedWorkerEndTimes;
std::vector<double> taskFinish;
......@@ -23,6 +24,8 @@ private:
bool is_clone = false;
double last_clone_time;
NoStealHeteroPrio* clone();
Instance* wrong_instance = NULL;
public:
NoStealHeteroPrio(const AlgOptions &options);
......
......@@ -5,6 +5,7 @@
#include <iostream>
#include <limits>
#include <cmath>
#include <random>
#include "NoStealHeteroPrio.h"
using namespace std;
......@@ -108,12 +109,28 @@ void NoStealHeteroPrio::start() {
last_clone_time = 0;
PushIntoQueue* action = new PushIntoQueue(this);
rthp.begin(*ins, action);
if(disturb > 0) {
std::default_random_engine generator(1234);
std::uniform_real_distribution<double> distribution(1.0 - disturb, 1.0 + disturb);
if (wrong_instance)
delete wrong_instance;
wrong_instance = new RecFileInstance(ins->inputFile, ins->platformFile, false, false);
wrong_instance->autoMerge();
for(auto & values: wrong_instance->execTimes)
for(auto& value: values)
value = distribution(generator) * value;
rthp.begin(*wrong_instance, action);
} else {
rthp.begin(*ins, action);
}
}
NoStealHeteroPrio::NoStealHeteroPrio(const AlgOptions &options) : GreedyAlgorithm(options), rthp(options) {
min_queue_size = options.asInt("minsize", 2);
threshold = options.asDouble("threshold", 0);
disturb = options.asDouble("disturb", 0);
if(rthp.doComms) {
delete(rthp.itemManager);
rthp.doComms = false;
......
Supports Markdown
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