Development of an AI system for construction schedule optimization
A construction schedule consists of hundreds of interconnected tasks with resource constraints. Traditional tools (MS Project, Primavera P6) require manual planning. AI automates the creation of an optimal schedule and dynamically recalculates it if deviations occur.
Automatic scheduling
Resource-Constrained Project Scheduling (RCPSP):
Construction schedule problem: N jobs with predecessor/successor dependencies, R types of resources (crews, cranes, formwork) with limited availability → minimize the total time.
from ortools.sat.python import cp_model
def schedule_construction_project(tasks, dependencies, resources, resource_limits):
"""
tasks: [{'id', 'duration_days', 'resource_demand': {type: qty}}]
dependencies: [(task_a, task_b)] — b начинается после a
resources: {'rebar_crew': 5, 'formwork_crew': 3, 'tower_crane': 2}
"""
model = cp_model.CpModel()
horizon = sum(t['duration_days'] for t in tasks) + 10 # мин. возможный срок
task_vars = {}
for task in tasks:
start = model.NewIntVar(0, horizon, f"start_{task['id']}")
end = model.NewIntVar(0, horizon, f"end_{task['id']}")
interval = model.NewIntervalVar(start, task['duration_days'], end, f"interval_{task['id']}")
task_vars[task['id']] = {'start': start, 'end': end, 'interval': interval}
# Зависимости (precedence constraints)
for pred_id, succ_id in dependencies:
model.Add(task_vars[succ_id]['start'] >= task_vars[pred_id]['end'])
# Ресурсные ограничения: кумулятивная нагрузка не превышает лимит
for resource_type, capacity in resource_limits.items():
intervals = []
demands = []
for task in tasks:
if resource_type in task.get('resource_demand', {}):
intervals.append(task_vars[task['id']]['interval'])
demands.append(task['resource_demand'][resource_type])
if intervals:
model.AddCumulative(intervals, demands, capacity)
# Целевая функция: минимизировать время завершения проекта
project_end = model.NewIntVar(0, horizon, 'project_end')
model.AddMaxEquality(project_end, [task_vars[t['id']]['end'] for t in tasks])
model.Minimize(project_end)
solver = cp_model.CpSolver()
solver.parameters.max_time_in_seconds = 60.0
status = solver.Solve(model)
if status in [cp_model.OPTIMAL, cp_model.FEASIBLE]:
return {t['id']: solver.Value(task_vars[t['id']]['start']) for t in tasks}
return None
Forecast of schedule violations
Early Warning System:
The ML model predicts work that will be delayed: - Features: current percentage of completion vs. planned, completion rate over the last 5 days - Resource availability: weather (fewer working days), material deliveries - Type of work: concrete (weather-dependent), installation (delivery-dependent)
import lightgbm as lgb
import pandas as pd
def predict_schedule_delay(task_progress_df, project_context):
"""
Прогноз задержки для каждой незавершённой работы.
task_progress_df: ежедневные отчёты о выполнении работ
"""
features = task_progress_df.copy()
# Ключевые признаки
features['planned_vs_actual'] = (features['actual_pct'] -
features['planned_pct_today'])
features['velocity_7d'] = features['actual_pct'].diff(7) / 7 # % в день
features['required_velocity'] = ((100 - features['actual_pct']) /
(features['days_remaining'] + 1))
features['velocity_gap'] = features['required_velocity'] - features['velocity_7d']
# Контекстные признаки
features['rain_days_forecast'] = project_context.get('rain_days_next7', 0)
features['resource_availability'] = project_context.get('crew_availability', 1.0)
features['material_on_site'] = features['material_stock_days']
model = lgb.LGBMRegressor() # предобученная модель
delay_predictions = model.predict(features[feature_cols])
return delay_predictions # в рабочих днях
Dynamic recalculation in case of deviations
Scenario Analysis:
If a critical task is delayed, perform an automatic recalculation: 1. Determine the affected downstream tasks (all successors). 2. Check if there is a buffer (float) or a critical path. 3. Suggest recovery options: - Add resources to the delayed task - Reschedule parallel tasks - Adjust the scope (if applicable).
Crash Analysis:
What if we compress the deadlines: which tasks can be compressed with minimal additional costs? - Crash cost per day for each task (double the team = +N rubles/day, -M days) - Linear Programming: minimize additional costs to achieve the target deadline
Resource management
Supply planning:
Look-ahead schedule: what materials are needed in 2–4 weeks → automatic supply requests: - Work register + consumption rates → bill of materials by period - Buffer: 10–15% of the weekly requirement in stock - Alert: material runs out in 5 days, and the supplier's lead time is 7 days
Workforce planning:
Forecast of the need for teams and specialties by day: - Peak in formwork work: 3 teams × 5 people are needed - Decline: 1 team for cleaning - Conclusion: notify the foreman about peaks 2 weeks in advance for hiring/attracting
Development period: 3–5 months for a system of automatic schedule planning, delay forecasting and dynamic recalculation with integration into Primavera P6 / MS Project.







