Find the right/best track combination for a given distance, using a genetic algorithm or ?.
You could easily formulate this as a integer linear programming (ILP) problem. This is a linear programming problem where the solutions are constrained to be integers. The problem is NP-hard as indicated in other answers, but software does exist to address this sort of problem.

Let $L$ be the ultimate length you are aiming for, $a$ be the number of
Track A used, $b$ be the number of Track B used, and so forth. Finally,
let $A$, $B$, $C$, and $D$ be the amount of each kind of track you have.

($a,b,c,d$ are variables; the rest are constants.)

Then the integer linear programming problem is formulated as:


$L - 0.5 \le 3.0 a + 5.0 b + 6.5 c + 10.5 d \le L + 0.5$
$0 \le a \le A$ 
$0 \le b \le B$ 
$0 \le c \le C$ 
$0 \le d \le D$ 
$a,b,c,d$ are integers
minimise $a+b+c+d$


The condition $a+b+c+d$ can be changed to what you want to minimise/maximise to suit your needs so long as 
it is linear in the variables $a,b,c,d$. The could be something capturing the costs of the various Tracks. All of the other ingredients can be changed in an obvious way, for different track lengths, different tolerance level, and so forth, so long as they are constants when you submit your question to an ILP system.

Plenty of software packages exist to solve such problems; many are listed on the page linked to above.