38 const Ideal& initialSubtract):
54 Term sliceMultiply(varCount);
55 for (
size_t var = 0; var < varCount; ++var)
56 sliceMultiply[var] = 1;
63 _tasks.addTask(slice.release());
78 else if (
_split->isLabelSplit())
91 return auto_ptr<MsmSlice>(
static_cast<MsmSlice*
>(slice.release()));
95 return auto_ptr<Slice>(
new MsmSlice(*
this));
105 ASSERT(sliceParam.get() != 0);
107 auto_ptr<MsmSlice> slice
108 (
static_cast<MsmSlice*
>(sliceParam.release()));
110 ASSERT(!slice->adjustMultiply());
111 ASSERT(!slice->normalize());
113 size_t var =
_split->getLabelSplitVariable(*slice);
115 Term term(slice->getVarCount());
117 const Term& lcm = slice->getLcm();
121 bool hasTwoLabels =
false;
124 if ((*it)[var] == 1) {
128 bool couldBeLabel = !slice->getSubtract().contains(term);
130 for (
size_t v = 0; v < slice->getVarCount(); ++v) {
131 if (term[v] == lcm[v]) {
132 couldBeLabel =
false;
149 auto_ptr<Slice> hasLabelSlice;
156 *hasLabelSlice = *slice;
157 hasLabelSlice->innerSlice(term);
160 slice->outerSlice(term);
166 slice->innerSlice(term);
169 if (hasLabelSlice.get() != 0) {
171 _tasks.addTask(hasLabelSlice.release());
175 _tasks.addTask(slice.release());
260 ASSERT(sliceParam.get() != 0);
262 auto_ptr<MsmSlice> slice
263 (
static_cast<MsmSlice*
>(sliceParam.release()));
267 autoSplit->reset(slice->getConsumer(),
_indep);
272 auto_ptr<MsmSlice> leftSlice(
new MsmSlice(*
this));
274 _tasks.addTask(leftSlice.release());
277 auto_ptr<MsmSlice> rightSlice(
new MsmSlice(*
this));
280 _tasks.addTask(rightSlice.release());
290 _split->getPivot(pivot, slice);
297 _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.
auto_ptr< MsmSlice > newMsmSlice()
virtual bool debugIsValidSlice(Slice *slice)
Check that this slice is valid for use with this strategy.
void independenceSplit(auto_ptr< Slice > slice)
IndependenceSplitter _indep
virtual bool processSlice(TaskEngine &tasks, auto_ptr< Slice > slice)
Process the parameter slice.
virtual void getPivot(Term &pivot, Slice &slice)
Used by pivotSplit to obtain a pivot.
void labelSplit(auto_ptr< Slice > slice)
virtual void run(const Ideal &ideal)
Run the Slice algorithm.
MsmStrategy(TermConsumer *consumer, const SplitStrategy *splitStrategy)
virtual auto_ptr< Slice > allocateSlice()
Directly allocate a slice of the correct type using new.
auto_ptr< Ideal > _initialSubtract
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 bool simplify(Slice &slice)
Simplifies slice and returns true if it changed.
virtual void pivotSplit(auto_ptr< Slice > slice)
Takes over ownership of slice.
auto_ptr< Slice > newSlice()
Returns a slice from the cache that freeSlice adds to, or allocate a new one using allocateSlice.
SliceStrategyCommon(const SplitStrategy *splitStrategy)
virtual void freeSlice(auto_ptr< Slice > slice)
It is allowed to delete returned slices directly, but it is better to use freeSlice.
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.