Query improvements in the min cost flow algorithms.
- External flow and potential maps can be used.
- New query functions: flow() and potential().
- CycleCanceling also provides dual solution (node potentials).
- Doc improvements.
3 * This file is a part of LEMON, a generic C++ optimization library
5 * Copyright (C) 2003-2008
6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
7 * (Egervary Research Group on Combinatorial Optimization, EGRES).
9 * Permission to use, modify and distribute this software is granted
10 * provided that this copyright notice appears in all copies. For
11 * precise terms see the accompanying LICENSE file.
13 * This software is provided "AS IS" with no warranty of any kind,
14 * express or implied, and with no claim as to its suitability for any
19 #include <lemon/polynomial.h>
20 #include <lemon/dim2.h>
22 #include "test_tools.h"
25 using namespace lemon;
28 Polynomial<int> pi(5);
29 check(pi.deg()==5,"Something is wrong here.");
33 check(pi[1]==0,"Uninitialized elements should be(?) zero.");
35 Polynomial<double> pd=pi;
36 check(pd.deg()==5,"Something is wrong here.");
37 check(pd[0]==12,"Something is wrong here.");
38 check(pd[5]==3,"Something is wrong here.");
42 Polynomial<double> pd;
44 check(pd.deg()==5,"Something is wrong here.");
45 check(pd[0]==12,"Something is wrong here.");
46 check(pd[5]==3,"Something is wrong here.");
48 check(pd(0)==12,"Something is wrong here.");
49 check(pd(1)==22,"Something is wrong here.");
50 check(pd(2)==136,"Something is wrong here.");
52 check((pd*pi).deg()==10,"Something is wrong here.");
53 check((pd*pi)[10]==9,"Something is wrong here.");
54 check((pd*pi)[7]==42,"Something is wrong here.");
56 Polynomial<double> pd2=pd+pi;
57 check(pd2[5]==6,"Something is wrong here.");
60 check(pd2[5]==12,"Something is wrong here.");
63 check(pd2[5]==6,"Something is wrong here.");
64 check((pd-pi)[5]==0,"Something is wrong here.");
66 Polynomial<double> pdd=pd.derivate();
68 check(pdd==pd,"Something is wrong here.");
69 check(pd.deg()==4,"Something is wrong here.");
70 check(pd[4]==15,"Something is wrong here.");
73 Polynomial<double> pdi=pd.integrate();
75 check(pdi==pd,"Something is wrong here.");
76 check(pd.deg()==5,"Something is wrong here.");
77 check(pd[5]==3,"Something is wrong here.");
78 check(pd[0]==0,"Something is wrong here.");