Lokad Envision Reference
website·Indexed 35 days ago
https://docs.lokad.com/Technical documentation for the Lokad Envision platform, featuring the StyleCode v1 property specifications for visualizations and a comprehensive reference for data types, functions (such as contains, substr, and uniform), and selectors like whichever.
What's inside Envision
- Envision is a Domain Specific Language (DSL) developed by Lokad specifically for the predictive optimization of supply chains. It is space-sensitive (similar to Python) and utilizes array programming to process entire columns of data simultaneously, similar to SQL. The language is used to create supply chain optimization apps on the Lokad platform.
Introduction to StyleCode for Envision dashboards
StyleCode is a CSS-like sub-language used to style Envision dashboards. It is written inside{ ... }blocks that attach to tiles or their elements. StyleCode is hierarchical: properties defined on a parent element are inherited by its children unless overridden. Tiles own element subtrees such asseries,column,entry,legend, or axes.Overview of Envision Selectors
Selectors in Envision are a type of aggregator that select one value from the input group and return it. Unlike other aggregators, selectors can be called on values of any type, including tuples.
There are five available selectors:
whicheverfirstlastsamesingle
Overview of Ranvars and Zedfuncs in Envision
Envision provides two specialized data types, Ranvars and Zedfuncs, to handle probabilistic forecasting and economic decision-making.
- Ranvars (Random Variables): Represent probability distributions over the set of integers ($\mathbb{Z}$). They are used for probabilistic forecasts (e.g., future demand, lead times, production yields) to consider all future scenarios simultaneously. A ranvar is a function $p:\mathbb{Z} \to \mathbb{R^+}$ where the sum of probabilities equals 1.
- Zedfuncs ($\mathbb{Z}$ functions): Represent functions $f: \mathbb{Z} \mapsto \mathbb{R}$. They are used to model economic rewards or losses associated with unidimensional decisions (e.g., quantities to order or produce). Unlike ranvars, their values can be negative and their sum is not necessarily bounded.
Both types support basic arithmetic operations (+, -, *, ^) and can be combined with regular numbers.
Overview of Envision user input mechanisms
Envision provides four primary mechanisms to allow users to interact with dashboards without editing the underlying code. Choosing the right mechanism depends on the intended use case:
- Dashboard Slices: Best for data exploration (e.g., zooming in on a specific part, store, or time period) as they navigate pre-computed views.
- Form Tiles: Best for 'what-if' scenarios and simulation.
- Upload Tiles: Best for batch workflows, such as amending quantities or prices via file upload.
- Editable Tables: Best for making small, manual modifications to uploaded tables.
Overview of the Lokad Platform and Envision Language
Lokad is a programmatic SaaS platform designed for building and operating supply chain decision applications. It uses a domain-specific language called Envision to define these applications. The platform is intended for analysts comfortable with spreadsheets and basic scripting.Overview of the Ionic (.ion) file format
Ionic is a proprietary columnar binary storage format used within the Lokad platform for Big Data processing. It is designed as an internal format for prepared data files and is not intended for external transfer or consumption by client enterprise systems.
Key advantages over CSV include:
- Performance: Processing is typically 5 to 10 times faster than CSV, especially for files exceeding a few hundred megabytes or reaching dozens of gigabytes.
- Strong Typing: Each column has a defined data type (e.g., text, date, number), reducing processing errors across script sequences.
- Efficiency: Columnar storage allows loading only required columns and facilitates parallelization. The binary format provides lossless compression, resulting in file sizes similar to GZip-compressed CSVs but with faster read/write speeds.
Overview of the Distribution Network Analysis dataset
The dataset for the Distribution Network Analysis workshop consists of several tables used to model a 1-echelon retail network. The network consists of one central warehouse supplying three points of sale: Paris (France), Berlin (Germany), and Milan (Italy).Overview of Envision modules
Modules are reusable Envision code blocks that can be imported by scripts or other modules. They are not executable, meaning they cannot produce dashboards and cannot containread,write, orshowstatements. Only elements explicitly marked with theexportkeyword are visible outside the module; all other values remain local.Overview of Envision Modules
Modules in Envision allow for code reuse by sharing logic between scripts. Unlike scripts, modules cannot be executed directly and do not produce dashboards. They serve as containers for logic that can be exported and then imported into scripts. Most Envision syntax is supported in modules, butreadandshowstatements are explicitly forbidden.Overview of Demand Forecasting with Envision
Demand forecasting in Envision leverages Differentiable Programming (DP) to optimize and fine-tune forecasting models. DP allows the computation of gradients or derivatives through computer programs, enabling the use of stochastic gradient descent to update model parameters. The primary tool for this in Envision is theAutodiffcode block.Overview of Lokad platform supporting tools
The Lokad platform provides a 'Batteries Included' environment designed for supply chain scientists and practitioners to support fast prototyping and production pipelines (testing, pre-production, and production). Key integrated supporting tools include:
- Fine-grained ACLs with federated identity (SSO).
- Built-in orchestration featuring concurrency control and HTTP hooks.
- File viewer with Markdown editing and tabular previews.
- FTPS / SFTP bridge for internal file storage.
- Built-in connectors for enterprise software such as ERPs.
- Web-based spreadsheet editing, importing, and exporting (Excel compatible).