pyoptinterface.knitro package

class pyoptinterface.knitro.Model

Bases: RawModel

KNITRO model class for PyOptInterface.

add_linear_constraint(expr: VariableIndex | ScalarAffineFunction | ExprBuilder, sense: ConstraintSense, rhs: float, name: str = '')
add_linear_constraint(expr: VariableIndex | ScalarAffineFunction | ExprBuilder, interval: Tuple[float, float], name: str = '')
add_linear_constraint(con: ComparisonConstraint, name: str = '')
add_m_linear_constraints(A, x, sense, b)

add constraints Ax <= / = / >= b

A is a 2-dimensional numpy array or scipy sparse matrix x is an iterable of variables sense is one of (poi.Leq, poi.Eq, poi.Geq) b is an iterable of values or a single scalar

add_m_variables(shape: Tuple[int, ...] | int, domain: VariableDomain | None = None, lb: float | None = None, ub: float | None = None, name: str | None = None, start: float | None = None)
add_nl_constraint(expr, sense: ConstraintSense, rhs: float, /, name: str = '')
add_nl_constraint(expr, interval: Tuple[float, float], /, name: str = '')
add_nl_constraint(con, /, name: str = '')
add_nl_objective(expr)
add_quadratic_constraint(expr: ScalarQuadraticFunction | ExprBuilder, sense: ConstraintSense, rhs: float, name: str = '')
add_quadratic_constraint(con: ComparisonConstraint, name: str = '')
add_second_order_cone_constraint(self, variables: collections.abc.Sequence[pyoptinterface._src.core_ext.VariableIndex], name: str = '', rotated: bool = False) pyoptinterface._src.core_ext.ConstraintIndex
add_variable(self, domain: pyoptinterface._src.core_ext.VariableDomain = VariableDomain.Continuous, lb: float = -1.7976931348623157e+308, ub: float = 1.7976931348623157e+308, name: str = '') pyoptinterface._src.core_ext.VariableIndex
add_variables(*coords: Collection, domain: VariableDomain | None = None, lb: float | None = None, ub: float | None = None, name: str | None = None, start: float | None = None)
close(self) None
delete_constraint(self, arg: pyoptinterface._src.core_ext.ConstraintIndex, /) None
delete_variable(self, arg: pyoptinterface._src.core_ext.VariableIndex, /) None
get_constraint_attribute(constraint: ConstraintIndex, attr: ConstraintAttribute)
get_constraint_dual(self, arg: pyoptinterface._src.core_ext.ConstraintIndex, /) float
get_constraint_name(self, arg: pyoptinterface._src.core_ext.ConstraintIndex, /) str
get_constraint_primal(self, arg: pyoptinterface._src.core_ext.ConstraintIndex, /) float
get_infinity(self) float
get_mip_node_count(self) int
get_mip_relative_gap(self) float
get_model_attribute(attr: ModelAttribute)
get_normalized_rhs(self, arg: pyoptinterface._src.core_ext.ConstraintIndex, /) float
get_number_iterations(self) int
get_obj_bound(self) float
get_obj_sense(self) pyoptinterface._src.core_ext.ObjectiveSense
get_obj_value(self) float
get_raw_parameter(self, name: str) int
get_raw_parameter(self, name: str) float
get_raw_parameter(self, param_id: int) int
get_raw_parameter(self, param_id: int) float
get_release(self) str
get_solve_time(self) float
get_solver_name(self) str
get_value(self, arg: pyoptinterface._src.core_ext.VariableIndex, /) float
get_value(self, arg: pyoptinterface._src.core_ext.ScalarAffineFunction, /) float
get_value(self, arg: pyoptinterface._src.core_ext.ScalarQuadraticFunction, /) float
get_value(self, arg: pyoptinterface._src.core_ext.ExprBuilder, /) float
get_variable_attribute(variable: VariableIndex, attr: VariableAttribute)
get_variable_lb(self, arg: pyoptinterface._src.core_ext.VariableIndex, /) float
get_variable_name(self, arg: pyoptinterface._src.core_ext.VariableIndex, /) str
get_variable_rc(self, arg: pyoptinterface._src.core_ext.VariableIndex, /) float
get_variable_ub(self, arg: pyoptinterface._src.core_ext.VariableIndex, /) float
init(self) None
is_empty()
property m_is_dirty

(self) -> bool

property m_solve_status

(self) -> int

property n_coniccons

(self) -> int

property n_cons

(self) -> int

property n_lincons

(self) -> int

property n_nlcons

(self) -> int

property n_quadcons

(self) -> int

property n_vars

(self) -> int

number_of_constraints(constraint_type: ConstraintType | None = None)
number_of_variables()
optimize(self) None
pprint(self, arg: pyoptinterface._src.core_ext.VariableIndex, /) str
pprint(self, expr: pyoptinterface._src.core_ext.ScalarAffineFunction, precision: int = 4) str
pprint(self, expr: pyoptinterface._src.core_ext.ScalarQuadraticFunction, precision: int = 4) str
pprint(self, expr: pyoptinterface._src.core_ext.ExprBuilder, precision: int = 4) str
set_constraint_attribute(constraint: ConstraintIndex, attr: ConstraintAttribute, value)
set_constraint_name(self, arg0: pyoptinterface._src.core_ext.ConstraintIndex, arg1: str, /) None
set_model_attribute(attr: ModelAttribute, value)
set_normalized_coefficient(self, arg0: pyoptinterface._src.core_ext.ConstraintIndex, arg1: pyoptinterface._src.core_ext.VariableIndex, arg2: float, /) None
set_normalized_rhs(self, arg0: pyoptinterface._src.core_ext.ConstraintIndex, arg1: float, /) None
set_obj_sense(self, arg: pyoptinterface._src.core_ext.ObjectiveSense, /) None
set_objective(self, expr: pyoptinterface._src.core_ext.ScalarAffineFunction, sense: pyoptinterface._src.core_ext.ObjectiveSense = ObjectiveSense.Minimize) None
set_objective(self, expr: pyoptinterface._src.core_ext.ScalarQuadraticFunction, sense: pyoptinterface._src.core_ext.ObjectiveSense = ObjectiveSense.Minimize) None
set_objective(self, expr: pyoptinterface._src.core_ext.ExprBuilder, sense: pyoptinterface._src.core_ext.ObjectiveSense = ObjectiveSense.Minimize) None
set_objective(self, expr: pyoptinterface._src.core_ext.VariableIndex, sense: pyoptinterface._src.core_ext.ObjectiveSense = ObjectiveSense.Minimize) None
set_objective(self, expr: float, sense: pyoptinterface._src.core_ext.ObjectiveSense = ObjectiveSense.Minimize) None
set_objective_coefficient(self, variable: pyoptinterface._src.core_ext.VariableIndex, coefficient: float) None
set_raw_parameter(self, name: str, value: int) None
set_raw_parameter(self, name: str, value: float) None
set_raw_parameter(self, name: str, value: str) None
set_raw_parameter(self, param_id: int, value: int) None
set_raw_parameter(self, param_id: int, value: float) None
set_raw_parameter(self, param_id: int, value: str) None
set_variable_attribute(variable: VariableIndex, attr: VariableAttribute, value)
set_variable_bounds(self, arg0: pyoptinterface._src.core_ext.VariableIndex, arg1: float, arg2: float, /) None
set_variable_domain(self, arg0: pyoptinterface._src.core_ext.VariableIndex, arg1: pyoptinterface._src.core_ext.VariableDomain, /) None
set_variable_lb(self, arg0: pyoptinterface._src.core_ext.VariableIndex, arg1: float, /) None
set_variable_name(self, arg0: pyoptinterface._src.core_ext.VariableIndex, arg1: str, /) None
set_variable_start(self, arg0: pyoptinterface._src.core_ext.VariableIndex, arg1: float, /) None
set_variable_ub(self, arg0: pyoptinterface._src.core_ext.VariableIndex, arg1: float, /) None
static supports_constraint_attribute(attribute: ConstraintAttribute, setable: bool = False) bool
static supports_model_attribute(attribute: ModelAttribute, setable: bool = False) bool
static supports_variable_attribute(attribute: VariableAttribute, setable: bool = False) bool
pyoptinterface.knitro.autoload_library()