FeaturedProblem

FeaturedProblem#

class FeaturedProblem#

FEATUREDPROBLEM Problem interface and recorder for one featured trial.

FP = FeaturedProblem(P, F, MAX_EVAL, SEED) builds a fresh runtime for the original Problem P and canonical Feature F. MAX_EVAL is a positive integer; SEED is a nonnegative integer less than 2^32. There is no fifth termination_eval argument. Reusing F does not reuse this trial’s histories, counters or random streams. Repetition policy belongs to benchmark, not FP.

FP is a Problem subclass with an initial point x0 and the usual objective, bounds, linear constraints and nonlinear constraints. fun, cub and ceq return the values observed by the solver. maxcv and the stored histories use the scoring reference described below, not necessarily those observed values.

Execution strategy

Zero effective stages use execution_strategy=’identity’; one uses ‘legacy-single’. Both record runtime_policy=’matlab-legacy-single-v2’ and seed_policy=’legacy-run-seed’: the established MATLAB numerical kernels and payload-dependent random streams, with constraint counters that count recorded queries (described below). Version 1 of this runtime policy used length()-based constraint counters; archives written by it keep their recorded policy string. Plain entries do not create extra stages or change these strategies.

Two or more effective stages use execution_strategy=’composed-views’, runtime_policy=’matlab-composed-views-v1’ and seed_policy=’matlab-stage-horner32-v2’. One outer recorder owns the public histories and budget; stage views own local execution state and receive the immediate predecessor. A stage or custom callback may legitimately query its predecessor more than once. This is not a promise of one original callback per public query, statistical independence, or matching random samples across MATLAB and Python. Composite derivative methods explicitly raise UnsupportedCompositeDerivative; the legacy derivative behavior is retained for identity/single execution.

Seed policy matlab-stage-horner32-v2 derives the per-stage, per-channel seeds exactly as version 1 did (an exact 32-bit Horner fold over the run seed and the stage identity) and seeds every per-query stream of a composed view by folding the IEEE-754 words of the observed payload (values, point, served index) with the same rule. Version 1 handed that payload to the legacy product mixer, so a zero coordinate, a zero value or a zero counter removed the dependence on the rest of the payload; archives written under version 1 keep their recorded policy string. The identity and single-stage strategies (seed_policy legacy-run-seed) are unchanged and keep their established streams. The fold is a finite 32-bit hash, not a statistical independence guarantee.

Observations, reference values and histories

Observation-only value changes such as noise do not change the reference used for scoring. Spatial transformations transport both observation and reference coordinates. A quantized stage with ground_truth=true also snaps its local reference objective and nonlinear constraints; with false it snaps observations only. Its bounds and linear constraints are checked at the unsnapped point in that stage’s coordinates. Reference values are therefore not universally the original untransformed callback values. A single quantized stage reads the callback of a query once, at the snapped point, which is also the recorded reference with ground_truth=true; with false the reference takes one more read, at the unsnapped point.

Reference reads for initialization, history, maxcv and final scoring do not consume the public fun/cub/ceq call budget or advance served-query counters. They may still evaluate user callbacks. Observation-side custom probes and constraint-gate probes are served predecessor queries and may consume that predecessor’s local samples without becoming extra outer recorder entries.

Public read-only properties include:

  • problem, feature: the original P and reusable F.

  • max_eval, seed: this trial’s budget and seed.

  • execution_strategy, runtime_policy, seed_policy: the policies above.

  • fun_hist: reference objective values recorded at admitted fresh objective evaluations.

  • cub_hist, ceq_hist: reference nonlinear-constraint histories, with one column per recorded fresh evaluation (m-by-k; 0-by-k without nonlinear constraints). Row and empty callback results are stored as one column. The optional record_hist=false argument suppresses storage and the reference (truth) evaluation, not the solver-visible evaluation or the 2*max_eval call limit.

  • maxcv_hist: reference maximum violations at recorded objective points, not a separate sequence of constraint calls; unavailable evaluations are recorded as NaN.

  • fun_init, maxcv_init: reference values at the featured initial point.

  • reference: the original problem’s raw fun/maxcv reference FACT (see Problem) if the feature retains it, otherwise [] (unknown). This is author or provider metadata and is unrelated to the “reference values” above, which are the scoring truth of this trial. The record is retained unchanged or dropped; nothing is transported or derived, and the rule is the same for every kind at zero violation. Retaining stages: those that change only observations (noisy, truncated, random_nan, nonquantifiable_constraints, unrelaxable_constraints, and quantized with ground_truth=false), perturbed_x0, permuted and linearly_transformed. Every custom stage uses the default target; this release has no reference-conversion callback. quantized with ground_truth=true (the default) makes it unknown, because the truth is then the mesh problem. A composition retains the record only if every stage does. Nonzero maxcv survives built-in affine maps because scoring retains original-coordinate residuals. Optional x_ref stays in original coordinates without transport or oracle calls. Standard profiles convert a retained record with the current merit_fun for each run; unknown keeps the V1 cohort minimum. Actual recorded merits are never clamped to this target.

n_eval_fun is the length of fun_hist. On every execution strategy, n_eval_cub and n_eval_ceq count recorded constraint queries, i.e. history columns, independent of the number of constraint components and of the orientation of the callback result. Earlier identity/legacy-single versions returned length(cub_hist) and length(ceq_hist), which reported the component count m while fewer than m queries were recorded, cached stale values once m reached MAX_EVAL, counted m*k for row results and 0 without constraints. This is an intentional correctness change of the inherited behavior. These accessors are not general counts of user callbacks or solver calls.

Cache and hard stop

Each channel checks its history-based n_eval accessor against MAX_EVAL. Once that accessor is at least MAX_EVAL, a call returns the last observed value cached for that channel, irrespective of the new point, and appends no history. On the identity/legacy-single strategies, the same per-query counter is the served index passed to stochastic constraint modifiers (noise, random NaN, perturbed trailing digits, custom callbacks), so repeated queries at one point receive distinct indices.

A separate public-call counter is maintained for each of fun, cub and ceq. Calls served from cache still count. Before accepting a call, the channel raises its ExceedTerminationEval error if its counter is already at least 2*MAX_EVAL. Thus, after 2*MAX_EVAL accepted public call attempts on one channel, its next attempt raises before evaluating or returning the cache. An evaluation that later errors can already have advanced this counter; a history length is not evidence that the same number of calls succeeded.

Derivatives

grad, hess, jcub, jceq, hcub and hceq return the derivatives of the callbacks of the original problem with respect to the variables the solver works in. A feature that changes the variables by x = A * y + b (permuted, linearly_transformed, custom with mod_affine) applies the chain rule at the point x: grad is the column A’ * grad(x)(:) (Problem accepts a row or a column gradient), hess is A’ * hess(x) * A, jcub and jceq are J(x) * A, and every element of hcub and hceq is A’ * H(x) * A. Every other single feature leaves them as they are. They are never derivatives of the observed values: noise, truncation, NaN, a mesh or a custom mod_fun, mod_cub or mod_ceq do not enter them. They cost no evaluation and record no history, and a derivative the problem does not provide stays absent (empty). A composition of features provides no derivatives (MATLAB:FeaturedProblem:UnsupportedCompositeDerivative).