Ticket #15194: exception_imports.patch

File exception_imports.patch, 1.8 KB (added by dimpase, 8 years ago)

the straightforward patch

  • sage/coding/delsarte_bounds.py

    # HG changeset patch
    # User Dmitrii Pasechnik <dimpase@gmail.com>
    # Date 1379091707 -28800
    # Node ID 5a3ea49447bdd6c572a23418916c5459cb582ca4
    # Parent  7f0b4d66a9ccf7c467dcc550baed9e4e88b4233b
    added imports and doctests for MIPSolver exceptions
    
    diff --git a/sage/coding/delsarte_bounds.py b/sage/coding/delsarte_bounds.py
    a b  
    155155       sage: delsarte_bound_hamming_space(11,3,4)
    156156       327680/3
    157157
     158    Such an input is invalid::
     159
     160       sage: delsarte_bound_hamming_space(11,3,-4)
     161       Solver exception:  'PPL : There is no feasible solution' ()
     162       False
     163
    158164    REFERENCES:
    159165
    160166    .. [1] P. Delsarte, An algebraic approach to the association schemes of coding theory,
     
    163169
    164170
    165171    """
     172    from sage.numerical.mip import MIPSolverException
    166173    A, p = _delsarte_LP_building(n, d, 0, q, isinteger,  solver)
    167174    try:
    168175        bd=p.solve()
    169     except sage.numerical.mip.MIPSolverException, exc:
     176    except MIPSolverException, exc:
    170177        print "Solver exception: ", exc, exc.args
    171178        if return_data:
    172179            return A,p,False
     
    235242       sage: delsarte_bound_additive_hamming_space(11,3,4,q_base=2)
    236243       16
    237244
     245   Such a d_star is not possible::
     246
     247       sage: delsarte_bound_additive_hamming_space(11,3,4,d_star=9)
     248       Solver exception:  'PPL : There is no feasible solution' ()
     249       False
     250
    238251   """
     252   from sage.numerical.mip import MIPSolverException
    239253   if q_base == 0:
    240254      q_base = q
    241255
     
    260274      A, p = _delsarte_LP_building(n, d, d_star, q, isinteger,  solver, q_base**m)
    261275      try:
    262276        bd=p.solve()
    263       except sage.numerical.mip.MIPSolverException, exc:
     277      except MIPSolverException, exc:
    264278        print "Solver exception: ", exc, exc.args
    265279        if return_data:
    266280           return A,p,False