code: def linprog(c, A=None, b=None, A_eq=None, b_eq=None, bounds=None):
      """Return the minimization of ``c*x`` with the given
      constraints ``A*x <= b`` and ``A_eq*x = b_eq``. Unless bounds
      are given, variables will have nonnegative values in the solution.
  
      If ``A`` is not given, then the dimension of the system will
      be determined by the length of ``C``.
  
      By default, all variables will be nonnegative. If ``bounds``
      is given as a single tuple, ``(lo, hi)``, then all variables
      will be constrained to be between ``lo`` and ``hi``. Use
      None for a ``lo`` or ``hi`` if it is unconstrained in the
      negative or positive direction, respectively, e.g.
      ``(None, 0)`` indicates nonpositive values. To set
      individual ranges, pass a list with length equal to the
      number of columns in ``A``, each element being a tuple; if
      only a few variables take on non-default values they can be
      passed as a dictionary with keys giving the corresponding
      column to which the variable is assigned, e.g. ``bounds={2:
      (1, 4)}`` would limit the 3rd variable to have a value in
      range ``[1, 4]``.
  
      Examples
      ========
  
      >>> from sympy.solvers.simplex import linprog
      >>> from sympy import symbols, Eq, linear_eq_to_matrix as M, Matrix
      >>> x = x1, x2, x3, x4 = symbols('x1:5')
      >>> X = Matrix(x)
      >>> c, d = M(5*x2 + x3 + 4*x4 - x1, x)
      >>> a, b = M([5*x2 + 2*x3 + 5*x4 - (x1 + 5)], x)
      >>> aeq, beq = M([Eq(3*x2 + x4, 2), Eq(-x1 + x3 + 2*x4, 1)], x)
      >>> constr = [i <= j for i,j in zip(a*X, b)]
      >>> constr += [Eq(i, j) for i,j in zip(aeq*X, beq)]
      >>> linprog(c, a, b, aeq, beq)
      (9/2, [0, 1/2, 0, 1/2])
      >>> assert all(i.subs(dict(zip(x, _[1]))) for i in constr)
  
      See Also
      ========
      lpmin, lpmax
      """
  
      ## the objective
      C = Matrix(c)
      if C.rows != 1 and C.cols == 1:
          C = C.T
      if C.rows != 1:
          raise ValueError("C must be a single row.")
  
      ## the inequalities
      if not A:
          if b:
              raise ValueError("A and b must both be given")
          # the governing equations will be simple constraints
          # on variables
          A, b = zeros(0, C.cols), zeros(C.cols, 1)
      else:
          A, b = [Matrix(i) for i in (A, b)]
  
      if A.cols != C.cols:
          raise ValueError("number of columns in A and C must match")
  
      ## the equalities
      if A_eq is None:
          if not b_eq is None:
              raise ValueError("A_eq and b_eq must both be given")
      else:
          A_eq, b_eq = [Matrix(i) for i in (A_eq, b_eq)]
          # if x == y then x <= y and x >= y (-x <= -y)
          A = A.col_join(A_eq)
          A = A.col_join(-A_eq)
          b = b.col_join(b_eq)
          b = b.col_join(-b_eq)
  
      if not (bounds is None or bounds == {} or bounds == (0, None)):
          ## the bounds are interpreted
          if type(bounds) is tuple and len(bounds) == 2:
              bounds = [bounds] * A.cols
          elif len(bounds) == A.cols and all(
              type(i) is tuple and len(i) == 2 for i in bounds
          ):
              pass  # individual bounds
          elif type(bounds) is dict and all(
              type(i) is tuple and len(i) == 2 for i in bounds.values()
          ):
              # sparse bounds
              db = bounds
              bounds = [(0, None)] * A.cols
              while db:
                  i, j = db.popitem()
                  bounds[i] = j  # IndexError if out-of-bounds indices
          else:
              raise ValueError("unexpected bounds %s" % bounds)
          A_, b_ = _handle_bounds(bounds)
          aux = A_.cols - A.cols
          if A:
              A = Matrix([[A, zeros(A.rows, aux)], [A_]])
              b = b.col_join(b_)
          else:
              A = A_
              b = b_
          C = C.row_join(zeros(1, aux))
      else:
          aux = -A.cols  # set so -aux will give all cols below
  
      o, p, d = _simplex(A, b, C)
      return o, p[:-aux]
  
imports: from sympy.core import sympify
  from sympy.core.exprtools import factor_terms
  from sympy.core.relational import Le, Ge, Eq
  from sympy.core.singleton import S
  from sympy.core.symbol import Dummy
  from sympy.core.sorting import ordered
  from sympy.functions.elementary.complexes import sign
  from sympy.matrices.dense import Matrix, zeros
  from sympy.solvers.solveset import linear_eq_to_matrix
  from sympy.utilities.iterables import numbered_symbols
  from sympy.utilities.misc import filldedent
label_desc: Use image node_id 13 for calling a global function with example usage: linprog(c, A, b, A_eq, b_eq, bounds) and returns: o,  p