Skip to main content

Argmin Inference

Name

UxHwDoubleArgmin, UxHwFloatArgmin — Perform argmin\mathrm{argmin} inference with distributional arithmetic.

Synopsis

#include <uxhw.h>

float UxHwFloatArgmin(
float functionOutput,
float * argumentArray,
size_t numberOfArguments,
float * minimizingArgumentInstanceArray
);

double UxHwDoubleArgmin(
double functionOutput,
double * argumentArray,
size_t numberOfArguments,
double * minimizingArgumentInstanceArray
);

Description

The UxHwDoubleArgmin() function performs argmin\mathrm{argmin} inference. It calculates the instances of the distributions in array argumentArray that produce the minimum value of the input distribution functionOutput. It stores the minimizing instances in the output array minimizingArgumentInstanceArray of length numberOfArguments, and returns the minimum value of the input distribution functionOutput.

Given a function f:SRf : S \rightarrow \mathbb{R}, the argmin\mathrm{argmin} of ff is defined as argminSf(x):={xΩ:f(x)f(s)sS}\mathrm{argmin}_S f(x) := \{x \in \Omega : f(x) \leq f(s) \forall s \in S \}, that is, the argmin\mathrm{argmin} of ff is the collection of inputs in SS that result in the minimum value of ff.

Parameters

  • functionOutput — An input distribution which is a computational result of the distributions in the input array argumentArray. This is the distribution which UxHwDoubleArgmin() and UxHwFloatArgmin() will attempt to minimize.

  • argumentArray — An array of input distributions that were used in computing functionOutput. UxHwDoubleArgmin() and UxHwFloatArgmin() will attempt to infer the instances of the distributions in argumentArray that minimize functionOutput..

  • numberOfArguments — The size of the input array argumentArray and the output array minimizingArgumentInstanceArray.

  • minimizingArgumentInstanceArray — The instances of the distributions in the array argumentArray that minimize the value of functionOutput.

Return values

The minimum value of functionOutput that is obtained when the distributions in the array argumentArray take on their minimizing values (i.e., values returned in minimizingArgumentInstanceArray).

Example 1: Finding the minimal circumference of a rectangle with a fixed area

#include <stddef.h>
#include <stdio.h>
#include <uxhw.h>

int
main(void)
{
double area = 25.0;
double baseLength = UxHwDoubleUniformDist(0.0, 5.0);
double sideLength = area / baseLength;
double circumference = 2 * (baseLength + sideLength);
double circumferenceMinimizingBaseLength;
double minimalCircumference;

/*
* Find the instance `circumferenceMinimizingBaseLength`
* of `baseLength` that minimizes `circumference` and
* the corresponding minimal circumference.
*/
minimalCircumference = UxHwDoubleArgmin(
circumference,
&baseLength,
1,
&circumferenceMinimizingBaseLength
);

printf("Circumference minimizing base length: %lf\n",
circumferenceMinimizingBaseLength);
printf("Minimal circumference: %lf\n", minimalCircumference);

return 0;
}

Example 2: Finding the maximum area enclosed by a fixed-length boundary

#include <stddef.h>
#include <stdio.h>
#include <uxhw.h>

int
main(void)
{
double totalBoundaryLength = 20.0;
double baseLength = UxHwDoubleUniformDist(0.0, 10.0);
double sideLength = totalBoundaryLength / 2.0 - baseLength;
double area = baseLength * sideLength;
double areaMaximizingBaseLength;
double maximalArea;

/*
* We want to find the maximizer of `area` (instead of
* minimizer), so we pass the negative value of `area`.
*/
maximalArea = -UxHwDoubleArgmin(
-area,
&baseLength,
1,
&areaMaximizingBaseLength
);

printf("Area maximizing base length: %lf\n", areaMaximizingBaseLength);
printf("Maximal area: %lf\n", maximalArea);

return 0;
}