linear_constraint.h
Go to the documentation of this file.
1 #ifndef LINEARCONSTRAINT
2 #define LINEARCONSTRAINT
3 
4 #include "interval.h"
5 #include "boolean.h"
6 #include "variables.h"
7 #include "box.h"
8 
9 #include <stdio.h>
10 
11 
24 /************************************************************************************/
31 #define INIT_NUM_TERMS_LC 10
32 /************************************************************************************/
33 
51 typedef struct {
52  unsigned int n;
53  unsigned int max;
54  unsigned int *ind;
55  double *val;
58 
59 
68 
69 
80 
90 
105 
116 
117 
128 
129 
145 double GetLinearConstraintCoefficient(unsigned int i,TLinearConstraint *lc);
146 
158 
170 unsigned int GetLinearConstraintVariable(unsigned int i,TLinearConstraint *lc);
171 
181 
192 
202 
203 
213 void AddCt2LinearConstraint(double ct,TLinearConstraint *lc);
214 
225 void AddTerm2LinearConstraint(unsigned int ind,double val,TLinearConstraint *lc);
226 
237 double RemoveTermFromLinearConstraint(unsigned int ind,TLinearConstraint *lc);
238 
239 
250 boolean LinearConstraintIncludes(unsigned int ind,TLinearConstraint *lc);
251 
252 
261 
270 void ScaleLinearConstraint(double a,TLinearConstraint *lc);
271 
272 
282 
301 void CleanLinearConstraint(double epsilon,Tinterval *is,TLinearConstraint *lc);
302 
327 boolean SimplifyLinearConstraint(boolean *full,Tinterval *is,TLinearConstraint *lc);
328 
359 unsigned int CropLinearConstraint(double epsilon,
360  unsigned int varType,
361  Tbox *b,
362  Tvariables *vs,
363  TLinearConstraint *lc);
364 
382 boolean CmpLinearConstraints(double *scaleOne2Two,TLinearConstraint *lc1,TLinearConstraint *lc2);
383 
400 double EvaluateLinearConstraint(double *varValues,TLinearConstraint *lc);
401 
415 
430 void PrintLinearConstraint(FILE *f,boolean eq,char **varName,TLinearConstraint *lc);
431 
440 void SaveLinearConstraint(FILE *f,TLinearConstraint *lc);
441 
450 void LoadLinearConstraint(FILE *f,TLinearConstraint *lc);
451 
460 
461 #endif
Definition of the boolean type.
Set of variables of a cuiksystem.
Definition: variables.h:38
void DeleteLinearConstraint(TLinearConstraint *lc)
Destructor.
boolean SimplifyLinearConstraint(boolean *full, Tinterval *is, TLinearConstraint *lc)
Apply linear constraints to reduce the ranges of the problem variables.
double * GetLinearConstraintCoefficients(TLinearConstraint *lc)
Gets the linear constraint coefficients.
Definition of the Tvariables type and the associated functions.
A linear constraint with an associated error.
void InitLinearConstraint(TLinearConstraint *lc)
Constructor.
boolean LinearConstraintIncludes(unsigned int ind, TLinearConstraint *lc)
Checks if a variable is included in a linear constraint.
void LoadLinearConstraint(FILE *f, TLinearConstraint *lc)
Constructor. Loads the linear constraint from a file.
unsigned int GetLinearConstraintVariable(unsigned int i, TLinearConstraint *lc)
Gets the a particular variable index.
void PrintLinearConstraint(FILE *f, boolean eq, char **varName, TLinearConstraint *lc)
Prints a linear constraint.
void InvertLinearConstraint(TLinearConstraint *lc)
Changes the sign of a linear constraint.
void AddTerm2LinearConstraint(unsigned int ind, double val, TLinearConstraint *lc)
Adds a scaled variable to the linear constraint.
void ResetLinearConstraint(TLinearConstraint *lc)
Resets a linear constraint.
void EvaluateLinearConstraintInt(Tinterval *varValues, Tinterval *i_out, TLinearConstraint *lc)
Interval evaluation of a linear constraint.
boolean CmpLinearConstraints(double *scaleOne2Two, TLinearConstraint *lc1, TLinearConstraint *lc2)
Compares two linear constraints.
void CopyLinearConstraint(TLinearConstraint *lc_dst, TLinearConstraint *lc_src)
Copy constructor.
unsigned int * ind
Definition of the Tbox type and the associated functions.
void ScaleLinearConstraint(double a, TLinearConstraint *lc)
Scales a linear constraint.
double RemoveTermFromLinearConstraint(unsigned int ind, TLinearConstraint *lc)
Removes a variable from a linear constraint.
boolean BoundedLinearConstraint(TLinearConstraint *lc)
Test if the constraint is bounded.
unsigned int * GetLinearConstraintVariables(TLinearConstraint *lc)
Gets the linear constraint variables.
unsigned int GetNumTermsInLinearConstraint(TLinearConstraint *lc)
Number of variables in a linear constraint.
A box.
Definition: box.h:83
void GetLinearConstraintError(Tinterval *error, TLinearConstraint *lc)
Gets the right-hand side interval for the linear constraint.
unsigned int CropLinearConstraint(double epsilon, unsigned int varType, Tbox *b, Tvariables *vs, TLinearConstraint *lc)
Reduce the ranges for.
void AddCt2LinearConstraint(double ct, TLinearConstraint *lc)
Adds a constant term to the linear constraint.
void AddLinearConstraints(TLinearConstraint *lc1, TLinearConstraint *lc)
Adds one linear constraint to another.
void SetLinearConstraintError(Tinterval *error, TLinearConstraint *lc)
Sets a new righ-hand side error of the linear constraint.
double GetLinearConstraintCoefficient(unsigned int i, TLinearConstraint *lc)
Gets the a particular linear constraint coefficient.
double EvaluateLinearConstraint(double *varValues, TLinearConstraint *lc)
Evaluates a linear combination for a given point.
Defines a interval.
Definition: interval.h:33
void CleanLinearConstraint(double epsilon, Tinterval *is, TLinearConstraint *lc)
Removes terms in the linear constraint that give too small ranges.
void SaveLinearConstraint(FILE *f, TLinearConstraint *lc)
Saves the linear constraint into a file.
double GetLinearConstraintErrorSize(TLinearConstraint *lc)
Gets the size of the right-hand side interval for the linear constraint.
Definition of the Tinterval type and the associated functions.