Sie sind auf Seite 1von 3

Although they re not guaranteed to find the optimal solution, they are

extremely good at finding close to optimal solutions within a reasonable timefra


me.
THE PROBLEM grade school
- available professors,
- available rooms,
- timeslots
- student groups.

Each class will be assigned a


- timeslot,
- a professor,
- a room
- a student group
by the class scheduler.

For each class scheduled by our application we will consider the


following hard constraints:
Classes can only be scheduled in free classrooms
A professor can only teach one class at any one time
Classrooms must be big enough to accommodate the student group
considering soft constraints can often make a big difference in the
quality of the timetables produced by the genetic algorithm.

1. ENCODING we ll begin by encoding the chromosome.


We can simply assign a numerical ID to each timeslot, professor and classroom.
We can then use a chromosome that encodes an array of integers our familiar
approach. This means each class that needs scheduling will only require three in
tegers
to encode it as shown below:
class 1 = (1,3,2)->(timesloID,roomID,professorID)
By splitting this array into chucks of three, we can retrieve
all of the information we need for each class.

INITIALIZATION
Let s first set up our supporting Java classes. We ll create a container class for
each of the data types above
1. room --> atributos(int roomId, String roomNumber, int capacity;)
2. timeslot --> atributos(int timeslotId, String timeslot)
3. professor --> atributos(int professorId, String professorName)
4. module --> atributos(int moduleId, String moduleCode, String module, int prof
essorIds[])
A module is what some might call a course , like Calculus 101 or American History
302 , and like real-life courses, can have multiple sections and groups of stud
ents
taking the course at different times of the week with different professors.
5. group --> atributos(int groupId, int groupSize, int moduleIds[])
The group class constructor accepts a group ID, a group size, and the module
IDs
the group is taking.
6. class --> atributos(int classId, int groupId, int moduleId)
The Class class represents a combination of all of the above. It represents a
student group taking a section of a module at a specific time, in a specific
room,
with a specific professor.
7. timetable
Now we can create a Timetable class to encapsulate all these objects into one
single timetable object.
The Timetable class also understands how to parse a chromosome and create a
candidate Timetable to be evaluated and scored.
a Timetable object knows all of the available rooms, timeslots, professors, etc.
, but
the Timetable object can also read a chromosome, create a subset of classes from
that chromosome, and help evaluate the fitness of the chromosome.

While each of these container classes is very simple they mostly define some
class properties, getters, and setters, with no real logic.

Creo que la mejor traduccin de "Off set" es "desplazamiento", al menos en lo que


respecta a la informtica.
Por ejemplo, muchos sistemas utilizan un tipo de direccionamiento de memoria que
consta de dos partes: La "base" y el "offset" con respcto a la base.
Por ejemplo, la direccin de memoria 123, podra direccionarse como Base=100 offset=
23
evaluation
it s important that the fitness function is designed well and provides an
accurate value for the individual s fitness. If the fitness function isn t well-desi
gned
it can take longer to find a solution which satisfies the minimum criteria, or p
ossibly,
fail to find an acceptable solution at all.
Fitness functions will often be the most computationally demanding components
of a genetic algorithm. Because of this, it s important that the fitness function
is also
well optimized helping to prevent bottlenecks and allowing the algorithm to run
efficiently.
k
Por qu? Porque lo que realmente significa para la JVM la conflictiva lnea 3 anterio
r, es Crear una nueva variable del tipo Person llamada personB y asginar la misma
referencia que tiene la variable personA , o simplemente Copiar la referencia (y n
o el contenido) de personA en una nueva variable del tipo Person llamada personB .
El resultado es que tenemos dos variables apuntando a una nica referencia (espac
io en memoria) en lugar de dos variables independientes con sus respectivas y di
ferentes referencias (espacios de memoria). As, cuando una de las dos variables c
ambia, cambian las dos. S, Java se orienta ms a punteros que a objetos, que es ms ti
l en programacin a bajo nivel y para ahorra unos bits; no en vano Java se bas en C
.
SEGMENTO
numero de casillas que ocupa este segmento
True si el segmento no se refiere a una clase, sino a un hueco libre

Das könnte Ihnen auch gefallen