Rooc runtime

Inside Rooc, you can use the functions defined inside of the runtime to perform operations on the data. There are 3 kinds of functions:

  • Normal functions: They accept an input and return an output
  • Block functions: They have a block where you can write an expression, and the block function will do some operation over the block
  • Block scoped functions: Like block functions, but they have an iteration scope. Inside of the scope you can define how to iterate over the data, and it will be available in the block for you to use.

Functions

They are functions that accept parameters and return a value, you can use them inside blocks, assignments or in expressions
Returns the length of the iterable
Enumerates the iterable, returning a tuple of the element and its index
Enumerates the iterable, returning a tuple of the element and its index
Returns the edges of a graph
Returns the edges of a graph
Returns the nodes of a graph
Returns the nodes of a graph
Returns the neighbour edges of a node
Returns the neighbour edges of a node
Returns the neighbour edges of a node name in a graph
Returns the neighbour edges of a node name in a graph
Returns an iterable of integers from `from` to `to` (inclusive or exclusive)
Zips two or more iterables together, returning a tuple of the elements, the length of the resulting iterable is the length of the shortest iterable
Returns the difference of two iterables
Returns the union of two iterables
Returns the intersection of two iterables

Block functions

They are blocks which have one or more expressions separated by a comma, they will use those expressions to perform a transformation, like the avg (average) block
Computes the inner expression as the minimum of all elements
Computes the inner expression as the maximum of all elements
Computes the inner expression as the average of all elements

Block scoped functions

They are function blocks, it has as parameters one or more iterators over iterable data, they will declare a variable (or more using tuples destructuring) for each iterator and then execute the block.
If there are more than one iterators, they will behave as nested iterators, where the first iterator is the outermost one
Expands the inner expression into a sum of all elements
Expands the inner expression into a product of all elements
Expands the inner expression into the minimum of all elements
Expands the inner expression into the maximum of all elements
Expands the inner expression into the average of all elements

Execution pipes

Other than the model, you can define an execution pipeline that you can customise to do what you need.
There are some presets you can choose from, but in general, each pipe step has an input and produces an output, each step of the pipeline will be executed one after the other in the order they are defined, and each result will be shown as the output.
Name:
Compiler
Input:
String
Output:
Parser
Compiles the code
Name:
Pre Model
Input:
Parser
Output:
Pre Model
Generates a model from the compiler output
Name:
Model
Input:
Pre Model
Output:
Model
Run the Pre Model to generate the static model
Name:
Linear model
Input:
Model
Output:
Linear Model
Transforms the model into a linear model
Name:
Standard linear model
Input:
Linear Model
Output:
Standard Linear Model
Transforms the linear model into a model in standard form
Name:
Tableau for simplex
Input:
Standard Linear Model
Output:
Tableau
Transforms the standard linear model into a tableau that can be used in the simplex algorithm, it creates artificial variables to find the initial basis
Name:
Real solver
Input:
Linear Model
Output:
Real Solution
Runs a real variable solver to find the optimal solution, the variables must be real or non negative real
Name:
Simplex solver with steps
Input:
Tableau
Output:
Optimal Tableau with Steps
Runs the simplex algorithm to find the optimal solution and returns the tableau at each step
Name:
Binary solver
Input:
Linear Model
Output:
Binary Solution
Runs a binary variable solver to find the optimal solution, the variables must be binary
Name:
Integer binary solver
Input:
Linear Model
Output:
Integer Binary Solution
Runs a binary and integer variable solver to find the optimal solution, the variables must be binary or integer
Name:
MILP solver
Input:
Linear Model
Output:
MILP Solution
Runs a solver that allows for real, integer and binary variables to find the optimal solution.
Name:
Auto solver
Input:
Linear Model
Output:
MILP Solution
Automatically picks the best solver to run for this model