Next: Generators of level 1, Previous: Linear expressions of level 1, Up: Level 1 of the interface
Datatype for constraints.
For information:
typedef struct ap_lincons1_t { ap_lincons0_t lincons0; ap_environment_t* env; } ap_lincons1_t;
Constraints are meant to be manipulated freely via their
components. Creating the constraint [1,2]x + 5/2 y >=0
and then
freeing it can be done with
ap_lincons1_t cons = ap_lincons1_make(AP_CONS_SUPEQ, ap_linexpr1_alloc(env,AP_LINEXPR_SPARSE,2), NULL); ap_lincons1_set_list(&cons, AP_COEFF_I_INT, 1,2, "x", AP_COEFF_S_FRAC, 5,2, "y", AP_END); ap_lincons1_clear(&cons);
typedef struct ap_lincons1_array_t { ap_lincons0_array_t lincons0_array; ap_environment_t* env; } ap_lincons1_array_t;
Datatype for arrays of constraints.
Arrays at level 1 cannot be accessed directly, for example by writing
array->p[i]
, but should instead be accessed with functions
ap_lincons1_array_get
and ap_lincons1_array_set
.
Next: Tests on linear constraints of level 1, Previous: Linear constraints of level 1, Up: Linear constraints of level 1
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 and set pointers to NULL.
Print the linear constraint on stream stream.
Next: Access to linear constraints of level 1, Previous: Allocating linear constraints of level 1, Up: Linear constraints of level 1
Return true
if the constraint is not satisfiable (b>=0
or [a,b]>=0
with b negative).
Next: Change of dimensions and permutations of linear constraints of level 1, Previous: Tests on linear constraints of level 1, Up: Linear constraints of level 1
Get a reference to the environment. Do not free it.
Get a reference to the type of constraint. You may use the reference to modify the constraint type.
Get a reference to the underlying expression of the constraint. Do not free it: nothing is duplicated. Modifying the argument or the result is equivalent, except for change of dimensions/environment.
Identical to corresponding ap_linexpr1_XXX
functions
(see Access to linear expressions of level 1).
Return underlying constraint of level 0. Do not free it: nothing is duplicated. Modifying the argument or the result is equivalent, except for change of dimensions/envionment.
Next: Arrays of linear constraints of level 1, Previous: Access to linear constraints of level 1, Up: Linear constraints of level 1
Identical to corresponding ap_linexpr1_XXX
functions (see Change of dimensions and permutations of linear expressions of level 1).
Previous: Change of dimensions and permutations of linear constraints of level 1, Up: Linear constraints of level 1
Allocate an array of constraints of size size, defined on the environment env.
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.
Return the size of the array.
Get a reference to the environment. Do not free it.
Return the linear constraint of the given index. Nothing is duplicated, and the result should never be cleared. Modifying the argument or the result is equivalent, except for change of environments
Fill the index of the array with the constraint. Assumes
ap_environment_is_eq(array->env,cons->env)
. Nothing is
duplicated. The argument should never be cleared (its environment is
dereferenced). If a constraint was already stored, it is first
cleared. Return true iff problem (index or
array->env!=cons->env
)
Clear the constraint at index index.
Identical to corresponding ap_linexpr1_XXX
functions (see Change of dimensions and permutations of linear expressions of level 1).