//---------------------------------------------------------------------------
#ifndef boomH
  #define boomH
//---------------------------------------------------------------------------
/* tracking: 1 = CD-S 2 = reduction 4 = Cover */
  #define trck 0
  #define mintrck 0


//---------------------------------------------------------------------------
struct DecompositionOptions;
//struct Notation;
//struct TGauge;
//---------------------------------------------------------------------------

struct CD_Opts;
struct Cov_Opts;

struct MinimizeOptions
{
  // CD-S
  CD_Opts * cdopts;
  Cov_Opts * covopts;

  // IE
  int IE_type;          // 0=SQ, 1=distrib_multi, 2=distrib_EXH, 3=multi, 4=EXH
  // dominance
  int DOM_type;         // 0=none, 1=duplicity, 2=dominance
  // IR
  int IR_no;            // 1=no IR
  int IR_mutations;     // mutations

  int OR_no;            // 1 = no OR
  // IC
  int IC_type;          // 0=compare, 1=tree
  int IC_memory;        // 1=implicant check memory

  // cover
  int COV_end;          // 1 = endcover only
  int COV_somin;        // 1 = single-output minimization



  int STOP_time;
  float STOP_maxtime;
  int STOP_iterations;
  int STOP_maxiterations;
  int STOP_improvement;
  int STOP_improvementint;
  int STOP_optimization;
  int STOP_optimizationval;

  int OPT_crit;

  int CD_no;            // 1=no CD-S
  
  // notation
  Notation not;           // for saving as equations
  bool savevarnames;        //  generate names when none are specified (for PLA)

  int DECOMP_enable;    // 1 = enable decomposition
  DecompositionOptions * dopts;           // decomposition options

  int DFT_enable;

  int FC_DF_dir;        // 0 = 1:x, 1 = x:1, 2 = scatter
  int FC_DF;

  int CD_FC;            // 0 = CD-S only, 100 = FC-Min only
};
//---------------------------------------------------------------------------

struct MinInfo
{
  int cyc;
  float tm;
  float CPUtm;
  int F_hits;
  int tries;
};

//---------------------------------------------------------------------------
class TBuffers;
class TermTree;

class Boom
{
public:
    MinimizeOptions * mo;
    TGauge gauge;
    MinInfo info;

    Boom();
    ~Boom();
    class TBoolFnct * Minimize( TBoolFnct * srcf );

private:
    TermTree * * i_buffer; // CD-search buffer for each output (hist)
    TBoolFnct * e_buffer; // CD/IE-phase buffer (shist)
    TBoolFnct * r_buffer; // IR-phase buffer (allf)
    TermTree * primes_ie; // primes after IE (PrHist)
    TermTree * * offtree; // offset tree
    TermTree * * imp_test; //


    void InitBuffers( TBoolFnct * srcf );
    void DeleteBuffers( TBoolFnct * srcf );
    TBoolFnct * OneMinStep( TBoolFnct * srcf, TBoolFnct * allf );
    TBoolFnct * OneFCMinStep( TBoolFnct * srcf, TBoolFnct * allf );
};

#endif
