Hangcil / fmincon-with-Cpp

A part of C++ optimization lib based on armadillo. It just implements one of the frequently used functions fmincon().
12 stars 4 forks source link

Build and Run fmincon in Ubuntu #4

Closed Elektron97 closed 1 year ago

Elektron97 commented 1 year ago

Hi! It's available a version of the package in linux?

Elektron97 commented 1 year ago

I edited the CMakeLists.txt for Unix user. You can find other modifications for interface this pkg with ROS in my fork.

#########################################
#### CMake File for Sci-Arma Library ####
#########################################

cmake_minimum_required(VERSION 3.22)
project(sci_arma)

set(CMAKE_CXX_STANDARD 14)

# Destions Dirs
set(EXECUTABLE_OUTPUT_PATH ./build)
set(LIBRARY_OUTPUT_PATH ./build)

# Find and Including Armadillo
find_package(Armadillo REQUIRED)
include_directories(./include ${ARMADILLO_INCLUDE_DIRS})
link_directories(${ARMADILLO_LIBRARIES})

# Build Optimization Library
add_library(optim src/fmincon/Rosenbrock.cpp src/fmincon/Powell.cpp src/fmincon/Powell.cpp src/fmincon/Powell_modified.cpp
        src/fmincon/BFGS.cpp src/fmincon/fmincon.cpp)
target_link_libraries(optim ${ARMADILLO_LIBRARIES})

#Add Example Exe
add_executable(sci_arma example_without_gra.cpp)
target_link_libraries(sci_arma ${ARMADILLO_LIBRARIES} optim)