[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Linear constraints of level 1 (‘ap_lincons1.h’)

datatype: ap_lincons1_t

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);
datatype: ap_lincons1_array_t
 
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.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Allocating linear constraints of level 1

Function: ap_lincons1_t ap_lincons1_make (ap_constyp_t constyp, ap_linexpr1_t* linexpr, ap_scalar_t* mod)

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.

Function: ap_lincons1_t ap_lincons1_make_unsat (ap_environment_t* env)

Create the constraint -1>=0.

Function: ap_lincons1_t ap_lincons1_copy (ap_lincons1_t* cons)

Duplication

Function: void ap_lincons1_clear (ap_lincons1_t* cons)

Clear the constraint and set pointers to NULL.

Function: void ap_lincons1_fprint (FILE* stream, ap_lincons1_t* cons);

Print the linear constraint on stream stream.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Tests on linear constraints of level 1

Function: bool ap_lincons1_is_unsat (ap_lincons1_t* cons)

Return true if the constraint is not satisfiable (b>=0 or [a,b]>=0 with b negative).


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Access to linear constraints of level 1

Function: ap_environment_t* ap_lincons1_envref (ap_lincons1_t* cons)

Get a reference to the environment. Do not free it.

Function: ap_constyp_t* ap_lincons1_constypref (ap_lincons1_t* cons)

Get a reference to the type of constraint. You may use the reference to modify the constraint type.

Function: ap_linexpr1_t ap_lincons1_linexpr1ref (ap_lincons1_t* cons)

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.

Function: void ap_lincons1_get_cst (ap_coeff_t* coeff, ap_lincons1_t* cons)
Function: void ap_lincons1_set_cst (ap_lincons1_t* cons, ap_coeff_t* cst)
Function: bool ap_lincons1_get_coeff (ap_coeff_t* coeff, ap_lincons1_t* cons, ap_var_t var)
Function: bool ap_lincons1_set_coeff (ap_lincons1_t* cons, ap_var_t var, ap_coeff_t* coeff)
Function: bool ap_lincons1_set_list (ap_lincons1_t* cons, ...)
Function: ap_coeff_t* ap_lincons1_cstref (ap_lincons1_t* cons)
Function: ap_coeff_t* ap_lincons1_coeffref (ap_lincons1_t* cons, ap_var_t var)

Identical to corresponding ap_linexpr1_XXX functions (see section Access to linear expressions of level 1).

Function: ap_lincons0_t* ap_lincons1_lincons0ref (ap_lincons1_t* cons)

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.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Change of dimensions and permutations of linear constraints of level 1

Function: bool ap_lincons1_extend_environment (ap_lincons1_t* ncons, ap_lincons1_t* cons, ap_environment_t* nenv)
Function: bool ap_lincons1_extend_environment_with (ap_lincons1_t* cons, ap_environment_t* nenv)

Identical to corresponding ap_linexpr1_XXX functions (see section Change of dimensions and permutations of linear expressions of level 1).


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Arrays of linear constraints of level 1

Function: ap_lincons1_array_t ap_lincons1_array_make (ap_environment_t* env, size_t size)

Allocate an array of constraints of size size, defined on the environment env.

The constraints are initialized with NULL pointers for underlying expressions.

Function: void ap_lincons1_array_clear (ap_lincons1_array_t* array)

Clear the constraints of the array, and then the array itself.

Function: void ap_lincons1_array_fprint (FILE* stream, ap_lincons1_array_t* array)

Print the array on the stream.

Function: size_t ap_lincons1_array_size (ap_lincons1_array_t* array)

Return the size of the array.

Function: ap_environment_t* ap_lincons1_array_envref (ap_lincons1_array_t* array)

Get a reference to the environment. Do not free it.

Function: ap_lincons1_t ap_lincons1_array_get (ap_lincons1_array_t* array, size_t index)

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

Function: bool ap_lincons1_array_set (ap_lincons1_array_t* array, size_t index, ap_lincons1_t* cons)

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)

Function: void ap_lincons1_array_clear_index (ap_lincons1_array_t* array, size_t index)

Clear the constraint at index index.

Function: bool ap_lincons1_array_extend_environment_with (ap_lincons1_array_t* array, ap_environment_t* nenv)
Function: bool ap_lincons1_array_extend_environment (ap_lincons1_array_t* narray, ap_lincons1_array_t* array, ap_environment_t* nenv)

Identical to corresponding ap_linexpr1_XXX functions (see section Change of dimensions and permutations of linear expressions of level 1).


[ < ] [ > ]   [ << ] [ Up ] [ >> ]

This document was generated by root on September 20, 2019 using texi2html 1.82.