BlyxDocumentation
Browse chapters
Documentation / Workflow recipes

Starling · Size a resource pool from overlapping bookings

Estimate resource capacity and actual occupied time from a booking schedule.

Size a resource pool from overlapping bookings

Summing all booking durations double-counts overlap. Measure occupied time separately from peak resource demand. Three bookings cover seven ticks and reach two simultaneous users. A pool of one is short by one resource.

Run the framework with your own input

Install Blyx 0.2.1 and a Rust toolchain with a host linker, then run the versioned project. Each positional argument is a number or a comma-separated numerical vector. The CLI accepts up to 16 entries per vector. The imported module accepts longer inputs.

git clone --depth 1 --branch v0.1.0 https://github.com/Rahulchaube1/blyx-starling.git
cd blyx-starling
blyxc native-run project.blyx -- "0,2,4" "4,5,7" 1

API and return values

Returns [covered ticks, peak simultaneous bookings, earliest peak, capacity shortfall]. Starts must be sorted; adjacent bookings can share a resource. Invalid input returns an empty vector.

ArgumentAccepted input
startsVector of: exact signed integer
endsVector of: exact signed integer
capacitypositive exact integer

Use the libraries independently

The framework vendors the same library source published in these two repositories. Each module has its own package page, input contract and regression suite.

Try the program

Output Ready
Expected output
7
2
2
1
Open in the full playground →

Practice

Change starts = [1, 3], ends = [3, 5]. Predict the result, then run the program.

Hint

Returns [covered ticks, peak simultaneous bookings, earliest peak, capacity shortfall]. Starts must be sorted; adjacent bookings can share a resource.

Worked solution

The result vector is [4, 1, 1, 0]. Compare its fields with the return layout in the API section.

Find

    let starts = [0, 2, 4];

Replace with

    let starts = [1, 3];

Find

    let ends = [4, 5, 7];

Replace with

    let ends = [3, 5];

Output after the change

4
1
1
0