Skip to content

Possible zero-generator issue in conSet/@zonotope/enclosePoints.m #79

Description

@lili1039

Description

The generator length in function aux_cloud2zonotope (in conSet/@zonotope/enclosePoints.m) is currently computed as

g = ratio * abs(dot(u,r)) * u;

where u is the dominant left singular vector of the residual point cloud and r is the radius vector of its axis-aligned interval enclosure.

The quantity abs(dot(u,r)) is the projection of the specific interval vertex r onto u. Since the entries of u may have different signs, positive and negative terms can cancel even when both u and r are nonzero. This may produce g = 0, followed by a 0/0 operation in function aux_compress:

u = g / norm(g);

For an axis-aligned interval with radius vector r, its support radius in direction u is supposed to be

dot(abs(u),r)

Therefore, the generator construction may be more appropriately written as

g = ratio * dot(abs(u),r) * u;

A numerical safeguard in aux_compress can also prevent division by zero as

function X = aux_compress(X,g)

    ng = norm(g);
    tol = 1e-12;

    if ng <= tol
        return;
    end

    u = g/ng;

    for i = 1:size(X,2)
        d = dot(X(:,i),u);
        d = min(ng,max(-ng,d));
        X(:,i) = X(:,i) - d*u;
    end
end

Steps to Reproduce the Issue

I have attached the point data file that triggered the issue, along with a minimal reproduction script.
Point data file: https://drive.google.com/file/d/1OLIA6q_IVsjmZsQsqB31v0_vyR-7tgVI/view?usp=drive_link

load('data.mat');
Zono_omega = zonotope.enclosePoints(omega);

In my case, the issue occurred at the last iteration in aux_cloud2zonotope. At that iteration,

norm(u) > 0
norm(r) > 0
dot(u,r) == 0
dot(abs(u),r) > 0

The above modification resolves the issue for this dataset.

Current Behavior

Sign cancellation in dot(u,r) may produce a zero generator even though the residual point cloud has nonzero extent. The subsequent normalization of g introduces NaN values into X and the resulting zonotope.

Expected Behavior

cloud2zonotope should return a valid zonotope without introducing NaN values.

Versions

  • Matlab version: R2024a
  • OS: Windows

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions