Next: Generators of level 0, Previous: Linear expressions of level 0, Up: Level 0 of the interface
typedef enum ap_constyp_t { AP_CONS_EQ, /* equality constraint */ AP_CONS_SUPEQ, /* >= constraint */ AP_CONS_SUP, /* > constraint */ AP_CONS_EQMOD, /* congruence equality constraint */ AP_CONS_DISEQ /* disequality constraint */ } ap_constyp_t;
Datatype for type of constraints.
typedef struct ap_lincons0_t { ap_linexpr0_t* linexpr0; /* expression */ ap_constyp_t constyp; /* type of constraint */ ap_scalar_t* scalar; /* maybe NULL. For EQMOD constraint, indicates the modulo */ } ap_lincons0_t;
Datatype for constraints.
Constraints are meant to be manipulated freely via their components. Creating the constraint [1,2]x0 + 5/2x1 >=0
and then freeing it can be done with
ap_lincons0_t cons = ap_lincons0_make(AP_CONS_SUPEQ, ap_linexpr0_alloc(AP_LINEXPR_SPARSE,2), NULL); ap_linexpr0_set_list(cons.linexpr0, AP_COEFF_I_INT, 1,2, 0, AP_COEFF_S_FRAC, 5,2, 1, AP_END); ap_lincons0_clear(&cons);
typedef struct ap_lincons0_array_t { ap_lincons0_t* p; size_t size; } ap_lincons0_array_t;
Datatype for arrays of constraints.
Arrays are accessed directly, for example by writing
array->p[i]
(of type ap_lincons0_t
),
array->p[i].constyp
and array->p[i].linexpr0
.
One can assign a constraint to the index index by writing:
array->p[index] = ap_lincons0_make(constyp,expr)
.
• Allocating linear constraints of level 0 | ||
• Tests on linear constraints of level 0 | ||
• Arrays of linear constraints of level 0 | ||
• Change of dimensions and permutations of linear constraints of level 0 |
Next: Tests on linear constraints of level 0, Previous: Linear constraints of level 0, Up: Linear constraints of level 0
Create a constraint of type constyp with the expression
linexpr, and the modulo mod in case of a congruence
constraint (constyp==AP_CONS_EQMOD
).
The expression is not duplicated, just pointed to, so it becomes managed via the constraint.
Create the constraint -1>=0
.
Duplication
Clear the constraint.
Print the linear constraint on stream stream, using the array
name_of_dim to convert dimensions to variable names. If
name_of_dim is NULL
, the dimensions are named
x0,x1,...
.
Next: Arrays of linear constraints of level 0, Previous: Allocating linear constraints of level 0, Up: Linear constraints of level 0
Return true
if the constraint is not satisfiable.
Next: Change of dimensions and permutations of linear constraints of level 0, Previous: Tests on linear constraints of level 0, Up: Linear constraints of level 0
Allocate an array of size constraints.
The constraints are initialized with NULL pointers for underlying expressions.
Clear the constraints of the array, and then the array itself.
Print the array on the stream.
These two functions add dimensions to the constraint, following
the semantics of dimchange (see the type definition of ap_dimchange_t
).
These two functions apply the given permutation to the dimensions of cons.
Extension to arrays of the corresponding functions on constraints.