GOBNILP
f164d83
|
Contains all the functions related to writing data to files. More...
#include "output.h"
#include "parent_set_data.h"
#include "pedigrees.h"
#include "utils.h"
#include "probdata_bn.h"
#include "versiongit.h"
#include <string.h>
#include <time.h>
#include "scip/scipdefplugins.h"
#include <scip/cons_countsols.h>
Functions | |
static char * | createFilename (char *filename, const char *probname, int nbns, int iteration) |
Constructs a filename for output for a particular iteration of the program. More... | |
static int | findExtension (char *filename) |
Finds the location in a string of the file extension. More... | |
SCIP_RETCODE | IO_addOutputParameters (SCIP *scip) |
Adds the parameters to SCIP related to outputing results. More... | |
SCIP_RETCODE | IO_doIterativePrint (SCIP *scip, MA_info *ma_info, ParentSetData *psd, int run) |
Prints appropriate information about each optimal solution obtained. More... | |
SCIP_RETCODE | IO_printcountsols (SCIP *scip, ParentSetData *psd, char *filename) |
Prints solutions found using countsols. More... | |
SCIP_RETCODE | IO_printHeader (SCIP *scip) |
Prints a header which describes the GOBNILP and SCIP systems being used. More... | |
SCIP_RETCODE | IO_printParameters (SCIP *scip) |
Prints any of the current SCIP or GOBNILP parameters not at their default value. More... | |
SCIP_RETCODE | IO_printProblem (SCIP *scip, int run) |
Prints the current problem in cip format. More... | |
SCIP_RETCODE | IO_printScoresInJKLFormat (SCIP *scip, ParentSetData *psd, SCIP_Real **scores) |
Conditionally, prints the scores to file. More... | |
SCIP_RETCODE | IO_printScoresInPSSFormat (SCIP *scip, ParentSetData *psd, PropertyData *prop) |
static SCIP_Bool | isRecognisedMETA (const char *name) |
static void | lookupAndPrintMetaLine (SCIP *scip, FILE *file, PropertyData *prop, int individual, const char *name) |
static SCIP_RETCODE | printAverages (SCIP *scip, MA_info *ma_info, ParentSetData *psd, char *filename, char *format) |
Prints the model average data. More... | |
static void | printBlankLine (FILE *file) |
static void | printCommentLine (FILE *file, const char *comment) |
static void | printMetaLine (FILE *file, const char *name, const char *value) |
static SCIP_RETCODE | printSCIPSolution (SCIP *scip) |
static void | printScoreLine (FILE *file, SCIP_VAR *var, int num_parents, int *parents, char **names) |
static SCIP_RETCODE | printSolution (SCIP *scip, ParentSetData *psd, char *filename, char *format) |
Prints the solution of the problem after solving. More... | |
static SCIP_RETCODE | printSolutionAdjacencyMatrixFormat (SCIP *scip, ParentSetData *psd, SCIP_Real **Scores, SCIP_Bool **selected, SCIP_Real total_score, FILE *stream) |
Prints the solution as an adjacency matrix. More... | |
static SCIP_RETCODE | printSolutionBNFormat (SCIP *scip, ParentSetData *psd, SCIP_Real **Scores, SCIP_Bool **selected, SCIP_Real total_score, FILE *stream) |
Prints the solution in a Bayesian network format. More... | |
static SCIP_RETCODE | printSolutionDotFormat (SCIP *scip, ParentSetData *psd, SCIP_Real **Scores, SCIP_Bool **selected, SCIP_Real total_score, FILE *stream) |
Prints the solution as a file suitable for plotting using the dot command from graphviz. More... | |
static SCIP_RETCODE | printSolutionLegacyFormat (SCIP *scip, ParentSetData *psd, SCIP_Real **Scores, SCIP_Bool **selected, SCIP_Real total_score, FILE *stream) |
Prints the solution in the traditional GOBNILP format. More... | |
static SCIP_RETCODE | printSolutionMECFormat (SCIP *scip, ParentSetData *psd, SCIP_Real **Scores, SCIP_Bool **selected, SCIP_Real total_score, FILE *stream) |
Prints the Markov equivalance class of the solution. More... | |
static SCIP_RETCODE | printSolutionScoreAndTimeFormat (SCIP *scip, ParentSetData *psd, SCIP_Real **Scores, SCIP_Bool **selected, SCIP_Real total_score, FILE *stream, SCIP_Real soltime) |
Prints just the objective value of the given solution and the time taken to find the solution. More... | |
static SCIP_RETCODE | printToFile (SCIP *scip, ParentSetData *psd, SCIP_Real **Scores, SCIP_Bool **selected, char *filename, char *format, SCIP_Real soltime, SCIP_Real total_score, SCIP_Bool *pedVals) |
Prints a solution to the problem. More... | |
static void | printVariableLine (FILE *file, const char *name) |
Contains all the functions related to writing data to files.
|
static |
Constructs a filename for output for a particular iteration of the program.
The filename constructed will be the input filename the iteration number appearing before the file extension or appended if there is no extension. If there is only a single network to find, then the iteration number is not inserted. For special values ("" and "stdout"), the value returned is the same value as given as input. Any occurrence of <probname> will be replaced with the basename of the problem.
filename | The filename to insert the string in to. |
probname | The basename of the problem. |
nbns | The number of Bayesian networks that the program is trying to find. |
iteration | The current iteration of the program. |
References findExtension().
Referenced by IO_printProblem(), and IO_printScoresInJKLFormat().
|
static |
Finds the location in a string of the file extension.
filename | The filename to inspect. |
Referenced by createFilename().
SCIP_RETCODE IO_addOutputParameters | ( | SCIP * | scip | ) |
Adds the parameters to SCIP related to outputing results.
These parameters consist of all those of the form gobnilp/outputfile/<param>
. Some other output parameters exist, but these can be currently found in probdata_bn.c .
scip | The SCIP instance to which parameters should be added. |
References UT_addBoolParam(), UT_addIntParam(), and UT_addStringParam().
Referenced by BN_addParameters().
SCIP_RETCODE IO_doIterativePrint | ( | SCIP * | scip, |
MA_info * | ma_info, | ||
ParentSetData * | psd, | ||
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. |
psd | The parentage data for the problem. |
Referenced by BN_doIterativePrint().
SCIP_RETCODE IO_printcountsols | ( | SCIP * | scip, |
ParentSetData * | psd, | ||
char * | filename | ||
) |
Prints solutions found using countsols.
scip | The SCIP instance to print solutions for. |
filename | The name of the file where solutions will be put. |
References ParentSetData::n, ParentSetData::nParentSets, ParentSetData::PaVars, and printSolutionLegacyFormat().
Referenced by BN_printcountsols().
SCIP_RETCODE IO_printHeader | ( | SCIP * | scip | ) |
Prints a header which describes the GOBNILP and SCIP systems being used.
scip | The SCIP instance that is being used. |
Referenced by BN_printHeader().
SCIP_RETCODE IO_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. |
Referenced by BN_printParameters().
SCIP_RETCODE IO_printProblem | ( | SCIP * | scip, |
int | run | ||
) |
Prints the current problem in cip format.
scip | The SCIP instance for which to print the problem. |
run | The iteration of the main loop that the problem is to be solved on. |
References createFilename().
Referenced by BN_printProblem().
SCIP_RETCODE IO_printScoresInJKLFormat | ( | SCIP * | scip, |
ParentSetData * | psd, | ||
SCIP_Real ** | scores | ||
) |
Conditionally, prints the scores to file.
scip | The SCIP instance the scores belong to. |
psd | The parent set data to print the data for. |
scores | Local scores (only used if SCIP variables have not been created) |
References createFilename(), ParentSetData::n, ParentSetData::nodeNames, ParentSetData::nParents, ParentSetData::nParentSets, ParentSetData::ParentSets, and ParentSetData::PaVars.
Referenced by BN_printScores(), and readProblemInNonCIPFormat().
|
static |
Prints the model average data.
scip | The SCIP instance for which to print the averages. |
psd | The parentage data for the problem. |
filename | The filename to output to, "stdout" for stdout or "" for nowhere. |
format | The format in which to print the averages. Recognised values are dot, pedigree, scoreandtime, legacy, adjacencymatrx and normal. |
References MA_getAverageValue(), MA_getTotalAveragesScore(), MA_getTotalAveragesTime(), ParentSetData::n, ParentSetData::nParentSets, ParentSetData::PaVars, and printToFile().
|
static |
Prints the solution of the problem after solving.
scip | The SCIP instance for which to print the solution. |
psd | The parentage data for the problem.vvv |
filename | The filename to output to, "stdout" for stdout or "" for nowhere. |
format | The format in which to print the solution. Recognised values are dot, pedigree, scoreandtime, legacy, adjacencymatrx and normal. |
References ParentSetData::n, ParentSetData::nParentSets, ParentSetData::PaVars, PD_getCurrentPedigreeVarValues(), PD_inPedigreeMode(), and printToFile().
|
static |
Prints the solution as an adjacency matrix.
scip | The SCIP instance to which the solution belongs. |
psd | The problem data used by the solution. |
Scores | The score data to use for the solution. |
selected | Whether each of the variables is selected in the solution. |
total_score | The overall score of this solution. |
stream | Where to print the solution. |
References ParentSetData::n, ParentSetData::nParents, ParentSetData::nParentSets, and ParentSetData::ParentSets.
Referenced by printToFile().
|
static |
Prints the solution in a Bayesian network format.
scip | The SCIP instance to which the solution belongs. |
psd | The problem data used by the solution. |
Scores | The score data to use for the solution. |
selected | Whether each of the variables is selected in the solution. |
total_score | The overall score of this solution. |
stream | Where to print the solution. |
References ParentSetData::n, ParentSetData::nodeNames, ParentSetData::nParents, ParentSetData::nParentSets, and ParentSetData::ParentSets.
Referenced by printToFile().
|
static |
Prints the solution as a file suitable for plotting using the dot command from graphviz.
scip | The SCIP instance to which the solution belongs. |
psd | The problem data used by the solution. |
Scores | The score data to use for the solution. |
selected | Whether each of the variables is selected in the solution. |
total_score | The overall score of this solution. |
stream | Where to print the solution. |
References ParentSetData::n, ParentSetData::nodeNames, ParentSetData::nParents, ParentSetData::nParentSets, and ParentSetData::ParentSets.
Referenced by printToFile().
|
static |
Prints the solution in the traditional GOBNILP format.
scip | The SCIP instance to which the solution belongs. |
psd | The problem data used by the solution. |
Scores | The score data to use for the solution. |
selected | Whether each of the variables is selected in the solution. |
total_score | The overall score of this solution. |
stream | Where to print the solution. |
References ParentSetData::n, ParentSetData::nodeNames, ParentSetData::nParents, ParentSetData::nParentSets, and ParentSetData::ParentSets.
Referenced by IO_printcountsols(), and printToFile().
|
static |
Prints the Markov equivalance class of the solution.
scip | The SCIP instance to which the solution belongs. |
psd | The problem data used by the solution. |
Scores | The score data to use for the solution. |
selected | Whether each of the variables is selected in the solution. |
total_score | The overall score of this solution. |
stream | Where to print the solution. |
References ParentSetData::n, ParentSetData::nodeNames, ParentSetData::nParents, ParentSetData::nParentSets, and ParentSetData::ParentSets.
Referenced by printToFile().
|
static |
Prints just the objective value of the given solution and the time taken to find the solution.
scip | The SCIP instance to which the solution belongs. |
psd | The problem data used by the solution. |
Scores | The score data to use for the solution. |
selected | Whether each of the variables is selected in the solution. |
total_score | The overall score of this solution. |
stream | Where to print the solution. |
soltime | The time taken to find the solution. |
Referenced by printToFile().
|
static |
Prints a solution to the problem.
scip | The SCIP instance for which to print the solution. |
psd | The problem data used by the solution. |
Scores | The score data to use for the solution. |
selected | Whether each of the variables is selected in the solution. |
total_score | The overall score of this solution. |
filename | The filename to output to, "stdout" for stdout or "" for nowhere. |
format | The format in which to print the solution. Recognised values are dot, pedigree, scoreandtime, legacy, adjacencymatrx and normal. |
soltime | The time taken to find the solution. |
pedVals | Whether each of the pedigree specific variables is selected in the solution. |
References PD_printSolutionPedigreeFormat(), printSolutionAdjacencyMatrixFormat(), printSolutionBNFormat(), printSolutionDotFormat(), printSolutionLegacyFormat(), printSolutionMECFormat(), and printSolutionScoreAndTimeFormat().
Referenced by printAverages(), and printSolution().