Coverage for picos/__init__.py: 100.00%

25 statements  

« prev     ^ index     » next       coverage.py v6.5.0, created at 2023-03-26 07:46 +0000

1# ------------------------------------------------------------------------------ 

2# Copyright (C) 2012-2017 Guillaume Sagnol 

3# Copyright (C) 2018-2019 Maximilian Stahlberg 

4# 

5# This file is part of PICOS. 

6# 

7# PICOS is free software: you can redistribute it and/or modify it under the 

8# terms of the GNU General Public License as published by the Free Software 

9# Foundation, either version 3 of the License, or (at your option) any later 

10# version. 

11# 

12# PICOS is distributed in the hope that it will be useful, but WITHOUT ANY 

13# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 

14# A PARTICULAR PURPOSE. See the GNU General Public License for more details. 

15# 

16# You should have received a copy of the GNU General Public License along with 

17# this program. If not, see <http://www.gnu.org/licenses/>. 

18# ------------------------------------------------------------------------------ 

19 

20"""A Python Interface to Conic Optimization Solvers. 

21 

22The :mod:`picos` namespace gives you quick access to the most important classes 

23and functions for optimizing with PICOS, so that ``import picos`` is often 

24sufficient for implementing your model. 

25""" 

26 

27from pathlib import Path 

28 

29from .apidoc import api_start, api_end 

30 

31 

32with (Path(__file__).parent / ".version").open() as versionFile: 

33 __version_info__ = tuple( 

34 int(x) for x in versionFile.read().strip().split(".")) 

35 

36__version__ = ".".join(str(x) for x in __version_info__) 

37 

38 

39_API_START = api_start(globals()) 

40# ------------------------------- 

41 

42# Namespaces. 

43from . import settings, uncertain # noqa 

44 

45# Character set changes. 

46from .glyphs import ascii, latin1, unicode, default as default_charset # noqa 

47 

48# Model setup. 

49from .modeling import (find_assignment, maximize, minimize, Objective, # noqa 

50 Options, Problem, Solution) 

51 

52# Constants. 

53from .expressions import Constant # noqa 

54 

55# Variables. 

56from .expressions.variables import ( # noqa 

57 BinaryVariable, ComplexVariable, HermitianVariable, IntegerVariable, 

58 LowerTriangularVariable, RealVariable, SkewSymmetricVariable, 

59 SymmetricVariable, UpperTriangularVariable) 

60 

61# Cones. 

62from .expressions import ( # noqa 

63 ExponentialCone, NonnegativeOrthant, PositiveSemidefiniteCone, ProductCone, 

64 RotatedSecondOrderCone, SecondOrderCone, ZeroSpace, TheField) 

65 

66# Other sets. 

67from .expressions import Ball, Ellipsoid, Simplex # noqa 

68 

69# Algebraic function-like classes. 

70from .constraints import FlowConstraint # noqa 

71from .expressions import ( # noqa 

72 DetRootN, Entropy, GeometricMean, Logarithm, LogSumExp, 

73 NegativeEntropy, Norm, SpectralNorm, SquaredNorm, NuclearNorm, PowerTrace, 

74 SumExtremes, SumExponentials) 

75 

76# Algebraic functions, including legacy ones. 

77from .expressions.algebra import * # noqa 

78 

79# Utilities. 

80from .expressions.data import value # noqa 

81from .expressions.samples import Samples # noqa 

82from .solvers import available_solvers # noqa 

83 

84# Non-algebraic legacy imports. 

85from .modeling.file_in import import_cbf # noqa 

86 

87# Exceptions. 

88from .modeling import SolutionFailure # noqa 

89from .expressions import NotValued # noqa 

90 

91# Allow users to work around https://github.com/scipy/scipy/issues/4819. 

92from .valuable import patch_scipy_array_priority # noqa 

93 

94# -------------------------------------- 

95__all__ = api_end(_API_START, globals())