#include "scip/scip.h"
#include "BranchingConstraints.h"
#include "Pricer.h"
#include "objscip/ObjBranchrule.h"
#include "Variable.h"

using namespace scip;
using namespace std;

class Branching : public ObjBranchrule
{
public:

	/** Constructs the pricer object with the data needed */
	Branching(
		SCIP*                   scip,							/**< SCIP pointer */
		Pricer*					_objPricer,						/**< pricer pointer */
		double					_eps
	);


	/** creates the multinode branching rule and includes it in SCIP */
	SCIP_RETCODE SCIPincludeBranchruleMyBranchRule(
		SCIP*                 scip                /**< SCIP data structure */
	);


	virtual		SCIP_DECL_BRANCHCOPY(scip_copy);

	virtual 	SCIP_DECL_BRANCHFREE(scip_free);

	virtual 	SCIP_DECL_BRANCHINIT(scip_init);

	virtual 	SCIP_DECL_BRANCHEXIT(scip_exit);

	virtual 	SCIP_DECL_BRANCHINITSOL(scip_initsol);

	virtual 	SCIP_DECL_BRANCHEXITSOL(scip_exitsol);

	virtual 	SCIP_DECL_BRANCHEXECLP(scip_execlp);

	virtual 	SCIP_DECL_BRANCHEXECEXT(scip_execext);

	virtual 	SCIP_DECL_BRANCHEXECPS(scip_execps);

	bool findArcBranchCand(
		SCIP*					scip							/**< SCIP data structure */
	);


	SCIP_RETCODE branchArc(
		SCIP*               scip				/**< SCIP data structure */
	);



	vector<BranchingConstraints>* getBranchingCons() {
		return objPricer->getBranchingConstraintsAtANode();
	}


	/** return node constraint */
	inline SCIP_CONS* getNodeCon(int node)
	{
		return objPricer->getCustomerCon(node);
	}

	inline int getNumberOfNodes() {
		return objPricer->getNumNodes();
	}

	inline Pricer* getPricer() {
		return objPricer;
	}

	inline double getEps() {
		return eps;
	}


	inline int getStartCustomerId() {
		return startCustomerId;
	}

	inline void setStartCustomerId(int _startCustomerId) {
		startCustomerId = _startCustomerId;
	}


	inline void setEndCustomerId(int _endCustomerId) {
		endCustomerId = _endCustomerId;
	}

	inline int getEndCustomerId() {
		return endCustomerId;
	}

	inline SCIP_CONS* getBranchCandidate() {
		return branchCandidate;
	}

	inline void setBranchCandidate(SCIP_CONS* _branchCandidate) {
		branchCandidate = _branchCandidate;
	}



private:
	Pricer*					objPricer;			/**< pricer pointer */
	double					eps;
	int						startCustomerId;
	int						endCustomerId;
	SCIP_Cons*				branchCandidate;	/**< should refer to the branching candidate*/

};