Skip to contents

Abstract Syntax Tree (AST) classes

Data structures to represent mathematical expressions.

new_ast() ast_set()
Create a new multimod AST (Abstract Syntax Tree) node
ast_constant()
Create a constant AST node
ast_dims()
Create an AST node for dimensions (dims) of a symbol
ast_equation()
Create an equation AST node
ast_expression()
Create an expression AST node
ast_func()
Create a function AST node
ast_mapping()
Create a mapping AST node
ast_parameter()
Create a parameter AST node
ast_prod()
Create a product AST node
ast_sum()
Create a summation AST node
ast_symbol()
Create a symbol AST node (for unclassified identifiers)
ast_unary()
Create a unary expression AST node
ast_variable()
Create a variable AST node
ast_when()
Construct a conditional expression node for multimod AST
ast_where()
Create a "where" AST node

Multimod classes

Classes to represent a model with sets, parameters, variables, equations, and data.

new_ast() ast_set()
Create a new multimod AST (Abstract Syntax Tree) node
new_equation()
Create a multimod equation object
new_mapping()
Create a multimod mapping object
new_model()
Create a multimod model object
new_parameter()
Create a multimod parameter
new_set()
Create a new set object
new_variable()
Create a multimod variable
as_multimod()
Convert an object to a multimod structure

Generic methods

Generic methods for multimod classes.

print(<ast>)
Print methods for AST classes

LaTeX functions

Functions to convert multimod objects to LaTeX.

as_latex()
Convert objects to LaTeX format
write_latex(<equation>)
Write LaTeX representation of an equation
write_latex(<model>)
Write LaTeX representation of a model
write_latex()
Write LaTeX representation of an equation or model
estimate_latex_length()
Estimate the length of a LaTeX string
format_latex_aligned()
Format a LaTeX equation across multiple lines using aligned
latex_bracket_size()
Estimate bracket size for LaTeX based on context and expression content
latex_math_brakets()
Generate LaTeX brackets for math expressions
latex_top_level_operators()
Identify top-level LaTeX operators in an expression

Functions to read GAMS models and convert multimod objects to GAMS code.

read_gams()
Read GAMS model file and parse its core structure.
as_gams()
Convert multimod object to GAMS syntax
write_gams(<model>)
Write a full GAMS model file from a multimod object
write_gams()
Write a GAMS model file from a multimod object
is_gams_expression()
Check if a string is a compound expression
parse_gams_equation()
Parse a GAMS equation into an AST object.

Functions to read JuMP models and convert multimod objects to JuMP code.

as_jump()
Convert multimod object to Julia/JuMP syntax

utility functions

Utility functions for multimod.

get_network_data()
Get network data for a multimod equation
is_gams_expression()
Check if a string is a compound expression
is_special()
Check if a character is a special character
is_word()
Check if a string is a word (alphabetic characters only)
is_word_num()
Check if a string is alphanumeric (letters, digits, or underscores)
parse_gams_equation()
Parse a GAMS equation into an AST object.
format_latex_aligned()
Format a LaTeX equation across multiple lines using aligned
extract_ast_elements()
Recursively extract elements by name from a nested structure
extract_where_nodes()
Extract "where" nodes from an AST
alias_ast_names()
Apply name aliases to AST nodes
depth()
Get the depth of a nested list structure (AST, multimod, and other objects)
annotate_brackets()
Annotate expression tree with bracket requirements
brackets_pair()
Get a pair of brackets
map_ast()
Recursively apply a function to all nodes of an AST
node_hash()
Generate a stable hash for an AST or multimod object (excluding internal hash fields)
node_type()
Get the type of an AST or multimod node
remap_ast_elements()
Replace AST elements with "ast_where" nodes
resolve_full_name()
Resolve alias to full set name
split_at_top_level_operators()
Split LaTeX math string at top-level operators
split_top_level_args()
Split function arguments at the top level
build_symbols_list()
Build a list of symbols from model_info

visualization

Visualization functions for multimod.

get_network_data()
Get network data for a multimod equation
as_visNetwork()
Convert a multimod ast or equation to a visNetwork object