File tree Expand file tree Collapse file tree 3 files changed +29
-8
lines changed
Expand file tree Collapse file tree 3 files changed +29
-8
lines changed Original file line number Diff line number Diff line change 1- import opengen .definitions
2- import opengen .builder
3- import opengen .config
4- import opengen .functions
5- import opengen .constraints
6- import opengen .tcp
7- import opengen .ocp
1+ from . import (
2+ definitions ,
3+ builder ,
4+ config ,
5+ functions ,
6+ constraints ,
7+ tcp ,
8+ ocp ,
9+ )
10+
11+ __all__ = [
12+ "definitions" ,
13+ "builder" ,
14+ "config" ,
15+ "functions" ,
16+ "constraints" ,
17+ "tcp" ,
18+ "ocp" ,
19+ ]
Original file line number Diff line number Diff line change @@ -645,6 +645,15 @@ def __initialize(self):
645645
646646 def __check_user_provided_parameters (self ):
647647 self .__logger .info ("Checking user parameters" )
648+
649+ # Check constraints dimensions
650+ dim_constraints = self .__problem .constraints .dimension ()
651+ dim_decision_variables = self .__problem .dim_decision_variables ()
652+ if dim_constraints is not None and dim_decision_variables != dim_constraints :
653+ raise ValueError (f"Inconsistent dimensions - decision variables: { dim_decision_variables } " ,
654+ f"set of constraints: { dim_constraints } " )
655+
656+ # Preconditioning...
648657 if self .__solver_config .preconditioning :
649658 # Preconditioning is not allowed when we have general ALM-type constraints of the form
650659 # F1(u, p) in C, unless C is {0} or an orthant (special case of rectangle).
Original file line number Diff line number Diff line change @@ -622,7 +622,7 @@ def test_dimension_sphere2(self):
622622 # Zero
623623 # -----------------------------------------------------------------------
624624
625- def test_zero_dimension (self ):
625+ def test_zero_dimension (self ):
626626 z = og .opengen .constraints .Zero ()
627627 self .assertIsNone (z .dimension ())
628628
You can’t perform that action at this time.
0 commit comments