Skip to content

Commit 9f52421

Browse files
committed
Course Timetabling Solver: Solver Parameters
- added new solver parameters (such as Search.MaxIdleIterations) - when on-fly student sectioning is enabled, use the new RandomStudentSwap neighbour selection - use the new Suggestion neighbour selection when the construction can be halted without finding a complete solution
1 parent e8236ce commit 9f52421

File tree

5 files changed

+550
-1
lines changed

5 files changed

+550
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
/*
2+
* Licensed to The Apereo Foundation under one or more contributor license
3+
* agreements. See the NOTICE file distributed with this work for
4+
* additional information regarding copyright ownership.
5+
*
6+
* The Apereo Foundation licenses this file to you under the Apache License,
7+
* Version 2.0 (the "License"); you may not use this file except in
8+
* compliance with the License. You may obtain a copy of the License at:
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
*
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
*
19+
*/
20+
21+
update solver_parameter_def set
22+
description = 'Number of instructors which are teaching a class which is placed to a different location than initial'
23+
where name = 'Perturbations.AffectedInstructorWeight';
24+
update solver_parameter_def set
25+
default_value = '-1'
26+
where name = 'SimulatedAnnealing.InitialTemperature' and default_value = '1.5';
27+
update solver_parameter_def set
28+
default_value = '100.0'
29+
where name = 'Placement.NrConflictsWeight1' and default_value = '1.0';
30+
update solver_parameter_def set
31+
default_value = '200.0'
32+
where name = 'Placement.WeightedConflictsWeight1' and default_value = '2.0';
33+
update solver_parameter_def set
34+
type = 'boolean'
35+
where name = 'Precedence.ConsiderDatePatterns' and type = 'text';
36+
37+
select 32767 * next_hi into @id from hibernate_unique_key;
38+
select uniqueid into @ggen from solver_parameter_group where name='General';
39+
select max(ord) into @ogen from solver_parameter_def where solver_param_group_id=@ggen;
40+
41+
insert into solver_parameter_def
42+
(uniqueid, name, default_value, description, type, ord, visible, solver_param_group_id) values
43+
(@id + 0, 'Search.MaxIdleIterations', '1000', 'Maximum number of non-improving iterations after which the construction phase is halted (-1 to never halt)', 'integer', @ogen + 1, 1, @ggen),
44+
(@id + 1, 'Search.MinConstructionTime', '10%', 'Minimum construction time when a complete solution cannot be reached', 'text', @ogen + 2, 1, @ggen),
45+
(@id + 2, 'Parallel.NrSolvers', '1', 'Number of parallel solver threads', 'integer', @ogen + 3, 1, @ggen),
46+
(@id + 3, 'ForwardCheck.MaxDepth', '2', 'Forward Checking: Max Depth', 'integer', @ogen + 4, 1, @ggen),
47+
(@id + 4, 'ForwardCheck.MaxDomainSize', '1000', 'Forward Checking: Max Domain Size', 'integer', @ogen + 5, 1, @ggen),
48+
(@id + 5, 'General.AutomaticInstructorConstraints', '', 'Automatic instructor constraints (separated by comma)', 'text', @ogen + 6, 1, @ggen),
49+
(@id + 6, 'General.LoadCommittedReservations', 'false', 'Load: Consider Reservations for Committed Classes', 'boolean', @ogen + 7, 1, @ggen),
50+
(@id + 7, 'General.ApplyInstructorDistributionsAcrossAllDepartments', 'false', 'Load: Apply Instructor Distributions Across All Departments', 'boolean', @ogen + 8, 1, @ggen),
51+
(@id + 8, 'General.StudentGroupCourseDemands', 'false', 'Create additional student demands based on student group reservations', 'boolean', @ogen + 9, 1, @ggen),
52+
(@id + 9, 'General.MPP.FixedTimes', 'false', 'MPP: Fix All Assigned Times', 'boolean', @ogen + 10, 1, @ggen),
53+
(@id + 10, 'General.WeakenDistributions','false', 'Weaken Hard Distributions (useful for fixed-time MPP)', 'boolean', @ogen + 11, 1, @ggen),
54+
(@id + 11, 'General.SoftInstructorConstraints', 'false', 'Soft Instructor Constraints (useful for fixed-time MPP)', 'boolean', @ogen + 12, 1, @ggen),
55+
(@id + 12, 'General.AllowProhibitedRooms', 'false', 'Allow Prohibited Rooms (useful for fixed-time MPP)', 'boolean', @ogen + 13, 1, @ggen);
56+
57+
update hibernate_unique_key set next_hi=next_hi+1;
58+
59+
delete d1 from
60+
solver_parameter_def d1 inner join solver_parameter_group g1 on d1.solver_param_group_id = g1.uniqueid,
61+
solver_parameter_def d2 inner join solver_parameter_group g2 on d2.solver_param_group_id = g2.uniqueid
62+
where d2.uniqueid < d1.uniqueid and d1.name = d2.name and g1.param_type = g2.param_type;
63+
64+
/*
65+
* Update database version
66+
*/
67+
68+
update application_config set value='271' where name='tmtbl.db.version';
69+
70+
commit;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
/*
2+
* Licensed to The Apereo Foundation under one or more contributor license
3+
* agreements. See the NOTICE file distributed with this work for
4+
* additional information regarding copyright ownership.
5+
*
6+
* The Apereo Foundation licenses this file to you under the Apache License,
7+
* Version 2.0 (the "License"); you may not use this file except in
8+
* compliance with the License. You may obtain a copy of the License at:
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
*
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
*
19+
*/
20+
21+
update solver_parameter_def set
22+
description = 'Number of instructors which are teaching a class which is placed to a different location than initial'
23+
where name = 'Perturbations.AffectedInstructorWeight';
24+
update solver_parameter_def set
25+
default_value = '-1'
26+
where name = 'SimulatedAnnealing.InitialTemperature' and default_value = '1.5';
27+
update solver_parameter_def set
28+
default_value = '100.0'
29+
where name = 'Placement.NrConflictsWeight1' and default_value = '1.0';
30+
update solver_parameter_def set
31+
default_value = '200.0'
32+
where name = 'Placement.WeightedConflictsWeight1' and default_value = '2.0';
33+
update solver_parameter_def set
34+
type = 'boolean'
35+
where name = 'Precedence.ConsiderDatePatterns' and type = 'text';
36+
37+
insert into solver_parameter_def (select
38+
solver_parameter_def_seq.nextval as uniqueid,
39+
'Search.MaxIdleIterations' as name,
40+
'1000' as default_value,
41+
'Maximum number of non-improving iterations after which the construction phase is halted (-1 to never halt)' as description,
42+
'integer' as type,
43+
(select count(*) from solver_parameter_def d, solver_parameter_group g where d.solver_param_group_id = g.uniqueid and g.name = 'General') as ord,
44+
1 as visible,
45+
uniqueid as solver_param_group_id from solver_parameter_group where name = 'General');
46+
insert into solver_parameter_def (select
47+
solver_parameter_def_seq.nextval as uniqueid,
48+
'Search.MinConstructionTime' as name,
49+
'10%' as default_value,
50+
'Minimum construction time when a complete solution cannot be reached' as description,
51+
'integer' as type,
52+
(select count(*) from solver_parameter_def d, solver_parameter_group g where d.solver_param_group_id = g.uniqueid and g.name = 'General') as ord,
53+
1 as visible,
54+
uniqueid as solver_param_group_id from solver_parameter_group where name = 'General');
55+
insert into solver_parameter_def (select
56+
solver_parameter_def_seq.nextval as uniqueid,
57+
'Parallel.NrSolvers' as name,
58+
'1' as default_value,
59+
'Number of parallel solver threads' as description,
60+
'integer' as type,
61+
(select count(*) from solver_parameter_def d, solver_parameter_group g where d.solver_param_group_id = g.uniqueid and g.name = 'General') as ord,
62+
1 as visible,
63+
uniqueid as solver_param_group_id from solver_parameter_group where name = 'General');
64+
insert into solver_parameter_def (select
65+
solver_parameter_def_seq.nextval as uniqueid,
66+
'ForwardCheck.MaxDepth' as name,
67+
'2' as default_value,
68+
'Forward Checking: Max Depth' as description,
69+
'integer' as type,
70+
(select count(*) from solver_parameter_def d, solver_parameter_group g where d.solver_param_group_id = g.uniqueid and g.name = 'General') as ord,
71+
1 as visible,
72+
uniqueid as solver_param_group_id from solver_parameter_group where name = 'General');
73+
insert into solver_parameter_def (select
74+
solver_parameter_def_seq.nextval as uniqueid,
75+
'ForwardCheck.MaxDomainSize' as name,
76+
'1000' as default_value,
77+
'Forward Checking: Max Domain Size' as description,
78+
'integer' as type,
79+
(select count(*) from solver_parameter_def d, solver_parameter_group g where d.solver_param_group_id = g.uniqueid and g.name = 'General') as ord,
80+
1 as visible,
81+
uniqueid as solver_param_group_id from solver_parameter_group where name = 'General');
82+
insert into solver_parameter_def (select
83+
solver_parameter_def_seq.nextval as uniqueid,
84+
'General.AutomaticInstructorConstraints' as name,
85+
'' as default_value,
86+
'Automatic instructor constraints (separated by comma)' as description,
87+
'text' as type,
88+
(select count(*) from solver_parameter_def d, solver_parameter_group g where d.solver_param_group_id = g.uniqueid and g.name = 'General') as ord,
89+
1 as visible,
90+
uniqueid as solver_param_group_id from solver_parameter_group where name = 'General');
91+
insert into solver_parameter_def (select
92+
solver_parameter_def_seq.nextval as uniqueid,
93+
'General.LoadCommittedReservations' as name,
94+
'false' as default_value,
95+
'Load: Consider Reservations for Committed Classes' as description,
96+
'boolean' as type,
97+
(select count(*) from solver_parameter_def d, solver_parameter_group g where d.solver_param_group_id = g.uniqueid and g.name = 'General') as ord,
98+
1 as visible,
99+
uniqueid as solver_param_group_id from solver_parameter_group where name = 'General');
100+
insert into solver_parameter_def (select
101+
solver_parameter_def_seq.nextval as uniqueid,
102+
'General.ApplyInstructorDistributionsAcrossAllDepartments' as name,
103+
'false' as default_value,
104+
'Load: Apply Instructor Distributions Across All Departments' as description,
105+
'boolean' as type,
106+
(select count(*) from solver_parameter_def d, solver_parameter_group g where d.solver_param_group_id = g.uniqueid and g.name = 'General') as ord,
107+
1 as visible,
108+
uniqueid as solver_param_group_id from solver_parameter_group where name = 'General');
109+
insert into solver_parameter_def (select
110+
solver_parameter_def_seq.nextval as uniqueid,
111+
'General.StudentGroupCourseDemands' as name,
112+
'false' as default_value,
113+
'Create additional student demands based on student group reservations' as description,
114+
'boolean' as type,
115+
(select count(*) from solver_parameter_def d, solver_parameter_group g where d.solver_param_group_id = g.uniqueid and g.name = 'General') as ord,
116+
1 as visible,
117+
uniqueid as solver_param_group_id from solver_parameter_group where name = 'General');
118+
insert into solver_parameter_def (select
119+
solver_parameter_def_seq.nextval as uniqueid,
120+
'General.MPP.FixedTimes' as name,
121+
'false' as default_value,
122+
'MPP: Fix All Assigned Times' as description,
123+
'boolean' as type,
124+
(select count(*) from solver_parameter_def d, solver_parameter_group g where d.solver_param_group_id = g.uniqueid and g.name = 'General') as ord,
125+
1 as visible,
126+
uniqueid as solver_param_group_id from solver_parameter_group where name = 'General');
127+
insert into solver_parameter_def (select
128+
solver_parameter_def_seq.nextval as uniqueid,
129+
'General.WeakenDistributions' as name,
130+
'false' as default_value,
131+
'Weaken Hard Distributions (useful for fixed-time MPP)' as description,
132+
'boolean' as type,
133+
(select count(*) from solver_parameter_def d, solver_parameter_group g where d.solver_param_group_id = g.uniqueid and g.name = 'General') as ord,
134+
1 as visible,
135+
uniqueid as solver_param_group_id from solver_parameter_group where name = 'General');
136+
insert into solver_parameter_def (select
137+
solver_parameter_def_seq.nextval as uniqueid,
138+
'General.SoftInstructorConstraints' as name,
139+
'' as default_value,
140+
'Soft Instructor Constraints (useful for fixed-time MPP)' as description,
141+
'boolean' as type,
142+
(select count(*) from solver_parameter_def d, solver_parameter_group g where d.solver_param_group_id = g.uniqueid and g.name = 'General') as ord,
143+
1 as visible,
144+
uniqueid as solver_param_group_id from solver_parameter_group where name = 'General');
145+
insert into solver_parameter_def (select
146+
solver_parameter_def_seq.nextval as uniqueid,
147+
'General.AllowProhibitedRooms' as name,
148+
'' as default_value,
149+
'Allow Prohibited Rooms (useful for fixed-time MPP)' as description,
150+
'boolean' as type,
151+
(select count(*) from solver_parameter_def d, solver_parameter_group g where d.solver_param_group_id = g.uniqueid and g.name = 'General') as ord,
152+
1 as visible,
153+
uniqueid as solver_param_group_id from solver_parameter_group where name = 'General');
154+
155+
156+
delete from solver_parameter_def where uniqueid in (select d1.uniqueid from
157+
solver_parameter_def d1 inner join solver_parameter_group g1 on d1.solver_param_group_id = g1.uniqueid,
158+
solver_parameter_def d2 inner join solver_parameter_group g2 on d2.solver_param_group_id = g2.uniqueid
159+
where d2.uniqueid < d1.uniqueid and d1.name = d2.name and g1.param_type = g2.param_type);
160+
161+
/*
162+
* Update database version
163+
*/
164+
165+
update application_config set value='271' where name='tmtbl.db.version';
166+
167+
commit;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
/*
2+
* Licensed to The Apereo Foundation under one or more contributor license
3+
* agreements. See the NOTICE file distributed with this work for
4+
* additional information regarding copyright ownership.
5+
*
6+
* The Apereo Foundation licenses this file to you under the Apache License,
7+
* Version 2.0 (the "License"); you may not use this file except in
8+
* compliance with the License. You may obtain a copy of the License at:
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
*
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
*
19+
*/
20+
21+
update solver_parameter_def set
22+
description = 'Number of instructors which are teaching a class which is placed to a different location than initial'
23+
where name = 'Perturbations.AffectedInstructorWeight';
24+
update solver_parameter_def set
25+
default_value = '-1'
26+
where name = 'SimulatedAnnealing.InitialTemperature' and default_value = '1.5';
27+
update solver_parameter_def set
28+
default_value = '100.0'
29+
where name = 'Placement.NrConflictsWeight1' and default_value = '1.0';
30+
update solver_parameter_def set
31+
default_value = '200.0'
32+
where name = 'Placement.WeightedConflictsWeight1' and default_value = '2.0';
33+
update solver_parameter_def set
34+
type = 'boolean'
35+
where name = 'Precedence.ConsiderDatePatterns' and type = 'text';
36+
37+
do $$
38+
declare
39+
id bigint;
40+
ggen bigint;
41+
ogen bigint;
42+
begin
43+
select 32767 * next_hi into id from hibernate_unique_key;
44+
select uniqueid into ggen from solver_parameter_group where name='General';
45+
select max(ord) into ogen from solver_parameter_def where solver_param_group_id=(select uniqueid from solver_parameter_group where name='General');
46+
insert into solver_parameter_def
47+
(uniqueid, name, default_value, description, type, ord, visible, solver_param_group_id) values
48+
(@id + 0, 'Search.MaxIdleIterations', '1000', 'Maximum number of non-improving iterations after which the construction phase is halted (-1 to never halt)', 'integer', @ogen + 1, true, @ggen),
49+
(@id + 1, 'Search.MinConstructionTime', '10%', 'Minimum construction time when a complete solution cannot be reached', 'text', @ogen + 2, true, @ggen),
50+
(@id + 2, 'Parallel.NrSolvers', '1', 'Number of parallel solver threads', 'integer', @ogen + 3, true, @ggen),
51+
(@id + 3, 'ForwardCheck.MaxDepth', '2', 'Forward Checking: Max Depth', 'integer', @ogen + 4, true, @ggen),
52+
(@id + 4, 'ForwardCheck.MaxDomainSize', '1000', 'Forward Checking: Max Domain Size', 'integer', @ogen + 5, true, @ggen),
53+
(@id + 5, 'General.AutomaticInstructorConstraints', '', 'Automatic instructor constraints (separated by comma)', 'text', @ogen + 6, true, @ggen),
54+
(@id + 6, 'General.LoadCommittedReservations', 'false', 'Load: Consider Reservations for Committed Classes', 'boolean', @ogen + 7, true, @ggen),
55+
(@id + 7, 'General.ApplyInstructorDistributionsAcrossAllDepartments', 'false', 'Load: Apply Instructor Distributions Across All Departments', 'boolean', @ogen + 8, true, @ggen),
56+
(@id + 8, 'General.StudentGroupCourseDemands', 'false', 'Create additional student demands based on student group reservations', 'boolean', @ogen + 9, true, @ggen),
57+
(@id + 9, 'General.MPP.FixedTimes', 'false', 'MPP: Fix All Assigned Times', 'boolean', @ogen + 10, true, @ggen),
58+
(@id + 10, 'General.WeakenDistributions','false', 'Weaken Hard Distributions (useful for fixed-time MPP)', 'boolean', @ogen + 11, true, @ggen),
59+
(@id + 11, 'General.SoftInstructorConstraints', 'false', 'Soft Instructor Constraints (useful for fixed-time MPP)', 'boolean', @ogen + 12, true, @ggen),
60+
(@id + 12, 'General.AllowProhibitedRooms', 'false', 'Allow Prohibited Rooms (useful for fixed-time MPP)', 'boolean', @ogen + 13, true, @ggen);
61+
update hibernate_unique_key set next_hi=next_hi+1;
62+
end; $$;
63+
64+
delete from solver_parameter_def where uniqueid in (select d1.uniqueid from
65+
solver_parameter_def d1 inner join solver_parameter_group g1 on d1.solver_param_group_id = g1.uniqueid,
66+
solver_parameter_def d2 inner join solver_parameter_group g2 on d2.solver_param_group_id = g2.uniqueid
67+
where d2.uniqueid < d1.uniqueid and d1.name = d2.name and g1.param_type = g2.param_type);
68+
69+
/*
70+
* Update database version
71+
*/
72+
73+
update application_config set value='271' where name='tmtbl.db.version';
74+
75+
commit;

0 commit comments

Comments
 (0)