#ifndef CPU_KNAPSACK_PARALLEL_HPP
#define CPU_KNAPSACK_PARALLEL_HPP

#include "data.hpp"

#include <algorithm>


class ParallelImplementation
{
private:
	// this function is not actualy used in serial implementation, but it may be handy...
	std::pair<std::uint64_t, std::uint64_t> getSizeAndPriority(const items_t& items, selection_t selection)
	{
		std::uint64_t size = 0;
		std::uint64_t priority = 0;
		for (std::size_t i = 0; i < items.size(); ++i) {
			if ((selection >> i) & 1) {
				size += items[i].size;
				priority += items[i].priority;
			}
		}
		return { size, priority };
	}

	void backtrack(const items_t& items, std::size_t index, selection_t selection, std::uint64_t size, std::uint64_t priority)
	{
	}
public:
	ParallelImplementation(std::size_t items, std::uint64_t minSize, std::uint64_t maxSize)
	{
		// any allocation of supporting data structures can be done here (size is the number of log records)
	}

	// The best priority is returned and the result vector is filled with selections.
	std::uint64_t operator()(const items_t &items, result_t &result)
	{
	}
};


#endif
