Genetic algorithm in univeristy timetabling - scheduling

Can anybody help me understand how to apply a GA in timetabling?
Right now I understand the steps of a GA, but don't know how to implement them in my project.
Can somebody guide me? If there is any pseudocode or links to help me it will be very much appreciated.
This is my university project. I'm not asking for working code, just some idea n pseudocode on how to implement it.
Thanks in advance!

Take a look at Solving Timetable Problem by Genetic Algorithm and Heuristic Search Case Study: Universitas Pelita Harapan Timetable

Transform the problem into a integer representation using an array to represent the chromosomes in the population.
Example {1, 2 , 5, 3, 4, 6, 7, 5}
The index in the array represents courses and the number at each index represents the time slot that the course is assigned to on a day. Random populations can then be created and evaluated based on a fitness function that would take into consideration the students associated with each course, course size, and any other constraint that may be present. I have used this approach to solving a university final examination timetable and it has worked well.

Related

ml.net Predict an outcome using historical data

I am a complete to newbie to machine learning but I am trying to achieve following:
I have a series of data, let's say:
ie:
[ {'day1', 5}, {'day2', 3}, {'day3', 8} ... {'day100', 8}]
that at the end has a final result:
ie: pass/fail/other result
I would like to predict the most likely end result by using a partial set of data
ie: [{'day1', 3}, {'day2', 1}, {'day3', 6} ... {'day50', 8}]
What would be the best way to achieve this and if possible, do you have any examples or hint of where to look into that could help someone like me with no experience in machine learning
It is a time series prediction.
I'd suggest you check if your time series contain trend or seasonality. Then try conventional methods of time-series prediction as moving average (or sliding window) when you, for example, predict day 6 based on days 1-5, then day 7 based on days 2-6 etc. You may also try Exponential Smoothing and ARIMA.
Concerning ml.net, the following tutorial is the best solution for you
as it uses a Singular Spectrum Analysis and thus takes into consideration a trend and possible seasonality to forecast values. You can employ it by using
ssaforecastingestimator: put window = 25 and horizon=1 if you want to use the first 25 days to predict the value for day 26 (prediction one step forward). I suggest you take a smaller window though (5-7 days).

z3prover, how to randomize in c++

when in python, i can use
z3.set_param('auto_config', False,
'smt.phase_selection', 5,
'smt.arith.random_initial_value', True,
'smt.random_seed', np.random.randint(0, 655350),
'sat.phase', 'random',
'sat.random_seed', np.random.randint(0, 655350))
to get things work. Whereas in c++, the job is never done. I tried to set params with solver.set(), as well as using Z3_global_param_set. For boolean problems, I can only get the same model.
What i want to do is to randomize every first outcome of the model for the same solver. Randomizing the result means a lot to my current work. Can any one help me? Thanks a lot!
In short, I want to get randomized result for a problem every time i call solver.get_model(), for problems such as (in boolean)
if(b0, 1, 0)+if(b1, 1, 0)+if(b2, 1, 0)>1
Thanks again for reading my description.

How to create a Graph for a Uniform-cost Search in C++

Could anyone please help me how to graph a tree in C++ if I have the following input file to read it:
A,B,1.2,1
A,C,1.5,0
C,D,0.7,0
D,E,0.6,0
The first two columns are 2 nodes. The third column is the cost for moving from one node to another. The fourth column is the reliable status (1=reliable, 0=unreliable).
I have ideas on how to implement the search itself, but I'm having a hard time to graph a tree in my code from the input file.
I'm not asking for any code, I hope that someone could give me an idea or pseudo code on how to accomplish this task.
Thanks a lot in advance!
Chris
you can use ASCII values of characters to store as array index.
struct node{
double weight;
int reliability; //0 for reliable
}
now your graph will be 2D matrix of nodes.
in c/c++ you can use yourChar - 'A' to get index.
A as 0, B as 1 and so on...
If your are planning to go any further with graphs, take a look at the Boost Graph Library.

Two plus Two Poker hand evaluator: How are the cards mapped to the integers?

In an effort to create the fastest possible monte carlo texas hold'em hand analyzer with C++, I am currently looking into the subject of hand evaluation.
As many of you may know, there are quite a number of hand evaluators, open source, out there. After giving it some thought, I settled on the "Two Plus Two hand evaluator" (so named since it was first introduced on the two plus two forum).
This is one of the fastest known evaluators out there, and uses array lookups to quickly find the value of a hand.
Now, for the function, you need to pass in an array with the cards you are interested in. Example:
int Cards[] = { 3, 5, 10, 17, 23, 24, 32 };
int hv = HandValue(Cards);
With values between 1 and 52. Now, my question is: What cards do these integers correspond to? Is a 3 an ace of spades? A three of hearts? I have scoured google, the two + two forum, various pages where hand evaluators are presented, the source file for the build-up of the array. All in vain. So I am hoping that someone here can point me in the right direction of where I can find this information, or give it to me outright.
The source where the evaluators are taken from is this excellent article: http://www.codingthewheel.com/archives/poker-hand-evaluator-roundup#cactus_kev
Which explains all the evaluators individually.
I didn't verify this, but it appears to be:
"2c": 1,
"2d": 2,
"2h": 3,
"2s": 4,
"3c": 5,
"3d": 6,
...
"kh": 47,
"ks": 48,
"ac": 49,
"ad": 50,
"ah": 51,
"as": 52
ref: https://github.com/chenosaurus/poker-evaluator/blob/master/lib/PokerEvaluator.js

Poor mans Huffman Compression

Im trying to better understand how the huffman decoder works. Ive got a code table but im having a hard time trying to understand how the decoder would work because of ambiguity in the binary string.
(im learning this in prep for my final year at uni)
my table:
Data Hcode
0, 0
1, 1
2, 10
3, 11
17, 100
18, 101
19, 110
29, 111
If i have a huffman code string like 010011 i can return many different combinations of data so how can i discriminate?
i understand the huffman logic in BST representation and you follow a path to a given leaf which the path resembles the code for that given value between (0-255(ascii)) but i still dont know how you can discriminate between returning data: 0,1,0 or data: 0,17
do i really have to enforce 2 bit codes on data 0 and 1? (00 and 01)
i hope ive explained the best i can XD
If your wondering how I generated the table - your gonna kill me because i didnt use tree logic to generate it. Althought i sorted the data (random bytes) on frequency - i generated the Hcodes by converting the element position number into binary (hency why i called this post Poor Mans Huffman).
Many Thanks for any advice.
The code table is wrong. Huffman odes are supposed to be prefix free. This is neccessary in order to decode them afterwards without ambiguities.
If you would use a binary tree for creating the codes, this would automatically ensure the "prefix freeness". See: http://en.wikipedia.org/wiki/Huffman_coding
And now, I am going to kill you ... ;)
Not only is the code table wrong, the lengths of the codes are also wrong. If you have two one-bit codes, you have already used up all of the code space, and can have no other codes. What you have shown is not only not a Huffman code and not a prefix code -- it is in fact not a code at all.