function w = get_cost( t, prev, next, el, vnum)

global z;
global trans;
global HUGE_VAL;

w = trans( prev, next);

if( w ~= HUGE_VAL)
  w = z(t) - w;
  w = w * w;
end
