当前位置: 首页>>代码示例>>C++>>正文


C++ Energy::SetFullEdges方法代码示例

本文整理汇总了C++中Energy::SetFullEdges方法的典型用法代码示例。如果您正苦于以下问题:C++ Energy::SetFullEdges方法的具体用法?C++ Energy::SetFullEdges怎么用?C++ Energy::SetFullEdges使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Energy的用法示例。


在下文中一共展示了Energy::SetFullEdges方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main(int argc, char* argv[])
{
	if (0)
	{
		Energy* g = ReadUAI("../grid4x4.UAI.LG");
		
		g->SetFullEdges(1);
		
		Energy::Options options;
		options.method = Energy::Options::MPLP;
		options.iter_max = 100;
		g->Solve(options);
		exit(1);
	}

	int i;

	char* filename = NULL;
	char* save_filename = NULL;
	char* save_rep_filename = NULL;
	bool BLP_relaxation = false;
	bool FULL_relaxation = false;
	bool FULLDUAL_relaxation = false;
	int FULL_relaxation_flag = 0;
	int FULLDUAL_relaxation_flag = 0;
	bool print_stats = false;
	
	Run* current = new Run;

	Block<Run*> run_list(10);
	Run** run_ptr = run_list.New();
	*run_ptr = current;

	for (i=1; i<argc; i++)
	{
		if (argv[i][0] == '+' && !argv[i][1])
		{
			current = new Run;
			run_ptr = run_list.New();
			*run_ptr = current;
			continue;
		}
		if (argv[i][0] != '-')
		{
			if (filename) { printf("Error: filename can be specified only once\n"); ShowUsage(argv[0]); }
			filename = argv[i];
			continue;
		}
		if (!strcmp("h", &argv[i][1]))
		{
			ShowUsage(argv[0], true);
		}
		if (!strncmp("save=", &argv[i][1], 5))
		{
			if (save_filename) { printf("Error: save filename can be specified only once\n"); ShowUsage(argv[0]); }
			save_filename = &argv[i][1+5];
			continue;
		}
		if (!strncmp("saverep=", &argv[i][1], 8))
		{
			if (save_filename) { printf("Error: save filename can be specified only once\n"); ShowUsage(argv[0]); }
			save_rep_filename = &argv[i][1+8];
			continue;
		}
		if (!strncmp("t=", &argv[i][1], 2))
		{
			if (current->tighten_filename) { printf("Error: tightening filename can be specified only once\n"); ShowUsage(argv[0]); }
			current->tighten_filename = &argv[i][1+2];
			continue;
		}
		if (!strncmp("iter=", &argv[i][1], 5))
		{
			current->options.iter_max = atoi(&argv[i][1+5]);
			continue;
		}
		if (!strncmp("time=", &argv[i][1], 5))
		{
			current->options.time_max = atof(&argv[i][1+5]);
			continue;
		}
		if (!strncmp("eps=", &argv[i][1], 4))
		{
			current->options.eps = atof(&argv[i][1+4]);
			continue;
		}
		if (!strcmp("SRMP", &argv[i][1]))
		{
			current->options.method = Energy::Options::SRMP;
			continue;
		}
		if (!strcmp("CMP", &argv[i][1]))
		{
			current->options.method = Energy::Options::CMP;
			continue;
		}
		if (!strcmp("MPLP", &argv[i][1]))
		{
			current->options.method = Energy::Options::MPLP;
			continue;
		}
//.........这里部分代码省略.........
开发者ID:UIKit0,项目名称:SRMP,代码行数:101,代码来源:example.cpp


注:本文中的Energy::SetFullEdges方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。