Back to index

fet  5.18.0
Defines | Functions | Variables
generate.cpp File Reference
#include <iomanip>
#include <iostream>
#include <ctime>
#include <QtAlgorithms>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include "timetable_defs.h"
#include "timetable.h"
#include "generate.h"
#include "rules.h"
#include "generate_pre.h"
#include "matrix.h"
#include <QMutex>
#include <QDateTime>
#include <QList>
#include <QSet>
#include <QSemaphore>

Go to the source code of this file.

Defines

#define nMinDaysBroken   (nMinDaysBrokenL[level])
#define selectedRoom   (selectedRoomL[level])
#define perm   (permL[level])
#define conflActivities   (conflActivitiesL[level])
#define nConflActivities   (nConflActivitiesL[level])
#define roomSlots   (roomSlotsL[level])

Functions

int max (qint16 a, int b)
bool skipRandom (double weightPercentage)
bool compareFunctionGenerate (int i, int j)

Variables

QMutex mutex
QSemaphore semaphorePlacedActivity
QSemaphore finishedSemaphore
Timetable gt
 The one and only instantiation of the main class.
static bool swappedActivities [MAX_ACTIVITIES]
static bool foundGoodSwap
static int restoreActIndex [4 *MAX_ACTIVITIES]
static int restoreTime [4 *MAX_ACTIVITIES]
static int restoreRoom [4 *MAX_ACTIVITIES]
static int nRestore
static int limitcallsrandomswap
const int MAX_LEVEL = 31
const int LEVEL_STOP_CONFLICTS_CALCULATION = MAX_LEVEL
static int level_limit
static int ncallsrandomswap
static int maxncallsrandomswap
Solution highestStageSolution
static QList< int > conflActivitiesTimeSlot
static int timeSlot
static int roomSlot
static Matrix2D< int > triedRemovals
static bool impossibleActivity
static int invPermutation [MAX_ACTIVITIES]
const int INF = 2000000000
static int tabu_size
static int crt_tabu_index
static Matrix1D< qint16 > tabu_activities
static Matrix1D< qint16 > tabu_times
static Matrix3D< qint16 > teachersTimetable
static Matrix3D< qint16 > subgroupsTimetable
static Matrix3D< qint16 > roomsTimetable
static Matrix3D< qint16 > newTeachersTimetable
static Matrix3D< qint16 > newSubgroupsTimetable
static Matrix2D< qint16 > newTeachersDayNHours
static Matrix2D< qint16 > newTeachersDayNGaps
static Matrix2D< qint16 > newSubgroupsDayNHours
static Matrix2D< qint16 > newSubgroupsDayNGaps
static Matrix2D< qint16 > newSubgroupsDayNFirstGaps
static Matrix3D< qint16 > oldTeachersTimetable
static Matrix3D< qint16 > oldSubgroupsTimetable
static Matrix2D< qint16 > oldTeachersDayNHours
static Matrix2D< qint16 > oldTeachersDayNGaps
static Matrix2D< qint16 > oldSubgroupsDayNHours
static Matrix2D< qint16 > oldSubgroupsDayNGaps
static Matrix2D< qint16 > oldSubgroupsDayNFirstGaps
static Matrix2D< qint16 > tchTimetable
static Matrix1D< qint16 > tchDayNHours
static Matrix1D< qint16 > tchDayNGaps
static Matrix2D< qint16 > sbgTimetable
static Matrix1D< qint16 > sbgDayNHours
static Matrix1D< qint16 > sbgDayNGaps
static Matrix1D< qint16 > sbgDayNFirstGaps
static Matrix2D< QList< int > > teacherActivitiesOfTheDay
int maxActivitiesPlaced
QDateTime generationStartDateTime
QDateTime generationHighestStageDateTime
const int MAX_RETRIES_FOR_AN_ACTIVITY_AT_LEVEL_0 = 400000
static Matrix1D< int > l0nWrong
static Matrix1D< int > l0minWrong
static Matrix1D< int > l0minIndexAct
static Matrix1D< QSet< int > > slotSetOfActivities
static Matrix1D< bool > slotCanEmpty
static Matrix1D< QSet< int > > activitiesAtTime
static double nMinDaysBrokenL [MAX_LEVEL][MAX_HOURS_PER_WEEK]
static int selectedRoomL [MAX_LEVEL][MAX_HOURS_PER_WEEK]
static int permL [MAX_LEVEL][MAX_HOURS_PER_WEEK]
static QList< int > conflActivitiesL [MAX_LEVEL][MAX_HOURS_PER_WEEK]
static int nConflActivitiesL [MAX_LEVEL][MAX_HOURS_PER_WEEK]
static int roomSlotsL [MAX_LEVEL][MAX_HOURS_PER_WEEK]
static int currentLevel

