├── .classpath ├── .gitignore ├── .project ├── .settings ├── org.eclipse.core.resources.prefs ├── org.eclipse.jdt.core.prefs ├── org.eclipse.jdt.ui.prefs ├── org.eclipse.wst.common.component └── org.eclipse.wst.common.project.facet.core.xml ├── LICENSE ├── README.md ├── build.number ├── build.xml ├── distribution.xml ├── lib ├── dom4j-2.1.4.jar ├── log4j-api-2.20.0.jar └── log4j-core-2.20.0.jar ├── pom.xml └── src ├── log4j2.xml └── org └── cpsolver ├── coursett ├── Constants.java ├── DomainChart.java ├── GetInfo.java ├── GetMppInfo.java ├── IdConvertor.java ├── JenrlChart.java ├── SolutionEvaluator.java ├── Test.java ├── TimetableLoader.java ├── TimetableSaver.java ├── TimetableSolver.java ├── TimetableXMLLoader.java ├── TimetableXMLSaver.java ├── constraint │ ├── BreakFlexibleConstraint.java │ ├── ClassLimitConstraint.java │ ├── DepartmentSpreadConstraint.java │ ├── DiscouragedRoomConstraint.java │ ├── ExtendedStudentConflicts.java │ ├── FlexibleConstraint.java │ ├── GroupConstraint.java │ ├── IgnoreStudentConflictsConstraint.java │ ├── InstructorConstraint.java │ ├── JenrlConstraint.java │ ├── MaxBlockFlexibleConstraint.java │ ├── MaxBreaksFlexibleConstraint.java │ ├── MaxConsecutiveDaysFlexibleConstraint.java │ ├── MaxDaysFlexibleConstraint.java │ ├── MaxHalfDaysFlexibleConstraint.java │ ├── MaxHolesFlexibleConstraint.java │ ├── MaxWeeksFlexibleConstraint.java │ ├── MinimizeNumberOfUsedGroupsOfTime.java │ ├── MinimizeNumberOfUsedRoomsConstraint.java │ ├── NoStudentOnlineConflicts.java │ ├── RoomConstraint.java │ ├── SoftInstructorConstraint.java │ ├── SpreadConstraint.java │ └── package-info.java ├── criteria │ ├── BackToBackInstructorPreferences.java │ ├── BrokenTimePatterns.java │ ├── DepartmentBalancingPenalty.java │ ├── DistributionPreferences.java │ ├── FlexibleConstraintCriterion.java │ ├── Perturbations.java │ ├── RoomPreferences.java │ ├── RoomViolations.java │ ├── SameSubpartBalancingPenalty.java │ ├── StudentCommittedConflict.java │ ├── StudentConflict.java │ ├── StudentDistanceConflict.java │ ├── StudentHardConflict.java │ ├── StudentOverlapConflict.java │ ├── StudentWorkdayConflict.java │ ├── TimePreferences.java │ ├── TimeViolations.java │ ├── TimetablingCriterion.java │ ├── TooBigRooms.java │ ├── UselessHalfHours.java │ ├── additional │ │ ├── IgnoredCommittedStudentConflict.java │ │ ├── IgnoredStudentConflict.java │ │ ├── ImportantStudentConflict.java │ │ ├── ImportantStudentHardConflict.java │ │ ├── InstructorConflict.java │ │ ├── InstructorFairness.java │ │ ├── InstructorLunchBreak.java │ │ ├── InstructorStudentConflict.java │ │ ├── InstructorStudentHardConflict.java │ │ ├── QuadraticStudentConflict.java │ │ ├── QuadraticStudentHardConflict.java │ │ ├── RoomSizePenalty.java │ │ ├── StudentLuchBreak.java │ │ ├── StudentMinimizeDaysOfWeek.java │ │ ├── StudentMinimizeScheduleHoles.java │ │ ├── StudentOnlineConflict.java │ │ ├── StudentOverLunchConflict.java │ │ └── package-info.java │ ├── package-info.java │ └── placement │ │ ├── AssignmentCount.java │ │ ├── DeltaTimePreference.java │ │ ├── HardConflicts.java │ │ ├── PlacementSelectionCriterion.java │ │ ├── PotentialHardConflicts.java │ │ ├── WeightedHardConflicts.java │ │ └── package-info.java ├── custom │ ├── DeterministicStudentSectioning.java │ └── package-info.java ├── heuristics │ ├── FixCompleteSolutionNeighbourSelection.java │ ├── HeuristicSelector.java │ ├── LectureSelection.java │ ├── NeighbourSelectionWithSuggestions.java │ ├── PlacementSelection.java │ ├── TimetableComparator.java │ ├── UniversalPerturbationsCounter.java │ └── package-info.java ├── model │ ├── Configuration.java │ ├── DefaultStudentSectioning.java │ ├── FinalSectioning.java │ ├── InitialSectioning.java │ ├── Lecture.java │ ├── OnFlySectioning.java │ ├── Placement.java │ ├── RoomLocation.java │ ├── RoomSharingModel.java │ ├── Student.java │ ├── StudentGroup.java │ ├── StudentSectioning.java │ ├── TimeLocation.java │ ├── TimetableModel.java │ └── package-info.java ├── neighbourhoods │ ├── RoomChange.java │ ├── RoomSwap.java │ ├── Suggestion.java │ ├── TimeChange.java │ ├── TimeSwap.java │ └── package-info.java ├── package-info.java ├── preference │ ├── AveragePreferenceCombination.java │ ├── MinMaxPreferenceCombination.java │ ├── PreferenceCombination.java │ ├── SumPreferenceCombination.java │ └── package-info.java └── sectioning │ ├── RandomStudentSwap.java │ ├── SctEnrollment.java │ ├── SctModel.java │ ├── SctSectioning.java │ ├── SctStudent.java │ ├── StudentMove.java │ ├── StudentSwap.java │ ├── StudentSwapGenerator.java │ ├── StudentSwapSectioning.java │ └── package-info.java ├── exam ├── MistaTables.java ├── Test.java ├── criteria │ ├── DistributionPenalty.java │ ├── ExamCriterion.java │ ├── ExamRotationPenalty.java │ ├── InstructorBackToBackConflicts.java │ ├── InstructorDirectConflicts.java │ ├── InstructorDistanceBackToBackConflicts.java │ ├── InstructorMoreThan2ADayConflicts.java │ ├── InstructorNotAvailableConflicts.java │ ├── LargeExamsPenalty.java │ ├── PeriodIndexPenalty.java │ ├── PeriodPenalty.java │ ├── PeriodSizePenalty.java │ ├── PerturbationPenalty.java │ ├── RoomPenalty.java │ ├── RoomPerturbationPenalty.java │ ├── RoomSizePenalty.java │ ├── RoomSplitDistancePenalty.java │ ├── RoomSplitPenalty.java │ ├── StudentBackToBackConflicts.java │ ├── StudentDirectConflicts.java │ ├── StudentDistanceBackToBackConflicts.java │ ├── StudentMoreThan2ADayConflicts.java │ ├── StudentNotAvailableConflicts.java │ ├── additional │ │ ├── DistanceToStronglyPreferredRoom.java │ │ ├── DistributionViolation.java │ │ ├── PeriodViolation.java │ │ ├── RoomViolation.java │ │ ├── StudentMoreThan1ADayConflicts.java │ │ └── package-info.java │ └── package-info.java ├── heuristics │ ├── ExamColoringConstruction.java │ ├── ExamConstruction.java │ ├── ExamGreatDeluge.java │ ├── ExamHillClimbing.java │ ├── ExamNeighbourSelection.java │ ├── ExamSimulatedAnnealing.java │ ├── ExamTabuSearch.java │ ├── ExamUnassignedVariableSelection.java │ └── package-info.java ├── model │ ├── Exam.java │ ├── ExamContext.java │ ├── ExamDistributionConstraint.java │ ├── ExamInstructor.java │ ├── ExamModel.java │ ├── ExamOwner.java │ ├── ExamPeriod.java │ ├── ExamPeriodPlacement.java │ ├── ExamPlacement.java │ ├── ExamRoom.java │ ├── ExamRoomPlacement.java │ ├── ExamRoomSharing.java │ ├── ExamStudent.java │ ├── PredefinedExamRoomSharing.java │ ├── SimpleExamRoomSharing.java │ └── package-info.java ├── neighbours │ ├── ExamPeriodSwapMove.java │ ├── ExamRandomMove.java │ ├── ExamRoomMove.java │ ├── ExamRoomSwapNeighbour.java │ ├── ExamSimpleNeighbour.java │ ├── ExamTimeMove.java │ └── package-info.java ├── package-info.java ├── reports │ ├── ExamAssignments.java │ ├── ExamCourseSectionAssignments.java │ ├── ExamInstructorConflicts.java │ ├── ExamNbrMeetingsPerDay.java │ ├── ExamPeriodUsage.java │ ├── ExamRoomComparator.java │ ├── ExamRoomSchedule.java │ ├── ExamRoomSplit.java │ ├── ExamStudentBackToBackConflicts.java │ ├── ExamStudentConflicts.java │ ├── ExamStudentConflictsBySectionCourse.java │ ├── ExamStudentConflictsPerExam.java │ ├── ExamStudentDirectConflicts.java │ ├── ExamStudentMoreTwoADay.java │ └── package-info.java └── split │ ├── ExamSplitMoves.java │ ├── ExamSplitter.java │ └── package-info.java ├── ifs ├── Constants.java ├── algorithms │ ├── GreatDeluge.java │ ├── HillClimber.java │ ├── MetaHeuristicSearch.java │ ├── NeighbourSearch.java │ ├── NeighbourSelector.java │ ├── ParallelConstruction.java │ ├── SimpleSearch.java │ ├── SimulatedAnnealing.java │ ├── StepCountingHillClimber.java │ ├── neighbourhoods │ │ ├── HillClimberSelection.java │ │ ├── RandomMove.java │ │ ├── RandomSwapMove.java │ │ ├── SuggestionMove.java │ │ └── package-info.java │ └── package-info.java ├── assignment │ ├── Assignment.java │ ├── AssignmentAbstract.java │ ├── AssignmentArray.java │ ├── AssignmentComparable.java │ ├── AssignmentComparator.java │ ├── AssignmentMap.java │ ├── DefaultInheritedAssignment.java │ ├── DefaultParallelAssignment.java │ ├── DefaultSingleAssignment.java │ ├── EmptyAssignment.java │ ├── InheritedAssignment.java │ ├── InheritedAssignmentArray.java │ ├── OptimisticInheritedAssignment.java │ ├── ValueComparator.java │ ├── context │ │ ├── AbstractClassWithContext.java │ │ ├── AssignmentConstraintContext.java │ │ ├── AssignmentContext.java │ │ ├── AssignmentContextHelper.java │ │ ├── AssignmentContextHolder.java │ │ ├── AssignmentContextHolderArray.java │ │ ├── AssignmentContextHolderMap.java │ │ ├── AssignmentContextReference.java │ │ ├── BinaryConstraintWithContext.java │ │ ├── CanHoldContext.java │ │ ├── CanInheritContext.java │ │ ├── ConstraintWithContext.java │ │ ├── DefaultParallelAssignmentContextHolder.java │ │ ├── DefaultSingleAssignmentContextHolder.java │ │ ├── ExtensionWithContext.java │ │ ├── HasAssignmentContext.java │ │ ├── InheritedAssignmentContextHolder.java │ │ ├── ModelWithContext.java │ │ ├── NeighbourSelectionWithContext.java │ │ ├── VariableWithContext.java │ │ └── package-info.java │ └── package-info.java ├── constant │ ├── ConstantModel.java │ ├── ConstantVariable.java │ └── package-info.java ├── criteria │ ├── AbstractCriterion.java │ ├── AssignedValue.java │ ├── Criterion.java │ └── package-info.java ├── dbt │ ├── DbtPropagation.java │ ├── DbtValueSelection.java │ ├── DbtVariableSelection.java │ └── package-info.java ├── example │ ├── csp │ │ ├── CSPBinaryConstraint.java │ │ ├── CSPModel.java │ │ ├── CSPValue.java │ │ ├── CSPVariable.java │ │ ├── SimpleTest.java │ │ ├── StructuredCSPModel.java │ │ ├── Test.java │ │ └── package-info.java │ ├── jobshop │ │ ├── Job.java │ │ ├── JobShopModel.java │ │ ├── Location.java │ │ ├── Machine.java │ │ ├── Operation.java │ │ ├── Test.java │ │ └── package-info.java │ ├── package-info.java │ ├── rpp │ │ ├── Location.java │ │ ├── RPPModel.java │ │ ├── Rectangle.java │ │ ├── ResourceConstraint.java │ │ ├── Test.java │ │ └── package-info.java │ └── tt │ │ ├── Activity.java │ │ ├── Dependence.java │ │ ├── Location.java │ │ ├── Resource.java │ │ ├── Test.java │ │ ├── TimetableModel.java │ │ └── package-info.java ├── extension │ ├── AssignedValue.java │ ├── AssignedValueSet.java │ ├── ConflictStatistics.java │ ├── Extension.java │ ├── MacPropagation.java │ ├── MacRevised.java │ ├── SearchIntensification.java │ ├── ViolatedInitials.java │ └── package-info.java ├── heuristics │ ├── BacktrackNeighbourSelection.java │ ├── GeneralValueSelection.java │ ├── GeneralVariableSelection.java │ ├── MaxIdleNeighbourSelection.java │ ├── NeighbourSelection.java │ ├── RouletteWheelSelection.java │ ├── RoundRobinNeighbourSelection.java │ ├── StandardNeighbourSelection.java │ ├── ValueSelection.java │ ├── VariableSelection.java │ └── package-info.java ├── model │ ├── BinaryConstraint.java │ ├── Constraint.java │ ├── ConstraintListener.java │ ├── ExtendedInfoProvider.java │ ├── GlobalConstraint.java │ ├── InfoProvider.java │ ├── LazyNeighbour.java │ ├── LazySwap.java │ ├── Model.java │ ├── ModelListener.java │ ├── Neighbour.java │ ├── SimpleNeighbour.java │ ├── Value.java │ ├── Variable.java │ ├── VariableListener.java │ ├── WeakeningConstraint.java │ └── package-info.java ├── package-info.java ├── perturbations │ ├── DefaultPerturbationsCounter.java │ ├── PerturbationsCounter.java │ └── package-info.java ├── solution │ ├── GeneralSolutionComparator.java │ ├── MPPSolutionComparator.java │ ├── Solution.java │ ├── SolutionComparator.java │ ├── SolutionListener.java │ └── package-info.java ├── solver │ ├── ParallelSolver.java │ ├── Solver.java │ ├── SolverListener.java │ └── package-info.java ├── termination │ ├── GeneralTerminationCondition.java │ ├── MPPTerminationCondition.java │ ├── TerminationCondition.java │ └── package-info.java └── util │ ├── CSVFile.java │ ├── Callback.java │ ├── Counter.java │ ├── Csv2Html.java │ ├── Csv2Tex.java │ ├── DataProperties.java │ ├── DistanceMetric.java │ ├── IdGenerator.java │ ├── JProf.java │ ├── ProblemLoader.java │ ├── ProblemSaver.java │ ├── Progress.java │ ├── ProgressListener.java │ ├── ProgressWriter.java │ ├── PrologFile.java │ ├── Query.java │ ├── SoftCache.java │ ├── ToolBox.java │ └── package-info.java ├── instructor ├── Test.java ├── constraints │ ├── GroupConstraint.java │ ├── InstructorConstraint.java │ ├── SameInstructorConstraint.java │ ├── SameLinkConstraint.java │ └── package-info.java ├── criteria │ ├── AttributePreferences.java │ ├── BackToBack.java │ ├── CoursePreferences.java │ ├── DifferentLecture.java │ ├── Distributions.java │ ├── InstructorPreferences.java │ ├── InstructorSchedulingCriterion.java │ ├── OriginalInstructor.java │ ├── SameCommon.java │ ├── SameCourse.java │ ├── SameDays.java │ ├── SameInstructor.java │ ├── SameLink.java │ ├── SameRoom.java │ ├── TeachingPreferences.java │ ├── TimeOverlaps.java │ ├── TimePreferences.java │ ├── UnusedInstructorLoad.java │ └── package-info.java ├── default.properties ├── model │ ├── Attribute.java │ ├── Course.java │ ├── EnrolledClass.java │ ├── Instructor.java │ ├── InstructorSchedulingModel.java │ ├── Preference.java │ ├── Section.java │ ├── TeachingAssignment.java │ ├── TeachingRequest.java │ └── package-info.java ├── package-info.java └── test │ ├── ChmTest.java │ ├── MathTest.java │ ├── chm.properties │ ├── math.properties │ └── package-info.java └── studentsct ├── GetChoices.java ├── GetInfo.java ├── OnlineSectProof.java ├── Solution2Expectations.java ├── StudentPreferencePenalties.java ├── StudentRequestXml.java ├── StudentSctBBTest.java ├── StudentSectioningLoader.java ├── StudentSectioningModel.java ├── StudentSectioningSaver.java ├── StudentSectioningXMLLoader.java ├── StudentSectioningXMLSaver.java ├── Test.java ├── check ├── CourseLimitCheck.java ├── InevitableStudentConflicts.java ├── OverlapCheck.java ├── SectionLimitCheck.java └── package-info.java ├── constraint ├── CancelledSections.java ├── ConfigLimit.java ├── CourseLimit.java ├── DisabledSections.java ├── FixInitialAssignments.java ├── FixedAssignments.java ├── HardDistanceConflicts.java ├── LinkedSections.java ├── RequiredReservation.java ├── RequiredRestrictions.java ├── RequiredSections.java ├── ReservationLimit.java ├── SectionLimit.java ├── StudentConflict.java ├── StudentNotAvailable.java └── package-info.java ├── extension ├── DistanceConflict.java ├── StudentConflictStatistics.java ├── StudentQuality.java ├── TimeOverlapsCounter.java └── package-info.java ├── filter ├── CombinedStudentFilter.java ├── FreshmanStudentFilter.java ├── PriortyStudentFilter.java ├── RandomStudentFilter.java ├── RealStudentFilter.java ├── ReverseStudentFilter.java ├── StudentFilter.java └── package-info.java ├── heuristics ├── AssignmentCheck.java ├── EnrollmentSelection.java ├── RandomizedBacktrackNeighbourSelection.java ├── RestoreBestSolution.java ├── RouletteWheelRequestSelection.java ├── StudentSctNeighbourSelection.java ├── TwoPhaseStudentSctNeighbourSelection.java ├── package-info.java ├── selection │ ├── AssignInitialSelection.java │ ├── BacktrackSelection.java │ ├── BranchBoundSelection.java │ ├── CriticalBacktrackSelection.java │ ├── CriticalCoursesBranchAndBoundSelection.java │ ├── CriticalStandardSelection.java │ ├── MinCreditBranchAndBoundSelection.java │ ├── OnlineSelection.java │ ├── PriorityConstructionSelection.java │ ├── ProblemStudentsProvider.java │ ├── RandomUnassignmentSelection.java │ ├── ResectionIncompleteStudentsSelection.java │ ├── ResectionUnassignedStudentsSelection.java │ ├── RndUnProblStudSelection.java │ ├── ShuffleStudentsSelection.java │ ├── StandardSelection.java │ ├── StudentEnrollmentSwapSelection.java │ ├── SwapStudentSelection.java │ ├── UnassignedCriticalCourseRequestSelection.java │ ├── UnassignedRequestSelection.java │ └── package-info.java └── studentord │ ├── StudentByPriorityRequestDate.java │ ├── StudentByRequestDate.java │ ├── StudentChoiceOrder.java │ ├── StudentChoiceRealFirstOrder.java │ ├── StudentGroupsChoiceRealFirstOrder.java │ ├── StudentMajorOrder.java │ ├── StudentOrder.java │ ├── StudentRandomOrder.java │ ├── StudentRandomRealFirstOrder.java │ └── package-info.java ├── model ├── AreaClassificationMajor.java ├── Choice.java ├── Config.java ├── Course.java ├── CourseRequest.java ├── Enrollment.java ├── FreeTimeRequest.java ├── Instructor.java ├── Offering.java ├── Request.java ├── RequestGroup.java ├── SctAssignment.java ├── Section.java ├── Student.java ├── StudentGroup.java ├── Subpart.java ├── Unavailability.java └── package-info.java ├── online ├── MaxOverExpectedConstraint.java ├── OnlineConfig.java ├── OnlineReservation.java ├── OnlineSection.java ├── OnlineSectioningModel.java ├── Test.java ├── expectations │ ├── AvoidUnbalancedWhenNoExpectations.java │ ├── FractionallyOverExpected.java │ ├── FractionallyUnbalancedWhenNoExpectations.java │ ├── MinimizeConflicts.java │ ├── MoreSpaceThanExpected.java │ ├── NeverOverExpected.java │ ├── OverExpectedCriterion.java │ ├── PenaltyNotNegative.java │ ├── PercentageOverExpected.java │ └── package-info.java ├── package-info.java └── selection │ ├── BestPenaltyCriterion.java │ ├── EqualWeightCriterion.java │ ├── MultiCriteriaBranchAndBoundSelection.java │ ├── MultiCriteriaBranchAndBoundSuggestions.java │ ├── OnlineSectioningCriterion.java │ ├── OnlineSectioningSelection.java │ ├── ResectioningWeights.java │ ├── StudentSchedulingAssistantWeights.java │ ├── SuggestionSelection.java │ ├── SuggestionsBranchAndBound.java │ └── package-info.java ├── package-info.java ├── report ├── AbstractStudentSectioningReport.java ├── AccommodationConflictsTable.java ├── CourseConflictTable.java ├── CourseSection.java ├── CriticalCoursesTable.java ├── DistanceConflictTable.java ├── RequestGroupTable.java ├── RequestPriorityTable.java ├── SectionConflictTable.java ├── SolutionStatsReport.java ├── StudentSectioningReport.java ├── TableauReport.java ├── TimeOverlapConflictTable.java ├── UnbalancedSectionsTable.java └── package-info.java ├── reservation ├── CourseReservation.java ├── CourseRestriction.java ├── CurriculumOverride.java ├── CurriculumReservation.java ├── CurriculumRestriction.java ├── DummyReservation.java ├── GroupReservation.java ├── IndividualReservation.java ├── IndividualRestriction.java ├── LearningCommunityReservation.java ├── Reservation.java ├── ReservationOverride.java ├── Restriction.java ├── UniversalOverride.java └── package-info.java └── weights ├── EqualStudentWeights.java ├── OriginalStudentWeights.java ├── PriorityStudentWeights.java ├── StudentWeights.java └── package-info.java /.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /bin/ 2 | /dist/ 3 | /target/ -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | cpsolver_v1 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.wst.common.project.facet.core.builder 10 | 11 | 12 | 13 | 14 | org.eclipse.jdt.core.javabuilder 15 | 16 | 17 | 18 | 19 | com.genuitec.eclipse.ast.deploy.core.DeploymentBuilder 20 | 21 | 22 | 23 | 24 | org.eclipse.wst.validation.validationbuilder 25 | 26 | 27 | 28 | 29 | 30 | org.eclipse.jem.workbench.JavaEMFNature 31 | org.eclipse.jdt.core.javanature 32 | org.eclipse.wst.common.project.facet.core.nature 33 | org.eclipse.wst.common.modulecore.ModuleCoreNature 34 | 35 | 36 | -------------------------------------------------------------------------------- /.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=UTF-8 3 | -------------------------------------------------------------------------------- /.settings/org.eclipse.jdt.ui.prefs: -------------------------------------------------------------------------------- 1 | #Tue May 18 15:48:05 CEST 2010 2 | eclipse.preferences.version=1 3 | formatter_profile=_CPSolver 4 | formatter_settings_version=11 5 | -------------------------------------------------------------------------------- /.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /build.number: -------------------------------------------------------------------------------- 1 | #Build Number for ANT. Do not edit! 2 | #Tue Mar 18 13:05:17 CET 2014 3 | build.number=1 4 | -------------------------------------------------------------------------------- /distribution.xml: -------------------------------------------------------------------------------- 1 | 22 | 26 | dist 27 | 28 | zip 29 | 30 | 31 | 32 | ${project.basedir} 33 | 34 | LICENSE 35 | 36 | true 37 | 38 | 49 | 50 | ${project.build.directory} 51 | / 52 | 53 | *.jar 54 | 55 | 56 | 57 | 58 | 59 | /lib 60 | false 61 | false 62 | runtime 63 | 64 | 65 | -------------------------------------------------------------------------------- /lib/dom4j-2.1.4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UniTime/cpsolver/9212829c689ce4a7716b9233efb455af4b091eb4/lib/dom4j-2.1.4.jar -------------------------------------------------------------------------------- /lib/log4j-api-2.20.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UniTime/cpsolver/9212829c689ce4a7716b9233efb455af4b091eb4/lib/log4j-api-2.20.0.jar -------------------------------------------------------------------------------- /lib/log4j-core-2.20.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UniTime/cpsolver/9212829c689ce4a7716b9233efb455af4b091eb4/lib/log4j-core-2.20.0.jar -------------------------------------------------------------------------------- /src/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/org/cpsolver/coursett/TimetableLoader.java: -------------------------------------------------------------------------------- 1 | package org.cpsolver.coursett; 2 | 3 | import org.cpsolver.coursett.model.Lecture; 4 | import org.cpsolver.coursett.model.Placement; 5 | import org.cpsolver.coursett.model.TimetableModel; 6 | import org.cpsolver.ifs.assignment.Assignment; 7 | import org.cpsolver.ifs.util.ProblemLoader; 8 | 9 | 10 | /** 11 | * Abstract timetable loader class. 12 | * 13 | * @author Tomas Muller 14 | * @version CourseTT 1.3 (University Course Timetabling)
15 | * Copyright (C) 2006 - 2014 Tomas Muller
16 | * muller@unitime.org
17 | * http://muller.unitime.org
18 | *
19 | * This library is free software; you can redistribute it and/or modify 20 | * it under the terms of the GNU Lesser General Public License as 21 | * published by the Free Software Foundation; either version 3 of the 22 | * License, or (at your option) any later version.
23 | *
24 | * This library is distributed in the hope that it will be useful, but 25 | * WITHOUT ANY WARRANTY; without even the implied warranty of 26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 27 | * Lesser General Public License for more details.
28 | *
29 | * You should have received a copy of the GNU Lesser General Public 30 | * License along with this library; if not see 31 | * http://www.gnu.org/licenses/. 32 | */ 33 | 34 | public abstract class TimetableLoader extends ProblemLoader { 35 | 36 | /** 37 | * Constructor 38 | * 39 | * @param model 40 | * an empty instance of timetable model 41 | * @param assignment current assignment 42 | */ 43 | public TimetableLoader(TimetableModel model, Assignment assignment) { 44 | super(model, assignment); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/org/cpsolver/coursett/TimetableSaver.java: -------------------------------------------------------------------------------- 1 | package org.cpsolver.coursett; 2 | 3 | import org.cpsolver.coursett.model.Lecture; 4 | import org.cpsolver.coursett.model.Placement; 5 | import org.cpsolver.coursett.model.TimetableModel; 6 | import org.cpsolver.ifs.solver.Solver; 7 | import org.cpsolver.ifs.util.ProblemSaver; 8 | 9 | 10 | /** 11 | * Abstract timetable saver class. 12 | * 13 | * @author Tomas Muller 14 | * @version CourseTT 1.3 (University Course Timetabling)
15 | * Copyright (C) 2006 - 2014 Tomas Muller
16 | * muller@unitime.org
17 | * http://muller.unitime.org
18 | *
19 | * This library is free software; you can redistribute it and/or modify 20 | * it under the terms of the GNU Lesser General Public License as 21 | * published by the Free Software Foundation; either version 3 of the 22 | * License, or (at your option) any later version.
23 | *
24 | * This library is distributed in the hope that it will be useful, but 25 | * WITHOUT ANY WARRANTY; without even the implied warranty of 26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 27 | * Lesser General Public License for more details.
28 | *
29 | * You should have received a copy of the GNU Lesser General Public 30 | * License along with this library; if not see 31 | * http://www.gnu.org/licenses/. 32 | */ 33 | 34 | public abstract class TimetableSaver extends ProblemSaver { 35 | 36 | /** 37 | * Constructor 38 | * @param solver current solver 39 | */ 40 | public TimetableSaver(Solver solver) { 41 | super(solver); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/org/cpsolver/coursett/criteria/StudentHardConflict.java: -------------------------------------------------------------------------------- 1 | package org.cpsolver.coursett.criteria; 2 | 3 | import org.cpsolver.coursett.model.Lecture; 4 | import org.cpsolver.ifs.util.DataProperties; 5 | 6 | /** 7 | * Student hard conflicts. This criterion counts student conflicts (either overlapping or 8 | * distance) between classes. A hard conflict is a student conflict that happens between 9 | * two classes that do not have alternatives (see {@link Lecture#isSingleSection()}). 10 | *
11 | * 12 | * @author Tomas Muller 13 | * @version CourseTT 1.3 (University Course Timetabling)
14 | * Copyright (C) 2006 - 2014 Tomas Muller
15 | * muller@unitime.org
16 | * http://muller.unitime.org
17 | *
18 | * This library is free software; you can redistribute it and/or modify 19 | * it under the terms of the GNU Lesser General Public License as 20 | * published by the Free Software Foundation; either version 3 of the 21 | * License, or (at your option) any later version.
22 | *
23 | * This library is distributed in the hope that it will be useful, but 24 | * WITHOUT ANY WARRANTY; without even the implied warranty of 25 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 26 | * Lesser General Public License for more details.
27 | *
28 | * You should have received a copy of the GNU Lesser General Public 29 | * License along with this library; if not see 30 | * http://www.gnu.org/licenses/. 31 | */ 32 | public class StudentHardConflict extends StudentConflict { 33 | 34 | @Override 35 | public boolean isApplicable(Lecture l1, Lecture l2) { 36 | return l1 != null && l2 != null && !ignore(l1, l2) && hard(l1, l2); // only hard student conflicts, but including committed 37 | } 38 | 39 | @Override 40 | public double getWeightDefault(DataProperties config) { 41 | return config.getPropertyDouble("Comparator.HardStudentConflictWeight", 5.0); 42 | } 43 | 44 | @Override 45 | public String getPlacementSelectionWeightName() { 46 | return "Placement.NrHardStudConfsWeight"; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/org/cpsolver/coursett/criteria/StudentOverlapConflict.java: -------------------------------------------------------------------------------- 1 | package org.cpsolver.coursett.criteria; 2 | 3 | import org.cpsolver.coursett.model.Lecture; 4 | import org.cpsolver.coursett.model.Placement; 5 | import org.cpsolver.coursett.model.TimeLocation; 6 | import org.cpsolver.ifs.util.DataProperties; 7 | 8 | /** 9 | * Student overlapping conflicts. This criterion counts student overlapping conflicts between classes. 10 | * An overlapping conflict occurs when two classes that are attended by the same student (or students) 11 | * are overlapping in time (i.e., {@link TimeLocation#hasIntersection(TimeLocation)} is true). 12 | *
13 | * 14 | * @author Tomas Muller 15 | * @version CourseTT 1.3 (University Course Timetabling)
16 | * Copyright (C) 2006 - 2014 Tomas Muller
17 | * muller@unitime.org
18 | * http://muller.unitime.org
19 | *
20 | * This library is free software; you can redistribute it and/or modify 21 | * it under the terms of the GNU Lesser General Public License as 22 | * published by the Free Software Foundation; either version 3 of the 23 | * License, or (at your option) any later version.
24 | *
25 | * This library is distributed in the hope that it will be useful, but 26 | * WITHOUT ANY WARRANTY; without even the implied warranty of 27 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 28 | * Lesser General Public License for more details.
29 | *
30 | * You should have received a copy of the GNU Lesser General Public 31 | * License along with this library; if not see 32 | * http://www.gnu.org/licenses/. 33 | */ 34 | public class StudentOverlapConflict extends StudentConflict { 35 | 36 | @Override 37 | public boolean inConflict(Placement p1, Placement p2) { 38 | return overlaps(p1, p2); 39 | } 40 | 41 | @Override 42 | public boolean isApplicable(Lecture l1, Lecture l2) { 43 | return l1 != null && l2 != null && !ignore(l1, l2) && applicable(l1, l2); // all student conflicts (including committed) 44 | } 45 | 46 | @Override 47 | public double getWeightDefault(DataProperties config) { 48 | return config.getPropertyDouble("Comparator.StudentConflictWeight", 1.0); 49 | } 50 | 51 | @Override 52 | public String getPlacementSelectionWeightName() { 53 | return "Placement.NrStudConfsWeight"; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/org/cpsolver/coursett/criteria/TimeViolations.java: -------------------------------------------------------------------------------- 1 | package org.cpsolver.coursett.criteria; 2 | 3 | 4 | import org.cpsolver.coursett.Constants; 5 | import org.cpsolver.coursett.model.Placement; 6 | 7 | /** 8 | * Time violations. This criterion counts how many times a prohibited time is assigned 9 | * to a class in interactive timetabling. 10 | *
11 | * 12 | * @author Tomas Muller 13 | * @version CourseTT 1.3 (University Course Timetabling)
14 | * Copyright (C) 2006 - 2014 Tomas Muller
15 | * muller@unitime.org
16 | * http://muller.unitime.org
17 | *
18 | * This library is free software; you can redistribute it and/or modify 19 | * it under the terms of the GNU Lesser General Public License as 20 | * published by the Free Software Foundation; either version 3 of the 21 | * License, or (at your option) any later version.
22 | *
23 | * This library is distributed in the hope that it will be useful, but 24 | * WITHOUT ANY WARRANTY; without even the implied warranty of 25 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 26 | * Lesser General Public License for more details.
27 | *
28 | * You should have received a copy of the GNU Lesser General Public 29 | * License along with this library; if not see 30 | * http://www.gnu.org/licenses/. 31 | */ 32 | public class TimeViolations extends RoomViolations { 33 | 34 | @Override 35 | protected boolean violation(Placement value) { 36 | int pref = value.getTimeLocation().getPreference(); 37 | return pref > Constants.sPreferenceLevelProhibited / 2; 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/org/cpsolver/coursett/criteria/additional/QuadraticStudentHardConflict.java: -------------------------------------------------------------------------------- 1 | package org.cpsolver.coursett.criteria.additional; 2 | 3 | 4 | import org.cpsolver.coursett.criteria.StudentHardConflict; 5 | import org.cpsolver.coursett.model.Lecture; 6 | import org.cpsolver.ifs.util.DataProperties; 7 | 8 | /** 9 | * Quadratic student conflicts. Same as {@link StudentHardConflict}, however, 10 | * student joint enrollments are squared (1 conflict counts as 1, 2 as 4, 3 as 9, etc.). 11 | * 12 | *
13 | * 14 | * @author Tomas Muller 15 | * @version CourseTT 1.3 (University Course Timetabling)
16 | * Copyright (C) 2006 - 2014 Tomas Muller
17 | * muller@unitime.org
18 | * http://muller.unitime.org
19 | *
20 | * This library is free software; you can redistribute it and/or modify 21 | * it under the terms of the GNU Lesser General Public License as 22 | * published by the Free Software Foundation; either version 3 of the 23 | * License, or (at your option) any later version.
24 | *
25 | * This library is distributed in the hope that it will be useful, but 26 | * WITHOUT ANY WARRANTY; without even the implied warranty of 27 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 28 | * Lesser General Public License for more details.
29 | *
30 | * You should have received a copy of the GNU Lesser General Public 31 | * License along with this library; if not see 32 | * http://www.gnu.org/licenses/. 33 | */ 34 | public class QuadraticStudentHardConflict extends QuadraticStudentConflict { 35 | 36 | @Override 37 | public boolean isApplicable(Lecture l1, Lecture l2) { 38 | return l1 != null && l2 != null && !ignore(l1, l2) && hard(l1, l2); 39 | } 40 | 41 | @Override 42 | public double getWeightDefault(DataProperties config) { 43 | return config.getPropertyDouble("Comparator.HardStudentConflictWeight", 5.0); 44 | } 45 | 46 | @Override 47 | public String getPlacementSelectionWeightName() { 48 | return "Placement.NrHardStudConfsWeight"; 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/org/cpsolver/coursett/criteria/additional/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * University Course Timetabling: Additional (Experimental) Criteria. 3 | *
4 | *
5 | * This packages contains additional (experimental) criteria that may be included in the objective function 6 | * in the university course timetabling problem. 7 | * 8 | * @author Tomas Muller 9 | * @version IFS 1.4 (Instructor Sectioning)
10 | * Copyright (C) 2024 Tomas Muller
11 | * muller@unitime.org
12 | * http://muller.unitime.org
13 | *
14 | * This library is free software; you can redistribute it and/or modify 15 | * it under the terms of the GNU Lesser General Public License as 16 | * published by the Free Software Foundation; either version 3 of the 17 | * License, or (at your option) any later version.
18 | *
19 | * This library is distributed in the hope that it will be useful, but 20 | * WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 22 | * Lesser General Public License for more details.
23 | *
24 | * You should have received a copy of the GNU Lesser General Public 25 | * License along with this library; if not see 26 | * http://www.gnu.org/licenses/. 27 | */ 28 | package org.cpsolver.coursett.criteria.additional; -------------------------------------------------------------------------------- /src/org/cpsolver/coursett/criteria/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * University Course Timetabling: Criteria. 3 | *
4 | *
5 | * This packages contains all criteria that are forming the objective function 6 | * in the university course timetabling problem. 7 | * 8 | * @author Tomas Muller 9 | * @version IFS 1.4 (Instructor Sectioning)
10 | * Copyright (C) 2024 Tomas Muller
11 | * muller@unitime.org
12 | * http://muller.unitime.org
13 | *
14 | * This library is free software; you can redistribute it and/or modify 15 | * it under the terms of the GNU Lesser General Public License as 16 | * published by the Free Software Foundation; either version 3 of the 17 | * License, or (at your option) any later version.
18 | *
19 | * This library is distributed in the hope that it will be useful, but 20 | * WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 22 | * Lesser General Public License for more details.
23 | *
24 | * You should have received a copy of the GNU Lesser General Public 25 | * License along with this library; if not see 26 | * http://www.gnu.org/licenses/. 27 | */ 28 | package org.cpsolver.coursett.criteria; -------------------------------------------------------------------------------- /src/org/cpsolver/coursett/criteria/placement/HardConflicts.java: -------------------------------------------------------------------------------- 1 | package org.cpsolver.coursett.criteria.placement; 2 | 3 | import java.util.Set; 4 | 5 | import org.cpsolver.coursett.model.Lecture; 6 | import org.cpsolver.coursett.model.Placement; 7 | import org.cpsolver.ifs.assignment.Assignment; 8 | 9 | 10 | /** 11 | * Number of values (of other variables) that have to be unassigned in order before 12 | * this value can be assigned. 13 | *
14 | * 15 | * @author Tomas Muller 16 | * @version CourseTT 1.3 (University Course Timetabling)
17 | * Copyright (C) 2006 - 2014 Tomas Muller
18 | * muller@unitime.org
19 | * http://muller.unitime.org
20 | *
21 | * This library is free software; you can redistribute it and/or modify 22 | * it under the terms of the GNU Lesser General Public License as 23 | * published by the Free Software Foundation; either version 3 of the 24 | * License, or (at your option) any later version.
25 | *
26 | * This library is distributed in the hope that it will be useful, but 27 | * WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details.
30 | *
31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library; if not see 33 | * http://www.gnu.org/licenses/. 34 | */ 35 | public class HardConflicts extends PlacementSelectionCriterion { 36 | 37 | @Override 38 | public String getPlacementSelectionWeightName() { 39 | return "Placement.NrConflictsWeight"; 40 | } 41 | 42 | @Override 43 | public double getValue(Assignment assignment, Placement value, Set conflicts) { 44 | return (conflicts == null ? 0 : conflicts.size()); 45 | } 46 | 47 | @Override 48 | public double getPlacementSelectionWeightDefault(int level) { 49 | return (level == 0 ? 3.0 : 0.0); 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/org/cpsolver/coursett/criteria/placement/PotentialHardConflicts.java: -------------------------------------------------------------------------------- 1 | package org.cpsolver.coursett.criteria.placement; 2 | 3 | import java.util.Set; 4 | 5 | import org.cpsolver.coursett.model.Lecture; 6 | import org.cpsolver.coursett.model.Placement; 7 | import org.cpsolver.ifs.assignment.Assignment; 8 | 9 | 10 | /** 11 | * Use conflict-based statistics to compute potential hard conflicts. 12 | *
13 | * 14 | * @author Tomas Muller 15 | * @version CourseTT 1.3 (University Course Timetabling)
16 | * Copyright (C) 2006 - 2014 Tomas Muller
17 | * muller@unitime.org
18 | * http://muller.unitime.org
19 | *
20 | * This library is free software; you can redistribute it and/or modify 21 | * it under the terms of the GNU Lesser General Public License as 22 | * published by the Free Software Foundation; either version 3 of the 23 | * License, or (at your option) any later version.
24 | *
25 | * This library is distributed in the hope that it will be useful, but 26 | * WITHOUT ANY WARRANTY; without even the implied warranty of 27 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 28 | * Lesser General Public License for more details.
29 | *
30 | * You should have received a copy of the GNU Lesser General Public 31 | * License along with this library; if not see 32 | * http://www.gnu.org/licenses/. 33 | */ 34 | public class PotentialHardConflicts extends WeightedHardConflicts { 35 | 36 | @Override 37 | public String getPlacementSelectionWeightName() { 38 | return "Placement.NrPotentialConflictsWeight"; 39 | } 40 | 41 | @Override 42 | public double getValue(Assignment assignment, Placement value, Set conflicts) { 43 | if (iStat != null && conflicts != null && !conflicts.isEmpty()) { 44 | return iStat.countPotentialConflicts(assignment, ((IterationContext)getContext(assignment)).getIteration(), value, 3); 45 | } else { 46 | return 0.0; 47 | } 48 | } 49 | 50 | @Override 51 | public double getPlacementSelectionWeightDefault(int level) { 52 | return 0.0; 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/org/cpsolver/coursett/criteria/placement/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * University Course Timetabling: Placement Selection Criteria. 3 | *
4 | *
5 | * This packages contains criteria that are only used in the placement selection 6 | * heuristics. These are criteria that ha no impact on the overall solution value. 7 | * Such criterion is for instance the number of hard conflict (values that have to 8 | * be unassigned before a selected value can be assigned for the problem to remain 9 | * consistent). 10 | * 11 | * @author Tomas Muller 12 | * @version IFS 1.4 (Instructor Sectioning)
13 | * Copyright (C) 2024 Tomas Muller
14 | * muller@unitime.org
15 | * http://muller.unitime.org
16 | *
17 | * This library is free software; you can redistribute it and/or modify 18 | * it under the terms of the GNU Lesser General Public License as 19 | * published by the Free Software Foundation; either version 3 of the 20 | * License, or (at your option) any later version.
21 | *
22 | * This library is distributed in the hope that it will be useful, but 23 | * WITHOUT ANY WARRANTY; without even the implied warranty of 24 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 25 | * Lesser General Public License for more details.
26 | *
27 | * You should have received a copy of the GNU Lesser General Public 28 | * License along with this library; if not see 29 | * http://www.gnu.org/licenses/. 30 | */ 31 | package org.cpsolver.coursett.criteria.placement; -------------------------------------------------------------------------------- /src/org/cpsolver/coursett/custom/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * University Course Timetabling: Various customizations. 3 | * 4 | * @author Tomas Muller 5 | * @version IFS 1.4 (Instructor Sectioning)
6 | * Copyright (C) 2024 Tomas Muller
7 | * muller@unitime.org
8 | * http://muller.unitime.org
9 | *
10 | * This library is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU Lesser General Public License as 12 | * published by the Free Software Foundation; either version 3 of the 13 | * License, or (at your option) any later version.
14 | *
15 | * This library is distributed in the hope that it will be useful, but 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | * Lesser General Public License for more details.
19 | *
20 | * You should have received a copy of the GNU Lesser General Public 21 | * License along with this library; if not see 22 | * http://www.gnu.org/licenses/. 23 | */ 24 | package org.cpsolver.coursett.custom; -------------------------------------------------------------------------------- /src/org/cpsolver/coursett/neighbourhoods/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * University Course Timetabling: Various Neighbourhoods. 3 | * 4 | * @author Tomas Muller 5 | * @version IFS 1.4 (Instructor Sectioning)
6 | * Copyright (C) 2024 Tomas Muller
7 | * muller@unitime.org
8 | * http://muller.unitime.org
9 | *
10 | * This library is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU Lesser General Public License as 12 | * published by the Free Software Foundation; either version 3 of the 13 | * License, or (at your option) any later version.
14 | *
15 | * This library is distributed in the hope that it will be useful, but 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | * Lesser General Public License for more details.
19 | *
20 | * You should have received a copy of the GNU Lesser General Public 21 | * License along with this library; if not see 22 | * http://www.gnu.org/licenses/. 23 | */ 24 | package org.cpsolver.coursett.neighbourhoods; -------------------------------------------------------------------------------- /src/org/cpsolver/coursett/preference/AveragePreferenceCombination.java: -------------------------------------------------------------------------------- 1 | package org.cpsolver.coursett.preference; 2 | 3 | /** 4 | * Average preference combination.
5 | *
    6 | *
  • If at least one preference is required → required 7 | *
  • If at least one preference is prohibited → prohibited 8 | *
  • Otherwise, mean value from the given preferences is returned 9 | *
