Skip to main content

Advanced Constraints

Overview

Learn to configure complex constraints for real-world scheduling scenarios.

Purpose

Handle sophisticated scheduling requirements.

Prerequisites

  • Completed first schedule tutorial
  • Understanding of basic constraints

Step-by-step Guide

Time-Based Constraints

No Early Morning Classes

{
"type": "time",
"rule": "no-classes-before",
"time": "09:00",
"appliesTo": "all"
}

Lunch Break Protection

{
"type": "time",
"rule": "no-classes-during",
"start": "12:00",
"end": "13:00",
"appliesTo": "all"
}

Room-Based Constraints

Equipment Requirements

{
"type": "room",
"rule": "require-equipment",
"courseType": "lab",
"equipment": ["computers", "projector"]
}

Capacity Constraints

{
"type": "room",
"rule": "minimum-capacity",
"courseType": "lecture",
"factor": 1.2
}

Instructor-Based Constraints

Maximum Weekly Hours

{
"type": "instructor",
"rule": "max-hours-per-week",
"hours": 18
}

Preferred Time Slots

{
"type": "instructor",
"rule": "prefer-time-slot",
"days": ["Monday", "Wednesday"],
"start": "10:00",
"end": "14:00"
}

Group-Based Constraints

Sequential Courses

{
"type": "group",
"rule": "sequential",
"courses": ["MATH101", "MATH102"],
"minGap": "1 day"
}

Best Practices

  • Document each constraint's purpose
  • Test constraints individually
  • Use constraint groups for related rules
  • Monitor solver performance

Common Mistakes

  • Creating contradictory constraints
  • Not testing constraint combinations
  • Over-constraining the solver