KNITRO

KNITRO 13.2

· KNITRO models/solves mixed-integer programming (MIP) models and mathematical programs with equilibrium constraints (MPEC) (see the KNITRO Documentation for details).

· KNITRO can use OpenMP (local host multi-processing) for some types of algorithms, as well as multistart and Parallel Finite-Difference Gradients. For more details see the KNITRO Documentation.

We are working on documentation of KNITRO OpenMP jobs. Please get in touch research-computing@wharton.upenn.edu if you need details on KNITRO+OpenMP.

Using KNITRO on Wharton’s HPC3

ALL software packages below require loading the knitro module before starting. That is done like:

module load knitro

That can be done in your ~/.bashrc file, in your job script prior to running any software below, or by hand in an interactive session.

Take a look at /usr/local/demo/optimization/knitro/, for some examples, a knitro.opt file (for setting your own options), etc.

Python

KNITRO for Python is available for your use across the cluster. Just load the knitro module before starting, which is done like:

module load knitro

That can be done in your ~/.bashrc file, in your job script prior to running any software below, or by hand in an interactive session.

For further details: https://www.artelys.com/tools/knitro_doc/2_userGuide/otherProgInterfaces.html

R

The KnitroR library is available for installation from any compute server in the cluster. Just import install the library in your R packages like:

qlogin
cd # <- change to your home directory
cp -r /usr/local/knitro/examples/R/KnitroR .
R CMD INSTALL KnitroR
logout

Then in your R code:

library(KnitroR)

To test functionality, in R:

knitro(objective=function(x) x[1]*x[2], x0=c(1,1))

For further details: https://www.artelys.com/tools/knitro_doc/2_userGuide/gettingStarted/startR.html

MATLAB

KNITRO Matlab is available for your use across the cluster.

As of v9, the command to use it has changed to knitromatlab (from KNITRO) instead of ktrlink (from MATLAB). In theory it should work ‘out of the box’, but some of the knitro options may have changed (if you’re loading a knitro.opt file, or something), and there are a good number of expanded bits as well.

 To activate in your MATLAB, add the addpath (below) to one of the following:

  • matlab code
  • ~/Documents/MATLAB/startup.m
addpath /usr/local/knitro/knitromatlab

You can test functionality like this:

[x fval] = knitro_nlp(@(x)cos(x),1)
...
x = 3.1416
fval = -1.0000

For further details: https://www.artelys.com/tools/knitro_doc/2_userGuide/gettingStarted/startMatlab.html

C/C++/Java

See the examples in /usr/local/knitro/examples/C or C++ or Java directories. For the C examples, just change the makefileKNDIR = /usr/local/knitro, and all should compile with a make.

For further details with C: https://www.artelys.com/tools/knitro_doc/2_userGuide/gettingStarted/startCallableLibrary.html

For further details with C++ & Javahttps://www.artelys.com/tools/knitro_doc/2_userGuide/otherProgInterfaces.html