Skip to content

Instantly share code, notes, and snippets.

@gnowzil
gnowzil / CMakeList.txt
Created Feb 17, 2022
EMTG CMakeList.txt modification
View CMakeList.txt
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 Oct 28, 2021
HS116 matrix structure, nonlinear objective
View hs116_matrix.m
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 Oct 28, 2021
HS116 with nonlinear constraints
View hs116_nonlin.m
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 Jun 19, 2020
Makefile for SNOPT/AMPL from library
View makefile_ampl
#-----------------------------------------------------------------------
# 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 Mar 30, 2020
pyOptSparse SNOPT precompiled library setup
View setup.py
#!/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)