#define READBUFFERSIZE 16384
-Deserializer::Deserializer(const char *file) :
+Deserializer::Deserializer(const char *file, bool alloy) :
buffer((char *) ourmalloc(READBUFFERSIZE)),
bufferindex(0),
bufferbytes(0),
if (filedesc < 0) {
exit(-1);
}
+ if(alloy){
+ solver->setAlloyEncoder();
+ }
}
Deserializer::~Deserializer() {
*/
class Deserializer {
public:
- Deserializer(const char *file);
+ Deserializer(const char *file, bool alloy = false);
CSolver *deserialize();
virtual ~Deserializer();
private:
printf("./run.sh deserializer test.dump [--alloy]\n");
exit(-1);
}
- CSolver *solver = CSolver::deserialize(argv[1]);
- if(argc == 3)
- solver->setAlloyEncoder();
+ CSolver *solver;
+ if(argc == 3){
+ solver = CSolver::deserialize(argv[1], true);
+ } else {
+ solver = CSolver::deserialize(argv[1]);
+ }
int value = solver->solve();
if (value == 1) {
printf("%s is SAT\n", argv[1]);
return copy;
}
-CSolver *CSolver::deserialize(const char *file) {
+CSolver *CSolver::deserialize(const char *file, bool alloy) {
model_print("deserializing %s ...\n", file);
- Deserializer deserializer(file);
+ Deserializer deserializer(file, alloy);
return deserializer.deserialize();
}
}
void CSolver::setAlloyEncoder(){
- alloyEncoder = new AlloyEnc(this);
+ if(alloyEncoder == NULL){
+ alloyEncoder = new AlloyEnc(this);
+ }
}
void CSolver::printConstraints() {
void replaceBooleanWithBoolean(BooleanEdge oldb, BooleanEdge newb);
CSolver *clone();
void serialize();
- static CSolver *deserialize(const char *file);
+ static CSolver *deserialize(const char *file, bool alloy = false);
void autoTune(uint budget);
void inferFixedOrders();
void inferFixedOrder(Order *order);