10 | * 11 | * @author Tomas Muller 12 | * @version CourseTT 1.3 (University Course Timetabling)
13 | * Copyright (C) 2006 - 2014 Tomas Muller
14 | * muller@unitime.org
15 | * http://muller.unitime.org
16 | *
17 | * This library is free software; you can redistribute it and/or modify 18 | * it under the terms of the GNU Lesser General Public License as 19 | * published by the Free Software Foundation; either version 3 of the 20 | * License, or (at your option) any later version.
21 | *
22 | * This library is distributed in the hope that it will be useful, but 23 | * WITHOUT ANY WARRANTY; without even the implied warranty of 24 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 25 | * Lesser General Public License for more details.
26 | *
27 | * You should have received a copy of the GNU Lesser General Public 28 | * License along with this library; if not see 29 | * http://www.gnu.org/licenses/. 30 | */ 31 | public class AveragePreferenceCombination extends PreferenceCombination { 32 | int iPreference = 0; 33 | int iCnt = 0; 34 | 35 | public AveragePreferenceCombination() {} 36 | 37 | public AveragePreferenceCombination(AveragePreferenceCombination c) { 38 | super(c); 39 | iPreference = c.iPreference; 40 | iCnt = c.iCnt; 41 | } 42 | 43 | @Override 44 | public void addPreferenceInt(int intPref) { 45 | super.addPreferenceInt(intPref); 46 | iPreference += intPref; 47 | iCnt++; 48 | } 49 | 50 | @Override 51 | public int getPreferenceInt() { 52 | return Math.round(((float) iPreference) / ((float) iCnt)); 53 | } 54 | 55 | @Override 56 | public PreferenceCombination clonePreferenceCombination() { return new AveragePreferenceCombination(this); } 57 | } 58 | -------------------------------------------------------------------------------- /src/org/cpsolver/coursett/preference/SumPreferenceCombination.java: -------------------------------------------------------------------------------- 1 | package org.cpsolver.coursett.preference; 2 | 3 | /** 4 | * Sum preference combination.
5 | *
    6 | *
  • If at least one preference is required → required 7 | *
  • If at least one preference is prohibited → prohibited 8 | *
  • Otherwise, sum of the given preferences is returned 9 | *
