The linear multi-state sliding window system consists of n linearly ordered positions and m statistically independent elements with different characteristics that are to be allocated at these positions. Each element can have different states: from complete failure up to perfect functioning. A performance rate is associated with each state. The system fails if the sum of the performance rates of elements located at any r consecutive positions is lower than a demand w. An algorithm based on the universal generating function method is suggested for determination of the linear multi-state sliding window system reliability. This algorithm can handle cases in which any number of multi-state elements are allocated in the same positon while some positions remain empty. It is shown that such uneven allocation provides greater system reliability than the even one. A genetic algorithm is used as optimization tool in order to solve the optimal element allocation problem.