template struct funcmin::RgminNlmlCtx

Overview

Synchronous objective view shared by the SCG and gradient-only adapters. More…

#include <gpr/ml/RgminObjective.h>
 
template <typename ClassName, typename FuncName>
struct RgminNlmlCtx {
    // structs
 
    struct Sample;
 
    // fields
 
    const gpr::EigenMatrix& x;
    const Eigen::VectorXd& x_ind;
    const Eigen::VectorXd& y;
    ClassName& holder;
    const FuncName func;
    const MapObjectiveConfig& map_cfg;
    const bool exact_curvature;
    bool trace_evaluations = false;
    bool hessian_vector_fallback = false;
    RgminCallbackFailure failure;
 
    // construction
 
    RgminNlmlCtx(const gpr::EigenMatrix& positions, const Eigen::VectorXd& indices, const Eigen::VectorXd& targets, ClassName& model, FuncName objective, const MapObjectiveConfig& configuration, bool use_exact_curvature, bool retain_step_samples = false, std::function<bool()> stop_requested = {});
 
    // methods
 
    rgmin_status_t captureCallbackError(const char* callback);
    void pinAt(const Eigen::VectorXd& w);
    std::size_t logicalObjectiveWork() const;
    std::size_t physicalObjectiveWork() const;
    const Sample& evalAt(const Eigen::VectorXd& w);
    rgmin_status_t restoreHolderAt(const Eigen::VectorXd& w);
};

Detailed Documentation

Synchronous objective view shared by the SCG and gradient-only adapters. Input arrays, the model and the member function remain valid for the whole minimize/step call. Model mutation belongs to the objective; coordinate publication belongs to the optimizer adapter after callback success.

Fields

bool hessian_vector_fallback = false

Set once the NLML Hessian-vector curvature callback has declined; rgmin then probes the gradient for every later curvature.

Methods

void pinAt(const Eigen::VectorXd& w)

Pin only an evaluated sample; a step boundary never calls the holder. The first successful callback also pins a box-projected opening point.

rgmin_status_t restoreHolderAt(const Eigen::VectorXd& w)

Cached first-order values do not restore mutable posterior state. This physical evaluation is separate from the solver’s request budget.