GOBNILP
f164d83
|
Contains all the functions related to the use of pedigrees in the program. More...
#include "probdata_bn.h"
#include "pedigrees.h"
#include "pedigree_data.h"
#include "parent_set_data.h"
#include "metadata.h"
#include "utils.h"
#include "versiongit.h"
#include <string.h>
Functions | |
static SCIP_RETCODE | addFullSiblingAgeGapConstraint (SCIP *scip, ParentSetData *psd, int max_age_gap, PedigreeData *peddata) |
Creates constraints which prevent the age gap better a pair of full siblings being too great. More... | |
static SCIP_RETCODE | addHalfSiblingAgeGapConstraint (SCIP *scip, ParentSetData *psd, int max_age_gap, PedigreeData *peddata) |
Creates constraints which prevent the age gap better a pair of half siblings with a common mother being too great. More... | |
static SCIP_RETCODE | addMaximumNumberOfOffspringConstraint (SCIP *scip, ParentSetData *psd, int max_size, SCIP_Bool mother, SCIP_Bool father, PedigreeData *peddata) |
Creates constraints stating that individuals cannot have more than a given number of children. More... | |
static SCIP_RETCODE | addMaximumSibsetSizeConstraint (SCIP *scip, ParentSetData *psd, int max_size, PedigreeData *peddata) |
Creates constraints stating that a pair of individuals cannot have more than a given number of children together. More... | |
static SCIP_RETCODE | addSexConsistencyConstraint (SCIP *scip, ParentSetData *psd, PedigreeData *peddata) |
Creates constraints enforcing sexual consistency on a pedigree. More... | |
static SCIP_RETCODE | assignSexVariables (SCIP *scip, SCIP_SOL *sol, ParentSetData *psd, SCIP_Bool *possible) |
Determines a possible assignment of the sex variables for a given primal solution. More... | |
static SCIP_Bool | checkSuitableForPedigree (SCIP *scip, ParentSetData *psd) |
Checks whether a SCIP problem is suitable for use as a pedigree. More... | |
static SCIP_RETCODE | PD_addPedigreeConstraints (SCIP *scip, ParentSetData *psd, PedigreeData *peddata) |
Adds all appropriate pedigree based constraints to the problem. More... | |
SCIP_RETCODE | PD_addPedigreeParameters (SCIP *scip) |
Makes SCIP recognise parameters related to pedigree reconstruction. More... | |
SCIP_RETCODE | PD_addPedigreeSpecificConstraints (SCIP *scip, ParentSetData *psd) |
Adds any constraints and variables needed for pedigree based constraints. More... | |
static SCIP_RETCODE | PD_addPedigreeVariables (SCIP *scip, ParentSetData *psd, PedigreeData *peddata) |
Creates any needed variables needed specifically for learning pedigrees. More... | |
SCIP_RETCODE | PD_assignPedigreeVariables (SCIP *scip, SCIP_SOL *sol, ParentSetData *psd, SCIP_Bool *possible) |
Tries to find values for any pedigree specific variables in a given primal solution. More... | |
SCIP_Bool * | PD_getCurrentPedigreeVarValues (SCIP *scip) |
Gets the values of the pedigree specific variables in the current solution. More... | |
SCIP_Bool | PD_inPedigreeMode (SCIP *scip) |
Determines whether the program is being run for learning pedigrees. More... | |
SCIP_RETCODE | PD_printSolutionPedigreeFormat (SCIP *scip, ParentSetData *psd, SCIP_Real **Scores, SCIP_Bool **selected, SCIP_Real total_score, FILE *stream, SCIP_Bool *pedvars) |
Prints the solution as a pedigree. More... | |
static SCIP_Bool | usingSexConsistency (SCIP *scip) |
Checks whether the program is enforcing sex consistency. More... | |
Contains all the functions related to the use of pedigrees in the program.
|
static |
Creates constraints which prevent the age gap better a pair of full siblings being too great.
scip | The SCIP instance in which to apply the constraint. |
psd | The parent set data associated with this problem. |
max_age_gap | The maximum permissible age gap. |
peddata | The pedigree data to use to construct the constraint. |
References PedigreeData::ages, PedigreeData::n, ParentSetData::nodeNames, ParentSetData::nParents, ParentSetData::nParentSets, ParentSetData::ParentSets, ParentSetData::PaVars, and UT_createEmptyLTEConstraint().
Referenced by PD_addPedigreeConstraints().
|
static |
Creates constraints which prevent the age gap better a pair of half siblings with a common mother being too great.
scip | The SCIP instance in which to apply the constraint. |
psd | The parent set data associated with this problem. |
max_age_gap | The maximum permissible age gap. |
peddata | The pedigree data to use to construct the constraint. |
References PedigreeData::ages, PedigreeData::n, ParentSetData::nodeNames, ParentSetData::nParents, ParentSetData::nParentSets, ParentSetData::ParentSets, ParentSetData::PaVars, PedigreeData::SexVars, and UT_createEmptyLTEConstraint().
Referenced by PD_addPedigreeConstraints().
|
static |
Creates constraints stating that individuals cannot have more than a given number of children.
scip | The SCIP instance this applies in. |
psd | The parent set data associated with this problem. |
max_size | The maximum number of children an indiivdual may have. |
mother | Whether the constraint should apply to mothers. |
father | Whether the constraint should apply to fathers. |
peddata | The pedigree data to use to construct the constraint. |
References PedigreeData::n, ParentSetData::nodeNames, ParentSetData::nParents, ParentSetData::nParentSets, ParentSetData::ParentSets, ParentSetData::PaVars, PedigreeData::SexVars, and UT_createEmptyLTEConstraint().
Referenced by PD_addPedigreeConstraints().
|
static |
Creates constraints stating that a pair of individuals cannot have more than a given number of children together.
scip | The SCIP instance this applies in. |
psd | The parent set data associated with this problem. |
max_size | The maximum number of children an indiivdual may have. |
peddata | The pedigree data to use to construct the constraint. |
References PedigreeData::n, ParentSetData::nodeNames, ParentSetData::nParents, ParentSetData::nParentSets, ParentSetData::ParentSets, ParentSetData::PaVars, and UT_createEmptyLTEConstraint().
Referenced by PD_addPedigreeConstraints().
|
static |
Creates constraints enforcing sexual consistency on a pedigree.
scip | The SCIP instance in which the constraints should be added. |
psd | The parent set data associated with this problem. |
peddata | The pedigree data to use to construct the constraint. |
References PedigreeData::n, ParentSetData::nParents, ParentSetData::nParentSets, ParentSetData::ParentSets, ParentSetData::PaVars, PedigreeData::SexVars, and UT_createEmptyLTEConstraint().
Referenced by PD_addPedigreeConstraints().
|
static |
Determines a possible assignment of the sex variables for a given primal solution.
If there is no possible assignment of sex variables (i.e. the primal is sexually inconsistent) then the function returns an appropriate error message.
scip | The SCIP instance on which the heuristic is running. |
sol | The heuristic solution being worked on. |
psd | The heursitic data related to this primal heursitic. |
possible | Will be set to TRUE if an assignment was possible. |
References MD_getPedigreeData(), PedigreeData::n, ParentSetData::nParents, ParentSetData::nParentSets, ParentSetData::ParentSets, ParentSetData::PaVars, and PedigreeData::SexVars.
Referenced by PD_assignPedigreeVariables().
|
static |
Checks whether a SCIP problem is suitable for use as a pedigree.
A problem is acceptable as a pedigree if it has no parent sets of more than size 2.
scip | The SCIP instance for which to check the data. |
psd | The parent set data associated with this problem. |
References ParentSetData::n, ParentSetData::nParents, and ParentSetData::nParentSets.
Referenced by PD_addPedigreeConstraints(), PD_addPedigreeVariables(), PD_assignPedigreeVariables(), and PD_printSolutionPedigreeFormat().
|
static |
Adds all appropriate pedigree based constraints to the problem.
scip | The SCIP instance in which to add the constraints. |
psd | The parent set data associated with this problem. |
peddata | The pedigree data to use to construct the constraints. |
References addFullSiblingAgeGapConstraint(), addHalfSiblingAgeGapConstraint(), addMaximumNumberOfOffspringConstraint(), addMaximumSibsetSizeConstraint(), addSexConsistencyConstraint(), checkSuitableForPedigree(), PedigreeData::sexes, and usingSexConsistency().
Referenced by PD_addPedigreeSpecificConstraints().
SCIP_RETCODE PD_addPedigreeParameters | ( | SCIP * | scip | ) |
Makes SCIP recognise parameters related to pedigree reconstruction.
scip | The SCIP instance to which to add the parameters. |
References UT_addBoolParam(), UT_addIntParam(), UT_addRealParam(), and UT_addStringParam().
Referenced by BN_addParameters().
SCIP_RETCODE PD_addPedigreeSpecificConstraints | ( | SCIP * | scip, |
ParentSetData * | psd | ||
) |
Adds any constraints and variables needed for pedigree based constraints.
scip | The SCIP instance in which to add the constraints. |
psd | The parent set data associated with this problem. |
References PedigreeData::ages, MD_getPedigreeData(), MD_setPedigreeData(), PedigreeData::n, ParentSetData::n, PD_addPedigreeConstraints(), PD_addPedigreeVariables(), PE_deallocatePedigreeData(), PedigreeData::sexes, and PedigreeData::SexVars.
Referenced by addAdditionalConstraints().
|
static |
Creates any needed variables needed specifically for learning pedigrees.
scip | The SCIP instance in which to create the variables. |
psd | The parent set data associated with this problem. |
peddata | The pedigree data to store the variables in. |
References checkSuitableForPedigree(), PedigreeData::n, ParentSetData::nodeNames, PedigreeData::sexes, PedigreeData::SexVars, and usingSexConsistency().
Referenced by PD_addPedigreeSpecificConstraints().
SCIP_RETCODE PD_assignPedigreeVariables | ( | SCIP * | scip, |
SCIP_SOL * | sol, | ||
ParentSetData * | psd, | ||
SCIP_Bool * | possible | ||
) |
Tries to find values for any pedigree specific variables in a given primal solution.
If there is no possible assignment of pedigree variables then the function returns an appropriate error message.
scip | The SCIP instance on which the heuristic is running. |
sol | The heuristic solution being worked on. |
psd | The heursitic data related to this primal heursitic. |
possible | Returns whether a valid assignment was possible. |
References assignSexVariables(), checkSuitableForPedigree(), and usingSexConsistency().
SCIP_Bool* PD_getCurrentPedigreeVarValues | ( | SCIP * | scip | ) |
Gets the values of the pedigree specific variables in the current solution.
If no pedigree specific variables are being used, NULL is returned.
scip | The SCIP instance for which to find the variable values. |
References MD_getPedigreeData(), PedigreeData::n, PedigreeData::SexVars, and usingSexConsistency().
Referenced by printSolution().
SCIP_Bool PD_inPedigreeMode | ( | SCIP * | scip | ) |
Determines whether the program is being run for learning pedigrees.
scip | The SCIP instance that is running. |
Referenced by addAdditionalConstraints(), printSolution(), and usingSexConsistency().
SCIP_RETCODE PD_printSolutionPedigreeFormat | ( | SCIP * | scip, |
ParentSetData * | psd, | ||
SCIP_Real ** | Scores, | ||
SCIP_Bool ** | selected, | ||
SCIP_Real | total_score, | ||
FILE * | stream, | ||
SCIP_Bool * | pedvars | ||
) |
Prints the solution as a pedigree.
The pedigree consists of four columns. The first is the individual, thes second is the sex of the individual, the third is its father and the fourth is its mother. If either the father or the mother is not present in the sample, a '-' is printed instead. If sex consistency is enforced, then individuals will not appear as father of one individual and mother of another. The pedigree is sorted such that all individuals are declared on a earlier line than those in which they appear as parents.
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. |
pedvars | Whether each of the pedigree specific variables is selected in the solution. |
References checkSuitableForPedigree(), MD_getPedigreeData(), PedigreeData::n, ParentSetData::nodeNames, ParentSetData::nParents, ParentSetData::nParentSets, ParentSetData::ParentSets, and usingSexConsistency().
Referenced by printToFile().
|
static |
Checks whether the program is enforcing sex consistency.
If the deprecated version of rhe sex consistency parameter is being used then a message will warn the user of this.
scip | The SCIP instance of which to check the status. |
References PD_inPedigreeMode().
Referenced by PD_addPedigreeConstraints(), PD_addPedigreeVariables(), PD_assignPedigreeVariables(), PD_getCurrentPedigreeVarValues(), and PD_printSolutionPedigreeFormat().