predictor.h 3.4 KB
#ifndef DEF_HPREDICTOR
#define DEF_HPREDICTOR

#include <vector>

class Predictor
{


public:

    Predictor(const std::vector < unsigned int > &v,
              const std::vector < float > &vWCt,
              const std::vector < float > &vWP,
              const std::vector < float > &vWE,
              const std::vector < std::vector < unsigned int > > &Nvs,
              //const std::vector < std::vector < float > > &NvWCps,
              const std::vector < std::vector < unsigned int > > &NvBs,
              const std::vector < std::vector < unsigned int > > &G2vertices,
              const std::vector < std::vector < std::vector < unsigned int > > > &G2Nv,
              const std::vector < std::vector < unsigned int > > &G2G1correspondance);

    ~Predictor();

    void predict(unsigned int T, float alphas, float alphar, float Po, unsigned int pseudoknotLevel,
                 unsigned int I, unsigned int seed, unsigned int nbHardCT);

    unsigned int get_iter_();

    std::vector < std::tuple < std::vector < unsigned int >, std::vector < float > > > get_best_cliques_();

    //std::vector < std::tuple < std::vector < unsigned int >, std::vector < float > > > get_cliques_();

    int dominate(std::vector < float > c1, std::vector < float > c2);

    bool approximatelyEqualAbsRel(float a, float b, float absEpsilon, float relEpsilon);

    bool paretoRespectHardCT(unsigned int nbHardCT);

    int findPseudoknotLevel (std::vector< unsigned int > clique, int add, int del);

    void printVector (int opt);

private:

    std::vector < unsigned int > vertices;

    std::vector < float > verticesWCt; /* user constraint weight */

    std::vector < float > verticesWP; /* probing weight */

    std::vector < float > verticesWE; /* energy weight */

    std::vector < std::vector < unsigned int > > Nv; /* vector of linked vertices for any vertex*/

    //std::vector < std::vector < float > > NvWCp; /* vector of compatibility of linked vertices for any vertex*/

    std::vector < std::vector < unsigned int > > NvB; /* vector of no linked vertices for any vertex*/

    std::vector < std::tuple < std::vector < unsigned int >, std::vector < float > > > cliques_; /*vector of cliques*/

    std::vector < unsigned int > tabu;

    std::vector < std::vector < unsigned int > > Csubopt;

    std::vector < std::vector < float > > Fcsubopt;

    std::vector < unsigned int > PA;

    std::vector < std::tuple< unsigned int, unsigned int, std::vector < float > > > OM;

    unsigned int L;

    std::vector < unsigned int > C; //clique

    std::vector < float > fc; //objective value of the clique

    std::vector < std::vector < unsigned int > > Cbest; // best solutions found so far Pareto front

    std::vector < std::vector < float > > fbest; // best objective value reached so far Pareto front

    std::vector < unsigned int > Cp; //last local optimum

    unsigned int w;  //counter for consecutive non-improving local optima

    unsigned int iter_;

    /* pseudoknot graphs */

    std::vector < std::vector < unsigned int > > G2vertices; /* vertex vectors of each G2 graphs
                                                              * vertices are sorted by the beginning of each interval */

    std::vector < std::vector < std::vector < unsigned int > > > G2Nv; /* Nv vectors of each G2 graphs */

    std::vector < std::vector < unsigned int > > G2G1correspondance; /* G1 vertex correspondance vector of each G2 graph */
};

#endif