ADMIT documentation: ADMITconstraint

ADMITconstraint

ADMITconstraint creates a ADMITconstraint object

CON = ADMITconstraint(STR)
CON = ADMITconstraint(STR,varargin)

Parses the string STR and generates a ADMITconstraint object from it.
Syntax description is also found in "./examples/OPTFILE_TEMPLATE.opt".

If additional arguments are provided, then this is equivalent to 
CON = ADMITconstraint(sprintf(STR,varargin))

In principle you can provide any string satisfying the syntax.

Syntax

General syntax is:
 NAME(TIME) := CONSTRAINT
or 
 NAME(TIME) := LOGICAL_CONSTRAINT

Notes

  NAME (allowed symbols [a-z,A-Z,0-9,_]) can be:
    - omitted
    - if NAME is provided, then the variable NAME must appear in the 
      constraint CONSTRAINT (which must also be an equality const.);
      CONSTRAINT is then used to derive implicit bounds on the variable 
  TIME can be :
    - omitted (with surrounding brackets); if the constraint containts a 
      time-dependent variable, then t_ALL is assumed
    - t=TIMEID : can be a single time-identifier-variable
    - t={TIMEID1,TIMEID2,...} : different time-identifier-variables 
      can be specified in brackets
    - "t=" can be omitted
  TIMEID: 
    - must be defined symbolically of 
      the form "t_ID" where "ID" can be an integer number or a string 
      (e.g. t_0, t_1, t_ALL, t_sim, ...)
    - "?" is reserved and is internally used for undefined timepoints
    - "t_ALL" or "*" is reserved but can be used to select all 
      time-points
  TIMEPOINT:
    - must be defined symbolically of 
      the form "t_ID" where "ID" can be an integer number BUT neither a 
      string nor a mixture of integer and string. 
      Valid TIMEPOINTS: e.g. t_0, t_1
      Invalid TIMEPOINTS: t_ALL
    - within a (normal) constraint (e.g. "Aa(TIMEPOINT) < 0", see below), 
      TIMEID must not be used. Instead use TIMEPOINT.
  CONSTRAINT can be:
    - a bounded one using the notation [lb,ub]; NAME must be provided in 
      this case
    - a "normal" constraint  is defined as any (polynomial or 
      rational-polynomial) function of the variables and relational 
      operators "<", "=", "<=", ">", or ">="
    - "t" is a reserved name denoting "time"
    - Time-variant variables should be annotated in the constraints by 
      VARNAME(TIMEPOINT) or VARNAME(t). If no annotation is given, 
      VARNAME(t) is assumed.
    - Relative/recursive time-points/time-relations can be notated e.g. 
      VARNAME(t-1). However, positive time-relations such as "A(t+1)" 
      are removed by shifting the time-bases of entire constraint such   
      that only "t" or "t-1" appear.
    - to use time explicitly in the constraints use TIME(t) 
      (refers to the current time point) or TIME(t-1) which refers to the 
      previous
  LOGICAL_CONSTRAINT can be:
    - the right-hand side must have the form:
         IMPLICATION-VAR <==> BOUNDARY
      or
         IMPLICATION-VAR <==> OPERATOR{LIST}
    - BOUNDARY is formulated like a (non-bounded) constraint of the 
      other variables
    - OPERATOR can be:
        - &   (AND, conjunction)
        - |   (OR, disjunction)
    - LIST is a comma-separated list of binary variables; curly brackets
      {} must be used to embrace the list
  NEGATION operator "~":
    - use "~" to negate a binary variable

  Further information:
    - The following strings must not be used in symbols or expressions 
      ("*" denotes any string): "t", "t_*", "k", "k_*", "i", "j", 
      "*___SDP", "TIME"

Examples

The following examples show how to formulate constraints. You can use any
one of the strings below and pass it to ADMITconstraint, e.g.
 ADMITconstraint('A(*) := [0,1]')

Add a constraint to an ADMITproject by using the "+"-operator

 opt = ADMITproject();
 opt = opt + ADMITconstraint('A(*) := [0,1]')

Remove a constraint from an ADMITproject by using the "-"-operator

 opt = opt - ADMITconstraint('A(*) := [0,1]')

You can also remove bounds and constraints specifically by using 
the "-"-operator and placeholders [],[*],'empty-string':

 opt = opt + ADMITconstraint('A(*) := [0,1]')
 opt = opt + ADMITconstraint('A(*) := A(t) = A(t-1)')
 opt = opt - ADMITconstraint('A(*) := []')
% or: opt = opt - ADMITconstraint('A(*) := [*]')
 opt = opt - ADMITconstraint('A(*) := ')
% or: opt = opt - ADMITconstraint('A(*) := *')

Setting bounds

  A(*)     := [0,1]
  A(0)     := [0,0.1]
  B(t_sim) := [10,20]
  C        := [2,3.1]
	

Normal constraints

  (t=*)     := A(t)-TIME(t) < 12
  (t=t_sim) := A(t-1)-A(t) >= 0
               C >= 0
  D(*)      := D(t)-A(t)*B(t) = 0

Logical constraints

  b1(t=t_sim)   := b1 <==> A(t) >= 0.1
    phi1(t=t_1) := phi1 <==> & { b1(t), b1(t_0) }
    phi2(t=t_1) := phi2 <==> | { b1(t), b1(t_0) }