-
-
Notifications
You must be signed in to change notification settings - Fork 12.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
87 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
class Casadi < Formula | ||
Check warning on line 1 in Formula/c/casadi.rb GitHub Actions / macOS 14-arm64`brew linkage --cached --test --strict casadi` failed on macOS Sonoma (14) on Apple Silicon!
Check warning on line 1 in Formula/c/casadi.rb GitHub Actions / macOS 13-arm64`brew linkage --cached --test --strict casadi` failed on macOS Ventura (13) on Apple Silicon!
|
||
desc "Symbolic framework for numeric optimization" | ||
homepage "http://casadi.org" | ||
url "https://github.com/casadi/casadi/releases/download/3.6.6/casadi-3.6.6.tar.gz" | ||
sha256 "104601d37ab7ebf897bce7e097823bb090dd7629a7cc4c2e76780f46fc0e59f6" | ||
license "LGPL-3.0-or-later" | ||
|
||
depends_on "cmake" => :build | ||
depends_on "doxygen" => :build | ||
depends_on "pkg-config" => :build | ||
depends_on "swig" => :build | ||
|
||
depends_on "ipopt" | ||
depends_on "numpy" | ||
depends_on "osqp" | ||
depends_on "proxsuite" | ||
depends_on "python@3.12" | ||
depends_on "swig" | ||
depends_on "tinyxml2" | ||
|
||
def python3 | ||
"python3.12" | ||
end | ||
|
||
def install | ||
site_packages = prefix/Language::Python.site_packages(python3) | ||
system "cmake", "-S", ".", "-B", "build", | ||
"-DPYTHON_EXECUTABLE=#{which(python3)}", | ||
"-DWITH_PYTHON=ON", | ||
"-DWITH_PYTHON3=ON", | ||
"-DWITH_LAPACK=ON", | ||
"-DWITH_IPOPT=ON", | ||
"-DWITH_BUILD_IPOPT=OFF", | ||
"-DWITH_JSON=OFF", | ||
"-DWITH_THREAD=ON", | ||
"-DWITH_OSQP=ON", | ||
"-DWITH_BUILD_OSQP=OFF", | ||
"-DWITH_QPOASES=ON", | ||
"-DWITH_PROXQP=ON", | ||
"-DWITH_BUILD_PROXQP=OFF", | ||
"-DWITH_TINYXML=ON", | ||
"-DWITH_BUILD_TINYXML=OFF", | ||
"-DWITH_KNITRO=OFF", | ||
"-DWITH_BUILD_KNITRO=OFF", | ||
"-DWITH_CPLEX=OFF", | ||
"-DWITH_MOCKUP_CPLEX=OFF", | ||
"-DWITH_GUROBI=OFF", | ||
"-DWITH_MOCKUP_GUROBI=OFF", | ||
"-DWITH_HSL=OFF", | ||
"-DWITH_MOCKUP_HSL=OFF", | ||
"-DWITH_WORHP=OFF", | ||
"-DWITH_MOCKUP_WORHP=OFF", | ||
"-DCASADI_PYTHON_PIP_METADATA_INSTALL=ON", | ||
"-DCASADI_PYTHON_PIP_METADATA_INSTALLER:STRING=\"brew\"", | ||
"-DSWIG_IMPORT=ON -DSWIG_EXPORT=OFF", | ||
"-DPYTHON_PREFIX=#{site_packages}", | ||
*std_cmake_args | ||
system "cmake", "--build", "build" | ||
system "cmake", "--install", "build" | ||
end | ||
|
||
test do | ||
system python3, "-c", <<~EOS | ||
from casadi import * | ||
# minimize 3x + 4y | ||
# subject to x + 2y <= 14 | ||
# 3x - y >= 0 | ||
# x - y <= 2 | ||
# Sparsity of the LP linear term | ||
A = Sparsity.dense(3, 2) | ||
# Create solver | ||
solver = conic('solver', 'qpoases', {'a':A}) | ||
g = DM([3,4]) | ||
a = DM([[1, 2],[3, -1], [1, -1]]) | ||
lba = DM([-inf, 0, -inf]) | ||
uba = DM([14, inf, 2]) | ||
sol = solver(g=g, a=a, lba=lba, uba=uba) | ||
print(sol) | ||
EOS | ||
end | ||
end |