Remove solver_nisland field from mjData.

PiperOrigin-RevId: 750527660
Change-Id: I6b34944c92483ea2abc774df75efd868255a2bac
This commit is contained in:
Yuval Tassa
2025-04-23 03:26:40 -07:00
committed by Copybara-Service
parent c2ac0d724e
commit 8f768be2da
10 changed files with 5 additions and 20 deletions
-1
View File
@@ -154,7 +154,6 @@ struct mjData_ {
// solver statistics
mjSolverStat solver[mjNISLAND*mjNSOLVER]; // solver statistics per island, per iteration
int solver_nisland; // number of islands processed by solver
int solver_niter[mjNISLAND]; // number of solver iterations, per island
int solver_nnz[mjNISLAND]; // number of nonzeros in Hessian or efc_AR, per island
mjtNum solver_fwdinv[2]; // forward-inverse comparison: qfrc, efc
-1
View File
@@ -182,7 +182,6 @@ struct mjData_ {
// solver statistics
mjSolverStat solver[mjNISLAND*mjNSOLVER]; // solver statistics per island, per iteration
int solver_nisland; // number of islands processed by solver
int solver_niter[mjNISLAND]; // number of solver iterations, per island
int solver_nnz[mjNISLAND]; // number of nonzeros in Hessian or efc_AR, per island
mjtNum solver_fwdinv[2]; // forward-inverse comparison: qfrc, efc
-1
View File
@@ -777,7 +777,6 @@
X( size_t, maxuse_arena ) \
X( int, maxuse_con ) \
X( int, maxuse_efc ) \
X( int, solver_nisland ) \
X( int, ncon ) \
X( int, ne ) \
X( int, nf ) \
-5
View File
@@ -4816,11 +4816,6 @@ STRUCTS: Mapping[str, StructDecl] = dict([
),
doc='solver statistics per island, per iteration',
),
StructFieldDecl(
name='solver_nisland',
type=ValueType(name='int'),
doc='number of islands processed by solver',
),
StructFieldDecl(
name='solver_niter',
type=ArrayType(
+1 -1
View File
@@ -97,7 +97,7 @@ void simulate(int id, int nstep, mjtNum* ctrl) {
// accumulate statistics
contacts[id] += d[id]->ncon;
constraints[id] += d[id]->nefc;
int nisland = d[id]->solver_nisland;
int nisland = mjMAX(1, mjMIN(d[id]->nisland, mjNISLAND));
if (nisland == 1 || nisland == 0) {
iterations[id] += d[id]->solver_niter[0];
} else {
+3 -3
View File
@@ -298,7 +298,7 @@ void UpdateProfiler(mj::Simulate* sim, const mjModel* m, const mjData* d) {
memset(sim->figcost.linepnt, 0, mjMAXLINE*sizeof(int));
// number of islands that have diagnostics
int nisland = mjMIN(d->solver_nisland, mjNISLAND);
int nisland = mjMAX(1, mjMIN(d->nisland, mjNISLAND));
// iterate over islands
for (int k=0; k < nisland; k++) {
@@ -413,7 +413,7 @@ void UpdateProfiler(mj::Simulate* sim, const mjModel* m, const mjData* d) {
static_cast<float>(d->nefc),
static_cast<float>(sqrt_nnz),
static_cast<float>(d->ncon),
static_cast<float>(solver_niter)
static_cast<float>(solver_niter) / nisland
};
// update figsize
@@ -582,7 +582,7 @@ void UpdateInfoText(mj::Simulate* sim, const mjModel* m, const mjData* d,
char tmp[20];
// number of islands with statistics
int nisland = mjMIN(d->solver_nisland, mjNISLAND);
int nisland = mjMAX(1, mjMIN(d->nisland, mjNISLAND));
// compute solver error (maximum over islands)
mjtNum solerr = 0;
-4
View File
@@ -730,7 +730,6 @@ void mj_fwdConstraint(const mjModel* m, mjData* d) {
// solve using threads
mj_solCG_island_multithreaded(m, d);
}
d->solver_nisland = nisland;
}
// run solver over all constraints
@@ -751,9 +750,6 @@ void mj_fwdConstraint(const mjModel* m, mjData* d) {
default:
mjERROR("unknown solver type %d", m->opt.solver);
}
// one (monolithic) island
d->solver_nisland = 1;
}
// save result for next step warmstart
-1
View File
@@ -1904,7 +1904,6 @@ static void _resetData(const mjModel* m, mjData* d, unsigned char debug_value) {
memset(d->warning, 0, mjNWARNING*sizeof(mjWarningStat));
memset(d->timer, 0, mjNTIMER*sizeof(mjTimerStat));
memset(d->solver, 0, mjNSOLVER*mjNISLAND*sizeof(mjSolverStat));
d->solver_nisland = 0;
mju_zeroInt(d->solver_niter, mjNISLAND);
mju_zeroInt(d->solver_nnz, mjNISLAND);
mju_zero(d->solver_fwdinv, 2);
+1 -2
View File
@@ -1008,9 +1008,8 @@ void mj_printFormattedData(const mjModel* m, const mjData* d, const char* filena
// SOLVER STAT
if (d->nefc) {
fprintf(fp, "SOLVER STAT\n");
fprintf(fp, " solver_nisland = %d\n", d->solver_nisland);
printVector(" solver_fwdinv = ", d->solver_fwdinv, 2, fp, float_format);
int nisland_stat = mjMIN(d->solver_nisland, mjNISLAND);
int nisland_stat = mjMAX(1, mjMIN(d->nisland, mjNISLAND));
for (int island=0; island < nisland_stat; island++) {
int niter_stat = mjMIN(mjNSOLVER, d->solver_niter[island]);
if (niter_stat) {
-1
View File
@@ -4826,7 +4826,6 @@ public unsafe struct mjData_ {
public mjSolverStat_ solver3997;
public mjSolverStat_ solver3998;
public mjSolverStat_ solver3999;
public int solver_nisland;
public fixed int solver_niter[20];
public fixed int solver_nnz[20];
public fixed double solver_fwdinv[2];