/*********************************************************************
 *  Author  : Tino Weinkauf and Wiebke Koepp
 *  Init    : Wednesday, March 28, 2018 - 11:45:51
 *
 *  Project : KTH Inviwo Modules
 *
 *  License : Follows the Inviwo BSD license model
 *********************************************************************
 */

#pragma once

#include "treeordercomputationsa.h"

class TemporalTreeOrderComputationSAConstraints
    : public TemporalTreeSimulatedAnnealing {
    // Friends
    // Types
public:
    // Construction / Deconstruction
public:
    TemporalTreeOrderComputationSAConstraints();
    virtual ~TemporalTreeOrderComputationSAConstraints() = default;

public:
    /// Resolve a single given constraint, either by choosing the best or a random resolution
    /// If multiple "best", choose at random from them
    void resolveConstraint(std::shared_ptr<const TemporalTree> tree, Constraint& constraint);

    /// Neighbor Solution from the current state
    void neighborSolution() override;

    /// Initalize everything
    void initializeResources() override;

    /// Reset only statistic things and settings
    void restart() override;

    void setLastToCurrent() override;

    void setCurrentToLast() override;

    void setBest() override;

    void prepareNextStep() override;

    /// Our main computation function
    virtual void process() override;

    // Ports
public:
    // Properties
public:
    /// Once a constraint to resolve has been choosen
    /// either choose the best one or random
    bool propResolveWithBest;

    // Attributes
private:
    /// All current unfulfilled constraints
    std::vector<size_t> unfulfilledConstraints;
};
