1
$\begingroup$

What do you call a set which accepts multiples of the same element, even in fractional amount? Is there even an established for this?

Example from a video game about production chains:

For a carpenter to run at full capacity, you need: 1 carpenter 1 sawyer 0.5 woodcutter 0.25 forestry

And knowing the fractional amount is important to know for example that you can build only 1 forestry to feed 4 carpenters.

There is the "multiset", but definitions I've read all say elements must have an integer count. I've search for keywords like "multiset fractional amounts", "multiset fractional multiplicity", but didn't find anything 😕.

There is the "knapsack" that turned out on occasion, but the problem's definitions also say the elements must have an integer count?

Am I just approaching this the wrong way??

(I'm a 1st year undergrad student in a computer science/programming degree)

$\endgroup$
  • $\begingroup$ I'm not sure where you read that a multiset must have integer elements. A multiset can have any type of element, and the element is allowed to be repeated in the multiset. $\endgroup$ – ryan Apr 16 at 0:16
3
$\begingroup$

I don't know a standard name for this, but what you've described is representable as a function into $\mathbb{R}$.

For your example, if $X$ is the set of your things then you can represent your 'fractional multiset' as a a function $f : X \to \mathbb{R}$ such that

$$ f(x) = \begin{cases} 1 & x = \text{carpenter}, \text{sawyer} \\ 0.5 & x = \text{woodcutter} \\ 0.25 & x = \text{forester} \\ 0 & \text{otherwise} \end{cases}. $$

If you're looking for a way to implement this in a programming language, if you need to store only finitely many things then you could use a map/dictionary data structure. For example in java you could use some implementation of Map<X, Float>

As for what to call this, "fractional multiset" sounds fine as long as you explain it in whatever context you're using. Alternately you could just refer to it as a "size/measurement function".

$\endgroup$
  • $\begingroup$ Another name that is common in optimization contexts is a weight function. $\endgroup$ – Discrete lizard Apr 16 at 14:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.