28 typedef std::pair<Time, char> Job;
30 auto returnJobTimeFunctor = [](Job job) {
return job.first; };
33 int numberOfMachines = 3;
34 std::vector<Job> jobs = { { 2.1,
'a' },
41 std::vector<std::pair<int, decltype(jobs)::iterator>> result;
44 numberOfMachines, jobs.begin(), jobs.end(), back_inserter(result),
45 returnJobTimeFunctor);
47 std::vector<Time> sumOfMachine;
48 sumOfMachine.resize(numberOfMachines);
49 for (
auto machineJobPair : result) {
50 auto machine = machineJobPair.first;
51 auto job = machineJobPair.second;
52 sumOfMachine[machine] += job->first;
53 std::cout <<
"On machine: " << machine <<
" do job: " << job->second
57 *std::max_element(sumOfMachine.begin(), sumOfMachine.end());
60 std::cout <<
"Solution:" << maximumLoad << std::endl;
int main()
[Scheduling Jobs On Identical Parallel Machines Example]
void scheduling_jobs_on_identical_parallel_machines(int n_machines, InputIterator first, InputIterator last, OutputIterator result, GetTime get_time)
detail
double Time
[Scheduling Jobs Example]