* and open the template in the editor.
*/
-/*
+/*
* File: VarOrderingOpt.cpp
* Author: hamed
- *
+ *
* Created on October 11, 2018, 5:31 PM
*/
#include "elementencoding.h"
#include "element.h"
-VarOrderingOpt::VarOrderingOpt(CSolver *_solver, SATEncoder *_satencoder): Transform(_solver){
+VarOrderingOpt::VarOrderingOpt(CSolver *_solver, SATEncoder *_satencoder) : Transform(_solver) {
satencoder = _satencoder;
}
VarOrderingOpt::~VarOrderingOpt() {
}
-void VarOrderingOpt::doTransform(){
+void VarOrderingOpt::doTransform() {
BooleanVarOrdering direction = (BooleanVarOrdering)solver->getTuner()->getTunable(VARIABLEORDER, &boolVarOrderingDesc);
- if ( direction == CONSTRAINTORDERING ){
+ if ( direction == CONSTRAINTORDERING ) {
return;
}
-
+
uint size = solver->allElements.getSize();
- if(direction == CHORONOLOGICALORDERING){
+ if (direction == CHORONOLOGICALORDERING) {
for (uint i = 0; i < size; i++) {
Element *el = solver->allElements.get(i);
ElementEncoding *encoding = el->getElementEncoding();
continue;
satencoder->encodeElementSATEncoder(el);
}
- }else{
- for (int i = size-1; i>0; i--) {
+ } else {
+ for (int i = size - 1; i > 0; i--) {
Element *el = solver->allElements.get(i);
ElementEncoding *encoding = el->getElementEncoding();
if (encoding->getElementEncodingType() == ELEM_UNASSIGNED)
* and open the template in the editor.
*/
-/*
+/*
* File: VarOrderingOpt.h
* Author: hamed
*
#include "transform.h"
-class VarOrderingOpt :Transform {
+class VarOrderingOpt : Transform {
public:
- VarOrderingOpt(CSolver *_solver, SATEncoder *_satencoder);
- void doTransform();
- virtual ~VarOrderingOpt();
+ VarOrderingOpt(CSolver *_solver, SATEncoder *_satencoder);
+ void doTransform();
+ virtual ~VarOrderingOpt();
private:
- SATEncoder* satencoder;
+ SATEncoder *satencoder;
};
-#endif /* VARORDERINGOPT_H */
+#endif/* VARORDERINGOPT_H */
CSolver *solver;
BooleanToEdgeMap booledgeMap;
VectorEdge *vector;
- friend class VarOrderingOpt;
+ friend class VarOrderingOpt;
};
void allocElementConstraintVariables(ElementEncoding *ee, uint numVars);
static TunableDesc NaiveEncodingDesc(ONEHOT, BINARYINDEX, ONEHOT);
static TunableDesc boolVarOrderingDesc(CONSTRAINTORDERING, REVERSEORDERING, REVERSEORDERING);
-enum Tunables {DECOMPOSEORDER, MUSTREACHGLOBAL, MUSTREACHLOCAL, MUSTREACHPRUNE, OPTIMIZEORDERSTRUCTURE, ORDERINTEGERENCODING, PREPROCESS, NODEENCODING, EDGEENCODING, MUSTEDGEPRUNE, ELEMENTOPT,
- ENCODINGGRAPHOPT, ELEMENTOPTSETS, PROXYVARIABLE, MUSTVALUE, NAIVEENCODER, VARIABLEORDER};
+enum Tunables {DECOMPOSEORDER, MUSTREACHGLOBAL, MUSTREACHLOCAL, MUSTREACHPRUNE, OPTIMIZEORDERSTRUCTURE, ORDERINTEGERENCODING, PREPROCESS, NODEENCODING, EDGEENCODING, MUSTEDGEPRUNE, ELEMENTOPT,
+ ENCODINGGRAPHOPT, ELEMENTOPTSETS, PROXYVARIABLE, MUSTVALUE, NAIVEENCODER, VARIABLEORDER};
typedef enum Tunables Tunables;
const char *tunableParameterToString(Tunables tunable);
VarOrderingOpt bor(this, satEncoder);
bor.doTransform();
-
+
time2 = getTimeNano();
model_print("Encoding Graph Time: %f\n", (time2 - time1) / NANOSEC);
-
+
satEncoder->encodeAllSATEncoder(this);
time1 = getTimeNano();
long long elapsedTime;
long satsolverTimeout;
friend class ElementOpt;
- friend class VarOrderingOpt;
+ friend class VarOrderingOpt;
};
inline CompOp flipOp(CompOp op) {