//
// CString.h/
//

#include "interface.h"

#ifdef consoleOut
#include <iostream>
using namespace std;
#endif

#ifndef _CString_
  #define _CString_

class InnerForm;

//
// reprezentace retezce reprezentujiciho aktualni prirazeni hodnot promennym
//
class CString
{
 public:

  CString(int lengthB);
  CString(const CString& _cstring);
  ~CString();

//  int fitness(InnerForm *inner, int fitnessSelected, int position=0);
  int fitness(InnerForm *inner, int fitnessSelected);
  int clausesUnsat(InnerForm *inner);
  int clausesSat(InnerForm *inner);
  int improvement(InnerForm *inner, int position);
  int weightedSat(InnerForm *inner);

  int length() const{return lengthB;}
  bool& operator[](int) const;
  CString& operator=(const CString& _cstring);
  bool operator==(const CString& _cstring);

  #ifdef consoleOut
  friend ostream& operator<<(ostream &o, const CString & cstr);
  #endif

  char * toString();
 protected:
  int lengthB;
  bool *varList;
};

//
// reprezentace vnitrni formy
//
class InnerForm
{
  public:
  InnerForm(){};

  #ifdef consoleOut
  void print();
  #endif

  int **clauses;
  int numberOfClauses;
  int numberOfVariables;
  int *weightTable; //pole vah jednotlivych promennych

  //penalizace pro kazdou nesplnenou metodu v pripade pouziti fitness funkce maxsat2
  int unsatPenalty;

};
#endif
