Loading...
Searching...
No Matches
diplacam.cpp
Go to the documentation of this file.
74 /** Optional runtime directory resolved by the shared settings reader, not a library filename. */
76 /** Shared backend, source, descriptor, thread, and deadline policy; not a second INI dialect. */
104 if (result.ec != std::errc{} || result.ptr != value.data() + value.size() || parsed < minimum || parsed > maximum)
146 return integer_setting(files.comparison.budget_ms, value, 1, dipla::CmaesOptions::max_budget_ms);
152 if (std::string_view(key) == "diffusion_seed") return ini_uint(value, &files.experiment.diffusion_seed);
153 if (std::string_view(key) == "sensor_noise_seed") return ini_uint(value, &files.experiment.sensor_noise_seed);
198ModelFiles read_model_settings(const std::filesystem::path& filename, bool require_model_files) {
228 if (!files.metadata.empty()) files.metadata = (directory / files.metadata).lexically_normal().string();
229 if (!files.conditioning_cache.empty()) files.conditioning_cache = (directory / files.conditioning_cache).lexically_normal().string();
258 const auto directory = std::filesystem::exists(executable.parent_path() / "diplacam_settings.ini") ?
332 if (used != value.size() || !std::isfinite(number)) throw std::runtime_error("Invalid coordinate");
347 const auto files = read_model_settings(settings, !show_config && (model.empty() || metadata.empty()));
392 if (configuration.empty() || !field.empty()) throw std::runtime_error("IPC mode requires only --config");
394 return dipla::serve(descriptor, configuration, model, metadata, cmaes, comparison, network_options, experiment);
408 if (!result) throw std::runtime_error("CMA-ES comparison budget expired before a complete route");
424 std::cerr << "diplacam planner=" << (cmaes ? "cmaes comparison_only=true onnx=false" : "diffusion onnx=true") << '\n';
425 std::cerr << "diplacam field_fnv1a=" << survey.field_digest() << " total_variance=" << survey.total_variance()
Allocation-free flat key=value mechanics; callers own schemas and storage.
static bool ini_uint(const char *text, uint64_t *number)
Parse digits-only uint64; overflow and signs are rejected.
Definition bounded_ini.h:52
static bool ini_real(const char *text, double *number)
Parse finite decimal/exponent notation, rejecting range errors and suffixes.
Definition bounded_ini.h:67
Owns an ONNX session and samples eight metre-valued control points.
Definition dipla_planner.hpp:159
Maintains a synthetic field, GP posterior, and planning comparisons.
Definition dipla_planner.hpp:207
Belief belief() const
Copy the current GP marginal mean and variance into fixed-size storage.
Definition dipla_planner.cpp:808
double total_variance() const
Return the sum of posterior marginal variances.
Definition dipla_planner.cpp:825
std::uint64_t field_digest() const
Return the FNV-1a digest of the input CSV bytes.
Definition dipla_planner.cpp:832
bool observe(double east, double north, std::uint32_t number, double height=DIPLA_DEMO_HEIGHT_MM/DIPLA_MM_PER_M)
Assimilate one synthetic observation at a local pose.
Definition dipla_planner.cpp:715
std::optional< Waypoints > compare(const std::array< double, 3 > &position, const CmaesOptions &options={}, const std::function< bool()> &cancelled={}) const
Run the explicitly requested native CMA-ES comparison planner.
Definition dipla_planner.cpp:758
Eigen-style Aigen values and build-selected planner aliases.
Public planning, synthetic-survey, and comparison APIs for Diplacam.
Public entry point for Diplacam's bounded local IPC worker.
int main(int argc, char **argv)
Parse CLI options and run standalone planning or the IPC worker.
Definition diplacam.cpp:250
static bool model_setting(void *unused, const char *key, const char *value)
Keep class/threshold selection module-owned rather than assigning acoustic semantics to the common pa...
Definition ear_inference.c:50
Integrity-checked model contracts and independently owned tensor workspaces.
bool inference_settings_read(struct inference_settings *settings, const char *filename, ini_field_handler extra, void *context, char *error, size_t capacity)
Parse one flat INI, delegate application keys and resolve paths against the selected file.
Definition inference_settings.c:158
void inference_settings_init(struct inference_settings *settings, enum inference_backend backend)
Reset storage and select conservative thread/timeout defaults.
Definition inference_settings.c:28
Shared application_settings.ini discovery with module-owned extra keys.
void apply_flight_margin(Waypoints &route, unsigned margin_cells)
Apply the configured horizontal flight margin.
Definition dipla_planner.cpp:599
int serve(int descriptor, const std::string &config_path, const std::string &model, const std::string &metadata, bool cmaes, const CmaesOptions &comparison, const NetworkOptions &network_options, const ExperimentOptions &experiment)
Serve a Diplacam session over an already-connected IPC descriptor.
Definition dipla_worker.cpp:491
void initialize_runtime(const std::string &onnx_lib_path)
Load the ONNX Runtime C API before constructing an inference session.
Definition dipla_planner.cpp:75
std::array< double, DIPLA_COORDINATE_COUNT *points > Noise
Definition dipla_planner.hpp:48
std::array< std::array< double, DIPLA_COORDINATE_COUNT >, points > Waypoints
Definition dipla_planner.hpp:50
Compile-time build identity strings for USHER executables.
Bounded parameters for the comparison-only CMA-ES planner.
Definition dipla_planner.hpp:117
void validate() const
Validate the complete comparison policy before planning.
Definition dipla_planner.cpp:585
static constexpr int max_evaluations
Definition dipla_planner.hpp:123
static constexpr int max_budget_ms
Definition dipla_planner.hpp:121
static constexpr int population_size
Definition dipla_planner.hpp:119
Startup-only synthetic experiment settings shared by both planners.
Definition dipla_planner.hpp:53
unsigned flight_margin_cells
Definition dipla_planner.hpp:61
double gp_kernel_variance
Definition dipla_planner.hpp:65
void validate() const
Reject nonfinite values and incompatible margins before allocation.
Definition dipla_planner.cpp:576
std::uint64_t sensor_noise_seed
Definition dipla_planner.hpp:57
double sensor_noise_variance
Definition dipla_planner.hpp:71
Model identity and execution limits for a diffusion network.
Definition dipla_planner.hpp:144
std::string conditioning_cache
Definition dipla_planner.hpp:152
char descriptor[INFERENCE_PATH_CAPACITY]
Definition inference_settings.h:43
char library_directory[INFERENCE_PATH_CAPACITY]
Definition inference_settings.h:44