Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <clasp/constraint.h>
00022 #include <string>
00023 namespace Clasp {
00025
00027 Constraint::Constraint() {}
00028 Constraint::~Constraint() {}
00029 void Constraint::destroy(Solver*, bool) { delete this; }
00030 ConstraintType Constraint::type() const { return Constraint_t::static_constraint; }
00031 bool Constraint::simplify(Solver&, bool) { return false; }
00032 void Constraint::undoLevel(Solver&) {}
00033 uint32 Constraint::estimateComplexity(const Solver&) const { return 1; }
00034 bool Constraint::valid(Solver&) { return true; }
00035 ClauseHead* Constraint::clause() { return 0; }
00036 LearntConstraint::~LearntConstraint() {}
00037 LearntConstraint::LearntConstraint() {}
00038 Activity LearntConstraint::activity() const{ return Activity(0, (1u<<7)-1); }
00039 void LearntConstraint::decreaseActivity() {}
00040 void LearntConstraint::resetActivity(Activity) {}
00041 ConstraintType LearntConstraint::type() const { return Constraint_t::learnt_conflict; }
00043
00045 PostPropagator::PostPropagator() : next(0) {}
00046 PostPropagator::~PostPropagator() {}
00047 bool PostPropagator::init(Solver&) { return true; }
00048 void PostPropagator::reset() {}
00049 bool PostPropagator::isModel(Solver& s) { return valid(s); }
00050 void PostPropagator::reason(Solver&, Literal, LitVec&) {}
00051 Constraint::PropResult PostPropagator::propagate(Solver&, Literal, uint32&) {
00052 return PropResult(true, false);
00053 }
00054 MessageHandler::MessageHandler() {}
00056
00058 PlatformError::PlatformError(const char* msg) : ClaspError(std::string("Platform Error: ")+msg) {}
00059 bool Antecedent::checkPlatformAssumptions() {
00060 int32* i = new int32(22);
00061 uint64 p = (uint64)(uintp)i;
00062 bool convOk = ((int32*)(uintp)p) == i;
00063 bool alignmentOk = (p & 3) == 0;
00064 delete i;
00065 if ( !alignmentOk ) {
00066 throw PlatformError("Unsupported Pointer-Alignment!");
00067 }
00068 if ( !convOk ) {
00069 throw PlatformError("Can't convert between Pointer and Integer!");
00070 }
00071 p = ~uintp(1);
00072 store_set_bit(p, 0);
00073 if (!test_bit(p, 0)) {
00074 throw PlatformError("Can't set LSB in pointer!");
00075 }
00076 store_clear_bit(p, 0);
00077 if (p != (~uintp(1))) {
00078 throw PlatformError("Can't restore LSB in pointer!");
00079 }
00080 Literal max = posLit(varMax-1);
00081 Antecedent a(max);
00082 if (a.type() != Antecedent::binary_constraint || a.firstLiteral() != max) {
00083 throw PlatformError("Cast between 64- and 32-bit integer does not work as expected!");
00084 }
00085 Antecedent b(max, ~max);
00086 if (b.type() != Antecedent::ternary_constraint || b.firstLiteral() != max || b.secondLiteral() != ~max) {
00087 throw PlatformError("Cast between 64- and 32-bit integer does not work as expected!");
00088 }
00089 return true;
00090 }
00091
00092 }