10 | * 11 | * @author Tomas Muller 12 | * @version CourseTT 1.3 (University Course Timetabling)
13 | * Copyright (C) 2006 - 2014 Tomas Muller
14 | * muller@unitime.org
15 | * http://muller.unitime.org
16 | *
17 | * This library is free software; you can redistribute it and/or modify 18 | * it under the terms of the GNU Lesser General Public License as 19 | * published by the Free Software Foundation; either version 3 of the 20 | * License, or (at your option) any later version.
21 | *
22 | * This library is distributed in the hope that it will be useful, but 23 | * WITHOUT ANY WARRANTY; without even the implied warranty of 24 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 25 | * Lesser General Public License for more details.
26 | *
27 | * You should have received a copy of the GNU Lesser General Public 28 | * License along with this library; if not see 29 | * http://www.gnu.org/licenses/. 30 | */ 31 | public class SumPreferenceCombination extends PreferenceCombination { 32 | int iPreference = 0; 33 | 34 | public SumPreferenceCombination() {} 35 | 36 | public SumPreferenceCombination(SumPreferenceCombination c) { 37 | super(c); 38 | iPreference = c.iPreference; 39 | } 40 | 41 | @Override 42 | public void addPreferenceInt(int intPref) { 43 | super.addPreferenceInt(intPref); 44 | iPreference += intPref; 45 | } 46 | 47 | @Override 48 | public int getPreferenceInt() { 49 | return iPreference; 50 | } 51 | 52 | @Override 53 | public SumPreferenceCombination clonePreferenceCombination() { return new SumPreferenceCombination(this); } 54 | } 55 | -------------------------------------------------------------------------------- /src/org/cpsolver/coursett/preference/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Various Preference Combinations. 3 | * 4 | * @author Tomas Muller 5 | * @version IFS 1.4 (Instructor Sectioning)
6 | * Copyright (C) 2024 Tomas Muller
7 | * muller@unitime.org
8 | * http://muller.unitime.org
9 | *
10 | * This library is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU Lesser General Public License as 12 | * published by the Free Software Foundation; either version 3 of the 13 | * License, or (at your option) any later version.
14 | *
15 | * This library is distributed in the hope that it will be useful, but 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | * Lesser General Public License for more details.
19 | *
20 | * You should have received a copy of the GNU Lesser General Public 21 | * License along with this library; if not see 22 | * http://www.gnu.org/licenses/. 23 | */ 24 | package org.cpsolver.coursett.preference; -------------------------------------------------------------------------------- /src/org/cpsolver/coursett/sectioning/StudentMove.java: -------------------------------------------------------------------------------- 1 | package org.cpsolver.coursett.sectioning; 2 | 3 | import java.util.List; 4 | 5 | import org.cpsolver.coursett.criteria.StudentConflict; 6 | import org.cpsolver.coursett.model.Lecture; 7 | import org.cpsolver.coursett.model.Placement; 8 | import org.cpsolver.ifs.assignment.Assignment; 9 | import org.cpsolver.ifs.model.Neighbour; 10 | 11 | /** 12 | * A simple interface representing a student enrollment change. 13 | * 14 | * @author Tomas Muller 15 | * @version CourseTT 1.3 (University Course Timetabling)
16 | * Copyright (C) 2017 Tomas Muller
17 | * muller@unitime.org
18 | * http://muller.unitime.org
19 | *
20 | * This library is free software; you can redistribute it and/or modify 21 | * it under the terms of the GNU Lesser General Public License as 22 | * published by the Free Software Foundation; either version 3 of the 23 | * License, or (at your option) any later version.
24 | *
25 | * This library is distributed in the hope that it will be useful, but 26 | * WITHOUT ANY WARRANTY; without even the implied warranty of 27 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 28 | * Lesser General Public License for more details.
29 | *
30 | * You should have received a copy of the GNU Lesser General Public 31 | * License along with this library; if not see 32 | * http://www.gnu.org/licenses/. 33 | */ 34 | public interface StudentMove extends Neighbour { 35 | public static double sEps = 0.0001; 36 | 37 | /** 38 | * Is the change valid / allowed? 39 | */ 40 | public boolean isAllowed(); 41 | 42 | /** 43 | * Student conflict weight change 44 | */ 45 | public double value(List criteria, Assignment assignment); 46 | 47 | /** 48 | * Student group weight change 49 | */ 50 | public double group(List criteria, Assignment assignment); 51 | } 52 | -------------------------------------------------------------------------------- /src/org/cpsolver/coursett/sectioning/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Additional Student Sectioning Algorithms. 3 | * 4 | * @author Tomas Muller 5 | * @version IFS 1.4 (Instructor Sectioning)
6 | * Copyright (C) 2024 Tomas Muller
7 | * muller@unitime.org
8 | * http://muller.unitime.org
9 | *
10 | * This library is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU Lesser General Public License as 12 | * published by the Free Software Foundation; either version 3 of the 13 | * License, or (at your option) any later version.
14 | *
15 | * This library is distributed in the hope that it will be useful, but 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | * Lesser General Public License for more details.
19 | *
20 | * You should have received a copy of the GNU Lesser General Public 21 | * License along with this library; if not see 22 | * http://www.gnu.org/licenses/. 23 | */ 24 | package org.cpsolver.coursett.sectioning; -------------------------------------------------------------------------------- /src/org/cpsolver/exam/criteria/additional/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Examination Timetabling: Additional (Experimental) Criteria. 3 | *
4 | *
5 | * This packages contains additional (experimental) criteria that may be included in the objective function 6 | * in the examination timetabling problem. 7 | * 8 | * @author Tomas Muller 9 | * @version IFS 1.4 (Instructor Sectioning)
10 | * Copyright (C) 2024 Tomas Muller
11 | * muller@unitime.org
12 | * http://muller.unitime.org
13 | *
14 | * This library is free software; you can redistribute it and/or modify 15 | * it under the terms of the GNU Lesser General Public License as 16 | * published by the Free Software Foundation; either version 3 of the 17 | * License, or (at your option) any later version.
18 | *
19 | * This library is distributed in the hope that it will be useful, but 20 | * WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 22 | * Lesser General Public License for more details.
23 | *
24 | * You should have received a copy of the GNU Lesser General Public 25 | * License along with this library; if not see 26 | * http://www.gnu.org/licenses/. 27 | */ 28 | package org.cpsolver.exam.criteria.additional; -------------------------------------------------------------------------------- /src/org/cpsolver/exam/criteria/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Examination Timetabling: Criteria. 3 | *
4 | *
5 | * This packages contains all criteria that are forming the objective function 6 | * in the examination timetabling problem. 7 | * 8 | * @author Tomas Muller 9 | * @version IFS 1.4 (Instructor Sectioning)
10 | * Copyright (C) 2024 Tomas Muller
11 | * muller@unitime.org
12 | * http://muller.unitime.org
13 | *
14 | * This library is free software; you can redistribute it and/or modify 15 | * it under the terms of the GNU Lesser General Public License as 16 | * published by the Free Software Foundation; either version 3 of the 17 | * License, or (at your option) any later version.
18 | *
19 | * This library is distributed in the hope that it will be useful, but 20 | * WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 22 | * Lesser General Public License for more details.
23 | *
24 | * You should have received a copy of the GNU Lesser General Public 25 | * License along with this library; if not see 26 | * http://www.gnu.org/licenses/. 27 | */ 28 | package org.cpsolver.exam.criteria; -------------------------------------------------------------------------------- /src/org/cpsolver/exam/heuristics/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Examination Timetabling: Solution Heuristics. 3 | * 4 | * @author Tomas Muller 5 | * @version IFS 1.4 (Instructor Sectioning)
6 | * Copyright (C) 2024 Tomas Muller
7 | * muller@unitime.org
8 | * http://muller.unitime.org
9 | *
10 | * This library is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU Lesser General Public License as 12 | * published by the Free Software Foundation; either version 3 of the 13 | * License, or (at your option) any later version.
14 | *
15 | * This library is distributed in the hope that it will be useful, but 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | * Lesser General Public License for more details.
19 | *
20 | * You should have received a copy of the GNU Lesser General Public 21 | * License along with this library; if not see 22 | * http://www.gnu.org/licenses/. 23 | */ 24 | package org.cpsolver.exam.heuristics; -------------------------------------------------------------------------------- /src/org/cpsolver/exam/model/SimpleExamRoomSharing.java: -------------------------------------------------------------------------------- 1 | package org.cpsolver.exam.model; 2 | 3 | import org.cpsolver.ifs.model.Model; 4 | import org.cpsolver.ifs.util.DataProperties; 5 | 6 | /** 7 | * Simple room sharing model. Any two exams of the same length ({@link Exam#getLength()}) can be put into any room, if the room is big enough.

8 | * To enable this model, set property Exams.RoomSharingClass to org.cpsolver.exam.model.SimpleExamRoomSharing 9 | *
10 | * 11 | * @author Tomas Muller 12 | * @version ExamTT 1.3 (Examination Timetabling)
13 | * Copyright (C) 2008 - 2014 Tomas Muller
14 | * muller@unitime.org
15 | * http://muller.unitime.org
16 | *
17 | * This library is free software; you can redistribute it and/or modify 18 | * it under the terms of the GNU Lesser General Public License as 19 | * published by the Free Software Foundation; either version 3 of the 20 | * License, or (at your option) any later version.
21 | *
22 | * This library is distributed in the hope that it will be useful, but 23 | * WITHOUT ANY WARRANTY; without even the implied warranty of 24 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 25 | * Lesser General Public License for more details.
26 | *
27 | * You should have received a copy of the GNU Lesser General Public 28 | * License along with this library; if not see 29 | * http://www.gnu.org/licenses/. 30 | */ 31 | public class SimpleExamRoomSharing extends ExamRoomSharing { 32 | 33 | public SimpleExamRoomSharing(Model model, DataProperties config) { 34 | super(model, config); 35 | } 36 | 37 | @Override 38 | public boolean canShareRoom(Exam x1, Exam x2) { 39 | return x1.getLength() == x2.getLength(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/org/cpsolver/exam/model/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Examination Timetabling: Model. 3 | * 4 | * @author Tomas Muller 5 | * @version IFS 1.4 (Instructor Sectioning)
6 | * Copyright (C) 2024 Tomas Muller
7 | * muller@unitime.org
8 | * http://muller.unitime.org
9 | *
10 | * This library is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU Lesser General Public License as 12 | * published by the Free Software Foundation; either version 3 of the 13 | * License, or (at your option) any later version.
14 | *
15 | * This library is distributed in the hope that it will be useful, but 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | * Lesser General Public License for more details.
19 | *
20 | * You should have received a copy of the GNU Lesser General Public 21 | * License along with this library; if not see 22 | * http://www.gnu.org/licenses/. 23 | */ 24 | package org.cpsolver.exam.model; -------------------------------------------------------------------------------- /src/org/cpsolver/exam/neighbours/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Examination Timetabling: Various Neighbourhoods. 3 | * 4 | * @author Tomas Muller 5 | * @version IFS 1.4 (Instructor Sectioning)
6 | * Copyright (C) 2024 Tomas Muller
7 | * muller@unitime.org
8 | * http://muller.unitime.org
9 | *
10 | * This library is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU Lesser General Public License as 12 | * published by the Free Software Foundation; either version 3 of the 13 | * License, or (at your option) any later version.
14 | *
15 | * This library is distributed in the hope that it will be useful, but 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | * Lesser General Public License for more details.
19 | *
20 | * You should have received a copy of the GNU Lesser General Public 21 | * License along with this library; if not see 22 | * http://www.gnu.org/licenses/. 23 | */ 24 | package org.cpsolver.exam.neighbours; -------------------------------------------------------------------------------- /src/org/cpsolver/exam/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Examination Timetabling Solver. 3 | * 4 | * @author Tomas Muller 5 | * @version IFS 1.4 (Instructor Sectioning)
6 | * Copyright (C) 2024 Tomas Muller
7 | * muller@unitime.org
8 | * http://muller.unitime.org
9 | *
10 | * This library is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU Lesser General Public License as 12 | * published by the Free Software Foundation; either version 3 of the 13 | * License, or (at your option) any later version.
14 | *
15 | * This library is distributed in the hope that it will be useful, but 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | * Lesser General Public License for more details.
19 | *
20 | * You should have received a copy of the GNU Lesser General Public 21 | * License along with this library; if not see 22 | * http://www.gnu.org/licenses/. 23 | */ 24 | package org.cpsolver.exam; -------------------------------------------------------------------------------- /src/org/cpsolver/exam/reports/ExamRoomComparator.java: -------------------------------------------------------------------------------- 1 | package org.cpsolver.exam.reports; 2 | 3 | import java.util.Comparator; 4 | 5 | import org.cpsolver.exam.model.Exam; 6 | import org.cpsolver.exam.model.ExamRoomPlacement; 7 | 8 | 9 | /** 10 | * Compare two rooms by size. Either normal seating size or alternative sating 11 | * size is used, based on the given exam (see {@link Exam#hasAltSeating()}.
12 | *
13 | * 14 | * @author Tomas Muller 15 | * @version ExamTT 1.3 (Examination Timetabling)
16 | * Copyright (C) 2008 - 2014 Tomas Muller
17 | * muller@unitime.org
18 | * http://muller.unitime.org
19 | *
20 | * This library is free software; you can redistribute it and/or modify 21 | * it under the terms of the GNU Lesser General Public License as 22 | * published by the Free Software Foundation; either version 3 of the 23 | * License, or (at your option) any later version.
24 | *
25 | * This library is distributed in the hope that it will be useful, but 26 | * WITHOUT ANY WARRANTY; without even the implied warranty of 27 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 28 | * Lesser General Public License for more details.
29 | *
30 | * You should have received a copy of the GNU Lesser General Public 31 | * License along with this library; if not see 32 | * http://www.gnu.org/licenses/. 33 | */ 34 | public class ExamRoomComparator implements Comparator { 35 | private boolean iAsc; 36 | private Exam iExam; 37 | 38 | /** 39 | * Constructor 40 | * 41 | * @param exam 42 | * exam for which rooms are to be compared 43 | * @param asc room order 44 | */ 45 | public ExamRoomComparator(Exam exam, boolean asc) { 46 | iExam = exam; 47 | iAsc = asc; 48 | } 49 | 50 | /** 51 | * Compare two rooms based on their normal/alternative seating size 52 | */ 53 | @Override 54 | public int compare(ExamRoomPlacement r1, ExamRoomPlacement r2) { 55 | int cmp = (iAsc ? 1 : -1) 56 | * Double.compare(r1.getSize(iExam.hasAltSeating()), r2.getSize(iExam.hasAltSeating())); 57 | if (cmp != 0) 58 | return cmp; 59 | return r1.getRoom().compareTo(r2.getRoom()); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/org/cpsolver/exam/reports/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Examination Timetabling: Reports. 3 | * 4 | * @author Tomas Muller 5 | * @version IFS 1.4 (Instructor Sectioning)
6 | * Copyright (C) 2024 Tomas Muller
7 | * muller@unitime.org
8 | * http://muller.unitime.org
9 | *
10 | * This library is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU Lesser General Public License as 12 | * published by the Free Software Foundation; either version 3 of the 13 | * License, or (at your option) any later version.
14 | *
15 | * This library is distributed in the hope that it will be useful, but 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | * Lesser General Public License for more details.
19 | *
20 | * You should have received a copy of the GNU Lesser General Public 21 | * License along with this library; if not see 22 | * http://www.gnu.org/licenses/. 23 | */ 24 | package org.cpsolver.exam.reports; -------------------------------------------------------------------------------- /src/org/cpsolver/exam/split/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This package contains an an experimental criterion that allows an exam to be split into two if it decreases the number of student conflicts. 3 | *

4 | * An examination split is improving (and is considered) if the weighted number of student conflicts that will be removed by the split is bigger than the weight of the splitter criterion. 5 | *

6 | * To enable examination splitting, following parameters needs to be set: 7 | *
    8 | *
  • HillClimber.AdditionalNeighbours=org.cpsolver.exam.split.ExamSplitMoves 9 | *
  • GreatDeluge.AdditionalNeighbours=org.cpsolver.exam.split.ExamSplitMoves 10 | *
  • Exams.AdditionalCriteria=org.cpsolver.exam.split.ExamSplitter 11 | *
  • Exams.ExamSplitWeight=500 12 | *
13 | * The Exams.ExamSplitWeight represents the weight of a split. For instance, to allow only splits that decrease the number of student direct conflicts, 14 | * half of the weight of a direct student conflict is a good value for this weight. 15 | * 16 | * @author Tomas Muller 17 | * @version IFS 1.4 (Instructor Sectioning)
18 | * Copyright (C) 2024 Tomas Muller
19 | * muller@unitime.org
20 | * http://muller.unitime.org
21 | *
22 | * This library is free software; you can redistribute it and/or modify 23 | * it under the terms of the GNU Lesser General Public License as 24 | * published by the Free Software Foundation; either version 3 of the 25 | * License, or (at your option) any later version.
26 | *
27 | * This library is distributed in the hope that it will be useful, but 28 | * WITHOUT ANY WARRANTY; without even the implied warranty of 29 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 30 | * Lesser General Public License for more details.
31 | *
32 | * You should have received a copy of the GNU Lesser General Public 33 | * License along with this library; if not see 34 | * http://www.gnu.org/licenses/. 35 | */ 36 | package org.cpsolver.exam.split; -------------------------------------------------------------------------------- /src/org/cpsolver/ifs/Constants.java: -------------------------------------------------------------------------------- 1 | package org.cpsolver.ifs; 2 | 3 | import java.io.IOException; 4 | import java.io.InputStream; 5 | import java.util.Properties; 6 | 7 | /** 8 | * IFS common constants.
9 | *
10 | * Build number and release date are to be set by apache ant. 11 | * 12 | * @author Tomas Muller 13 | * @version IFS 1.3 (Iterative Forward Search)
14 | * Copyright (C) 2006 - 2014 Tomas Muller
15 | * muller@unitime.org
16 | * http://muller.unitime.org
17 | *
18 | * This library is free software; you can redistribute it and/or modify 19 | * it under the terms of the GNU Lesser General Public License as 20 | * published by the Free Software Foundation; either version 3 of the 21 | * License, or (at your option) any later version.
22 | *
23 | * This library is distributed in the hope that it will be useful, but 24 | * WITHOUT ANY WARRANTY; without even the implied warranty of 25 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 26 | * Lesser General Public License for more details.
27 | *
28 | * You should have received a copy of the GNU Lesser General Public 29 | * License along with this library; if not see 30 | * http://www.gnu.org/licenses/. 31 | */ 32 | public class Constants { 33 | private static Properties sProperties = null; 34 | 35 | private static Properties getProperties() { 36 | if (sProperties == null) { 37 | sProperties = new Properties(); 38 | InputStream in = Constants.class.getClassLoader().getResourceAsStream("cpsolver.version"); 39 | if (in != null) { 40 | try { 41 | sProperties.load(in); 42 | in.close(); 43 | } catch (IOException e) {} 44 | } 45 | } 46 | return sProperties; 47 | } 48 | 49 | /** 50 | * Version 51 | * @return current solver version 52 | */ 53 | public static String getVersion() { 54 | return getProperties().getProperty("project.version", "1.3"); 55 | } 56 | 57 | /** 58 | * Build number 59 | * @return current solver build number 60 | */ 61 | public static String getBuildNumber() { 62 | return getProperties().getProperty("cpsolver.build_nbr", "?"); 63 | } 64 | 65 | /** 66 | * Release date 67 | * @return current solver release date 68 | */ 69 | public static String getReleaseDate() { 70 | return getProperties().getProperty("cpsolver.rel_date", "?"); 71 | } 72 | } -------------------------------------------------------------------------------- /src/org/cpsolver/ifs/algorithms/neighbourhoods/HillClimberSelection.java: -------------------------------------------------------------------------------- 1 | package org.cpsolver.ifs.algorithms.neighbourhoods; 2 | 3 | import org.cpsolver.ifs.heuristics.NeighbourSelection; 4 | 5 | /** 6 | * This interface may be implemented by a {@link NeighbourSelection} to indicate that it is employed by a hill climber. 7 | *
8 | * 9 | * @author Tomas Muller 10 | * @version IFS 1.3 (Iterative Forward Search)
11 | * Copyright (C) 2014 Tomas Muller
12 | * muller@unitime.org
13 | * http://muller.unitime.org
14 | *
15 | * This library is free software; you can redistribute it and/or modify 16 | * it under the terms of the GNU Lesser General Public License as 17 | * published by the Free Software Foundation; either version 3 of the 18 | * License, or (at your option) any later version.
19 | *
20 | * This library is distributed in the hope that it will be useful, but 21 | * WITHOUT ANY WARRANTY; without even the implied warranty of 22 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 23 | * Lesser General Public License for more details.
24 | *
25 | * You should have received a copy of the GNU Lesser General Public 26 | * License along with this library; if not see 27 | * http://www.gnu.org/licenses/. 28 | **/ 29 | public interface HillClimberSelection { 30 | 31 | /** 32 | * True if employed by a hill climber, e.g., worsening moves may be skipped. 33 | * @param hcMode true if used by a hill climber (worsening moves are automatically discarded) 34 | */ 35 | public void setHcMode(boolean hcMode); 36 | } 37 | -------------------------------------------------------------------------------- /src/org/cpsolver/ifs/algorithms/neighbourhoods/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * IFS: Various Problem-Independent Neighbourhoods. 3 | * 4 | * @author Tomas Muller 5 | * @version IFS 1.4 (Instructor Sectioning)
6 | * Copyright (C) 2024 Tomas Muller
7 | * muller@unitime.org
8 | * http://muller.unitime.org
9 | *
10 | * This library is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU Lesser General Public License as 12 | * published by the Free Software Foundation; either version 3 of the 13 | * License, or (at your option) any later version.
14 | *
15 | * This library is distributed in the hope that it will be useful, but 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | * Lesser General Public License for more details.
19 | *
20 | * You should have received a copy of the GNU Lesser General Public 21 | * License along with this library; if not see 22 | * http://www.gnu.org/licenses/. 23 | */ 24 | package org.cpsolver.ifs.algorithms.neighbourhoods; -------------------------------------------------------------------------------- /src/org/cpsolver/ifs/algorithms/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * IFS Neighbourhood Search Algorithms 3 | * 4 | * @author Tomas Muller 5 | * @version IFS 1.4 (Instructor Sectioning)
6 | * Copyright (C) 2024 Tomas Muller
7 | * muller@unitime.org
8 | * http://muller.unitime.org
9 | *
10 | * This library is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU Lesser General Public License as 12 | * published by the Free Software Foundation; either version 3 of the 13 | * License, or (at your option) any later version.
14 | *
15 | * This library is distributed in the hope that it will be useful, but 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | * Lesser General Public License for more details.
19 | *
20 | * You should have received a copy of the GNU Lesser General Public 21 | * License along with this library; if not see 22 | * http://www.gnu.org/licenses/. 23 | */ 24 | package org.cpsolver.ifs.algorithms; -------------------------------------------------------------------------------- /src/org/cpsolver/ifs/assignment/AssignmentComparable.java: -------------------------------------------------------------------------------- 1 | package org.cpsolver.ifs.assignment; 2 | 3 | import org.cpsolver.ifs.model.Value; 4 | import org.cpsolver.ifs.model.Variable; 5 | 6 | /** 7 | * Comparable interface for assignment-dependent objects. To be used by 8 | * {@link AssignmentComparator}. 9 | * 10 | * 11 | * @author Tomas Muller 12 | * @version IFS 1.3 (Iterative Forward Search)
13 | * Copyright (C) 2014 Tomas Muller
14 | * muller@unitime.org
15 | * http://muller.unitime.org
16 | *
17 | * This library is free software; you can redistribute it and/or modify 18 | * it under the terms of the GNU Lesser General Public License as 19 | * published by the Free Software Foundation; either version 3 of the 20 | * License, or (at your option) any later version.
21 | *
22 | * This library is distributed in the hope that it will be useful, but 23 | * WITHOUT ANY WARRANTY; without even the implied warranty of 24 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 25 | * Lesser General Public License for more details.
26 | *
27 | * You should have received a copy of the GNU Lesser General Public 28 | * License along with this library; if not see http://www.gnu.org/licenses. 29 | * @param A class implementing this interface 30 | * @param Variable 31 | * @param Value 32 | **/ 33 | public interface AssignmentComparable, T extends Value> extends Comparable { 34 | 35 | /** 36 | * Compare this object with a given one. 37 | * @param assignment current assignment 38 | * @param other other instance 39 | * @return comparison of this instance and the given one 40 | */ 41 | public int compareTo(Assignment assignment, X other); 42 | 43 | @Deprecated 44 | @Override 45 | /** 46 | * Compare this object with a given one. 47 | * @param other other instance 48 | * @return comparison of this instance and the given one 49 | */ 50 | public int compareTo(X other); 51 | } 52 | -------------------------------------------------------------------------------- /src/org/cpsolver/ifs/assignment/AssignmentComparator.java: -------------------------------------------------------------------------------- 1 | package org.cpsolver.ifs.assignment; 2 | 3 | import java.util.Comparator; 4 | 5 | import org.cpsolver.ifs.model.Value; 6 | import org.cpsolver.ifs.model.Variable; 7 | 8 | 9 | /** 10 | * Comparator for the {@link AssignmentComparable} objects. 11 | * 12 | * 13 | * @author Tomas Muller 14 | * @version IFS 1.3 (Iterative Forward Search)
15 | * Copyright (C) 2014 Tomas Muller
16 | * muller@unitime.org
17 | * http://muller.unitime.org
18 | *
19 | * This library is free software; you can redistribute it and/or modify 20 | * it under the terms of the GNU Lesser General Public License as 21 | * published by the Free Software Foundation; either version 3 of the 22 | * License, or (at your option) any later version.
23 | *
24 | * This library is distributed in the hope that it will be useful, but 25 | * WITHOUT ANY WARRANTY; without even the implied warranty of 26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 27 | * Lesser General Public License for more details.
28 | *
29 | * You should have received a copy of the GNU Lesser General Public 30 | * License along with this library; if not see http://www.gnu.org/licenses. 31 | * @param A class implementing {@link AssignmentComparable} 32 | * @param Variable 33 | * @param Value 34 | **/ 35 | public class AssignmentComparator, V extends Variable, T extends Value> implements Comparator { 36 | protected Assignment iAssignment; 37 | 38 | /** 39 | * Create comparator with the given assignment. 40 | * @param assignment current assignment 41 | */ 42 | public AssignmentComparator(Assignment assignment) { 43 | iAssignment = assignment; 44 | } 45 | 46 | @Override 47 | public int compare(X o1, X o2) { 48 | return o1.compareTo(iAssignment, o2); 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/org/cpsolver/ifs/assignment/EmptyAssignment.java: -------------------------------------------------------------------------------- 1 | package org.cpsolver.ifs.assignment; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Collection; 5 | 6 | import org.cpsolver.ifs.assignment.context.AssignmentContextHolderMap; 7 | import org.cpsolver.ifs.model.Value; 8 | import org.cpsolver.ifs.model.Variable; 9 | 10 | 11 | /** 12 | * An empty assignment. All variables are unassigned, any attempt to assign a 13 | * variable will throw the {@link UnsupportedOperationException} exception.

