#include "paal/utils/functors.hpp"
#include "paal/utils/type_functions.hpp"
#include "paal/utils/assign_updates.hpp"
#include <boost/iterator/counting_iterator.hpp>
#include <boost/range/algorithm/sort.hpp>
#include <queue>
#include <vector>
#include <algorithm>
#include <utility>
Go to the source code of this file.
Namespaces | |
paal | |
global namespace of project. | |
paal::greedy | |
Greedy namespace. | |
Functions | |
template<class InputIterator , class OutputIterator , class GetTime , class GetDueDate , class GetReleaseDate > | |
auto | paal::greedy::scheduling_jobs_with_deadlines_on_a_single_machine (const InputIterator first, const InputIterator last, GetTime get_time, GetReleaseDate get_release_date, GetDueDate get_due_date, OutputIterator result) |
solve scheduling jobs on identical parallel machines problem and fill start time of all jobs example:
#include "paal/utils/irange.hpp"
#include <iostream>
#include <utility>
int main() {
// sample data
std::vector<Time> time = { 2.1, 3.1, 4.1, 5.1, 6.1, 7.1, 8.1 };
std::vector<Time> release = { 1, 2, 3, 4, 5, 6, 7 };
std::vector<Time> due_date = { -1, 0, -2, -3, -4, -5, -6 };
auto jobs = paal::irange(time.size());
std::vector<std::pair<decltype(jobs)::iterator, Time>> jobs_to_start_dates;
Time delay =
jobs.begin(), jobs.end(), [&](int i) { return time[i]; },
[&](int i) { return release[i]; },
[&](int i) { return due_date[i]; },
back_inserter(jobs_to_start_dates));
for (auto job_start_time : jobs_to_start_dates) {
std::cout << "Job " << (*job_start_time.first)
<< " Start time: " << job_start_time.second << std::endl;
}
// print result
std::cout << "Solution: " << delay << std::endl;
return 0;
}
example file is scheduling_jobs_with_deadlines_on_a_single_machine_example.cpp More... | |
Definition in file scheduling_jobs_with_deadlines_on_a_single_machine.hpp.