Gap penalties are used during sequence alignment. Gap penalties contribute to the overall score of alignments, and therefore, the size of the gap penalty relative to the entries in the similarity matrix affects the alignment that is finally selected. Selecting a higher gap penalty will cause less favourable characters to be aligned, to avoid creating as many gaps.
Linear gap penalties are the simplest type of gap penalty. The only parameter, d, is a penalty per gap. This is almost always negative, so that the alignment with less gaps is favoured over the alignment with more gaps. Under a linear gap penalty, the overall penalty for one large gap is the same as for many small gaps.
Affine gap penalties attempt to overcome this problem. In biological sequences, for example, it is much more likely that one big gap of length 10 occurs in one sequence, due to a single insertion or deletion event, than it is that 10 small gaps of length 1 are made. Therefore, affine gap penalties have a gap opening penalty, c, and a gap extension penalty, e. A gap of length l is then given a penalty c + (l-1)e. So that gaps are discouraged, c and e are almost always negative. Furthermore, because a few large gaps is better than many small gaps, e is almost always smaller than c.