Conversation
| #define MILQ_BINPACKING_HPP | ||
|
|
||
| #include <Schedule.hpp> | ||
| #include <string> |
There was a problem hiding this comment.
unused include
| #include <string> |
|
|
||
| #include <QuantumResourceManager.hpp> | ||
| #include <qdmi.h> | ||
| #include <vector> |
There was a problem hiding this comment.
unused include
| #include <vector> |
| @@ -0,0 +1,18 @@ | |||
| #ifndef MILQ_BINPACKING_HPP | |||
There was a problem hiding this comment.
I'd prefer #pragma once (this is e.g. also used in the passes repository)
|
|
||
| namespace milq | ||
| { | ||
| std::vector<JobProxy> convert_to_proxies(const std::vector<QuantumTask> &tasks); |
| #ifndef MILQ_BINPACKING_HPP | ||
| #define MILQ_BINPACKING_HPP | ||
|
|
||
| #include <Schedule.hpp> |
There was a problem hiding this comment.
Usually it's quotes for non-system headers:
#include "File.hpp" // user-written file include
#include <vector> // system header include|
|
||
| std::vector<Schedule> improve_population(std::vector<Schedule> &population) | ||
| { | ||
| auto population_copy = population; |
| } | ||
| if (!candidates.empty()) | ||
| { | ||
| std::uniform_int_distribution<int> candidate_distribution( |
There was a problem hiding this comment.
The end of the distribution is inclusive, so this can be out of bounds.
| for (auto &job : bucket->job_proxies) | ||
| { | ||
| auto &machine = *std::min_element( | ||
| schedule.get_machines().begin(), schedule.get_machines().end(), | ||
| [](const Machine *m1, const Machine *m2) | ||
| { return m1->capacity < m2->capacity; }); | ||
| if (machine->buckets.empty()) | ||
| { | ||
| // TODO proprose new cuts ore put them in multipile | ||
| // buckets if necessary | ||
| machine->buckets.push_back(bucket); | ||
| } | ||
| else | ||
| { | ||
| auto &smallest_bucket = *std::min_element( | ||
| machine->buckets.begin(), machine->buckets.end(), | ||
| [&machine](const Bucket *b1, const Bucket *b2) | ||
| { | ||
| return remaining_capacity(b1, machine->capacity) < | ||
| remaining_capacity(b2, machine->capacity); | ||
| }); | ||
| if (remaining_capacity(smallest_bucket, machine->capacity) < | ||
| job->num_qubits) | ||
| { | ||
| // TODO proprose new cuts ore put them in multipile | ||
| // buckets if necessary | ||
| machine->buckets.push_back(bucket); | ||
| } | ||
| else | ||
| { | ||
| smallest_bucket->job_proxies.push_back(job); | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
I'm not sure if this works. You iterate over the jobs, but then you are adding the whole bucket without breaking. I can't verify easily that this doesn't add jobs twice.
| return std::accumulate( | ||
| population.begin(), population.end(), 0, | ||
| [&x](int sum, Schedule &other) | ||
| { return sum + x.hamming_distance(other); }) < | ||
| std::accumulate( | ||
| population.begin(), population.end(), 0, | ||
| [&y](int sum, Schedule &other) | ||
| { return sum + y.hamming_distance(other); }); |
There was a problem hiding this comment.
The accumulates should go into separate lines for separability
| best_schedule = | ||
| current_best.get_makespan() < best_schedule.get_makespan() | ||
| ? current_best | ||
| : best_schedule; |
There was a problem hiding this comment.
Shouldn't this be somehow handled by the omp reduction? (I don't know this functionality)
This is a naive port of our
milqscheduler to C++.There are still multiple
TODOs to fix,and probably tons of performance improvements.The build seems fine @kayaercument how are we supposed to include the QRM?
Also, some things are missing compared to the QRM setup, like git hooks.
Some more todos: