Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect dimensions for matrix multiplication #12

Open
mcamurri opened this issue Nov 7, 2023 · 2 comments
Open

Incorrect dimensions for matrix multiplication #12

mcamurri opened this issue Nov 7, 2023 · 2 comments

Comments

@mcamurri
Copy link

mcamurri commented Nov 7, 2023

Thanks for sharing the code with the research community!

The solution proposed by @Highlight123 in #8 seems not to be working for me.

I'm using MATLAB 2023b on Windows 10 Enterprise

  • I have installed YALMIP by downloading the zipped master branch and adding the corresponding folders to the MATLAB path, as explained here
  • I have installed IPOPT by unzipping the content of the windows zip file found in the packages folder and adding it to the MATLAB path as well.

When running the test.m example file, I encounter the following error when the MPC-CBF portion of the code is executed:

Run DCLF-DCBF

******************************************************************************
This program contains Ipopt, a library for large-scale nonlinear optimization.
 Ipopt is released as open source code under the Eclipse Public License (EPL).
         For more information visit http://projects.coin-or.org/Ipopt
******************************************************************************

solver time: 0.047731
solver time: 0.008463
solver time: 0.093812
solver time: 0.023940
solver time: 0.026648
solver time: 0.022985
solver time: 0.024641
solver time: 0.025211
solver time: 0.022818
solver time: 0.023665
solver time: 0.022227
solver time: 0.025823
solver time: 0.022322
solver time: 0.026809
solver time: 0.025507
solver time: 0.023072
solver time: 0.022888
solver time: 0.024795
solver time: 0.022537
solver time: 0.023309
solver time: 0.027679
solver time: 0.041902
solver time: 0.029257
solver time: 0.045835
solver time: 0.044835
solver time: 0.020762
solver time: 0.023178
solver time: 0.018531
solver time: 0.014889
solver time: 0.014883
solver time: 0.019863
solver time: 0.013205
solver time: 0.017712
solver time: 0.016276
solver time: 0.020308
solver time: 0.015621
solver time: 0.019068
solver time: 0.016642
solver time: 0.019565
solver time: 0.016545
solver time: 0.018946
solver time: 0.016591
solver time: 0.016828
solver time: 0.017160
solver time: 0.016907
solver time: 0.017280
solver time: 0.018163
solver time: 0.018101
solver time: 0.018135
solver time: 0.018532
solver time: 0.018296
solver time: 0.023914
solver time: 0.018515
solver time: 0.023602
solver time: 0.018284
solver time: 0.030814
solver time: 0.018128
solver time: 0.028315
solver time: 0.018415
solver time: 0.028239
solver time: 0.018291
solver time: 0.018133
solver time: 0.017463
solver time: 0.018425
solver time: 0.017462
solver time: 0.019470
solver time: 0.020075
solver time: 0.017156
solver time: 0.016994
solver time: 0.022822
solver time: 0.025683
solver time: 0.017895
solver time: 0.024991
solver time: 0.017129
solver time: 0.028229
solver time: 0.014601
solver time: 0.025064
solver time: 0.014364
solver time: 0.020803
solver time: 0.011387
solver time: 0.041871
solver time: 0.013326
solver time: 0.010609
solver time: 0.015937
solver time: 0.012670
solver time: 0.013214
solver time: 0.010542
solver time: 0.012082
solver time: 0.011136
solver time: 0.013361
solver time: 0.011288
solver time: 0.012865
solver time: 0.015118
solver time: 0.017965
solver time: 0.017676
solver time: 0.029309
solver time: 0.018754
solver time: 0.016743
solver time: 0.017627
solver time: 0.018350
solver time: 0.019865
solver time: 0.017784
solver time: 0.015771
solver time: 0.017858
solver time: 0.017445
solver time: 0.017529
solver time: 0.016989
solver time: 0.017326
solver time: 0.016378
solver time: 0.015842
solver time: 0.015983
solver time: 0.016424
solver time: 0.015772
solver time: 0.016275
solver time: 0.018587
solver time: 0.018780
solver time: 0.015130
solver time: 0.015676
solver time: 0.013548
solver time: 0.015363
solver time: 0.015692
solver time: 0.014703
solver time: 0.016040
solver time: 0.015461
solver time: 0.014108
solver time: 0.018002
solver time: 0.014736
solver time: 0.015342
solver time: 0.015623
solver time: 0.014029
solver time: 0.014831
solver time: 0.015464
solver time: 0.014131
solver time: 0.015590
solver time: 0.013597
solver time: 0.013393
solver time: 0.014460
solver time: 0.018404
solver time: 0.017950
solver time: 0.016268
solver time: 0.015683
solver time: 0.015537
solver time: 0.016887
solver time: 0.017083
solver time: 0.016588
solver time: 0.016346
solver time: 0.014546
solver time: 0.014235
solver time: 0.012632
solver time: 0.016101
solver time: 0.017285
Run MPC-CBF
solver time: 0.026445
solver time: 0.024115
solver time: 0.020360
solver time: 0.021547
solver time: 0.024552
solver time: 0.023751
solver time: 0.020647
solver time: 0.022978
solver time: 0.021042
solver time: 0.019102
solver time: 0.030104
solver time: 0.020458
solver time: 0.034109
solver time: 0.026081
solver time: 0.022414
solver time: 0.024533
solver time: 0.021113
solver time: 0.033569
solver time: 0.023680
solver time: 0.021309
solver time: 0.021535
solver time: 0.020313
solver time: 0.149422
solver time: 0.035624
solver time: 0.038381
solver time: 0.023511
solver time: 0.026955
solver time: 0.029792
solver time: 0.047430
solver time: 0.036920
solver time: 0.022587
solver time: 0.035625
solver time: 0.038502
solver time: 0.018121
solver time: 0.040078
solver time: 0.026732
solver time: 0.034052
solver time: 0.021790
solver time: 0.018138
solver time: 0.050003
solver time: 0.022862
solver time: 0.026748
solver time: 0.026580
solver time: 0.032877
Error using  * 
Incorrect dimensions for matrix multiplication. Check that the number of columns in the first matrix matches the number of rows in
the second matrix. To operate on each element of the matrix individually, use TIMES (.*) for elementwise multiplication.

Error in MPCCBF/sim (line 33)
                xk = self.system.A * xk + self.system.B * uk;

Error in test (line 115)
    controller_mpc_cbf_one.sim(time_total);

Related documentation

Note that I encounter the same error in any other execution of the other tests:

>> testBenchmark
solver time: 0.022939
Error using  * 
Incorrect dimensions for matrix multiplication. Check that the number of columns in the first matrix matches the number of rows in
the second matrix. To operate on each element of the matrix individually, use TIMES (.*) for elementwise multiplication.

Error in MPCCBF/sim (line 33)
                xk = self.system.A * xk + self.system.B * uk;

Error in testBenchmark (line 52)
    controller_mpc_cbf.sim(time_total);

Related documentation
>> testGamma
Run MPC-CBF with gamma 0.100000
solver time: 0.021581
Error using  * 
Incorrect dimensions for matrix multiplication. Check that the number of columns in the first matrix matches the number of rows in
the second matrix. To operate on each element of the matrix individually, use TIMES (.*) for elementwise multiplication.

Error in MPCCBF/sim (line 33)
                xk = self.system.A * xk + self.system.B * uk;

Error in testGamma (line 50)
    controller_mpc_cbf_list{ind}.sim(time_total);

Related documentation
>> testHorizon
solver time: 0.030083
Error using  * 
Incorrect dimensions for matrix multiplication. Check that the number of columns in the first matrix matches the number of rows in
the second matrix. To operate on each element of the matrix individually, use TIMES (.*) for elementwise multiplication.

Error in MPCCBF/sim (line 33)
               xk = self.system.A * xk + self.system.B * uk;

Error in testHorizon (line 48)
controller_mpc_cbf_1.sim(time_total);

Related documentation

Is there any other place where to look for an IPOPT version that works on Windows?

@mcamurri
Copy link
Author

mcamurri commented Nov 9, 2023

Update 1

I have just installed matlab on Ubuntu 20.04, used the Ipopt zip file provided for linux, and installed the YALMIP master according to instructions.

And I've got the exact same problem:

Error using  * 
Incorrect dimensions for matrix multiplication. Check that the number of columns in the
first matrix matches the number of rows in the second matrix. To operate on each element
of the matrix individually, use TIMES (.*) for elementwise multiplication.

Error in MPCCBF/sim (line 33)
                xk = self.system.A * xk + self.system.B * uk;

Error in test (line 115)
    controller_mpc_cbf_one.sim(time_total);

Related documentation

The only code that succeeds is the first part of test.m where DCLF-DCBF is executed.

@mcamurri
Copy link
Author

mcamurri commented Nov 9, 2023

Update 2 and Solution

The problem is indeed caused by IPOPT not being able to find a feasible solution.

I solved by looking for a YALMIP release that was closer to the date of publication of the ACC 2021 paper.

The release R20210331 worked for me on Matlab 2023b and Ubuntu 20.04.

I had applied some other fixes to be able to use all scripts, see #13 #14 and #15

Please specify in your README.md the correct version of YALMIP to use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant