载入中...
搜索中...
未找到
eve::agent 命名空间参考

命名空间

namespace  detail
 

类

class  Agent
 Squirrel entry eve.Agent(): owner-thread synchronous training, inference and replay. 更多...
 
class  AgentTensor
 Manager-owned optional tensor backend. Owner thread only; revokes before destruction. 更多...
 
struct  Config
 Bounded search configuration; seed streams for environment, search and learning are separate. 更多...
 
class  IEnvironment
 Adapter for a resettable game, simulation, UI or other decision-making environment. @ownership The caller owns the environment and all domain state. The runner borrows it only for the synchronous call; no references escape. @thread Call on the domain owner thread. Callbacks may call unrelated services, but must not reenter or destroy this environment. The runner holds no locks. 更多...
 
class  IGpuPolicyBackend
 Optional GPU policy service, registered independently of eager tensor CPU. @ownership Same synchronous borrowing contract as IPolicyBackend; revoke before destruction. @thread Device owner thread only. No callbacks, reentry or device teardown during a call. 更多...
 
class  IPolicyBackend
 Optional inference service. Providers own their registration and revoke before destruction. @thread Owner thread only; no reentry, provider unload or external callbacks during inference. @ownership Inputs are borrowed only for the call. Outputs own all data. Core resolves the capability anew for each inference; it never retains a provider across environment callbacks. 更多...
 
struct  Observation
 Owning state projection; action IDs index a fixed domain action catalogue. 更多...
 
struct  Policy
 Owning version-1 portable network weights; import validates the entire value before use. 更多...
 
struct  Report
 Owning search result; reward, coverage and failures remain separate evidence. 更多...
 
struct  Trace
 In-memory versioned replay evidence, independent of learned model state. 更多...
 
struct  TraceStep
 Owning executed action and resulting observation; no domain pointers are retained. 更多...
 

枚举

enum class  Outcome { Running , Success , Failure }
 Domain outcome, independent of reward and infrastructure errors. 更多...
 
enum class  Strategy { Random , EvolutionLearning }
 Explicit algorithm choice, also used for equal-budget random baselines. 更多...
 
enum class  Backend { Cpu , Tensor , Gpu }
 Explicit backend; Tensor is eager CPU, Gpu accelerates inference and SGD via agent_tensor. 更多...
 

函数

Result< void > validatePolicy (const Policy &policy)
 Validate the complete owning policy before inference/import, with no mutation or callbacks.
 
Result< std::string > backendName (Backend backend)
 Return an owning backend label, or Unsupported if Tensor is unavailable; owner thread only.
 
Result< std::vector< double > > infer (const Policy &policy, const Observation &observation, Backend backend=Backend::Cpu)
 Compute masked action probabilities with validated version-1 owning weights.
 
Result< Report > run (const Config &config, IEnvironment &environment)
 Run bounded evolutionary rollout search and elite policy distillation.
 
Result< void > replay (const Trace &trace, IEnvironment &environment, double absoluteTolerance=1e-6)
 Reset and replay actual actions, checking all observations and failure evidence.
 
 Module_IMPL (Agent, new Agent())
 
Result< Config > decodeConfig (const Value &value)
 Decode strict script/JSON configuration; unknown keys rejected, no mutations or callbacks.
 
Result< Observation > decodeObservation (const Value &value)
 Decode owning observation data, rejecting malformed values; dimensions are checked by run/infer.
 
Result< Policy > decodePolicy (const Value &value)
 Decode and validate version-1 owning policy; unknown keys/versions rejected atomically.
 
Result< Trace > decodeTrace (const Value &value)
 Decode version-1 owning replay data; run-time consistency is checked before replay reset.
 
Value encodePolicy (const Policy &policy)
 Encode a runner-produced policy into owning versioned data; no references retained.
 
Value encodeTrace (const Trace &trace)
 Encode a runner-produced trace into owning versioned data; seeds use lossless decimal strings.
 
Value encodeReport (const Report &report)
 Encode runner-produced report, including policy and replayable evidence, as owning data.
 
 Module_IMPL (AgentTensor, new AgentTensor())
 
Result< std::unique_ptr< IGpuPolicyBackend > > makeGpuBackend ()
 Create an owning GPU provider; compile lazily on the device owner thread.
 
Result< std::unique_ptr< IPolicyBackend > > makeTensorBackend ()
 Create an owning tensor eager CPU inference provider; caller owns registration.
 

枚举类型说明

◆ Backend

enum class eve::agent::Backend
strong

Explicit backend; Tensor is eager CPU, Gpu accelerates inference and SGD via agent_tensor.

枚举值
Cpu 
Tensor 
Gpu 

在文件 Agent.h 第 50 行定义.

◆ Outcome

enum class eve::agent::Outcome
strong

Domain outcome, independent of reward and infrastructure errors.

枚举值
Running 
Success 
Failure 

在文件 Agent.h 第 13 行定义.

◆ Strategy

enum class eve::agent::Strategy
strong

Explicit algorithm choice, also used for equal-budget random baselines.

枚举值
Random 
EvolutionLearning 

在文件 Agent.h 第 47 行定义.

函数说明

◆ backendName()

EVENGINE_API_FOUNDATION Result< std::string > eve::agent::backendName ( Backend  backend)

Return an owning backend label, or Unsupported if Tensor is unavailable; owner thread only.

在文件 Agent.cpp 第 93 行定义.

引用了 Cpu, eve::Diagnostic::error(), eve::Result< T >::failure(), Gpu, eve::InvalidArgument, eve::Result< T >::success(), Tensor , 以及 eve::Unsupported.

被这些函数引用 infer() , 以及 run().

◆ decodeConfig()

EVENGINE_API_FOUNDATION Result< Config > eve::agent::decodeConfig ( const Value &  value)

Decode strict script/JSON configuration; unknown keys rejected, no mutations or callbacks.

在文件 Codec.cpp 第 117 行定义.

引用了 c, Gpu, key, name, number, object, Random, seed, string, target, Tensor , 以及 value.

◆ decodeObservation()

Result< Observation > eve::agent::decodeObservation ( const Value &  value)

Decode owning observation data, rejecting malformed values; dimensions are checked by run/infer.

在文件 Codec.cpp 第 186 行定义.

引用了 value.

◆ decodePolicy()

EVENGINE_API_FOUNDATION Result< Policy > eve::agent::decodePolicy ( const Value &  value)

Decode and validate version-1 owning policy; unknown keys/versions rejected atomically.

在文件 Codec.cpp 第 189 行定义.

引用了 eve::Result< T >::failure(), n, number, object, p, required, eve::agent::Policy::schemaId, string, valid, validatePolicy() , 以及 value.

◆ decodeTrace()

EVENGINE_API_FOUNDATION Result< Trace > eve::agent::decodeTrace ( const Value &  value)

Decode version-1 owning replay data; run-time consistency is checked before replay reset.

在文件 Codec.cpp 第 207 行定义.

引用了 number, object, required, eve::agent::Trace::schemaId, step, string, t , 以及 value.

◆ encodePolicy()

EVENGINE_API_FOUNDATION Value eve::agent::encodePolicy ( const Policy &  p)

Encode a runner-produced policy into owning versioned data; no references retained.

在文件 Codec.cpp 第 225 行定义.

引用了 eve::Value::object(), p, w , 以及 weights.

被这些函数引用 encodeReport().

◆ encodeReport()

Value eve::agent::encodeReport ( const Report &  r)

Encode runner-produced report, including policy and replayable evidence, as owning data.

在文件 Codec.cpp 第 247 行定义.

引用了 encodePolicy(), encodeReport(), encodeTrace(), findings, key, r , 以及 t.

被这些函数引用 encodeReport().

◆ encodeTrace()

EVENGINE_API_FOUNDATION Value eve::agent::encodeTrace ( const Trace &  t)

Encode a runner-produced trace into owning versioned data; seeds use lossless decimal strings.

在文件 Codec.cpp 第 235 行定义.

引用了 eve::Value::object(), s, steps , 以及 t.

被这些函数引用 encodeReport().

◆ infer()

EVENGINE_API_FOUNDATION Result< std::vector< double > > eve::agent::infer ( const Policy &  policy,
const Observation &  observation,
Backend  backend = Backend::Cpu 
)

Compute masked action probabilities with validated version-1 owning weights.

参数
policyBorrowed only during this call; unknown versions/shapes/NaNs are rejected.
observationBorrowed state with nonempty legal mask and normalized finite features.
返回
Owning probabilities indexed by action ID (illegal actions have zero probability).
参数
backendCPU, eager Tensor or GPU; missing provider/device returns Unsupported.
备注
No retained references; CPU is pure, Tensor calls are owner-thread affine.

在文件 Agent.cpp 第 112 行定义.

引用了 eve::agent::Policy::actionCount, backendName(), Cpu, eve::Diagnostic::error(), EV_ASSERT, eve::agent::IPolicyBackend::evaluate(), eve::agent::Policy::featureCount, eve::agent::detail::forward(), Gpu, eve::InvalidArgument, eve::agent::Observation::legalActions, size, validatePolicy() , 以及 value.

◆ makeGpuBackend()

Result< std::unique_ptr< IGpuPolicyBackend > > eve::agent::makeGpuBackend ( )

Create an owning GPU provider; compile lazily on the device owner thread.

返回
GPU-only provider; execution returns an error when the device or graph is unsupported.
备注
Revoke and destroy before Graphics device teardown. No device or caller data is owned by registration.

在文件 GpuBackend.cpp 第 97 行定义.

被这些函数引用 eve::agent::AgentTensor::AgentTensor().

◆ makeTensorBackend()

EVENGINE_API_ORCHESTRATION Result< std::unique_ptr< IPolicyBackend > > eve::agent::makeTensorBackend ( )

Create an owning tensor eager CPU inference provider; caller owns registration.

返回
Unique CPU-only provider; inputs/outputs follow IPolicyBackend.
备注
Owner-thread execution, no callbacks; caller must revoke before destroying.

在文件 TensorBackend.cpp 第 47 行定义.

被这些函数引用 eve::agent::AgentTensor::AgentTensor().

◆ Module_IMPL() [1/2]

eve::agent::Module_IMPL ( Agent  ,
new   Agent() 
)

◆ Module_IMPL() [2/2]

eve::agent::Module_IMPL ( AgentTensor  ,
new   AgentTensor() 
)

◆ replay()

EVENGINE_API_FOUNDATION Result< void > eve::agent::replay ( const Trace &  trace,
IEnvironment &  environment,
double  absoluteTolerance = 1e-6 
)

Reset and replay actual actions, checking all observations and failure evidence.

参数
traceVersion-1 owning evidence from run; independent of training.
environmentBorrowed isolated adapter, mutated synchronously on its owner thread.
absoluteToleranceFinite nonnegative feature/reward tolerance; masks, coverage, outcomes and findings must match exactly. Invalid trace is rejected before reset.
返回
Conflict for divergence, or the original adapter failure; no locks/callback retention.

在文件 Agent.cpp 第 258 行定义.

引用了 eve::Conflict, eve::agent::Trace::dt, eve::agent::Trace::environmentSeed, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::agent::Observation::features, eve::agent::Trace::initial, eve::InvalidArgument, previous, eve::agent::IEnvironment::reset(), eve::agent::Observation::reward, Running, eve::agent::Trace::schemaId, eve::agent::Trace::schemaVersion, eve::agent::IEnvironment::step(), step, eve::agent::Trace::steps, eve::Result< T >::success() , 以及 trace.

◆ run()

EVENGINE_API_FOUNDATION Result< Report > eve::agent::run ( const Config &  config,
IEnvironment &  environment 
)

Run bounded evolutionary rollout search and elite policy distillation.

参数
configAll budgets, time and RNG streams; invalid/nonfinite inputs are rejected before reset.
environmentBorrowed isolated domain adapter, left at its final evaluated state.
返回
Owning evidence, or adapter/validation failure. No partial report is published on error.
备注
Two tanh hidden layers and softmax are trained by explicit backpropagation on elite trajectories. This is evolutionary search, not stationary MCMC. Same build/config/deterministic adapter gives repeatable traces. Floating-point cross-platform equivalence uses replay's explicit tolerance. No global RNG, worker, ECS system or persistent domain link is introduced. Tensor inference requires an explicitly registered provider. Gpu executes forward/backprop/SGD on the device, Cpu/Tensor use CPU SGD. GPU FP32 is tolerance-based, not bitwise equivalent to CPU; stochastic action choices can amplify small numeric differences.

在文件 Agent.cpp 第 145 行定义.

引用了 a, action, b, eve::agent::Report::backend, backendName(), eve::agent::Report::best, eve::agent::Report::bestScore, c, eve::Cancelled, eve::agent::Observation::coverage, eve::agent::Report::coverage, eve::agent::Report::episodes, epoch, eve::Diagnostic::error(), EvolutionLearning, eve::Result< T >::failure(), Failure, eve::agent::Report::failures, eve::agent::Observation::finding, eve::agent::Report::findings, generation, Gpu, eve::InvalidArgument, eve::agent::Observation::legalActions, eve::agent::detail::makePolicy(), member, eve::agent::Observation::outcome, parent, eve::agent::Report::policy, previous, Random, random, eve::agent::IEnvironment::reset(), eve::agent::Observation::reward, Running, eve::agent::IEnvironment::step(), step, eve::agent::Report::steps, eve::Result< T >::success(), tick, eve::agent::detail::train(), eve::agent::Report::trainingBackend, eve::agent::Report::trainingSamples, eve::Unsupported, valid , 以及 validatePolicy().

◆ validatePolicy()