Skip to content

Instantly share code, notes, and snippets.

@gnowzil
gnowzil / CMakeList.txt
Created February 17, 2022 19:30
EMTG CMakeList.txt modification
cmake_minimum_required(VERSION 3.8)
#pull in the user-defined configurations
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR})
include(EMTG-Config.cmake)
if (${EMTG_MPI})
add_definitions(-DEMTG_MPI)
message(STATUS "Activating MPI with compiler: ${CMAKE_CXX_COMPILER}")
endif()
@gnowzil
gnowzil / hs116_matrix.m
Created October 28, 2021 21:19
HS116 matrix structure, nonlinear objective
function [x,F,info]=hs116_matrix()
% HS Problem 116 with explicit linear constraints.
% The Jacobian structure and linear elements are defined as a matrix.
% Linear objective row is in the first row and defined as a "nonlinear" function.
options.name = 'hs116';
options.printfile = 'hs116_mtx.out';
options.specsfile = which('hs116.spc');
options.system_information ='yes';
@gnowzil
gnowzil / hs116_nonlin.m
Created October 28, 2021 21:17
HS116 with nonlinear constraints
function [x,F,xmul,Fmul,INFO] = hs116_nonlin()
% HS116
% Problem has both linear and nonlinear constraints but
% all constraints are defiend as nonlinear in this example.
%
% Jacobian defined in coordinate form
% Linear objective defined in row 1.
%
%
@gnowzil
gnowzil / makefile_ampl
Last active June 19, 2020 16:15
Makefile for SNOPT/AMPL from library
#-----------------------------------------------------------------------
# Makefile to create SNOPT AMPL executable from libsnopt7.a
#
# Assumes you have downloaded solvers.tgz and snopt.tgz and
# that you ran "./configurehere; make" in the solvers
# directory to build amplsolver.a
#-----------------------------------------------------------------------
SNOPT_LIB = /path/to/libsnopt7.a
@gnowzil
gnowzil / setup.py
Created March 30, 2020 17:34
pyOptSparse SNOPT precompiled library setup
#!/usr/bin/env python
# This is a modified version of pyoptsparse/pyoptsparse/pySNOPT/setup.py
# The modifications allow the user to use pyOpt with SNOPT precompiled libraries.
#
# Instructions:
# 1. Replace pyoptsparse/pyoptsparse/pySNOPT/setup.py with this file.
# 2. Modify line 39 so that snopt7_path is the actual path to the location of the
# precompiled SNOPT library (libsnopt7.*).
# 3. Make sure to add the location of the library to DYLD_LIBRARY_PATH (for macOS)