  A class of valued constraint satisfaction problems (VCSPs) is characterised
by a valued constraint language, a fixed set of cost functions on a finite
domain. An instance of the problem is specified by a sum of cost functions from
the language with the goal to minimise the sum.
  We study which classes of finite-valued languages can be solved exactly by
the basic linear programming relaxation (BLP). Thapper and Zivny showed [20]
that if BLP solves the language then the language admits a binary commutative
fractional polymorphism. We prove that the converse is also true. This leads to
a necessary and a sufficient condition which can be checked in polynomial time
for a given language. In contrast, the previous necessary and sufficient
condition due to [20] involved infinitely many inequalities.
  More recently, Thapper and Zivny [21] showed (using, in particular, a
technique introduced in this paper) that core languages that do not satisfy our
condition are NP-hard. Taken together, these results imply that a finite-valued
language can either be solved using Linear Programming or is NP-hard.
