51 Facade(params.getPrintActions()),
60 Facade(params.getPrintActions()),
69 Facade(params.getPrintActions()),
80 beginAction(
"Computing multigraded Hilbert-Poincare series.");
85 consumer->beginConsuming();
88 consumer->doneConsuming();
95 beginAction(
"Computing univariate Hilbert-Poincare series.");
97 auto_ptr<CoefTermConsumer> consumer =
101 consumer->beginConsuming();
104 consumer->doneConsuming();
135 mpz_class minusCodimension;
145 return -minusCodimension;
147 return v.size() + minusCodimension;
155 Ideal irreducibleDecom(varCount);
162 (
"Computing primary decomposition from irreducible decomposition.");
178 irreducibleDecom.
getLcm(lcm);
181 Term support(varCount);
185 Ideal primaryComponent(varCount);
191 consumer->beginConsumingList();
200 primaryComponentDual.
insert(tmp);
212 consumer->beginConsuming();
214 dualTerm != primaryComponent.
end(); ++dualTerm) {
216 consumer->consume(tmp);
218 consumer->doneConsuming();
220 primaryComponent.
clear();
221 primaryComponentDual.
clear();
224 consumer->doneConsumingList();
231 beginAction(
"Computing maximal staircase monomials.");
244 beginAction(
"Preparing to compute maximal standard monomials.");
254 beginAction(
"Ensuring specified point is divisible by lcm.");
255 vector<mpz_class>
lcm;
258 for (
size_t var = 0; var < lcm.size(); ++var) {
259 if (lcm[var] > point[var]) {
262 (
"The specified point to dualize on is not divisible by the "
263 "least common multiple of the minimal generators of the ideal.");
268 beginAction(
"Preparing to compute Alexander dual.");
279 vector<mpz_class>
lcm;
292 Ideal radical(varCount);
294 Ideal decom(varCount);
298 beginAction(
"Computing associated primes from irreducible decomposition.");
303 for (
size_t var = 0; var < varCount; ++var) {
324 consumer->beginConsuming();
329 consumer->consume(tmp);
331 consumer->doneConsuming();
337 (
const vector<mpz_class>& grading,
338 mpz_class& optimalValue,
339 bool reportAllSolutions) {
340 ASSERT(isFirstComputation());
341 ASSERT(grading.size() == _common.getIdeal().getVarCount());
343 beginAction(
"Preparing to solve optimization program.");
344 if (!_common.getIdeal().containsIdentity())
345 _common.addPurePowersAtInfinity();
348 return solveProgram(grading, optimalValue, reportAllSolutions);
352 (
const vector<mpz_class>& grading,
353 mpz_class& optimalValue,
354 bool reportAllSolutions) {
355 ASSERT(isFirstComputation());
356 ASSERT(grading.size() == _common.getIdeal().getVarCount());
358 _common.getTranslator().decrement();
359 return solveProgram(grading, optimalValue, reportAllSolutions);
364 beginAction(
"Computing irreducible decomposition.");
376 mpz_class& optimalValue,
377 bool reportAllSolutions) {
383 (
"Turning off Independence splits as they are not supported\n"
384 "for optimization.");
391 (
"Bound simplification requires using the bound to eliminate\n"
392 "non-improving slices, which has been turned off. Am now turning\n"
410 (grader,
_split.get(), reportAllSolutions, boundSetting);
415 const Ideal& solution = strategy.getMaximalSolutions();
419 consumer->consume(solution);
424 optimalValue = strategy.getMaximalValue();
441 if (
lcm.isSquareFree())
474 auto_ptr<SliceStrategy> debugStrategy;
477 (
new DebugStrategy(strategyWithOptions, stderr));
478 strategyWithOptions = debugStrategy.get();
481 auto_ptr<SliceStrategy> statisticsStrategy;
483 statisticsStrategy.reset
485 strategyWithOptions = statisticsStrategy.get();
488 ASSERT(strategyWithOptions != 0);
void setIdealAndPolyOutput(const CommonParams ¶ms, const BigIdeal &input, CoefBigTermConsumer &output)
Use given ideal and support polynomial output.
Cont::const_iterator const_iterator
const mpz_class & getExponent(size_t variable, Exponent exponent) const
This method translates from IDs to arbitrary precision integers.
Eliminate non-improving slices, achieving a branch-and-bound algorithm in place of the usual backtrac...
auto_ptr< CoefTermConsumer > makeToUnivariatePolyConsumer()
static void encodedDual(Exponent *res, const Exponent *dualOf, const Exponent *point, size_t varCount)
The parameter dualOf is interpreted to encode an irreducible ideal, and the dual of that reflected in...
auto_ptr< CoefTermConsumer > makeTranslatedPolyConsumer()
void computeAlexanderDual()
Compute the Alexander dual of the ideal.
This is the super class of all facades.
void addPurePowersAtInfinity()
virtual void run(const Ideal &ideal)=0
Run the Slice algorithm.
auto_ptr< SplitStrategy > _split
OptimizeStrategy optimizes a function on the maximal standard monomials of a monomial ideal using bra...
void getLcmOfIdeal(vector< mpz_class > &lcm)
void computeMultigradedHilbertSeries()
Compute the numerator of the multigraded Hilbert-Poincare series.
bool getPrintStatistics() const
Returns whether to print statistics on what the algorithm did to standard error after it has run...
bool getPrintDebug() const
Returns whether to print information about what the algorithm is doing to standard error as it runs...
Represents a monomial ideal with int exponents.
void lcm(Word *res, const Word *resEnd, const Word *a, const Word *b)
A wrapper for a SliceStrategy that collects statistics on what is going on, while delegating everythi...
const string & getSplit() const
The intention of this class is to describe the different kinds of mathematical structures that Frobby...
auto_ptr< TermConsumer > makeTranslatedIdealConsumer(bool split=false)
void codimension(const Ideal &ideal, mpz_t codim)
Compute the codimension of a monomial ideal.
A TermGrader assigns a value, the degree, to each monomial.
This class is used to transfer terms one at a time from one part of the program to another...
void computeMaximalStandardMonomials()
Compute the maximal standard monomials of the ideal.
This file contains functions for printing strings to standard error.
void setInfinityPowersToZero(Ideal &ideal) const
The method addPurePowersAtInfinity adds high exponents that map to zero.
virtual void consumeRing(const VarNames &names)
Tell the consumer which ring is being used.
void produceEncodedIrrDecom(TermConsumer &consumer)
void setIdealAndIdealOutput(const CommonParams ¶ms, const BigIdeal &input, BigTermConsumer &output)
Use given ideal and support ideal output.
bool getUseBoundSimplification() const
Returns whether to simplify slices by seeking to generate non-improving slices that are then eliminat...
bool solveStandardProgram(const vector< mpz_class > &grading, mpz_class &value, bool reportAllSolutions)
Solve an optimization program over maximal standard monomials.
void endAction()
Prints to standard error the time since the last call to beginAction.
void displayNote(const string &msg)
Display msg to standard error in a way that indicates that this is something that the user should tak...
size_t getVarCount() const
virtual void setUseIndependence(bool use)=0
This method should only be called before calling run().
bool isFirstComputation() const
bool containsIdentity() const
void addPurePowersAtInfinity(Ideal &ideal) const
Adds a generator of the form v^e, e > 0, for any variable v where generator of that form is not alrea...
static auto_ptr< SplitStrategy > createStrategy(const string &prefix)
Returns the strategy whose name has the given prefix.
void decrement()
Replaces var^v by var^(v-1).
const VarNames & getNames()
void readIdealAndSetOutput(const CommonParams ¶ms, const DataType &output)
Read input ideal and support specified kind of output.
virtual void setUseSimplification(bool use)=0
This method should only be called before calling run().
SliceFacade(const SliceParams ¶ms, const DataType &output)
const_iterator end() const
void computeIrreducibleDecomposition(bool encode)
Compute the unique irredundant set of irreducible ideals whose intersection equals ideal...
Make no use of the bound.
bool getUseBoundElimination() const
Returns whether to use branch-and-bound to speed up Slice optimization computations by eliminating no...
void beginAction(const char *message)
Prints message to standard error if printing is turned on, and records the time when the action start...
mpz_class computeDimension(bool codimension=false)
Compute the Krull dimension of ideal.
void computeAssociatedPrimes()
Compute the associated primes of the ideal.
void useIndependenceSplits(bool value)
void dualize(const vector< mpz_class > &a)
Replaces var^v by var^(a[i] - v) except that var^0 is left alone.
TermTranslator & getTranslator()
void useBoundElimination(bool value)
bool getUseIndependenceSplits() const
void setToZeroOne(TermTranslator &translator)
This class describes the interface of a strategy object for the Slice Algorithm.
CommonParamsHelper _common
Eliminate non-improving slices and simplify slices by trying to generate non-improving slices that ar...
BoundSetting
The values of BoundSetting indicate how to use the bound.
void getLcm(Exponent *lcm) const
Sets lcm to the least common multiple of all generators.
const_iterator begin() const
void computeMaximalStaircaseMonomials()
Compute the maximal staircase monomials of the ideal.
bool solveIrreducibleDecompositionProgram(const vector< mpz_class > &grading, mpz_class &optimalValue, bool reportAllSolutions)
Solve an optimization program over irreducible components.
void reportError(const string &errorMsg)
void insert(const Exponent *term)
bool solveProgram(const vector< mpz_class > &grading, mpz_class &optimalValue, bool reportAllSolutions)
void computeUnivariateHilbertSeries()
Compute the numerator of the univariate Hilbert-Poincare series.
void takeRadicalNoMinimize()
Replaces all generators with their support and does not remove any non-minimal generators this may pr...
static bool hasSameSupport(const Exponent *a, const Exponent *b, size_t varCount)
Returns whether for every variable .
bool getUseSimplification() const
Apply simplification to the state of the algorithm when possible.
void runSliceAlgorithmWithOptions(SliceStrategy &strategy)
void computePrimaryDecomposition()
Compute the unique "nicest" primary decomposition of the ideal.
Term represents a product of variables which does not include a coefficient.