Initial commit: cuGenOpt GPU optimization solver

This commit is contained in:
L-yang-yang 2026-03-20 00:33:45 +08:00
commit fc5a0ff4af
117 changed files with 25545 additions and 0 deletions

View file

@ -0,0 +1,63 @@
/**
* opt_init_solution: 属性双向构造初始解 验证实验
*
* 对比heuristic init当前代码TSP 自动注入距离矩阵构造解)
* vs E4 baseline 数据(纯随机初始解)
*
* 测试实例eil51, lin318, pcb442
* 时间预算5s, 10s, 30s
* 输出CSV
*/
#include "bench_common.cuh"
int main(int argc, char** argv) {
bench_init();
bench_csv_header();
float time_budgets[] = {5.0f, 10.0f, 30.0f};
// eil51 — 小规模回归测试
{
auto& inst = ALL_TSP_INSTANCES[0]; // eil51
float* dist = new float[inst.n * inst.n];
compute_euc2d_dist(dist, inst.coords, inst.n);
for (float t : time_budgets) {
char cfg[64];
snprintf(cfg, sizeof(cfg), "heur_%.0fs", t);
SolverConfig c = make_timed_config(t);
bench_run_tsp<void>(inst.name, cfg, inst.n, dist, c, inst.optimal);
}
delete[] dist;
}
// lin318 — 中大规模
{
auto& inst = ALL_TSP_INSTANCES[4]; // lin318
float* dist = new float[inst.n * inst.n];
compute_euc2d_dist(dist, inst.coords, inst.n);
for (float t : time_budgets) {
char cfg[64];
snprintf(cfg, sizeof(cfg), "heur_%.0fs", t);
SolverConfig c = make_timed_config(t);
bench_run_tsp<void>(inst.name, cfg, inst.n, dist, c, inst.optimal);
}
delete[] dist;
}
// pcb442 — 大规模
{
auto& inst = ALL_TSP_INSTANCES[5]; // pcb442
float* dist = new float[inst.n * inst.n];
compute_euc2d_dist(dist, inst.coords, inst.n);
for (float t : time_budgets) {
char cfg[64];
snprintf(cfg, sizeof(cfg), "heur_%.0fs", t);
SolverConfig c = make_timed_config(t);
bench_run_tsp<void>(inst.name, cfg, inst.n, dist, c, inst.optimal);
}
delete[] dist;
}
fprintf(stderr, "\n[opt_init] completed.\n");
return 0;
}