WorstFirstAssignment:

Path: Math/Analysis

% Reorder columns to minimize the diagonal sum with a worst-first policy
--------------------------------------------------------------------------
   Form:
   [optOrder,optCost,costVec] = WorstFirstAssignment( mat );
--------------------------------------------------------------------------

   ------
   Inputs
   ------
   mat             (N,N)     Square cost matrix. 
                             All elements should be >=0 to work properly.

   -------
   Outputs
   -------
   optOrder        (1,N)     Optimal order of matrix columns.
   optCost          (1)      Total cost = sum of reordered matrix diagonal
   costVec         (1,N)     Vector of costs = diagonal of reordered matrix

--------------------------------------------------------------------------

Back to the Math Module page