public static Resource componentwiseMin(Resource lhs, Resource rhs) {
    Resource ret = createResource(0);
    int maxLength = ResourceUtils.getNumberOfCountableResourceTypes();
    for (int i = 0; i < maxLength; i++) {
      try {
        ResourceInformation rhsValue = rhs.getResourceInformation(i);
        ResourceInformation lhsValue = lhs.getResourceInformation(i);
        ResourceInformation outInfo = lhsValue.getValue() < rhsValue.getValue()
            ? lhsValue
            : rhsValue;
        ret.setResourceInformation(i, outInfo);
      } catch (ResourceNotFoundException ye) {
        LOG.warn("Resource is missing:" + ye.getMessage());
        continue;
      }
    }
    return ret;
  }
@Test
  @Timeout(1000)
  void testComponentwiseMin() {
    assertEquals(createResource(1, 1),
        componentwiseMin(createResource(1, 1), createResource(2, 2)));
    assertEquals(createResource(1, 1),
        componentwiseMin(createResource(2, 2), createResource(1, 1)));
    assertEquals(createResource(1, 1),
        componentwiseMin(createResource(1, 2), createResource(2, 1)));
    assertEquals(createResource(1, 1, 1),
        componentwiseMin(createResource(1, 1, 1), createResource(2, 2, 2)));
    assertEquals(createResource(1, 1, 0),
        componentwiseMin(createResource(2, 2, 2), createResource(1, 1)));
    assertEquals(createResource(1, 1, 2),
        componentwiseMin(createResource(1, 2, 2), createResource(2, 1, 3)));
  }