Questions tagged [casadi]

CasADi is an open-source tool for nonlinear optimization and algorithmic differentiation.

CasADi is an open-source tool for nonlinear optimization and algorithmic differentiation.

It facilitates rapid — yet efficient — implementation of different methods for numerical optimal control, both in an offline context and for nonlinear model predictive control (NMPC).

See https://web.casadi.org/

21 questions
1
vote
1 answer

Integrate pre-compiled libraries into C++ codebase with CMake ExternalProject

I want to integrate CasADi into a CMake-based C++ codebase as an ExternalProject. For this purpose, I would like to use pre-compiled libraries because building from source is not recommended. So far, I have only managed to write the…
fdev
  • 127
  • 12
1
vote
0 answers

How to improve the execution time of gradient estimation using tf.GradientTape in tensorflow 2.x

The objective is to implement https://web.casadi.org/blog/tensorflow/, which was written using Tensorflow 1.x and gpflow 1.x, using Tensorflow 2.x and gpflow 2.x . I have implemented it in Tensorflow 2.x (I attached them at the end of the question).…
GPrathap
  • 7,336
  • 7
  • 65
  • 83
1
vote
0 answers

Derivative of spline in casadi

I am working on an MPC with the python library doMPC and I have to express all my objective functions and constraints using casadi symbolic framework. I need to use an interpolating cubic spline and use its derivative. However, I cannot find the…
0
votes
0 answers

What are the differences between casadi's dot product and numpy's dot product, and how can I calculate the dot product in Casadi?

I am trying to write a conversion from a pytorch neural network to a casadi neural network. I am getting an error where the dot product requires equal shapes, whereas numpy does not require that. Example: import numpy as np A = np.array([[1, 2,…
Tom McLean
  • 5,583
  • 1
  • 11
  • 36
0
votes
0 answers

Is it possible to specify the number of threads used by cbc in bonmin options?

I'm trying to solve a MINLP using bonmn. However, due to the large scale of the problem to be solved, the computation time is very long. It seems that the MILP part is taking a long time, so I would like to speed up the CBC solver used in MILP by…
0
votes
0 answers

MATLAB Code generation together with Casadi

I am trying to generate a C code from a MATLAB code (MPC) that uses CasADi. I initially tried to use MATLAB Coder to do it, but it couldn't generate code from casadi.Function() because it contains some statements that are not supported by MATLAB…
0
votes
0 answers

How to generate code from a MATLAB function containing 'import' statement?

I am trying to generate C code from a MATLAB code using MATLAB Coder. The MATLAB code is an MPC controller and uses CasADi, and therefore there is an 'import' statement to import casadi functions. So, MATLAB Coder gives an error that import…
Kamal
  • 1
  • 2
0
votes
2 answers

Transfer or Extract Computed Data from One Python File to Another

AA computes a function using a software called CasADi. I have installed CasADi, and AA can run on my desktop. BB has to run in a container and imports data from AA.Because of this, BB cannot run because it doesn't recognize CasADi How can I change…
NAA
  • 1
  • 1
0
votes
0 answers

What is the Problem with the CASADI examples for callbacks?

I am currently trying to implement a CasADi callback function into my code but ran into some problems. While trying to find a solution I tried out the examples that are provided on the CasADi website. But all of the exemplary code files throw errors…
Quatsch
  • 1
  • 1
0
votes
0 answers

Code Generation using CasADi and IPOPT in Simulink for MPC Problem

I am trying to generate code in Simulink using level 2 S-Function. I am able to generate code in Simulink but the problem is Simulink is not recognizing the IPOPT. It is using its own solvers to solve the problem. Please share your experiences here,…
0
votes
0 answers

Neural Network MPC (do_MPC library)

I want to use neural networks as models for do_MPC so, As mentioned in do_MPC doc, converted the tf model to ONNX model and converted it to Casadi format with do_MPC.sysid.ONNXConversion. Lastly, I tried to check using casadi.convert, but the error…
이윤형
  • 1
  • 1
0
votes
1 answer

How can I both lower limit an optimization variable and allow it to be zero?

I am working on a Model Predictive Control for a chiller - storage tank system. I'm a thermal engineering master student and this topic is new to me, so the things I'm asking may not be for this forum, but I'm running out of ideas. I'm developing…
Martin B
  • 1
  • 1
0
votes
0 answers

Constrained QP problem with C++ CasADi library apparently does not take into account the costraint function

I don't know if someone can help here as the target community may not be so wide, but I will give it a try. I'm practicing with the open-source C++ CasADi library for optimization and I'm struggling with the implementation of a quadratic programming…
Marco Ferro
  • 386
  • 4
  • 18
0
votes
1 answer

Assertion "!de_in[DE_X].is_empty()" failed: Ill-posed ODE - no state

I've the following code which uses python pyomo. I think my code is right, but it can't run. I don't understand what's wrong. False statement casadi/core/integrator.cpp:1417: Assertion "!de_in[DE_X].is_empty()" failed:Ill-posed ODE - no state。 this…
0
votes
0 answers

Symbol lookup error: Using precompiled binary CasADI in C++ with cmake

I want to use casadi with c++ for optimal control problems. Therefore, I want to include it using the binary with cmake. I am on a Ubuntu 20.04 machine. My cmake version is 3.16.3. My gcc version is 11.1.0. I followed the following example:…
1
2