4
/* Specially Ordered Sets (SOS) prototypes and settings */
5
/* ------------------------------------------------------------------------- */
12
/* SOS constraint defines */
13
/* ------------------------------------------------------------------------- */
18
#define SOS_START_SIZE 10 /* Start size of SOS_list array; realloced if needed */
20
/* Define SOS_is_feasible() return values */
21
/* ------------------------------------------------------------------------- */
22
#define SOS3_INCOMPLETE -2
23
#define SOS_INCOMPLETE -1
24
#define SOS_COMPLETE 0
25
#define SOS_INFEASIBLE 1
26
#define SOS_INTERNALERROR 2
29
typedef struct _SOSgroup SOSgroup;
31
typedef struct _SOSrec
46
/* typedef */ struct _SOSgroup
48
lprec *lp; /* Pointer to owner */
49
SOSrec **sos_list; /* Array of pointers to SOS lists */
50
int sos_alloc; /* Size allocated to specially ordered sets (SOS1, SOS2...) */
51
int sos_count; /* Number of specially ordered sets (SOS1, SOS2...) */
52
int maxorder; /* The highest-order SOS in the group */
53
int sos1_count; /* Number of the lowest order SOS in the group */
54
int *membership; /* Array of variable-sorted indeces to SOSes that the variable is member of */
55
int *memberpos; /* Starting positions of the each column's membership list */
63
/* SOS storage structure */
64
STATIC SOSgroup *create_SOSgroup(lprec *lp);
65
STATIC void resize_SOSgroup(SOSgroup *group);
66
STATIC int append_SOSgroup(SOSgroup *group, SOSrec *SOS);
67
STATIC int clean_SOSgroup(SOSgroup *group, MYBOOL forceupdatemap);
68
STATIC void free_SOSgroup(SOSgroup **group);
70
STATIC SOSrec *create_SOSrec(SOSgroup *group, char *name, int type, int priority, int size, int *variables, REAL *weights);
71
STATIC MYBOOL delete_SOSrec(SOSgroup *group, int sosindex);
72
STATIC int append_SOSrec(SOSrec *SOS, int size, int *variables, REAL *weights);
73
STATIC void free_SOSrec(SOSrec *SOS);
76
STATIC int make_SOSchain(lprec *lp, MYBOOL forceresort);
77
STATIC int SOS_member_updatemap(SOSgroup *group);
78
STATIC MYBOOL SOS_member_sortlist(SOSgroup *group, int sosindex);
79
STATIC MYBOOL SOS_shift_col(SOSgroup *group, int sosindex, int column, int delta, LLrec *usedmap, MYBOOL forceresort);
80
int SOS_member_delete(SOSgroup *group, int sosindex, int member);
81
int SOS_get_type(SOSgroup *group, int sosindex);
82
int SOS_infeasible(SOSgroup *group, int sosindex);
83
int SOS_member_index(SOSgroup *group, int sosindex, int member);
84
int SOS_member_count(SOSgroup *group, int sosindex);
85
int SOS_memberships(SOSgroup *group, int column);
86
int *SOS_get_candidates(SOSgroup *group, int sosindex, int column, MYBOOL excludetarget, REAL *upbound, REAL *lobound);
87
int SOS_is_member(SOSgroup *group, int sosindex, int column);
88
MYBOOL SOS_is_member_of_type(SOSgroup *group, int column, int sostype);
89
MYBOOL SOS_set_GUB(SOSgroup *group, int sosindex, MYBOOL state);
90
MYBOOL SOS_is_GUB(SOSgroup *group, int sosindex);
91
MYBOOL SOS_is_marked(SOSgroup *group, int sosindex, int column);
92
MYBOOL SOS_is_active(SOSgroup *group, int sosindex, int column);
93
MYBOOL SOS_is_full(SOSgroup *group, int sosindex, int column, MYBOOL activeonly);
94
MYBOOL SOS_can_activate(SOSgroup *group, int sosindex, int column);
95
MYBOOL SOS_set_marked(SOSgroup *group, int sosindex, int column, MYBOOL asactive);
96
MYBOOL SOS_unmark(SOSgroup *group, int sosindex, int column);
97
int SOS_fix_unmarked(SOSgroup *group, int sosindex, int variable, REAL *bound, REAL value,
98
MYBOOL isupper, int *diffcount, DeltaVrec *changelog);
99
int SOS_fix_list(SOSgroup *group, int sosindex, int variable, REAL *bound,
100
int *varlist, MYBOOL isleft, DeltaVrec *changelog);
101
int SOS_is_satisfied(SOSgroup *group, int sosindex, REAL *solution);
102
MYBOOL SOS_is_feasible(SOSgroup *group, int sosindex, REAL *solution);
108
#endif /* HEADER_lp_SOS */