# 能量最小化初探，graphcuts能量最小化调用

梯度下降

模拟退火

图割

2.这个 跟最优化问题的求解，有什么联系跟区别呢？

3.这个能量的观点是否跟信息熵类似，让系统的熵最小？

/* energy.h */
/* Vladimir Kolmogorov (vnk@cs.cornell.edu), 2003. */

/*
This software implements an energy minimization technique described in

What Energy Functions can be Minimized via Graph Cuts?
To appear in IEEE Transactions on Pattern Analysis and Machine Intelligence (PAMI).
Earlier version appeared in European Conference on Computer Vision (ECCV), May 2002.

More specifically, it computes the global minimum of a function E of binary
variables x_1, ..., x_n which can be written as a sum of terms involving
at most three variables at a time:

E(x_1, ..., x_n) = \sum_{i}     E^{i}    (x_i)
+ \sum_{i,j}   E^{i,j}  (x_i, x_j)
+ \sum_{i,j,k} E^{i,j,k}(x_i, x_j, x_k)

The method works only if each term is "regular". Definitions of regularity
for terms E^{i}, E^{i,j}, E^{i,j,k} are given below as comments to functions

This software can be used only for research purposes. IF YOU USE THIS SOFTWARE,
YOU SHOULD CITE THE AFOREMENTIONED PAPER IN ANY RESULTING PUBLICATION.

In order to use it, you will also need a MAXFLOW software which can be
obtained from http://www.cs.cornell.edu/People/vnk/software.html

Example usage
(Minimizes the following function of 3 binary variables:
E(x, y, z) = x - 2*y + 3*(1-z) - 4*x*y + 5*|y-z|):

///////////////////////////////////////////////////

#include <stdio.h>
#include "energy.h"

void test_energy()
{
// Minimize the following function of 3 binary variables:
// E(x, y, z) = x - 2*y + 3*(1-z) - 4*x*y + 5*|y-z|

Energy::Var varx, vary, varz;
Energy *e = new Energy();

//e -> add_term2(x, y, 0, 0, 0, -4); // add term -4*x*y
//e -> add_term2(y, z, 0, 5, 5, 0); // add term 5*|y-z|

Energy::TotalValue Emin = e -> minimize();

printf("Minimum = %d\n", Emin);
printf("Optimal solution:\n");
printf("x = %d\n", e->get_var(varx));
printf("y = %d\n", e->get_var(vary));
printf("z = %d\n", e->get_var(varz));

delete e;
}

///////////////////////////////////////////////////
*/

boykov跟kolmogorkov与2001年提出的一种新的最大流最小割算法，该算法基于增广路算法，通过扩展，标记，更新被标记的节点，形成新的搜索树，并不断重复。

193 篇文章32 人订阅

0 条评论