SliceStrategyCommon.h
Go to the documentation of this file.
/* Frobby: Software for monomial ideal computations.
Copyright (C) 2007 Bjarke Hammersholt Roune (www.broune.com)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see http://www.gnu.org/licenses/.
*/
#ifndef SLICE_STRATEGY_COMMON
#define SLICE_STRATEGY_COMMON
#include "SliceStrategy.h"
#include "SplitStrategy.h"
#include "TaskEngine.h"
#include <vector>
#include <string>
#include "Term.h"
class Slice;
class SplitStrategy;
class SliceStrategyCommon : public SliceStrategy {
public:
SliceStrategyCommon(const SplitStrategy* splitStrategy);
virtual ~SliceStrategyCommon();
virtual void freeSlice(unique_ptr<Slice> slice);
virtual void setUseIndependence(bool use);
virtual void setUseSimplification(bool use);
protected:
virtual bool simplify(Slice& slice);
virtual unique_ptr<Slice> allocateSlice() = 0;
virtual bool debugIsValidSlice(Slice* slice) = 0;
unique_ptr<Slice> newSlice();
virtual void pivotSplit(unique_ptr<Slice> slice);
virtual void getPivot(Term& pivot, Slice& slice) = 0;
bool getUseIndependence() const;
bool getUseSimplification() const;
const SplitStrategy* _split;
TaskEngine _tasks;
private:
bool _useIndependence;
bool _useSimplification;
vector<Slice*> _sliceCache;
Term _pivotTmp;
};
#endif
SliceStrategy.h
SplitStrategy.h
TaskEngine.h
Term.h
SliceStrategyCommon::setUseIndependence
virtual void setUseIndependence(bool use)
This method should only be called before calling run().
Definition SliceStrategyCommon.cpp:47
SliceStrategyCommon::getUseIndependence
bool getUseIndependence() const
Returns true if independence splits should be performed when possible.
Definition SliceStrategyCommon.cpp:113
SliceStrategyCommon::getPivot
virtual void getPivot(Term &pivot, Slice &slice)=0
Used by pivotSplit to obtain a pivot.
SliceStrategyCommon::getUseSimplification
bool getUseSimplification() const
Returns true if slices should be simplified.
Definition SliceStrategyCommon.cpp:117
SliceStrategyCommon::_split
const SplitStrategy * _split
Definition SliceStrategyCommon.h:80
SliceStrategyCommon::_sliceCache
vector< Slice * > _sliceCache
This is the cache maintained through newSlice and freeSlice.
Definition SliceStrategyCommon.h:95
SliceStrategyCommon::freeSlice
virtual void freeSlice(unique_ptr< Slice > slice)
It is allowed to delete returned slices directly, but it is better to use freeSlice.
Definition SliceStrategyCommon.cpp:39
SliceStrategyCommon::simplify
virtual bool simplify(Slice &slice)
Simplifies slice and returns true if it changed.
Definition SliceStrategyCommon.cpp:55
SliceStrategyCommon::_useIndependence
bool _useIndependence
Definition SliceStrategyCommon.h:87
SliceStrategyCommon::allocateSlice
virtual unique_ptr< Slice > allocateSlice()=0
Directly allocate a slice of the correct type using new.
SliceStrategyCommon::pivotSplit
virtual void pivotSplit(unique_ptr< Slice > slice)
Takes over ownership of slice.
Definition SliceStrategyCommon.cpp:77
SliceStrategyCommon::SliceStrategyCommon
SliceStrategyCommon(const SplitStrategy *splitStrategy)
Definition SliceStrategyCommon.cpp:24
SliceStrategyCommon::~SliceStrategyCommon
virtual ~SliceStrategyCommon()
Definition SliceStrategyCommon.cpp:31
SliceStrategyCommon::setUseSimplification
virtual void setUseSimplification(bool use)
This method should only be called before calling run().
Definition SliceStrategyCommon.cpp:51
SliceStrategyCommon::_useSimplification
bool _useSimplification
Definition SliceStrategyCommon.h:88
SliceStrategyCommon::debugIsValidSlice
virtual bool debugIsValidSlice(Slice *slice)=0
Check that this slice is valid for use with this strategy.
SliceStrategyCommon::_pivotTmp
Term _pivotTmp
Definition SliceStrategyCommon.h:97
SliceStrategyCommon::newSlice
unique_ptr< Slice > newSlice()
Returns a slice from the cache that freeSlice adds to, or allocate a new one using allocateSlice.
Definition SliceStrategyCommon.cpp:65
SliceStrategyCommon::_tasks
TaskEngine _tasks
This keeps track of pending tasks to process.
Definition SliceStrategyCommon.h:84
SliceStrategy
This class describes the interface of a strategy object for the Slice Algorithm.
Definition SliceStrategy.h:33
Slice
This class represents a slice, which is the central data structure of the Slice Algorithm.
Definition Slice.h:77
SplitStrategy
A SplitStrategy is an implementation of a split selection strategy for the Slice Algorithm.
Definition SplitStrategy.h:30
TaskEngine
TaskEngine handles a list of tasks that are to be carried out.
Definition TaskEngine.h:40
Term
Term represents a product of variables which does not include a coefficient.
Definition Term.h:49