Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
course_scheduling.proto
Go to the documentation of this file.
1// Copyright 2010-2024 Google LLC
2// Licensed under the Apache License, Version 2.0 (the "License");
3// you may not use this file except in compliance with the License.
4// You may obtain a copy of the License at
5//
6// http://www.apache.org/licenses/LICENSE-2.0
7//
8// Unless required by applicable law or agreed to in writing, software
9// distributed under the License is distributed on an "AS IS" BASIS,
10// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11// See the License for the specific language governing permissions and
12// limitations under the License.
13
14syntax = "proto3";
15
16package operations_research;
17
18// Information required to create a schedule for a school system.
19message CourseSchedulingModel {
20 // Schedule name, used only for logging purposes.
21 string display_name = 1;
22
23 // The number of days in a schedule rotation. If the school system uses a
24 // block schedule, this value should be 1.
25 int32 days_count = 2;
26
27 // The number of time slots each day in a schedule rotation. If the school
28 // system uses a block schedule, this value is the number of blocks.
29 int32 daily_time_slot_count = 3;
30
31 // List of courses that need to be scheduled.
32 repeated Course courses = 4;
33
34 // List of teachers.
35 repeated Teacher teachers = 5;
36
37 // List of students that need to be assigned to these courses.
38 repeated Student students = 6;
39
40 // List of rooms that the courses can be assigned to.
41 repeated Room rooms = 7;
42}
43
44// Holds the solution to the course scheduling problem.
45message CourseSchedulingResult {
46 // Human readable message about the solver or given model.
47 string message = 1;
48
49 // Status of the solver.
50 CourseSchedulingResultStatus solver_status = 2;
51
52 // List of the time slot and room assignments for each section of a course.
53 repeated ClassAssignment class_assignments = 3;
54
55 // List of course and section assignments for each student.
56 repeated StudentAssignment student_assignments = 4;
57}
58
59message ClassAssignment {
60 // Index of the course in the CourseSchedulingModel.
61 int32 course_index = 1;
62
63 // Specific section of the course in the CourseSchedulingModel.
64 int32 section_number = 2;
65
66 // Time slots that this class has been assigned to in the
67 // CourseSchedulingModel.
68 repeated int32 time_slots = 3;
69
70 // Indices of the rooms that the class is assigned to in the
71 // CourseSchedulingModel. If this is not empty, then the number of indices
72 // must match the number of time slots.
73 repeated int32 room_indices = 4;
74}
75
76message StudentAssignment {
77 // Index of the student in the CourseSchedulingModel.
78 int32 student_index = 1;
79
80 // Course indices in the CourseSchedulingModel that this student has been
81 // assigned to. The number of indices must match the number of section
82 // indices.
83 repeated int32 course_indices = 2;
84
85 // Section indices for each Course in the CourseSchedulingModel this this
86 // student has been assigned to. The number of indices must match the number
87 // of course indices.
88 repeated int32 section_indices = 3;
89}
90
91message Course {
92 // Course name, used only for logging purposes.
93 string display_name = 1;
94
95 // The number of times each section of this course needs to meet during a
96 // schedule rotation. Each section of the course meets no more than once a
97 // day. If the school system uses a block schedule, then this value should
98 // be 1.
99 int32 meetings_count = 2;
100
101 // The maximum number of students for this course. This value can be equal to
102 // +Infinity to encode a course has no maximum capacity.
103 int32 max_capacity = 3;
104
105 // The minimum number of students for this course.
106 int32 min_capacity = 4;
107
108 // The number of consecutive time slots that each section of this course needs
109 // to be scheduled for. This value can only be 1 or 2. If the value is 2, then
110 // 2 consecutive time slots in a day counts as 1 meeting time for the section.
111 int32 consecutive_slots_count = 5;
112
113 // List of indices for the teachers of this course. We are assuming that each
114 // teacher teaches separately. Must have the same number of elements as the
115 // number of sections list.
116 repeated int32 teacher_indices = 6;
117
118 // The number of sections each teacher teaches of this course. Must have the
119 // same number of elements as the teacher index list.
120 repeated int32 teacher_section_counts = 7;
121
122 // List of the possible rooms that this course can be assigned to. This can
123 // be empty.
124 repeated int32 room_indices = 8;
125}
126
127message Teacher {
128 // Teacher name, used only for logging purposes.
129 string display_name = 1;
130
131 // List of time slots that the teacher cannot be scheduled for. These time
132 // slot values index to the accumulative number of time slots starting at 0.
133 // For example, if a schedule rotation has 5 days and 8 time slots per day,
134 // and a teacher cannot be scheduled for the last time slot of the fourth
135 // day, the number here would be 31.
136 repeated int32 restricted_time_slots = 2;
137}
138
139message Student {
140 // Student name, used only for logging purposes.
141 string display_name = 1;
142
143 // List of course indices that the student needs to be enrolled in.
144 repeated int32 course_indices = 2;
145}
146
147message Room {
148 // Room name, used only for logging purposes.
149 string display_name = 1;
150
151 // Maximum number of students that can fit into this room.
152 int32 capacity = 2;
153}
154
155// Status returned by the solver.
156enum CourseSchedulingResultStatus {
157 COURSE_SCHEDULING_RESULT_STATUS_UNSPECIFIED = 0;
158
159 // The solver had enough time to find some solution that satisfies all
160 // constraints, but it did not prove optimality (which means it may or may
161 // not have reached the optimal).
162 //
163 // This can happen for large LP models (linear programming), and is a frequent
164 // response for time-limited MIPs (mixed integer programming). This is also
165 // what the CP (constraint programming) solver will return if there is no
166 // objective specified.
167 SOLVER_FEASIBLE = 1;
168
169 // The solver found the proven optimal solution.
170 SOLVER_OPTIMAL = 2;
171
172 // The model does not have any solution, according to the solver (which
173 // "proved" it, with the caveat that numerical proofs aren't actual proofs),
174 // or based on trivial considerations (eg. a variable whose lower bound is
175 // strictly greater than its upper bound).
176 SOLVER_INFEASIBLE = 3;
177
178 // Model errors. These are always deterministic and repeatable.
179 // They should be accompanied with a string description of the error.
180 SOLVER_MODEL_INVALID = 4;
181
182 // The model has not been solved in the given time or the solver was not able
183 // to solve the model given.
184 SOLVER_NOT_SOLVED = 5;
185
186 // An error (either numerical or from a bug in the code) occurred.
187 ABNORMAL = 6;
188}