Saturday, February 9, 2008

DPS906 Code Nearly Compete

I am nearly complete my game tree assignment. I have
  1. A Move Generator
  2. Transposition Tables
  3. AlphaBeta Pruning
its a little funny to get TT and AB working together, spent 8 hours on this last night (oy what a good feeling when it worked!). I got it to work in the end, but I am VERY confused as to why

You see, there is a line of code in my program which double checks the retreived from TT score vs the current alpha/beta values. This double check exists because, the first time you run into a board layout the alpha and beta values might be very different from the second time you run into a board layout. This took me a long time to fathom... but finally I did, and I started tweaking my code.

I started coding statements like "if the value of the TT check score is greater than alpha and below beta, the board does not need rescoring" (if current.beta > tt.score > current.alpha )"

However this doesn't work. What does work is this
if( sc.score_ <= nn->d._atLeast || sc.score_ >= nn->d._atMost )

SC being the TT check score and nn->d being a structure that holds the current alpha (atLeast) and beta (atMost).

Im very perplexed... oh well it works (and is the same as the literature I've read), Im just rather confused to why. I'll send Cathy an Email.

Friday, February 8, 2008

DPS906 Lecture 8

E=T-O -- error calculation

Wj = Wj + lr * Ij * E -- new weight calculation

Genetic Algorithm (GA)
- things evolve from other things... including solutions.

Solutions can evolve from other solutions.
- solutions need to be some sort of parameter list (called a string)
- create a gene (one possible solution)
- each gene needs to be evaluated for its fitness

start with initial population of randomly generated solutions(genes)
for the better solutions give them a % chance to be successful
This % chance is called "Relative Fitness"
eg
5 genes
g1 fitness = 5 (relative fitness is 5/15) [0.333]
g2 fitness = 3 (relative fitness is 3/15) [0.533]
g3 fitness = 4 (relative fitness is 4/15) [0.799]
g4 fitness = 1 (relative fitness is 1/15) [0.866]
g5 fitness = 2 (relative fitness is 2/15) [1]

now survival of the fittest pick 5 genes at random by rolling a dice which has values between 0 and 1

next operation is called cross over to form new genes. Then to restart the process.

mutation process... you randomly pick one spot on a gene and change it. You dont want to do mutations very often.

BTR820 Lecture 7

Citing vs Quoting

Quoting - using other words verbatim. (3 or more unusual words)

Citing - When you take someone elses idea. Or facts/info/methods. (facts that are not common knowledge to the audience you are writing to). You must cite if you summarize or paraphrase.

Difference between citing and footnotes/endnotes. Don't use for citation, use for parenthetical information.

... - when cutting out info from a quote .... when cutting out the end of the sentence. If ... is actually in the quote then use [...].

4 lines or more you use block quotes. (10 space indent)

Works Cited is only the works you cite... Bibliography is all the work you read.

Thursday, February 7, 2008

DPS912 Lecture 6

Lots of Review on Network Sockets. stdout is buffered, if you need to make sure that printf actually prints uses fflush.

Went over the Assignment

Signals

Signals are sometimes called interrupts. They interrupt the normal flow of the program. CTRL+Z or CTRL+C. You have no idea when they will occur.

Processes can send other processes signals if they have permission. Most singnals have a default behaviour, and processes can be programmed to change the default behavior (eg ignore the signal)

you can set a signal handler using the following functions

signal() - easier but deprecated

sigaction() - harder but modern. It can do more stuff

Wednesday, February 6, 2008

DPS906 Lecture 8

Machine Learning

Teach a program to learn to do something.
Something==Pattern Recognition (usually)

Training Data (computer creates rules from this data)
Testing Data (test the computers rules with this data)

The way that it comes out with an answer is often not something that can be explained with a rule.

Neural Networks

In AI neural nets are made of nodes. Nodes have a bunch of input... the could come from anywhere depending on the situation. The inputs have a weight when they input data to the node. When the node outputs it does calculation based on the inputs... during the "training phase" the weights of the input are adjusted. See written notes for more info

Nodes typically have the same activation function.
3 common functions
  1. Threshold function: (if IjWj > threshold return 1 else return 0) (have to adjust threshold)
  2. Sign function: similar to threshold add in an extra weight and input to the threshold function (W0I0) W0 is threshold (allows you to adjust the threshold as a weight rather than the threshold) I0 = -1
  3. Signoid function: a function that doesn't return 1 or 0 only... returns values inbetween (eg 0.234 or 0.453) Has a funky Sigma curve.
Perceptron

Feed forward, single layer, neural net.
  • feed forward == input/output goes one way, never backward (see drawings). inputs for a node always come from a node in previous layers never from later layers. Nodes in same layer do not connect.
  • Single layer means only one layer. Single layer + feed forward means the nodes never talk to each other.
Good things
Given time/data a perceptron will learn to separate anything that is linearly separable. (AND OR are both linear separate, XOR is not linear separate)

Actual learning of a perceptron
DEFINITION EPOCH: Each time you update the weights in the perceptron is called an epoch.
Perception begins its "life" as a bunch of nodes. Create your layer of nodes with inputs and outputs. Randomly assign weights to all inputs and go through the 1st "training" stage. You may get an error.
Input(I)
Error(E) = Training Answer(T) - Neural Net Output(O).
if( e > 0 ) t must be > o
if( e <> t

if (Ij) is -ve increasing weight will decrease output
if Ij is +ve increasing weight will increase output
weight = weight + learning rate(this is a constant) * Ij * E.

Tuesday, February 5, 2008

Another Response to a Grumble Grumble article

Andrew Smith is a brilliant mind concerned with open source. He is also a former classmate of mine so I am quite interested in all of his rants. His latest rant is titled "Whether to make money with software"

Andrew States:
"so by open sourcing your software you, as a business, don’t have anything to gain"

I disagree, take this fictitious example....

I am releasing a client/server game called World of Wormcraft. I will not make money from selling the actual software, in-fact I will give away the client AND the server for free. Completely open source.

I will make money from the millions of people who have a monthly subscription which allows them to connect to my OFFICIAL high broadband server.

Why would I want to release the server as open source? Cant anyone just set up their own personal server? Yes they can.... however their personal servers are not official (and not of the same service quality). Their servers add to my World of Wormcraft publicity, add interest to my game (you can try it out for free), and eventually is a GoodThing (TM) because the game will live on after I stop running the Official Server.

There is a risk that another business will take my server code and start their own high-bandwidth near-official servers. Their competitive advantage over me is that they did not have to spend any money in development. However MY competitive advantage includes being "the brand," having a full working knowledge of the code AND being maintainer of the code (thus v2 is released by me... if my competition releases v2 they have to fork and lose branding). My competition and I will compete based on price and service quality. My service quality will be superior to theirs because of my intimate knowledge of the code and the ability to v2 w/o forking, so if I can match their price I win.

I admit there are a lot of holes in my argument. I am postulating this idea not to be bullet proof, but just to give Andrew the idea that it "can be done and I do have something to gain."

BTR820 Lecture 6

How do we Evaluate an Article?
  • how famous is the author
  • how often are is the author cited by others
  • where do they work
  • where was it published
- use scholar.google.com
- 25 citations is very very good
- 10 is acceptable
- 0 is shady

Sometimes really really bad papers get cited a lot (as examples of what not to do)
younger papers get cited less

It is a common occurrence for a scholar to get excited about something outside their field and write a paper about it.

wikipedia is biased
sometimes journals are biased too. Alan Sokal published a "joke" paper and it got published (he put in enough physics jargon and wrote to the political views of the journal)