Skip to content
Snippets Groups Projects
Select Git revision
  • 89fe9c355ce91cffd2b2b61e57a252f4128fd5cf
  • master default protected
  • loss
  • producer
4 results

Beam.hpp

Blame
  • Beam.hpp 949 B
    #ifndef BEAM__H
    #define BEAM__H
    
    #include <vector>
    #include <string>
    #include "BaseConfig.hpp"
    #include "ReadingMachine.hpp"
    #include "Producer.hpp"
    
    class Beam
    {
      public :
    
      class Element
      {
        public :
    
        BaseConfig config;
        int nextTransition{-1};
        boost::circular_buffer<std::string> name{20};
        float meanProbability{0.0};
        int nbTransitions = 0;
        double totalProbability{0.0};
        bool ended{false};
        float entropy{0.0};
    
        public :
    
        Element(const Element & other, int nextTransition);
        Element(const BaseConfig & model);
      };
    
      private :
    
      std::size_t width;
      float threshold;
      std::vector<Element> elements;
      bool ended{false};
    
      public :
    
      Beam(std::size_t width, float threshold, BaseConfig & model, const ReadingMachine & machine);
      Element & operator[](std::size_t index);
      void update(ReadingMachine & machine, bool debug, std::optional<Producer> & producer);
      bool isEnded() const;
    };
    
    #endif