Bengali
ভাষাসমূহ
English
Bengali
Japanese
Spanish



QuadraticProgram

class QuadraticProgram(name='')[source]

Bases: object

Quadratically Constrained Quadratic Program representation.

This representation supports inequality and equality constraints, as well as continuous, binary, and integer variables.

প্যারামিটার:

name (str) -- The name of the quadratic program.

Attributes

linear_constraints

Returns the list of linear constraints of the quadratic program.

linear_constraints_index

Returns the dictionary that maps the name of a linear constraint to its index.

name

Returns the name of the quadratic program.

objective

Returns the quadratic objective.

quadratic_constraints

Returns the list of quadratic constraints of the quadratic program.

quadratic_constraints_index

Returns the dictionary that maps the name of a quadratic constraint to its index.

status

Status of the quadratic program.

variables

Returns the list of variables of the quadratic program.

variables_index

Returns the dictionary that maps the name of a variable to its index.

Methods

binary_var([name])

Adds a binary variable to the quadratic program.

binary_var_dict(keys[, name, key_format])

Uses 'var_dict' to construct a dictionary of binary variables

binary_var_list(keys[, name, key_format])

Uses 'var_list' to construct a list of binary variables

clear()

Clears the quadratic program, i.e., deletes all variables, constraints, the objective function as well as the name.

continuous_var([lowerbound, upperbound, name])

Adds a continuous variable to the quadratic program.

continuous_var_dict(keys[, lowerbound, ...])

Uses 'var_dict' to construct a dictionary of continuous variables

continuous_var_list(keys[, lowerbound, ...])

Uses 'var_list' to construct a list of continuous variables

export_as_lp_string()

Returns the quadratic program as a string of LP format.

from_ising(qubit_op[, offset, linear])

Create a quadratic program from a qubit operator and a shift value.

get_feasibility_info(x)

Returns whether a solution is feasible or not along with the violations.

get_linear_constraint(i)

Returns a linear constraint for a given name or index.

get_num_binary_vars()

Returns the total number of binary variables.

get_num_continuous_vars()

Returns the total number of continuous variables.

get_num_integer_vars()

Returns the total number of integer variables.

get_num_linear_constraints()

Returns the number of linear constraints.

get_num_quadratic_constraints()

Returns the number of quadratic constraints.

get_num_vars([vartype])

Returns the total number of variables or the number of variables of the specified type.

get_quadratic_constraint(i)

Returns a quadratic constraint for a given name or index.

get_variable(i)

Returns a variable for a given name or index.

integer_var([lowerbound, upperbound, name])

Adds an integer variable to the quadratic program.

integer_var_dict(keys[, lowerbound, ...])

Uses 'var_dict' to construct a dictionary of integer variables

integer_var_list(keys[, lowerbound, ...])

Uses 'var_list' to construct a list of integer variables

is_feasible(x)

Returns whether a solution is feasible or not.

linear_constraint([linear, sense, rhs, name])

Adds a linear equality constraint to the quadratic program of the form:

maximize([constant, linear, quadratic])

Sets a quadratic objective to be maximized.

minimize([constant, linear, quadratic])

Sets a quadratic objective to be minimized.

prettyprint([wrap])

Returns a pretty printed string of this problem.

quadratic_constraint([linear, quadratic, ...])

Adds a quadratic equality constraint to the quadratic program of the form:

read_from_lp_file(filename)

Loads the quadratic program from a LP file.

remove_linear_constraint(i)

Remove a linear constraint

remove_quadratic_constraint(i)

Remove a quadratic constraint

substitute_variables([constants, variables])

Substitutes variables with constants or other variables.

to_ising()

Return the Ising Hamiltonian of this problem.

write_to_lp_file(filename)

Writes the quadratic program to an LP file.