#ifndef PBCODEGEN_H_
#define PBCODEGEN_H_

#include <fstream>
#include <string>
#include <sstream>
#include <map>
#include <vector>
#include "include/bas/CosiGlobal.h"

namespace cosi {

namespace io {

namespace bas {

class PbCodeGen {
public:
	PbCodeGen(std::string pFileName);
	virtual ~PbCodeGen();
	void AddVariable(int pIndex);
	void AddToCostFunction(int pCoefficinet, int pIndex);
	void AddLessThanOrEqualToConstraint(std::map<int,int> pVarList, int pRhs);
	void AddGreaterThanOrEqualToConstraint(std::map<int,int> pVarList, int pRhs);
	void AddEqualityConstraint(std::map<int,int> pVarList, int pRhs);
	bool Run();
	bool GetValue(int Index);
private:
	std::map<int,std::string> mVariables;
	std::map< std::string , int > mName2Variable;
	std::string mFileName;
	std::map<int,int> mCostFuntion;
	std::vector<std::map<int,int> > mLeqLhs;
	std::vector< int > mLeqRhs;
	std::vector<std::map<int,int> > mGeqLhs;
	std::vector< int > mGeqRhs;
	std::vector<std::map<int,int> > mEqLhs;
	std::vector< int > mEqRhs;
	std::map<int,bool> mResult ;
};

}
}
}

#endif /*PBCODEGEN_H_*/
