⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cell.h

📁 文化算法的实际应用
💻 H
字号:
#ifndef CAEP_CELL_H
#define CAEP_CELL_H
#include <iostream>
#include <vector>
#include "config.h"
using namespace std;

namespace CAEP
{
	class Cell
	{
	private:

	public:
		CellType mCellType;
		int mDepth;
		vector<int> mDimension;
		int mFeasibleCount;
		int mUnFeasibleCount;
		vector<float> mLowNode;
		vector<float> mHighNode;
		vector<Cell*> mSon;
		Cell *mFather;	
		Configer &mConfiger;

		Cell(Configer& cfg):mConfiger(cfg),mDimension(cfg.TreeDim),mLowNode(cfg.VariableCount),mHighNode(cfg.VariableCount),mSon(cfg.TreeNodeCount)
		{

		}

		~Cell()
		{
			for(int i = 0; i < mSon.size(); i++)
			{
				delete mSon[i];
			}
		}
		
		static Cell* Near(int prioridad, Cell* node)
		{
			int i;
			Cell *res;

			for (; node->mFather != NULL; node = node->mFather) {
				for (i = 0; i <node->mSon.size(); i++) {
					if (node->mFather->mSon[i] == node) {
						continue;
					}
					res = Find(prioridad, node->mFather->mSon[i]);
					if (res != NULL) {
						return res;
					}
				}
			}
			return NULL;
		}

		static Cell* Find(int prioridad, Cell* node)
		{
			int i;
			Cell *res;

			if (node->mDimension[0] == -1) {
				if (node->mCellType <= prioridad) {
					return node;
				}
				else {
					return NULL;
				}
			}

			for (i = 0; i < node->mSon.size(); i++) {
				res = Find(prioridad, node->mSon[i]);
				if (res != NULL) {
					return res;
				}
			}
			return NULL;
		}
	};
}
#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -