edits
[satune.git] / src / Encoders / naiveencoder.cc
index ef677adf77671389a279bc736537f195a83cd36e..2d77608772ba3d01351aa0a7b89e857b7c9d02ca 100644 (file)
 #include <strings.h>
 
 void naiveEncodingDecision(CSolver *This) {
-       HSIteratorBoolean *iterator = This->getConstraints();
+       SetIteratorBooleanEdge *iterator = This->getConstraints();
        while (iterator->hasNext()) {
-               Boolean *boolean = iterator->next();
-               naiveEncodingConstraint(boolean);
+               BooleanEdge b = iterator->next();
+               naiveEncodingConstraint(b.getBoolean());
        }
        delete iterator;
 }
@@ -28,7 +28,8 @@ void naiveEncodingConstraint(Boolean *This) {
                return;
        }
        case ORDERCONST: {
-               ((BooleanOrder *) This)->order->setOrderEncodingType(PAIRWISE);
+               if(((BooleanOrder *) This)->order->encoding.type == ORDER_UNASSIGNED)
+                       ((BooleanOrder *) This)->order->setOrderEncodingType(PAIRWISE);
                return;
        }
        case LOGICOP: {
@@ -46,7 +47,7 @@ void naiveEncodingConstraint(Boolean *This) {
 
 void naiveEncodingLogicOp(BooleanLogic *This) {
        for (uint i = 0; i < This->inputs.getSize(); i++) {
-               naiveEncodingConstraint(This->inputs.get(i));
+               naiveEncodingConstraint(This->inputs.get(i).getBoolean());
        }
 }