Windows

The Knitro software package for Windows is delivered as a zipped file (ending in .zip), or as a self-extracting executable (ending in .exe). For the zipped file, double-click on it and extract all contents to a new folder. For the .exe file, double-click on it and follow the instructions. The self-extracting executable creates start menu shortcuts and an uninstall entry in Add/Remove Programs; otherwise, the two install methods are identical.

The default installation location for Knitro is (assuming your HOMEDRIVE is “C:”):

> C:\Program Files\Artelys

Unpacking will create a folder named knitro-12.1.0-z. Contents of the full product distribution are the following:

  • INSTALL.txt: a file containing installation instructions.
  • LICENSE_KNITRO.txt: a file containing the Knitro license agreement.
  • README.txt: a file with instructions on how to get started using Knitro.
  • Knitro_12_1_ReleaseNotes: a file containing release notes.
  • get_machine_ID: an executable that identifies the machine ID, required for obtaining a Artelys license file.
  • doc: a folder containing Knitro documentation, including this manual.
  • include: a folder containing the Knitro header file knitro.h.
  • lib: a folder containing the Knitro library file knitro.dll, as well as any other libraries that are used with Knitro.
  • examples: a folder containing examples of how to use the Knitro API in different programming languages (C, C++, C#, Fortran, Java, Python, R). The examples\C folder contains the most extensive set (see examples\C\README.txt for details).
  • knitroampl: a folder containing knitroampl.exe (the Knitro solver for AMPL), instructions, and an example model for testing Knitro with AMPL.
  • knitromatlab: A folder containing the files needed to use the Knitro solver for MATLAB, example models, and the instructions and explanation file README.txt.

To activate Knitro for your computer you will need a valid Artelys license file. If you purchased a floating network license, then refer to the Artelys License Manager User’s Manual provided in the doc folder of your distribution.

For a stand-alone, single computer license, double-click on the get_machine_ID.bat batch file provided with the distribution. This will generate a machine ID (five pairs of hexadecimal digits). Alternatively, open a DOS-like command window (click Start / Run, and then type cmd). Change to the directory where you unzipped the distribution, and type get_machine_ID.exe, a program supplied with the distribution to generate the machine ID.

If purchased through Artelys, you may request your license key from your Artelys customer area at https://www.artelys.com/en/home using your machine ID (please contact info-knitro@artelys.com if you have any issue with your customer area). If Knitro was purchased through a distributor, then email the machine ID to your local distributor. Artelys (or your local distributor) will then send you a license file containing the encrypted license text string. The Artelys license manager supports a variety of ways to install licenses. The simplest procedure is to place each license file in the folder:

> C:\Program Files\Artelys\

(create the folder above if it does not exist). The license file name may be changed, but must begin with the characters artelys_lic. If this does not work, try creating a new environment variable called ARTELYS_LICENSE and set it to the folder holding your license file(s). See information on setting environment variables below and refer to the Artelys License Manager User’s Manual for more installation details.

Setting environment variables

In order to run Knitro binary or executable files from anywhere on your Windows computer, as well as load dynamic libraries (or dll’s) used by Knitro at runtime, it is necessary to make sure that the PATH system environment variable is set properly on your Windows machine. In particular, you must update the system PATH environment variable so that it indicates the location of the Knitro lib folder (containing the Knitro provided dll’s) and the knitroampl folder (or whichever folder contains the knitroampl.exe executable file). This can be done as follows.

  • Windows 8 and later
    • From the Windows Start screen, search for and open “Edit the system environment variables”.
    • Click the Advanced tab.
    • Click Environment Variables.
    • Under System variables, edit the Path variable to add the Knitro lib folder and knitroampl folder. Specify the whole path to these folders, and make sure to separate the paths by a semi-colon.
  • Windows Vista and Windows 7
    • At the Windows desktop, right-click “Computer”.
    • Select “Properties”.
    • Click on Advanced System Settings in the left pane.
    • In the System Properties window select the Advanced tab.
    • Click Environment Variables.
    • Under System variables, edit the Path variable to add the Knitro lib folder and knitroampl folder. Specify the whole path to these folders, and make sure to separate the paths by a semi-colon.

Note that you may need to restart your Windows machine after modifying the environment variables, for the changes to take effect. Simply logging out and relogging in is not enough. Moreover, if the PATH environment variable points to more than one folder that contains an executable or dll of the same name, the one that will be chosen is the one whose folder appears first in the PATH variable definition.

If you are using Knitro with AMPL, you should make sure the folder containing the AMPL executable file ampl.exe is also added to the PATH variable (as well as the folder containing the knitroampl.exe as described above). Additionally, if you are using an external third party dll with Knitro such as your own Basic Linear Algebra Subroutine (BLAS) libraries (see user options blasoption and blasoptionlib), or a Linear Programming (LP) solver library (see user option lpsolver), then you will also need to add the folders containing these dll’s to the system PATH environment variable as described in the last step above.

If you are setting the ARTELYS_LICENSE environment variable to activate your license, then follow the instructions above, but in the last step create a new environment variable called ARTELYS_LICENSE and give it the value of the folder containing your Artelys license file (specify the whole path to this folder).

Knitro for MATLAB

To use Knitro with MATLAB, you may need to add the Knitro/MATLAB interface files to your MATLAB path. Assuming the default installation folders were used and the KNITRODIR environment variable contains the path to the Knitro installation directory, set by the installer or manually, the MATLAB path can be updated with the following commands in MATLAB:

> addpath(strcat(getenv('KNITRODIR’),’\knitromatlab'));
> savepath();

Alternatively, if the environment variable is not set properly, you can update the MATLAB path by calling addpath() with the full path to the Knitro/MATLAB interface files, such as:

> addpath('C:\Program Files\Artelys\Knitro |release|\knitromatlab');
> savepath();