GOBNILP
f164d83
|
Provides the core functionality for the Bayesian network learning problem. More...
#include <string.h>
#include <ctype.h>
#include <float.h>
#include "probdata_bn.h"
#include "pedigrees.h"
#include "pedigree_scorer.h"
#include "cons_dagcluster.h"
#include "cons_ci.h"
#include "cons_chordal.h"
#include "cons_distinguishedrep.h"
#include "heur_sinks.h"
#include "utils.h"
#include "output.h"
#include "metadata.h"
#include "scoring.h"
#include "scip/misc.h"
#include "disp_clearcols.h"
#include "event_splitdag.h"
#include "cons_lop.h"
#include "cons_partialordering.h"
#include "cons_vanilla.h"
Macros | |
#define | DEFAULT_GOBNILP_INPUT_FORMAT "jkl" |
Functions | |
static SCIP_RETCODE | addAcyclicityConstraints (SCIP *scip, ParentSetData *psd) |
Adds the acyclity constraints to the problem. More... | |
static SCIP_RETCODE | addAdditionalConstraints (SCIP *scip, ParentSetData *psd) |
Adds constraints ruling out immoralities in the DAG. More... | |
static SCIP_RETCODE | addAncestorVariables (SCIP *scip, ParentSetData *psd) |
If gobnilp/ancestorvars == TRUE, creates binary variables encoding the ancestor relation Creates binary variables anc[i][j] where anc[i][j]==1 iff j is an ancestor of i If gobnilp/useconspartialordering == TRUE, the partial order constraint is used on these variables. More... | |
static SCIP_RETCODE | addArrowVariables (SCIP *scip, ParentSetData *psd) |
Adds variables representing directed and undirected edges The branching priority for these variables is set at 10, so typically SCIP will branch on these variables rather than parent set variables. More... | |
static SCIP_RETCODE | addEdgeNumberConstraints (SCIP *scip, ParentSetData *psd) |
Adds constraints on the number of edges in the DAG. More... | |
static SCIP_RETCODE | addFounderConstraints (SCIP *scip, ParentSetData *psd) |
Adds constraints on the number of possible founders. More... | |
static SCIP_RETCODE | addGeneralDAGConstraints (SCIP *scip, ParentSetData *psd) |
Adds general structural constraints to the DAG. More... | |
static SCIP_RETCODE | addImsetVariables (SCIP *scip, ParentSetData *psd) |
The imsetvar for a subset of nodes = 1 iff one of the elements in the subset has all the others as parents. More... | |
static SCIP_RETCODE | addKBestMECVariables (SCIP *scip, ParentSetData *psd) |
static SCIP_RETCODE | addNChildrenVars (SCIP *scip, const ParentSetData *psd) |
Adds variables which count how many children a node has. | |
static SCIP_RETCODE | addOneParentSetConstraints (SCIP *scip, ParentSetData *psd) |
Adds the constraints that there must be one parent set to the problem. More... | |
static SCIP_RETCODE | addOrderedCoveredArcConstraints (SCIP *scip, ParentSetData *psd) |
Adds constraints ruling out covered arcs from lower to higher vertices. More... | |
static SCIP_RETCODE | addParentNumberConstraints (SCIP *scip, const ParentSetData *psd) |
Adds constraints on the number of nodes that can be parents. More... | |
static SCIP_RETCODE | addParentVariables (SCIP *scip, ParentSetData *psd, SCIP_Real **scores) |
Creates and adds the parent variables to the problem. More... | |
static SCIP_RETCODE | addPaSizeVariables (SCIP *scip, ParentSetData *psd) |
If gobnilp/pasizevars == TRUE adds and sets the branching priorities of variables representing parent set size. More... | |
static SCIP_RETCODE | addPosindVariables (SCIP *scip, ParentSetData *psd) |
If gobnilp/posindvars == TRUE, adds binary variables indicating the position of nodes in a total order consistent with a DAG solution. More... | |
static SCIP_RETCODE | addPosVariables (SCIP *scip, ParentSetData *psd) |
If gobnilp/posvars == TRUE, creates integer variables giving a generation number for each node If a node is a founder its generation number is 0 If j is a parent of i its generation number is strictly less than i's An upper bound on any such variable can be set using gobnilp/maxpos Uses an Indicator constraint. More... | |
static SCIP_RETCODE | addTotalorderVariables (SCIP *scip, ParentSetData *psd) |
If gobnilp/totalordervars == TRUE, creates, and sets the branching priority for, binary variables encoding a total order consistent with a DAG solution Creates binary variables order[i][j] where order[i][j]==1 if i comes after j in the total ordering. More... | |
static SCIP_RETCODE | ancestor_constraint (SCIP *scip, ParentSetData *psd, int i, int j, SCIP_Bool truthvalue) |
Adds a constraint stating that an ancestor relation must be present or absent. More... | |
static SCIP_RETCODE | BN_addMECNonRepetitionConstraint (SCIP *scip, int run) |
Adds a constraint that prevents networks in the same MEC as the current best network being found again. More... | |
SCIP_RETCODE | BN_addNonRepetitionConstraint (SCIP *scip, int run) |
Adds a constraint that prevents the current best network being found again. More... | |
SCIP_RETCODE | BN_addParameters (SCIP *scip) |
Adds GOBNILP specific parameters to those recognised by SCIP. More... | |
SCIP_RETCODE | BN_doIterativePrint (SCIP *scip, MA_info *ma_info, int run) |
Prints appropriate information about each optimal solution obtained. More... | |
int | BN_getNumberOfRepeats (SCIP *scip) |
Gets the number of most likely Bayesian networks that should be found. More... | |
SCIP_RETCODE | BN_includePlugins (SCIP *scip) |
Includes all plugins needed by the problem. More... | |
SCIP_RETCODE | BN_printcountsols (SCIP *scip, char *filename) |
Prints solutions found using countsols. More... | |
SCIP_RETCODE | BN_printHeader (SCIP *scip) |
Prints a header which describes the GOBNILP and SCIP systems being used. More... | |
SCIP_RETCODE | BN_printParameters (SCIP *scip) |
Prints any of the current SCIP or GOBNILP parameters not at their default value. More... | |
SCIP_RETCODE | BN_printProblem (SCIP *scip, int run) |
Prints the current problem. More... | |
SCIP_RETCODE | BN_printScores (SCIP *scip) |
Prints the scores for the family variables in Jaakkola format. More... | |
SCIP_RETCODE | BN_readProblem (SCIP *scip, char *inputformat, char *frequencyfile, const char *filename) |
Reads in a problem from a file. More... | |
SCIP_RETCODE | BN_setParamaterDefaults (SCIP *scip) |
Sets various built-in SCIP parameters to suitable GOBNILP values. More... | |
SCIP_RETCODE | BN_suppresscols (SCIP *scip) |
Suppresses output columns according to the value of parameter gobnilp/verblevelsetcols. More... | |
static SCIP_RETCODE | ci_constraint (SCIP *scip, ParentSetData *psd, const char *a_str, const char *b_str, const char *s_str) |
Adds a conditional independence (ci) constraint. More... | |
static int | countParentSets (FILE *file) |
static int | countVars (FILE *file) |
static SCIP_RETCODE | createBasicModel (SCIP *scip, ParentSetData *psd, SCIP_Real **scores) |
Adds the variables and constraints needed for the basic DAG learning problem. More... | |
static SCIP_Bool | differ (SCIP *scip, ParentSetData *psd, int i, int ki1, int ki2, int j) |
Determines if two parent sets differ by just a single given item. More... | |
static SCIP_RETCODE | edge_constraint (SCIP *scip, ParentSetData *psd, int i, int j, SCIP_Bool undirected, SCIP_Bool truthvalue) |
Adds a constraint stating that an edge must be present or absent. More... | |
static void | extractMetaNameAndValue (const char *string, char *name, char *value) |
static SCIP_RETCODE | getDelimiters (SCIP *scip, int *num_delims, char **delims, SCIP_Bool *merge_delims) |
Gets the delimiter information needed to read in information from files. More... | |
static char * | getInputFormat (SCIP *scip, char *inputformat, const char *filename) |
Gets the format in which the input file has been given. More... | |
static SCIP_RETCODE | getProblemName (const char *filename, char *probname, int maxSize) |
Gets a problem name based on the file from which it was read. More... | |
static SCIP_RETCODE | immorality_constraint (SCIP *scip, ParentSetData *psd, int i, int j, int child, SCIP_Bool truthvalue) |
Adds a constraint enforcing or preventing an immorality constraint. More... | |
static SCIP_RETCODE | order_constraint (SCIP *scip, ParentSetData *psd, int i, int j) |
Adds a constraint stating that variable i must come before variable j in any variable ordering consistent with the learned network This works by simply fixing the relevant total order variable An error is generated if the user has not asked for the total order constraint handler to be used. More... | |
static SCIP_RETCODE | parseSet (SCIP *scip, ParentSetData *psd, const char *str, int *set, int *n_set, SCIP_Bool *success) |
Parses a string to extract a set from it. More... | |
static SCIP_RETCODE | process_constraint (SCIP *scip, ParentSetData *psd, const char *line) |
Adds a constraint on the DAG structure. More... | |
static SCIP_RETCODE | readProblemInCIPFormat (SCIP *scip, const char *filename) |
Reads a problem from a file in cip format. More... | |
static SCIP_RETCODE | readProblemInJaakkolaFormat (SCIP *scip, const char *filename, ParentSetData *psd, SCIP_Real ***scores, PropertyData *prop) |
Reads local score BN file (in Jaakkola format) More... | |
static SCIP_RETCODE | readProblemInNonCIPFormat (SCIP *scip, char *frequencyfile, const char *filename, char *format) |
Reads a problem from a file in a format other than CIP. More... | |
static SCIP_RETCODE | readProblemInPSSFormat (SCIP *scip, const char *filename, ParentSetData *psd, SCIP_Real ***scores, PropertyData *prop) |
Reads local score BN file (in PSS format) More... | |
static | SCIP_DECL_PROBDELORIG (probdelorigBN) |
delete problem data | |
static SCIP_RETCODE | setBranchingPriorities (SCIP *scip, ParentSetData *psd) |
Sets the branching priority of variables. More... | |
static SCIP_RETCODE | setSpecialProperties (SCIP *scip, ParentSetData *psd) |
Sets properties to non-standard values. More... | |
static SCIP_RETCODE | sink_constraint (SCIP *scip, ParentSetData *psd, int sink) |
Adds a constraint stating that a given node must be a sink This is effected by fixing all parent set indicator variables to zero if the sink is one of the parents. More... | |
static int | splitAtWhitespace (const char *string, char ***parts) |
Provides the core functionality for the Bayesian network learning problem.
|
static |
Adds the acyclity constraints to the problem.
scip | The SCIP instance to add the constraints to. |
psd | The parent set data to use for generating the acyclity constraints. |
References DC_createCons(), PS_deallocateParentSetData(), and PS_splitToComponents().
Referenced by createBasicModel().
|
static |
Adds constraints ruling out immoralities in the DAG.
scip | The SCIP instance to add the constraint to. |
psd | The parent set data associated with this problem. |
scip | The SCIP instance to add the constraint to. |
psd | The parent set data associated with this problem. |
References addEdgeNumberConstraints(), addFounderConstraints(), addGeneralDAGConstraints(), addOrderedCoveredArcConstraints(), addParentNumberConstraints(), PD_addPedigreeSpecificConstraints(), PD_inPedigreeMode(), SCIPcreateConsBasicChordal(), SCIPcreateConsBasicDistinguishedrep(), SCIPcreateConsVanilla(), SCIPincludeConshdlrDistinguishedrep(), and SCIPincludeConshdlrVanilla().
Referenced by BN_readProblem().
|
static |
If gobnilp/ancestorvars == TRUE, creates binary variables encoding the ancestor relation Creates binary variables anc[i][j] where anc[i][j]==1 iff j is an ancestor of i If gobnilp/useconspartialordering == TRUE, the partial order constraint is used on these variables.
scip | SCIP data structure |
psd | parent sets data structure |
References ParentSetData::n, and SCIPcreateConsPartialOrdering().
Referenced by createBasicModel().
|
static |
Adds variables representing directed and undirected edges The branching priority for these variables is set at 10, so typically SCIP will branch on these variables rather than parent set variables.
scip | SCIP data structure |
psd | parent sets data structure |
References get_arrow(), hashtableCreateArrow(), ParentSetData::n, ParentSetData::nodeNames, ParentSetData::nParents, ParentSetData::nParentSets, ParentSetData::ParentSets, ParentSetData::PaVars, put_arrow(), and put_edge().
Referenced by createBasicModel().
|
static |
Adds constraints on the number of edges in the DAG.
scip | The SCIP instance to add the constraint to. |
psd | The parent set data associated with this problem. |
References get_edge(), and ParentSetData::n.
Referenced by addAdditionalConstraints().
|
static |
Adds constraints on the number of possible founders.
scip | The SCIP instance to add the constraint to. |
psd | The parent set data associated with this problem. |
References ParentSetData::n, ParentSetData::nParents, ParentSetData::nParentSets, and ParentSetData::PaVars.
Referenced by addAdditionalConstraints().
|
static |
Adds general structural constraints to the DAG.
scip | The SCIP instance to add the constraint to. |
psd | The parent set data associated with this problem. |
References get_edge(), ParentSetData::n, ParentSetData::nParents, ParentSetData::nParentSets, ParentSetData::ParentSets, ParentSetData::PaVars, and process_constraint().
Referenced by addAdditionalConstraints().
|
static |
The imsetvar for a subset of nodes = 1 iff one of the elements in the subset has all the others as parents.
It is binary due to acyclicity. If gobnilp/imsetvars == TRUE, creates and sets the branching priority for, variables representing imsets for subsets of nodes of size 3 Note that the imsetvar for a subset of size 2 is an 'edge' variable - these are always created.
scip | SCIP data structure |
psd | parent sets data structure |
References get_edge(), ParentSetData::n, ParentSetData::nodeNames, ParentSetData::nParents, ParentSetData::nParentSets, ParentSetData::ParentSets, and ParentSetData::PaVars.
Referenced by createBasicModel().
|
static |
scip | SCIP data structure |
psd | parent sets data structure |
References get_edge(), ParentSetData::n, ParentSetData::nodeNames, ParentSetData::nParents, ParentSetData::nParentSets, ParentSetData::ParentSets, and ParentSetData::PaVars.
Referenced by createBasicModel().
|
static |
Adds the constraints that there must be one parent set to the problem.
scip | The SCIP instance to add the constraints to. |
psd | The parent set data to use for generating the constraints. |
References ParentSetData::n, ParentSetData::nParentSets, and ParentSetData::PaVars.
Referenced by createBasicModel().
|
static |
Adds constraints ruling out covered arcs from lower to higher vertices.
scip | The SCIP instance to add the constraint to. |
psd | The parent set data associated with this problem. |
References differ(), get_arrow(), ParentSetData::n, ParentSetData::nodeNames, ParentSetData::nParents, ParentSetData::nParentSets, ParentSetData::ParentSets, and ParentSetData::PaVars.
Referenced by addAdditionalConstraints().
|
static |
Adds constraints on the number of nodes that can be parents.
This also requires the creation of a number of binary variables.
scip | The SCIP instance to add the constraint to. |
psd | The parent set data associated with this problem. |
References get_arrow(), ParentSetData::n, and ParentSetData::nodeNames.
Referenced by addAdditionalConstraints().
|
static |
Creates and adds the parent variables to the problem.
scip | The SCIP instance to create the variables for. |
psd | The parent set data to base the variables on. |
scores | The objective function coefficients for each variable. |
References ParentSetData::n, ParentSetData::nodeNames, ParentSetData::nParents, ParentSetData::nParentSets, ParentSetData::ParentSets, and ParentSetData::PaVars.
Referenced by createBasicModel().
|
static |
If gobnilp/pasizevars == TRUE adds and sets the branching priorities of variables representing parent set size.
Creates pasize[i] for each node i which is constrained to be equal to the parent set size of node i
scip | The SCIP instance |
psd | Parent set data |
References ParentSetData::n, ParentSetData::nodeNames, ParentSetData::nParents, ParentSetData::nParentSets, and ParentSetData::PaVars.
Referenced by createBasicModel().
|
static |
If gobnilp/posindvars == TRUE, adds binary variables indicating the position of nodes in a total order consistent with a DAG solution.
Creates n^2 variables posind[i][j], where posind[i][j]==1 iff variable i is in position j in some total order consistent with a DAG solution This is done by the following constraints: pos(j) - pos(i) + n*I(j is a parent of i) =< n-1 pos(i) and pos(j) are integers denoted the index of i and j in a total order. They are defined as a linear combination of posind variables in the obvious way.
scip | SCIP data structure |
psd | parent sets data structure |
References get_arrow(), and ParentSetData::n.
Referenced by createBasicModel().
|
static |
If gobnilp/posvars == TRUE, creates integer variables giving a generation number for each node If a node is a founder its generation number is 0 If j is a parent of i its generation number is strictly less than i's An upper bound on any such variable can be set using gobnilp/maxpos Uses an Indicator constraint.
scip | SCIP data structure |
psd | parent sets data structure |
References get_arrow(), ParentSetData::n, ParentSetData::nParents, ParentSetData::nParentSets, and ParentSetData::PaVars.
Referenced by createBasicModel().
|
static |
If gobnilp/totalordervars == TRUE, creates, and sets the branching priority for, binary variables encoding a total order consistent with a DAG solution Creates binary variables order[i][j] where order[i][j]==1 if i comes after j in the total ordering.
If gobnilp/useconslinearordering == TRUE, the linear ordering constraint handler that comes as an example with SCIP is used If gobnilp/inittransitivity == TRUE then all n^3 transitivity constraints are added to the problem If gobnilp/bestparentsfororder == TRUE then, for each node, a constraint is added so that the highest scoring parent set consistent with the total order must be selected
scip | SCIP data structure |
psd | parent sets data structure |
References get_arrow(), ParentSetData::n, ParentSetData::nParents, ParentSetData::nParentSets, ParentSetData::ParentSets, ParentSetData::PaVars, and SCIPcreateConsLOP().
Referenced by createBasicModel().
|
static |
Adds a constraint stating that an ancestor relation must be present or absent.
This works by simply fixing the relevant ancestor variable
scip | The SCIP instance in which to add the constraint. |
psd | The parent set data for the problem. |
i | The descendant node |
j | The ancestor node |
truthvalue | Whether the relation must or must not appear |
Referenced by process_constraint().
|
static |
Adds a constraint that prevents networks in the same MEC as the current best network being found again.
scip | The SCIP instance being used for the optimisation. |
run | The iteration of the loop that this soilution was found on. |
References get_edge(), MD_getParentSetData(), and ParentSetData::n.
Referenced by BN_addNonRepetitionConstraint().
SCIP_RETCODE BN_addNonRepetitionConstraint | ( | SCIP * | scip, |
int | run | ||
) |
Adds a constraint that prevents the current best network being found again.
scip | The SCIP instance being used for the optimisation. |
run | The iteration of the loop that this soilution was found on. |
References BN_addMECNonRepetitionConstraint(), MD_getParentSetData(), ParentSetData::n, ParentSetData::nParentSets, and ParentSetData::PaVars.
SCIP_RETCODE BN_addParameters | ( | SCIP * | scip | ) |
Adds GOBNILP specific parameters to those recognised by SCIP.
scip | The SCIP instance to add to the parameters to. |
References IO_addOutputParameters(), PD_addPedigreeParameters(), SC_addScoringParameters(), UT_addBoolParam(), UT_addIntParam(), UT_addLongintParam(), UT_addRealParam(), and UT_addStringParam().
Referenced by main().
SCIP_RETCODE BN_doIterativePrint | ( | SCIP * | scip, |
MA_info * | ma_info, | ||
int | run | ||
) |
Prints appropriate information about each optimal solution obtained.
scip | The SCIP instance for which the solution has been found. |
run | The iteration of the main loop that the solution was found on. |
References IO_doIterativePrint(), and MD_getParentSetData().
Referenced by main().
int BN_getNumberOfRepeats | ( | SCIP * | scip | ) |
Gets the number of most likely Bayesian networks that should be found.
scip | The SCIP inatance used for finding the networks. |
Referenced by main().
SCIP_RETCODE BN_includePlugins | ( | SCIP * | scip | ) |
Includes all plugins needed by the problem.
scip | The SCIP instance to add the plugins to. |
References DC_includeConshdlr(), HS_includePrimal(), MD_initialiseMetadata(), SCIPincludeConshdlrChordal(), SCIPincludeConshdlrCi(), SCIPincludeConshdlrLOP(), and SCIPincludeConshdlrPartialOrdering().
Referenced by main().
SCIP_RETCODE BN_printcountsols | ( | SCIP * | scip, |
char * | filename | ||
) |
Prints solutions found using countsols.
scip | The SCIP instance to print scores for. |
References IO_printcountsols(), and MD_getParentSetData().
Referenced by main().
SCIP_RETCODE BN_printHeader | ( | SCIP * | scip | ) |
Prints a header which describes the GOBNILP and SCIP systems being used.
scip | The SCIP instance that is being used. |
References IO_printHeader().
Referenced by main().
SCIP_RETCODE BN_printParameters | ( | SCIP * | scip | ) |
Prints any of the current SCIP or GOBNILP parameters not at their default value.
scip | The SCIP instance to consult the parameters of. |
References IO_printParameters().
Referenced by main().
SCIP_RETCODE BN_printProblem | ( | SCIP * | scip, |
int | run | ||
) |
Prints the current problem.
scip | The SCIP instance for which the problem should be printed. |
run | The iteration of the main loop that the problem is to be solved on. |
References IO_printProblem().
Referenced by main().
SCIP_RETCODE BN_printScores | ( | SCIP * | scip | ) |
Prints the scores for the family variables in Jaakkola format.
scip | The SCIP instance to print scores for. |
References IO_printScoresInJKLFormat(), and MD_getParentSetData().
Referenced by main().
SCIP_RETCODE BN_readProblem | ( | SCIP * | scip, |
char * | inputformat, | ||
char * | frequencyfile, | ||
const char * | filename | ||
) |
Reads in a problem from a file.
Currently supported file formats are "jak", "cip" and "dat". The one to use is determined using the -f
cmmand line argument and the filename extension. See getInputFormat() for details.
scip | The SCIP instance to read the problem in to. |
filename | The filename from which to read the problem. |
References addAdditionalConstraints(), getInputFormat(), MD_getParentSetData(), ParentSetData::n, ParentSetData::nParents, ParentSetData::nParentSets, ParentSetData::ParentSets, readProblemInCIPFormat(), readProblemInNonCIPFormat(), setBranchingPriorities(), and setSpecialProperties().
Referenced by main().
SCIP_RETCODE BN_setParamaterDefaults | ( | SCIP * | scip | ) |
Sets various built-in SCIP parameters to suitable GOBNILP values.
These values can still be overriden using the settings file.
scip | The SCIP instance the parameters relate to. |
Referenced by main().
SCIP_RETCODE BN_suppresscols | ( | SCIP * | scip | ) |
Suppresses output columns according to the value of parameter gobnilp/verblevelsetcols.
Referenced by main().
|
static |
Adds a conditional independence (ci) constraint.
scip | The SCIP instance in which to add the constraint. |
psd | The parent set data for the problem. |
a_str | A set |
b_str | B set |
s_str | S (separator) set |
References ParentSetData::n, ParentSetData::nParents, ParentSetData::nParentSets, ParentSetData::ParentSets, parseSet(), ParentSetData::PaVars, and SCIPcreateConsCi().
Referenced by process_constraint().
|
static |
Adds the variables and constraints needed for the basic DAG learning problem.
scip | The SCIP instance to create the problem in. |
psd | The parent set data to base the problem on. |
scores | The scores of each of the parent sets in the problem. |
References addAcyclicityConstraints(), addAncestorVariables(), addArrowVariables(), addImsetVariables(), addKBestMECVariables(), addNChildrenVars(), addOneParentSetConstraints(), addParentVariables(), addPaSizeVariables(), addPosindVariables(), addPosVariables(), and addTotalorderVariables().
Referenced by readProblemInNonCIPFormat().
|
static |
Determines if two parent sets differ by just a single given item.
scip | The SCIP instance the variable sets belong to. |
psd | The parent set data for the problem. |
i | The child variable. |
ki1 | The index of one parent set of i. |
ki2 | The index of another parent set of i. |
j | A variable. |
References ParentSetData::nParents, and ParentSetData::ParentSets.
Referenced by addOrderedCoveredArcConstraints().
|
static |
Adds a constraint stating that an edge must be present or absent.
This works by simply fixing the relevant edge or arrow variable
scip | The SCIP instance in which to add the constraint. |
psd | The parent set data for the problem. |
i | The node from which the edge starts. |
j | The node at which the edge finishes. |
undirected | Whether the edge is undirected or not. |
truthvalue | Whether the edge must or must not appear |
References get_arrow(), and get_edge().
Referenced by process_constraint().
|
static |
Gets the delimiter information needed to read in information from files.
scip | The SCIP instance being used. |
num_delims | The number of delimiters. |
delims | The delimiters to use. |
merge_delims | Whether consecutive delimiters should be merged into one. |
Referenced by readProblemInNonCIPFormat().
|
static |
Gets the format in which the input file has been given.
If the format has been set on the command line, this will be given. If this is not set, then the suffix of the filename will be examined. If this does not work, then DEFAULT_GOBNILP_PARAMS_FILE is used.
scip | The SCIP instance this applies to. |
filename | The name of the file to read. |
Referenced by BN_readProblem().
|
static |
Gets a problem name based on the file from which it was read.
This function copied from LOP example written by March Pfetsch.
filename | input filename |
probname | output problemname |
maxSize | maximum size of probname |
Referenced by readProblemInNonCIPFormat().
|
static |
Adds a constraint enforcing or preventing an immorality constraint.
scip | The SCIP instance in which to add the constraint. |
psd | The parent set data for the problem. |
i | A parent involved in the immorality constraint. |
j | The other parent involved. |
child | The child involved in the constraint. |
truthvalue | TRUE if the immorality must exist, FALSE if it must not exist. |
References get_edge(), ParentSetData::nodeNames, ParentSetData::nParents, ParentSetData::nParentSets, ParentSetData::ParentSets, and ParentSetData::PaVars.
Referenced by process_constraint().
|
static |
Adds a constraint stating that variable i must come before variable j in any variable ordering consistent with the learned network This works by simply fixing the relevant total order variable An error is generated if the user has not asked for the total order constraint handler to be used.
scip | The SCIP instance in which to add the constraint. |
psd | The parent set data for the problem. |
i | The node which must be earlier in the order. |
j | The node which must be later in the order. |
Referenced by process_constraint().
|
static |
Parses a string to extract a set from it.
scip | The SCIP instance that this belongs to. |
psd | The data set that the set refers to. |
str | string to parse |
set | result set |
n_set | length of set |
success | success flag |
References get_index().
Referenced by ci_constraint().
|
static |
Adds a constraint on the DAG structure.
scip | The SCIP instance in which to add the constraint. |
psd | The parent set data relating to this problem. |
line | The description of the constraint to add. |
References ancestor_constraint(), ci_constraint(), edge_constraint(), get_index(), immorality_constraint(), order_constraint(), and sink_constraint().
Referenced by addGeneralDAGConstraints().
|
static |
Reads a problem from a file in cip format.
scip | The SCIP instance in to which the problem should be read. |
filename | The file to read the problem from. |
Referenced by BN_readProblem().
|
static |
Reads local score BN file (in Jaakkola format)
Format:
scip | The SCIP instance being used. |
filename | The file to read from. |
psd | The parentage data that is read from the file. |
scores | The score of each of the parent set combinations. |
prop | The properties of the data read from the file. |
References ParentSetData::n, PropertyData::n, ParentSetData::nodeNames, ParentSetData::nParents, ParentSetData::nParentSets, PropertyData::num_properties, ParentSetData::ParentSets, PropertyData::property_names, and PropertyData::property_values.
Referenced by readProblemInNonCIPFormat().
|
static |
Reads a problem from a file in a format other than CIP.
scip | The SCIP instance in to which the problem should be read. |
filename | The file to read the problem from. |
format | The format the problem is given in. |
References createBasicModel(), getDelimiters(), getProblemName(), IO_printScoresInJKLFormat(), MD_setParentSetData(), MD_setPropertyData(), ParentSetData::n, ParentSetData::nodeNames, ParentSetData::nParents, ParentSetData::nParentSets, ParentSetData::ParentSets, ParentSetData::PaVars, PR_deallocatePropertyData(), PR_initialise(), PS_readProblemInGenomeFormat(), readProblemInJaakkolaFormat(), readProblemInPSSFormat(), and SC_readProblemInDataFormat().
Referenced by BN_readProblem().
|
static |
Reads local score BN file (in PSS format)
scip | The SCIP instance being used. |
filename | The file to read from. |
psd | The parentage data that is read from the file. |
scores | The score of each of the parent set combinations. |
prop | The properties of the data read from the file. |
Referenced by readProblemInNonCIPFormat().
|
static |
Sets the branching priority of variables.
scip | The SCIP instance being used. |
psd | The data for the problem. |
References get_arrow(), get_edge(), ParentSetData::n, ParentSetData::nParentSets, and ParentSetData::PaVars.
Referenced by BN_readProblem().
|
static |
Sets properties to non-standard values.
scip | The SCIP instance being used. |
psd | The data for the problem. |
References get_arrow(), get_edge(), ParentSetData::n, ParentSetData::nParentSets, and ParentSetData::PaVars.
Referenced by BN_readProblem().
|
static |
Adds a constraint stating that a given node must be a sink This is effected by fixing all parent set indicator variables to zero if the sink is one of the parents.
scip | The SCIP instance in which to add the constraint. |
psd | The parent set data for the problem. |
sink | The node which must be a sink. |
References ParentSetData::n, ParentSetData::nParents, ParentSetData::nParentSets, ParentSetData::ParentSets, and ParentSetData::PaVars.
Referenced by process_constraint().