QuadraticProgram¶
- class QuadraticProgram(name='')[source]¶
Quadratically Constrained Quadratic Program representation.
This representation supports inequality and equality constraints, as well as continuous, binary, and integer variables.
- Parameters
name (
str
) – The name of the quadratic program.
Attributes
Returns the list of linear constraints of the quadratic program.
Returns the dictionary that maps the name of a linear constraint to its index.
Returns the name of the quadratic program.
Returns the quadratic objective.
Returns the list of quadratic constraints of the quadratic program.
Returns the dictionary that maps the name of a quadratic constraint to its index.
Status of the quadratic program.
Returns the list of variables of the quadratic program.
Returns the dictionary that maps the name of a variable to its index.
Methods
QuadraticProgram.binary_var
([name])Adds a binary variable to the quadratic program.
Clears the quadratic program, i.e., deletes all variables, constraints, the objective function as well as the name.
Adds a continuous variable to the quadratic program.
Returns the quadratic program as a string of LP format.
Loads this quadratic program from a docplex model.
Returns a linear constraint for a given name or index.
Returns the total number of binary variables.
Returns the total number of continuous variables.
Returns the total number of integer variables.
Returns the number of linear constraints.
Returns the number of quadratic constraints.
QuadraticProgram.get_num_vars
([vartype])Returns the total number of variables or the number of variables of the specified type.
Returns a quadratic constraint for a given name or index.
Returns a variable for a given name or index.
QuadraticProgram.integer_var
([lowerbound, …])Adds an integer variable to the quadratic program.
QuadraticProgram.linear_constraint
([linear, …])Adds a linear equality constraint to the quadratic program of the form:
QuadraticProgram.maximize
([constant, …])Sets a quadratic objective to be maximized.
QuadraticProgram.minimize
([constant, …])Sets a quadratic objective to be minimized.
Returns the quadratic program as a string in Docplex’s pretty print format.
QuadraticProgram.prettyprint
([out])Pretty prints the quadratic program to a given output stream (None = default).
Adds a quadratic equality constraint to the quadratic program of the form:
QuadraticProgram.read_from_lp_file
(filename)Loads the quadratic program from a LP file.
Remove a linear constraint
Remove a quadratic constraint
Substitutes variables with constants or other variables.
Returns a docplex model corresponding to this quadratic program.
QuadraticProgram.write_to_lp_file
(filename)Writes the quadratic program to an LP file.