5.3. 例外¶
- exception pysimple.SimpleError(msg: str)¶
ベースクラス:
Exception
数理最適化のモデリング特有の例外を表すクラスです.
サンプル
>>> ij = Element(value=[(1,3), (1,4), (2,3)], name='ij') >>> ij + 1 pysimple.error.SimpleError: dim of 'Element' must be 1 >>> i = Element(value=[1,2], name='i') >>> x = Variable(index=i, name='x') >>> x + 1 pysimple.error.SimpleError: Variable 'x' needs to be with index (no index given) >>> Sum(x[i], i) + i pysimple.error.SimpleError: illegal use of Element 'i' which has been operated already >>> Condition(ij, i>1) pysimple.error.SimpleError: illegal use of Element 'i' >>> p = Problem() >>> p += x[i] pysimple.error.SimpleError: objective cannot be defined with index >>> p += Sum(x[i]) >>> p += Sum(x[i]) pysimple.error.SimpleError: objective can only be assigned once >>> p += x[i] >= 1 >>> p += x[i] >= 1 pysimple.error.SimpleError: override constraint '(x[i]>=1)'