37 const Ideal& initialSubtract):
53 Term sliceMultiply(varCount);
54 for (
size_t var = 0; var < varCount; ++var)
55 sliceMultiply[var] = 1;
57 unique_ptr<Slice> slice
62 _tasks.addTask(slice.release());
77 else if (
_split->isLabelSplit())
90 return unique_ptr<MsmSlice>(
static_cast<MsmSlice*
>(slice.release()));
94 return unique_ptr<Slice>(
new MsmSlice(*
this));
104 ASSERT(sliceParam.get() != 0);
106 unique_ptr<MsmSlice> slice
107 (
static_cast<MsmSlice*
>(sliceParam.release()));
109 ASSERT(!slice->adjustMultiply());
110 ASSERT(!slice->normalize());
112 size_t var =
_split->getLabelSplitVariable(*slice);
114 Term term(slice->getVarCount());
116 const Term& lcm = slice->getLcm();
120 bool hasTwoLabels =
false;
123 if ((*it)[var] == 1) {
127 bool couldBeLabel = !slice->getSubtract().contains(term);
129 for (
size_t v = 0; v < slice->getVarCount(); ++v) {
130 if (term[v] == lcm[v]) {
131 couldBeLabel =
false;
148 unique_ptr<Slice> hasLabelSlice;
155 *hasLabelSlice = *slice;
156 hasLabelSlice->innerSlice(term);
159 slice->outerSlice(term);
165 slice->innerSlice(term);
168 if (hasLabelSlice.get() != 0) {
170 _tasks.addTask(hasLabelSlice.release());
174 _tasks.addTask(slice.release());
259 ASSERT(sliceParam.get() != 0);
261 unique_ptr<MsmSlice> slice
262 (
static_cast<MsmSlice*
>(sliceParam.release()));
266 autoSplit->reset(slice->getConsumer(),
_indep);
271 unique_ptr<MsmSlice> leftSlice(
new MsmSlice(*
this));
273 _tasks.addTask(leftSlice.release());
276 unique_ptr<MsmSlice> rightSlice(
new MsmSlice(*
this));
279 _tasks.addTask(rightSlice.release());
289 _split->getPivot(pivot, slice);
296 _split->getPivot(pivot, slice, grader);
Represents a monomial ideal with int exponents.
Cont::const_iterator const_iterator
size_t getVarCount() const
void getRestProjection(Projection &projection) const
size_t getVarCount() const
void getBigProjection(Projection &projection) const
Projection _leftProjection
MsmIndependenceSplit::RightConsumer _rightConsumer
virtual void dispose()
Called when the task is no longer used but run has not and will not be called.
virtual void beginConsuming()
Tell the consumer to begin consuming an ideal.
Projection _rightProjection
virtual void doneConsuming()
Must be called once after each time beginConsuming has been called.
virtual void run(TaskEngine &engine)
Does whatever work this task represents.
const Projection & getRightProjection()
TermConsumer * getLeftConsumer()
void reset(TermConsumer *consumer, IndependenceSplitter &splitter)
const Projection & getLeftProjection()
TermConsumer * getRightConsumer()
virtual void consume(const Term &term)
Consume a term.
Invariant: either the slice is a trivial base case, or removeDoubleLcm returns false.
virtual unique_ptr< Slice > allocateSlice()
Directly allocate a slice of the correct type using new.
virtual bool debugIsValidSlice(Slice *slice)
Check that this slice is valid for use with this strategy.
virtual bool processSlice(TaskEngine &tasks, unique_ptr< Slice > slice)
Process the parameter slice.
IndependenceSplitter _indep
void independenceSplit(unique_ptr< Slice > slice)
unique_ptr< MsmSlice > newMsmSlice()
unique_ptr< Ideal > _initialSubtract
virtual void getPivot(Term &pivot, Slice &slice)
Used by pivotSplit to obtain a pivot.
void labelSplit(unique_ptr< Slice > slice)
virtual void run(const Ideal &ideal)
Run the Slice algorithm.
MsmStrategy(TermConsumer *consumer, const SplitStrategy *splitStrategy)
bool getUseIndependence() const
Returns true if independence splits should be performed when possible.
bool getUseSimplification() const
Returns true if slices should be simplified.
const SplitStrategy * _split
virtual void freeSlice(unique_ptr< Slice > slice)
It is allowed to delete returned slices directly, but it is better to use freeSlice.
virtual bool simplify(Slice &slice)
Simplifies slice and returns true if it changed.
virtual void pivotSplit(unique_ptr< Slice > slice)
Takes over ownership of slice.
SliceStrategyCommon(const SplitStrategy *splitStrategy)
unique_ptr< Slice > newSlice()
Returns a slice from the cache that freeSlice adds to, or allocate a new one using allocateSlice.
TaskEngine _tasks
This keeps track of pending tasks to process.
This class represents a slice, which is the central data structure of the Slice Algorithm.
A SplitStrategy is an implementation of a split selection strategy for the Slice Algorithm.
TaskEngine handles a list of tasks that are to be carried out.
A Task object represents a unit of work that is performed when the method run() is called.
This class is used to transfer terms one at a time from one part of the program to another,...
A TermGrader assigns a value, the degree, to each monomial.
Term represents a product of variables which does not include a coefficient.
static void setToIdentity(Exponent *res, size_t varCount)
Set res equal to , i.e. set each entry of res equal to 0.
This header file includes common definitions and is included as the first line of code in every imple...
virtual void doneConsuming()
Must be called once after each time beginConsuming has been called.
virtual void consume(const Term &term)
Consume a term.
virtual void beginConsuming()
Tell the consumer to begin consuming an ideal.