Built in functions and procedures
The following is a list of built in functions and procedures of the Mosel language (excluding modules). Functions return a value; procedures do not.
- Dynamic array handling
- 
  create exists delcell isdynamic 
- Freeze (finalize) a dynamic set
- 
  finalize 
- Rounding functions
- 
  ceil floor round abs 
- Mathematical functions
- 
  exp log ln sqrt cos sin arctan isodd 
- Special real values
- 
  isfinite isinf isnan 
- Random number generator
- 
  random setrandseed 
- Minimum/maximum of a list of values
- 
  v := minlist(5, 7, 2, 9) w := maxlist(CAP(1), CAP(2)) 
- Inline ``if'' function
- 
  MAX_INVEN(t) := if(t MAX_TIME, 1000, 0) Inven(t) := stock(t) = buy(t) - sell(t) + if(t 1, stock(t-1), 0)
- Matrix export to file
- 
  exportprob 
- File handling
- 
  fopen fclose fselect getfid getfname getreadcnt iseof fflush fskipline fwrite[_] / fwriteln[_] read / readln write[_] / writeln[_] 
- String handling
- 
  strfmt substr _ 
- Access and modify model objects
- 
  getcoeff[s] setcoeff getvars sethidden ishidden setname gettype settype getsize makesos1 makesos2 getfirst getlast findfirst findlast reverse getreverse gethead gettail cuthead cuttail splithead splittail 
- Access solution values
- 
  getobjval getsol getrcost getslack getact getdual 
- Exit from a model
- 
  exit 
- Mosel controls
- 
  getparam setparam 
- Date/time
- 
  currentdate currenttime timestamp 
- Bit value handling
- 
  bitflip bitneg bitset bitshift bittest bitval 
- Miscellaneous
- 
  asproc assert reset setioerr setmatherr publish unpublish 
- Overloading of subroutines
  - Some functions or procedures are overloaded: a single subroutine can be called with different types and numbers of arguments
 
- Additional subroutines are provided by Mosel library modules, which extend the basic Mosel language, e.g.,
  - mmxprs: Xpress Optimizer
- mmodbc: ODBC data connection
- mmsheet: accessing spreadsheets
- mmsystem: system calls; text handling
- mmjobs: handling multiple models and (remote) Mosel instances
- mmsvg: graphics
 
- User-defined functions and procedures
  - You can also write your own functions and procedures within a Mosel model
- Structure of subroutines is similar to a model (may have declarations blocks)
- User subroutines may define overloaded versions of built in subroutines
 
- Packages
  - Additional subroutines may also be provided through packages (Mosel libraries written in the Mosel language as opposed to Mosel modules that are implemented in C)
 
 
