37 vector<mpz_class> makeVector(mpz_class a, mpz_class b, mpz_class c, mpz_class d) {
38 vector<mpz_class> vec(4);
50 TermGrader grader(makeVector(0, 100, 10000, mpz_class(
"300000000000000007")), translator);
53 (grader, splitStrategy.get(),
false,
63 TermGrader grader(makeVector(1, -1, 0, 0), translator);
66 (grader, splitStrategy.get(),
true,
87 Term(
"10 0 0 0"),
Term(
"10 0 0 0")));
100 #define INNER_SIMP_TEST(strat, div, dom, degree, expectPivot) \
102 Term gotPivot(Term(expectPivot).getVarCount()); \
103 bool expectSimplify = !Term(expectPivot).isIdentity(); \
104 ASSERT_EQ(strat.getInnerSimplify \
105 (Term(div), Term(dom), degree, gotPivot), \
107 if (expectSimplify) { \
108 ASSERT_EQ(gotPivot, Term(expectPivot)); \
112 #define OUTER_SIMP_TEST(strat, div, dom, degree, expectPivot) \
114 Term gotPivot(Term(expectPivot).getVarCount()); \
115 bool expectSimplify = !Term(expectPivot).isIdentity(); \
116 ASSERT_EQ(strat.getOuterSimplify \
117 (Term(div), Term(dom), degree, gotPivot), \
119 if (expectSimplify) { \
120 ASSERT_EQ(gotPivot, Term(expectPivot)); \
126 TermGrader grader(makeVector(100, 10, 1, 0), translator);
130 (grader, splitStrategy.get(),
true,
133 (grader, splitStrategy.get(),
false,
137 all.consume(
Term(
"1 2 3 4"));
138 ASSERT_EQ(all.getMaximalValue(), mpz_class(
"123"));
140 one.beginConsuming();
141 one.consume(
Term(
"1 2 3 4"));
142 ASSERT_EQ(one.getMaximalValue(), mpz_class(
"123"));
170 TermGrader grader(makeVector(-100, -10, -1, 0), translator);
174 (grader, splitStrategy.get(),
true,
177 (grader, splitStrategy.get(),
false,
181 all.consume(
Term(
"1 2 3 4"));
182 ASSERT_EQ(all.getMaximalValue(), mpz_class(
"-123"));
184 one.beginConsuming();
185 one.consume(
Term(
"1 2 3 4"));
186 ASSERT_EQ(one.getMaximalValue(), mpz_class(
"-123"));
#define INNER_SIMP_TEST(strat, div, dom, degree, expectPivot)
#define OUTER_SIMP_TEST(strat, div, dom, degree, expectPivot)
TEST(OptimizeStrategy, Simplify)
#define ASSERT_TRUE(VALUE)
#define ASSERT_FALSE(VALUE)
static BigIdeal xx_yy_zz_t_xz_yz()
Returns .
Represents a monomial ideal with int exponents.
virtual void run(const Ideal &ideal)
Run the Slice algorithm.
OptimizeStrategy optimizes a function on the maximal standard monomials of a monomial ideal using bra...
@ UseBoundToEliminateAndSimplify
Eliminate non-improving slices and simplify slices by trying to generate non-improving slices that ar...
const Ideal & getMaximalSolutions()
Returns one of or all of the msm's with optimal value found so far, depending on the value of reportA...
const mpz_class & getMaximalValue()
The optimal value associated to all entries from getMaximalSolutions().
bool changedInWayRelevantToBound(const Term &oldDivisor, const Term &oldDominator, const Term &newDivisor, const Term &newDominator) const
Returns true if iterating bound-based simplification might do something.
virtual void beginConsuming()
Tell the consumer to begin consuming an ideal.
This class describes the interface of a strategy object for the Slice Algorithm.
static auto_ptr< SplitStrategy > createStrategy(const string &prefix)
Returns the strategy whose name has the given prefix.
A TermGrader assigns a value, the degree, to each monomial.
TermTranslator handles translation between terms whose exponents are infinite precision integers and ...
Term represents a product of variables which does not include a coefficient.
#define TEST_SUITE2(PARENT, SUITE)
#define TEST_SUITE(SUITE)