Commit 48391018 authored by David Speck's avatar David Speck

improved version of restrict

parent 7a7c38a9
This diff is collapsed.
...@@ -44,6 +44,9 @@ bool SymSearch::reconstructSolution(MEDDLY::dd_edge &target, ...@@ -44,6 +44,9 @@ bool SymSearch::reconstructSolution(MEDDLY::dd_edge &target,
std::sort( std::sort(
g_operators.begin(), g_operators.end(), g_operators.begin(), g_operators.end(),
std::bind(higherCost, std::placeholders::_1, std::placeholders::_2)); std::bind(higherCost, std::placeholders::_1, std::placeholders::_2));
} else {
//std::cout << "shuffle" << std::endl;
//std::reverse(g_operators.begin(), g_operators.end());
} }
std::cout << "Beginning plan reconstruction: " << std::endl; std::cout << "Beginning plan reconstruction: " << std::endl;
......
...@@ -10,8 +10,6 @@ FILES = ../meddly_extensions/genericBinaryOperator.h \ ...@@ -10,8 +10,6 @@ FILES = ../meddly_extensions/genericBinaryOperator.h \
../meddly_extensions/userDefiniedOperators.h \ ../meddly_extensions/userDefiniedOperators.h \
../meddly_extensions/restrict.h \ ../meddly_extensions/restrict.h \
../meddly_extensions/swapVarPrimed.h \ ../meddly_extensions/swapVarPrimed.h \
../meddly_extensions/lessThan.h \
../meddly_extensions/lessThanApprox.h \
../meddly_extensions/swapToPrimedVar.h \ ../meddly_extensions/swapToPrimedVar.h \
../meddly_extensions/partialComplement.h \ ../meddly_extensions/partialComplement.h \
../meddly_extensions/minVar.h \ ../meddly_extensions/minVar.h \
......
...@@ -467,7 +467,7 @@ TEST(minStates, random) { ...@@ -467,7 +467,7 @@ TEST(minStates, random) {
} }
} }
TEST(lessThan, examplePaper) { /*TEST(lessThan, examplePaper) {
int max = std::numeric_limits<int>::max(); int max = std::numeric_limits<int>::max();
int nVars = 3; int nVars = 3;
int limits[] = { 2, 2, 3 }; int limits[] = { 2, 2, 3 };
...@@ -693,4 +693,4 @@ TEST(lessThanApprox, examplePaper2) { ...@@ -693,4 +693,4 @@ TEST(lessThanApprox, examplePaper2) {
} }
delete assigns; delete assigns;
assigns = nullptr; assigns = nullptr;
} }*/
...@@ -124,7 +124,7 @@ class restrictOp: public MEDDLY::unary_operation { ...@@ -124,7 +124,7 @@ class restrictOp: public MEDDLY::unary_operation {
rp = resF->linkNode(ap); rp = resF->linkNode(ap);
rv = av; rv = av;
MEDDLY::unpacked_node::recycle(A); MEDDLY::unpacked_node::recycle(A);
delete Key; saveResult(Key, ap, rv, rp);
return; return;
} }
// Is a node which we want to restrict to a value // Is a node which we want to restrict to a value
...@@ -133,17 +133,12 @@ class restrictOp: public MEDDLY::unary_operation { ...@@ -133,17 +133,12 @@ class restrictOp: public MEDDLY::unary_operation {
// this link is important // this link is important
if (A->d(val) == -1) rp = -1; if (A->d(val) == -1) rp = -1;
else rp = resF->linkNode(A->d(val)); else rp = resF->linkNode(A->d(val));
MEDDLY::unpacked_node::recycle(A);
saveResult(Key, ap, A->ei(val), rp);
rv = av + A->ei(val); rv = av + A->ei(val);
/*int tmp = av + A->ei(val);
if (av > 0 && A->ei(val) > 0 && tmp < 0) {
rv = std::numeric_limits<int>::max();
} else {
rv = tmp;
}*/
if (rv < 0) if (rv < 0)
rv = std::numeric_limits<int>::max(); rv = std::numeric_limits<int>::max();
MEDDLY::unpacked_node::recycle(A);
delete Key;
return; return;
} }
......
...@@ -15,8 +15,6 @@ void initializeUserDefiniedOps() { ...@@ -15,8 +15,6 @@ void initializeUserDefiniedOps() {
initializeSwapToPrimedVar(); initializeSwapToPrimedVar();
initializeUnionMin(); initializeUnionMin();
initializeIntersectionMax(); initializeIntersectionMax();
initializeLessThan();
initializeLessThanApprox();
initializePartialComplement(); initializePartialComplement();
initializeMinStates(); initializeMinStates();
} }
......
...@@ -13,8 +13,6 @@ ...@@ -13,8 +13,6 @@
#include "./minVar.h" #include "./minVar.h"
#include "./swapVarPrimed.h" #include "./swapVarPrimed.h"
#include "./swapToPrimedVar.h" #include "./swapToPrimedVar.h"
#include "./lessThan.h"
#include "./lessThanApprox.h"
#include "./partialComplement.h" #include "./partialComplement.h"
#include "./minStates.h" #include "./minStates.h"
#include "../resourcesHandle.h" #include "../resourcesHandle.h"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment