#include<casadi/casadi.hpp>
#include<iostream>
using namespace std;
using namespace casadi;
int main()
{
MX x = MX::sym("x", 1);
MX y = MX::sym("y", 1);
MX z = MX::sym("z", 1);
MX f = pow(x,2) + 100 * pow(z,2);
MX g = z + pow((1-x), 2) - y;
MXDict nlp = {{"f", f}, {"g", g}, {"x", MX::vertcat({x,y,z})}};
Function solver = nlpsol("S","ipopt",nlp);
DMDict arg ={{"ubg", 0}, {"lbg", 0}, {"x0", DM::vertcat({0,0,0})}};
DMDict res = solver(arg);
return 0;
} ...
find_package(IPOPT)
find_package(CASADI)
...
cmake -DWITH_IPOPT=ON ..
Now I get the libcasadi_nlpsol_ipopt.so in ~/casadi/build/lib.
To be sure that The library will be detected, I do
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/alic/casadi/build/lib
I recompiled the small optimization code given above but when I run I get an eror similar to the previous
one, except that there is some symbol that he cannot find :
CasADi - 2018-01-31 18:28:19 WARNING(".../casadi/core/plugin_interface.hpp:292: Assertion "handle!=0" failed:
PluginInterface::load_plugin: Cannot load shared library 'libcasadi_nlpsol_ipopt.so':
(
Searched directories: 1. casadipath from GlobalOptions
2. CASADIPATH env var
3. PATH env var (Windows)
4. LD_LIBRARY_PATH env var (Linux)
5. DYLD_LIBRARY_PATH env var (osx)
A library may be 'not found' even if the file exists:
* library is not compatible (different compiler/bitness)
* the dependencies are not found
)
Tried '' :
Error code: /usr/local/lib/libcasadi_nlpsol_ipopt.so: undefined symbol: _ZN6casadi14OracleFunction8finalizeERKSt3mapISsNS_11GenericTypeESt4lessISsESaISt4pairIKSsS2_EEE# toplevel CMakeLists.txt
cmake_minimum_required(VERSION 3.2 FATAL_ERROR)
# put debugging symbols
set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} /home/alic/casadi/cmake)
find_package(CASADI REQUIRED)
find_package(IPOPT REQUIRED)
add_subdirectory(hovercraft)
add_subdirectory(mylibrary)Also, normally you don't link against the build directory. You do a "make install" step. Joel
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/alic/coinhsl/lib
...
This is Ipopt version 3.12.9, running with linear solver mumps.
...
Also, normally you don't link against the build directory. You do a "make install" step. Joel
What do you mean? (I am pretty new to cmake).
So hove can I select that I want the problem to be solve specifically with ma_97?