diff --git a/.github/workflows/stubs.yml b/.github/workflows/stubs.yml new file mode 100644 index 000000000..559f8d97b --- /dev/null +++ b/.github/workflows/stubs.yml @@ -0,0 +1,71 @@ +name: Check type stubs +env: + version: 10.0.0 + +on: + push: + branches: + - "master" + pull_request: + types: [opened, synchronize, reopened, ready_for_review] + branches: + - "master" + workflow_dispatch: + +defaults: + run: + shell: bash + +jobs: + stubtest: + if: (github.event_name != 'pull_request') || (github.event.pull_request.draft == false) + runs-on: ubuntu-24.04 + env: + PYTHON_VERSION: "3.14" + + steps: + - uses: actions/checkout@v6 + + - name: Install dependencies (SCIPOptSuite) + run: | + wget --quiet --no-check-certificate "https://github.com/scipopt/scip/releases/download/v${{ env.version }}/scipoptsuite_${{ env.version }}-1+jammy_amd64.deb" + sudo apt-get update && sudo apt install -y ./scipoptsuite_${{ env.version }}-1+jammy_amd64.deb + + - name: Setup python ${{ env.PYTHON_VERSION }} + uses: actions/setup-python@v4 + with: + python-version: ${{ env.PYTHON_VERSION }} + + - name: Install mypy + run: | + python -m pip install mypy + + - name: Install PySCIPOpt + run: | + export CFLAGS="-O0 -ggdb -Wall -Wextra -Werror -Wno-error=deprecated-declarations" # Debug mode. More warnings. Warnings as errors, but allow deprecated declarations. + python -m pip install . -v 2>&1 | tee build.log + + - name: Run MyPy + run: python -m mypy --package pyscipopt + + - name: Run stubtest + run: stubs/test.sh + + lint: + runs-on: ubuntu-latest + env: + FILES: src/pyscipopt/scip.pyi + + steps: + - uses: actions/checkout@v6 + + - name: Install Ruff + uses: astral-sh/ruff-action@v3 + with: + args: "--version" + + - name: Lint type stubs + run: ruff check ${{ env.FILES }} --extend-select ANN,I,PYI,RUF100 + + - name: Format type stubs + run: ruff format ${{ env.FILES }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ab002ee6..cec5a1cdc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,8 +2,13 @@ ## Unreleased ### Added +- Added automated script for generating type stubs +- Include parameter names in type stubs +- Speed up MatrixExpr.sum(axis=...) via quicksum ### Fixed - all fundamental callbacks now raise an error if not implemented +- Fixed the type of MatrixExpr.sum(axis=...) result from MatrixVariable to MatrixExpr. +- Updated IIS result in PyiisfinderExec() ### Changed - changed default value of enablepricing flag to True ### Removed diff --git a/scripts/generate_stubs.py b/scripts/generate_stubs.py new file mode 100755 index 000000000..52acbaed2 --- /dev/null +++ b/scripts/generate_stubs.py @@ -0,0 +1,807 @@ +#!/usr/bin/env python3 +""" +Automatic stub generator for PySCIPOpt. + +This script parses .pxi and .pxd files and generates .pyi stub files automatically. +It extracts class definitions, methods, attributes, and module-level functions. + +Usage: + python scripts/generate_stubs.py + +The generated stub will be written to src/pyscipopt/scip.pyi +""" + +import re +import os +from pathlib import Path +from dataclasses import dataclass, field +from typing import Optional +from collections import OrderedDict + + +@dataclass +class ClassInfo: + """Holds information about a class.""" + name: str + parent: Optional[str] = None + attributes: list = field(default_factory=list) # list of (name, type_hint) + methods: list = field(default_factory=list) # list of method names + static_methods: set = field(default_factory=set) # set of static method names + class_vars: list = field(default_factory=list) # list of (name, type_hint) + has_hash: bool = False + has_eq: bool = False + is_dataclass: bool = False + dataclass_fields: list = field(default_factory=list) # list of (name, type, default) + + +@dataclass +class ModuleInfo: + """Holds information about the module.""" + classes: OrderedDict = field(default_factory=OrderedDict) + functions: list = field(default_factory=list) + module_vars: list = field(default_factory=list) + + +class StubGenerator: + """Generates Python stub files from Cython .pxi and .pxd files.""" + + # Special methods that need specific type hints + COMPARISON_METHODS = { + '__eq__': 'def __eq__(self, other: object) -> bool: ...', + '__ne__': 'def __ne__(self, other: object) -> bool: ...', + '__lt__': 'def __lt__(self, other: object) -> bool: ...', + '__le__': 'def __le__(self, other: object) -> bool: ...', + '__gt__': 'def __gt__(self, other: object) -> bool: ...', + '__ge__': 'def __ge__(self, other: object) -> bool: ...', + } + + SPECIAL_METHODS = { + '__hash__': 'def __hash__(self) -> int: ...', + '__len__': 'def __len__(self) -> int: ...', + '__bool__': 'def __bool__(self) -> bool: ...', + '__init__': 'def __init__(self, *args, **kwargs) -> None: ...', + '__repr__': 'def __repr__(self) -> str: ...', + '__str__': 'def __str__(self) -> str: ...', + '__delitem__': 'def __delitem__(self, other) -> None: ...', + '__setitem__': 'def __setitem__(self, index, object) -> None: ...', + } + + # Methods that should NOT appear in stubs (internal Cython methods) + EXCLUDED_METHODS = { + '__cinit__', '__dealloc__', '__reduce__', '__reduce_cython__', + '__setstate_cython__', '__pyx_vtable__', '__repr__', '__str__', + } + + # Methods that should be expanded to comparison methods + RICHCMP_EXPANSION = { + '__richcmp__': ['__eq__', '__ne__', '__lt__', '__le__', '__gt__', '__ge__'], + } + + # Methods with specific type hints (no *args, **kwargs) + TYPED_METHODS = { + '__getitem__': 'def __getitem__(self, index): ...', + '__iter__': 'def __iter__(self): ...', + '__next__': 'def __next__(self): ...', + '__add__': 'def __add__(self, other): ...', + '__radd__': 'def __radd__(self, other): ...', + '__sub__': 'def __sub__(self, other): ...', + '__rsub__': 'def __rsub__(self, other): ...', + '__mul__': 'def __mul__(self, other): ...', + '__rmul__': 'def __rmul__(self, other): ...', + '__truediv__': 'def __truediv__(self, other): ...', + '__rtruediv__': 'def __rtruediv__(self, other): ...', + '__pow__': 'def __pow__(self, other): ...', + '__rpow__': 'def __rpow__(self, other): ...', + '__neg__': 'def __neg__(self): ...', + '__abs__': 'def __abs__(self): ...', + '__iadd__': 'def __iadd__(self, other): ...', + '__isub__': 'def __isub__(self, other): ...', + '__imul__': 'def __imul__(self, other): ...', + } + + def __init__(self, src_dir: Path): + self.src_dir = src_dir + self.module_info = ModuleInfo() + + # Classes that inherit from numpy.ndarray need special handling + self.numpy_classes = {'MatrixExpr', 'MatrixConstraint'} + + # Known parent classes mapping (from class name to parent in stubs) + self.inheritance_map = { + 'Variable': 'Expr', + 'Constant': 'GenExpr', + 'VarExpr': 'GenExpr', + 'PowExpr': 'GenExpr', + 'UnaryExpr': 'GenExpr', + 'SumExpr': 'GenExpr', + 'ProdExpr': 'GenExpr', + 'MatrixExpr': 'numpy.ndarray', + 'MatrixConstraint': 'numpy.ndarray', + 'MatrixExprCons': 'numpy.ndarray', + 'MatrixGenExpr': 'MatrixExpr', + 'MatrixVariable': 'MatrixExpr', + } + + def parse_pxi_file(self, filepath: Path) -> None: + """Parse a .pxi file and extract class/function definitions.""" + with open(filepath, 'r', encoding='utf-8') as f: + content = f.read() + + self._parse_content(content, filepath) + + def parse_pxd_file(self, filepath: Path) -> None: + """Parse a .pxd file and extract public attributes.""" + with open(filepath, 'r', encoding='utf-8') as f: + content = f.read() + + # Find class definitions and their public attributes + class_pattern = re.compile( + r'^cdef\s+class\s+(\w+)(?:\s*\((\w+)\))?:\s*$', + re.MULTILINE + ) + + attr_pattern = re.compile( + r'^\s+cdef\s+public\s+(?:object\s+)?(\w+)\s*$', + re.MULTILINE + ) + + lines = content.split('\n') + current_class = None + + for i, line in enumerate(lines): + # Check for class definition + class_match = class_pattern.match(line) + if class_match: + class_name = class_match.group(1) + parent = class_match.group(2) + current_class = class_name + + if class_name not in self.module_info.classes: + self.module_info.classes[class_name] = ClassInfo( + name=class_name, + parent=parent + ) + continue + + # Check for public attribute + if current_class and 'cdef public' in line: + # Extract attribute name + match = re.search(r'cdef\s+public\s+(?:\w+\s+)?(\w+)\s*$', line.strip()) + if match: + attr_name = match.group(1) + if current_class in self.module_info.classes: + cls_info = self.module_info.classes[current_class] + if (attr_name, 'Incomplete') not in cls_info.attributes: + cls_info.attributes.append((attr_name, 'Incomplete')) + + # Detect end of class (unindented line that's not empty or comment) + if current_class and line and not line.startswith(' ') and not line.startswith('\t'): + if not line.startswith('#') and not line.startswith('cdef class'): + current_class = None + + def _parse_content(self, content: str, filepath: Path) -> None: + """Parse content from a .pxi file.""" + lines = content.split('\n') + + # Stack of (class_name, base_indent) for nested class tracking + # Only track top-level classes (indent 0) for stub generation + class_stack = [] + in_property = False + property_name = None + + def get_current_class(): + """Get the current class if we're directly in a top-level class. + + Returns None if: + - We're not in any class + - We're in a nested class (not the top-level class) + """ + if not class_stack: + return None + # Only return a class if we're directly in a top-level (indent 0) class + # If the latest class on the stack is not at indent 0, we're in a nested class + latest_class, latest_indent = class_stack[-1] + if latest_indent == 0: + return latest_class + return None + + i = 0 + while i < len(lines): + line = lines[i] + stripped = line.strip() + + # Skip empty lines and comments + if not stripped or stripped.startswith('#'): + i += 1 + continue + + # Calculate indentation (handle tabs as 4 spaces) + raw_indent = 0 + for ch in line: + if ch == ' ': + raw_indent += 1 + elif ch == '\t': + raw_indent += 4 + else: + break + indent = raw_indent + + # Pop classes from stack when we see a line at or below their base indent + while class_stack and indent <= class_stack[-1][1]: + class_stack.pop() + + # Check for class definition + class_match = re.match( + r'^(?:cdef\s+)?class\s+(\w+)(?:\s*\(([^)]*)\))?:\s*$', + stripped + ) + if class_match: + class_name = class_match.group(1) + parent = class_match.group(2) + + # Clean up parent (remove Cython types) + if parent: + parent = parent.strip() + # Skip internal Cython parent classes + if parent in ('object',): + parent = None + + # Push to class stack + class_stack.append((class_name, indent)) + + # Only add top-level classes (indent 0) to module info + if indent == 0: + if class_name not in self.module_info.classes: + self.module_info.classes[class_name] = ClassInfo( + name=class_name, + parent=self.inheritance_map.get(class_name, parent) + ) + i += 1 + continue + + current_class = get_current_class() + + # Check for property definition + property_match = re.match(r'^property\s+(\w+)\s*:', stripped) + if property_match and current_class: + property_name = property_match.group(1) + in_property = True + i += 1 + continue + + # Check for property __get__ (indicates a readable attribute) + if in_property and 'def __get__(self)' in stripped: + if current_class and property_name: + cls_info = self.module_info.classes.get(current_class) + if cls_info and (property_name, 'Incomplete') not in cls_info.attributes: + cls_info.attributes.append((property_name, 'Incomplete')) + in_property = False + property_name = None + i += 1 + continue + + # Check for public attribute in class body + if current_class and 'cdef public' in stripped: + match = re.search(r'cdef\s+public\s+(?:\w+\s+)?(\w+)\s*$', stripped) + if match: + attr_name = match.group(1) + cls_info = self.module_info.classes.get(current_class) + if cls_info and (attr_name, 'Incomplete') not in cls_info.attributes: + cls_info.attributes.append((attr_name, 'Incomplete')) + i += 1 + continue + + # Check for __slots__ definition + if current_class and '__slots__' in stripped: + slots_match = re.search(r"__slots__\s*=\s*\(([^)]+)\)", stripped) + if slots_match: + slots_str = slots_match.group(1) + # Parse slot names + slot_names = re.findall(r"['\"](\w+)['\"]", slots_str) + cls_info = self.module_info.classes.get(current_class) + if cls_info: + for slot_name in slot_names: + if (slot_name, 'Incomplete') not in cls_info.attributes: + cls_info.attributes.append((slot_name, 'Incomplete')) + i += 1 + continue + + # Check for class variable assignment (for enum-like classes) + if current_class: + cls_info = self.module_info.classes.get(current_class) + if cls_info: + # Handle multi-assignment lines like: exp, log, sqrt = 'exp', 'log', 'sqrt' + # Only for Op class (special case for operator definitions) + if current_class == 'Op' and indent == 4: + multi_match = re.match(r'^(\w+(?:\s*,\s*\w+)+)\s*=\s*(.+)$', stripped) + if multi_match: + var_names = [v.strip() for v in multi_match.group(1).split(',')] + var_values = multi_match.group(2).strip() + + # Determine type from first value + if var_values.startswith('"') or var_values.startswith("'"): + type_hint = 'str' + elif var_values.isdigit() or 'SCIP_' in var_values: + type_hint = 'int' + else: + type_hint = 'str' + + for var_name in var_names: + if not var_name.startswith('_') and var_name not in ('self',): + if (var_name, type_hint) not in cls_info.class_vars: + cls_info.class_vars.append((var_name, type_hint)) + i += 1 + continue + + # Match pattern like: ATTRNAME = SCIP_VALUE or ATTRNAME = VALUE + var_match = re.match(r'^(\w+)\s*=\s*(.+)$', stripped) + if var_match: + var_name = var_match.group(1) + var_value = var_match.group(2).strip() + + # Skip private variables, special cases, and method assignments + if not var_name.startswith('_') and var_name not in ('self',): + # Determine type from value pattern + if 'SCIP_' in var_value or var_value.isdigit(): + type_hint = 'int' + elif var_value.startswith('"') or var_value.startswith("'"): + type_hint = 'str' + else: + type_hint = 'int' # default for enum-like + + # For UPPERCASE names, use ClassVar + if var_name.isupper(): + if (var_name, type_hint) not in cls_info.class_vars: + cls_info.class_vars.append((var_name, type_hint)) + # For lowercase class variables (like in Op class), only add if: + # - Class has no methods yet (we're at class-level, not in a method) + # - The class is in a known list of classes with class vars + elif current_class == 'Op' and indent == 4: + if (var_name, type_hint) not in cls_info.class_vars: + cls_info.class_vars.append((var_name, type_hint)) + i += 1 + continue + + # Check for decorators (look at previous non-empty lines) + is_property = False + is_setter = False + is_staticmethod = False + if stripped.startswith('def ') and i > 0: + # Look back for decorators + for j in range(i - 1, max(0, i - 5), -1): + prev_line = lines[j].strip() + if prev_line == '@property': + is_property = True + elif '.setter' in prev_line or '.deleter' in prev_line: + is_setter = True + elif prev_line == '@staticmethod': + is_staticmethod = True + elif prev_line and not prev_line.startswith('#') and not prev_line.startswith('@'): + break + + # Check for method definition (handle multi-line signatures) + # First, check if this line starts a def/cpdef + method_start_match = re.match( + r'^(?:cpdef|def)\s+(\w+)\s*\(', + stripped + ) + if method_start_match: + method_name = method_start_match.group(1) + + # Skip setters (they don't need separate stubs) + if is_setter: + i += 1 + continue + + # Skip nested functions (defined inside methods, at high indentation) + # Methods should be at indent 4 for top-level class methods + if current_class and indent > 4: + # This is likely a nested function, skip it + i += 1 + continue + + # Skip excluded methods (internal Cython methods) + if method_name in self.EXCLUDED_METHODS: + i += 1 + continue + + if current_class: + cls_info = self.module_info.classes.get(current_class) + if cls_info: + if is_property: + # Add as attribute instead of method + if (method_name, 'Incomplete') not in cls_info.attributes: + cls_info.attributes.append((method_name, 'Incomplete')) + elif method_name == '__richcmp__': + # Expand __richcmp__ to individual comparison methods + for cmp_method in self.RICHCMP_EXPANSION['__richcmp__']: + if cmp_method not in cls_info.methods: + cls_info.methods.append(cmp_method) + elif method_name not in cls_info.methods: + cls_info.methods.append(method_name) + + # Track static methods + if is_staticmethod: + cls_info.static_methods.add(method_name) + + # Track special methods + if method_name == '__hash__': + cls_info.has_hash = True + elif method_name == '__eq__': + cls_info.has_eq = True + else: + # Module-level function (must be at indent 0) + if indent == 0 and method_name not in self.module_info.functions: + self.module_info.functions.append(method_name) + + i += 1 + continue + + # Check for module-level variable + if not current_class and indent == 0: + var_match = re.match(r'^(\w+)\s*=\s*', stripped) + if var_match: + var_name = var_match.group(1) + if not var_name.startswith('_') and var_name not in ('include',): + if var_name not in [v[0] for v in self.module_info.module_vars]: + self.module_info.module_vars.append((var_name, 'Incomplete')) + + i += 1 + + def _detect_dataclass(self, content: str) -> dict: + """Detect @dataclass decorated classes and their fields.""" + dataclasses = {} + + # Find @dataclass decorated classes + pattern = re.compile( + r'@dataclass\s*\n\s*class\s+(\w+)(?:\s*\([^)]*\))?\s*:\s*\n((?:\s+.+\n)*)', + re.MULTILINE + ) + + for match in pattern.finditer(content): + class_name = match.group(1) + body = match.group(2) + + fields = [] + for line in body.split('\n'): + # Match field: type = default or field: type + field_match = re.match(r'\s+(\w+)\s*:\s*(\w+)(?:\s*=\s*(.+))?', line) + if field_match: + fname = field_match.group(1) + ftype = field_match.group(2) + fdefault = field_match.group(3) + fields.append((fname, ftype, fdefault)) + + dataclasses[class_name] = fields + + return dataclasses + + def generate_stub(self) -> str: + """Generate the complete stub file content.""" + lines = [] + + # Header imports + lines.append('from dataclasses import dataclass') + lines.append('from typing import ClassVar') + lines.append('') + lines.append('import numpy') + lines.append('from _typeshed import Incomplete') + lines.append('') + + # Module-level variables and functions (sorted alphabetically) + # Merge variables and functions into a single sorted list + all_module_items = [] + + for var_name, type_hint in self.module_info.module_vars: + all_module_items.append((var_name, 'var', type_hint)) + + for func_name in self.module_info.functions: + all_module_items.append((func_name, 'func', None)) + + # Sort by name + all_module_items.sort(key=lambda x: x[0]) + + for name, kind, type_hint in all_module_items: + if kind == 'var': + lines.append(f'{name}: {type_hint}') + else: + lines.append(f'{name}: Incomplete') + + if all_module_items: + lines.append('') + + # Classes (sorted alphabetically) + sorted_classes = sorted( + self.module_info.classes.values(), + key=lambda c: c.name + ) + + for cls_info in sorted_classes: + # Skip internal classes + if cls_info.name.startswith('_') and cls_info.name != '_VarArray': + continue + + lines.extend(self._generate_class_stub(cls_info)) + lines.append('') + + return '\n'.join(lines) + + def _generate_class_stub(self, cls_info: ClassInfo) -> list: + """Generate stub for a single class.""" + lines = [] + + # Handle dataclass + if cls_info.is_dataclass: + lines.append('@dataclass') + + # Class declaration + if cls_info.parent: + lines.append(f'class {cls_info.name}({cls_info.parent}):') + else: + lines.append(f'class {cls_info.name}:') + + # Dataclass fields + if cls_info.dataclass_fields: + for fname, ftype, fdefault in cls_info.dataclass_fields: + if fdefault: + lines.append(f' {fname}: {ftype} = {fdefault}') + else: + lines.append(f' {fname}: {ftype}') + return lines + + # Class variables (for enum-like classes) + sorted_class_vars = sorted(cls_info.class_vars, key=lambda x: x[0]) + for var_name, type_hint in sorted_class_vars: + lines.append(f' {var_name}: ClassVar[{type_hint}] = ...') + + # Instance attributes + sorted_attrs = sorted(cls_info.attributes, key=lambda x: x[0]) + for attr_name, type_hint in sorted_attrs: + lines.append(f' {attr_name}: {type_hint}') + + # Methods - separate regular methods and special methods + regular_methods = [] + special_methods = [] + comparison_methods = [] + + for method in cls_info.methods: + if method in self.COMPARISON_METHODS: + comparison_methods.append(method) + elif method.startswith('__') and method.endswith('__'): + special_methods.append(method) + else: + regular_methods.append(method) + + # Check if this class inherits from numpy.ndarray or MatrixExpr (don't auto-add __init__) + is_numpy_subclass = cls_info.parent and ('ndarray' in cls_info.parent or 'Matrix' in cls_info.parent) + + # Specific classes that shouldn't get __init__ auto-added + skip_init_classes = {'Op'} + + # If class has both __hash__ and __eq__, add all comparison methods + if cls_info.has_hash and cls_info.has_eq: + for cmp_method in self.COMPARISON_METHODS: + if cmp_method not in comparison_methods and cmp_method not in special_methods: + comparison_methods.append(cmp_method) + + # Output __init__ first if present or needs to be added (not for numpy subclasses or specific classes) + if '__init__' in special_methods: + lines.append(f' {self.SPECIAL_METHODS["__init__"]}') + special_methods.remove('__init__') + elif '__init__' not in cls_info.methods and not is_numpy_subclass and not cls_info.is_dataclass and cls_info.name not in skip_init_classes: + lines.append(f' {self.SPECIAL_METHODS["__init__"]}') + + # Sort and output regular methods + for method in sorted(regular_methods): + if method in cls_info.static_methods: + lines.append(' @staticmethod') + lines.append(f' def {method}(*args, **kwargs): ...') + else: + lines.append(f' def {method}(self, *args, **kwargs): ...') + + # Combine special methods and comparison methods, sort alphabetically + all_special = [] + for method in special_methods: + if method in self.SPECIAL_METHODS: + all_special.append((method, self.SPECIAL_METHODS[method])) + elif method in self.TYPED_METHODS: + all_special.append((method, self.TYPED_METHODS[method])) + else: + all_special.append((method, f'def {method}(self, *args, **kwargs): ...')) + + for method in comparison_methods: + all_special.append((method, self.COMPARISON_METHODS[method])) + + # Sort and output all special methods alphabetically + for method, stub in sorted(all_special, key=lambda x: x[0]): + lines.append(f' {stub}') + + # If class is empty, add pass or ellipsis + if len(lines) == 1: + lines.append(' ...') + + return lines + + def run(self) -> str: + """Run the stub generator on all relevant files.""" + pxi_files = list(self.src_dir.glob('*.pxi')) + pxd_files = list(self.src_dir.glob('*.pxd')) + + # Parse .pxd files first for attribute declarations + for pxd_file in pxd_files: + print(f'Parsing {pxd_file.name}...') + self.parse_pxd_file(pxd_file) + + # Parse .pxi files for implementations + for pxi_file in pxi_files: + print(f'Parsing {pxi_file.name}...') + self.parse_pxi_file(pxi_file) + + # Handle special cases + self._apply_special_cases() + + # Generate the stub + return self.generate_stub() + + def _apply_special_cases(self) -> None: + """Apply special cases and known patterns.""" + # Add 'name' attribute to classes that commonly have it + name_classes = { + 'Variable', 'Constraint', 'Row', 'NLRow', 'Event', + 'Benders', 'Benderscut', 'Conshdlr', 'Heur', 'Sepa', + 'Reader', 'Relax', 'Eventhdlr' + } + + for class_name in name_classes: + if class_name in self.module_info.classes: + cls_info = self.module_info.classes[class_name] + if ('name', 'Incomplete') not in cls_info.attributes: + cls_info.attributes.append(('name', 'Incomplete')) + + # Handle LP class special case (readonly name) + if 'LP' in self.module_info.classes: + cls_info = self.module_info.classes['LP'] + if ('name', 'Incomplete') not in cls_info.attributes: + cls_info.attributes.append(('name', 'Incomplete')) + + # Handle Statistics as dataclass + if 'Statistics' in self.module_info.classes: + cls_info = self.module_info.classes['Statistics'] + cls_info.is_dataclass = True + cls_info.dataclass_fields = [ + ('status', 'str', None), + ('total_time', 'float', None), + ('solving_time', 'float', None), + ('presolving_time', 'float', None), + ('reading_time', 'float', None), + ('copying_time', 'float', None), + ('problem_name', 'str', None), + ('presolved_problem_name', 'str', None), + ('n_runs', 'int', 'None'), + ('n_nodes', 'int', 'None'), + ('n_solutions_found', 'int', '-1'), + ('first_solution', 'float', 'None'), + ('primal_bound', 'float', 'None'), + ('dual_bound', 'float', 'None'), + ('gap', 'float', 'None'), + ] + + # Add/update known module-level variables with correct types + known_vars = { + 'CONST': 'Term', + 'EventNames': 'dict', + 'MAJOR': 'int', + 'MINOR': 'int', + 'Operator': 'Op', + 'PATCH': 'int', + 'StageNames': 'dict', + '_SCIP_BOUNDTYPE_TO_STRING': 'dict', + 'str_conversion': 'Incomplete', + } + + # Remove PY_SCIP_CALL from functions if it exists (it's also a callable) + if 'PY_SCIP_CALL' in self.module_info.functions: + self.module_info.functions.remove('PY_SCIP_CALL') + known_vars['PY_SCIP_CALL'] = 'Incomplete' + + # Update existing or add new + updated_vars = [] + seen = set() + for var_name, type_hint in self.module_info.module_vars: + if var_name in known_vars: + updated_vars.append((var_name, known_vars[var_name])) + seen.add(var_name) + else: + updated_vars.append((var_name, type_hint)) + seen.add(var_name) + + # Add any known vars that weren't in the list + for var_name, type_hint in known_vars.items(): + if var_name not in seen: + updated_vars.append((var_name, type_hint)) + + self.module_info.module_vars = updated_vars + + +def main(): + """Main entry point.""" + import argparse + + parser = argparse.ArgumentParser( + description='Generate Python stub files (.pyi) from PySCIPOpt Cython sources.', + formatter_class=argparse.RawDescriptionHelpFormatter, + epilog=''' +Examples: + python scripts/generate_stubs.py # Generate and write stubs + python scripts/generate_stubs.py --check # Check if stubs are up-to-date + python scripts/generate_stubs.py --dry-run # Show what would be generated +''' + ) + parser.add_argument( + '--check', action='store_true', + help='Check if the stub file is up-to-date (exits with 1 if not)' + ) + parser.add_argument( + '--dry-run', action='store_true', + help='Print the generated stubs to stdout instead of writing to file' + ) + parser.add_argument( + '-q', '--quiet', action='store_true', + help='Suppress progress output' + ) + args = parser.parse_args() + + # Find the source directory + script_dir = Path(__file__).parent + project_root = script_dir.parent + src_dir = project_root / 'src' / 'pyscipopt' + + if not src_dir.exists(): + print(f'Error: Source directory not found: {src_dir}') + return 1 + + if not args.quiet: + print(f'Generating stubs from {src_dir}...') + + generator = StubGenerator(src_dir) + stub_content = generator.run() + + output_path = src_dir / 'scip.pyi' + + if args.dry_run: + print(stub_content) + return 0 + + if args.check: + # Compare with existing file + if output_path.exists(): + with open(output_path, 'r', encoding='utf-8') as f: + existing_content = f.read() + if existing_content == stub_content: + if not args.quiet: + print('Stub file is up-to-date.') + return 0 + else: + print(f'Stub file {output_path} is out of date.') + print('Run without --check to regenerate.') + return 1 + else: + print(f'Stub file {output_path} does not exist.') + return 1 + + # Write the stub file + with open(output_path, 'w', encoding='utf-8') as f: + f.write(stub_content) + + if not args.quiet: + print(f'Stub file written to {output_path}') + print(f'\nSummary:') + print(f' Classes: {len(generator.module_info.classes)}') + print(f' Functions: {len(generator.module_info.functions)}') + print(f' Module variables: {len(generator.module_info.module_vars)}') + + return 0 + + +if __name__ == '__main__': + exit(main()) diff --git a/src/pyscipopt/__init__.py b/src/pyscipopt/__init__.py index 7e32ca6c1..fafa440ad 100644 --- a/src/pyscipopt/__init__.py +++ b/src/pyscipopt/__init__.py @@ -4,7 +4,7 @@ import os if hasattr(os, 'add_dll_directory'): if os.getenv('SCIPOPTDIR'): - os.add_dll_directory(os.path.join(os.getenv('SCIPOPTDIR').strip('"'), 'bin')) + os.add_dll_directory(os.path.join(os.environ['SCIPOPTDIR'].strip('"'), 'bin')) # export user-relevant objects: from pyscipopt.Multidict import multidict as multidict diff --git a/src/pyscipopt/iisfinder.pxi b/src/pyscipopt/iisfinder.pxi index e06ac83e3..390ee5c4e 100644 --- a/src/pyscipopt/iisfinder.pxi +++ b/src/pyscipopt/iisfinder.pxi @@ -33,4 +33,5 @@ cdef SCIP_RETCODE PyiisfinderExec (SCIP_IIS* iis, SCIP_IISFINDER* iisfinder, SCI PyIIS.iis._iis = iis result_dict = PyIIS.iisfinderexec() assert isinstance(result_dict, dict), "iisfinderexec() must return a dictionary." + result[0] = result_dict.get("result", result[0]) return SCIP_OKAY \ No newline at end of file diff --git a/src/pyscipopt/matrix.pxi b/src/pyscipopt/matrix.pxi index 8353ed767..1a6a09cf3 100644 --- a/src/pyscipopt/matrix.pxi +++ b/src/pyscipopt/matrix.pxi @@ -3,8 +3,14 @@ # TODO Add tests """ +from typing import Optional, Tuple, Union import numpy as np -from typing import Union +try: + # NumPy 2.x location + from numpy.lib.array_utils import normalize_axis_tuple +except ImportError: + # Fallback for NumPy 1.x + from numpy.core.numeric import normalize_axis_tuple def _is_number(e): @@ -44,16 +50,61 @@ def _matrixexpr_richcmp(self, other, op): class MatrixExpr(np.ndarray): - def sum(self, **kwargs): - """ - Based on `numpy.ndarray.sum`, but returns a scalar if `axis=None`. - This is useful for matrix expressions to compare with a matrix or a scalar. + + def sum( + self, + axis: Optional[Union[int, Tuple[int, ...]]] = None, + keepdims: bool = False, + **kwargs, + ) -> Union[Expr, MatrixExpr]: """ + Return the sum of the array elements over the given axis. + + Parameters + ---------- + axis : None or int or tuple of ints, optional + Axis or axes along which a sum is performed. The default, axis=None, will + sum all of the elements of the input array. If axis is negative it counts + from the last to the first axis. If axis is a tuple of ints, a sum is + performed on all of the axes specified in the tuple instead of a single axis + or all the axes as before. + + keepdims : bool, optional + If this is set to True, the axes which are reduced are left in the result as + dimensions with size one. With this option, the result will broadcast + correctly against the input array. + + **kwargs : ignored + Additional keyword arguments are ignored. They exist for compatibility + with `numpy.ndarray.sum`. + + Returns + ------- + Expr or MatrixExpr + If the sum is performed over all axes, return an Expr, otherwise return + a MatrixExpr. - if kwargs.get("axis") is None: - # Speed up `.sum()` #1070 - return quicksum(self.flat) - return super().sum(**kwargs) + """ + axis: Tuple[int, ...] = normalize_axis_tuple( + range(self.ndim) if axis is None else axis, self.ndim + ) + if len(axis) == self.ndim: + res = quicksum(self.flat) + return ( + np.array([res], dtype=object).reshape([1] * self.ndim).view(MatrixExpr) + if keepdims + else res + ) + + keep_axes = tuple(i for i in range(self.ndim) if i not in axis) + shape = ( + tuple(1 if i in axis else self.shape[i] for i in range(self.ndim)) + if keepdims + else tuple(self.shape[i] for i in keep_axes) + ) + return np.apply_along_axis( + quicksum, -1, self.transpose(keep_axes + axis).reshape(shape + (-1,)) + ).view(MatrixExpr) def __le__(self, other: Union[float, int, "Expr", np.ndarray, "MatrixExpr"]) -> MatrixExprCons: return _matrixexpr_richcmp(self, other, 1) diff --git a/src/pyscipopt/recipes/getLocalConss.py b/src/pyscipopt/recipes/getLocalConss.py index 2de03049e..c1c659b69 100644 --- a/src/pyscipopt/recipes/getLocalConss.py +++ b/src/pyscipopt/recipes/getLocalConss.py @@ -24,7 +24,7 @@ def getLocalConss(model: Model, node = None) -> List[List[Constraint]]: else: cur_node = node - added_conss = [] + added_conss: List[Constraint] = [] while cur_node is not None: added_conss = cur_node.getAddedConss() + added_conss cur_node = cur_node.getParent() diff --git a/src/pyscipopt/scip.pyi b/src/pyscipopt/scip.pyi index 571f987d7..831dd02ed 100644 --- a/src/pyscipopt/scip.pyi +++ b/src/pyscipopt/scip.pyi @@ -3,6 +3,7 @@ from typing import ClassVar import numpy from _typeshed import Incomplete +from typing_extensions import disjoint_base CONST: Term EventNames: dict @@ -32,867 +33,1610 @@ sqrt: Incomplete str_conversion: Incomplete value_to_array: Incomplete +@disjoint_base class Benders: model: Incomplete name: Incomplete - def __init__(self, *args, **kwargs) -> None: ... - def benderscreatesub(self, *args, **kwargs): ... - def bendersexit(self, *args, **kwargs): ... - def bendersexitpre(self, *args, **kwargs): ... - def bendersexitsol(self, *args, **kwargs): ... - def bendersfree(self, *args, **kwargs): ... - def bendersfreesub(self, *args, **kwargs): ... - def bendersgetvar(self, *args, **kwargs): ... - def bendersinit(self, *args, **kwargs): ... - def bendersinitpre(self, *args, **kwargs): ... - def bendersinitsol(self, *args, **kwargs): ... - def benderspostsolve(self, *args, **kwargs): ... - def benderspresubsolve(self, *args, **kwargs): ... - def benderssolvesub(self, *args, **kwargs): ... - def benderssolvesubconvex(self, *args, **kwargs): ... - + def __init__(self) -> None: ... + def benderscreatesub(self, probnumber: Incomplete) -> Incomplete: ... + def bendersexit(self) -> Incomplete: ... + def bendersexitpre(self) -> Incomplete: ... + def bendersexitsol(self) -> Incomplete: ... + def bendersfree(self) -> Incomplete: ... + def bendersfreesub(self, probnumber: Incomplete) -> Incomplete: ... + def bendersgetvar( + self, variable: Incomplete, probnumber: Incomplete + ) -> Incomplete: ... + def bendersinit(self) -> Incomplete: ... + def bendersinitpre(self) -> Incomplete: ... + def bendersinitsol(self) -> Incomplete: ... + def benderspostsolve( + self, + solution: Incomplete, + enfotype: Incomplete, + mergecandidates: Incomplete, + npriomergecands: Incomplete, + checkint: Incomplete, + infeasible: Incomplete, + ) -> Incomplete: ... + def benderspresubsolve( + self, solution: Incomplete, enfotype: Incomplete, checkint: Incomplete + ) -> Incomplete: ... + def benderssolvesub( + self, solution: Incomplete, probnumber: Incomplete + ) -> Incomplete: ... + def benderssolvesubconvex( + self, solution: Incomplete, probnumber: Incomplete, onlyconvex: Incomplete + ) -> Incomplete: ... + +@disjoint_base class Benderscut: benders: Incomplete model: Incomplete name: Incomplete - def __init__(self, *args, **kwargs) -> None: ... - def benderscutexec(self, *args, **kwargs): ... - def benderscutexit(self, *args, **kwargs): ... - def benderscutexitsol(self, *args, **kwargs): ... - def benderscutfree(self, *args, **kwargs): ... - def benderscutinit(self, *args, **kwargs): ... - def benderscutinitsol(self, *args, **kwargs): ... - + def __init__(self) -> None: ... + def benderscutexec( + self, solution: Incomplete, probnumber: Incomplete, enfotype: Incomplete + ) -> Incomplete: ... + def benderscutexit(self) -> Incomplete: ... + def benderscutexitsol(self) -> Incomplete: ... + def benderscutfree(self) -> Incomplete: ... + def benderscutinit(self) -> Incomplete: ... + def benderscutinitsol(self) -> Incomplete: ... + +@disjoint_base class BoundChange: - def __init__(self, *args, **kwargs) -> None: ... - def getBoundchgtype(self, *args, **kwargs): ... - def getBoundtype(self, *args, **kwargs): ... - def getNewBound(self, *args, **kwargs): ... - def getVar(self, *args, **kwargs): ... - def isRedundant(self, *args, **kwargs): ... - + def __init__(self) -> None: ... + def getBoundchgtype(self) -> Incomplete: ... + def getBoundtype(self) -> Incomplete: ... + def getNewBound(self) -> Incomplete: ... + def getVar(self) -> Incomplete: ... + def isRedundant(self) -> Incomplete: ... + +@disjoint_base class Branchrule: model: Incomplete - def __init__(self, *args, **kwargs) -> None: ... - def branchexecext(self, *args, **kwargs): ... - def branchexeclp(self, *args, **kwargs): ... - def branchexecps(self, *args, **kwargs): ... - def branchexit(self, *args, **kwargs): ... - def branchexitsol(self, *args, **kwargs): ... - def branchfree(self, *args, **kwargs): ... - def branchinit(self, *args, **kwargs): ... - def branchinitsol(self, *args, **kwargs): ... - + def __init__(self) -> None: ... + def branchexecext(self, allowaddcons: Incomplete) -> Incomplete: ... + def branchexeclp(self, allowaddcons: Incomplete) -> Incomplete: ... + def branchexecps(self, allowaddcons: Incomplete) -> Incomplete: ... + def branchexit(self) -> Incomplete: ... + def branchexitsol(self) -> Incomplete: ... + def branchfree(self) -> Incomplete: ... + def branchinit(self) -> Incomplete: ... + def branchinitsol(self) -> Incomplete: ... + +@disjoint_base class Column: data: Incomplete - def __init__(self, *args, **kwargs) -> None: ... - def getAge(self, *args, **kwargs): ... - def getBasisStatus(self, *args, **kwargs): ... - def getLPPos(self, *args, **kwargs): ... - def getLb(self, *args, **kwargs): ... - def getObjCoeff(self, *args, **kwargs): ... - def getPrimsol(self, *args, **kwargs): ... - def getUb(self, *args, **kwargs): ... - def getVar(self, *args, **kwargs): ... - def isIntegral(self, *args, **kwargs): ... - def __eq__(self, other: object) -> bool: ... - def __ge__(self, other: object) -> bool: ... - def __gt__(self, other: object) -> bool: ... + def __init__(self) -> None: ... + def getAge(self) -> Incomplete: ... + def getBasisStatus(self) -> Incomplete: ... + def getLPPos(self) -> Incomplete: ... + def getLb(self) -> Incomplete: ... + def getObjCoeff(self) -> Incomplete: ... + def getPrimsol(self) -> Incomplete: ... + def getUb(self) -> Incomplete: ... + def getVar(self) -> Incomplete: ... + def isIntegral(self) -> Incomplete: ... + def __eq__(self, other: Incomplete)-> Incomplete: ... + def __ge__(self, other: Incomplete)-> Incomplete: ... + def __gt__(self, other: Incomplete)-> Incomplete: ... def __hash__(self) -> int: ... - def __le__(self, other: object) -> bool: ... - def __lt__(self, other: object) -> bool: ... - def __ne__(self, other: object) -> bool: ... + def __le__(self, other: Incomplete)-> Incomplete: ... + def __lt__(self, other: Incomplete)-> Incomplete: ... + def __ne__(self, other: Incomplete)-> Incomplete: ... +@disjoint_base class ColumnExact: data: Incomplete - def __init__(self, *args, **kwargs) -> None: ... + def __init__(self) -> None: ... +@disjoint_base class Conshdlr: model: Incomplete name: Incomplete - def __init__(self, *args, **kwargs) -> None: ... - def consactive(self, *args, **kwargs): ... - def conscheck(self, *args, **kwargs): ... - def conscopy(self, *args, **kwargs): ... - def consdeactive(self, *args, **kwargs): ... - def consdelete(self, *args, **kwargs): ... - def consdelvars(self, *args, **kwargs): ... - def consdisable(self, *args, **kwargs): ... - def consenable(self, *args, **kwargs): ... - def consenfolp(self, *args, **kwargs): ... - def consenfops(self, *args, **kwargs): ... - def consenforelax(self, *args, **kwargs): ... - def consexit(self, *args, **kwargs): ... - def consexitpre(self, *args, **kwargs): ... - def consexitsol(self, *args, **kwargs): ... - def consfree(self, *args, **kwargs): ... - def consgetdivebdchgs(self, *args, **kwargs): ... - def consgetnvars(self, *args, **kwargs): ... - def consgetpermsymgraph(self, *args, **kwargs): ... - def consgetsignedpermsymgraph(self, *args, **kwargs): ... - def consgetvars(self, *args, **kwargs): ... - def consinit(self, *args, **kwargs): ... - def consinitlp(self, *args, **kwargs): ... - def consinitpre(self, *args, **kwargs): ... - def consinitsol(self, *args, **kwargs): ... - def conslock(self, *args, **kwargs): ... - def consparse(self, *args, **kwargs): ... - def conspresol(self, *args, **kwargs): ... - def consprint(self, *args, **kwargs): ... - def consprop(self, *args, **kwargs): ... - def consresprop(self, *args, **kwargs): ... - def conssepalp(self, *args, **kwargs): ... - def conssepasol(self, *args, **kwargs): ... - def constrans(self, *args, **kwargs): ... - + def __init__(self) -> None: ... + def consactive(self, constraint: Incomplete) -> Incomplete: ... + def conscheck( + self, + constraints: Incomplete, + solution: Incomplete, + checkintegrality: Incomplete, + checklprows: Incomplete, + printreason: Incomplete, + completely: Incomplete, + ) -> Incomplete: ... + def conscopy(self) -> Incomplete: ... + def consdeactive(self, constraint: Incomplete) -> Incomplete: ... + def consdelete(self, constraint: Incomplete) -> Incomplete: ... + def consdelvars(self, constraints: Incomplete) -> Incomplete: ... + def consdisable(self, constraint: Incomplete) -> Incomplete: ... + def consenable(self, constraint: Incomplete) -> Incomplete: ... + def consenfolp( + self, + constraints: Incomplete, + nusefulconss: Incomplete, + solinfeasible: Incomplete, + ) -> Incomplete: ... + def consenfops( + self, + constraints: Incomplete, + nusefulconss: Incomplete, + solinfeasible: Incomplete, + objinfeasible: Incomplete, + ) -> Incomplete: ... + def consenforelax( + self, + solution: Incomplete, + constraints: Incomplete, + nusefulconss: Incomplete, + solinfeasible: Incomplete, + ) -> Incomplete: ... + def consexit(self, constraints: Incomplete) -> Incomplete: ... + def consexitpre(self, constraints: Incomplete) -> Incomplete: ... + def consexitsol( + self, constraints: Incomplete, restart: Incomplete + ) -> Incomplete: ... + def consfree(self) -> Incomplete: ... + def consgetdivebdchgs(self) -> Incomplete: ... + def consgetnvars(self, constraint: Incomplete) -> Incomplete: ... + def consgetpermsymgraph(self) -> Incomplete: ... + def consgetsignedpermsymgraph(self) -> Incomplete: ... + def consgetvars(self, constraint: Incomplete) -> Incomplete: ... + def consinit(self, constraints: Incomplete) -> Incomplete: ... + def consinitlp(self, constraints: Incomplete) -> Incomplete: ... + def consinitpre(self, constraints: Incomplete) -> Incomplete: ... + def consinitsol(self, constraints: Incomplete) -> Incomplete: ... + def conslock( + self, + constraint: Incomplete, + locktype: Incomplete, + nlockspos: Incomplete, + nlocksneg: Incomplete, + ) -> Incomplete: ... + def consparse(self) -> Incomplete: ... + def conspresol( + self, + constraints: Incomplete, + nrounds: Incomplete, + presoltiming: Incomplete, + nnewfixedvars: Incomplete, + nnewaggrvars: Incomplete, + nnewchgvartypes: Incomplete, + nnewchgbds: Incomplete, + nnewholes: Incomplete, + nnewdelconss: Incomplete, + nnewaddconss: Incomplete, + nnewupgdconss: Incomplete, + nnewchgcoefs: Incomplete, + nnewchgsides: Incomplete, + result_dict: Incomplete, + ) -> Incomplete: ... + def consprint(self, constraint: Incomplete) -> Incomplete: ... + def consprop( + self, + constraints: Incomplete, + nusefulconss: Incomplete, + nmarkedconss: Incomplete, + proptiming: Incomplete, + ) -> Incomplete: ... + def consresprop(self) -> Incomplete: ... + def conssepalp( + self, constraints: Incomplete, nusefulconss: Incomplete + ) -> Incomplete: ... + def conssepasol( + self, constraints: Incomplete, nusefulconss: Incomplete, solution: Incomplete + ) -> Incomplete: ... + def constrans(self, sourceconstraint: Incomplete) -> Incomplete: ... + +@disjoint_base class Constant(GenExpr): number: Incomplete - def __init__(self, *args, **kwargs) -> None: ... + def __init__(self, *args: Incomplete, **kwargs: Incomplete) -> None: ... +@disjoint_base class Constraint: data: Incomplete name: Incomplete - def __init__(self, *args, **kwargs) -> None: ... - def getConshdlrName(self, *args, **kwargs): ... - def isActive(self, *args, **kwargs): ... - def isChecked(self, *args, **kwargs): ... - def isDynamic(self, *args, **kwargs): ... - def isEnforced(self, *args, **kwargs): ... - def isInitial(self, *args, **kwargs): ... - def isKnapsack(self, *args, **kwargs): ... - def isLinear(self, *args, **kwargs): ... - def isLinearType(self, *args, **kwargs): ... - def isLocal(self, *args, **kwargs): ... - def isModifiable(self, *args, **kwargs): ... - def isNonlinear(self, *args, **kwargs): ... - def isOriginal(self, *args, **kwargs): ... - def isPropagated(self, *args, **kwargs): ... - def isRemovable(self, *args, **kwargs): ... - def isSeparated(self, *args, **kwargs): ... - def isStickingAtNode(self, *args, **kwargs): ... - def __eq__(self, other: object) -> bool: ... - def __ge__(self, other: object) -> bool: ... - def __gt__(self, other: object) -> bool: ... + def __init__(self) -> None: ... + def getConshdlrName(self) -> Incomplete: ... + def isActive(self) -> Incomplete: ... + def isChecked(self) -> Incomplete: ... + def isDynamic(self) -> Incomplete: ... + def isEnforced(self) -> Incomplete: ... + def isInitial(self) -> Incomplete: ... + def isKnapsack(self) -> Incomplete: ... + def isLinear(self) -> Incomplete: ... + def isLinearType(self) -> Incomplete: ... + def isLocal(self) -> Incomplete: ... + def isModifiable(self) -> Incomplete: ... + def isNonlinear(self) -> Incomplete: ... + def isOriginal(self) -> Incomplete: ... + def isPropagated(self) -> Incomplete: ... + def isRemovable(self) -> Incomplete: ... + def isSeparated(self) -> Incomplete: ... + def isStickingAtNode(self) -> Incomplete: ... + def __eq__(self, other: Incomplete)-> Incomplete: ... + def __ge__(self, other: Incomplete)-> Incomplete: ... + def __gt__(self, other: Incomplete)-> Incomplete: ... def __hash__(self) -> int: ... - def __le__(self, other: object) -> bool: ... - def __lt__(self, other: object) -> bool: ... - def __ne__(self, other: object) -> bool: ... + def __le__(self, other: Incomplete)-> Incomplete: ... + def __lt__(self, other: Incomplete)-> Incomplete: ... + def __ne__(self, other: Incomplete)-> Incomplete: ... +@disjoint_base class Cutsel: model: Incomplete - def __init__(self, *args, **kwargs) -> None: ... - def cutselexit(self, *args, **kwargs): ... - def cutselexitsol(self, *args, **kwargs): ... - def cutselfree(self, *args, **kwargs): ... - def cutselinit(self, *args, **kwargs): ... - def cutselinitsol(self, *args, **kwargs): ... - def cutselselect(self, *args, **kwargs): ... - + def __init__(self) -> None: ... + def cutselexit(self) -> Incomplete: ... + def cutselexitsol(self) -> Incomplete: ... + def cutselfree(self) -> Incomplete: ... + def cutselinit(self) -> Incomplete: ... + def cutselinitsol(self) -> Incomplete: ... + def cutselselect( + self, + cuts: Incomplete, + forcedcuts: Incomplete, + root: Incomplete, + maxnselectedcuts: Incomplete, + ) -> Incomplete: ... + +@disjoint_base class DomainChanges: - def __init__(self, *args, **kwargs) -> None: ... - def getBoundchgs(self, *args, **kwargs): ... + def __init__(self) -> None: ... + def getBoundchgs(self) -> Incomplete: ... +@disjoint_base class Event: data: Incomplete - def __init__(self, *args, **kwargs) -> None: ... - def _getEventNames(self, *args, **kwargs): ... - def getName(self, *args, **kwargs): ... - def getNewBound(self, *args, **kwargs): ... - def getNode(self, *args, **kwargs): ... - def getOldBound(self, *args, **kwargs): ... - def getRow(self, *args, **kwargs): ... - def getType(self, *args, **kwargs): ... - def getVar(self, *args, **kwargs): ... - def __eq__(self, other: object) -> bool: ... - def __ge__(self, other: object) -> bool: ... - def __gt__(self, other: object) -> bool: ... + name: Incomplete + def __init__(self) -> None: ... + def _getEventNames(self) -> Incomplete: ... + def getName(self) -> Incomplete: ... + def getNewBound(self) -> Incomplete: ... + def getNode(self) -> Incomplete: ... + def getOldBound(self) -> Incomplete: ... + def getRow(self) -> Incomplete: ... + def getType(self) -> Incomplete: ... + def getVar(self) -> Incomplete: ... + def __eq__(self, other: Incomplete)-> Incomplete: ... + def __ge__(self, other: Incomplete)-> Incomplete: ... + def __gt__(self, other: Incomplete)-> Incomplete: ... def __hash__(self) -> int: ... - def __le__(self, other: object) -> bool: ... - def __lt__(self, other: object) -> bool: ... - def __ne__(self, other: object) -> bool: ... + def __le__(self, other: Incomplete)-> Incomplete: ... + def __lt__(self, other: Incomplete)-> Incomplete: ... + def __ne__(self, other: Incomplete)-> Incomplete: ... +@disjoint_base class Eventhdlr: model: Incomplete name: Incomplete - def __init__(self, *args, **kwargs) -> None: ... - def eventcopy(self, *args, **kwargs): ... - def eventdelete(self, *args, **kwargs): ... - def eventexec(self, *args, **kwargs): ... - def eventexit(self, *args, **kwargs): ... - def eventexitsol(self, *args, **kwargs): ... - def eventfree(self, *args, **kwargs): ... - def eventinit(self, *args, **kwargs): ... - def eventinitsol(self, *args, **kwargs): ... - + def __init__(self) -> None: ... + def eventcopy(self) -> Incomplete: ... + def eventdelete(self) -> Incomplete: ... + def eventexec(self, event: Incomplete) -> Incomplete: ... + def eventexit(self) -> Incomplete: ... + def eventexitsol(self) -> Incomplete: ... + def eventfree(self) -> Incomplete: ... + def eventinit(self) -> Incomplete: ... + def eventinitsol(self) -> Incomplete: ... + +@disjoint_base class Expr: terms: Incomplete - def __init__(self, *args, **kwargs) -> None: ... - def degree(self, *args, **kwargs): ... - def normalize(self, *args, **kwargs): ... - def __abs__(self): ... - def __add__(self, other): ... - def __eq__(self, other: object) -> bool: ... - def __ge__(self, other: object) -> bool: ... - def __getitem__(self, index): ... - def __gt__(self, other: object) -> bool: ... - def __iadd__(self, other): ... - def __iter__(self): ... - def __le__(self, other: object) -> bool: ... - def __lt__(self, other: object) -> bool: ... - def __mul__(self, other): ... - def __ne__(self, other: object) -> bool: ... - def __neg__(self): ... - def __next__(self): ... - def __pow__(self, other): ... - def __radd__(self, other): ... - def __rmul__(self, other): ... - def __rpow__(self, other): ... - def __rsub__(self, other): ... - def __rtruediv__(self, other): ... - def __sub__(self, other): ... - def __truediv__(self, other): ... - + def __init__(self, *args: Incomplete, **kwargs: Incomplete) -> None: ... + def degree(self) -> Incomplete: ... + def normalize(self) -> Incomplete: ... + def __abs__(self) -> Incomplete: ... + def __add__(self, other: Incomplete) -> Incomplete: ... + def __eq__(self, other: Incomplete)-> Incomplete: ... + def __ge__(self, other: Incomplete)-> Incomplete: ... + def __getitem__(self, index: Incomplete) -> Incomplete: ... + def __gt__(self, other: Incomplete)-> Incomplete: ... + def __iadd__(self, other: Incomplete) -> Incomplete: ... # noqa: PYI034 + def __iter__(self) -> Incomplete: ... + def __le__(self, other: Incomplete)-> Incomplete: ... + def __lt__(self, other: Incomplete)-> Incomplete: ... + def __mul__(self, other: Incomplete) -> Incomplete: ... + def __ne__(self, other: Incomplete)-> Incomplete: ... + def __neg__(self) -> Incomplete: ... + def __next__(self) -> Incomplete: ... + def __pow__(self, other: Incomplete, mod: Incomplete = ...) -> Incomplete: ... + def __radd__(self, other: Incomplete) -> Incomplete: ... + def __rmul__(self, other: Incomplete) -> Incomplete: ... + def __rpow__(self, other: Incomplete) -> Incomplete: ... + def __rsub__(self, other: Incomplete) -> Incomplete: ... + def __rtruediv__(self, other: Incomplete) -> Incomplete: ... + def __sub__(self, other: Incomplete) -> Incomplete: ... + def __truediv__(self, other: Incomplete) -> Incomplete: ... + +@disjoint_base class ExprCons: _lhs: Incomplete _rhs: Incomplete expr: Incomplete - def __init__(self, *args, **kwargs) -> None: ... - def normalize(self, *args, **kwargs): ... - def __bool__(self) -> bool: ... - def __eq__(self, other: object) -> bool: ... - def __ge__(self, other: object) -> bool: ... - def __gt__(self, other: object) -> bool: ... - def __le__(self, other: object) -> bool: ... - def __lt__(self, other: object) -> bool: ... - def __ne__(self, other: object) -> bool: ... - + def __init__(self, *args: Incomplete, **kwargs: Incomplete) -> None: ... + def normalize(self) -> Incomplete: ... + def __bool__(self)-> Incomplete: ... + def __eq__(self, other: Incomplete)-> Incomplete: ... + def __ge__(self, other: Incomplete)-> Incomplete: ... + def __gt__(self, other: Incomplete)-> Incomplete: ... + def __le__(self, other: Incomplete)-> Incomplete: ... + def __lt__(self, other: Incomplete)-> Incomplete: ... + def __ne__(self, other: Incomplete)-> Incomplete: ... + +@disjoint_base class GenExpr: _op: Incomplete children: Incomplete - def __init__(self, *args, **kwargs) -> None: ... - def degree(self, *args, **kwargs): ... - def getOp(self, *args, **kwargs): ... - def __abs__(self): ... - def __add__(self, other): ... - def __eq__(self, other: object) -> bool: ... - def __ge__(self, other: object) -> bool: ... - def __gt__(self, other: object) -> bool: ... - def __le__(self, other: object) -> bool: ... - def __lt__(self, other: object) -> bool: ... - def __mul__(self, other): ... - def __ne__(self, other: object) -> bool: ... - def __neg__(self): ... - def __pow__(self, other): ... - def __radd__(self, other): ... - def __rmul__(self, other): ... - def __rpow__(self, other): ... - def __rsub__(self, other): ... - def __rtruediv__(self, other): ... - def __sub__(self, other): ... - def __truediv__(self, other): ... - + def __init__(self, *args: Incomplete, **kwargs: Incomplete) -> None: ... + def degree(self) -> Incomplete: ... + def getOp(self) -> Incomplete: ... + def __abs__(self) -> Incomplete: ... + def __add__(self, other: Incomplete) -> Incomplete: ... + def __eq__(self, other: Incomplete)-> Incomplete: ... + def __ge__(self, other: Incomplete)-> Incomplete: ... + def __gt__(self, other: Incomplete)-> Incomplete: ... + def __le__(self, other: Incomplete)-> Incomplete: ... + def __lt__(self, other: Incomplete)-> Incomplete: ... + def __mul__(self, other: Incomplete) -> Incomplete: ... + def __ne__(self, other: Incomplete)-> Incomplete: ... + def __neg__(self) -> Incomplete: ... + def __pow__(self, other: Incomplete, mod: Incomplete = ...) -> Incomplete: ... + def __radd__(self, other: Incomplete) -> Incomplete: ... + def __rmul__(self, other: Incomplete) -> Incomplete: ... + def __rpow__(self, other: Incomplete) -> Incomplete: ... + def __rsub__(self, other: Incomplete) -> Incomplete: ... + def __rtruediv__(self, other: Incomplete) -> Incomplete: ... + def __sub__(self, other: Incomplete) -> Incomplete: ... + def __truediv__(self, other: Incomplete) -> Incomplete: ... + +@disjoint_base class Heur: model: Incomplete name: Incomplete - def __init__(self, *args, **kwargs) -> None: ... - def heurexec(self, *args, **kwargs): ... - def heurexit(self, *args, **kwargs): ... - def heurexitsol(self, *args, **kwargs): ... - def heurfree(self, *args, **kwargs): ... - def heurinit(self, *args, **kwargs): ... - def heurinitsol(self, *args, **kwargs): ... - + def __init__(self) -> None: ... + def heurexec( + self, heurtiming: Incomplete, nodeinfeasible: Incomplete + ) -> Incomplete: ... + def heurexit(self) -> Incomplete: ... + def heurexitsol(self) -> Incomplete: ... + def heurfree(self) -> Incomplete: ... + def heurinit(self) -> Incomplete: ... + def heurinitsol(self) -> Incomplete: ... + +@disjoint_base class IIS: - def __init__(self, *args, **kwargs) -> None: ... - def getNNodes(self, *args, **kwargs): ... - def getSubscip(self, *args, **kwargs): ... - def getTime(self, *args, **kwargs): ... - def greedyMakeIrreducible(self, *args, **kwargs): ... - def isSubscipInfeasible(self, *args, **kwargs): ... - def isSubscipIrreducible(self, *args, **kwargs): ... - def setSubscipInfeasible(self, *args, **kwargs): ... - def setSubscipIrreducible(self, *args, **kwargs): ... - + def __init__(self) -> None: ... + def getNNodes(self) -> Incomplete: ... + def getSubscip(self) -> Incomplete: ... + def getTime(self) -> Incomplete: ... + def greedyMakeIrreducible(self) -> Incomplete: ... + def isSubscipInfeasible(self) -> Incomplete: ... + def isSubscipIrreducible(self) -> Incomplete: ... + def setSubscipInfeasible(self, infeasible: Incomplete) -> Incomplete: ... + def setSubscipIrreducible(self, irreducible: Incomplete) -> Incomplete: ... + +@disjoint_base class IISfinder: iis: Incomplete - def __init__(self, *args, **kwargs) -> None: ... - def iisfinderexec(self, *args, **kwargs): ... - def iisfinderfree(self, *args, **kwargs): ... + def __init__(self) -> None: ... + def iisfinderexec(self) -> Incomplete: ... + def iisfinderfree(self) -> Incomplete: ... +@disjoint_base class LP: name: Incomplete - def __init__(self, *args, **kwargs) -> None: ... - def addCol(self, *args, **kwargs): ... - def addCols(self, *args, **kwargs): ... - def addRow(self, *args, **kwargs): ... - def addRows(self, *args, **kwargs): ... - def chgBound(self, *args, **kwargs): ... - def chgCoef(self, *args, **kwargs): ... - def chgObj(self, *args, **kwargs): ... - def chgSide(self, *args, **kwargs): ... - def clear(self, *args, **kwargs): ... - def delCols(self, *args, **kwargs): ... - def delRows(self, *args, **kwargs): ... - def getActivity(self, *args, **kwargs): ... - def getBasisInds(self, *args, **kwargs): ... - def getBounds(self, *args, **kwargs): ... - def getDual(self, *args, **kwargs): ... - def getDualRay(self, *args, **kwargs): ... - def getIntParam(self, *args, **kwargs): ... - def getNIterations(self, *args, **kwargs): ... - def getObjVal(self, *args, **kwargs): ... - def getPrimal(self, *args, **kwargs): ... - def getPrimalRay(self, *args, **kwargs): ... - def getRealParam(self, *args, **kwargs): ... - def getRedcost(self, *args, **kwargs): ... - def getSides(self, *args, **kwargs): ... - def infinity(self, *args, **kwargs): ... - def isDualFeasible(self, *args, **kwargs): ... - def isInfinity(self, *args, **kwargs): ... - def isOptimal(self, *args, **kwargs): ... - def isPrimalFeasible(self, *args, **kwargs): ... - def ncols(self, *args, **kwargs): ... - def nrows(self, *args, **kwargs): ... - def readLP(self, *args, **kwargs): ... - def setIntParam(self, *args, **kwargs): ... - def setRealParam(self, *args, **kwargs): ... - def solve(self, *args, **kwargs): ... - def writeLP(self, *args, **kwargs): ... + def __init__(self, *args: Incomplete, **kwargs: Incomplete) -> None: ... + def addCol( + self, + entries: Incomplete, + obj: Incomplete = ..., + lb: Incomplete = ..., + ub: Incomplete = ..., + ) -> Incomplete: ... + def addCols( + self, + entrieslist: Incomplete, + objs: Incomplete = ..., + lbs: Incomplete = ..., + ubs: Incomplete = ..., + ) -> Incomplete: ... + def addRow( + self, entries: Incomplete, lhs: Incomplete = ..., rhs: Incomplete = ... + ) -> Incomplete: ... + def addRows( + self, entrieslist: Incomplete, lhss: Incomplete = ..., rhss: Incomplete = ... + ) -> Incomplete: ... + def chgBound( + self, col: Incomplete, lb: Incomplete, ub: Incomplete + ) -> Incomplete: ... + def chgCoef( + self, row: Incomplete, col: Incomplete, newval: Incomplete + ) -> Incomplete: ... + def chgObj(self, col: Incomplete, obj: Incomplete) -> Incomplete: ... + def chgSide( + self, row: Incomplete, lhs: Incomplete, rhs: Incomplete + ) -> Incomplete: ... + def clear(self) -> Incomplete: ... + def delCols(self, firstcol: Incomplete, lastcol: Incomplete) -> Incomplete: ... + def delRows(self, firstrow: Incomplete, lastrow: Incomplete) -> Incomplete: ... + def getActivity(self) -> Incomplete: ... + def getBasisInds(self) -> Incomplete: ... + def getBounds( + self, firstcol: Incomplete = ..., lastcol: Incomplete = ... + ) -> Incomplete: ... + def getDual(self) -> Incomplete: ... + def getDualRay(self) -> Incomplete: ... + def getIntParam(self, param: Incomplete) -> Incomplete: ... + def getNIterations(self) -> Incomplete: ... + def getObjVal(self) -> Incomplete: ... + def getPrimal(self) -> Incomplete: ... + def getPrimalRay(self) -> Incomplete: ... + def getRealParam(self, param: Incomplete) -> Incomplete: ... + def getRedcost(self) -> Incomplete: ... + def getSides( + self, firstrow: Incomplete = ..., lastrow: Incomplete = ... + ) -> Incomplete: ... + def infinity(self) -> Incomplete: ... + def isDualFeasible(self) -> Incomplete: ... + def isInfinity(self, val: Incomplete) -> Incomplete: ... + def isOptimal(self) -> Incomplete: ... + def isPrimalFeasible(self) -> Incomplete: ... + def ncols(self) -> Incomplete: ... + def nrows(self) -> Incomplete: ... + def readLP(self, filename: Incomplete) -> Incomplete: ... + def setIntParam(self, param: Incomplete, value: Incomplete) -> Incomplete: ... + def setRealParam(self, param: Incomplete, value: Incomplete) -> Incomplete: ... + def solve(self, dual: Incomplete = ...) -> Incomplete: ... + def writeLP(self, filename: Incomplete) -> Incomplete: ... class MatrixConstraint(numpy.ndarray): - def getConshdlrName(self, *args, **kwargs): ... - def isActive(self, *args, **kwargs): ... - def isChecked(self, *args, **kwargs): ... - def isDynamic(self, *args, **kwargs): ... - def isEnforced(self, *args, **kwargs): ... - def isInitial(self, *args, **kwargs): ... - def isLinear(self, *args, **kwargs): ... - def isLocal(self, *args, **kwargs): ... - def isModifiable(self, *args, **kwargs): ... - def isNonlinear(self, *args, **kwargs): ... - def isPropagated(self, *args, **kwargs): ... - def isRemovable(self, *args, **kwargs): ... - def isSeparated(self, *args, **kwargs): ... - def isStickingAtNode(self, *args, **kwargs): ... + def getConshdlrName(self) -> Incomplete: ... + def isActive(self) -> Incomplete: ... + def isChecked(self) -> Incomplete: ... + def isDynamic(self) -> Incomplete: ... + def isEnforced(self) -> Incomplete: ... + def isInitial(self) -> Incomplete: ... + def isLinear(self) -> Incomplete: ... + def isLocal(self) -> Incomplete: ... + def isModifiable(self) -> Incomplete: ... + def isNonlinear(self) -> Incomplete: ... + def isPropagated(self) -> Incomplete: ... + def isRemovable(self) -> Incomplete: ... + def isSeparated(self) -> Incomplete: ... + def isStickingAtNode(self) -> Incomplete: ... class MatrixExpr(numpy.ndarray): - def sum(self, *args, **kwargs): ... - def __add__(self, other): ... - def __eq__(self, other: object) -> bool: ... - def __ge__(self, other: object) -> bool: ... - def __iadd__(self, other): ... - def __le__(self, other: object) -> bool: ... - def __matmul__(self, *args, **kwargs): ... - def __mul__(self, other): ... - def __pow__(self, other): ... - def __radd__(self, other): ... - def __rmul__(self, other): ... - def __rsub__(self, other): ... - def __rtruediv__(self, other): ... - def __sub__(self, other): ... - def __truediv__(self, other): ... + def sum( # type: ignore[override] + self, axis: Incomplete = ..., keepdims: Incomplete = ..., **kwargs: Incomplete + ) -> Incomplete: ... + def __add__(self, other: Incomplete) -> Incomplete: ... + def __eq__(self, other: Incomplete)-> Incomplete: ... + def __ge__(self, other: Incomplete) -> MatrixExprCons: ... + def __iadd__(self, other: Incomplete) -> Incomplete: ... # noqa: PYI034 + def __le__(self, other: Incomplete) -> MatrixExprCons: ... + def __matmul__(self, other: Incomplete) -> Incomplete: ... + def __mul__(self, other: Incomplete) -> Incomplete: ... + def __pow__(self, other: Incomplete) -> Incomplete: ... # type: ignore[override] + def __radd__(self, other: Incomplete) -> Incomplete: ... + def __rmul__(self, other: Incomplete) -> Incomplete: ... + def __rsub__(self, other: Incomplete) -> Incomplete: ... + def __rtruediv__(self, other: Incomplete) -> Incomplete: ... + def __sub__(self, other: Incomplete) -> Incomplete: ... + def __truediv__(self, other: Incomplete) -> Incomplete: ... class MatrixExprCons(numpy.ndarray): - def __eq__(self, other: object) -> bool: ... - def __ge__(self, other: object) -> bool: ... - def __le__(self, other: object) -> bool: ... + def __eq__(self, other: Incomplete)-> Incomplete: ... + def __ge__(self, other: Incomplete) -> MatrixExprCons: ... + def __le__(self, other: Incomplete) -> MatrixExprCons: ... -class MatrixGenExpr(MatrixExpr): ... +class MatrixGenExpr(MatrixExpr): + ... class MatrixVariable(MatrixExpr): - def getAvgSol(self, *args, **kwargs): ... - def getCol(self, *args, **kwargs): ... - def getIndex(self, *args, **kwargs): ... - def getLPSol(self, *args, **kwargs): ... - def getLbGlobal(self, *args, **kwargs): ... - def getLbLocal(self, *args, **kwargs): ... - def getLbOriginal(self, *args, **kwargs): ... - def getObj(self, *args, **kwargs): ... - def getUbGlobal(self, *args, **kwargs): ... - def getUbLocal(self, *args, **kwargs): ... - def getUbOriginal(self, *args, **kwargs): ... - def isInLP(self, *args, **kwargs): ... - def varMayRound(self, *args, **kwargs): ... - def vtype(self, *args, **kwargs): ... - + def getAvgSol(self) -> Incomplete: ... + def getCol(self) -> Incomplete: ... + def getIndex(self) -> Incomplete: ... + def getLPSol(self) -> Incomplete: ... + def getLbGlobal(self) -> Incomplete: ... + def getLbLocal(self) -> Incomplete: ... + def getLbOriginal(self) -> Incomplete: ... + def getObj(self) -> Incomplete: ... + def getUbGlobal(self) -> Incomplete: ... + def getUbLocal(self) -> Incomplete: ... + def getUbOriginal(self) -> Incomplete: ... + def isInLP(self) -> Incomplete: ... + def varMayRound(self, direction: Incomplete = ...) -> Incomplete: ... + def vtype(self) -> Incomplete: ... + +@disjoint_base class Model: _freescip: Incomplete data: Incomplete - def __init__(self, *args, **kwargs) -> None: ... - def _createConsGenNonlinear(self, *args, **kwargs): ... - def _createConsLinear(self, *args, **kwargs): ... - def _createConsNonlinear(self, *args, **kwargs): ... - def _createConsQuadratic(self, *args, **kwargs): ... - def _getStageNames(self, *args, **kwargs): ... - def activateBenders(self, *args, **kwargs): ... - def addBendersSubproblem(self, *args, **kwargs): ... - def addCoefKnapsack(self, *args, **kwargs): ... - def addCoefLinear(self, *args, **kwargs): ... - def addCons(self, *args, **kwargs): ... - def addConsAnd(self, *args, **kwargs): ... - def addConsCardinality(self, *args, **kwargs): ... - def addConsCoeff(self, *args, **kwargs): ... - def addConsDisjunction(self, *args, **kwargs): ... - def addConsElemDisjunction(self, *args, **kwargs): ... - def addConsIndicator(self, *args, **kwargs): ... - def addConsKnapsack(self, *args, **kwargs): ... - def addConsLocal(self, *args, **kwargs): ... - def addConsNode(self, *args, **kwargs): ... - def addConsOr(self, *args, **kwargs): ... - def addConsSOS1(self, *args, **kwargs): ... - def addConsSOS2(self, *args, **kwargs): ... - def addConsXor(self, *args, **kwargs): ... - def addConss(self, *args, **kwargs): ... - def addCut(self, *args, **kwargs): ... - def addExprNonlinear(self, *args, **kwargs): ... - def addMatrixCons(self, *args, **kwargs): ... - def addMatrixConsIndicator(self, *args, **kwargs): ... - def addMatrixVar(self, *args, **kwargs): ... - def addObjoffset(self, *args, **kwargs): ... - def addPoolCut(self, *args, **kwargs): ... - def addPyCons(self, *args, **kwargs): ... - def addRowDive(self, *args, **kwargs): ... - def addRowExact(self, *args, **kwargs): ... - def addSol(self, *args, **kwargs): ... - def addVar(self, *args, **kwargs): ... - def addVarLocks(self, *args, **kwargs): ... - def addVarLocksType(self, *args, **kwargs): ... - def addVarSOS1(self, *args, **kwargs): ... - def addVarSOS2(self, *args, **kwargs): ... - def addVarToRow(self, *args, **kwargs): ... - def allColsInLP(self, *args, **kwargs): ... - def allowNegSlackExact(self, *args, **kwargs): ... - def appendVarSOS1(self, *args, **kwargs): ... - def appendVarSOS2(self, *args, **kwargs): ... - def applyCutsProbing(self, *args, **kwargs): ... - def attachEventHandlerCallback(self, *args, **kwargs): ... - def backtrackProbing(self, *args, **kwargs): ... - def branchLPExact(self, *args, **kwargs): ... - def branchVar(self, *args, **kwargs): ... - def branchVarVal(self, *args, **kwargs): ... - def cacheRowExtensions(self, *args, **kwargs): ... - def calcChildEstimate(self, *args, **kwargs): ... - def calcNodeselPriority(self, *args, **kwargs): ... - def catchEvent(self, *args, **kwargs): ... - def catchRowEvent(self, *args, **kwargs): ... - def catchVarEvent(self, *args, **kwargs): ... - def checkBendersSubproblemOptimality(self, *args, **kwargs): ... - def checkQuadraticNonlinear(self, *args, **kwargs): ... - def checkSol(self, *args, **kwargs): ... - def chgCapacityKnapsack(self, *args, **kwargs): ... - def chgCoefLinear(self, *args, **kwargs): ... - def chgLhs(self, *args, **kwargs): ... - def chgReoptObjective(self, *args, **kwargs): ... - def chgRhs(self, *args, **kwargs): ... - def chgRowLhsDive(self, *args, **kwargs): ... - def chgRowRhsDive(self, *args, **kwargs): ... - def chgVarBranchPriority(self, *args, **kwargs): ... - def chgVarLb(self, *args, **kwargs): ... - def chgVarLbDive(self, *args, **kwargs): ... - def chgVarLbGlobal(self, *args, **kwargs): ... - def chgVarLbNode(self, *args, **kwargs): ... - def chgVarLbProbing(self, *args, **kwargs): ... - def chgVarObjDive(self, *args, **kwargs): ... - def chgVarObjProbing(self, *args, **kwargs): ... - def chgVarType(self, *args, **kwargs): ... - def chgVarUb(self, *args, **kwargs): ... - def chgVarUbDive(self, *args, **kwargs): ... - def chgVarUbGlobal(self, *args, **kwargs): ... - def chgVarUbNode(self, *args, **kwargs): ... - def chgVarUbProbing(self, *args, **kwargs): ... - def computeBestSolSubproblems(self, *args, **kwargs): ... - def constructLP(self, *args, **kwargs): ... - def copyLargeNeighborhoodSearch(self, *args, **kwargs): ... - def count(self, *args, **kwargs): ... - def createChild(self, *args, **kwargs): ... - def createCons(self, *args, **kwargs): ... - def createConsFromExpr(self, *args, **kwargs): ... - def createEmptyRowSepa(self, *args, **kwargs): ... - def createEmptyRowUnspec(self, *args, **kwargs): ... - def createOrigSol(self, *args, **kwargs): ... - def createPartialSol(self, *args, **kwargs): ... - def createProbBasic(self, *args, **kwargs): ... - def createSol(self, *args, **kwargs): ... - def cutoffNode(self, *args, **kwargs): ... - def deactivatePricer(self, *args, **kwargs): ... - def delCoefLinear(self, *args, **kwargs): ... - def delCons(self, *args, **kwargs): ... - def delConsLocal(self, *args, **kwargs): ... - def delVar(self, *args, **kwargs): ... - def disableDebugSol(self, *args, **kwargs): ... - def disablePropagation(self, *args, **kwargs): ... - def dropEvent(self, *args, **kwargs): ... - def dropRowEvent(self, *args, **kwargs): ... - def dropVarEvent(self, *args, **kwargs): ... - def enableDebugSol(self, *args, **kwargs): ... - def enableExactSolving(self, *args, **kwargs): ... - def enableReoptimization(self, *args, **kwargs): ... - def endDive(self, *args, **kwargs): ... - def endProbing(self, *args, **kwargs): ... - def endStrongbranch(self, *args, **kwargs): ... - def epsilon(self, *args, **kwargs): ... - def feasCeil(self, *args, **kwargs): ... - def feasFloor(self, *args, **kwargs): ... - def feasFrac(self, *args, **kwargs): ... - def feasRound(self, *args, **kwargs): ... - def feastol(self, *args, **kwargs): ... - def fixVar(self, *args, **kwargs): ... - def fixVarProbing(self, *args, **kwargs): ... - def flushRowExtensions(self, *args, **kwargs): ... - def frac(self, *args, **kwargs): ... - def freeBendersSubproblems(self, *args, **kwargs): ... - def freeProb(self, *args, **kwargs): ... - def freeReoptSolve(self, *args, **kwargs): ... - def freeSol(self, *args, **kwargs): ... - def freeTransform(self, *args, **kwargs): ... + def __init__(self, *args: Incomplete, **kwargs: Incomplete) -> None: ... + def _createConsGenNonlinear( + self, cons: Incomplete, **kwargs: Incomplete + ) -> Incomplete: ... + def _createConsLinear( + self, lincons: Incomplete, **kwargs: Incomplete + ) -> Incomplete: ... + def _createConsNonlinear( + self, cons: Incomplete, **kwargs: Incomplete + ) -> Incomplete: ... + def _createConsQuadratic( + self, quadcons: Incomplete, **kwargs: Incomplete + ) -> Incomplete: ... + def _getStageNames(self) -> Incomplete: ... + def activateBenders( + self, benders: Incomplete, nsubproblems: Incomplete + ) -> Incomplete: ... + def addBendersSubproblem( + self, benders: Incomplete, subproblem: Incomplete + ) -> Incomplete: ... + def addCoefKnapsack( + self, cons: Incomplete, var: Incomplete, weight: Incomplete + ) -> Incomplete: ... + def addCoefLinear( + self, cons: Incomplete, var: Incomplete, value: Incomplete + ) -> Incomplete: ... + def addCons( + self, + cons: Incomplete, + name: Incomplete = ..., + initial: Incomplete = ..., + separate: Incomplete = ..., + enforce: Incomplete = ..., + check: Incomplete = ..., + propagate: Incomplete = ..., + local: Incomplete = ..., + modifiable: Incomplete = ..., + dynamic: Incomplete = ..., + removable: Incomplete = ..., + stickingatnode: Incomplete = ..., + ) -> Incomplete: ... + def addConsAnd( + self, + vars: Incomplete, + resvar: Incomplete, + name: Incomplete = ..., + initial: Incomplete = ..., + separate: Incomplete = ..., + enforce: Incomplete = ..., + check: Incomplete = ..., + propagate: Incomplete = ..., + local: Incomplete = ..., + modifiable: Incomplete = ..., + dynamic: Incomplete = ..., + removable: Incomplete = ..., + stickingatnode: Incomplete = ..., + ) -> Incomplete: ... + def addConsCardinality( + self, + consvars: Incomplete, + cardval: Incomplete, + indvars: Incomplete = ..., + weights: Incomplete = ..., + name: Incomplete = ..., + initial: Incomplete = ..., + separate: Incomplete = ..., + enforce: Incomplete = ..., + check: Incomplete = ..., + propagate: Incomplete = ..., + local: Incomplete = ..., + dynamic: Incomplete = ..., + removable: Incomplete = ..., + stickingatnode: Incomplete = ..., + ) -> Incomplete: ... + def addConsCoeff( + self, cons: Incomplete, var: Incomplete, coeff: Incomplete + ) -> Incomplete: ... + def addConsDisjunction( + self, + conss: Incomplete, + name: Incomplete = ..., + initial: Incomplete = ..., + relaxcons: Incomplete = ..., + enforce: Incomplete = ..., + check: Incomplete = ..., + local: Incomplete = ..., + modifiable: Incomplete = ..., + dynamic: Incomplete = ..., + ) -> Incomplete: ... + def addConsElemDisjunction( + self, disj_cons: Incomplete, cons: Incomplete + ) -> Incomplete: ... + def addConsIndicator( + self, + cons: Incomplete, + binvar: Incomplete = ..., + activeone: Incomplete = ..., + name: Incomplete = ..., + initial: Incomplete = ..., + separate: Incomplete = ..., + enforce: Incomplete = ..., + check: Incomplete = ..., + propagate: Incomplete = ..., + local: Incomplete = ..., + dynamic: Incomplete = ..., + removable: Incomplete = ..., + stickingatnode: Incomplete = ..., + ) -> Incomplete: ... + def addConsKnapsack( + self, + vars: Incomplete, + weights: Incomplete, + capacity: Incomplete, + name: Incomplete = ..., + initial: Incomplete = ..., + separate: Incomplete = ..., + enforce: Incomplete = ..., + check: Incomplete = ..., + modifiable: Incomplete = ..., + propagate: Incomplete = ..., + local: Incomplete = ..., + dynamic: Incomplete = ..., + removable: Incomplete = ..., + stickingatnode: Incomplete = ..., + ) -> Incomplete: ... + def addConsLocal( + self, cons: Incomplete, validnode: Incomplete = ... + ) -> Incomplete: ... + def addConsNode( + self, node: Incomplete, cons: Incomplete, validnode: Incomplete = ... + ) -> Incomplete: ... + def addConsOr( + self, + vars: Incomplete, + resvar: Incomplete, + name: Incomplete = ..., + initial: Incomplete = ..., + separate: Incomplete = ..., + enforce: Incomplete = ..., + check: Incomplete = ..., + propagate: Incomplete = ..., + local: Incomplete = ..., + modifiable: Incomplete = ..., + dynamic: Incomplete = ..., + removable: Incomplete = ..., + stickingatnode: Incomplete = ..., + ) -> Incomplete: ... + def addConsSOS1( + self, + vars: Incomplete, + weights: Incomplete = ..., + name: Incomplete = ..., + initial: Incomplete = ..., + separate: Incomplete = ..., + enforce: Incomplete = ..., + check: Incomplete = ..., + propagate: Incomplete = ..., + local: Incomplete = ..., + dynamic: Incomplete = ..., + removable: Incomplete = ..., + stickingatnode: Incomplete = ..., + ) -> Incomplete: ... + def addConsSOS2( + self, + vars: Incomplete, + weights: Incomplete = ..., + name: Incomplete = ..., + initial: Incomplete = ..., + separate: Incomplete = ..., + enforce: Incomplete = ..., + check: Incomplete = ..., + propagate: Incomplete = ..., + local: Incomplete = ..., + dynamic: Incomplete = ..., + removable: Incomplete = ..., + stickingatnode: Incomplete = ..., + ) -> Incomplete: ... + def addConsXor( + self, + vars: Incomplete, + rhsvar: Incomplete, + name: Incomplete = ..., + initial: Incomplete = ..., + separate: Incomplete = ..., + enforce: Incomplete = ..., + check: Incomplete = ..., + propagate: Incomplete = ..., + local: Incomplete = ..., + modifiable: Incomplete = ..., + dynamic: Incomplete = ..., + removable: Incomplete = ..., + stickingatnode: Incomplete = ..., + ) -> Incomplete: ... + def addConss( + self, + conss: Incomplete, + name: Incomplete = ..., + initial: Incomplete = ..., + separate: Incomplete = ..., + enforce: Incomplete = ..., + check: Incomplete = ..., + propagate: Incomplete = ..., + local: Incomplete = ..., + modifiable: Incomplete = ..., + dynamic: Incomplete = ..., + removable: Incomplete = ..., + stickingatnode: Incomplete = ..., + ) -> Incomplete: ... + def addCut(self, cut: Incomplete, forcecut: Incomplete = ...) -> Incomplete: ... + def addExprNonlinear( + self, cons: Incomplete, expr: Incomplete, coef: Incomplete + ) -> Incomplete: ... + def addMatrixCons( + self, + cons: Incomplete, + name: Incomplete = ..., + initial: Incomplete = ..., + separate: Incomplete = ..., + enforce: Incomplete = ..., + check: Incomplete = ..., + propagate: Incomplete = ..., + local: Incomplete = ..., + modifiable: Incomplete = ..., + dynamic: Incomplete = ..., + removable: Incomplete = ..., + stickingatnode: Incomplete = ..., + ) -> Incomplete: ... + def addMatrixConsIndicator( + self, + cons: Incomplete, + binvar: Incomplete = ..., + activeone: Incomplete = ..., + name: Incomplete = ..., + initial: Incomplete = ..., + separate: Incomplete = ..., + enforce: Incomplete = ..., + check: Incomplete = ..., + propagate: Incomplete = ..., + local: Incomplete = ..., + dynamic: Incomplete = ..., + removable: Incomplete = ..., + stickingatnode: Incomplete = ..., + ) -> Incomplete: ... + def addMatrixVar( + self, + shape: Incomplete, + name: Incomplete = ..., + vtype: Incomplete = ..., + lb: Incomplete = ..., + ub: Incomplete = ..., + obj: Incomplete = ..., + pricedVar: Incomplete = ..., + pricedVarScore: Incomplete = ..., + ) -> Incomplete: ... + def addObjoffset( + self, offset: Incomplete, solutions: Incomplete = ... + ) -> Incomplete: ... + def addPoolCut(self, row: Incomplete) -> Incomplete: ... + def addPyCons(self, cons: Incomplete) -> Incomplete: ... + def addRowDive(self, row: Incomplete) -> Incomplete: ... + def addRowExact(self, rowexact: Incomplete) -> Incomplete: ... + def addSol(self, solution: Incomplete, free: Incomplete = ...) -> Incomplete: ... + def addVar( + self, + name: Incomplete = ..., + vtype: Incomplete = ..., + lb: Incomplete = ..., + ub: Incomplete = ..., + obj: Incomplete = ..., + pricedVar: Incomplete = ..., + pricedVarScore: Incomplete = ..., + deletable: Incomplete = ..., + ) -> Incomplete: ... + def addVarLocks( + self, var: Incomplete, nlocksdown: Incomplete, nlocksup: Incomplete + ) -> Incomplete: ... + def addVarLocksType( + self, + var: Incomplete, + locktype: Incomplete, + nlocksdown: Incomplete, + nlocksup: Incomplete, + ) -> Incomplete: ... + def addVarSOS1( + self, cons: Incomplete, var: Incomplete, weight: Incomplete + ) -> Incomplete: ... + def addVarSOS2( + self, cons: Incomplete, var: Incomplete, weight: Incomplete + ) -> Incomplete: ... + def addVarToRow( + self, row: Incomplete, var: Incomplete, value: Incomplete + ) -> Incomplete: ... + def allColsInLP(self) -> Incomplete: ... + def allowNegSlackExact(self) -> Incomplete: ... + def appendVarSOS1(self, cons: Incomplete, var: Incomplete) -> Incomplete: ... + def appendVarSOS2(self, cons: Incomplete, var: Incomplete) -> Incomplete: ... + def applyCutsProbing(self) -> Incomplete: ... + def attachEventHandlerCallback( + self, + callback: Incomplete, + events: Incomplete, + name: Incomplete = ..., + description: Incomplete = ..., + ) -> Incomplete: ... + def backtrackProbing(self, probingdepth: Incomplete) -> Incomplete: ... + def branchLPExact(self) -> Incomplete: ... + def branchVar(self, variable: Incomplete) -> Incomplete: ... + def branchVarVal(self, variable: Incomplete, value: Incomplete) -> Incomplete: ... + def cacheRowExtensions(self, row: Incomplete) -> Incomplete: ... + def calcChildEstimate( + self, variable: Incomplete, targetvalue: Incomplete + ) -> Incomplete: ... + def calcNodeselPriority( + self, variable: Incomplete, branchdir: Incomplete, targetvalue: Incomplete + ) -> Incomplete: ... + def catchEvent( + self, eventtype: Incomplete, eventhdlr: Incomplete + ) -> Incomplete: ... + def catchRowEvent( + self, row: Incomplete, eventtype: Incomplete, eventhdlr: Incomplete + ) -> Incomplete: ... + def catchVarEvent( + self, var: Incomplete, eventtype: Incomplete, eventhdlr: Incomplete + ) -> Incomplete: ... + def checkBendersSubproblemOptimality( + self, solution: Incomplete, probnumber: Incomplete, benders: Incomplete = ... + ) -> Incomplete: ... + def checkQuadraticNonlinear(self, cons: Incomplete) -> Incomplete: ... + def checkSol( + self, + solution: Incomplete, + printreason: Incomplete = ..., + completely: Incomplete = ..., + checkbounds: Incomplete = ..., + checkintegrality: Incomplete = ..., + checklprows: Incomplete = ..., + original: Incomplete = ..., + ) -> Incomplete: ... + def chgCapacityKnapsack( + self, cons: Incomplete, capacity: Incomplete + ) -> Incomplete: ... + def chgCoefLinear( + self, cons: Incomplete, var: Incomplete, value: Incomplete + ) -> Incomplete: ... + def chgLhs(self, cons: Incomplete, lhs: Incomplete) -> Incomplete: ... + def chgReoptObjective( + self, coeffs: Incomplete, sense: Incomplete = ... + ) -> Incomplete: ... + def chgRhs(self, cons: Incomplete, rhs: Incomplete) -> Incomplete: ... + def chgRowLhsDive(self, row: Incomplete, newlhs: Incomplete) -> Incomplete: ... + def chgRowRhsDive(self, row: Incomplete, newrhs: Incomplete) -> Incomplete: ... + def chgVarBranchPriority( + self, var: Incomplete, priority: Incomplete + ) -> Incomplete: ... + def chgVarLb(self, var: Incomplete, lb: Incomplete) -> Incomplete: ... + def chgVarLbDive(self, var: Incomplete, newbound: Incomplete) -> Incomplete: ... + def chgVarLbGlobal(self, var: Incomplete, lb: Incomplete) -> Incomplete: ... + def chgVarLbNode( + self, node: Incomplete, var: Incomplete, lb: Incomplete + ) -> Incomplete: ... + def chgVarLbProbing(self, var: Incomplete, lb: Incomplete) -> Incomplete: ... + def chgVarObjDive(self, var: Incomplete, newobj: Incomplete) -> Incomplete: ... + def chgVarObjProbing(self, var: Incomplete, newobj: Incomplete) -> Incomplete: ... + def chgVarType(self, var: Incomplete, vtype: Incomplete) -> Incomplete: ... + def chgVarUb(self, var: Incomplete, ub: Incomplete) -> Incomplete: ... + def chgVarUbDive(self, var: Incomplete, newbound: Incomplete) -> Incomplete: ... + def chgVarUbGlobal(self, var: Incomplete, ub: Incomplete) -> Incomplete: ... + def chgVarUbNode( + self, node: Incomplete, var: Incomplete, ub: Incomplete + ) -> Incomplete: ... + def chgVarUbProbing(self, var: Incomplete, ub: Incomplete) -> Incomplete: ... + def computeBestSolSubproblems(self) -> Incomplete: ... + def constructLP(self) -> Incomplete: ... + def copyLargeNeighborhoodSearch( + self, to_fix: Incomplete, fix_vals: Incomplete + ) -> Incomplete: ... + def count(self) -> Incomplete: ... + def createChild( + self, nodeselprio: Incomplete, estimate: Incomplete + ) -> Incomplete: ... + def createCons( + self, + conshdlr: Incomplete, + name: Incomplete, + initial: Incomplete = ..., + separate: Incomplete = ..., + enforce: Incomplete = ..., + check: Incomplete = ..., + propagate: Incomplete = ..., + local: Incomplete = ..., + modifiable: Incomplete = ..., + dynamic: Incomplete = ..., + removable: Incomplete = ..., + stickingatnode: Incomplete = ..., + ) -> Incomplete: ... + def createConsFromExpr( + self, + cons: Incomplete, + name: Incomplete = ..., + initial: Incomplete = ..., + separate: Incomplete = ..., + enforce: Incomplete = ..., + check: Incomplete = ..., + propagate: Incomplete = ..., + local: Incomplete = ..., + modifiable: Incomplete = ..., + dynamic: Incomplete = ..., + removable: Incomplete = ..., + stickingatnode: Incomplete = ..., + ) -> Incomplete: ... + def createEmptyRowSepa( + self, + sepa: Incomplete, + name: Incomplete = ..., + lhs: Incomplete = ..., + rhs: Incomplete = ..., + local: Incomplete = ..., + modifiable: Incomplete = ..., + removable: Incomplete = ..., + ) -> Incomplete: ... + def createEmptyRowUnspec( + self, + name: Incomplete = ..., + lhs: Incomplete = ..., + rhs: Incomplete = ..., + local: Incomplete = ..., + modifiable: Incomplete = ..., + removable: Incomplete = ..., + ) -> Incomplete: ... + def createOrigSol(self, heur: Incomplete = ...) -> Incomplete: ... + def createPartialSol(self, heur: Incomplete = ...) -> Incomplete: ... + def createProbBasic(self, problemName: Incomplete = ...) -> Incomplete: ... + def createSol( + self, heur: Incomplete = ..., initlp: Incomplete = ... + ) -> Incomplete: ... + def cutoffNode(self, node: Incomplete) -> Incomplete: ... + def deactivatePricer(self, pricer: Incomplete) -> Incomplete: ... + def delCoefLinear(self, cons: Incomplete, var: Incomplete) -> Incomplete: ... + def delCons(self, cons: Incomplete) -> Incomplete: ... + def delConsLocal(self, cons: Incomplete) -> Incomplete: ... + def delVar(self, var: Incomplete) -> Incomplete: ... + def disableDebugSol(self) -> Incomplete: ... + def disablePropagation(self, onlyroot: Incomplete = ...) -> Incomplete: ... + def dropEvent(self, eventtype: Incomplete, eventhdlr: Incomplete) -> Incomplete: ... + def dropRowEvent( + self, row: Incomplete, eventtype: Incomplete, eventhdlr: Incomplete + ) -> Incomplete: ... + def dropVarEvent( + self, var: Incomplete, eventtype: Incomplete, eventhdlr: Incomplete + ) -> Incomplete: ... + def enableDebugSol(self) -> Incomplete: ... + def enableExactSolving(self, enable: Incomplete) -> Incomplete: ... + def enableReoptimization(self, enable: Incomplete = ...) -> Incomplete: ... + def endDive(self) -> Incomplete: ... + def endProbing(self) -> Incomplete: ... + def endStrongbranch(self) -> Incomplete: ... + def epsilon(self) -> Incomplete: ... + def feasCeil(self, value: Incomplete) -> Incomplete: ... + def feasFloor(self, value: Incomplete) -> Incomplete: ... + def feasFrac(self, value: Incomplete) -> Incomplete: ... + def feasRound(self, value: Incomplete) -> Incomplete: ... + def feastol(self) -> Incomplete: ... + def fixVar(self, var: Incomplete, val: Incomplete) -> Incomplete: ... + def fixVarProbing(self, var: Incomplete, fixedval: Incomplete) -> Incomplete: ... + def flushRowExtensions(self, row: Incomplete) -> Incomplete: ... + def frac(self, value: Incomplete) -> Incomplete: ... + def freeBendersSubproblems(self) -> Incomplete: ... + def freeProb(self) -> Incomplete: ... + def freeReoptSolve(self) -> Incomplete: ... + def freeSol(self, solution: Incomplete) -> Incomplete: ... + def freeTransform(self) -> Incomplete: ... @staticmethod - def from_ptr(*args, **kwargs): ... - def generateIIS(self, *args, **kwargs): ... - def getActivity(self, *args, **kwargs): ... - def getBendersAuxiliaryVar(self, *args, **kwargs): ... - def getBendersSubproblem(self, *args, **kwargs): ... - def getBendersVar(self, *args, **kwargs): ... - def getBestChild(self, *args, **kwargs): ... - def getBestLeaf(self, *args, **kwargs): ... - def getBestNode(self, *args, **kwargs): ... - def getBestSibling(self, *args, **kwargs): ... - def getBestSol(self, *args, **kwargs): ... - def getBestboundNode(self, *args, **kwargs): ... - def getBipartiteGraphRepresentation(self, *args, **kwargs): ... - def getBranchScoreMultiple(self, *args, **kwargs): ... - def getCapacityKnapsack(self, *args, **kwargs): ... - def getChildren(self, *args, **kwargs): ... - def getColRedCost(self, *args, **kwargs): ... - def getCondition(self, *args, **kwargs): ... - def getConsNVars(self, *args, **kwargs): ... - def getConsVals(self, *args, **kwargs): ... - def getConsVars(self, *args, **kwargs): ... - def getConss(self, *args, **kwargs): ... - def getCurrentNode(self, *args, **kwargs): ... - def getCutEfficacy(self, *args, **kwargs): ... - def getCutLPSolCutoffDistance(self, *args, **kwargs): ... - def getCutoffbound(self, *args, **kwargs): ... - def getDepth(self, *args, **kwargs): ... - def getDualMultiplier(self, *args, **kwargs): ... - def getDualSolVal(self, *args, **kwargs): ... - def getDualbound(self, *args, **kwargs): ... - def getDualboundRoot(self, *args, **kwargs): ... - def getDualfarkasKnapsack(self, *args, **kwargs): ... - def getDualfarkasLinear(self, *args, **kwargs): ... - def getDualsolKnapsack(self, *args, **kwargs): ... - def getDualsolLinear(self, *args, **kwargs): ... - def getGap(self, *args, **kwargs): ... - def getHeurTiming(self, *args, **kwargs): ... - def getIIS(self, *args, **kwargs): ... - def getLPBInvARow(self, *args, **kwargs): ... - def getLPBInvRow(self, *args, **kwargs): ... - def getLPBasisInd(self, *args, **kwargs): ... - def getLPBranchCands(self, *args, **kwargs): ... - def getLPColsData(self, *args, **kwargs): ... - def getLPObjVal(self, *args, **kwargs): ... - def getLPRowsData(self, *args, **kwargs): ... - def getLPSolstat(self, *args, **kwargs): ... - def getLeaves(self, *args, **kwargs): ... - def getLhs(self, *args, **kwargs): ... - def getLinearConsIndicator(self, *args, **kwargs): ... - def getLocalEstimate(self, *args, **kwargs): ... - def getLowerbound(self, *args, **kwargs): ... - def getMajorVersion(self, *args, **kwargs): ... - def getMaxDepth(self, *args, **kwargs): ... - def getMinorVersion(self, *args, **kwargs): ... - def getNBestSolsFound(self, *args, **kwargs): ... - def getNBinVars(self, *args, **kwargs): ... - def getNChildren(self, *args, **kwargs): ... - def getNConss(self, *args, **kwargs): ... - def getNContVars(self, *args, **kwargs): ... - def getNCountedSols(self, *args, **kwargs): ... - def getNCuts(self, *args, **kwargs): ... - def getNCutsApplied(self, *args, **kwargs): ... - def getNFeasibleLeaves(self, *args, **kwargs): ... - def getNImplVars(self, *args, **kwargs): ... - def getNInfeasibleLeaves(self, *args, **kwargs): ... - def getNIntVars(self, *args, **kwargs): ... - def getNLPBranchCands(self, *args, **kwargs): ... - def getNLPCols(self, *args, **kwargs): ... - def getNLPIterations(self, *args, **kwargs): ... - def getNLPRows(self, *args, **kwargs): ... - def getNLPs(self, *args, **kwargs): ... - def getNLeaves(self, *args, **kwargs): ... - def getNLimSolsFound(self, *args, **kwargs): ... - def getNNlRows(self, *args, **kwargs): ... - def getNNodeLPIterations(self, *args, **kwargs): ... - def getNNodes(self, *args, **kwargs): ... - def getNReaders(self, *args, **kwargs): ... - def getNSepaRounds(self, *args, **kwargs): ... - def getNSiblings(self, *args, **kwargs): ... - def getNSols(self, *args, **kwargs): ... - def getNSolsFound(self, *args, **kwargs): ... - def getNStrongbranchLPIterations(self, *args, **kwargs): ... - def getNTotalNodes(self, *args, **kwargs): ... - def getNVars(self, *args, **kwargs): ... - def getNVarsAnd(self, *args, **kwargs): ... - def getNlRowActivityBounds(self, *args, **kwargs): ... - def getNlRowSolActivity(self, *args, **kwargs): ... - def getNlRowSolFeasibility(self, *args, **kwargs): ... - def getNlRows(self, *args, **kwargs): ... - def getObjVal(self, *args, **kwargs): ... - def getObjective(self, *args, **kwargs): ... - def getObjectiveSense(self, *args, **kwargs): ... - def getObjlimit(self, *args, **kwargs): ... - def getObjoffset(self, *args, **kwargs): ... - def getOpenNodes(self, *args, **kwargs): ... - def getParam(self, *args, **kwargs): ... - def getParams(self, *args, **kwargs): ... - def getPlungeDepth(self, *args, **kwargs): ... - def getPresolvingTime(self, *args, **kwargs): ... - def getPrimalRay(self, *args, **kwargs): ... - def getPrimalRayVal(self, *args, **kwargs): ... - def getPrimalbound(self, *args, **kwargs): ... - def getPrioChild(self, *args, **kwargs): ... - def getPrioSibling(self, *args, **kwargs): ... - def getProbName(self, *args, **kwargs): ... - def getProbingDepth(self, *args, **kwargs): ... - def getPseudoBranchCands(self, *args, **kwargs): ... - def getReadingTime(self, *args, **kwargs): ... - def getResultantAnd(self, *args, **kwargs): ... - def getRhs(self, *args, **kwargs): ... - def getRowActivity(self, *args, **kwargs): ... - def getRowDualSol(self, *args, **kwargs): ... - def getRowLPActivity(self, *args, **kwargs): ... - def getRowLinear(self, *args, **kwargs): ... - def getRowNumIntCols(self, *args, **kwargs): ... - def getRowObjParallelism(self, *args, **kwargs): ... - def getRowParallelism(self, *args, **kwargs): ... - def getSiblings(self, *args, **kwargs): ... - def getSlack(self, *args, **kwargs): ... - def getSlackVarIndicator(self, *args, **kwargs): ... - def getSolObjVal(self, *args, **kwargs): ... - def getSolTime(self, *args, **kwargs): ... - def getSolVal(self, *args, **kwargs): ... - def getSols(self, *args, **kwargs): ... - def getSolvingTime(self, *args, **kwargs): ... - def getStage(self, *args, **kwargs): ... - def getStageName(self, *args, **kwargs): ... - def getStatus(self, *args, **kwargs): ... - def getTechVersion(self, *args, **kwargs): ... - def getTermsQuadratic(self, *args, **kwargs): ... - def getTotalTime(self, *args, **kwargs): ... - def getTransformedCons(self, *args, **kwargs): ... - def getTransformedVar(self, *args, **kwargs): ... - def getTreesizeEstimation(self, *args, **kwargs): ... - def getVal(self, *args, **kwargs): ... - def getValsLinear(self, *args, **kwargs): ... - def getVarDict(self, *args, **kwargs): ... - def getVarLbDive(self, *args, **kwargs): ... - def getVarPseudocost(self, *args, **kwargs): ... - def getVarPseudocostScore(self, *args, **kwargs): ... - def getVarRedcost(self, *args, **kwargs): ... - def getVarStrongbranch(self, *args, **kwargs): ... - def getVarStrongbranchLast(self, *args, **kwargs): ... - def getVarStrongbranchNode(self, *args, **kwargs): ... - def getVarUbDive(self, *args, **kwargs): ... - def getVars(self, *args, **kwargs): ... - def getVarsAnd(self, *args, **kwargs): ... - def getWeightsKnapsack(self, *args, **kwargs): ... - def hasPrimalRay(self, *args, **kwargs): ... - def hideOutput(self, *args, **kwargs): ... - def inProbing(self, *args, **kwargs): ... - def inRepropagation(self, *args, **kwargs): ... - def includeBenders(self, *args, **kwargs): ... - def includeBendersDefaultCuts(self, *args, **kwargs): ... - def includeBenderscut(self, *args, **kwargs): ... - def includeBranchrule(self, *args, **kwargs): ... - def includeConshdlr(self, *args, **kwargs): ... - def includeCutsel(self, *args, **kwargs): ... - def includeDefaultPlugins(self, *args, **kwargs): ... - def includeEventhdlr(self, *args, **kwargs): ... - def includeHeur(self, *args, **kwargs): ... - def includeIISfinder(self, *args, **kwargs): ... - def includeNodesel(self, *args, **kwargs): ... - def includePresol(self, *args, **kwargs): ... - def includePricer(self, *args, **kwargs): ... - def includeProp(self, *args, **kwargs): ... - def includeReader(self, *args, **kwargs): ... - def includeRelax(self, *args, **kwargs): ... - def includeSepa(self, *args, **kwargs): ... - def infinity(self, *args, **kwargs): ... - def initBendersDefault(self, *args, **kwargs): ... - def interruptSolve(self, *args, **kwargs): ... - def isAndConsSorted(self, *args, **kwargs): ... - def isCutEfficacious(self, *args, **kwargs): ... - def isEQ(self, *args, **kwargs): ... - def isExact(self, *args, **kwargs): ... - def isFeasEQ(self, *args, **kwargs): ... - def isFeasGE(self, *args, **kwargs): ... - def isFeasGT(self, *args, **kwargs): ... - def isFeasIntegral(self, *args, **kwargs): ... - def isFeasLE(self, *args, **kwargs): ... - def isFeasLT(self, *args, **kwargs): ... - def isFeasNegative(self, *args, **kwargs): ... - def isFeasPositive(self, *args, **kwargs): ... - def isFeasZero(self, *args, **kwargs): ... - def isGE(self, *args, **kwargs): ... - def isGT(self, *args, **kwargs): ... - def isHugeValue(self, *args, **kwargs): ... - def isInfinity(self, *args, **kwargs): ... - def isLE(self, *args, **kwargs): ... - def isLPSolBasic(self, *args, **kwargs): ... - def isLT(self, *args, **kwargs): ... - def isNLPConstructed(self, *args, **kwargs): ... - def isNegative(self, *args, **kwargs): ... - def isObjChangedProbing(self, *args, **kwargs): ... - def isPositive(self, *args, **kwargs): ... - def isZero(self, *args, **kwargs): ... - def lpiGetIterations(self, *args, **kwargs): ... - def markDoNotAggrVar(self, *args, **kwargs): ... - def markDoNotMultaggrVar(self, *args, **kwargs): ... - def newProbingNode(self, *args, **kwargs): ... - def optimize(self, *args, **kwargs): ... - def optimizeNogil(self, *args, **kwargs): ... - def presolve(self, *args, **kwargs): ... - def printBestSol(self, *args, **kwargs): ... - def printCons(self, *args, **kwargs): ... - def printExternalCodeVersions(self, *args, **kwargs): ... - def printNlRow(self, *args, **kwargs): ... - def printProblem(self, *args, **kwargs): ... - def printRow(self, *args, **kwargs): ... - def printSol(self, *args, **kwargs): ... - def printStatistics(self, *args, **kwargs): ... - def printStatisticsJson(self, *args, **kwargs): ... - def printVersion(self, *args, **kwargs): ... - def propagateProbing(self, *args, **kwargs): ... - def readParams(self, *args, **kwargs): ... - def readProblem(self, *args, **kwargs): ... - def readSol(self, *args, **kwargs): ... - def readSolFile(self, *args, **kwargs): ... - def redirectOutput(self, *args, **kwargs): ... - def relax(self, *args, **kwargs): ... - def releaseRow(self, *args, **kwargs): ... - def repropagateNode(self, *args, **kwargs): ... - def resetParam(self, *args, **kwargs): ... - def resetParams(self, *args, **kwargs): ... - def restartSolve(self, *args, **kwargs): ... - def separateSol(self, *args, **kwargs): ... - def setBendersSubproblemIsConvex(self, *args, **kwargs): ... - def setBoolParam(self, *args, **kwargs): ... - def setCharParam(self, *args, **kwargs): ... - def setCheck(self, *args, **kwargs): ... - def setEmphasis(self, *args, **kwargs): ... - def setEnforced(self, *args, **kwargs): ... - def setHeurTiming(self, *args, **kwargs): ... - def setHeuristics(self, *args, **kwargs): ... - def setInitial(self, *args, **kwargs): ... - def setIntParam(self, *args, **kwargs): ... - def setLogfile(self, *args, **kwargs): ... - def setLongintParam(self, *args, **kwargs): ... - def setMaximize(self, *args, **kwargs): ... - def setMinimize(self, *args, **kwargs): ... - def setModifiable(self, *args, **kwargs): ... - def setObjIntegral(self, *args, **kwargs): ... - def setObjective(self, *args, **kwargs): ... - def setObjlimit(self, *args, **kwargs): ... - def setParam(self, *args, **kwargs): ... - def setParams(self, *args, **kwargs): ... - def setParamsCountsols(self, *args, **kwargs): ... - def setPresolve(self, *args, **kwargs): ... - def setProbName(self, *args, **kwargs): ... - def setRealParam(self, *args, **kwargs): ... - def setRelaxSolVal(self, *args, **kwargs): ... - def setRemovable(self, *args, **kwargs): ... - def setSeparating(self, *args, **kwargs): ... - def setSolVal(self, *args, **kwargs): ... - def setStringParam(self, *args, **kwargs): ... - def setupBendersSubproblem(self, *args, **kwargs): ... - def solveBendersSubproblem(self, *args, **kwargs): ... - def solveConcurrent(self, *args, **kwargs): ... - def solveDiveLP(self, *args, **kwargs): ... - def solveProbingLP(self, *args, **kwargs): ... - def sortAndCons(self, *args, **kwargs): ... - def startDive(self, *args, **kwargs): ... - def startProbing(self, *args, **kwargs): ... - def startStrongbranch(self, *args, **kwargs): ... - def tightenVarLb(self, *args, **kwargs): ... - def tightenVarLbGlobal(self, *args, **kwargs): ... - def tightenVarUb(self, *args, **kwargs): ... - def tightenVarUbGlobal(self, *args, **kwargs): ... - def to_ptr(self, *args, **kwargs): ... - def translateSubSol(self, *args, **kwargs): ... - def trySol(self, *args, **kwargs): ... - def updateBendersLowerbounds(self, *args, **kwargs): ... - def updateNodeLowerbound(self, *args, **kwargs): ... - def updateVarPseudocost(self, *args, **kwargs): ... - def version(self, *args, **kwargs): ... - def writeBestSol(self, *args, **kwargs): ... - def writeBestTransSol(self, *args, **kwargs): ... - def writeLP(self, *args, **kwargs): ... - def writeMIP(self, *args, **kwargs): ... - def writeName(self, *args, **kwargs): ... - def writeParams(self, *args, **kwargs): ... - def writeProblem(self, *args, **kwargs): ... - def writeSol(self, *args, **kwargs): ... - def writeStatistics(self, *args, **kwargs): ... - def writeStatisticsJson(self, *args, **kwargs): ... - def writeTransSol(self, *args, **kwargs): ... - def __eq__(self, other: object) -> bool: ... - def __ge__(self, other: object) -> bool: ... - def __gt__(self, other: object) -> bool: ... + def from_ptr(capsule: Incomplete, take_ownership: Incomplete) -> Incomplete: ... + def generateIIS(self) -> Incomplete: ... + def getActivity(self, cons: Incomplete, sol: Incomplete = ...) -> Incomplete: ... + def getBendersAuxiliaryVar( + self, probnumber: Incomplete, benders: Incomplete = ... + ) -> Incomplete: ... + def getBendersSubproblem( + self, probnumber: Incomplete, benders: Incomplete = ... + ) -> Incomplete: ... + def getBendersVar( + self, var: Incomplete, benders: Incomplete = ..., probnumber: Incomplete = ... + ) -> Incomplete: ... + def getBestChild(self) -> Incomplete: ... + def getBestLeaf(self) -> Incomplete: ... + def getBestNode(self) -> Incomplete: ... + def getBestSibling(self) -> Incomplete: ... + def getBestSol(self) -> Incomplete: ... + def getBestboundNode(self) -> Incomplete: ... + def getBipartiteGraphRepresentation( + self, + prev_col_features: Incomplete = ..., + prev_edge_features: Incomplete = ..., + prev_row_features: Incomplete = ..., + static_only: Incomplete = ..., + suppress_warnings: Incomplete = ..., + ) -> Incomplete: ... + def getBranchScoreMultiple( + self, var: Incomplete, gains: Incomplete + ) -> Incomplete: ... + def getCapacityKnapsack(self, cons: Incomplete) -> Incomplete: ... + def getChildren(self) -> Incomplete: ... + def getColRedCost(self, col: Incomplete) -> Incomplete: ... + def getCondition(self, exact: Incomplete = ...) -> Incomplete: ... + def getConsNVars(self, constraint: Incomplete) -> Incomplete: ... + def getConsVals(self, constraint: Incomplete) -> Incomplete: ... + def getConsVars(self, constraint: Incomplete) -> Incomplete: ... + def getConss(self, transformed: Incomplete = ...) -> Incomplete: ... + def getCurrentNode(self) -> Incomplete: ... + def getCutEfficacy(self, cut: Incomplete, sol: Incomplete = ...) -> Incomplete: ... + def getCutLPSolCutoffDistance( + self, cut: Incomplete, sol: Incomplete + ) -> Incomplete: ... + def getCutoffbound(self) -> Incomplete: ... + def getDepth(self) -> Incomplete: ... + def getDualMultiplier(self, cons: Incomplete) -> Incomplete: ... + def getDualSolVal( + self, cons: Incomplete, boundconstraint: Incomplete = ... + ) -> Incomplete: ... + def getDualbound(self) -> Incomplete: ... + def getDualboundRoot(self) -> Incomplete: ... + def getDualfarkasKnapsack(self, cons: Incomplete) -> Incomplete: ... + def getDualfarkasLinear(self, cons: Incomplete) -> Incomplete: ... + def getDualsolKnapsack(self, cons: Incomplete) -> Incomplete: ... + def getDualsolLinear(self, cons: Incomplete) -> Incomplete: ... + def getGap(self) -> Incomplete: ... + def getHeurTiming(self, heurname: Incomplete) -> Incomplete: ... + def getIIS(self) -> Incomplete: ... + def getLPBInvARow(self, row: Incomplete) -> Incomplete: ... + def getLPBInvRow(self, row: Incomplete) -> Incomplete: ... + def getLPBasisInd(self) -> Incomplete: ... + def getLPBranchCands(self) -> Incomplete: ... + def getLPColsData(self) -> Incomplete: ... + def getLPObjVal(self) -> Incomplete: ... + def getLPRowsData(self) -> Incomplete: ... + def getLPSolstat(self) -> Incomplete: ... + def getLeaves(self) -> Incomplete: ... + def getLhs(self, cons: Incomplete) -> Incomplete: ... + def getLinearConsIndicator(self, cons: Incomplete) -> Incomplete: ... + def getLocalEstimate(self, original: Incomplete = ...) -> Incomplete: ... + def getLowerbound(self) -> Incomplete: ... + def getMajorVersion(self) -> Incomplete: ... + def getMaxDepth(self) -> Incomplete: ... + def getMinorVersion(self) -> Incomplete: ... + def getNBestSolsFound(self) -> Incomplete: ... + def getNBinVars(self) -> Incomplete: ... + def getNChildren(self) -> Incomplete: ... + def getNConss(self, transformed: Incomplete = ...) -> Incomplete: ... + def getNContVars(self) -> Incomplete: ... + def getNCountedSols(self) -> Incomplete: ... + def getNCuts(self) -> Incomplete: ... + def getNCutsApplied(self) -> Incomplete: ... + def getNFeasibleLeaves(self) -> Incomplete: ... + def getNImplVars(self) -> Incomplete: ... + def getNInfeasibleLeaves(self) -> Incomplete: ... + def getNIntVars(self) -> Incomplete: ... + def getNLPBranchCands(self) -> Incomplete: ... + def getNLPCols(self) -> Incomplete: ... + def getNLPIterations(self) -> Incomplete: ... + def getNLPRows(self) -> Incomplete: ... + def getNLPs(self) -> Incomplete: ... + def getNLeaves(self) -> Incomplete: ... + def getNLimSolsFound(self) -> Incomplete: ... + def getNNlRows(self) -> Incomplete: ... + def getNNodeLPIterations(self) -> Incomplete: ... + def getNNodes(self) -> Incomplete: ... + def getNReaders(self) -> Incomplete: ... + def getNSepaRounds(self) -> Incomplete: ... + def getNSiblings(self) -> Incomplete: ... + def getNSols(self) -> Incomplete: ... + def getNSolsFound(self) -> Incomplete: ... + def getNStrongbranchLPIterations(self) -> Incomplete: ... + def getNTotalNodes(self) -> Incomplete: ... + def getNVars(self, transformed: Incomplete = ...) -> Incomplete: ... + def getNVarsAnd(self, and_cons: Incomplete) -> Incomplete: ... + def getNlRowActivityBounds(self, nlrow: Incomplete) -> Incomplete: ... + def getNlRowSolActivity( + self, nlrow: Incomplete, sol: Incomplete = ... + ) -> Incomplete: ... + def getNlRowSolFeasibility( + self, nlrow: Incomplete, sol: Incomplete = ... + ) -> Incomplete: ... + def getNlRows(self) -> Incomplete: ... + def getObjVal(self, original: Incomplete = ...) -> Incomplete: ... + def getObjective(self) -> Incomplete: ... + def getObjectiveSense(self) -> Incomplete: ... + def getObjlimit(self) -> Incomplete: ... + def getObjoffset(self, original: Incomplete = ...) -> Incomplete: ... + def getOpenNodes(self) -> Incomplete: ... + def getParam(self, name: Incomplete) -> Incomplete: ... + def getParams(self) -> Incomplete: ... + def getPlungeDepth(self) -> Incomplete: ... + def getPresolvingTime(self) -> Incomplete: ... + def getPrimalRay(self) -> Incomplete: ... + def getPrimalRayVal(self, var: Incomplete) -> Incomplete: ... + def getPrimalbound(self) -> Incomplete: ... + def getPrioChild(self) -> Incomplete: ... + def getPrioSibling(self) -> Incomplete: ... + def getProbName(self) -> Incomplete: ... + def getProbingDepth(self) -> Incomplete: ... + def getPseudoBranchCands(self) -> Incomplete: ... + def getReadingTime(self) -> Incomplete: ... + def getResultantAnd(self, and_cons: Incomplete) -> Incomplete: ... + def getRhs(self, cons: Incomplete) -> Incomplete: ... + def getRowActivity(self, row: Incomplete) -> Incomplete: ... + def getRowDualSol(self, row: Incomplete) -> Incomplete: ... + def getRowLPActivity(self, row: Incomplete) -> Incomplete: ... + def getRowLinear(self, cons: Incomplete) -> Incomplete: ... + def getRowNumIntCols(self, row: Incomplete) -> Incomplete: ... + def getRowObjParallelism(self, row: Incomplete) -> Incomplete: ... + def getRowParallelism( + self, row1: Incomplete, row2: Incomplete, orthofunc: Incomplete = ... + ) -> Incomplete: ... + def getSiblings(self) -> Incomplete: ... + def getSlack( + self, cons: Incomplete, sol: Incomplete = ..., side: Incomplete = ... + ) -> Incomplete: ... + def getSlackVarIndicator(self, cons: Incomplete) -> Incomplete: ... + def getSolObjVal( + self, sol: Incomplete, original: Incomplete = ... + ) -> Incomplete: ... + def getSolTime(self, sol: Incomplete) -> Incomplete: ... + def getSolVal(self, sol: Incomplete, expr: Incomplete) -> Incomplete: ... + def getSols(self) -> Incomplete: ... + def getSolvingTime(self) -> Incomplete: ... + def getStage(self) -> Incomplete: ... + def getStageName(self) -> Incomplete: ... + def getStatus(self) -> Incomplete: ... + def getTechVersion(self) -> Incomplete: ... + def getTermsQuadratic(self, cons: Incomplete) -> Incomplete: ... + def getTotalTime(self) -> Incomplete: ... + def getTransformedCons(self, cons: Incomplete) -> Incomplete: ... + def getTransformedVar(self, var: Incomplete) -> Incomplete: ... + def getTreesizeEstimation(self) -> Incomplete: ... + def getVal(self, expr: Incomplete) -> Incomplete: ... + def getValsLinear(self, cons: Incomplete) -> Incomplete: ... + def getVarDict(self, transformed: Incomplete = ...) -> Incomplete: ... + def getVarLbDive(self, var: Incomplete) -> Incomplete: ... + def getVarPseudocost( + self, var: Incomplete, branchdir: Incomplete + ) -> Incomplete: ... + def getVarPseudocostScore( + self, var: Incomplete, solVal: Incomplete + ) -> Incomplete: ... + def getVarRedcost(self, var: Incomplete) -> Incomplete: ... + def getVarStrongbranch( + self, + var: Incomplete, + itlim: Incomplete, + idempotent: Incomplete = ..., + integral: Incomplete = ..., + ) -> Incomplete: ... + def getVarStrongbranchLast(self, var: Incomplete) -> Incomplete: ... + def getVarStrongbranchNode(self, var: Incomplete) -> Incomplete: ... + def getVarUbDive(self, var: Incomplete) -> Incomplete: ... + def getVars(self, transformed: Incomplete = ...) -> Incomplete: ... + def getVarsAnd(self, and_cons: Incomplete) -> Incomplete: ... + def getWeightsKnapsack(self, cons: Incomplete) -> Incomplete: ... + def hasPrimalRay(self) -> Incomplete: ... + def hideOutput(self, quiet: Incomplete = ...) -> Incomplete: ... + def inProbing(self) -> Incomplete: ... + def inRepropagation(self) -> Incomplete: ... + def includeBenders( + self, + benders: Incomplete, + name: Incomplete, + desc: Incomplete, + priority: Incomplete = ..., + cutlp: Incomplete = ..., + cutpseudo: Incomplete = ..., + cutrelax: Incomplete = ..., + shareaux: Incomplete = ..., + ) -> Incomplete: ... + def includeBendersDefaultCuts(self, benders: Incomplete) -> Incomplete: ... + def includeBenderscut( + self, + benders: Incomplete, + benderscut: Incomplete, + name: Incomplete, + desc: Incomplete, + priority: Incomplete = ..., + islpcut: Incomplete = ..., + ) -> Incomplete: ... + def includeBranchrule( + self, + branchrule: Incomplete, + name: Incomplete, + desc: Incomplete, + priority: Incomplete, + maxdepth: Incomplete, + maxbounddist: Incomplete, + ) -> Incomplete: ... + def includeConshdlr( + self, + conshdlr: Incomplete, + name: Incomplete, + desc: Incomplete, + sepapriority: Incomplete = ..., + enfopriority: Incomplete = ..., + chckpriority: Incomplete = ..., + sepafreq: Incomplete = ..., + propfreq: Incomplete = ..., + eagerfreq: Incomplete = ..., + maxprerounds: Incomplete = ..., + delaysepa: Incomplete = ..., + delayprop: Incomplete = ..., + needscons: Incomplete = ..., + proptiming: Incomplete = ..., + presoltiming: Incomplete = ..., + ) -> Incomplete: ... + def includeCutsel( + self, + cutsel: Incomplete, + name: Incomplete, + desc: Incomplete, + priority: Incomplete, + ) -> Incomplete: ... + def includeDefaultPlugins(self) -> Incomplete: ... + def includeEventhdlr( + self, eventhdlr: Incomplete, name: Incomplete, desc: Incomplete + ) -> Incomplete: ... + def includeHeur( + self, + heur: Incomplete, + name: Incomplete, + desc: Incomplete, + dispchar: Incomplete, + priority: Incomplete = ..., + freq: Incomplete = ..., + freqofs: Incomplete = ..., + maxdepth: Incomplete = ..., + timingmask: Incomplete = ..., + usessubscip: Incomplete = ..., + ) -> Incomplete: ... + def includeIISfinder( + self, + iisfinder: Incomplete, + name: Incomplete, + desc: Incomplete, + priority: Incomplete = ..., + freq: Incomplete = ..., + ) -> Incomplete: ... + def includeNodesel( + self, + nodesel: Incomplete, + name: Incomplete, + desc: Incomplete, + stdpriority: Incomplete, + memsavepriority: Incomplete, + ) -> Incomplete: ... + def includePresol( + self, + presol: Incomplete, + name: Incomplete, + desc: Incomplete, + priority: Incomplete, + maxrounds: Incomplete, + timing: Incomplete = ..., + ) -> Incomplete: ... + def includePricer( + self, + pricer: Incomplete, + name: Incomplete, + desc: Incomplete, + priority: Incomplete = ..., + delay: Incomplete = ..., + ) -> Incomplete: ... + def includeProp( + self, + prop: Incomplete, + name: Incomplete, + desc: Incomplete, + presolpriority: Incomplete, + presolmaxrounds: Incomplete, + proptiming: Incomplete, + presoltiming: Incomplete = ..., + priority: Incomplete = ..., + freq: Incomplete = ..., + delay: Incomplete = ..., + ) -> Incomplete: ... + def includeReader( + self, reader: Incomplete, name: Incomplete, desc: Incomplete, ext: Incomplete + ) -> Incomplete: ... + def includeRelax( + self, + relax: Incomplete, + name: Incomplete, + desc: Incomplete, + priority: Incomplete = ..., + freq: Incomplete = ..., + ) -> Incomplete: ... + def includeSepa( + self, + sepa: Incomplete, + name: Incomplete, + desc: Incomplete, + priority: Incomplete = ..., + freq: Incomplete = ..., + maxbounddist: Incomplete = ..., + usessubscip: Incomplete = ..., + delay: Incomplete = ..., + ) -> Incomplete: ... + def infinity(self) -> Incomplete: ... + def initBendersDefault(self, subproblems: Incomplete) -> Incomplete: ... + def interruptSolve(self) -> Incomplete: ... + def isAndConsSorted(self, and_cons: Incomplete) -> Incomplete: ... + def isCutEfficacious( + self, cut: Incomplete, sol: Incomplete = ... + ) -> Incomplete: ... + def isEQ(self, val1: Incomplete, val2: Incomplete) -> Incomplete: ... + def isExact(self) -> Incomplete: ... + def isFeasEQ(self, val1: Incomplete, val2: Incomplete) -> Incomplete: ... + def isFeasGE(self, val1: Incomplete, val2: Incomplete) -> Incomplete: ... + def isFeasGT(self, val1: Incomplete, val2: Incomplete) -> Incomplete: ... + def isFeasIntegral(self, value: Incomplete) -> Incomplete: ... + def isFeasLE(self, val1: Incomplete, val2: Incomplete) -> Incomplete: ... + def isFeasLT(self, val1: Incomplete, val2: Incomplete) -> Incomplete: ... + def isFeasNegative(self, value: Incomplete) -> Incomplete: ... + def isFeasPositive(self, value: Incomplete) -> Incomplete: ... + def isFeasZero(self, value: Incomplete) -> Incomplete: ... + def isGE(self, val1: Incomplete, val2: Incomplete) -> Incomplete: ... + def isGT(self, val1: Incomplete, val2: Incomplete) -> Incomplete: ... + def isHugeValue(self, val: Incomplete) -> Incomplete: ... + def isInfinity(self, value: Incomplete) -> Incomplete: ... + def isLE(self, val1: Incomplete, val2: Incomplete) -> Incomplete: ... + def isLPSolBasic(self) -> Incomplete: ... + def isLT(self, val1: Incomplete, val2: Incomplete) -> Incomplete: ... + def isNLPConstructed(self) -> Incomplete: ... + def isNegative(self, val: Incomplete) -> Incomplete: ... + def isObjChangedProbing(self) -> Incomplete: ... + def isPositive(self, val: Incomplete) -> Incomplete: ... + def isZero(self, value: Incomplete) -> Incomplete: ... + def lpiGetIterations(self) -> Incomplete: ... + def markDoNotAggrVar(self, var: Incomplete) -> Incomplete: ... + def markDoNotMultaggrVar(self, var: Incomplete) -> Incomplete: ... + def newProbingNode(self) -> Incomplete: ... + def optimize(self) -> Incomplete: ... + def optimizeNogil(self) -> Incomplete: ... + def presolve(self) -> Incomplete: ... + def printBestSol(self, write_zeros: Incomplete = ...) -> Incomplete: ... + def printCons(self, constraint: Incomplete) -> Incomplete: ... + def printExternalCodeVersions(self) -> Incomplete: ... + def printNlRow(self, nlrow: Incomplete) -> Incomplete: ... + def printProblem( + self, + ext: Incomplete = ..., + trans: Incomplete = ..., + genericnames: Incomplete = ..., + ) -> Incomplete: ... + def printRow(self, row: Incomplete) -> Incomplete: ... + def printSol( + self, solution: Incomplete = ..., write_zeros: Incomplete = ... + ) -> Incomplete: ... + def printStatistics(self, filename: Incomplete = ...) -> Incomplete: ... + def printStatisticsJson(self) -> Incomplete: ... + def printVersion(self) -> Incomplete: ... + def propagateProbing(self, maxproprounds: Incomplete) -> Incomplete: ... + def readParams(self, file: Incomplete) -> Incomplete: ... + def readProblem( + self, filename: Incomplete, extension: Incomplete = ... + ) -> Incomplete: ... + def readSol(self, filename: Incomplete) -> Incomplete: ... + def readSolFile(self, filename: Incomplete) -> Incomplete: ... + def redirectOutput(self) -> Incomplete: ... + def relax(self) -> Incomplete: ... + def releaseRow(self, row: Incomplete) -> Incomplete: ... + def repropagateNode(self, node: Incomplete) -> Incomplete: ... + def resetParam(self, name: Incomplete) -> Incomplete: ... + def resetParams(self) -> Incomplete: ... + def restartSolve(self) -> Incomplete: ... + def separateSol( + self, + sol: Incomplete = ..., + pretendroot: Incomplete = ..., + allowlocal: Incomplete = ..., + onlydelayed: Incomplete = ..., + ) -> Incomplete: ... + def setBendersSubproblemIsConvex( + self, benders: Incomplete, probnumber: Incomplete, isconvex: Incomplete = ... + ) -> Incomplete: ... + def setBoolParam(self, name: Incomplete, value: Incomplete) -> Incomplete: ... + def setCharParam(self, name: Incomplete, value: Incomplete) -> Incomplete: ... + def setCheck(self, cons: Incomplete, newCheck: Incomplete) -> Incomplete: ... + def setEmphasis( + self, paraemphasis: Incomplete, quiet: Incomplete = ... + ) -> Incomplete: ... + def setEnforced(self, cons: Incomplete, newEnf: Incomplete) -> Incomplete: ... + def setHeurTiming( + self, heurname: Incomplete, heurtiming: Incomplete + ) -> Incomplete: ... + def setHeuristics(self, setting: Incomplete) -> Incomplete: ... + def setInitial(self, cons: Incomplete, newInit: Incomplete) -> Incomplete: ... + def setIntParam(self, name: Incomplete, value: Incomplete) -> Incomplete: ... + def setLogfile(self, path: Incomplete) -> Incomplete: ... + def setLongintParam(self, name: Incomplete, value: Incomplete) -> Incomplete: ... + def setMaximize(self) -> Incomplete: ... + def setMinimize(self) -> Incomplete: ... + def setModifiable(self, cons: Incomplete, newMod: Incomplete) -> Incomplete: ... + def setObjIntegral(self) -> Incomplete: ... + def setObjective( + self, expr: Incomplete, sense: Incomplete = ..., clear: Incomplete = ... + ) -> Incomplete: ... + def setObjlimit(self, objlimit: Incomplete) -> Incomplete: ... + def setParam(self, name: Incomplete, value: Incomplete) -> Incomplete: ... + def setParams(self, params: Incomplete) -> Incomplete: ... + def setParamsCountsols(self) -> Incomplete: ... + def setPresolve(self, setting: Incomplete) -> Incomplete: ... + def setProbName(self, name: Incomplete) -> Incomplete: ... + def setRealParam(self, name: Incomplete, value: Incomplete) -> Incomplete: ... + def setRelaxSolVal(self, var: Incomplete, val: Incomplete) -> Incomplete: ... + def setRemovable(self, cons: Incomplete, newRem: Incomplete) -> Incomplete: ... + def setSeparating(self, setting: Incomplete) -> Incomplete: ... + def setSolVal( + self, solution: Incomplete, var: Incomplete, val: Incomplete + ) -> Incomplete: ... + def setStringParam(self, name: Incomplete, value: Incomplete) -> Incomplete: ... + def setupBendersSubproblem( + self, + probnumber: Incomplete, + benders: Incomplete = ..., + solution: Incomplete = ..., + checktype: Incomplete = ..., + ) -> Incomplete: ... + def solveBendersSubproblem( + self, + probnumber: Incomplete, + solvecip: Incomplete, + benders: Incomplete = ..., + solution: Incomplete = ..., + ) -> Incomplete: ... + def solveConcurrent(self) -> Incomplete: ... + def solveDiveLP(self, itlim: Incomplete = ...) -> Incomplete: ... + def solveProbingLP(self, itlim: Incomplete = ...) -> Incomplete: ... + def sortAndCons(self, and_cons: Incomplete) -> Incomplete: ... + def startDive(self) -> Incomplete: ... + def startProbing(self) -> Incomplete: ... + def startStrongbranch(self) -> Incomplete: ... + def tightenVarLb( + self, var: Incomplete, lb: Incomplete, force: Incomplete = ... + ) -> Incomplete: ... + def tightenVarLbGlobal( + self, var: Incomplete, lb: Incomplete, force: Incomplete = ... + ) -> Incomplete: ... + def tightenVarUb( + self, var: Incomplete, ub: Incomplete, force: Incomplete = ... + ) -> Incomplete: ... + def tightenVarUbGlobal( + self, var: Incomplete, ub: Incomplete, force: Incomplete = ... + ) -> Incomplete: ... + def to_ptr(self, give_ownership: Incomplete) -> Incomplete: ... + def translateSubSol( + self, sub_model: Incomplete, sol: Incomplete, heur: Incomplete + ) -> Incomplete: ... + def trySol( + self, + solution: Incomplete, + printreason: Incomplete = ..., + completely: Incomplete = ..., + checkbounds: Incomplete = ..., + checkintegrality: Incomplete = ..., + checklprows: Incomplete = ..., + free: Incomplete = ..., + ) -> Incomplete: ... + def updateBendersLowerbounds( + self, lowerbounds: Incomplete, benders: Incomplete = ... + ) -> Incomplete: ... + def updateNodeLowerbound(self, node: Incomplete, lb: Incomplete) -> Incomplete: ... + def updateVarPseudocost( + self, + var: Incomplete, + valdelta: Incomplete, + objdelta: Incomplete, + weight: Incomplete, + ) -> Incomplete: ... + def version(self) -> Incomplete: ... + def writeBestSol( + self, filename: Incomplete = ..., write_zeros: Incomplete = ... + ) -> Incomplete: ... + def writeBestTransSol( + self, filename: Incomplete = ..., write_zeros: Incomplete = ... + ) -> Incomplete: ... + def writeLP(self, filename: Incomplete = ...) -> Incomplete: ... + def writeMIP( + self, + filename: Incomplete, + genericnames: Incomplete = ..., + origobj: Incomplete = ..., + lazyconss: Incomplete = ..., + ) -> Incomplete: ... + def writeName(self, var: Incomplete) -> Incomplete: ... + def writeParams( + self, + filename: Incomplete = ..., + comments: Incomplete = ..., + onlychanged: Incomplete = ..., + verbose: Incomplete = ..., + ) -> Incomplete: ... + def writeProblem( + self, + filename: Incomplete = ..., + trans: Incomplete = ..., + genericnames: Incomplete = ..., + verbose: Incomplete = ..., + ) -> Incomplete: ... + def writeSol( + self, + solution: Incomplete, + filename: Incomplete = ..., + write_zeros: Incomplete = ..., + ) -> Incomplete: ... + def writeStatistics(self, filename: Incomplete = ...) -> Incomplete: ... + def writeStatisticsJson(self, filename: Incomplete = ...) -> Incomplete: ... + def writeTransSol( + self, + solution: Incomplete, + filename: Incomplete = ..., + write_zeros: Incomplete = ..., + ) -> Incomplete: ... + def __eq__(self, other: Incomplete)-> Incomplete: ... + def __ge__(self, other: Incomplete)-> Incomplete: ... + def __gt__(self, other: Incomplete)-> Incomplete: ... def __hash__(self) -> int: ... - def __le__(self, other: object) -> bool: ... - def __lt__(self, other: object) -> bool: ... - def __ne__(self, other: object) -> bool: ... + def __le__(self, other: Incomplete)-> Incomplete: ... + def __lt__(self, other: Incomplete)-> Incomplete: ... + def __ne__(self, other: Incomplete)-> Incomplete: ... +@disjoint_base class NLRow: data: Incomplete name: Incomplete - def __init__(self, *args, **kwargs) -> None: ... - def getConstant(self, *args, **kwargs): ... - def getDualsol(self, *args, **kwargs): ... - def getLhs(self, *args, **kwargs): ... - def getLinearTerms(self, *args, **kwargs): ... - def getRhs(self, *args, **kwargs): ... - def __eq__(self, other: object) -> bool: ... - def __ge__(self, other: object) -> bool: ... - def __gt__(self, other: object) -> bool: ... + def __init__(self) -> None: ... + def getConstant(self) -> Incomplete: ... + def getDualsol(self) -> Incomplete: ... + def getLhs(self) -> Incomplete: ... + def getLinearTerms(self) -> Incomplete: ... + def getRhs(self) -> Incomplete: ... + def __eq__(self, other: Incomplete)-> Incomplete: ... + def __ge__(self, other: Incomplete)-> Incomplete: ... + def __gt__(self, other: Incomplete)-> Incomplete: ... def __hash__(self) -> int: ... - def __le__(self, other: object) -> bool: ... - def __lt__(self, other: object) -> bool: ... - def __ne__(self, other: object) -> bool: ... + def __le__(self, other: Incomplete)-> Incomplete: ... + def __lt__(self, other: Incomplete)-> Incomplete: ... + def __ne__(self, other: Incomplete)-> Incomplete: ... +@disjoint_base class Node: data: Incomplete - def __init__(self, *args, **kwargs) -> None: ... - def getAddedConss(self, *args, **kwargs): ... - def getDepth(self, *args, **kwargs): ... - def getDomchg(self, *args, **kwargs): ... - def getEstimate(self, *args, **kwargs): ... - def getLowerbound(self, *args, **kwargs): ... - def getNAddedConss(self, *args, **kwargs): ... - def getNDomchg(self, *args, **kwargs): ... - def getNParentBranchings(self, *args, **kwargs): ... - def getNumber(self, *args, **kwargs): ... - def getParent(self, *args, **kwargs): ... - def getParentBranchings(self, *args, **kwargs): ... - def getType(self, *args, **kwargs): ... - def isActive(self, *args, **kwargs): ... - def isPropagatedAgain(self, *args, **kwargs): ... - def __eq__(self, other: object) -> bool: ... - def __ge__(self, other: object) -> bool: ... - def __gt__(self, other: object) -> bool: ... + def __init__(self) -> None: ... + def getAddedConss(self) -> Incomplete: ... + def getDepth(self) -> Incomplete: ... + def getDomchg(self) -> Incomplete: ... + def getEstimate(self) -> Incomplete: ... + def getLowerbound(self) -> Incomplete: ... + def getNAddedConss(self) -> Incomplete: ... + def getNDomchg(self) -> Incomplete: ... + def getNParentBranchings(self) -> Incomplete: ... + def getNumber(self) -> Incomplete: ... + def getParent(self) -> Incomplete: ... + def getParentBranchings(self) -> Incomplete: ... + def getType(self) -> Incomplete: ... + def isActive(self) -> Incomplete: ... + def isPropagatedAgain(self) -> Incomplete: ... + def __eq__(self, other: Incomplete)-> Incomplete: ... + def __ge__(self, other: Incomplete)-> Incomplete: ... + def __gt__(self, other: Incomplete)-> Incomplete: ... def __hash__(self) -> int: ... - def __le__(self, other: object) -> bool: ... - def __lt__(self, other: object) -> bool: ... - def __ne__(self, other: object) -> bool: ... + def __le__(self, other: Incomplete)-> Incomplete: ... + def __lt__(self, other: Incomplete)-> Incomplete: ... + def __ne__(self, other: Incomplete)-> Incomplete: ... +@disjoint_base class Nodesel: model: Incomplete - def __init__(self, *args, **kwargs) -> None: ... - def nodecomp(self, *args, **kwargs): ... - def nodeexit(self, *args, **kwargs): ... - def nodeexitsol(self, *args, **kwargs): ... - def nodefree(self, *args, **kwargs): ... - def nodeinit(self, *args, **kwargs): ... - def nodeinitsol(self, *args, **kwargs): ... - def nodeselect(self, *args, **kwargs): ... + def __init__(self) -> None: ... + def nodecomp(self, node1: Incomplete, node2: Incomplete) -> Incomplete: ... + def nodeexit(self) -> Incomplete: ... + def nodeexitsol(self) -> Incomplete: ... + def nodefree(self) -> Incomplete: ... + def nodeinit(self) -> Incomplete: ... + def nodeinitsol(self) -> Incomplete: ... + def nodeselect(self) -> Incomplete: ... class Op: add: ClassVar[str] = ... @@ -916,14 +1660,14 @@ class PY_SCIP_BENDERSENFOTYPE: LP: ClassVar[int] = ... PSEUDO: ClassVar[int] = ... RELAX: ClassVar[int] = ... - def __init__(self, *args, **kwargs) -> None: ... + def __init__(self) -> None: ... class PY_SCIP_BRANCHDIR: AUTO: ClassVar[int] = ... DOWNWARDS: ClassVar[int] = ... FIXED: ClassVar[int] = ... UPWARDS: ClassVar[int] = ... - def __init__(self, *args, **kwargs) -> None: ... + def __init__(self) -> None: ... class PY_SCIP_EVENTTYPE: BESTSOLFOUND: ClassVar[int] = ... @@ -982,7 +1726,7 @@ class PY_SCIP_EVENTTYPE: VAREVENT: ClassVar[int] = ... VARFIXED: ClassVar[int] = ... VARUNLOCKED: ClassVar[int] = ... - def __init__(self, *args, **kwargs) -> None: ... + def __init__(self) -> None: ... class PY_SCIP_HEURTIMING: AFTERLPLOOP: ClassVar[int] = ... @@ -996,18 +1740,18 @@ class PY_SCIP_HEURTIMING: DURINGLPLOOP: ClassVar[int] = ... DURINGPRESOLLOOP: ClassVar[int] = ... DURINGPRICINGLOOP: ClassVar[int] = ... - def __init__(self, *args, **kwargs) -> None: ... + def __init__(self) -> None: ... class PY_SCIP_IMPLINTTYPE: NONE: ClassVar[int] = ... STRONG: ClassVar[int] = ... WEAK: ClassVar[int] = ... - def __init__(self, *args, **kwargs) -> None: ... + def __init__(self) -> None: ... class PY_SCIP_LOCKTYPE: CONFLICT: ClassVar[int] = ... MODEL: ClassVar[int] = ... - def __init__(self, *args, **kwargs) -> None: ... + def __init__(self) -> None: ... class PY_SCIP_LPPARAM: BARRIERCONVTOL: ClassVar[int] = ... @@ -1030,7 +1774,7 @@ class PY_SCIP_LPPARAM: SCALING: ClassVar[int] = ... THREADS: ClassVar[int] = ... TIMING: ClassVar[int] = ... - def __init__(self, *args, **kwargs) -> None: ... + def __init__(self) -> None: ... class PY_SCIP_LPSOLSTAT: ERROR: ClassVar[int] = ... @@ -1041,7 +1785,7 @@ class PY_SCIP_LPSOLSTAT: OPTIMAL: ClassVar[int] = ... TIMELIMIT: ClassVar[int] = ... UNBOUNDEDRAY: ClassVar[int] = ... - def __init__(self, *args, **kwargs) -> None: ... + def __init__(self) -> None: ... class PY_SCIP_NODETYPE: CHILD: ClassVar[int] = ... @@ -1055,7 +1799,7 @@ class PY_SCIP_NODETYPE: REFOCUSNODE: ClassVar[int] = ... SIBLING: ClassVar[int] = ... SUBROOT: ClassVar[int] = ... - def __init__(self, *args, **kwargs) -> None: ... + def __init__(self) -> None: ... class PY_SCIP_PARAMEMPHASIS: BENCHMARK: ClassVar[int] = ... @@ -1070,28 +1814,28 @@ class PY_SCIP_PARAMEMPHASIS: PHASEFEAS: ClassVar[int] = ... PHASEIMPROVE: ClassVar[int] = ... PHASEPROOF: ClassVar[int] = ... - def __init__(self, *args, **kwargs) -> None: ... + def __init__(self) -> None: ... class PY_SCIP_PARAMSETTING: AGGRESSIVE: ClassVar[int] = ... DEFAULT: ClassVar[int] = ... FAST: ClassVar[int] = ... OFF: ClassVar[int] = ... - def __init__(self, *args, **kwargs) -> None: ... + def __init__(self) -> None: ... class PY_SCIP_PRESOLTIMING: EXHAUSTIVE: ClassVar[int] = ... FAST: ClassVar[int] = ... MEDIUM: ClassVar[int] = ... NONE: ClassVar[int] = ... - def __init__(self, *args, **kwargs) -> None: ... + def __init__(self) -> None: ... class PY_SCIP_PROPTIMING: AFTERLPLOOP: ClassVar[int] = ... AFTERLPNODE: ClassVar[int] = ... BEFORELP: ClassVar[int] = ... DURINGLPLOOP: ClassVar[int] = ... - def __init__(self, *args, **kwargs) -> None: ... + def __init__(self) -> None: ... class PY_SCIP_RESULT: BRANCHED: ClassVar[int] = ... @@ -1111,14 +1855,14 @@ class PY_SCIP_RESULT: SUCCESS: ClassVar[int] = ... SUSPENDED: ClassVar[int] = ... UNBOUNDED: ClassVar[int] = ... - def __init__(self, *args, **kwargs) -> None: ... + def __init__(self) -> None: ... class PY_SCIP_ROWORIGINTYPE: CONS: ClassVar[int] = ... REOPT: ClassVar[int] = ... SEPA: ClassVar[int] = ... UNSPEC: ClassVar[int] = ... - def __init__(self, *args, **kwargs) -> None: ... + def __init__(self) -> None: ... class PY_SCIP_SOLORIGIN: LPSOL: ClassVar[int] = ... @@ -1129,7 +1873,7 @@ class PY_SCIP_SOLORIGIN: RELAXSOL: ClassVar[int] = ... UNKNOWN: ClassVar[int] = ... ZERO: ClassVar[int] = ... - def __init__(self, *args, **kwargs) -> None: ... + def __init__(self) -> None: ... class PY_SCIP_STAGE: EXITPRESOLVE: ClassVar[int] = ... @@ -1146,7 +1890,7 @@ class PY_SCIP_STAGE: SOLVING: ClassVar[int] = ... TRANSFORMED: ClassVar[int] = ... TRANSFORMING: ClassVar[int] = ... - def __init__(self, *args, **kwargs) -> None: ... + def __init__(self) -> None: ... class PY_SCIP_STATUS: BESTSOLLIMIT: ClassVar[int] = ... @@ -1166,129 +1910,167 @@ class PY_SCIP_STATUS: UNBOUNDED: ClassVar[int] = ... UNKNOWN: ClassVar[int] = ... USERINTERRUPT: ClassVar[int] = ... - def __init__(self, *args, **kwargs) -> None: ... + def __init__(self) -> None: ... +@disjoint_base class PowExpr(GenExpr): expo: Incomplete - def __init__(self, *args, **kwargs) -> None: ... + def __init__(self, *args: Incomplete, **kwargs: Incomplete) -> None: ... +@disjoint_base class Presol: model: Incomplete - def __init__(self, *args, **kwargs) -> None: ... - def presolexec(self, *args, **kwargs): ... - def presolexit(self, *args, **kwargs): ... - def presolexitpre(self, *args, **kwargs): ... - def presolfree(self, *args, **kwargs): ... - def presolinit(self, *args, **kwargs): ... - def presolinitpre(self, *args, **kwargs): ... - + def __init__(self) -> None: ... + def presolexec( + self, nrounds: Incomplete, presoltiming: Incomplete + ) -> Incomplete: ... + def presolexit(self) -> Incomplete: ... + def presolexitpre(self) -> Incomplete: ... + def presolfree(self) -> Incomplete: ... + def presolinit(self) -> Incomplete: ... + def presolinitpre(self) -> Incomplete: ... + +@disjoint_base class Pricer: model: Incomplete - def __init__(self, *args, **kwargs) -> None: ... - def pricerexit(self, *args, **kwargs): ... - def pricerexitsol(self, *args, **kwargs): ... - def pricerfarkas(self, *args, **kwargs): ... - def pricerfree(self, *args, **kwargs): ... - def pricerinit(self, *args, **kwargs): ... - def pricerinitsol(self, *args, **kwargs): ... - def pricerredcost(self, *args, **kwargs): ... - + def __init__(self) -> None: ... + def pricerexit(self) -> Incomplete: ... + def pricerexitsol(self) -> Incomplete: ... + def pricerfarkas(self) -> Incomplete: ... + def pricerfree(self) -> Incomplete: ... + def pricerinit(self) -> Incomplete: ... + def pricerinitsol(self) -> Incomplete: ... + def pricerredcost(self) -> Incomplete: ... + +@disjoint_base class ProdExpr(GenExpr): constant: Incomplete - def __init__(self, *args, **kwargs) -> None: ... + def __init__(self, *args: Incomplete, **kwargs: Incomplete) -> None: ... +@disjoint_base class Prop: model: Incomplete - def __init__(self, *args, **kwargs) -> None: ... - def propexec(self, *args, **kwargs): ... - def propexit(self, *args, **kwargs): ... - def propexitpre(self, *args, **kwargs): ... - def propexitsol(self, *args, **kwargs): ... - def propfree(self, *args, **kwargs): ... - def propinit(self, *args, **kwargs): ... - def propinitpre(self, *args, **kwargs): ... - def propinitsol(self, *args, **kwargs): ... - def proppresol(self, *args, **kwargs): ... - def propresprop(self, *args, **kwargs): ... - + def __init__(self) -> None: ... + def propexec(self, proptiming: Incomplete) -> Incomplete: ... + def propexit(self) -> Incomplete: ... + def propexitpre(self) -> Incomplete: ... + def propexitsol(self, restart: Incomplete) -> Incomplete: ... + def propfree(self) -> Incomplete: ... + def propinit(self) -> Incomplete: ... + def propinitpre(self) -> Incomplete: ... + def propinitsol(self) -> Incomplete: ... + def proppresol( + self, nrounds: Incomplete, presoltiming: Incomplete, result_dict: Incomplete + ) -> Incomplete: ... + def propresprop( + self, + confvar: Incomplete, + inferinfo: Incomplete, + bdtype: Incomplete, + relaxedbd: Incomplete, + ) -> Incomplete: ... + +@disjoint_base class Reader: model: Incomplete name: Incomplete - def __init__(self, *args, **kwargs) -> None: ... - def readerfree(self, *args, **kwargs): ... - def readerread(self, *args, **kwargs): ... - def readerwrite(self, *args, **kwargs): ... - + def __init__(self) -> None: ... + def readerfree(self) -> Incomplete: ... + def readerread(self, filename: Incomplete) -> Incomplete: ... + def readerwrite( + self, + file: Incomplete, + name: Incomplete, + transformed: Incomplete, + objsense: Incomplete, + objoffset: Incomplete, + objscale: Incomplete, + binvars: Incomplete, + intvars: Incomplete, + implvars: Incomplete, + contvars: Incomplete, + fixedvars: Incomplete, + startnvars: Incomplete, + conss: Incomplete, + maxnconss: Incomplete, + startnconss: Incomplete, + genericnames: Incomplete, + ) -> Incomplete: ... + +@disjoint_base class Relax: model: Incomplete name: Incomplete - def __init__(self, *args, **kwargs) -> None: ... - def relaxexec(self, *args, **kwargs): ... - def relaxexit(self, *args, **kwargs): ... - def relaxexitsol(self, *args, **kwargs): ... - def relaxfree(self, *args, **kwargs): ... - def relaxinit(self, *args, **kwargs): ... - def relaxinitsol(self, *args, **kwargs): ... - + def __init__(self) -> None: ... + def relaxexec(self) -> Incomplete: ... + def relaxexit(self) -> Incomplete: ... + def relaxexitsol(self) -> Incomplete: ... + def relaxfree(self) -> Incomplete: ... + def relaxinit(self) -> Incomplete: ... + def relaxinitsol(self) -> Incomplete: ... + +@disjoint_base class Row: data: Incomplete name: Incomplete - def __init__(self, *args, **kwargs) -> None: ... - def getAge(self, *args, **kwargs): ... - def getBasisStatus(self, *args, **kwargs): ... - def getCols(self, *args, **kwargs): ... - def getConsOriginConshdlrtype(self, *args, **kwargs): ... - def getConstant(self, *args, **kwargs): ... - def getDualfarkas(self, *args, **kwargs): ... - def getDualsol(self, *args, **kwargs): ... - def getLPPos(self, *args, **kwargs): ... - def getLhs(self, *args, **kwargs): ... - def getNLPNonz(self, *args, **kwargs): ... - def getNNonz(self, *args, **kwargs): ... - def getNorm(self, *args, **kwargs): ... - def getOrigintype(self, *args, **kwargs): ... - def getRhs(self, *args, **kwargs): ... - def getVals(self, *args, **kwargs): ... - def isInGlobalCutpool(self, *args, **kwargs): ... - def isIntegral(self, *args, **kwargs): ... - def isLocal(self, *args, **kwargs): ... - def isModifiable(self, *args, **kwargs): ... - def isRemovable(self, *args, **kwargs): ... - def __eq__(self, other: object) -> bool: ... - def __ge__(self, other: object) -> bool: ... - def __gt__(self, other: object) -> bool: ... + def __init__(self) -> None: ... + def getAge(self) -> Incomplete: ... + def getBasisStatus(self) -> Incomplete: ... + def getCols(self) -> Incomplete: ... + def getConsOriginConshdlrtype(self) -> Incomplete: ... + def getConstant(self) -> Incomplete: ... + def getDualfarkas(self) -> Incomplete: ... + def getDualsol(self) -> Incomplete: ... + def getLPPos(self) -> Incomplete: ... + def getLhs(self) -> Incomplete: ... + def getNLPNonz(self) -> Incomplete: ... + def getNNonz(self) -> Incomplete: ... + def getNorm(self) -> Incomplete: ... + def getOrigintype(self) -> Incomplete: ... + def getRhs(self) -> Incomplete: ... + def getVals(self) -> Incomplete: ... + def isInGlobalCutpool(self) -> Incomplete: ... + def isIntegral(self) -> Incomplete: ... + def isLocal(self) -> Incomplete: ... + def isModifiable(self) -> Incomplete: ... + def isRemovable(self) -> Incomplete: ... + def __eq__(self, other: Incomplete)-> Incomplete: ... + def __ge__(self, other: Incomplete)-> Incomplete: ... + def __gt__(self, other: Incomplete)-> Incomplete: ... def __hash__(self) -> int: ... - def __le__(self, other: object) -> bool: ... - def __lt__(self, other: object) -> bool: ... - def __ne__(self, other: object) -> bool: ... + def __le__(self, other: Incomplete)-> Incomplete: ... + def __lt__(self, other: Incomplete)-> Incomplete: ... + def __ne__(self, other: Incomplete)-> Incomplete: ... +@disjoint_base class RowExact: data: Incomplete - def __init__(self, *args, **kwargs) -> None: ... + def __init__(self) -> None: ... +@disjoint_base class Sepa: model: Incomplete name: Incomplete - def __init__(self, *args, **kwargs) -> None: ... - def sepaexeclp(self, *args, **kwargs): ... - def sepaexecsol(self, *args, **kwargs): ... - def sepaexit(self, *args, **kwargs): ... - def sepaexitsol(self, *args, **kwargs): ... - def sepafree(self, *args, **kwargs): ... - def sepainit(self, *args, **kwargs): ... - def sepainitsol(self, *args, **kwargs): ... - + def __init__(self) -> None: ... + def sepaexeclp(self) -> Incomplete: ... + def sepaexecsol(self, solution: Incomplete) -> Incomplete: ... + def sepaexit(self) -> Incomplete: ... + def sepaexitsol(self) -> Incomplete: ... + def sepafree(self) -> Incomplete: ... + def sepainit(self) -> Incomplete: ... + def sepainitsol(self) -> Incomplete: ... + +@disjoint_base class Solution: data: Incomplete - def __init__(self, *args, **kwargs) -> None: ... - def _checkStage(self, *args, **kwargs): ... - def _evaluate(self, *args, **kwargs): ... - def getOrigin(self, *args, **kwargs): ... - def retransform(self, *args, **kwargs): ... - def translate(self, *args, **kwargs): ... - def __delitem__(self, other) -> None: ... - def __getitem__(self, index): ... - def __setitem__(self, index, object) -> None: ... + def __init__(self, *args: Incomplete, **kwargs: Incomplete) -> None: ... + def _checkStage(self, method: Incomplete) -> Incomplete: ... + def _evaluate(self, term: Incomplete) -> Incomplete: ... + def getOrigin(self) -> Incomplete: ... + def retransform(self) -> Incomplete: ... + def translate(self, target: Incomplete) -> Incomplete: ... + def __getitem__(self, index: Incomplete) -> Incomplete: ... + def __setitem__(self, index: Incomplete, object: Incomplete) -> None: ... @dataclass class Statistics: @@ -1300,102 +2082,107 @@ class Statistics: copying_time: float problem_name: str presolved_problem_name: str - n_runs: int = None - n_nodes: int = None + n_runs: int | None = None + n_nodes: int | None = None n_solutions_found: int = -1 - first_solution: float = None - primal_bound: float = None - dual_bound: float = None - gap: float = None - primal_dual_integral: float = None + first_solution: float | None = None + primal_bound: float | None = None + dual_bound: float | None = None + gap: float | None = None + primal_dual_integral: float | None = None @property - def n_binary_vars(self): ... + def n_binary_vars(self) -> Incomplete: ... @property - def n_conss(self): ... + def n_conss(self) -> Incomplete: ... @property - def n_continuous_vars(self): ... + def n_continuous_vars(self) -> Incomplete: ... @property - def n_implicit_integer_vars(self): ... + def n_implicit_integer_vars(self) -> Incomplete: ... @property - def n_integer_vars(self): ... + def n_integer_vars(self) -> Incomplete: ... @property - def n_maximal_cons(self): ... + def n_maximal_cons(self) -> Incomplete: ... @property - def n_presolved_binary_vars(self): ... + def n_presolved_binary_vars(self) -> Incomplete: ... @property - def n_presolved_conss(self): ... + def n_presolved_conss(self) -> Incomplete: ... @property - def n_presolved_continuous_vars(self): ... + def n_presolved_continuous_vars(self) -> Incomplete: ... @property - def n_presolved_implicit_integer_vars(self): ... + def n_presolved_implicit_integer_vars(self) -> Incomplete: ... @property - def n_presolved_integer_vars(self): ... + def n_presolved_integer_vars(self) -> Incomplete: ... @property - def n_presolved_maximal_cons(self): ... + def n_presolved_maximal_cons(self) -> Incomplete: ... @property - def n_presolved_vars(self): ... + def n_presolved_vars(self) -> Incomplete: ... @property - def n_vars(self): ... + def n_vars(self) -> Incomplete: ... +@disjoint_base class SumExpr(GenExpr): coefs: Incomplete constant: Incomplete - def __init__(self, *args, **kwargs) -> None: ... + def __init__(self, *args: Incomplete, **kwargs: Incomplete) -> None: ... class Term: hashval: Incomplete ptrtuple: Incomplete vartuple: Incomplete - def __init__(self, *args, **kwargs) -> None: ... - def __add__(self, other): ... - def __eq__(self, other: object) -> bool: ... - def __getitem__(self, index): ... + def __init__(self, *args: Incomplete) -> None: ... + def __add__(self, other: Incomplete) -> Incomplete: ... + def __eq__(self, other: Incomplete)-> Incomplete: ... + def __ge__(self, other: Incomplete)-> Incomplete: ... + def __getitem__(self, index: Incomplete) -> Incomplete: ... + def __gt__(self, other: Incomplete)-> Incomplete: ... def __hash__(self) -> int: ... + def __le__(self, other: object) -> bool: ... def __len__(self) -> int: ... + def __lt__(self, other: object) -> bool: ... + def __ne__(self, other: object) -> bool: ... class UnaryExpr(GenExpr): - def __init__(self, *args, **kwargs) -> None: ... + def __init__(self, *args: Incomplete, **kwargs: Incomplete) -> None: ... +@disjoint_base class VarExpr(GenExpr): var: Incomplete - def __init__(self, *args, **kwargs) -> None: ... + def __init__(self, *args: Incomplete, **kwargs: Incomplete) -> None: ... +@disjoint_base class Variable(Expr): data: Incomplete name: Incomplete - def __init__(self, *args, **kwargs) -> None: ... - def getAvgSol(self, *args, **kwargs): ... - def getCol(self, *args, **kwargs): ... - def getImplType(self, *args, **kwargs): ... - def getIndex(self, *args, **kwargs): ... - def getLPSol(self, *args, **kwargs): ... - def getLbGlobal(self, *args, **kwargs): ... - def getLbLocal(self, *args, **kwargs): ... - def getLbOriginal(self, *args, **kwargs): ... - def getNBranchings(self, *args, **kwargs): ... - def getNBranchingsCurrentRun(self, *args, **kwargs): ... - def getNLocksDown(self, *args, **kwargs): ... - def getNLocksDownType(self, *args, **kwargs): ... - def getNLocksUp(self, *args, **kwargs): ... - def getNLocksUpType(self, *args, **kwargs): ... - def getObj(self, *args, **kwargs): ... - def getStatus(self, *args, **kwargs): ... - def getUbGlobal(self, *args, **kwargs): ... - def getUbLocal(self, *args, **kwargs): ... - def getUbOriginal(self, *args, **kwargs): ... - def isActive(self, *args, **kwargs): ... - def isBinary(self, *args, **kwargs): ... - def isDeletable(self, *args, **kwargs): ... - def isImpliedIntegral(self, *args, **kwargs): ... - def isInLP(self, *args, **kwargs): ... - def isIntegral(self, *args, **kwargs): ... - def isNonImpliedIntegral(self, *args, **kwargs): ... - def isOriginal(self, *args, **kwargs): ... - def isRelaxationOnly(self, *args, **kwargs): ... - def markRelaxationOnly(self, *args, **kwargs): ... - def ptr(self, *args, **kwargs): ... - def varMayRound(self, *args, **kwargs): ... - def vtype(self, *args, **kwargs): ... - -class _VarArray: - def __init__(self, *args, **kwargs) -> None: ... + def __init__(self, *args: Incomplete, **kwargs: Incomplete) -> None: ... + def getAvgSol(self) -> Incomplete: ... + def getCol(self) -> Incomplete: ... + def getImplType(self) -> Incomplete: ... + def getIndex(self) -> Incomplete: ... + def getLPSol(self) -> Incomplete: ... + def getLbGlobal(self) -> Incomplete: ... + def getLbLocal(self) -> Incomplete: ... + def getLbOriginal(self) -> Incomplete: ... + def getNBranchings(self, branchdir: Incomplete) -> Incomplete: ... + def getNBranchingsCurrentRun(self, branchdir: Incomplete) -> Incomplete: ... + def getNLocksDown(self) -> Incomplete: ... + def getNLocksDownType(self, locktype: Incomplete) -> Incomplete: ... + def getNLocksUp(self) -> Incomplete: ... + def getNLocksUpType(self, locktype: Incomplete) -> Incomplete: ... + def getObj(self) -> Incomplete: ... + def getStatus(self) -> Incomplete: ... + def getUbGlobal(self) -> Incomplete: ... + def getUbLocal(self) -> Incomplete: ... + def getUbOriginal(self) -> Incomplete: ... + def isActive(self) -> Incomplete: ... + def isBinary(self) -> Incomplete: ... + def isDeletable(self) -> Incomplete: ... + def isImpliedIntegral(self) -> Incomplete: ... + def isInLP(self) -> Incomplete: ... + def isIntegral(self) -> Incomplete: ... + def isNonImpliedIntegral(self) -> Incomplete: ... + def isOriginal(self) -> Incomplete: ... + def isRelaxationOnly(self) -> Incomplete: ... + def markRelaxationOnly(self) -> Incomplete: ... + def ptr(self) -> Incomplete: ... + def varMayRound(self, direction: Incomplete = ...) -> Incomplete: ... + def vtype(self) -> Incomplete: ... diff --git a/stubs/allowlist b/stubs/allowlist new file mode 100644 index 000000000..16b3ad843 --- /dev/null +++ b/stubs/allowlist @@ -0,0 +1,4 @@ +.*.__reduce_cython__ +.*.__setstate_cython__ +pyscipopt.scip.__test__ +pyscipopt._version.__conditional_annotations__ diff --git a/stubs/test.sh b/stubs/test.sh new file mode 100755 index 000000000..e35305576 --- /dev/null +++ b/stubs/test.sh @@ -0,0 +1,10 @@ +#!/bin/bash -e + +# Test the stubs for pyscipopt using stubtest +# This checks that the type hints in the stubs are consistent with the actual implementation +# Prerequisite: install mypy (which provides stubtest) in the same environment as pyscipopt +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +python -m mypy.stubtest \ + --allowlist "$SCRIPT_DIR/allowlist" \ + --allowlist "$SCRIPT_DIR/todo" \ + pyscipopt diff --git a/stubs/todo b/stubs/todo new file mode 100644 index 000000000..2187481cc --- /dev/null +++ b/stubs/todo @@ -0,0 +1,3 @@ +pyscipopt.recipes.primal_dual_evolution.GapEventhdlr@14 +pyscipopt.scip.Statistics.__init__ +pyscipopt.scip.Statistics.__match_args__ diff --git a/tests/test_iis.py b/tests/test_iis.py index 2538c44ba..c48326509 100644 --- a/tests/test_iis.py +++ b/tests/test_iis.py @@ -76,9 +76,7 @@ def test_iisGreddyMakeIrreducible(): m.includeIISfinder(my_iis, "", "", priority=10000) iis = m.generateIIS() - with pytest.raises(AssertionError): - assert not iis.isSubscipIrreducible() # this should not fail - + assert not iis.isSubscipIrreducible() assert iis.isSubscipInfeasible() iis.greedyMakeIrreducible() diff --git a/tests/test_matrix_variable.py b/tests/test_matrix_variable.py index 27f549000..e4758f077 100644 --- a/tests/test_matrix_variable.py +++ b/tests/test_matrix_variable.py @@ -19,7 +19,7 @@ sin, sqrt, ) -from pyscipopt.scip import GenExpr +from pyscipopt.scip import CONST, GenExpr def test_catching_errors(): @@ -181,7 +181,30 @@ def test_expr_from_matrix_vars(): for term, coeff in expr_list: assert len(term) == 3 -def test_matrix_sum_argument(): + +def test_matrix_sum_error(): + m = Model() + x = m.addMatrixVar((2, 3), "x", "I", ub=4) + + # test axis type + with pytest.raises(TypeError): + x.sum("0") + + # test axis value (out of range) + with pytest.raises(ValueError): + x.sum(2) + + # test axis value (out of range) + with pytest.raises(ValueError): + x.sum((-3,)) + + # test axis value (duplicate) + with pytest.raises(ValueError): + x.sum((0, 0)) + + +def test_matrix_sum_axis(): + # compare the result of summing matrix variable after optimization m = Model() # Return a array when axis isn't None @@ -190,7 +213,8 @@ def test_matrix_sum_argument(): # compare the result of summing 2d array to a scalar with a scalar x = m.addMatrixVar((2, 3), "x", "I", ub=4) - m.addMatrixCons(x.sum() == 24) + # `axis=tuple(range(x.ndim))` is `axis=None` + m.addMatrixCons(x.sum(axis=tuple(range(x.ndim))) == 24) # compare the result of summing 2d array to 1d array y = m.addMatrixVar((2, 4), "y", "I", ub=4) @@ -198,21 +222,43 @@ def test_matrix_sum_argument(): # compare the result of summing 3d array to a 2d array with a 2d array z = m.addMatrixVar((2, 3, 4), "z", "I", ub=4) - m.addMatrixCons(z.sum(axis=2) == x) + m.addMatrixCons(z.sum(2) == x) m.addMatrixCons(z.sum(axis=1) == y) # to fix the element values m.addMatrixCons(z == np.ones((2, 3, 4))) - m.setObjective(x.sum() + y.sum() + z.sum(), "maximize") + m.setObjective(x.sum() + y.sum() + z.sum(tuple(range(z.ndim))), "maximize") m.optimize() assert (m.getVal(x) == np.full((2, 3), 4)).all().all() assert (m.getVal(y) == np.full((2, 4), 3)).all().all() -@pytest.mark.parametrize("n", [50, 100, 200]) -def test_sum_performance(n): +@pytest.mark.parametrize( + "axis, keepdims", + [ + (0, False), + (0, True), + (1, False), + (1, True), + ((0, 2), False), + ((0, 2), True), + ], +) +def test_matrix_sum_result(axis, keepdims): + # directly compare the result of np.sum and MatrixExpr.sum + _getVal = np.vectorize(lambda e: e.terms[CONST]) + a = np.arange(6).reshape((1, 2, 3)) + + np_res = a.sum(axis, keepdims=keepdims) + scip_res = MatrixExpr.sum(a, axis, keepdims=keepdims) + assert (np_res == _getVal(scip_res)).all() + assert np_res.shape == _getVal(scip_res).shape + + +@pytest.mark.parametrize("n", [50, 100]) +def test_matrix_sum_axis_is_none_performance(n): model = Model() x = model.addMatrixVar((n, n)) @@ -229,6 +275,24 @@ def test_sum_performance(n): assert model.isGT(end_orig - start_orig, end_matrix - start_matrix) +@pytest.mark.parametrize("n", [50, 100]) +def test_matrix_sum_axis_not_none_performance(n): + model = Model() + x = model.addMatrixVar((n, n)) + + # Original sum via `np.ndarray.sum`, `np.sum` will call subclass method + start_orig = time() + np.ndarray.sum(x, axis=0) + end_orig = time() + + # Optimized sum via `quicksum` + start_matrix = time() + x.sum(axis=0) + end_matrix = time() + + assert model.isGT(end_orig - start_orig, end_matrix - start_matrix) + + def test_add_cons_matrixVar(): m = Model() matrix_variable = m.addMatrixVar(shape=(3, 3), vtype="B", name="A", obj=1) @@ -521,6 +585,14 @@ def test_matrix_matmul_return_type(): assert type(y @ z) is MatrixExpr +def test_matrix_sum_return_type(): + # test #1117, require returning type is MatrixExpr not MatrixVariable + m = Model() + + x = m.addMatrixVar((3, 2)) + assert type(x.sum(axis=1)) is MatrixExpr + + def test_broadcast(): # test #1065 m = Model()