Readable models
Represent horizons, resources, tasks, routes, activities, constraints, and objectives in text files that can be reviewed like source code.
Declarative optimization language
BeBO Lang lets you describe resources, tasks, precedences, objectives, and solver settings in a readable model, then compiles that model into solver-ready output.
horizon 0 to 120;
resource M_Taglio { capacity: 1 };
task Sedia_Taglio {
duration: 3;
on: M_Taglio;
in: J_Sedia
};
precedes Sedia_Taglio -> Sedia_Piallatura;
minimize makespan;
solve with cp_sat { time_limit: 60; workers: 4; };
Overview
BeBO is a compact compiler toolchain for scheduling and optimization models. It focuses on making problem definitions readable, checkable, and ready for solver backends.
Represent horizons, resources, tasks, routes, activities, constraints, and objectives in text files that can be reviewed like source code.
Lexing, parsing, semantic analysis, IR generation, and reformulation are separated so each stage can be validated and explained.
BeBO emits JSON models for CP, MILP, or VRP flows and can call the Python CP-SAT bridge for actual scheduling runs.
Solver results can be inspected as JSON, text summaries, HTML Gantt charts, or matplotlib visualizations through the viewer.
Quickstart
The project is an Ada/Alire codebase with compiled executables under bin. The examples below use the current repository layout.
bin\bebo_main.exe check examples\mobili_jobshop.bebo
bin\bebo_main.exe explain examples\mobili_jobshop.bebo
bin\bebo_main.exe run examples\mobili_jobshop.bebo --solver cp_sat --out risultato.json
python viewer\bebo_viewer.py risultato.json --html
Language guide
A BeBO model declares a planning horizon, domain objects, constraints, an objective, and a solver block. The compiler infers the problem domain from the model shape.
Every valid model needs a time horizon. Semantic error SEM006 is raised when the horizon is missing.
horizon 0 to 200;
Resources represent machines, vehicles, renewable resources, or any limited-capacity entity.
resource M1 { capacity: 1 };
resource R1 { capacity: 12; renewable: true };
resource Van1 { capacity: 200 };
Use task for Job Shop scheduling, activity for RCPSP-style project scheduling, and node/depot for VRPTW models.
task J1_Op1 { duration: 6; on: M2; in: J1 };
activity A02 { duration: 8; requires R1: 4 };
depot D0 { location: 0 };
node C1 { service_time: 10; window: 912 to 967 };
The current IR supports no-overlap, precedence, cumulative, deadline, time-window, cover, and soft constraints.
no_overlap J1_Op1 on M3;
precedes J1_Op1 -> J1_Op2;
depends A01 -> A02;
deadline A20 before 80;
The compiler models objectives such as makespan, tardiness, cost, throughput, lexicographic objectives, and custom expressions.
minimize makespan;
minimize total_cost;
maximize throughput;
Solver options are parsed into a common configuration. Supported names in the CLI usage are cp_sat, gurobi, highs, and vrp_or_tools.
solve with cp_sat {
time_limit: 120;
workers: 4;
log: false;
};
Command line
The executable accepts the commands exposed by Bebo_Options and handled by the main compiler entry point.
| Command | Purpose | Example |
|---|---|---|
check |
Parse and validate a model without solving. | bebo check model.bebo |
explain |
Show inferred domain, horizon, IR counts, and generated backend model. | bebo explain model.bebo |
run |
Compile, reformulate, and solve or emit the backend JSON. | bebo run model.bebo --solver cp_sat --out result.json |
version |
Print the compiler version. | bebo version |
--solver <name>: override solver selection.--out <file>: write JSON result or generated model.--gantt: print textual Gantt output when solving CP JSON.--verbose or -v: print generated model JSON.--format json|csv|html|gantt|table: select output format.The CP-SAT bridge reads a CP model JSON and writes a result JSON with status, objective, solve_time_s, and schedule.
python bridges\python\cpsat_bridge.py -i bebo_model.json -o risultato.json
Examples
These examples are useful starting points for learning the syntax and expected modeling style.
A production scenario with chairs, tables, wardrobes, bookcases, five machines, precedence chains, no-overlap constraints, and a makespan objective.
horizon 0 to 120;
resource M_Taglio { capacity: 1 };
resource M_Piallatura { capacity: 1 };
task Sedia_Taglio { duration: 3; on: M_Taglio; in: J_Sedia };
task Sedia_Piallatura { duration: 2; on: M_Piallatura; in: J_Sedia };
no_overlap Sedia_Taglio on M_Taglio;
precedes Sedia_Taglio -> Sedia_Piallatura;
minimize makespan;
solve with cp_sat { time_limit: 60; workers: 4; };
Source file: examples\mobili_jobshop.bebo
A project scheduling model with activities, renewable resources, capacities, and dependency chains.
horizon 0 to 100;
resource R1 { capacity: 12; renewable: true };
resource R2 { capacity: 13; renewable: true };
activity A01 { duration: 0 };
activity A02 { duration: 8; requires R1: 4; requires R2: 0 };
activity A03 { duration: 4; requires R1: 10; requires R2: 0 };
depends A01 -> A02;
depends A01 -> A03;
minimize makespan;
solve with cp_sat { time_limit: 120; workers: 8; };
Source file: tests\instances\rcpsp_j30_01.bebo
A vehicle routing with time windows example using depot, vehicles, service times, and customer windows.
horizon 0 to 1236;
resource Van1 { capacity: 200 };
resource Van2 { capacity: 200 };
depot D0 { location: 0 };
node C1 { service_time: 10; window: 912 to 967 };
node C2 { service_time: 10; window: 825 to 870 };
minimize total_cost;
solve with vrp_or_tools { time_limit: 60; workers: 4; };
Source file: tests\instances\vrptw_solomon_c101.bebo
Architecture
The compiler keeps modeling, validation, intermediate representation, reformulation, and solver invocation as separate responsibilities.
The core packages implement tokens, lexer, parser, AST, semantic analyzer, symbol table, IR builder, CLI options, and output rendering.
The reformulator can emit CP JSON, MILP JSON, or VRP JSON and select a backend from the inferred problem domain and solver configuration.
The CP-SAT bridge uses OR-Tools to solve interval scheduling models and returns a normalized JSON result.
Output
Solver runs produce a compact result object that can be saved, visualized, or consumed by other systems.
{
"status": "optimal",
"objective": 40.0,
"solve_time_s": 0.0282,
"schedule": {
"sedia_taglio": { "start": 19, "end": 22 }
}
}