Skip to content

Issue with assigning constraints to IDA solver #159

Description

@n-rasmussen

In the ida.pyx file constraints_idx is to be specified as an array

'constraints_idx':
Values: numpy vector or None (= default)
Description:
Constraint the individual variables. The variables are
denoted by the position (index) in the residual vector.
All these indexes are/have to be specified in this
'constraints_idx' array.

However, range cannot be taken of a array.

if not constraints_type is None:
if not constraints_idx is None:
constraints_vars = np.zeros(N, DTYPE)
for idx in range(constraints_idx):
constraints_vars[constraints_idx[idx]] = constraints_type[idx]
else:

This line can be changed to this to get the indexes of the constraints

for i, idx in enumerate(constraints_idx):
    constraints_vars[idx] = constraints_type[i]

Activity

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions