Back to index

fet  5.18.0
Signals | Public Member Functions
GenerateMultipleThread Class Reference

#include <timetablegeneratemultipleform.h>

List of all members.

Signals

void timetableStarted (int timetable)
void timetableGenerated (int timetable, const QString &description, bool ok)
void finished ()

Public Member Functions

void run ()

Detailed Description

Definition at line 28 of file timetablegeneratemultipleform.h.


Member Function Documentation

Here is the caller graph for this function:

Definition at line 72 of file timetablegeneratemultipleform.cpp.

{
       genMulti.abortOptimization=false;
       
       time(&initial_time);

       for(int i=0; i<nTimetables; i++){
              time(&start_time);
       
              bool impossible;
              bool timeExceeded;
              
              for(int qq=0; qq<gt.rules.nInternalActivities; qq++)
                     permutation[qq]=savedPermutation[qq];
                     
              emit(timetableStarted(i+1));
              semaphoreTimetableStarted.acquire();

              genMulti.generate(timeLimit, impossible, timeExceeded, true); //true means threaded

              QString s;
              
              bool ok;

              mutex.lock();
              if(genMulti.abortOptimization){
                     mutex.unlock();
                     return;
              }
              else if(impossible){
                     s=tr("Timetable impossible to generate");
                     s+=QString(".");
                     ok=false;
              }
              else if(timeExceeded){
                     s=tr("Time exceeded for current timetable");

                     int mact=maxActivitiesPlaced;
                     int mseconds=genMulti.timeToHighestStage;

                     bool zero=false;
                     if(mseconds==0)
                            zero=true;
                     int hh=mseconds/3600;
                     mseconds%=3600;
                     int mm=mseconds/60;
                     mseconds%=60;
                     int ss=mseconds;

                     QString tim;
                     if(hh>0){
                            tim+=" ";
                            tim+=tr("%1 h", "hours").arg(hh);
                     }
                     if(mm>0){
                            tim+=" ";
                            tim+=tr("%1 m", "minutes").arg(mm);
                     }
                     if(ss>0 || zero){
                            tim+=" ";
                            tim+=tr("%1 s", "seconds").arg(ss);
                     }
                     tim.remove(0, 1);
                     s+=QString(". ");
                     s+=tr("Max placed activities: %1 (at %2)", "%1 represents the maximum number of activities placed, %2 is a time interval").arg(mact).arg(tim);

                     s+=QString(".");

                     ok=false;
              }
              else{
                     ok=true;
                     
                     time_t finish_time;
                     time(&finish_time);
                     int seconds=int(finish_time-start_time);
                     int hours=seconds/3600;
                     seconds%=3600;
                     int minutes=seconds/60;
                     seconds%=60;
                     
                     QString tmp;
                     genMulti.c.fitness(gt.rules, &tmp);
                     
                     s=tr("Timetable has %1 soft conflicts factor and was generated in %2 hours, %3 minutes and %4 seconds")
                      .arg(CustomFETString::number(genMulti.c.conflictsTotal))
                      .arg(hours)
                      .arg(minutes)
                      .arg(seconds);

                     s+=QString(".");
              }
              mutex.unlock();
              
              emit(timetableGenerated(i+1, s, ok));
              semaphoreTimetableFinished.acquire();
       }
       
       emit(finished());
}

Here is the call graph for this function:

void GenerateMultipleThread::timetableGenerated ( int  timetable,
const QString &  description,
bool  ok 
) [signal]

Here is the caller graph for this function:

void GenerateMultipleThread::timetableStarted ( int  timetable) [signal]

Here is the caller graph for this function:


The documentation for this class was generated from the following files: