Environment

class Environment

This class provides access to the environment variables and provides facilities to specify where to load the underlying AMPL interpreter.

Environment()

Default constructor.

Environment(binaryDirectory)

Constructor with ability to select the location of the AMPL binary. Note that if this constructor is used, the automatic lookup for an AMPL executable will not be executed.

Parameters

binaryDirectory (character) – The directory in which look for the AMPL binary.

Environment(binaryDirectory, binaryName)

Constructor with ability to select the location and name of the AMPL binary. Note that if this constructor is used, the automatic lookup for an AMPL executable will not be executed.

Parameters
  • binaryDirectory (character) – The directory in which look for the AMPL binary.

  • binaryName (character) – The name of the AMPL binary.

Environment.get(name)

Searches the current object for an environment variable called name and returns its value if found.

Parameters

name (character) – Name of the environment variable.

Returns

The value of the variable or NA.

Return type

character

Environment.put(name, value)

Add an environment variable to the environment, or change its value if already defined.

Parameters
  • name (character) – Name of the environment variable.

  • value (character) – Value to be assigned.

Environment.setBinDir(binaryDirectory)

Set the location where AMPLAPI will search for the AMPL executable.

Parameters

binaryDirectory (character) – The directory in which look for the AMPL Binary.

Environment.getBinDir()

Get the location where AMPLAPI will search for the AMPL executable.

Returns

The location where AMPLAPI will search for the AMPL executable.

Return type

character

Environment.setBinName(binaryName)

Set the name of the AMPL executable.

Parameters

binaryName (character) – The name of the AMPL binary.

Environment.getBinName()

Get the name of the AMPL executable.

Returns

The name of the AMPL executable.

Return type

character

Environment.toString()

Returns all variables in the object as a string.

Returns

All variables in the map.

Return type

character

Environment.list()

Returns all variables in the object as a list.

Returns

All variables in the map.

Return type

list