BeBO Lang

Declarative optimization language

From constraints to schedules.

BeBO Lang lets you describe resources, tasks, precedences, objectives, and solver settings in a readable model, then compiles that model into solver-ready output.

mobili_jobshop.bebo
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

What BeBO Lang is for

BeBO is a compact compiler toolchain for scheduling and optimization models. It focuses on making problem definitions readable, checkable, and ready for solver backends.

Readable models

Represent horizons, resources, tasks, routes, activities, constraints, and objectives in text files that can be reviewed like source code.

Compiler pipeline

Lexing, parsing, semantic analysis, IR generation, and reformulation are separated so each stage can be validated and explained.

Solver-oriented output

BeBO emits JSON models for CP, MILP, or VRP flows and can call the Python CP-SAT bridge for actual scheduling runs.

Visual results

Solver results can be inspected as JSON, text summaries, HTML Gantt charts, or matplotlib visualizations through the viewer.

3 modeled domains: Job Shop, RCPSP, VRPTW
4 CLI commands: run, check, explain, version
40 demo makespan for the furniture schedule

Quickstart

Use the compiler from the repository

The project is an Ada/Alire codebase with compiled executables under bin. The examples below use the current repository layout.

1

Check a model

bin\bebo_main.exe check examples\mobili_jobshop.bebo
2

Explain the generated model

bin\bebo_main.exe explain examples\mobili_jobshop.bebo
3

Run the solver bridge

bin\bebo_main.exe run examples\mobili_jobshop.bebo --solver cp_sat --out risultato.json
4

Open the Gantt viewer

python viewer\bebo_viewer.py risultato.json --html

Language guide

Core concepts

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.

Horizon

Every valid model needs a time horizon. Semantic error SEM006 is raised when the horizon is missing.

horizon 0 to 200;

Resources

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 };

Tasks, activities, nodes, and depots

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 };

Constraints

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;

Objectives

The compiler models objectives such as makespan, tardiness, cost, throughput, lexicographic objectives, and custom expressions.

minimize makespan;
minimize total_cost;
maximize throughput;

Solver block

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

CLI reference

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

Common flags

  • --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.

Python bridge

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

Model patterns included in the repo

These examples are useful starting points for learning the syntax and expected modeling style.

Furniture Job Shop

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

PSPLIB RCPSP

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

Solomon VRPTW subset

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

Furniture demo result

optimal | makespan 40 | 20 tasks
Cutting
Planing
Drilling
Painting
Assembly

Architecture

How BeBO turns text into optimization models

The compiler keeps modeling, validation, intermediate representation, reformulation, and solver invocation as separate responsibilities.

Model Lexer Parser Semantic IR Reformulator Solver Output

Ada compiler core

The core packages implement tokens, lexer, parser, AST, semantic analyzer, symbol table, IR builder, CLI options, and output rendering.

Backend emitters

The reformulator can emit CP JSON, MILP JSON, or VRP JSON and select a backend from the inferred problem domain and solver configuration.

Python integration

The CP-SAT bridge uses OR-Tools to solve interval scheduling models and returns a normalized JSON result.

Output

Result JSON contract

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 }
  }
}