Define Documentation

#define conflActivities   (conflActivitiesL[level])

Definition at line 3288 of file generate.cpp.

#define nConflActivities   (nConflActivitiesL[level])

Definition at line 3290 of file generate.cpp.

#define nMinDaysBroken   (nMinDaysBrokenL[level])

Definition at line 3285 of file generate.cpp.

#define perm   (permL[level])

Definition at line 3287 of file generate.cpp.

#define roomSlots   (roomSlotsL[level])

Definition at line 3291 of file generate.cpp.

#define selectedRoom   (selectedRoomL[level])

Definition at line 3286 of file generate.cpp.


Function Documentation

bool compareFunctionGenerate ( int  i,
int  j 
) [inline]

Definition at line 3274 of file generate.cpp.

Here is the caller graph for this function:

int max ( qint16  a,
int  b 
) [inline]

Definition at line 194 of file generate.cpp.

                               {
       if(int(a)>=b)
              return int(a);
       else
              return b;
}

Here is the caller graph for this function:

bool skipRandom ( double  weightPercentage) [inline]

Definition at line 1592 of file generate.cpp.

{
       if(weightPercentage<0)
              return true; //non-existing constraint
              
       if(weightPercentage>=100.0)
              return false;

       double t=weightPercentage/100.0;
       assert(t>=0 && t<=1);
              
       t*=double(MM);
       int tt=int(floor(t+0.5));
       assert(tt>=0 && tt<=MM);
                                          
       int r=randomKnuth1MM1();
       assert(r>0 && r<MM); //r cannot be 0
       if(tt<=r)
              return true;
       else
              return false;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

Matrix1D<QSet<int> > activitiesAtTime [static]

Definition at line 190 of file generate.cpp.

Definition at line 3266 of file generate.cpp.

QList<int> conflActivitiesTimeSlot [static]

Definition at line 88 of file generate.cpp.

int crt_tabu_index [static]

Definition at line 106 of file generate.cpp.

int currentLevel [static]

Definition at line 3272 of file generate.cpp.

QSemaphore finishedSemaphore

Definition at line 53 of file timetablegenerateform.cpp.

bool foundGoodSwap [static]

Definition at line 64 of file generate.cpp.

Definition at line 177 of file generate.cpp.

Definition at line 176 of file generate.cpp.

The one and only instantiation of the main class.

Definition at line 99 of file fet.cpp.

Definition at line 83 of file generate.cpp.

bool impossibleActivity [static]

Definition at line 96 of file generate.cpp.

const int INF = 2000000000

Definition at line 100 of file generate.cpp.

Definition at line 98 of file generate.cpp.

Matrix1D<int> l0minIndexAct [static]

Definition at line 184 of file generate.cpp.

Matrix1D<int> l0minWrong [static]

Definition at line 183 of file generate.cpp.

Matrix1D<int> l0nWrong [static]

Definition at line 182 of file generate.cpp.

int level_limit [static]

Definition at line 78 of file generate.cpp.

Definition at line 76 of file generate.cpp.

int limitcallsrandomswap [static]

Definition at line 72 of file generate.cpp.

const int MAX_LEVEL = 31

Definition at line 74 of file generate.cpp.

Definition at line 179 of file generate.cpp.

Definition at line 174 of file generate.cpp.

int maxncallsrandomswap [static]

Definition at line 81 of file generate.cpp.

QMutex mutex

Definition at line 45 of file timetablegenerateform.cpp.

int ncallsrandomswap [static]

Definition at line 80 of file generate.cpp.

Definition at line 3268 of file generate.cpp.

Definition at line 134 of file generate.cpp.

Matrix2D<qint16> newSubgroupsDayNGaps [static]

Definition at line 133 of file generate.cpp.

Matrix2D<qint16> newSubgroupsDayNHours [static]

Definition at line 132 of file generate.cpp.

Matrix3D<qint16> newSubgroupsTimetable [static]

Definition at line 129 of file generate.cpp.

Matrix2D<qint16> newTeachersDayNGaps [static]

Definition at line 131 of file generate.cpp.

Matrix2D<qint16> newTeachersDayNHours [static]

Definition at line 130 of file generate.cpp.

Matrix3D<qint16> newTeachersTimetable [static]

Definition at line 128 of file generate.cpp.

Definition at line 3263 of file generate.cpp.

int nRestore [static]

Definition at line 70 of file generate.cpp.

Definition at line 150 of file generate.cpp.

Matrix2D<qint16> oldSubgroupsDayNGaps [static]

Definition at line 149 of file generate.cpp.

Matrix2D<qint16> oldSubgroupsDayNHours [static]

Definition at line 148 of file generate.cpp.

Matrix3D<qint16> oldSubgroupsTimetable [static]

Definition at line 145 of file generate.cpp.

Matrix2D<qint16> oldTeachersDayNGaps [static]

Definition at line 147 of file generate.cpp.

Matrix2D<qint16> oldTeachersDayNHours [static]

Definition at line 146 of file generate.cpp.

Matrix3D<qint16> oldTeachersTimetable [static]

Definition at line 144 of file generate.cpp.

Definition at line 3265 of file generate.cpp.

int restoreActIndex[4 *MAX_ACTIVITIES] [static]

Definition at line 67 of file generate.cpp.

int restoreRoom[4 *MAX_ACTIVITIES] [static]

Definition at line 69 of file generate.cpp.

int restoreTime[4 *MAX_ACTIVITIES] [static]

Definition at line 68 of file generate.cpp.

int roomSlot [static]

Definition at line 90 of file generate.cpp.

Definition at line 3269 of file generate.cpp.

Matrix3D<qint16> roomsTimetable [static]

Definition at line 118 of file generate.cpp.

Matrix1D<qint16> sbgDayNFirstGaps [static]

Definition at line 168 of file generate.cpp.

Matrix1D<qint16> sbgDayNGaps [static]

Definition at line 167 of file generate.cpp.

Matrix1D<qint16> sbgDayNHours [static]

Definition at line 166 of file generate.cpp.

Matrix2D<qint16> sbgTimetable [static]

Definition at line 165 of file generate.cpp.

Definition at line 3264 of file generate.cpp.

Definition at line 51 of file timetablegenerateform.cpp.

Matrix1D<bool> slotCanEmpty [static]

Definition at line 188 of file generate.cpp.

Matrix1D<QSet<int> > slotSetOfActivities [static]

Definition at line 187 of file generate.cpp.

Matrix3D<qint16> subgroupsTimetable [static]

Definition at line 117 of file generate.cpp.

Definition at line 62 of file generate.cpp.

Matrix1D<qint16> tabu_activities [static]

Definition at line 109 of file generate.cpp.

int tabu_size [static]

Definition at line 105 of file generate.cpp.

Matrix1D<qint16> tabu_times [static]

Definition at line 110 of file generate.cpp.

Matrix1D<qint16> tchDayNGaps [static]

Definition at line 163 of file generate.cpp.

Matrix1D<qint16> tchDayNHours [static]

Definition at line 162 of file generate.cpp.

Matrix2D<qint16> tchTimetable [static]

Definition at line 161 of file generate.cpp.

Matrix2D<QList<int> > teacherActivitiesOfTheDay [static]

Definition at line 172 of file generate.cpp.

Matrix3D<qint16> teachersTimetable [static]

Definition at line 116 of file generate.cpp.

int timeSlot [static]

Definition at line 89 of file generate.cpp.

Matrix2D<int> triedRemovals [static]

Definition at line 94 of file generate.cpp.