GOBNILP  f164d83
property_data.h
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2  * GOBNILP Copyright (C) 2012-2017 James Cussens, Mark Bartlett *
3  * *
4  * This program is free software; you can redistribute it and/or *
5  * modify it under the terms of the GNU General Public License as *
6  * published by the Free Software Foundation; either version 3 of the *
7  * License, or (at your option) any later version. *
8  * *
9  * This program is distributed in the hope that it will be useful, *
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
12  * General Public License for more details. *
13  * *
14  * You should have received a copy of the GNU General Public License *
15  * along with this program; if not, see *
16  * <http://www.gnu.org/licenses>. *
17  * *
18  * Additional permission under GNU GPL version 3 section 7 *
19  * *
20  * If you modify this Program, or any covered work, by linking or *
21  * combining it with SCIP (or a modified version of that library), *
22  * containing parts covered by the terms of the ZIB Academic License, *
23  * the licensors of this Program grant you additional permission to *
24  * convey the resulting work. *
25  * *
26  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
27 
32 #ifndef __PROPERTY_DATA_H__
33 #define __PROPERTY_DATA_H__
34 
35 #include <scip/scip.h>
36 
38 typedef struct
39 {
40 
41  /* Global Properties */
48 
49  /* Local Properties */
51  int n;
55  char*** property_names;
57  char*** property_values;
58 
59 } PropertyData;
60 
61 extern SCIP_RETCODE PR_deallocatePropertyData(SCIP* scip, PropertyData** pd);
62 extern SCIP_RETCODE PR_copyPropertyData(SCIP* scip, PropertyData* original, PropertyData** duplicate);
63 
64 extern SCIP_RETCODE PR_writeToFile(SCIP* scip, FILE* file, PropertyData* pd);
65 extern SCIP_RETCODE PR_parse(SCIP* scip, char* str, PropertyData** pd);
66 
67 extern void PR_initialise(PropertyData* pd);
68 
69 extern SCIP_Bool PR_hasGlobalProperty(SCIP* scip, PropertyData* pd, const char* name);
70 extern char* PR_getGlobalProperty(SCIP* scip, PropertyData* pd, const char* name);
71 extern SCIP_RETCODE PR_setGlobalProperty(SCIP* scip, PropertyData* pd, const char* name, const char* value);
72 extern SCIP_RETCODE PR_setGlobalPropertyFromInt(SCIP* scip, PropertyData* pd, const char* name, int value);
73 extern SCIP_RETCODE PR_setGlobalPropertyFromReal(SCIP* scip, PropertyData* pd, const char* name, SCIP_Real value);
74 extern SCIP_RETCODE PR_setGlobalPropertyFromBool(SCIP* scip, PropertyData* pd, const char* name, SCIP_Bool value);
75 extern SCIP_RETCODE PR_setGlobalPropertyFromArray(SCIP* scip, PropertyData* pd, const char* name, const char** value, int length);
76 extern SCIP_RETCODE PR_setGlobalPropertyFromRealArray(SCIP* scip, PropertyData* pd, const char* name, SCIP_Real* value, int length);
77 
78 extern SCIP_Bool PR_hasProperty(SCIP* scip, PropertyData* pd, int individual, const char* name);
79 extern char* PR_getProperty(SCIP* scip, PropertyData* pd, int individual, const char* name);
80 extern SCIP_RETCODE PR_setProperty(SCIP* scip, PropertyData* pd, int individual, const char* name, const char* value);
81 extern SCIP_RETCODE PR_setPropertyFromInt(SCIP* scip, PropertyData* pd, int individual, const char* name, int value);
82 extern SCIP_RETCODE PR_setPropertyFromReal(SCIP* scip, PropertyData* pd, int individual, const char* name, SCIP_Real value);
83 extern SCIP_RETCODE PR_setPropertyFromBool(SCIP* scip, PropertyData* pd, int individual, const char* name, SCIP_Bool value);
84 extern SCIP_RETCODE PR_setPropertyFromArray(SCIP* scip, PropertyData* pd, int individual, const char* name, const char** value, int length);
85 extern SCIP_RETCODE PR_setPropertyFromRealArray(SCIP* scip, PropertyData* pd, int individual, const char* name, SCIP_Real* value, int length);
86 
87 #endif
SCIP_Bool PR_hasProperty(SCIP *scip, PropertyData *pd, int individual, const char *name)
Does a property data structure have a given property for a given individual?
Definition: property_data.c:553
SCIP_RETCODE PR_setGlobalPropertyFromInt(SCIP *scip, PropertyData *pd, const char *name, int value)
Set a global property to a given value.
Definition: property_data.c:454
SCIP_RETCODE PR_parse(SCIP *scip, char *str, PropertyData **pd)
Parses a PropertyData structure from a sting.
Definition: property_data.c:244
SCIP_RETCODE PR_setPropertyFromArray(SCIP *scip, PropertyData *pd, int individual, const char *name, const char **value, int length)
Set a property for an individual to a given value Value is converted from an array of strings to a st...
Definition: property_data.c:689
SCIP_RETCODE PR_setGlobalPropertyFromRealArray(SCIP *scip, PropertyData *pd, const char *name, SCIP_Real *value, int length)
Set a global property to a given value Value is converted from an array of reals to a string...
Definition: property_data.c:527
SCIP_RETCODE PR_setPropertyFromBool(SCIP *scip, PropertyData *pd, int individual, const char *name, SCIP_Bool value)
Set a property for an individual to a given value Value is converted from a SCIP_Bool to a string...
Definition: property_data.c:671
SCIP_RETCODE PR_setGlobalPropertyFromBool(SCIP *scip, PropertyData *pd, const char *name, SCIP_Bool value)
Set a global property to a given value Value is converted from a SCIP_Bool to a string.
Definition: property_data.c:486
int n
The number of individuals with properties.
Definition: property_data.h:51
char *** property_names
The names of the properties of each individual.
Definition: property_data.h:55
char *** property_values
The values of the properties of each individual.
Definition: property_data.h:57
SCIP_RETCODE PR_setPropertyFromReal(SCIP *scip, PropertyData *pd, int individual, const char *name, SCIP_Real value)
Set a property for an individual to a given value Value is converted from a SCIP_Real to a string...
Definition: property_data.c:654
int num_global
The number of global properties.
Definition: property_data.h:43
SCIP_RETCODE PR_copyPropertyData(SCIP *scip, PropertyData *original, PropertyData **duplicate)
Makes a deep copy of a PropertyData structure.
Definition: property_data.c:108
char * PR_getProperty(SCIP *scip, PropertyData *pd, int individual, const char *name)
Returns the value of a given property for a given individual.
Definition: property_data.c:570
int * num_properties
The number of properties of each individual.
Definition: property_data.h:53
SCIP_Bool PR_hasGlobalProperty(SCIP *scip, PropertyData *pd, const char *name)
Find out whether a string is a global property.
Definition: property_data.c:387
Problem data that is not directly related to the parent sets.
Definition: property_data.h:38
SCIP_RETCODE PR_setProperty(SCIP *scip, PropertyData *pd, int individual, const char *name, const char *value)
Set a property for an individual to a given value.
Definition: property_data.c:585
char ** global_property_names
The names of the global properties.
Definition: property_data.h:45
SCIP_RETCODE PR_setGlobalPropertyFromArray(SCIP *scip, PropertyData *pd, const char *name, const char **value, int length)
Set a global property to a given value Value is converted from an array of strings to a string...
Definition: property_data.c:503
SCIP_RETCODE PR_setPropertyFromInt(SCIP *scip, PropertyData *pd, int individual, const char *name, int value)
Set a property for an individual to a given value Value is converted from an int to a string...
Definition: property_data.c:637
SCIP_RETCODE PR_writeToFile(SCIP *scip, FILE *file, PropertyData *pd)
Writes a PropertyData structure to file.
Definition: property_data.c:178
SCIP_RETCODE PR_setPropertyFromRealArray(SCIP *scip, PropertyData *pd, int individual, const char *name, SCIP_Real *value, int length)
Set a property for an individual to a given value Value is converted from an array of reals to a stri...
Definition: property_data.c:713
char ** global_property_values
The values of the global properties.
Definition: property_data.h:47
SCIP_RETCODE PR_deallocatePropertyData(SCIP *scip, PropertyData **pd)
Deallocates the memory associated with a PropertyData structure.
Definition: property_data.c:44
SCIP_RETCODE PR_setGlobalProperty(SCIP *scip, PropertyData *pd, const char *name, const char *value)
Set a global property to a given value.
Definition: property_data.c:417
char * PR_getGlobalProperty(SCIP *scip, PropertyData *pd, const char *name)
Get the value of a global property.
Definition: property_data.c:402
SCIP_RETCODE PR_setGlobalPropertyFromReal(SCIP *scip, PropertyData *pd, const char *name, SCIP_Real value)
Set a global property to a given value Value is converted from a SCIP_Real to a string.
Definition: property_data.c:470
void PR_initialise(PropertyData *pd)
Initialises a data structure with empty values.
Definition: property_data.c:372