Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
InteractiveLPBackend.objective_constant_term: New
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Koeppe committed Apr 12, 2016
1 parent b8ea5a2 commit d84b5bd
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/sage/numerical/backends/interactivelp_backend.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,32 @@ cdef class InteractiveLPBackend:
constraint_types, variable_types,
problem_type, ring, objective_constant_term=d)

cpdef objective_constant_term(self, d=None):
"""
Set or get the constant term in the objective function
INPUT:
- ``d`` (double) -- its coefficient. If `None` (default), return the current value.
EXAMPLE::
sage: from sage.numerical.backends.generic_backend import get_solver
sage: p = get_solver(solver = "InteractiveLP")
sage: p.objective_constant_term()
0
sage: p.objective_constant_term(42)
sage: p.objective_constant_term()
42
"""
if d is None:
return self.lp.objective_constant_term()
else:
A, b, c, x, constraint_types, variable_types, problem_type, ring, _ = self._AbcxCVPRd()
self.lp = InteractiveLPProblem(A, b, c, x,
constraint_types, variable_types,
problem_type, ring, objective_constant_term=d)

cpdef set_objective(self, list coeff, d = 0):
"""
Set the objective function.
Expand Down

0 comments on commit d84b5bd

Please sign in to comment.