z3-z3-4.13.0.src.math.dd.pdd_eval.h Maven / Gradle / Ivy
The newest version!
/*++
Copyright (c) 2019 Microsoft Corporation
Module Name:
dd_pdd.cpp
Abstract:
Poly DD package
Author:
Nikolaj Bjorner (nbjorner) 2019-12-23
Lev Nachmanson (levnach) 2019-12-23
Revision History:
--*/
#pragma once
#include "math/dd/dd_pdd.h"
namespace dd {
// calculates the value of a pdd expression based on the given values of the variables
class pdd_eval {
std::function m_var2val;
public:
std::function& var2val() { return m_var2val; } // setter
const std::function& var2val() const { return m_var2val; } // getter
rational operator()(pdd const& p) {
if (p.is_val()) {
return p.val();
}
return (*this)(p.hi()) * m_var2val(p.var()) + (*this)(p.lo());
}
};
}