alphaville / optimization-engine

Nonconvex embedded optimization: code generation for fast real-time optimization

Home Page:https://alphaville.github.io/optimization-engine/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wrong documentation about Cartesian product constraint

AlexanderKeijzer opened this issue · comments

The indexing of cartesian products is off by one. In the Python documentation and Rust docs the index starts at 0.
However, the code asserts that the index ends at the length of the vector (and therefore starts at 1):

assert!(x.len() == self.dimension(), "x has wrong size");

And then loops until index-1 (and therefore my final index should be N not N-1):

This should probably be changed in the docs as changing the code will break all implementations. However, starting the index at 1 is quite unintuitive when used in Rust and should be documented well.