#ifndef SOLUTION_H
#define SOLUTION_H

#include "Instance.h"  // Include necessary headers
#include "Tour.h"


struct Solution;
struct ModifiedSolution;

struct Solution {
    const Instance& instance;
    float totalCosts;
    std::vector<Tour> tours;
    std::vector<int> customerToTourMap = { 0 }; // initialized with depot only

    Solution(const Instance& instance);

    Solution(const Instance& instance, const std::vector<std::vector<int>>& tours);

    void acceptModifiedSolution(ModifiedSolution & modSol);

    void generateCustomerToTourMap();

    std::vector<std::vector<int>> getTourList() const;

    std::size_t getHash();

    Solution& operator=(const Solution & other);
};

struct ModifiedSolution {
    Solution& originalSolution;
    const Instance& instance;
    float totalCosts;
    std::vector<int> removedToursId;
    std::vector<Tour> newTours;
    std::vector<int> nonInsertedNodes;

    ModifiedSolution(Solution& originalSolution);

    void removeCustomers(const std::vector<int>& A);

    std::unordered_set<int> destroy(float c_bar, int L_max, float alpha);

    void repair(const std::vector<int>& A, float beta, bool insertInNewToursOnly);

    ModifiedSolution& operator=(const ModifiedSolution& other);
};

#endif // SOLUTION_H