Model ( name="", env=defaultEnv )

Model constructor.


name: Name of new model. Note that name will be stored as an ASCII string. Thus, a name like 'A<span>$</span>{\rightarrow}<span>$</span>B' will produce an error, because '<span>$</span>{\rightarrow}<span>$</span>' can not be represented as an ASCII character. Note also that names that contain spaces are strongly discouraged, because they can't be written to LP format files.

env: Environment in which to create the model. Creating your environment (using the Env constructor) gives you more control over Gurobi licensing, but it can make your program more complex. Use the default environment unless you know that you need to control your own environments.

Return value:

New model object. Model initially contains no variables or constraints.

Example usage:

  m = Model("NewModel")
  x0 = m.addVar()

  env = Env("my.log")
  m2 = Model("NewModel2", env)