Skip to content

engine: 2-D VECTOR SORT ORDER disagrees with vector.dat expected output #576

Closed

Description

@bpowers

The expected output for p in test/sdeverywhere/models/vector/vector.dat, a 2-D VECTOR SORT ORDER, disagrees with what the engine computes.
We do not know which is right, because no real-Vensim output in the repo covers a 2-D sort.

Example

p[DimA,DimB] = VECTOR SORT ORDER(o[DimA,DimB], ASCENDING)
o = [1,2; 4,3; 5,5]

vector.dat has p = [0,1; 1,0; 0,1]: each row sorted on its own (the last dimension is the sorted one).
The engine sorts the whole array flattened and gives [0,1,3,2,4,5].
test/test-models/tests/vector_order/output.tab (real Vensim DSS) only sorts along one dimension, so it does not settle this.

Why it matters

vector.xmile is commented out of the simulation tests, so nothing fails today.
If it is enabled, either the engine or the fixture is wrong for any model that sorts a 2-D array.

Fix

Get real-Vensim output for a 2-D VECTOR SORT ORDER (C-LEARN uses multi-dimensional sorts and has a real Ref.vdf), then make the engine match it and enable vector.xmile.

Pointers

  • src/simlin-engine/src/vm_vector_sort_order.rs
  • src/simlin-engine/tests/integration/simulate.rs (simulates_vector_xmile_genuine)

Activity

  1. added
    engine
    on Jun 8, 2026
  2. changed the title [-]engine: dormant vector.dat 2-D VECTOR SORT ORDER p block is inconsistent + genuine-Vensim multi-dim VSO semantics unverified by any live fixture[/-] [+]engine: 2-D VECTOR SORT ORDER disagrees with vector.dat expected output[/+] on Oct 12, 2026
  3. added
    bug
    compat
    on Oct 12, 2026
  4. bpowers commented on Oct 12, 2026

    @bpowers
    OwnerAuthor

    Closing: already fixed on main.

    VECTOR SORT ORDER ranks per row with the last dimension as the sorted axis (src/simlin-engine/src/vm_vector_sort_order.rs:50-102), which yields vector.dat's p = [0,1; 1,0; 0,1]. simulates_vector_xmile_genuine and simulates_vector_mdl_genuine (tests/integration/simulate.rs:2903, 2920) run by default and compare every variable, including p, against vector.dat with no exclusions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcompatengine

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions