g | x | w | all
Bytes Lang Time Link
264Python3240828T170838ZAjax1234
114Perl 5 MListUtil=uniq F231211T165908ZXcali
106JavaScript ES6231207T222536ZArnauld
096JavaScript Node.js231208T035848Zl4m2
015Jelly231207T194237ZJonathan
006Nekomata231207T135421Zalephalp
01605AB1E231207T081825ZKevin Cr
052Charcoal231207T114203ZNeil

Python3, 264 bytes

def f(m,n):
 q,s=[(m-1,n,['X'])],[]
 for m,n,g in q:
  if m==0 and n==0:s+=[tuple(sorted(g))];continue
  if m:
   q+=[(m-1,n,g[:-1]+['X'+g[-1]])];q+=[(m-1,n,g+['X'])]
   if n:q+=[(m-1,n-1,g+['Xx'])]
  if n and'X'in g[-1]:q+=[(m,n-1,g[:-1]+[g[-1]+'x'])]
 return{*s}

Try it online!

Perl 5 -MList::Util=uniq -F, 114 bytes

$X=y/X//;$x=y/x//;say for uniq grep{s/^ +| +$//g;!/xX|\bx+\b|  /&&$X==y/X//&&$x==y/x//}sort glob"{X,x,' '}"x(@F*3)

Try it online!

It's extremely slow. TIO times out on any input longer than 4 characters.

JavaScript (ES6), 106 bytes

-1 thanks to @l4m2

Expects a string with leading 1's for X's and trailing 0's for x's.

Returns a single string with commas and line breaks as separators.

f=(s,o=O=[],p="1")=>s-(q=s.replace(p,""))?f(q,[...o,p].sort())+f(s,o,p+0)+f(s,o,p+1):O[o]||s?"":O[o]=o+`
`

Try it online!

JavaScript (Node.js), 96 bytes

f=(s,o=[],p="1")=>s-(q=s.replace(p,""))&&p<o[0]+f?f(q,[p,...o])+f(s,o,p+0)+f(s,o,p+1):s?"":o+`
`

Try it online!

From Arnauld's

JavaScript (Node.js), 82 bytes, slow

f=(s,o=[],p=s)=>p?(s-(q=s.replace(p,""))?f(q,[p,...o],p):'')+f(s,o,p-1):s?'':o+`
`

Try it online!

Jelly, 15 bytes

I'm very prepared for a smarter approach to trounce this!

Œ!ŒṖ€ẎṢ€ṢẸƇƊƑƇQ

A monadic Link that accepts a list of zeros (no torch) and ones (has torch) that yields a list of the possible partitions.

Try it online!

How?

Œ!ŒṖ€ẎṢ€ṢẸƇƊƑƇQ - Link: Hikers
Œ!              - all permutations of {Hikers}
  ŒṖ€           - list partitions of each
     Ẏ          - tighten to a single list of hiker partitions
             Ƈ  - keep those for which:
            Ƒ   -   is invariant under?:
           Ɗ    -     last three links as a monad - f(hiker partition):
      Ṣ€        -       sort each group
        Ṣ       -       sort that
          Ƈ     -       keep those for which:
         Ẹ      -         any? (has torch?)
              Q - deduplicate

Nekomata, 6 bytes

Ooᵐᵗžũ

Attempt This Online!

Takes input as a sorted list of 1s and 0s, where 1 means with torch and 0 means without torch.

Ooᵐᵗžũ
O       Set partition; split the input into a list of subsets
 o      Sort
  ᵐᵗž   Check that each subset contains at least one nonzero element
     ũ  Remove duplicate solutions

05AB1E, 16 bytes

œ€.œ€`€€{€{êʒ€àP

I/O as a list of 1s/0s for Xs/xs respectively.

I have the feeling the first part of the code can be substantially shorter and I'm missing some obvious builtin combinations.. :/

Try it online or verify all test cases.

Explanation:"

œ€.œ€`€€{€{ê # Get all unique sorted partitions:
œ            #  Get all permutations of the (implicit) input-list
 €.œ         #  Get all partitions of each permutation
    €`       #  Flatten this list of lists of lists of 1s/0s one level down
      €€{    #  Sort the values inside the parts of partitions
         €{  #  Sort the parts of each partition
           ê #  Sorted-uniquify the list of sorted partitions
ʒ            # Filter this list of partitions by:
 ۈ          #  Get the maximum of each part
   P         #  Take the product to check if all are truthy
             # (after which the filtered list is output implicitly)

Charcoal, 52 bytes

⊞υ⟦⟧FS«≔υθ≔⟦⟧υFθ«Fκ⊞υEκ⎇⁼ν⌕κλ⁺μιμ¿⁼ιX⊞υ⊞OκX»»Φυ⁼κ⌕υι

Try it online! Link is to verbose version of code. Assumes the input contains Xs optionally followed by xs. Explanation:

⊞υ⟦⟧

Start with all possibilities of 0 elements.

FS«

Loop over the elements.

≔υθ≔⟦⟧υFθ«

Loop over a saved copy of the possibilities and start collecting new possibilities.

Fκ⊞υEκ⎇⁼ν⌕κλ⁺μιμ

Add the current element to each of the unique lists in this possibility. (If there are duplicates then this doesn't prevent them, it just ensures that they are sorted so that they can be identified as duplicate.)

¿⁼ιX⊞υ⊞OκX

If the current element is an X then also add it as a new list.

»»Φυ⁼κ⌕υι

Deduplicate and output the found possibilities.