14 | * 15 | * @author Tomas Muller 16 | * @version IFS 1.3 (Iterative Forward Search)
17 | * Copyright (C) 2014 Tomas Muller
18 | * muller@unitime.org
19 | * http://muller.unitime.org
20 | *
21 | * This library is free software; you can redistribute it and/or modify 22 | * it under the terms of the GNU Lesser General Public License as 23 | * published by the Free Software Foundation; either version 3 of the 24 | * License, or (at your option) any later version.
25 | *
26 | * This library is distributed in the hope that it will be useful, but 27 | * WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details.
30 | *
31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library; if not see http://www.gnu.org/licenses. 33 | * @param Variable 34 | * @param Value 35 | **/ 36 | public class EmptyAssignment, T extends Value> extends AssignmentAbstract { 37 | 38 | public EmptyAssignment() { 39 | super(new AssignmentContextHolderMap()); 40 | } 41 | 42 | @Override 43 | public long getIteration(V variable) { 44 | return 0; 45 | } 46 | 47 | @Override 48 | public Collection assignedVariables() { 49 | return new ArrayList(); 50 | } 51 | 52 | @Override 53 | protected T getValueInternal(V variable) { 54 | return null; 55 | } 56 | 57 | @Override 58 | protected void setValueInternal(long iteration, V variable, T value) { 59 | throw new UnsupportedOperationException(); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/org/cpsolver/ifs/assignment/InheritedAssignment.java: -------------------------------------------------------------------------------- 1 | package org.cpsolver.ifs.assignment; 2 | 3 | import org.cpsolver.ifs.model.Value; 4 | import org.cpsolver.ifs.model.Variable; 5 | 6 | /** 7 | * An assignment inherited from some other assignment with only a few local 8 | * modifications. This can be used to pass a "copy" of an assignment to a neighbor 9 | * selection. 10 | * 11 | * @see Assignment 12 | * 13 | * @author Tomas Muller 14 | * @version IFS 1.3 (Iterative Forward Search)
15 | * Copyright (C) 2014 Tomas Muller
16 | * muller@unitime.org
17 | * http://muller.unitime.org
18 | *
19 | * This library is free software; you can redistribute it and/or modify 20 | * it under the terms of the GNU Lesser General Public License as 21 | * published by the Free Software Foundation; either version 3 of the 22 | * License, or (at your option) any later version.
23 | *
24 | * This library is distributed in the hope that it will be useful, but 25 | * WITHOUT ANY WARRANTY; without even the implied warranty of 26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 27 | * Lesser General Public License for more details.
28 | *
29 | * You should have received a copy of the GNU Lesser General Public 30 | * License along with this library; if not see http://www.gnu.org/licenses. 31 | * @param Variable 32 | * @param Value 33 | **/ 34 | public interface InheritedAssignment, T extends Value> extends Assignment { 35 | 36 | /** 37 | * Return parent assignment. 38 | * @return parent assignment 39 | */ 40 | public Assignment getParentAssignment(); 41 | 42 | /** 43 | * Version of the assignment (usually the iteration of the parent assignment at the time of creation) 44 | * @return version of the inherited assignment 45 | */ 46 | public long getVersion(); 47 | } 48 | -------------------------------------------------------------------------------- /src/org/cpsolver/ifs/assignment/InheritedAssignmentArray.java: -------------------------------------------------------------------------------- 1 | package org.cpsolver.ifs.assignment; 2 | 3 | import java.util.Arrays; 4 | 5 | import org.cpsolver.ifs.assignment.context.InheritedAssignmentContextHolder; 6 | import org.cpsolver.ifs.model.Value; 7 | import org.cpsolver.ifs.model.Variable; 8 | import org.cpsolver.ifs.solution.Solution; 9 | 10 | public class InheritedAssignmentArray, T extends Value> extends AssignmentArray implements InheritedAssignment { 11 | private Assignment iParent; 12 | private long iVersion = -1; 13 | private int iIndex = -1; 14 | 15 | public InheritedAssignmentArray(Solution parent, int index) { 16 | super(new InheritedAssignmentContextHolder(index, parent.getIteration())); 17 | iIndex = index; 18 | iAssignments = Arrays.copyOf(((AssignmentArray)parent.getAssignment()).iAssignments, parent.getModel().variables().size()); 19 | iIteration = Arrays.copyOf(((AssignmentArray)parent.getAssignment()).iIteration, parent.getModel().variables().size()); 20 | } 21 | 22 | @Override 23 | public int getIndex() { 24 | return iIndex; 25 | } 26 | 27 | @Override 28 | public Assignment getParentAssignment() { 29 | return iParent; 30 | } 31 | 32 | @Override 33 | public long getVersion() { 34 | return iVersion; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/org/cpsolver/ifs/assignment/ValueComparator.java: -------------------------------------------------------------------------------- 1 | package org.cpsolver.ifs.assignment; 2 | 3 | import org.cpsolver.ifs.model.Value; 4 | import org.cpsolver.ifs.model.Variable; 5 | import org.cpsolver.ifs.solver.Solver; 6 | 7 | /** 8 | * A simple class comparing two values. Using {@link Value#compareTo(Assignment, Value)}. 9 | * This is to replace the {@link Comparable} interface on the {@link Value} which is 10 | * using the deprecated method {@link Value#compareTo(Value)}. 11 | * 12 | * @see Assignment 13 | * @see Solver 14 | * 15 | * @author Tomas Muller 16 | * @version IFS 1.3 (Iterative Forward Search)
17 | * Copyright (C) 2014 Tomas Muller
18 | * muller@unitime.org
19 | * http://muller.unitime.org
20 | *
21 | * This library is free software; you can redistribute it and/or modify 22 | * it under the terms of the GNU Lesser General Public License as 23 | * published by the Free Software Foundation; either version 3 of the 24 | * License, or (at your option) any later version.
25 | *
26 | * This library is distributed in the hope that it will be useful, but 27 | * WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details.
30 | *
31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library; if not see http://www.gnu.org/licenses. 33 | * @param Variable 34 | * @param Value 35 | **/ 36 | public class ValueComparator, T extends Value> extends AssignmentComparator { 37 | 38 | public ValueComparator(Assignment assignment) { 39 | super(assignment); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/org/cpsolver/ifs/assignment/context/CanHoldContext.java: -------------------------------------------------------------------------------- 1 | package org.cpsolver.ifs.assignment.context; 2 | 3 | import org.cpsolver.ifs.assignment.Assignment; 4 | 5 | /** 6 | * An additional interface that can be implemented by the {@link HasAssignmentContext} class. 7 | * The assignment context holder (see {@link AssignmentContextHolder}) can than use this interface 8 | * to store assignment contexts directly on the {@link HasAssignmentContext} class, if the 9 | * assignment permits it (the {@link Assignment#getIndex()} is implemented, i.e., a non negative 10 | * index is returned). 11 | * 12 | * @see HasAssignmentContext 13 | * 14 | * @author Tomas Muller 15 | * @version IFS 1.3 (Iterative Forward Search)
16 | * Copyright (C) 2014 Tomas Muller
17 | * muller@unitime.org
18 | * http://muller.unitime.org
19 | *
20 | * This library is free software; you can redistribute it and/or modify 21 | * it under the terms of the GNU Lesser General Public License as 22 | * published by the Free Software Foundation; either version 3 of the 23 | * License, or (at your option) any later version.
24 | *
25 | * This library is distributed in the hope that it will be useful, but 26 | * WITHOUT ANY WARRANTY; without even the implied warranty of 27 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 28 | * Lesser General Public License for more details.
29 | *
30 | * You should have received a copy of the GNU Lesser General Public 31 | * License along with this library; if not see http://www.gnu.org/licenses. 32 | **/ 33 | public interface CanHoldContext { 34 | /** 35 | * Maximum number of assignment contexts to be held 36 | */ 37 | public static int sMaxSize = 17; 38 | 39 | /** 40 | * An array of {@link CanHoldContext#sMaxSize} assignment contexts 41 | * @return assignment contexts 42 | */ 43 | public AssignmentContext[] getContext(); 44 | } 45 | -------------------------------------------------------------------------------- /src/org/cpsolver/ifs/assignment/context/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Assignment context can be used by a class (e.g., a constraint, a extension, a neighborhood selection, or a criterion) to 3 | * contain any assignment dependent data. 4 | * 5 | * Instead of holding the data directly, the class only holds a reference to the appropriate assignment context, 6 | * which is stored with the assignment and returned from the assignment using the reference. 7 | * 8 | * @author Tomas Muller 9 | * @version IFS 1.4 (Instructor Sectioning)
10 | * Copyright (C) 2024 Tomas Muller
11 | * muller@unitime.org
12 | * http://muller.unitime.org
13 | *
14 | * This library is free software; you can redistribute it and/or modify 15 | * it under the terms of the GNU Lesser General Public License as 16 | * published by the Free Software Foundation; either version 3 of the 17 | * License, or (at your option) any later version.
18 | *
19 | * This library is distributed in the hope that it will be useful, but 20 | * WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 22 | * Lesser General Public License for more details.
23 | *
24 | * You should have received a copy of the GNU Lesser General Public 25 | * License along with this library; if not see 26 | * http://www.gnu.org/licenses/. 27 | */ 28 | package org.cpsolver.ifs.assignment.context; -------------------------------------------------------------------------------- /src/org/cpsolver/ifs/assignment/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * An assignment holds current values of all the variables of a model. 3 | * 4 | * These classes decouple an assignment of variables to their values from the model. 5 | * This is needed for any kind of parallel computations, or in general, to be able to 6 | * hold multiple different assignments in memory. 7 | * 8 | * @author Tomas Muller 9 | * @version IFS 1.4 (Instructor Sectioning)
10 | * Copyright (C) 2024 Tomas Muller
11 | * muller@unitime.org
12 | * http://muller.unitime.org
13 | *
14 | * This library is free software; you can redistribute it and/or modify 15 | * it under the terms of the GNU Lesser General Public License as 16 | * published by the Free Software Foundation; either version 3 of the 17 | * License, or (at your option) any later version.
18 | *
19 | * This library is distributed in the hope that it will be useful, but 20 | * WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 22 | * Lesser General Public License for more details.
23 | *
24 | * You should have received a copy of the GNU Lesser General Public 25 | * License along with this library; if not see 26 | * http://www.gnu.org/licenses/. 27 | */ 28 | package org.cpsolver.ifs.assignment; -------------------------------------------------------------------------------- /src/org/cpsolver/ifs/constant/ConstantVariable.java: -------------------------------------------------------------------------------- 1 | package org.cpsolver.ifs.constant; 2 | 3 | import org.cpsolver.ifs.model.Value; 4 | 5 | /** 6 | * Extension of a variable with the possibility to have a constant value. 7 | * 8 | * Such variables are excluded from the solver process, however, they can be 9 | * included in constraints. 10 | * 11 | * @author Tomas Muller 12 | * @version IFS 1.3 (Iterative Forward Search)
13 | * Copyright (C) 2006 - 2014 Tomas Muller
14 | * muller@unitime.org
15 | * http://muller.unitime.org
16 | *
17 | * This library is free software; you can redistribute it and/or modify 18 | * it under the terms of the GNU Lesser General Public License as 19 | * published by the Free Software Foundation; either version 3 of the 20 | * License, or (at your option) any later version.
21 | *
22 | * This library is distributed in the hope that it will be useful, but 23 | * WITHOUT ANY WARRANTY; without even the implied warranty of 24 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 25 | * Lesser General Public License for more details.
26 | *
27 | * You should have received a copy of the GNU Lesser General Public 28 | * License along with this library; if not see http://www.gnu.org/licenses. 29 | * 30 | * @param Value 31 | */ 32 | public interface ConstantVariable> { 33 | /** True, if the variable is constant. 34 | * @return true if constant 35 | **/ 36 | public boolean isConstant(); 37 | 38 | /** Return assignment if constant 39 | * @return constant value (if {@link ConstantVariable#isConstant()} is true) 40 | **/ 41 | public T getConstantValue(); 42 | } 43 | -------------------------------------------------------------------------------- /src/org/cpsolver/ifs/constant/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Extension of the model with constant variables. 3 | * 4 | * Such variables are excluded from the solver process, however, they can 5 | * be included in constraints. Such model can allow us to build a 6 | * solution on top of another solution (e.g., committed classes in the 7 | * course timetabling). 8 | * 9 | * @author Tomas Muller 10 | * @version IFS 1.4 (Instructor Sectioning)
11 | * Copyright (C) 2024 Tomas Muller
12 | * muller@unitime.org
13 | * http://muller.unitime.org
14 | *
15 | * This library is free software; you can redistribute it and/or modify 16 | * it under the terms of the GNU Lesser General Public License as 17 | * published by the Free Software Foundation; either version 3 of the 18 | * License, or (at your option) any later version.
19 | *
20 | * This library is distributed in the hope that it will be useful, but 21 | * WITHOUT ANY WARRANTY; without even the implied warranty of 22 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 23 | * Lesser General Public License for more details.
24 | *
25 | * You should have received a copy of the GNU Lesser General Public 26 | * License along with this library; if not see 27 | * http://www.gnu.org/licenses/. 28 | */ 29 | package org.cpsolver.ifs.constant; -------------------------------------------------------------------------------- /src/org/cpsolver/ifs/criteria/AssignedValue.java: -------------------------------------------------------------------------------- 1 | package org.cpsolver.ifs.criteria; 2 | 3 | import java.util.Set; 4 | 5 | import org.cpsolver.ifs.assignment.Assignment; 6 | import org.cpsolver.ifs.model.Model; 7 | import org.cpsolver.ifs.model.Value; 8 | import org.cpsolver.ifs.model.Variable; 9 | import org.cpsolver.ifs.util.DataProperties; 10 | 11 | 12 | /** 13 | * Simple Criterion: Sum of {@link Value#toDouble(Assignment)}.
14 | *
15 | * This criterion only counts a sum of values (see {@link Value#toDouble(Assignment)}) of the assigned variables. 16 | * It is an alternative to the default {@link Model#getTotalValue(Assignment)}. 17 | * 18 | * @author Tomas Muller 19 | * @version IFS 1.3 (Iterative Forward Search)
20 | * Copyright (C) 2006 - 2014 Tomas Muller
21 | * muller@unitime.org
22 | * http://muller.unitime.org
23 | *
24 | * This library is free software; you can redistribute it and/or modify 25 | * it under the terms of the GNU Lesser General Public License as 26 | * published by the Free Software Foundation; either version 3 of the 27 | * License, or (at your option) any later version.
28 | *
29 | * This library is distributed in the hope that it will be useful, but 30 | * WITHOUT ANY WARRANTY; without even the implied warranty of 31 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 32 | * Lesser General Public License for more details.
33 | *
34 | * You should have received a copy of the GNU Lesser General Public 35 | * License along with this library; if not see 36 | * http://www.gnu.org/licenses/. 37 | * @param Variable 38 | * @param Value 39 | */ 40 | public class AssignedValue, T extends Value> extends AbstractCriterion{ 41 | 42 | @Override 43 | public double getWeightDefault(DataProperties config) { 44 | return 1.0; 45 | } 46 | 47 | @Override 48 | public double getValue(Assignment assignment, T value, Set conflicts) { 49 | double ret = value.toDouble(assignment); 50 | if (conflicts != null) 51 | for (T conflict: conflicts) 52 | ret -= conflict.toDouble(assignment); 53 | return ret; 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /src/org/cpsolver/ifs/criteria/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * IFS Criteria. 3 | * 4 | * An optimization objective can be split into several (optimization) criteria 5 | * and modeled as a weighted sum of these. This makes the implementation of a particular problem 6 | * more versatile as it allows for an easier modification of the optimization objective. 7 | * 8 | * @author Tomas Muller 9 | * @version IFS 1.4 (Instructor Sectioning)
10 | * Copyright (C) 2024 Tomas Muller
11 | * muller@unitime.org
12 | * http://muller.unitime.org
13 | *
14 | * This library is free software; you can redistribute it and/or modify 15 | * it under the terms of the GNU Lesser General Public License as 16 | * published by the Free Software Foundation; either version 3 of the 17 | * License, or (at your option) any later version.
18 | *
19 | * This library is distributed in the hope that it will be useful, but 20 | * WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 22 | * Lesser General Public License for more details.
23 | *
24 | * You should have received a copy of the GNU Lesser General Public 25 | * License along with this library; if not see 26 | * http://www.gnu.org/licenses/. 27 | */ 28 | package org.cpsolver.ifs.criteria; -------------------------------------------------------------------------------- /src/org/cpsolver/ifs/dbt/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Dynamic backtracking extension of IFS solver 3 | * 4 | * @author Tomas Muller 5 | * @version IFS 1.4 (Instructor Sectioning)
6 | * Copyright (C) 2024 Tomas Muller
7 | * muller@unitime.org
8 | * http://muller.unitime.org
9 | *
10 | * This library is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU Lesser General Public License as 12 | * published by the Free Software Foundation; either version 3 of the 13 | * License, or (at your option) any later version.
14 | *
15 | * This library is distributed in the hope that it will be useful, but 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | * Lesser General Public License for more details.
19 | *
20 | * You should have received a copy of the GNU Lesser General Public 21 | * License along with this library; if not see 22 | * http://www.gnu.org/licenses/. 23 | */ 24 | package org.cpsolver.ifs.dbt; -------------------------------------------------------------------------------- /src/org/cpsolver/ifs/example/csp/CSPValue.java: -------------------------------------------------------------------------------- 1 | package org.cpsolver.ifs.example.csp; 2 | 3 | import org.cpsolver.ifs.model.Value; 4 | 5 | /** 6 | * CSP value. 7 | * 8 | * @author Tomas Muller 9 | * @version IFS 1.3 (Iterative Forward Search)
10 | * Copyright (C) 2006 - 2014 Tomas Muller
11 | * muller@unitime.org
12 | * http://muller.unitime.org
13 | *
14 | * This library is free software; you can redistribute it and/or modify 15 | * it under the terms of the GNU Lesser General Public License as 16 | * published by the Free Software Foundation; either version 3 of the 17 | * License, or (at your option) any later version.
18 | *
19 | * This library is distributed in the hope that it will be useful, but 20 | * WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 22 | * Lesser General Public License for more details.
23 | *
24 | * You should have received a copy of the GNU Lesser General Public 25 | * License along with this library; if not see 26 | * http://www.gnu.org/licenses/. 27 | */ 28 | public class CSPValue extends Value { 29 | /** 30 | * Constructor 31 | * 32 | * @param variable 33 | * parent variable 34 | * @param value 35 | * value (an integer between 0 .. number of values - 1 ) 36 | */ 37 | public CSPValue(CSPVariable variable, int value) { 38 | super(variable, Double.valueOf(value)); 39 | } 40 | 41 | @Override 42 | public double toDouble() { 43 | return iValue; 44 | } 45 | 46 | @Override 47 | public String getName() { 48 | return String.valueOf(toDouble()); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/org/cpsolver/ifs/example/csp/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Random Binary CSP with uniform distribution. 3 | *
4 | *
5 | * A random CSP is defined by a four-tuple (n, d, p1, p2), where n 6 | * denotes the number of variables and d denotes the domain size of each 7 | * variable, p1 and p2 are two probabilities. They are used to generate 8 | * randomly the binary constraints among the variables. p1 represents the 9 | * probability that a constraint exists between two different variables 10 | * and p2 represents the probability that a pair of values in the domains 11 | * of two variables connected by a constraint are incompatible. 12 | *
13 | *
14 | * We use a so called model B of Random CSP (n, d, n1, n2) where n1 = 15 | * p1*n*(n-1)/2 pairs of variables are randomly and uniformly selected 16 | * and binary constraints are posted between them. For each constraint, 17 | * n2 = p1*d^2 randomly and uniformly selected pairs of values are picked 18 | * as incompatible. 19 | * 20 | * @author Tomas Muller 21 | * @version IFS 1.4 (Instructor Sectioning)
22 | * Copyright (C) 2024 Tomas Muller
23 | * muller@unitime.org
24 | * http://muller.unitime.org
25 | *
26 | * This library is free software; you can redistribute it and/or modify 27 | * it under the terms of the GNU Lesser General Public License as 28 | * published by the Free Software Foundation; either version 3 of the 29 | * License, or (at your option) any later version.
30 | *
31 | * This library is distributed in the hope that it will be useful, but 32 | * WITHOUT ANY WARRANTY; without even the implied warranty of 33 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 34 | * Lesser General Public License for more details.
35 | *
36 | * You should have received a copy of the GNU Lesser General Public 37 | * License along with this library; if not see 38 | * http://www.gnu.org/licenses/. 39 | */ 40 | package org.cpsolver.ifs.example.csp; -------------------------------------------------------------------------------- /src/org/cpsolver/ifs/example/jobshop/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * JobShop Problem. 3 | *
4 | *
5 | * The Job-shop scheduling problem (n,m,J,Cmax) is concerned with 6 | * ordering n jobs on m machines: each job is composed of an ordered list 7 | * of m operations and must be processed during a uninterrupted time 8 | * period of a given length on each of the m machines. The objective is 9 | * to minimise the makespan, i.e., the maximum of job completion times. 10 | * 11 | * @author Tomas Muller 12 | * @version IFS 1.4 (Instructor Sectioning)
13 | * Copyright (C) 2024 Tomas Muller
14 | * muller@unitime.org
15 | * http://muller.unitime.org
16 | *
17 | * This library is free software; you can redistribute it and/or modify 18 | * it under the terms of the GNU Lesser General Public License as 19 | * published by the Free Software Foundation; either version 3 of the 20 | * License, or (at your option) any later version.
21 | *
22 | * This library is distributed in the hope that it will be useful, but 23 | * WITHOUT ANY WARRANTY; without even the implied warranty of 24 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 25 | * Lesser General Public License for more details.
26 | *
27 | * You should have received a copy of the GNU Lesser General Public 28 | * License along with this library; if not see 29 | * http://www.gnu.org/licenses/. 30 | */ 31 | package org.cpsolver.ifs.example.jobshop; -------------------------------------------------------------------------------- /src/org/cpsolver/ifs/example/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * IFS Examples 3 | * 4 | * @author Tomas Muller 5 | * @version IFS 1.4 (Instructor Sectioning)
6 | * Copyright (C) 2024 Tomas Muller
7 | * muller@unitime.org
8 | * http://muller.unitime.org
9 | *
10 | * This library is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU Lesser General Public License as 12 | * published by the Free Software Foundation; either version 3 of the 13 | * License, or (at your option) any later version.
14 | *
15 | * This library is distributed in the hope that it will be useful, but 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | * Lesser General Public License for more details.
19 | *
20 | * You should have received a copy of the GNU Lesser General Public 21 | * License along with this library; if not see 22 | * http://www.gnu.org/licenses/. 23 | */ 24 | package org.cpsolver.ifs.example; -------------------------------------------------------------------------------- /src/org/cpsolver/ifs/extension/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * IFS Extensions (conflict-based statistics, maintenance of arc consistency) 3 | * 4 | * @author Tomas Muller 5 | * @version IFS 1.4 (Instructor Sectioning)
6 | * Copyright (C) 2024 Tomas Muller
7 | * muller@unitime.org
8 | * http://muller.unitime.org
9 | *
10 | * This library is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU Lesser General Public License as 12 | * published by the Free Software Foundation; either version 3 of the 13 | * License, or (at your option) any later version.
14 | *
15 | * This library is distributed in the hope that it will be useful, but 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | * Lesser General Public License for more details.
19 | *
20 | * You should have received a copy of the GNU Lesser General Public 21 | * License along with this library; if not see 22 | * http://www.gnu.org/licenses/. 23 | */ 24 | package org.cpsolver.ifs.extension; -------------------------------------------------------------------------------- /src/org/cpsolver/ifs/heuristics/NeighbourSelection.java: -------------------------------------------------------------------------------- 1 | package org.cpsolver.ifs.heuristics; 2 | 3 | import org.cpsolver.ifs.model.Neighbour; 4 | import org.cpsolver.ifs.model.Value; 5 | import org.cpsolver.ifs.model.Variable; 6 | import org.cpsolver.ifs.solution.Solution; 7 | import org.cpsolver.ifs.solver.Solver; 8 | 9 | /** 10 | * Neighbour selection criterion.
11 | *
12 | * In each iteration of the solver, a neighbour is selected and assigned (by 13 | * default {@link StandardNeighbourSelection} is employed). 14 | * 15 | * @see Solver 16 | * 17 | * @author Tomas Muller 18 | * @version IFS 1.3 (Iterative Forward Search)
19 | * Copyright (C) 2006 - 2014 Tomas Muller
20 | * muller@unitime.org
21 | * http://muller.unitime.org
22 | *
23 | * This library is free software; you can redistribute it and/or modify 24 | * it under the terms of the GNU Lesser General Public License as 25 | * published by the Free Software Foundation; either version 3 of the 26 | * License, or (at your option) any later version.
27 | *
28 | * This library is distributed in the hope that it will be useful, but 29 | * WITHOUT ANY WARRANTY; without even the implied warranty of 30 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 31 | * Lesser General Public License for more details.
32 | *
33 | * You should have received a copy of the GNU Lesser General Public 34 | * License along with this library; if not see http://www.gnu.org/licenses. 35 | * 36 | * @param Variable 37 | * @param Value 38 | **/ 39 | public interface NeighbourSelection, T extends Value> { 40 | /** Criterion initialization 41 | * @param solver current solver 42 | **/ 43 | public void init(Solver solver); 44 | 45 | /** 46 | * select a neighbour of a given solution 47 | * 48 | * @param solution 49 | * given solution 50 | * @return a neighbour assignment 51 | */ 52 | public Neighbour selectNeighbour(Solution solution); 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/org/cpsolver/ifs/heuristics/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * IFS Heuristics (value and variable selection criteria) 3 | * 4 | * @author Tomas Muller 5 | * @version IFS 1.4 (Instructor Sectioning)
6 | * Copyright (C) 2024 Tomas Muller
7 | * muller@unitime.org
8 | * http://muller.unitime.org
9 | *
10 | * This library is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU Lesser General Public License as 12 | * published by the Free Software Foundation; either version 3 of the 13 | * License, or (at your option) any later version.
14 | *
15 | * This library is distributed in the hope that it will be useful, but 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | * Lesser General Public License for more details.
19 | *
20 | * You should have received a copy of the GNU Lesser General Public 21 | * License along with this library; if not see 22 | * http://www.gnu.org/licenses/. 23 | */ 24 | package org.cpsolver.ifs.heuristics; -------------------------------------------------------------------------------- /src/org/cpsolver/ifs/model/ExtendedInfoProvider.java: -------------------------------------------------------------------------------- 1 | package org.cpsolver.ifs.model; 2 | 3 | import java.util.Map; 4 | 5 | import org.cpsolver.ifs.assignment.Assignment; 6 | 7 | 8 | /** 9 | * An extension of the {@link InfoProvider} class providing extended information. The extended info 10 | * may be computationally more expensive as it is only computed when needed (see {@link Model#getExtendedInfo(Assignment)}). 11 | * 12 | * @see Model 13 | * 14 | * @author Tomas Muller 15 | * @version IFS 1.3 (Iterative Forward Search)
16 | * Copyright (C) 2014 Tomas Muller
17 | * muller@unitime.org
18 | * http://muller.unitime.org
19 | *
20 | * This library is free software; you can redistribute it and/or modify 21 | * it under the terms of the GNU Lesser General Public License as 22 | * published by the Free Software Foundation; either version 3 of the 23 | * License, or (at your option) any later version.
24 | *
25 | * This library is distributed in the hope that it will be useful, but 26 | * WITHOUT ANY WARRANTY; without even the implied warranty of 27 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 28 | * Lesser General Public License for more details.
29 | *
30 | * You should have received a copy of the GNU Lesser General Public 31 | * License along with this library; if not see 32 | * http://www.gnu.org/licenses/. 33 | * @param Variable 34 | * @param Value 35 | */ 36 | public interface ExtendedInfoProvider, T extends Value> extends InfoProvider { 37 | 38 | /** 39 | * Extended information about current solution. Similar to 40 | * {@link InfoProvider#getInfo(Assignment, Map)}, but some more information (that is more 41 | * expensive to compute) might be added. 42 | * @param assignment current assignment 43 | * @param info extended info 44 | */ 45 | public void getExtendedInfo(Assignment assignment, Map info); 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/org/cpsolver/ifs/model/InfoProvider.java: -------------------------------------------------------------------------------- 1 | package org.cpsolver.ifs.model; 2 | 3 | import java.util.Collection; 4 | import java.util.Map; 5 | 6 | import org.cpsolver.ifs.assignment.Assignment; 7 | 8 | 9 | /** 10 | * A class providing INFO table. 11 | * 12 | * @see Model 13 | * 14 | * @author Tomas Muller 15 | * @version IFS 1.3 (Iterative Forward Search)
16 | * Copyright (C) 2006 - 2014 Tomas Muller
17 | * muller@unitime.org
18 | * http://muller.unitime.org
19 | *
20 | * This library is free software; you can redistribute it and/or modify 21 | * it under the terms of the GNU Lesser General Public License as 22 | * published by the Free Software Foundation; either version 3 of the 23 | * License, or (at your option) any later version.
24 | *
25 | * This library is distributed in the hope that it will be useful, but 26 | * WITHOUT ANY WARRANTY; without even the implied warranty of 27 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 28 | * Lesser General Public License for more details.
29 | *
30 | * You should have received a copy of the GNU Lesser General Public 31 | * License along with this library; if not see 32 | * http://www.gnu.org/licenses/. 33 | * 34 | * @param Variable 35 | * @param Value 36 | */ 37 | public interface InfoProvider, T extends Value> { 38 | /** Adds some information into the table with information about the solution 39 | * @param assignment current assignment 40 | * @param info info table 41 | **/ 42 | public void getInfo(Assignment assignment, Map info); 43 | 44 | /** 45 | * Adds some information into the table with information about the solution, 46 | * only consider variables from the given set 47 | * @param assignment current assignment 48 | * @param info info table 49 | * @param variables sub-problem 50 | */ 51 | public void getInfo(Assignment assignment, Map info, Collection variables); 52 | } -------------------------------------------------------------------------------- /src/org/cpsolver/ifs/model/Neighbour.java: -------------------------------------------------------------------------------- 1 | package org.cpsolver.ifs.model; 2 | 3 | import java.util.Map; 4 | 5 | import org.cpsolver.ifs.assignment.Assignment; 6 | 7 | 8 | /** 9 | * IFS neighbour. 10 | * 11 | * @see org.cpsolver.ifs.heuristics.NeighbourSelection 12 | * 13 | * @author Tomas Muller 14 | * @version IFS 1.3 (Iterative Forward Search)
15 | * Copyright (C) 2006 - 2014 Tomas Muller
16 | * muller@unitime.org
17 | * http://muller.unitime.org
18 | *
19 | * This library is free software; you can redistribute it and/or modify 20 | * it under the terms of the GNU Lesser General Public License as 21 | * published by the Free Software Foundation; either version 3 of the 22 | * License, or (at your option) any later version.
23 | *
24 | * This library is distributed in the hope that it will be useful, but 25 | * WITHOUT ANY WARRANTY; without even the implied warranty of 26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 27 | * Lesser General Public License for more details.
28 | *
29 | * You should have received a copy of the GNU Lesser General Public 30 | * License along with this library; if not see 31 | * http://www.gnu.org/licenses/. 32 | * 33 | * @param Variable 34 | * @param Value 35 | */ 36 | public interface Neighbour, T extends Value> { 37 | /** Perform assignment 38 | * @param assignment current assignment 39 | * @param iteration current iteration 40 | **/ 41 | public void assign(Assignment assignment, long iteration); 42 | 43 | /** Difference in the evaluation function, if this neighnour is assigned. 44 | * @param assignment current assignment 45 | * @return difference in the solution value when assigned 46 | **/ 47 | public double value(Assignment assignment); 48 | 49 | /** Return assignments to be done. 50 | * @return list of assignments (including unassignments) of this neighbour 51 | **/ 52 | public Map assignments(); 53 | } 54 | -------------------------------------------------------------------------------- /src/org/cpsolver/ifs/model/VariableListener.java: -------------------------------------------------------------------------------- 1 | package org.cpsolver.ifs.model; 2 | 3 | import org.cpsolver.ifs.assignment.Assignment; 4 | 5 | /** 6 | * IFS variable listener. 7 | * 8 | * @see Variable 9 | * 10 | * @author Tomas Muller 11 | * @version IFS 1.3 (Iterative Forward Search)
12 | * Copyright (C) 2006 - 2014 Tomas Muller
13 | * muller@unitime.org
14 | * http://muller.unitime.org
15 | *
16 | * This library is free software; you can redistribute it and/or modify 17 | * it under the terms of the GNU Lesser General Public License as 18 | * published by the Free Software Foundation; either version 3 of the 19 | * License, or (at your option) any later version.
20 | *
21 | * This library is distributed in the hope that it will be useful, but 22 | * WITHOUT ANY WARRANTY; without even the implied warranty of 23 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 24 | * Lesser General Public License for more details.
25 | *
26 | * You should have received a copy of the GNU Lesser General Public 27 | * License along with this library; if not see 28 | * http://www.gnu.org/licenses/. 29 | * 30 | * @param Value 31 | */ 32 | public interface VariableListener> { 33 | /** 34 | * Called by the variable when a value is assigned to it 35 | * 36 | * @param assignment current assignment 37 | * @param iteration 38 | * current iteration 39 | * @param value 40 | * assigned to the variable 41 | */ 42 | public void variableAssigned(Assignment assignment, long iteration, T value); 43 | 44 | /** 45 | * Called by the variable when a value is unassigned from it 46 | * 47 | * @param assignment current assignment 48 | * @param iteration 49 | * current iteration 50 | * @param value 51 | * unassigned from the variable 52 | */ 53 | public void variableUnassigned(Assignment assignment, long iteration, T value); 54 | 55 | /** 56 | * Called by the variable when a value is permanently removed from its 57 | * domain 58 | * 59 | * @param iteration 60 | * current iteration 61 | * @param value 62 | * removed from the variable's domain 63 | */ 64 | public void valueRemoved(long iteration, T value); 65 | } 66 | -------------------------------------------------------------------------------- /src/org/cpsolver/ifs/model/WeakeningConstraint.java: -------------------------------------------------------------------------------- 1 | package org.cpsolver.ifs.model; 2 | 3 | import org.cpsolver.ifs.assignment.Assignment; 4 | 5 | /** 6 | * Interface of a constraint that weakens with the time. 7 | * 8 | * @author Tomas Muller 9 | * @version CourseTT 1.3 (University Course Timetabling)
10 | * Copyright (C) 2006 - 2014 Tomas Muller
11 | * muller@unitime.org
12 | * http://muller.unitime.org
13 | *
14 | * This library is free software; you can redistribute it and/or modify 15 | * it under the terms of the GNU Lesser General Public License as 16 | * published by the Free Software Foundation; either version 3 of the 17 | * License, or (at your option) any later version.
18 | *
19 | * This library is distributed in the hope that it will be useful, but 20 | * WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 22 | * Lesser General Public License for more details.
23 | *
24 | * You should have received a copy of the GNU Lesser General Public 25 | * License along with this library; if not see 26 | * http://www.gnu.org/licenses/. 27 | * 28 | * @param Variable 29 | * @param Value 30 | */ 31 | public interface WeakeningConstraint, T extends Value> { 32 | /** 33 | * Weaken the constraint. This method is called if the constraint 34 | * participates in an unassigned of a variable. 35 | * @param assignment current assignment 36 | */ 37 | public void weaken(Assignment assignment); 38 | 39 | 40 | /** 41 | * Weaken the constraint enough so that it can assign the given 42 | * value. 43 | * @param assignment current assignment 44 | * @param value a conflicting value to be assigned 45 | */ 46 | public void weaken(Assignment assignment, T value); 47 | } 48 | -------------------------------------------------------------------------------- /src/org/cpsolver/ifs/model/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * IFS Model (description of a problem) 3 | * 4 | * @author Tomas Muller 5 | * @version IFS 1.4 (Instructor Sectioning)
6 | * Copyright (C) 2024 Tomas Muller
7 | * muller@unitime.org
8 | * http://muller.unitime.org
9 | *
10 | * This library is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU Lesser General Public License as 12 | * published by the Free Software Foundation; either version 3 of the 13 | * License, or (at your option) any later version.
14 | *
15 | * This library is distributed in the hope that it will be useful, but 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | * Lesser General Public License for more details.
19 | *
20 | * You should have received a copy of the GNU Lesser General Public 21 | * License along with this library; if not see 22 | * http://www.gnu.org/licenses/. 23 | */ 24 | package org.cpsolver.ifs.model; -------------------------------------------------------------------------------- /src/org/cpsolver/ifs/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Iterative Forward Search Algorithm (root package) 3 | * 4 | * @author Tomas Muller 5 | * @version IFS 1.4 (Instructor Sectioning)
6 | * Copyright (C) 2024 Tomas Muller
7 | * muller@unitime.org
8 | * http://muller.unitime.org
9 | *
10 | * This library is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU Lesser General Public License as 12 | * published by the Free Software Foundation; either version 3 of the 13 | * License, or (at your option) any later version.
14 | *
15 | * This library is distributed in the hope that it will be useful, but 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | * Lesser General Public License for more details.
19 | *
20 | * You should have received a copy of the GNU Lesser General Public 21 | * License along with this library; if not see 22 | * http://www.gnu.org/licenses/. 23 | */ 24 | package org.cpsolver.ifs; -------------------------------------------------------------------------------- /src/org/cpsolver/ifs/perturbations/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Minimal Perturbation Problem: counting of perturbations 3 | * 4 | * @author Tomas Muller 5 | * @version IFS 1.4 (Instructor Sectioning)
6 | * Copyright (C) 2024 Tomas Muller
7 | * muller@unitime.org
8 | * http://muller.unitime.org
9 | *
10 | * This library is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU Lesser General Public License as 12 | * published by the Free Software Foundation; either version 3 of the 13 | * License, or (at your option) any later version.
14 | *
15 | * This library is distributed in the hope that it will be useful, but 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | * Lesser General Public License for more details.
19 | *
20 | * You should have received a copy of the GNU Lesser General Public 21 | * License along with this library; if not see 22 | * http://www.gnu.org/licenses/. 23 | */ 24 | package org.cpsolver.ifs.perturbations; -------------------------------------------------------------------------------- /src/org/cpsolver/ifs/solution/SolutionComparator.java: -------------------------------------------------------------------------------- 1 | package org.cpsolver.ifs.solution; 2 | 3 | import org.cpsolver.ifs.model.Value; 4 | import org.cpsolver.ifs.model.Variable; 5 | 6 | /** 7 | * IFS solution comparator.
8 | *
9 | * The solution comparator compares two solutions: the current solution and the 10 | * best solution found. This comparison can be based on several criteria. For 11 | * example, it can lexicographically order solutions according to the number of 12 | * unassigned variables (smaller number is better) and the number of violated 13 | * soft constraints. 14 | * 15 | * @see Solution 16 | * @see org.cpsolver.ifs.solver.Solver 17 | * 18 | * @author Tomas Muller 19 | * @version IFS 1.3 (Iterative Forward Search)
20 | * Copyright (C) 2006 - 2014 Tomas Muller
21 | * muller@unitime.org
22 | * http://muller.unitime.org
23 | *
24 | * This library is free software; you can redistribute it and/or modify 25 | * it under the terms of the GNU Lesser General Public License as 26 | * published by the Free Software Foundation; either version 3 of the 27 | * License, or (at your option) any later version.
28 | *
29 | * This library is distributed in the hope that it will be useful, but 30 | * WITHOUT ANY WARRANTY; without even the implied warranty of 31 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 32 | * Lesser General Public License for more details.
33 | *
34 | * You should have received a copy of the GNU Lesser General Public 35 | * License along with this library; if not see 36 | * http://www.gnu.org/licenses/. 37 | * 38 | * @param Variable 39 | * @param Value 40 | */ 41 | public interface SolutionComparator, T extends Value> { 42 | /** 43 | * Compares two solutions. Returns true if the given solution is better than 44 | * its best ever found solution (see {@link Solution#saveBest()} and 45 | * {@link Solution#restoreBest()}). 46 | * 47 | * @param currentSolution 48 | * given solution 49 | * @return true if the given solution is better than the best ever found 50 | * solution 51 | */ 52 | public boolean isBetterThanBestSolution(Solution currentSolution); 53 | } 54 | -------------------------------------------------------------------------------- /src/org/cpsolver/ifs/solution/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * IFS Solution (also contains solution comparator) 3 | * 4 | * @author Tomas Muller 5 | * @version IFS 1.4 (Instructor Sectioning)
6 | * Copyright (C) 2024 Tomas Muller
7 | * muller@unitime.org
8 | * http://muller.unitime.org
9 | *
10 | * This library is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU Lesser General Public License as 12 | * published by the Free Software Foundation; either version 3 of the 13 | * License, or (at your option) any later version.
14 | *
15 | * This library is distributed in the hope that it will be useful, but 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | * Lesser General Public License for more details.
19 | *
20 | * You should have received a copy of the GNU Lesser General Public 21 | * License along with this library; if not see 22 | * http://www.gnu.org/licenses/. 23 | */ 24 | package org.cpsolver.ifs.solution; -------------------------------------------------------------------------------- /src/org/cpsolver/ifs/solver/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * IFS Solver 3 | * 4 | * @author Tomas Muller 5 | * @version IFS 1.4 (Instructor Sectioning)
6 | * Copyright (C) 2024 Tomas Muller
7 | * muller@unitime.org
8 | * http://muller.unitime.org
9 | *
10 | * This library is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU Lesser General Public License as 12 | * published by the Free Software Foundation; either version 3 of the 13 | * License, or (at your option) any later version.
14 | *
15 | * This library is distributed in the hope that it will be useful, but 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | * Lesser General Public License for more details.
19 | *
20 | * You should have received a copy of the GNU Lesser General Public 21 | * License along with this library; if not see 22 | * http://www.gnu.org/licenses/. 23 | */ 24 | package org.cpsolver.ifs.solver; -------------------------------------------------------------------------------- /src/org/cpsolver/ifs/termination/TerminationCondition.java: -------------------------------------------------------------------------------- 1 | package org.cpsolver.ifs.termination; 2 | 3 | import org.cpsolver.ifs.model.Value; 4 | import org.cpsolver.ifs.model.Variable; 5 | import org.cpsolver.ifs.solution.Solution; 6 | 7 | /** 8 | * Termination condition.
9 | *
10 | * The termination condition determines when the algorithm should finish. For 11 | * example, the solver should terminate when the maximal number of iterations or 12 | * some other given timeout value is reached. Moreover, it can stop the search 13 | * process when the current solution is good enough, e.g., all variables are 14 | * assigned and/or some other solution parameters are in the required ranges. 15 | * For example, the solver can stop when all variables are assigned and less 16 | * than 10% of the soft constraints are violated. Termination of the process by 17 | * the user can also be a part of the termination condition. 18 | * 19 | * @see org.cpsolver.ifs.solver.Solver 20 | * 21 | * @author Tomas Muller 22 | * @version IFS 1.3 (Iterative Forward Search)
23 | * Copyright (C) 2006 - 2014 Tomas Muller
24 | * muller@unitime.org
25 | * http://muller.unitime.org
26 | *
27 | * This library is free software; you can redistribute it and/or modify 28 | * it under the terms of the GNU Lesser General Public License as 29 | * published by the Free Software Foundation; either version 3 of the 30 | * License, or (at your option) any later version.
31 | *
32 | * This library is distributed in the hope that it will be useful, but 33 | * WITHOUT ANY WARRANTY; without even the implied warranty of 34 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 35 | * Lesser General Public License for more details.
36 | *
37 | * You should have received a copy of the GNU Lesser General Public 38 | * License along with this library; if not see http://www.gnu.org/licenses. 39 | * 40 | * @param Variable 41 | * @param Value 42 | **/ 43 | public interface TerminationCondition, T extends Value> { 44 | /** 45 | * Returns true when the solver can continue with the next iteration 46 | * 47 | * @param currentSolution 48 | * current solution 49 | * @return true if the solver can continue with the next iteration 50 | */ 51 | public boolean canContinue(Solution currentSolution); 52 | } 53 | -------------------------------------------------------------------------------- /src/org/cpsolver/ifs/termination/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * IFS Termination (termination condition) 3 | * 4 | * @author Tomas Muller 5 | * @version IFS 1.4 (Instructor Sectioning)
6 | * Copyright (C) 2024 Tomas Muller
7 | * muller@unitime.org
8 | * http://muller.unitime.org
9 | *
10 | * This library is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU Lesser General Public License as 12 | * published by the Free Software Foundation; either version 3 of the 13 | * License, or (at your option) any later version.
14 | *
15 | * This library is distributed in the hope that it will be useful, but 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | * Lesser General Public License for more details.
19 | *
20 | * You should have received a copy of the GNU Lesser General Public 21 | * License along with this library; if not see 22 | * http://www.gnu.org/licenses/. 23 | */ 24 | package org.cpsolver.ifs.termination; -------------------------------------------------------------------------------- /src/org/cpsolver/ifs/util/Callback.java: -------------------------------------------------------------------------------- 1 | package org.cpsolver.ifs.util; 2 | 3 | /** 4 | * Callback interface. 5 | * 6 | * @author Tomas Muller 7 | * @version IFS 1.3 (Iterative Forward Search)
8 | * Copyright (C) 2006 - 2014 Tomas Muller
9 | * muller@unitime.org
10 | * http://muller.unitime.org
11 | *
12 | * This library is free software; you can redistribute it and/or modify 13 | * it under the terms of the GNU Lesser General Public License as 14 | * published by the Free Software Foundation; either version 3 of the 15 | * License, or (at your option) any later version.
16 | *
17 | * This library is distributed in the hope that it will be useful, but 18 | * WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 | * Lesser General Public License for more details.
21 | *
22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with this library; if not see 24 | * http://www.gnu.org/licenses/. 25 | */ 26 | public interface Callback { 27 | /** Execute callback */ 28 | public void execute(); 29 | } 30 | -------------------------------------------------------------------------------- /src/org/cpsolver/ifs/util/Counter.java: -------------------------------------------------------------------------------- 1 | package org.cpsolver.ifs.util; 2 | 3 | /** 4 | * Counter. 5 | * 6 | * @author Tomas Muller 7 | * @version IFS 1.3 (Iterative Forward Search)
8 | * Copyright (C) 2006 - 2014 Tomas Muller
9 | * muller@unitime.org
10 | * http://muller.unitime.org
11 | *
12 | * This library is free software; you can redistribute it and/or modify 13 | * it under the terms of the GNU Lesser General Public License as 14 | * published by the Free Software Foundation; either version 3 of the 15 | * License, or (at your option) any later version.
16 | *
17 | * This library is distributed in the hope that it will be useful, but 18 | * WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 | * Lesser General Public License for more details.
21 | *
22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with this library; if not see 24 | * http://www.gnu.org/licenses/. 25 | */ 26 | public class Counter { 27 | private long iValue = 0; 28 | 29 | /** Set counter 30 | * @param value counter value 31 | **/ 32 | public void set(long value) { 33 | iValue = value; 34 | } 35 | 36 | /** Returns current value 37 | * @return counter value 38 | **/ 39 | public long get() { 40 | return iValue; 41 | } 42 | 43 | /** Increment counter 44 | * @param value counter increment 45 | **/ 46 | public void inc(long value) { 47 | iValue += value; 48 | } 49 | 50 | /** Decrement counter 51 | * @param value counter decrement 52 | **/ 53 | public void dec(long value) { 54 | iValue -= value; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/org/cpsolver/ifs/util/IdGenerator.java: -------------------------------------------------------------------------------- 1 | package org.cpsolver.ifs.util; 2 | 3 | /** 4 | * ID generator. 5 | * 6 | * @author Tomas Muller 7 | * @version IFS 1.3 (Iterative Forward Search)
8 | * Copyright (C) 2006 - 2014 Tomas Muller
9 | * muller@unitime.org
10 | * http://muller.unitime.org
11 | *
12 | * This library is free software; you can redistribute it and/or modify 13 | * it under the terms of the GNU Lesser General Public License as 14 | * published by the Free Software Foundation; either version 3 of the 15 | * License, or (at your option) any later version.
16 | *
17 | * This library is distributed in the hope that it will be useful, but 18 | * WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 | * Lesser General Public License for more details.
21 | *
22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with this library; if not see 24 | * http://www.gnu.org/licenses/. 25 | */ 26 | public class IdGenerator { 27 | private int iLastId = 0; 28 | 29 | /** Generates new id 30 | * @return new unique id 31 | **/ 32 | public long newId() { 33 | return ++iLastId; 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/org/cpsolver/ifs/util/ProgressListener.java: -------------------------------------------------------------------------------- 1 | package org.cpsolver.ifs.util; 2 | 3 | /** 4 | * Progress bar listener. 5 | * 6 | * @author Tomas Muller 7 | * @version IFS 1.3 (Iterative Forward Search)
8 | * Copyright (C) 2006 - 2014 Tomas Muller
9 | * muller@unitime.org
10 | * http://muller.unitime.org
11 | *
12 | * This library is free software; you can redistribute it and/or modify 13 | * it under the terms of the GNU Lesser General Public License as 14 | * published by the Free Software Foundation; either version 3 of the 15 | * License, or (at your option) any later version.
16 | *
17 | * This library is distributed in the hope that it will be useful, but 18 | * WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 | * Lesser General Public License for more details.
21 | *
22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with this library; if not see 24 | * http://www.gnu.org/licenses/. 25 | */ 26 | public interface ProgressListener { 27 | /** 28 | * Progress status is changed 29 | * 30 | * @param status 31 | * current status name 32 | */ 33 | public void statusChanged(String status); 34 | 35 | /** 36 | * Progress phase is changed 37 | * 38 | * @param phase 39 | * current phase name 40 | */ 41 | public void phaseChanged(String phase); 42 | 43 | /** 44 | * Progress bar is changed 45 | * 46 | * @param currentProgress 47 | * current progress 48 | * @param maxProgress 49 | * maximum progress in this phase 50 | */ 51 | public void progressChanged(long currentProgress, long maxProgress); 52 | 53 | /** Progress is saved */ 54 | public void progressSaved(); 55 | 56 | /** Progress is restored */ 57 | public void progressRestored(); 58 | 59 | /** Progress message is printed 60 | * @param message a message to print 61 | **/ 62 | public void progressMessagePrinted(Progress.Message message); 63 | } 64 | -------------------------------------------------------------------------------- /src/org/cpsolver/ifs/util/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Utilities 3 | * 4 | * @author Tomas Muller 5 | * @version IFS 1.4 (Instructor Sectioning)
6 | * Copyright (C) 2024 Tomas Muller
7 | * muller@unitime.org
8 | * http://muller.unitime.org
9 | *
10 | * This library is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU Lesser General Public License as 12 | * published by the Free Software Foundation; either version 3 of the 13 | * License, or (at your option) any later version.
14 | *
15 | * This library is distributed in the hope that it will be useful, but 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | * Lesser General Public License for more details.
19 | *
20 | * You should have received a copy of the GNU Lesser General Public 21 | * License along with this library; if not see 22 | * http://www.gnu.org/licenses/. 23 | */ 24 | package org.cpsolver.ifs.util; -------------------------------------------------------------------------------- /src/org/cpsolver/instructor/constraints/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Instructor Scheduling: Constraints. 3 | * 4 | * The most work is done by the {@link org.cpsolver.instructor.constraints.InstructorConstraint}. It checks for 5 | * instructor availability, maximal load, time conflicts, and whether the given assignments are of the same 6 | * course (if desired). 7 | * 8 | * @author Tomas Muller 9 | * @version IFS 1.3 (Instructor Sectioning)
10 | * Copyright (C) 2016 Tomas Muller
11 | * muller@unitime.org
12 | * http://muller.unitime.org
13 | *
14 | * This library is free software; you can redistribute it and/or modify 15 | * it under the terms of the GNU Lesser General Public License as 16 | * published by the Free Software Foundation; either version 3 of the 17 | * License, or (at your option) any later version.
18 | *
19 | * This library is distributed in the hope that it will be useful, but 20 | * WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 22 | * Lesser General Public License for more details.
23 | *
24 | * You should have received a copy of the GNU Lesser General Public 25 | * License along with this library; if not see 26 | * http://www.gnu.org/licenses/. 27 | */ 28 | package org.cpsolver.instructor.constraints; -------------------------------------------------------------------------------- /src/org/cpsolver/instructor/criteria/AttributePreferences.java: -------------------------------------------------------------------------------- 1 | package org.cpsolver.instructor.criteria; 2 | 3 | import java.util.Set; 4 | 5 | import org.cpsolver.ifs.assignment.Assignment; 6 | import org.cpsolver.ifs.util.DataProperties; 7 | import org.cpsolver.instructor.model.TeachingAssignment; 8 | import org.cpsolver.instructor.model.TeachingRequest; 9 | 10 | /** 11 | * Attribute Preferences. This criterion counts how well are the attribute preferences that are set on a {@link TeachingRequest} met 12 | * (counting {@link TeachingAssignment#getAttributePreference()}). 13 | * 14 | * @author Tomas Muller 15 | * @version IFS 1.3 (Instructor Sectioning)
16 | * Copyright (C) 2016 Tomas Muller
17 | * muller@unitime.org
18 | * http://muller.unitime.org
19 | *
20 | * This library is free software; you can redistribute it and/or modify 21 | * it under the terms of the GNU Lesser General Public License as 22 | * published by the Free Software Foundation; either version 3 of the 23 | * License, or (at your option) any later version.
24 | *
25 | * This library is distributed in the hope that it will be useful, but 26 | * WITHOUT ANY WARRANTY; without even the implied warranty of 27 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 28 | * Lesser General Public License for more details.
29 | *
30 | * You should have received a copy of the GNU Lesser General Public 31 | * License along with this library; if not see 32 | * http://www.gnu.org/licenses/. 33 | */ 34 | public class AttributePreferences extends InstructorSchedulingCriterion { 35 | 36 | @Override 37 | public double getWeightDefault(DataProperties config) { 38 | return 1000.0; 39 | } 40 | 41 | @Override 42 | public double getValue(Assignment assignment, TeachingAssignment value, Set conflicts) { 43 | return value.getAttributePreference(); 44 | } 45 | 46 | @Override 47 | public String getAbbreviation() { 48 | return "AttributePref"; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/org/cpsolver/instructor/criteria/CoursePreferences.java: -------------------------------------------------------------------------------- 1 | package org.cpsolver.instructor.criteria; 2 | 3 | import java.util.Set; 4 | 5 | import org.cpsolver.ifs.assignment.Assignment; 6 | import org.cpsolver.ifs.util.DataProperties; 7 | import org.cpsolver.instructor.model.Instructor; 8 | import org.cpsolver.instructor.model.TeachingAssignment; 9 | import org.cpsolver.instructor.model.TeachingRequest; 10 | 11 | /** 12 | * Course Preferences. This criterion counts how well are the course preferences that are set on an {@link Instructor} met 13 | * (counting {@link TeachingAssignment#getCoursePreference()}). 14 | * 15 | * @author Tomas Muller 16 | * @version IFS 1.3 (Instructor Sectioning)
17 | * Copyright (C) 2016 Tomas Muller
18 | * muller@unitime.org
19 | * http://muller.unitime.org
20 | *
21 | * This library is free software; you can redistribute it and/or modify 22 | * it under the terms of the GNU Lesser General Public License as 23 | * published by the Free Software Foundation; either version 3 of the 24 | * License, or (at your option) any later version.
25 | *
26 | * This library is distributed in the hope that it will be useful, but 27 | * WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details.
30 | *
31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library; if not see 33 | * http://www.gnu.org/licenses/. 34 | */ 35 | public class CoursePreferences extends InstructorSchedulingCriterion { 36 | 37 | @Override 38 | public double getWeightDefault(DataProperties config) { 39 | return 0.1; 40 | } 41 | 42 | @Override 43 | public double getValue(Assignment assignment, TeachingAssignment value, Set conflicts) { 44 | return value.getCoursePreference(); 45 | } 46 | 47 | @Override 48 | public String getAbbreviation() { 49 | return "CoursePref"; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/org/cpsolver/instructor/criteria/InstructorPreferences.java: -------------------------------------------------------------------------------- 1 | package org.cpsolver.instructor.criteria; 2 | 3 | import java.util.Set; 4 | 5 | import org.cpsolver.ifs.assignment.Assignment; 6 | import org.cpsolver.ifs.util.DataProperties; 7 | import org.cpsolver.instructor.model.TeachingAssignment; 8 | import org.cpsolver.instructor.model.TeachingRequest; 9 | 10 | /** 11 | * Instructor Preferences. This criterion counts how well are the instructor preferences that are set on a {@link TeachingRequest} met 12 | * (counting {@link TeachingAssignment#getInstructorPreference()}). 13 | * 14 | * @author Tomas Muller 15 | * @version IFS 1.3 (Instructor Sectioning)
16 | * Copyright (C) 2016 Tomas Muller
17 | * muller@unitime.org
18 | * http://muller.unitime.org
19 | *
20 | * This library is free software; you can redistribute it and/or modify 21 | * it under the terms of the GNU Lesser General Public License as 22 | * published by the Free Software Foundation; either version 3 of the 23 | * License, or (at your option) any later version.
24 | *
25 | * This library is distributed in the hope that it will be useful, but 26 | * WITHOUT ANY WARRANTY; without even the implied warranty of 27 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 28 | * Lesser General Public License for more details.
29 | *
30 | * You should have received a copy of the GNU Lesser General Public 31 | * License along with this library; if not see 32 | * http://www.gnu.org/licenses/. 33 | */ 34 | public class InstructorPreferences extends InstructorSchedulingCriterion { 35 | 36 | @Override 37 | public double getWeightDefault(DataProperties config) { 38 | return 0.1; 39 | } 40 | 41 | @Override 42 | public double getValue(Assignment assignment, TeachingAssignment value, Set conflicts) { 43 | return value.getInstructorPreference(); 44 | } 45 | 46 | @Override 47 | public String getAbbreviation() { 48 | return "InstructorPref"; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/org/cpsolver/instructor/criteria/TeachingPreferences.java: -------------------------------------------------------------------------------- 1 | package org.cpsolver.instructor.criteria; 2 | 3 | import java.util.Set; 4 | 5 | import org.cpsolver.ifs.assignment.Assignment; 6 | import org.cpsolver.ifs.util.DataProperties; 7 | import org.cpsolver.instructor.model.Instructor; 8 | import org.cpsolver.instructor.model.TeachingAssignment; 9 | import org.cpsolver.instructor.model.TeachingRequest; 10 | 11 | /** 12 | * Teaching Preferences. This criterion counts how well are the teaching preferences that are set on an {@link Instructor} met 13 | * (counting {@link Instructor#getPreference()}). 14 | * 15 | * @author Tomas Muller 16 | * @version IFS 1.3 (Instructor Sectioning)
17 | * Copyright (C) 2016 Tomas Muller
18 | * muller@unitime.org
19 | * http://muller.unitime.org
20 | *
21 | * This library is free software; you can redistribute it and/or modify 22 | * it under the terms of the GNU Lesser General Public License as 23 | * published by the Free Software Foundation; either version 3 of the 24 | * License, or (at your option) any later version.
25 | *
26 | * This library is distributed in the hope that it will be useful, but 27 | * WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details.
30 | *
31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library; if not see 33 | * http://www.gnu.org/licenses/. 34 | */ 35 | public class TeachingPreferences extends InstructorSchedulingCriterion { 36 | 37 | @Override 38 | public double getWeightDefault(DataProperties config) { 39 | return 1.0; 40 | } 41 | 42 | @Override 43 | public double getValue(Assignment assignment, TeachingAssignment value, Set conflicts) { 44 | return value.getInstructor().getPreference(); 45 | } 46 | 47 | @Override 48 | public String getAbbreviation() { 49 | return "TeachingPref"; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/org/cpsolver/instructor/criteria/TimePreferences.java: -------------------------------------------------------------------------------- 1 | package org.cpsolver.instructor.criteria; 2 | 3 | import java.util.Set; 4 | 5 | import org.cpsolver.ifs.assignment.Assignment; 6 | import org.cpsolver.ifs.util.DataProperties; 7 | import org.cpsolver.instructor.model.Instructor; 8 | import org.cpsolver.instructor.model.TeachingAssignment; 9 | import org.cpsolver.instructor.model.TeachingRequest; 10 | 11 | /** 12 | * Time Preferences. This criterion counts how well are the time preferences that are set on an {@link Instructor} met 13 | * (counting {@link TeachingAssignment#getTimePreference()}). 14 | * 15 | * @author Tomas Muller 16 | * @version IFS 1.3 (Instructor Sectioning)
17 | * Copyright (C) 2016 Tomas Muller
18 | * muller@unitime.org
19 | * http://muller.unitime.org
20 | *
21 | * This library is free software; you can redistribute it and/or modify 22 | * it under the terms of the GNU Lesser General Public License as 23 | * published by the Free Software Foundation; either version 3 of the 24 | * License, or (at your option) any later version.
25 | *
26 | * This library is distributed in the hope that it will be useful, but 27 | * WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details.
30 | *
31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library; if not see 33 | * http://www.gnu.org/licenses/. 34 | */ 35 | public class TimePreferences extends InstructorSchedulingCriterion { 36 | @Override 37 | public double getWeightDefault(DataProperties config) { 38 | return 1.0; 39 | } 40 | 41 | @Override 42 | public double getValue(Assignment assignment, TeachingAssignment value, Set conflicts) { 43 | return value.getTimePreference(); 44 | } 45 | 46 | @Override 47 | public String getAbbreviation() { 48 | return "TimePref"; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/org/cpsolver/instructor/criteria/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Instructor Scheduling: Criteria. 3 | * 4 | * Optimization criteria for the instructor scheduling problem. 5 | * 6 | * @author Tomas Muller 7 | * @version IFS 1.3 (Instructor Sectioning)
8 | * Copyright (C) 2016 Tomas Muller
9 | * muller@unitime.org
10 | * http://muller.unitime.org
11 | *
12 | * This library is free software; you can redistribute it and/or modify 13 | * it under the terms of the GNU Lesser General Public License as 14 | * published by the Free Software Foundation; either version 3 of the 15 | * License, or (at your option) any later version.
16 | *
17 | * This library is distributed in the hope that it will be useful, but 18 | * WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 | * Lesser General Public License for more details.
21 | *
22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with this library; if not see 24 | * http://www.gnu.org/licenses/. 25 | */ 26 | package org.cpsolver.instructor.criteria; -------------------------------------------------------------------------------- /src/org/cpsolver/instructor/default.properties: -------------------------------------------------------------------------------- 1 | # Instructor Scheduling Default Configuration 2 | ############################################## 3 | 4 | # Termination 5 | Termination.Class=org.cpsolver.ifs.termination.GeneralTerminationCondition 6 | Termination.StopWhenComplete=false 7 | Termination.TimeOut=300 8 | 9 | # Solver configuration 10 | General.SaveBestUnassigned=-1 11 | Comparator.Class=org.cpsolver.ifs.solution.GeneralSolutionComparator 12 | Value.Class=org.cpsolver.ifs.heuristics.GeneralValueSelection 13 | Variable.Class=org.cpsolver.ifs.heuristics.GeneralVariableSelection 14 | Extensions.Classes=org.cpsolver.ifs.extension.ConflictStatistics 15 | Neighbour.Class=org.cpsolver.ifs.algorithms.SimpleSearch 16 | Value.RandomWalkProb=0.02 17 | Value.WeightConflicts=1000.0 18 | Debug.Criterion=true 19 | 20 | # XML Load 21 | Defaults.Exclusive=true 22 | Defaults.SameCommon=true 23 | 24 | # Files 25 | input=input/solution.xml 26 | output=output -------------------------------------------------------------------------------- /src/org/cpsolver/instructor/model/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Instructor Scheduling: Model. 3 | * 4 | * Instructor Scheduling problem model. The model is implemented by {@link org.cpsolver.instructor.model.InstructorSchedulingModel}. 5 | * Variables are {@link org.cpsolver.instructor.model.TeachingRequest}, values are {@link org.cpsolver.instructor.model.TeachingAssignment}. 6 | * Each teaching request has a course (see {@link org.cpsolver.instructor.model.Course}) and one or more sections (see {link {@link org.cpsolver.instructor.model.Section}}). 7 | * Each assignment assigns one instructor (see {@link org.cpsolver.instructor.model.Instructor}) to a single teaching request. 8 | * 9 | * @author Tomas Muller 10 | * @version IFS 1.3 (Instructor Sectioning)
11 | * Copyright (C) 2016 Tomas Muller
12 | * muller@unitime.org
13 | * http://muller.unitime.org
14 | *
15 | * This library is free software; you can redistribute it and/or modify 16 | * it under the terms of the GNU Lesser General Public License as 17 | * published by the Free Software Foundation; either version 3 of the 18 | * License, or (at your option) any later version.
19 | *
20 | * This library is distributed in the hope that it will be useful, but 21 | * WITHOUT ANY WARRANTY; without even the implied warranty of 22 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 23 | * Lesser General Public License for more details.
24 | *
25 | * You should have received a copy of the GNU Lesser General Public 26 | * License along with this library; if not see 27 | * http://www.gnu.org/licenses/. 28 | */ 29 | package org.cpsolver.instructor.model; -------------------------------------------------------------------------------- /src/org/cpsolver/instructor/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Instructor Scheduling. 3 | * 4 | * Instructor scheduling is a process of assigning instructors (typically teaching assistants) to classes 5 | * after the course timetabling and student scheduling is done. 6 | * 7 | * @author Tomas Muller 8 | * @version IFS 1.3 (Instructor Sectioning)
9 | * Copyright (C) 2016 Tomas Muller
10 | * muller@unitime.org
11 | * http://muller.unitime.org
12 | *
13 | * This library is free software; you can redistribute it and/or modify 14 | * it under the terms of the GNU Lesser General Public License as 15 | * published by the Free Software Foundation; either version 3 of the 16 | * License, or (at your option) any later version.
17 | *
18 | * This library is distributed in the hope that it will be useful, but 19 | * WITHOUT ANY WARRANTY; without even the implied warranty of 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 21 | * Lesser General Public License for more details.
22 | *
23 | * You should have received a copy of the GNU Lesser General Public 24 | * License along with this library; if not see 25 | * http://www.gnu.org/licenses/. 26 | */ 27 | package org.cpsolver.instructor; -------------------------------------------------------------------------------- /src/org/cpsolver/instructor/test/chm.properties: -------------------------------------------------------------------------------- 1 | Termination.Class=org.cpsolver.ifs.termination.GeneralTerminationCondition 2 | Termination.StopWhenComplete=false 3 | Termination.TimeOut=300 4 | General.SaveBestUnassigned=-1 5 | Comparator.Class=org.cpsolver.ifs.solution.GeneralSolutionComparator 6 | Value.Class=org.cpsolver.ifs.heuristics.GeneralValueSelection 7 | Value.WeightConflicts=1000.0 8 | Variable.Class=org.cpsolver.ifs.heuristics.GeneralVariableSelection 9 | Extensions.Classes=org.cpsolver.ifs.extension.ConflictStatistics 10 | Neighbour.Class=org.cpsolver.ifs.algorithms.SimpleSearch 11 | Debug.Criterion=true 12 | Value.RandomWalkProb=0.02 13 | Defaults.BackToBack=-1 14 | Defaults.Exclusive=true 15 | Defaults.SameCommon=true 16 | Xml.LoadSolution=false 17 | Xml.SaveInitial=true 18 | Xml.SaveBest=true 19 | BackToBack.DifferentTypeWeight=0.0 20 | Weight.BackToBack=0.0 21 | Weight.TimePreferences=10.0 22 | input=/Users/muller/Test/TA/chm/solution.xml 23 | output=/Users/muller/Test/TA/chm/output -------------------------------------------------------------------------------- /src/org/cpsolver/instructor/test/math.properties: -------------------------------------------------------------------------------- 1 | Termination.Class=org.cpsolver.ifs.termination.GeneralTerminationCondition 2 | Termination.StopWhenComplete=false 3 | Termination.TimeOut=300 4 | General.SaveBestUnassigned=-1 5 | Comparator.Class=org.cpsolver.ifs.solution.GeneralSolutionComparator 6 | Value.Class=org.cpsolver.ifs.heuristics.GeneralValueSelection 7 | Value.WeightConflicts=1000.0 8 | Variable.Class=org.cpsolver.ifs.heuristics.GeneralVariableSelection 9 | Extensions.Classes=org.cpsolver.ifs.extension.ConflictStatistics 10 | Neighbour.Class=org.cpsolver.ifs.algorithms.SimpleSearch 11 | Debug.Criterion=true 12 | Value.RandomWalkProb=0.02 13 | Xml.LoadSolution=false 14 | Xml.SaveInitial=true 15 | Xml.SaveBest=true 16 | input=/Users/muller/Test/TA/input 17 | output=/Users/muller/Test/TA/output2 -------------------------------------------------------------------------------- /src/org/cpsolver/instructor/test/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Instructor Scheduling: Tests. 3 | * 4 | * Problem-specific tests go here. 5 | * 6 | * @author Tomas Muller 7 | * @version IFS 1.3 (Instructor Sectioning)
8 | * Copyright (C) 2016 Tomas Muller
9 | * muller@unitime.org
10 | * http://muller.unitime.org
11 | *
12 | * This library is free software; you can redistribute it and/or modify 13 | * it under the terms of the GNU Lesser General Public License as 14 | * published by the Free Software Foundation; either version 3 of the 15 | * License, or (at your option) any later version.
16 | *
17 | * This library is distributed in the hope that it will be useful, but 18 | * WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 | * Lesser General Public License for more details.
21 | *
22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with this library; if not see 24 | * http://www.gnu.org/licenses/. 25 | */ 26 | package org.cpsolver.instructor.test; -------------------------------------------------------------------------------- /src/org/cpsolver/studentsct/StudentSectioningLoader.java: -------------------------------------------------------------------------------- 1 | package org.cpsolver.studentsct; 2 | 3 | import org.cpsolver.ifs.assignment.Assignment; 4 | import org.cpsolver.ifs.util.ProblemLoader; 5 | import org.cpsolver.studentsct.model.Enrollment; 6 | import org.cpsolver.studentsct.model.Request; 7 | 8 | 9 | /** 10 | * Abstract student sectioning loader class. 11 | * 12 | * @author Tomas Muller 13 | * @version StudentSct 1.3 (Student Sectioning)
14 | * Copyright (C) 2007 - 2014 Tomas Muller
15 | * muller@unitime.org
16 | * http://muller.unitime.org
17 | *
18 | * This library is free software; you can redistribute it and/or modify 19 | * it under the terms of the GNU Lesser General Public License as 20 | * published by the Free Software Foundation; either version 3 of the 21 | * License, or (at your option) any later version.
22 | *
23 | * This library is distributed in the hope that it will be useful, but 24 | * WITHOUT ANY WARRANTY; without even the implied warranty of 25 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 26 | * Lesser General Public License for more details.
27 | *
28 | * You should have received a copy of the GNU Lesser General Public 29 | * License along with this library; if not see 30 | * http://www.gnu.org/licenses/. 31 | */ 32 | 33 | public abstract class StudentSectioningLoader extends ProblemLoader { 34 | /** 35 | * Constructor 36 | * 37 | * @param model 38 | * an empty instance of timetable model 39 | * @param assignment an empty assignment to be populated 40 | */ 41 | public StudentSectioningLoader(StudentSectioningModel model, Assignment assignment) { 42 | super(model, assignment); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/org/cpsolver/studentsct/StudentSectioningSaver.java: -------------------------------------------------------------------------------- 1 | package org.cpsolver.studentsct; 2 | 3 | import org.cpsolver.ifs.solver.Solver; 4 | import org.cpsolver.ifs.util.ProblemSaver; 5 | import org.cpsolver.studentsct.model.Enrollment; 6 | import org.cpsolver.studentsct.model.Request; 7 | 8 | 9 | /** 10 | * Abstract student sectioning saver class. 11 | * 12 | * @author Tomas Muller 13 | * @version StudentSct 1.3 (Student Sectioning)
14 | * Copyright (C) 2007 - 2014 Tomas Muller
15 | * muller@unitime.org
16 | * http://muller.unitime.org
17 | *
18 | * This library is free software; you can redistribute it and/or modify 19 | * it under the terms of the GNU Lesser General Public License as 20 | * published by the Free Software Foundation; either version 3 of the 21 | * License, or (at your option) any later version.
22 | *
23 | * This library is distributed in the hope that it will be useful, but 24 | * WITHOUT ANY WARRANTY; without even the implied warranty of 25 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 26 | * Lesser General Public License for more details.
27 | *
28 | * You should have received a copy of the GNU Lesser General Public 29 | * License along with this library; if not see 30 | * http://www.gnu.org/licenses/. 31 | */ 32 | 33 | public abstract class StudentSectioningSaver extends ProblemSaver { 34 | /** 35 | * Constructor 36 | * @param solver current solver 37 | */ 38 | public StudentSectioningSaver(Solver solver) { 39 | super(solver); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/org/cpsolver/studentsct/check/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Various checks of validity of a student sectioning solution. 3 | * 4 | * @author Tomas Muller 5 | * @version IFS 1.4 (Instructor Sectioning)
6 | * Copyright (C) 2024 Tomas Muller
7 | * muller@unitime.org
8 | * http://muller.unitime.org
9 | *
10 | * This library is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU Lesser General Public License as 12 | * published by the Free Software Foundation; either version 3 of the 13 | * License, or (at your option) any later version.
14 | *
15 | * This library is distributed in the hope that it will be useful, but 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | * Lesser General Public License for more details.
19 | *
20 | * You should have received a copy of the GNU Lesser General Public 21 | * License along with this library; if not see 22 | * http://www.gnu.org/licenses/. 23 | */ 24 | package org.cpsolver.studentsct.check; -------------------------------------------------------------------------------- /src/org/cpsolver/studentsct/constraint/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Student Sectioning: Constraints. 3 | * 4 | * @author Tomas Muller 5 | * @version IFS 1.4 (Instructor Sectioning)
6 | * Copyright (C) 2024 Tomas Muller
7 | * muller@unitime.org
8 | * http://muller.unitime.org
9 | *
10 | * This library is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU Lesser General Public License as 12 | * published by the Free Software Foundation; either version 3 of the 13 | * License, or (at your option) any later version.
14 | *
15 | * This library is distributed in the hope that it will be useful, but 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | * Lesser General Public License for more details.
19 | *
20 | * You should have received a copy of the GNU Lesser General Public 21 | * License along with this library; if not see 22 | * http://www.gnu.org/licenses/. 23 | */ 24 | package org.cpsolver.studentsct.constraint; -------------------------------------------------------------------------------- /src/org/cpsolver/studentsct/extension/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Student Sectioning: Various Extensions. 3 | * 4 | * @author Tomas Muller 5 | * @version IFS 1.4 (Instructor Sectioning)
6 | * Copyright (C) 2024 Tomas Muller
7 | * muller@unitime.org
8 | * http://muller.unitime.org
9 | *
10 | * This library is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU Lesser General Public License as 12 | * published by the Free Software Foundation; either version 3 of the 13 | * License, or (at your option) any later version.
14 | *
15 | * This library is distributed in the hope that it will be useful, but 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | * Lesser General Public License for more details.
19 | *
20 | * You should have received a copy of the GNU Lesser General Public 21 | * License along with this library; if not see 22 | * http://www.gnu.org/licenses/. 23 | */ 24 | package org.cpsolver.studentsct.extension; -------------------------------------------------------------------------------- /src/org/cpsolver/studentsct/filter/FreshmanStudentFilter.java: -------------------------------------------------------------------------------- 1 | package org.cpsolver.studentsct.filter; 2 | 3 | import org.cpsolver.studentsct.model.AreaClassificationMajor; 4 | import org.cpsolver.studentsct.model.Student; 5 | 6 | /** 7 | * This student filter accepts only freshman students. 8 | * 9 | * @author Tomas Muller 10 | * @version StudentSct 1.3 (Student Sectioning)
11 | * Copyright (C) 2007 - 2014 Tomas Muller
12 | * muller@unitime.org
13 | * http://muller.unitime.org
14 | *
15 | * This library is free software; you can redistribute it and/or modify 16 | * it under the terms of the GNU Lesser General Public License as 17 | * published by the Free Software Foundation; either version 3 of the 18 | * License, or (at your option) any later version.
19 | *
20 | * This library is distributed in the hope that it will be useful, but 21 | * WITHOUT ANY WARRANTY; without even the implied warranty of 22 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 23 | * Lesser General Public License for more details.
24 | *
25 | * You should have received a copy of the GNU Lesser General Public 26 | * License along with this library; if not see 27 | * http://www.gnu.org/licenses/. 28 | */ 29 | 30 | public class FreshmanStudentFilter implements StudentFilter { 31 | 32 | public FreshmanStudentFilter() { 33 | } 34 | 35 | /** 36 | * Accept student. Student is accepted if it is freshmen, i.e., academic 37 | * area classification code is A, 01, or 02. 38 | **/ 39 | @Override 40 | public boolean accept(Student student) { 41 | for (AreaClassificationMajor aac : student.getAreaClassificationMajors()) { 42 | if ("A".equals(aac.getClassification())) 43 | return true; // First Year 44 | if ("01".equals(aac.getClassification())) 45 | return true; // First Semester Freshman 46 | if ("02".equals(aac.getClassification())) 47 | return true; // Second Semester Freshman 48 | } 49 | return false; 50 | } 51 | 52 | @Override 53 | public String getName() { 54 | return "Freshman"; 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /src/org/cpsolver/studentsct/filter/PriortyStudentFilter.java: -------------------------------------------------------------------------------- 1 | package org.cpsolver.studentsct.filter; 2 | 3 | import org.cpsolver.studentsct.model.Student; 4 | import org.cpsolver.studentsct.model.Student.StudentPriority; 5 | 6 | /** 7 | * This student filter only accepts students that are flagged as priority students. 8 | * 9 | * @author Tomas Muller 10 | * @version StudentSct 1.3 (Student Sectioning)
11 | * Copyright (C) 2007 - 2014 Tomas Muller
12 | * muller@unitime.org
13 | * http://muller.unitime.org
14 | *
15 | * This library is free software; you can redistribute it and/or modify 16 | * it under the terms of the GNU Lesser General Public License as 17 | * published by the Free Software Foundation; either version 3 of the 18 | * License, or (at your option) any later version.
19 | *
20 | * This library is distributed in the hope that it will be useful, but 21 | * WITHOUT ANY WARRANTY; without even the implied warranty of 22 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 23 | * Lesser General Public License for more details.
24 | *
25 | * You should have received a copy of the GNU Lesser General Public 26 | * License along with this library; if not see 27 | * http://www.gnu.org/licenses/. 28 | */ 29 | public class PriortyStudentFilter implements StudentFilter { 30 | StudentPriority iPriority = StudentPriority.Priority; 31 | boolean iIncludeHigherPriority = true; 32 | 33 | public PriortyStudentFilter(StudentPriority priority, boolean includeHigherPriority) { 34 | iPriority = priority; iIncludeHigherPriority = includeHigherPriority; 35 | } 36 | 37 | @Override 38 | public boolean accept(Student student) { 39 | if (student.isDummy()) return false; 40 | if (iIncludeHigherPriority) { 41 | return iPriority.isSameOrHigher(student); 42 | } else { 43 | return iPriority.isSame(student); 44 | } 45 | } 46 | 47 | @Override 48 | public String getName() { 49 | return iPriority.name() + (iIncludeHigherPriority ? "+" : ""); 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/org/cpsolver/studentsct/filter/RealStudentFilter.java: -------------------------------------------------------------------------------- 1 | package org.cpsolver.studentsct.filter; 2 | 3 | import org.cpsolver.studentsct.model.Student; 4 | 5 | /** 6 | * This student filter accepts only real students (last-like students are 7 | * rejected). 8 | * 9 | * @author Tomas Muller 10 | * @version StudentSct 1.3 (Student Sectioning)
11 | * Copyright (C) 2007 - 2014 Tomas Muller
12 | * muller@unitime.org
13 | * http://muller.unitime.org
14 | *
15 | * This library is free software; you can redistribute it and/or modify 16 | * it under the terms of the GNU Lesser General Public License as 17 | * published by the Free Software Foundation; either version 3 of the 18 | * License, or (at your option) any later version.
19 | *
20 | * This library is distributed in the hope that it will be useful, but 21 | * WITHOUT ANY WARRANTY; without even the implied warranty of 22 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 23 | * Lesser General Public License for more details.
24 | *
25 | * You should have received a copy of the GNU Lesser General Public 26 | * License along with this library; if not see 27 | * http://www.gnu.org/licenses/. 28 | */ 29 | 30 | public class RealStudentFilter implements StudentFilter { 31 | 32 | public RealStudentFilter() { 33 | } 34 | 35 | /** 36 | * Accept student. Student is accepted if {@link Student#isDummy()} is 37 | * false. 38 | **/ 39 | @Override 40 | public boolean accept(Student student) { 41 | return !student.isDummy(); 42 | } 43 | 44 | @Override 45 | public String getName() { 46 | return "Real"; 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/org/cpsolver/studentsct/filter/ReverseStudentFilter.java: -------------------------------------------------------------------------------- 1 | package org.cpsolver.studentsct.filter; 2 | 3 | import org.cpsolver.studentsct.model.Student; 4 | 5 | /** 6 | * This student filter accepts students that are not accepted by the provided 7 | * student filter. 8 | * 9 | * @author Tomas Muller 10 | * @version StudentSct 1.3 (Student Sectioning)
11 | * Copyright (C) 2007 - 2014 Tomas Muller
12 | * muller@unitime.org
13 | * http://muller.unitime.org
14 | *
15 | * This library is free software; you can redistribute it and/or modify 16 | * it under the terms of the GNU Lesser General Public License as 17 | * published by the Free Software Foundation; either version 3 of the 18 | * License, or (at your option) any later version.
19 | *
20 | * This library is distributed in the hope that it will be useful, but 21 | * WITHOUT ANY WARRANTY; without even the implied warranty of 22 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 23 | * Lesser General Public License for more details.
24 | *
25 | * You should have received a copy of the GNU Lesser General Public 26 | * License along with this library; if not see 27 | * http://www.gnu.org/licenses/. 28 | */ 29 | 30 | public class ReverseStudentFilter implements StudentFilter { 31 | private StudentFilter iFilter = null; 32 | 33 | /** 34 | * Constructor 35 | * 36 | * @param filter 37 | * student filter that is to be reversed 38 | */ 39 | public ReverseStudentFilter(StudentFilter filter) { 40 | iFilter = filter; 41 | } 42 | 43 | /** 44 | * Accept student. Student is accepted if the provided student filter 45 | * refuses him/her. 46 | **/ 47 | @Override 48 | public boolean accept(Student student) { 49 | return (iFilter == null ? false : !iFilter.accept(student)); 50 | } 51 | 52 | @Override 53 | public String getName() { 54 | return "NOT " + iFilter.getName(); 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /src/org/cpsolver/studentsct/filter/StudentFilter.java: -------------------------------------------------------------------------------- 1 | package org.cpsolver.studentsct.filter; 2 | 3 | import org.cpsolver.studentsct.StudentSectioningXMLLoader; 4 | import org.cpsolver.studentsct.Test; 5 | import org.cpsolver.studentsct.model.Student; 6 | 7 | /** 8 | * Interface for filter students based on academic area classifications, majors, 9 | * or minors. This interface can be used by {@link StudentSectioningXMLLoader} 10 | * to load only subset of all students, and it is used by {@link Test} to 11 | * combine last-like and real students from two XML files. 12 | * 13 | * @author Tomas Muller 14 | * @version StudentSct 1.3 (Student Sectioning)
15 | * Copyright (C) 2007 - 2014 Tomas Muller
16 | * muller@unitime.org
17 | * http://muller.unitime.org
18 | *
19 | * This library is free software; you can redistribute it and/or modify 20 | * it under the terms of the GNU Lesser General Public License as 21 | * published by the Free Software Foundation; either version 3 of the 22 | * License, or (at your option) any later version.
23 | *
24 | * This library is distributed in the hope that it will be useful, but 25 | * WITHOUT ANY WARRANTY; without even the implied warranty of 26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 27 | * Lesser General Public License for more details.
28 | *
29 | * You should have received a copy of the GNU Lesser General Public 30 | * License along with this library; if not see 31 | * http://www.gnu.org/licenses/. 32 | */ 33 | 34 | public interface StudentFilter { 35 | /** Accept student 36 | * @param student a student 37 | * @return true if the student is to be accepted (sectioned)*/ 38 | public boolean accept(Student student); 39 | 40 | /** 41 | * Filter name 42 | */ 43 | public String getName(); 44 | } 45 | -------------------------------------------------------------------------------- /src/org/cpsolver/studentsct/filter/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Various student filters. 3 | * 4 | * @author Tomas Muller 5 | * @version IFS 1.4 (Instructor Sectioning)
6 | * Copyright (C) 2024 Tomas Muller
7 | * muller@unitime.org
8 | * http://muller.unitime.org
9 | *
10 | * This library is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU Lesser General Public License as 12 | * published by the Free Software Foundation; either version 3 of the 13 | * License, or (at your option) any later version.
14 | *
15 | * This library is distributed in the hope that it will be useful, but 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | * Lesser General Public License for more details.
19 | *
20 | * You should have received a copy of the GNU Lesser General Public 21 | * License along with this library; if not see 22 | * http://www.gnu.org/licenses/. 23 | */ 24 | package org.cpsolver.studentsct.filter; -------------------------------------------------------------------------------- /src/org/cpsolver/studentsct/heuristics/AssignmentCheck.java: -------------------------------------------------------------------------------- 1 | package org.cpsolver.studentsct.heuristics; 2 | 3 | import org.cpsolver.ifs.assignment.Assignment; 4 | import org.cpsolver.ifs.model.Value; 5 | import org.cpsolver.ifs.model.Variable; 6 | 7 | /** 8 | * Simple interface providing an assignment check for the {@link EnrollmentSelection}. 9 | * 10 | * @author Tomas Muller 11 | * @version StudentSct 1.3 (Student Sectioning)
12 | * Copyright (C) 2007 - 2014 Tomas Muller
13 | * muller@unitime.org
14 | * http://muller.unitime.org
15 | *
16 | * This library is free software; you can redistribute it and/or modify 17 | * it under the terms of the GNU Lesser General Public License as 18 | * published by the Free Software Foundation; either version 3 of the 19 | * License, or (at your option) any later version.
20 | *
21 | * This library is distributed in the hope that it will be useful, but 22 | * WITHOUT ANY WARRANTY; without even the implied warranty of 23 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 24 | * Lesser General Public License for more details.
25 | *
26 | * You should have received a copy of the GNU Lesser General Public 27 | * License along with this library; if not see 28 | * http://www.gnu.org/licenses/. 29 | */ 30 | public interface AssignmentCheck, T extends Value> { 31 | 32 | /** 33 | * Check whether the given conflict can be unassigned 34 | * @param value value to be assigned 35 | * @param conflict conflicting value 36 | * @param assignment current assignment 37 | * @return true if the conflict can be unassigned due to the given value 38 | */ 39 | public boolean canUnassign(T value, T conflict, Assignment assignment); 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/org/cpsolver/studentsct/heuristics/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Student Sectioning: Heuristics. 3 | * 4 | * @author Tomas Muller 5 | * @version IFS 1.4 (Instructor Sectioning)
6 | * Copyright (C) 2024 Tomas Muller
7 | * muller@unitime.org
8 | * http://muller.unitime.org
9 | *
10 | * This library is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU Lesser General Public License as 12 | * published by the Free Software Foundation; either version 3 of the 13 | * License, or (at your option) any later version.
14 | *
15 | * This library is distributed in the hope that it will be useful, but 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | * Lesser General Public License for more details.
19 | *
20 | * You should have received a copy of the GNU Lesser General Public 21 | * License along with this library; if not see 22 | * http://www.gnu.org/licenses/. 23 | */ 24 | package org.cpsolver.studentsct.heuristics; -------------------------------------------------------------------------------- /src/org/cpsolver/studentsct/heuristics/selection/ProblemStudentsProvider.java: -------------------------------------------------------------------------------- 1 | package org.cpsolver.studentsct.heuristics.selection; 2 | 3 | import java.util.Set; 4 | 5 | import org.cpsolver.studentsct.model.Student; 6 | 7 | 8 | /** 9 | * An interface to pass the list problematic students computed by a neighbour 10 | * selection to the next neighbour selection. 11 | * 12 | * @author Tomas Muller 13 | * @version StudentSct 1.3 (Student Sectioning)
14 | * Copyright (C) 2007 - 2014 Tomas Muller
15 | * muller@unitime.org
16 | * http://muller.unitime.org
17 | *
18 | * This library is free software; you can redistribute it and/or modify 19 | * it under the terms of the GNU Lesser General Public License as 20 | * published by the Free Software Foundation; either version 3 of the 21 | * License, or (at your option) any later version.
22 | *
23 | * This library is distributed in the hope that it will be useful, but 24 | * WITHOUT ANY WARRANTY; without even the implied warranty of 25 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 26 | * Lesser General Public License for more details.
27 | *
28 | * You should have received a copy of the GNU Lesser General Public 29 | * License along with this library; if not see 30 | * http://www.gnu.org/licenses/. 31 | */ 32 | 33 | public interface ProblemStudentsProvider { 34 | /** Set of problematic students ({@link Student} objects). 35 | * @return set of problematic students 36 | **/ 37 | public Set getProblemStudents(); 38 | } 39 | -------------------------------------------------------------------------------- /src/org/cpsolver/studentsct/heuristics/selection/UnassignedCriticalCourseRequestSelection.java: -------------------------------------------------------------------------------- 1 | package org.cpsolver.studentsct.heuristics.selection; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Collections; 5 | import java.util.LinkedList; 6 | import java.util.List; 7 | import java.util.Queue; 8 | 9 | import org.cpsolver.ifs.heuristics.VariableSelection; 10 | import org.cpsolver.ifs.solution.Solution; 11 | import org.cpsolver.ifs.solver.Solver; 12 | import org.cpsolver.studentsct.model.Enrollment; 13 | import org.cpsolver.studentsct.model.Request; 14 | import org.cpsolver.studentsct.model.Request.RequestPriority; 15 | 16 | public class UnassignedCriticalCourseRequestSelection implements VariableSelection{ 17 | protected Queue iRequests = null; 18 | private RequestPriority iPriority = null; 19 | 20 | UnassignedCriticalCourseRequestSelection(RequestPriority priority) { 21 | iPriority = priority; 22 | } 23 | 24 | 25 | @Override 26 | public void init(Solver solver) { 27 | iRequests = new LinkedList(); 28 | } 29 | 30 | @Override 31 | public Request selectVariable(Solution solution) { 32 | return nextRequest(solution); 33 | } 34 | 35 | protected synchronized Request nextRequest(Solution solution) { 36 | Request ret = iRequests.poll(); 37 | if (ret == null) { 38 | List variables = new ArrayList(); 39 | for (Request r: solution.getModel().unassignedVariables(solution.getAssignment())) 40 | if (iPriority.isCritical(r)) variables.add(r); 41 | Collections.shuffle(variables); 42 | iRequests.addAll(variables); 43 | ret = iRequests.poll(); 44 | } 45 | return ret; 46 | } 47 | } -------------------------------------------------------------------------------- /src/org/cpsolver/studentsct/heuristics/selection/UnassignedRequestSelection.java: -------------------------------------------------------------------------------- 1 | package org.cpsolver.studentsct.heuristics.selection; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Collections; 5 | import java.util.LinkedList; 6 | import java.util.List; 7 | import java.util.Queue; 8 | 9 | import org.cpsolver.ifs.heuristics.VariableSelection; 10 | import org.cpsolver.ifs.solution.Solution; 11 | import org.cpsolver.ifs.solver.Solver; 12 | import org.cpsolver.studentsct.filter.StudentFilter; 13 | import org.cpsolver.studentsct.model.Enrollment; 14 | import org.cpsolver.studentsct.model.FreeTimeRequest; 15 | import org.cpsolver.studentsct.model.Request; 16 | 17 | public class UnassignedRequestSelection implements VariableSelection{ 18 | protected int iNrRounds = 0; 19 | protected Queue iRequests = null; 20 | protected StudentFilter iFilter = null; 21 | 22 | @Override 23 | public void init(Solver solver) { 24 | iRequests = new LinkedList(); 25 | iNrRounds = solver.getProperties().getPropertyInt("UnassignedRequestSelection.NrRounds", 1); 26 | } 27 | 28 | @Override 29 | public Request selectVariable(Solution solution) { 30 | return nextRequest(solution); 31 | } 32 | 33 | protected synchronized Request nextRequest(Solution solution) { 34 | if (iRequests.isEmpty() && iNrRounds > 0) { 35 | iNrRounds --; 36 | List variables = new ArrayList(); 37 | for (Request r: solution.getModel().unassignedVariables(solution.getAssignment())) { 38 | if (r instanceof FreeTimeRequest) continue; 39 | if (iFilter == null || iFilter.accept(r.getStudent())) 40 | variables.add(r); 41 | } 42 | Collections.shuffle(variables); 43 | iRequests.addAll(variables); 44 | } 45 | return iRequests.poll(); 46 | } 47 | 48 | /** 49 | * Only consider students meeting the given filter. 50 | */ 51 | public StudentFilter getFilter() { return iFilter; } 52 | 53 | /** 54 | * Only consider students meeting the given filter. 55 | */ 56 | public UnassignedRequestSelection withFilter(StudentFilter filter) { iFilter = filter; return this; } 57 | } -------------------------------------------------------------------------------- /src/org/cpsolver/studentsct/heuristics/selection/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Student Sectioning: Various Neighbour Selection Criteria. 3 | *
4 | *
5 | * These criteria are used by {@link org.cpsolver.studentsct.heuristics.StudentSctNeighbourSelection}. 6 | * 7 | * @author Tomas Muller 8 | * @version IFS 1.4 (Instructor Sectioning)
9 | * Copyright (C) 2024 Tomas Muller
10 | * muller@unitime.org
11 | * http://muller.unitime.org
12 | *
13 | * This library is free software; you can redistribute it and/or modify 14 | * it under the terms of the GNU Lesser General Public License as 15 | * published by the Free Software Foundation; either version 3 of the 16 | * License, or (at your option) any later version.
17 | *
18 | * This library is distributed in the hope that it will be useful, but 19 | * WITHOUT ANY WARRANTY; without even the implied warranty of 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 21 | * Lesser General Public License for more details.
22 | *
23 | * You should have received a copy of the GNU Lesser General Public 24 | * License along with this library; if not see 25 | * http://www.gnu.org/licenses/. 26 | */ 27 | package org.cpsolver.studentsct.heuristics.selection; -------------------------------------------------------------------------------- /src/org/cpsolver/studentsct/heuristics/studentord/StudentByPriorityRequestDate.java: -------------------------------------------------------------------------------- 1 | package org.cpsolver.studentsct.heuristics.studentord; 2 | 3 | import org.cpsolver.ifs.util.DataProperties; 4 | import org.cpsolver.studentsct.model.CourseRequest; 5 | import org.cpsolver.studentsct.model.Student; 6 | 7 | /** 8 | * Return the given set of students in an order of student priority, and 9 | * when of the same priority of average course request 10 | * time stamp {@link CourseRequest#getTimeStamp()}. If the time stamp 11 | * is the same (or not set), fall back to the number of choices 12 | * (student with fewer choices first). 13 | * 14 | * @author Tomas Muller 15 | * @version StudentSct 1.3 (Student Sectioning)
16 | * Copyright (C) 2007 - 2021 Tomas Muller
17 | * muller@unitime.org
18 | * http://muller.unitime.org
19 | *
20 | * This library is free software; you can redistribute it and/or modify 21 | * it under the terms of the GNU Lesser General Public License as 22 | * published by the Free Software Foundation; either version 3 of the 23 | * License, or (at your option) any later version.
24 | *
25 | * This library is distributed in the hope that it will be useful, but 26 | * WITHOUT ANY WARRANTY; without even the implied warranty of 27 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 28 | * Lesser General Public License for more details.
29 | *
30 | * You should have received a copy of the GNU Lesser General Public 31 | * License along with this library; if not see 32 | * http://www.gnu.org/licenses/. 33 | */ 34 | public class StudentByPriorityRequestDate extends StudentByRequestDate { 35 | 36 | public StudentByPriorityRequestDate(DataProperties config) { 37 | super(config); 38 | } 39 | 40 | @Override 41 | public int compare(Student s1, Student s2) { 42 | if (s1.getPriority() != s2.getPriority()) return (s1.getPriority().ordinal() < s2.getPriority().ordinal() ? -1 : 1); 43 | return super.compare(s1, s2); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/org/cpsolver/studentsct/heuristics/studentord/StudentChoiceRealFirstOrder.java: -------------------------------------------------------------------------------- 1 | package org.cpsolver.studentsct.heuristics.studentord; 2 | 3 | import org.cpsolver.ifs.util.DataProperties; 4 | import org.cpsolver.studentsct.model.Student; 5 | 6 | /** 7 | * Return the given set of students in an order of average number of choices of 8 | * each student (students with more choices first), however, real student are 9 | * before last-like students. By default, the order is reversed (students with 10 | * less choices first). 11 | * 12 | * @author Tomas Muller 13 | * @version StudentSct 1.3 (Student Sectioning)
14 | * Copyright (C) 2007 - 2014 Tomas Muller
15 | * muller@unitime.org
16 | * http://muller.unitime.org
17 | *
18 | * This library is free software; you can redistribute it and/or modify 19 | * it under the terms of the GNU Lesser General Public License as 20 | * published by the Free Software Foundation; either version 3 of the 21 | * License, or (at your option) any later version.
22 | *
23 | * This library is distributed in the hope that it will be useful, but 24 | * WITHOUT ANY WARRANTY; without even the implied warranty of 25 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 26 | * Lesser General Public License for more details.
27 | *
28 | * You should have received a copy of the GNU Lesser General Public 29 | * License along with this library; if not see 30 | * http://www.gnu.org/licenses/. 31 | */ 32 | public class StudentChoiceRealFirstOrder extends StudentChoiceOrder { 33 | 34 | public StudentChoiceRealFirstOrder(DataProperties config) { 35 | super(config); 36 | } 37 | 38 | public StudentChoiceRealFirstOrder() { 39 | super(new DataProperties()); 40 | setReverse(true); 41 | } 42 | 43 | @Override 44 | public int compare(Student s1, Student s2) { 45 | if (s1.isDummy()) { 46 | if (!s2.isDummy()) 47 | return 1; 48 | } else if (s2.isDummy()) 49 | return -1; 50 | return super.compare(s1, s2); 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /src/org/cpsolver/studentsct/heuristics/studentord/StudentOrder.java: -------------------------------------------------------------------------------- 1 | package org.cpsolver.studentsct.heuristics.studentord; 2 | 3 | import java.util.List; 4 | 5 | import org.cpsolver.studentsct.model.Student; 6 | 7 | 8 | /** 9 | * This interface is used by online selectioning test to take students in a 10 | * particular order, parameter Test.StudentOrder. 11 | * 12 | * @author Tomas Muller 13 | * @version StudentSct 1.3 (Student Sectioning)
14 | * Copyright (C) 2007 - 2014 Tomas Muller
15 | * muller@unitime.org
16 | * http://muller.unitime.org
17 | *
18 | * This library is free software; you can redistribute it and/or modify 19 | * it under the terms of the GNU Lesser General Public License as 20 | * published by the Free Software Foundation; either version 3 of the 21 | * License, or (at your option) any later version.
22 | *
23 | * This library is distributed in the hope that it will be useful, but 24 | * WITHOUT ANY WARRANTY; without even the implied warranty of 25 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 26 | * Lesser General Public License for more details.
27 | *
28 | * You should have received a copy of the GNU Lesser General Public 29 | * License along with this library; if not see 30 | * http://www.gnu.org/licenses/. 31 | */ 32 | public interface StudentOrder { 33 | /** Return the given set of students in a particular order 34 | * @param students input list of students 35 | * @return new list of students, ordered by this criterion 36 | **/ 37 | public List order(List students); 38 | } 39 | -------------------------------------------------------------------------------- /src/org/cpsolver/studentsct/heuristics/studentord/StudentRandomOrder.java: -------------------------------------------------------------------------------- 1 | package org.cpsolver.studentsct.heuristics.studentord; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Collections; 5 | import java.util.List; 6 | 7 | import org.cpsolver.ifs.util.DataProperties; 8 | import org.cpsolver.studentsct.model.Student; 9 | 10 | 11 | /** 12 | * Return the given set of students in a random order 13 | * 14 | * @author Tomas Muller 15 | * @version StudentSct 1.3 (Student Sectioning)
16 | * Copyright (C) 2007 - 2014 Tomas Muller
17 | * muller@unitime.org
18 | * http://muller.unitime.org
19 | *
20 | * This library is free software; you can redistribute it and/or modify 21 | * it under the terms of the GNU Lesser General Public License as 22 | * published by the Free Software Foundation; either version 3 of the 23 | * License, or (at your option) any later version.
24 | *
25 | * This library is distributed in the hope that it will be useful, but 26 | * WITHOUT ANY WARRANTY; without even the implied warranty of 27 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 28 | * Lesser General Public License for more details.
29 | *
30 | * You should have received a copy of the GNU Lesser General Public 31 | * License along with this library; if not see 32 | * http://www.gnu.org/licenses/. 33 | */ 34 | public class StudentRandomOrder implements StudentOrder { 35 | 36 | public StudentRandomOrder(DataProperties config) { 37 | } 38 | 39 | /** Return the given set of students in a random order */ 40 | @Override 41 | public List order(List students) { 42 | List ret = new ArrayList(students); 43 | Collections.shuffle(ret); 44 | return ret; 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/org/cpsolver/studentsct/heuristics/studentord/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Online Student Sectioning Test: various students orderings 3 | * 4 | * @author Tomas Muller 5 | * @version IFS 1.4 (Instructor Sectioning)
6 | * Copyright (C) 2024 Tomas Muller
7 | * muller@unitime.org
8 | * http://muller.unitime.org
9 | *
10 | * This library is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU Lesser General Public License as 12 | * published by the Free Software Foundation; either version 3 of the 13 | * License, or (at your option) any later version.
14 | *
15 | * This library is distributed in the hope that it will be useful, but 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | * Lesser General Public License for more details.
19 | *
20 | * You should have received a copy of the GNU Lesser General Public 21 | * License along with this library; if not see 22 | * http://www.gnu.org/licenses/. 23 | */ 24 | package org.cpsolver.studentsct.heuristics.studentord; -------------------------------------------------------------------------------- /src/org/cpsolver/studentsct/model/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Student Sectioning: Model. 3 | * 4 | * @author Tomas Muller 5 | * @version IFS 1.4 (Instructor Sectioning)
6 | * Copyright (C) 2024 Tomas Muller
7 | * muller@unitime.org
8 | * http://muller.unitime.org
9 | *
10 | * This library is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU Lesser General Public License as 12 | * published by the Free Software Foundation; either version 3 of the 13 | * License, or (at your option) any later version.
14 | *
15 | * This library is distributed in the hope that it will be useful, but 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | * Lesser General Public License for more details.
19 | *
20 | * You should have received a copy of the GNU Lesser General Public 21 | * License along with this library; if not see 22 | * http://www.gnu.org/licenses/. 23 | */ 24 | package org.cpsolver.studentsct.model; -------------------------------------------------------------------------------- /src/org/cpsolver/studentsct/online/OnlineConfig.java: -------------------------------------------------------------------------------- 1 | package org.cpsolver.studentsct.online; 2 | 3 | import org.cpsolver.studentsct.model.Config; 4 | import org.cpsolver.studentsct.model.Offering; 5 | 6 | /** 7 | * An online configuration. A simple extension of the {@link Config} class that allows to set the current configuration enrollment. 8 | * This class is particularly useful when a model containing only the given student is constructed (to provide him/her with a schedule or suggestions). 9 | * 10 | * @author Tomas Muller 11 | * @version StudentSct 1.3 (Student Sectioning)
12 | * Copyright (C) 2014 Tomas Muller
13 | * muller@unitime.org
14 | * http://muller.unitime.org
15 | *
16 | * This library is free software; you can redistribute it and/or modify 17 | * it under the terms of the GNU Lesser General Public License as 18 | * published by the Free Software Foundation; either version 3 of the 19 | * License, or (at your option) any later version.
20 | *
21 | * This library is distributed in the hope that it will be useful, but 22 | * WITHOUT ANY WARRANTY; without even the implied warranty of 23 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 24 | * Lesser General Public License for more details.
25 | *
26 | * You should have received a copy of the GNU Lesser General Public 27 | * License along with this library; if not see http://www.gnu.org/licenses. 28 | * 29 | */ 30 | public class OnlineConfig extends Config { 31 | private int iEnrollment = 0; 32 | 33 | public OnlineConfig(long id, int limit, String name, Offering offering) { 34 | super(id, limit, name, offering); 35 | } 36 | 37 | /** 38 | * Set current enrollment 39 | * @param enrollment current enrollment 40 | */ 41 | public void setEnrollment(int enrollment) { iEnrollment = enrollment; } 42 | 43 | /** 44 | * Get current enrollment 45 | * @return current enrollment 46 | */ 47 | public int getEnrollment() { return iEnrollment; } 48 | } -------------------------------------------------------------------------------- /src/org/cpsolver/studentsct/online/expectations/MoreSpaceThanExpected.java: -------------------------------------------------------------------------------- 1 | package org.cpsolver.studentsct.online.expectations; 2 | 3 | import org.cpsolver.ifs.util.DataProperties; 4 | 5 | /** 6 | * A class is considered over-expected, when there less space available than expected. 7 | * Much like the {@link PercentageOverExpected}, but with no ability to adjust the expectations. 8 | * Expectation rounding can be defined by OverExpected.Rounding parameter, defaults to round 9 | * (other values are none, ceil, and floor).

10 | * Unlimited classes are never over-expected. A class is over-expected when the number of 11 | * enrolled students (including the student in question) + expectations is greater or equal 12 | * the section limit. 13 | * 14 | * @author Tomas Muller 15 | * @version StudentSct 1.3 (Student Sectioning)
16 | * Copyright (C) 2014 Tomas Muller
17 | * muller@unitime.org
18 | * http://muller.unitime.org
19 | *
20 | * This library is free software; you can redistribute it and/or modify 21 | * it under the terms of the GNU Lesser General Public License as 22 | * published by the Free Software Foundation; either version 3 of the 23 | * License, or (at your option) any later version.
24 | *
25 | * This library is distributed in the hope that it will be useful, but 26 | * WITHOUT ANY WARRANTY; without even the implied warranty of 27 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 28 | * Lesser General Public License for more details.
29 | *
30 | * You should have received a copy of the GNU Lesser General Public 31 | * License along with this library; if not see http://www.gnu.org/licenses. 33 | * 34 | */ 35 | public class MoreSpaceThanExpected extends PercentageOverExpected { 36 | 37 | public MoreSpaceThanExpected(DataProperties config) { 38 | super(config); 39 | setPercentage(1.0); 40 | } 41 | 42 | public MoreSpaceThanExpected() { 43 | super(); 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/org/cpsolver/studentsct/online/expectations/NeverOverExpected.java: -------------------------------------------------------------------------------- 1 | package org.cpsolver.studentsct.online.expectations; 2 | 3 | import org.cpsolver.ifs.assignment.Assignment; 4 | import org.cpsolver.ifs.util.DataProperties; 5 | import org.cpsolver.studentsct.model.Enrollment; 6 | import org.cpsolver.studentsct.model.Request; 7 | import org.cpsolver.studentsct.model.Section; 8 | 9 | /** 10 | * A section is never over-expected. 11 | * 12 | * @author Tomas Muller 13 | * @version StudentSct 1.3 (Student Sectioning)
14 | * Copyright (C) 2014 Tomas Muller
15 | * muller@unitime.org
16 | * http://muller.unitime.org
17 | *
18 | * This library is free software; you can redistribute it and/or modify 19 | * it under the terms of the GNU Lesser General Public License as 20 | * published by the Free Software Foundation; either version 3 of the 21 | * License, or (at your option) any later version.
22 | *
23 | * This library is distributed in the hope that it will be useful, but 24 | * WITHOUT ANY WARRANTY; without even the implied warranty of 25 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 26 | * Lesser General Public License for more details.
27 | *
28 | * You should have received a copy of the GNU Lesser General Public 29 | * License along with this library; if not see http://www.gnu.org/licenses. 30 | * 31 | */ 32 | public class NeverOverExpected implements OverExpectedCriterion { 33 | 34 | public NeverOverExpected(DataProperties config) { 35 | } 36 | 37 | @Override 38 | public double getOverExpected(Assignment assignment, Section section, Request request) { 39 | return 0.0; 40 | } 41 | 42 | @Override 43 | public Integer getExpected(int sectionLimit, double expectedSpace) { 44 | return null; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/org/cpsolver/studentsct/online/expectations/PenaltyNotNegative.java: -------------------------------------------------------------------------------- 1 | package org.cpsolver.studentsct.online.expectations; 2 | 3 | import org.cpsolver.ifs.assignment.Assignment; 4 | import org.cpsolver.ifs.util.DataProperties; 5 | import org.cpsolver.studentsct.model.Enrollment; 6 | import org.cpsolver.studentsct.model.Request; 7 | import org.cpsolver.studentsct.model.Section; 8 | 9 | /** 10 | * Class is over-expected when {@link Section#getPenalty()} is not negative. 11 | * 12 | * @author Tomas Muller 13 | * @version StudentSct 1.3 (Student Sectioning)
14 | * Copyright (C) 2014 Tomas Muller
15 | * muller@unitime.org
16 | * http://muller.unitime.org
17 | *
18 | * This library is free software; you can redistribute it and/or modify 19 | * it under the terms of the GNU Lesser General Public License as 20 | * published by the Free Software Foundation; either version 3 of the 21 | * License, or (at your option) any later version.
22 | *
23 | * This library is distributed in the hope that it will be useful, but 24 | * WITHOUT ANY WARRANTY; without even the implied warranty of 25 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 26 | * Lesser General Public License for more details.
27 | *
28 | * You should have received a copy of the GNU Lesser General Public 29 | * License along with this library; if not see http://www.gnu.org/licenses. 31 | * 32 | */ 33 | public class PenaltyNotNegative implements OverExpectedCriterion { 34 | 35 | public PenaltyNotNegative(DataProperties config) { 36 | } 37 | 38 | @Override 39 | public double getOverExpected(Assignment assignment, Section section, Request request) { 40 | if (section.getPenalty() < 0 || section.getLimit() <= 0.0) 41 | return 0.0; 42 | int subparts = section.getSubpart().getConfig().getSubparts().size(); 43 | return 1.0 / subparts; 44 | } 45 | 46 | @Override 47 | public String toString() { 48 | return "not-negative"; 49 | } 50 | 51 | @Override 52 | public Integer getExpected(int sectionLimit, double expectedSpace) { 53 | if (sectionLimit <= 0.0) 54 | return null; 55 | 56 | int expected = (int) Math.round(expectedSpace); 57 | if (expected > 0) 58 | return expected; 59 | 60 | return null; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/org/cpsolver/studentsct/online/expectations/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | *

3 | * Student Sectioning Solver: Over-Expectation Criteria. 4 | *

5 | *
6 | *
7 | * This package contains various criteria deciding when a sections is 8 | * over-expected. Over-expected sections are avoided (if possible). 9 | * Also, a student should never be given a suggestion that would increase the 10 | * over-expected penalization. 11 | * 12 | * @author Tomas Muller 13 | * @version IFS 1.4 (Instructor Sectioning)
14 | * Copyright (C) 2024 Tomas Muller
15 | * muller@unitime.org
16 | * http://muller.unitime.org
17 | *
18 | * This library is free software; you can redistribute it and/or modify 19 | * it under the terms of the GNU Lesser General Public License as 20 | * published by the Free Software Foundation; either version 3 of the 21 | * License, or (at your option) any later version.
22 | *
23 | * This library is distributed in the hope that it will be useful, but 24 | * WITHOUT ANY WARRANTY; without even the implied warranty of 25 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 26 | * Lesser General Public License for more details.
27 | *
28 | * You should have received a copy of the GNU Lesser General Public 29 | * License along with this library; if not see 30 | * http://www.gnu.org/licenses/. 31 | */ 32 | package org.cpsolver.studentsct.online.expectations; -------------------------------------------------------------------------------- /src/org/cpsolver/studentsct/online/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | *

3 | * Online Student Sectioning Solver. 4 | *

5 | *
6 | *
7 | * This package contains various extensions of the batch student sectioning problem, better supporting the ability 8 | * of online (real-time) student scheduling in UniTime. 9 | * 10 | * @author Tomas Muller 11 | * @version IFS 1.4 (Instructor Sectioning)
12 | * Copyright (C) 2024 Tomas Muller
13 | * muller@unitime.org
14 | * http://muller.unitime.org
15 | *
16 | * This library is free software; you can redistribute it and/or modify 17 | * it under the terms of the GNU Lesser General Public License as 18 | * published by the Free Software Foundation; either version 3 of the 19 | * License, or (at your option) any later version.
20 | *
21 | * This library is distributed in the hope that it will be useful, but 22 | * WITHOUT ANY WARRANTY; without even the implied warranty of 23 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 24 | * Lesser General Public License for more details.
25 | *
26 | * You should have received a copy of the GNU Lesser General Public 27 | * License along with this library; if not see 28 | * http://www.gnu.org/licenses/. 29 | */ 30 | package org.cpsolver.studentsct.online; -------------------------------------------------------------------------------- /src/org/cpsolver/studentsct/online/selection/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | *

3 | * Online Student Sectioning Solver: Selection Weights and Heuristics. 4 | *

5 | *
6 | *
7 | * This package contains various algorithms to provide student with an initial schedule and 8 | * with suggestions. There are also different weights, using multiple criteria with or without 9 | * counting on course request priorities. 10 | * 11 | * @author Tomas Muller 12 | * @version IFS 1.4 (Instructor Sectioning)
13 | * Copyright (C) 2024 Tomas Muller
14 | * muller@unitime.org
15 | * http://muller.unitime.org
16 | *
17 | * This library is free software; you can redistribute it and/or modify 18 | * it under the terms of the GNU Lesser General Public License as 19 | * published by the Free Software Foundation; either version 3 of the 20 | * License, or (at your option) any later version.
21 | *
22 | * This library is distributed in the hope that it will be useful, but 23 | * WITHOUT ANY WARRANTY; without even the implied warranty of 24 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 25 | * Lesser General Public License for more details.
26 | *
27 | * You should have received a copy of the GNU Lesser General Public 28 | * License along with this library; if not see 29 | * http://www.gnu.org/licenses/. 30 | */ 31 | package org.cpsolver.studentsct.online.selection; -------------------------------------------------------------------------------- /src/org/cpsolver/studentsct/report/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Student Sectioning: Various Reports. 3 | * 4 | * @author Tomas Muller 5 | * @version IFS 1.4 (Instructor Sectioning)
6 | * Copyright (C) 2024 Tomas Muller
7 | * muller@unitime.org
8 | * http://muller.unitime.org
9 | *
10 | * This library is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU Lesser General Public License as 12 | * published by the Free Software Foundation; either version 3 of the 13 | * License, or (at your option) any later version.
14 | *
15 | * This library is distributed in the hope that it will be useful, but 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | * Lesser General Public License for more details.
19 | *
20 | * You should have received a copy of the GNU Lesser General Public 21 | * License along with this library; if not see 22 | * http://www.gnu.org/licenses/. 23 | */ 24 | package org.cpsolver.studentsct.report; -------------------------------------------------------------------------------- /src/org/cpsolver/studentsct/weights/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Student Sectioning Weightings: various students weight models 3 | * 4 | * @author Tomas Muller 5 | * @version IFS 1.4 (Instructor Sectioning)
6 | * Copyright (C) 2024 Tomas Muller
7 | * muller@unitime.org
8 | * http://muller.unitime.org
9 | *
10 | * This library is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU Lesser General Public License as 12 | * published by the Free Software Foundation; either version 3 of the 13 | * License, or (at your option) any later version.
14 | *
15 | * This library is distributed in the hope that it will be useful, but 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | * Lesser General Public License for more details.
19 | *
20 | * You should have received a copy of the GNU Lesser General Public 21 | * License along with this library; if not see 22 | * http://www.gnu.org/licenses/. 23 | */ 24 | package org.cpsolver.studentsct.weights; --------------------------------------------------------------------------------