Model

Constructor

Model(**kwargs)

Creates an optimization model

Components

Model.get_name(self)

Returns model name

Model.set_session(self, session)

Sets the session of model

Model.get_session(self)

Returns the session of the model

Model.get_session_type(self)

Tests whether the model session is defined and still active

Model.set_objective(self, expression, name)

Specifies the objective function for the model

Model.append_objective(self, expression, name)

Appends a new objective to the model

Model.get_objective(self)

Returns the objective function as an Expression object

Model.get_all_objectives(self)

Returns a list of objectives in the model

Model.add_variable(self, name[, vartype, …])

Adds a new variable to the model

Model.add_variables(self, \*argv, name[, …])

Adds a group of variables to the model

Model.add_implicit_variable(self[, argv, name])

Adds an implicit variable to the model

Model.get_variable(self, name)

Returns the reference to a variable in the model

Model.get_variables(self)

Returns a list of variables

Model.get_grouped_variables(self)

Returns an ordered dictionary of variables

Model.get_implicit_variables(self)

Returns a list of implicit variables

Model.get_variable_coef(self, var)

Returns the objective value coefficient of a variable

Model.drop_variable(self, variable)

Drops a variable from the model

Model.drop_variables(self, \*variables)

Drops a variable group from the model

Model.add_constraint(self, c, name)

Adds a single constraint to the model

Model.add_constraints(self, argv, name)

Adds a set of constraints to the model

Model.get_constraint(self, name)

Returns the reference to a constraint in the model

Model.get_constraints(self)

Returns a list of constraints in the model

Model.get_grouped_constraints(self)

Returns an ordered dictionary of constraints

Model.drop_constraint(self, constraint)

Drops a constraint from the model

Model.drop_constraints(self, \*constraints)

Drops a constraint group from the model

Model.add_set(self, name[, init, value, settype])

Adds a set to the model

Model.add_parameter(self, \*argv, name[, …])

Adds a abstract.Parameter object to the model

Model.add_statement(self, statement[, …])

Adds a PROC OPTMODEL statement to the model

Model.get_sets(self)

Returns a list of Set objects in the model

Model.get_parameters(self)

Returns a list of abstract.Parameter and abstract.ParameterGroup objects in the model

Model.get_statements(self)

Returns a list of all statements inside the model

Model.include(self, \*argv)

Adds existing variables and constraints to a model

Solver calls

Model.solve(self, \*\*kwargs)

Solves the model by calling CAS or SAS optimization solvers

Model.tune_parameters(self, \*\*kwargs)

Tunes the model to find ideal solver parameters

Model.get_solution(self[, vtype, solution, …])

Returns the primal and dual problem solutions

Model.get_variable_value(self, var)

Returns the value of a variable

Model.get_objective_value(self)

Returns the optimal objective value

Model.get_solution_summary(self)

Returns the solution summary table to the user

Model.get_problem_summary(self)

Returns the problem summary table to the user

Model.get_tuner_results(self)

Returns the tuning results

Model.print_solution(self)

Prints the current values of the variables

Model.clear_solution(self)

Clears the cached solution of the model

Export

Model.to_mps(self, \*\*kwargs)

Returns the problem in MPS format

Model.to_optmodel(self, \*\*kwargs)

Returns the model in OPTMODEL format

Model.export_mps(self[, filename, fetch])

Exports model in MPS format

Internal functions

Model._is_linear(self)

Checks whether the model can be written as a linear model (in MPS format)

Deprecated

Deprecated since version 1.0.0.

The following method(s) are deprecated and will be removed in future minor updates.

Model.to_frame(self, \*\*kwargs)