In this paper the discretized variational principle in the simulation of the Wall Touching Kink Modes (WTKM) is reformulated in terms of independent variables and a corresponding constrained minimization algorithm is elaborated. In a frame of a general formalism is proposed an algoritm for constrained linear minimization adapted to this class of problems. The FORTRAN programme that realize the algorithm is described.