I suspect you are talking here about $cx\le by$. Typically for feasible (but non-optimal) solutions for the primal and dual pair we have an inequality here and this becomes an equality when both are optimal.
So if two you create the dual problem and you find it's solution then the gap is zero? Or if you create the solution then the complementary slackness is equal to the difference between the two?
So iff the the solution is optimal then the gap is 0? How would one go about checking if the solution is zero? (trying to get a grip on linear programming before Christmas). So any detailed explanation that works well for someone with a primarily algorithmic mind would be great as well (I tend to get a bit stuck at the mathematical notations but can understand algorithms really well).
Checking if the solution is zero? That has no meaning in this context. I think you mean checking if a solution is optimal. There must be a paragraph or even a whole chapter in your book about optimality conditions for an LP. Yes, optimality implies no gap.
Sorry I don't really have a book. But yes I do mean if the gap is zero then the solution is optimal, ok good to know but that seems like the inverse of how you would go about this as it seems like your prefer to discovered if the gap is going to be zero ahead of time. Any hints on how to do that?
For normal simplex method this gap concept is not important. It is more of a theoretical thing. For some interior points that work on the primal and the dual it is a measure that is really used. It has for certain implications in the economic interpretation of optimal solutions (think of sensitivity analysis).
But am I correct from reading the book that we have a slack variable equal to the distance between the chosen values and their actual values?
btw do you know any good way of checking if you have indeed correctly created the dual of a problem? Somewhat unrelated but it would be nice if there was an online tool to let me check if I was right
Chosen values and actual values are not terms I am familiar with. Slack is difference between the lhs (i.e. a'x for a given x) and the rhs (i.e. b). I.e. Ax + s = b.
Sorry I don't of no tool for that. As a practitioner I am not often worried about producing a dual formulation of a model. The easiest way to check is solve both primal and dual models. The primal model gives x plus duals y. The dual model gives y + duals x.