This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
yap-6.3/packages/cplint/cplint.h

75 lines
1.5 KiB
C
Raw Normal View History

/*
2011-10-22 15:33:04 +01:00
LPAD and CP-Logic interpreter
Copyright (c) 2007, Fabrizio Riguzzi
This package uses the library cudd, see http://vlsi.colorado.edu/~fabio/CUDD/
for the relative license.
*/
#include "cudd_config.h"
2017-10-17 10:56:41 +01:00
#include <stdio.h>
#if HAVE_CUDDINT_H
#include "cuddInt.h"
#elif HAVE_CUDD_CUDDINT_H
#include "cudd/cuddInt.h"
#endif
2017-10-17 10:56:41 +01:00
#include "YapInterface.h"
2017-10-17 10:56:41 +01:00
2018-11-04 10:55:58 +00:00
typedef struct {
int var, value;
} factor;
2017-10-17 10:56:41 +01:00
typedef struct {
2011-10-22 15:33:04 +01:00
int nFact;
2017-10-17 10:56:41 +01:00
factor *factors;
2011-10-22 15:33:04 +01:00
} term;
2010-07-27 15:53:47 +01:00
2017-10-17 10:56:41 +01:00
typedef struct {
2011-10-22 15:33:04 +01:00
int nTerms;
2017-10-17 10:56:41 +01:00
term *terms;
2011-10-22 15:33:04 +01:00
} expr;
2010-07-27 15:53:47 +01:00
2017-10-17 10:56:41 +01:00
typedef struct {
int nVal, nBit;
double *probabilities;
DdNode **booleanVars;
2011-10-22 15:33:04 +01:00
} variable;
2017-10-17 10:56:41 +01:00
typedef struct {
2011-10-22 15:33:04 +01:00
int nVar;
int nBVar;
2017-10-17 10:56:41 +01:00
variable *varar;
int *bVar2mVar;
2011-10-22 15:33:04 +01:00
} variables;
2017-10-17 10:56:41 +01:00
typedef struct {
2011-10-22 15:33:04 +01:00
DdNode *key;
double value;
} rowel;
2017-10-17 10:56:41 +01:00
typedef struct {
2011-10-22 15:33:04 +01:00
int cnt;
rowel *row;
} tablerow;
2017-10-17 10:56:41 +01:00
variables createVars(YAP_Term t, DdManager *mgr, int create_dot,
char inames[1000][20]);
2011-10-22 15:33:04 +01:00
expr createExpression(YAP_Term t);
void init_my_predicates(void);
2017-10-17 10:56:41 +01:00
DdNode *retFunction(DdManager *mgr, expr expression, variables v);
DdNode *retTerm(DdManager *mgr, term t, variables v);
DdNode *retFactor(DdManager *mgr, factor f, variables v);
2017-10-17 10:56:41 +01:00
double Prob(DdNode *node, variables vars, tablerow *nodes);
2017-10-17 10:56:41 +01:00
double ProbBool(DdNode *node, int bits, int nBit, int posBVar, variable v,
int mVarIndex, variables vars, tablerow *nodes, int comp);
2011-10-22 15:33:04 +01:00
2017-10-17 10:56:41 +01:00
tablerow *init_table(int nbvars);
double *get_value(tablerow *tab, DdNode *node);
2011-10-22 15:33:04 +01:00
void add_node(tablerow *tab, DdNode *node, double value);
void destroy_table(tablerow *tab, int nbvars);