Package cplex :: Package _internal :: Module _subinterfaces :: Class SensitivityInterface
[frames] | no frames]
 

Class SensitivityInterface


Methods for sensitivity analysis.
Instance Methods
 
__init__(self, parent)
Creates a new SensitivityInterface.
 
lower_bounds(self, *args)
Returns the sensitivity of a set of lower bounds.
 
upper_bounds(self, *args)
Returns the sensitivity of a set of upper bounds.
 
bounds(self, *args)
Returns the sensitivity of a set of both lower and upper bounds.
 
objective(self, *args)
Returns the sensitivity of part of the objective function.
 
rhs(self, *args)
Returns the sensitivity of the righthand side of a set of linear constraints.

Inherited from _baseinterface.BaseInterface: get_indices

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties

Inherited from object: __class__

Method Details

__init__(self, parent)
(Constructor)

 

Creates a new SensitivityInterface.

The sensitivity interface is exposed by the top-level Cplex class as Cplex.solution.sensitivity. This constructor is not meant to be used externally.

Overrides: object.__init__

lower_bounds(self, *args)

 

Returns the sensitivity of a set of lower bounds.

Can be called by four forms.

>>> import cplex
>>> c = cplex.Cplex()
>>> out = c.set_results_stream(None)
>>> out = c.set_log_stream(None)
>>> c.read("example.mps")
>>> c.solve()
>>> c.solution.sensitivity.lower_bounds(1)
(-1e+20, 17.5)
>>> c.solution.sensitivity.lower_bounds('x3')
(-1e+20, 42.5)
>>> c.solution.sensitivity.lower_bounds(["x3", 0])
[(-1e+20, 42.5), (-1e+20, 40.0)]
>>> c.solution.sensitivity.lower_bounds()
[(-1e+20, 40.0), (-1e+20, 17.5), (-1e+20, 42.5), (-1e+20, 0.625)]

upper_bounds(self, *args)

 

Returns the sensitivity of a set of upper bounds.

Can be called by four forms.

>>> import cplex
>>> c = cplex.Cplex()
>>> out = c.set_results_stream(None)
>>> out = c.set_log_stream(None)
>>> c.read("example.mps")
>>> c.solve()
>>> c.solution.sensitivity.upper_bounds(1)
(17.5, 1e+20)
>>> c.solution.sensitivity.upper_bounds("x3")
(42.5, 1e+20)
>>> bupper = c.solution.sensitivity.upper_bounds(["x3", 0])
>>> for i, j in zip(bupper, [(42.5, 1e+20), (36.428571, 155.0)]):
...     abs(i[0] - j[0]) < 1e-6 and abs(i[1]- j[1]) < 1e-6
...
True
True
>>> bupper = c.solution.sensitivity.upper_bounds()
>>> for i, j in zip(bupper[3], (0.625, 1e+20)):
...     abs(i - j) < 1e-6
...
True
True

bounds(self, *args)

 

Returns the sensitivity of a set of both lower and upper bounds.

Can be called by four forms.

>>> import cplex
>>> c = cplex.Cplex()
>>> out = c.set_results_stream(None)
>>> out = c.set_log_stream(None)
>>> c.read("example.mps")
>>> c.solve()
>>> c.solution.sensitivity.bounds(1)
(-1e+20, 17.5, 17.5, 1e+20)
>>> c.solution.sensitivity.bounds("x3")
(-1e+20, 42.5, 42.5, 1e+20)
>>> c.solution.sensitivity.bounds(["x3", 1])
[(-1e+20, 42.5, 42.5, 1e+20), (-1e+20, 17.5, 17.5, 1e+20)]
>>> bd = c.solution.sensitivity.bounds()
>>> bd[1]
(-1e+20, 17.5, 17.5, 1e+20)

objective(self, *args)

 

Returns the sensitivity of part of the objective function.

Can be called by four forms.

>>> import cplex
>>> c = cplex.Cplex()
>>> out = c.set_results_stream(None)
>>> out = c.set_log_stream(None)
>>> c.read("example.mps")
>>> c.solve()
>>> c.solution.sensitivity.objective(1)
(-3.0, 5.0)
>>> c.solution.sensitivity.objective("x3")
(-1e+20, -2.0)
>>> c.solution.sensitivity.objective(["x3", 1])
[(-1e+20, -2.0), (-3.0, 5.0)]
>>> c.solution.sensitivity.objective()
[(-1e+20, 2.5), (-3.0, 5.0), (-1e+20, -2.0), (0.0, 4.0)]

rhs(self, *args)

 

Returns the sensitivity of the righthand side of a set of linear constraints.

Can be called by four forms.

>>> import cplex
>>> c = cplex.Cplex()
>>> out = c.set_results_stream(None)
>>> out = c.set_log_stream(None)
>>> c.read("example.mps")
>>> c.solve()
>>> rhssa = c.solution.sensitivity.rhs(1)
>>> for i, j in zip(rhssa, (20.0, 46.666666)):
...     abs(i - j) < 1e-6
...
True
True
>>> c.solution.sensitivity.rhs("c3")
(-1e+20, 112.5)
>>> rhssa = c.solution.sensitivity.rhs(["c3", 1])
>>> for i, j in zip(rhssa, [(-1e+20, 112.5), (20.0, 46.666666)]):
...     abs(i[0] - j[0]) < 1e-6 and abs(i[1]- j[1]) < 1e-6
...
True
True
>>> rhssa = c.solution.sensitivity.rhs()
>>> for i, j in zip(rhssa[3], (-1e+20, 42.5)):
...     abs(i - j) < 1e-6
...
True
True