Package cplex :: Package _internal :: Module _subinterfaces :: Class FeasoptInterface
 

Class FeasoptInterface


Finds a minimal relaxation of the problem that is feasible.

This is a callable class. To find a feasible relaxation of a problem, invoke the __call__ method of this class.

Instance Methods
 
all_constraints(self)
Returns an object instructing feasopt to relax all constraints.
 
upper_bound_constraints(self, *args)
Returns an object instructing feasopt to relax all upper bounds.
 
lower_bound_constraints(self, *args)
Returns an object instructing feasopt to relax all lower bounds.
 
linear_constraints(self, *args)
Returns an object instructing feasopt to relax all linear constraints.
 
quadratic_constraints(self, *args)
Returns an object instructing feasopt to relax all quadratic constraints.
 
indicator_constraints(self, *args)
Returns an object instructing feasopt to relax all indicator constraints.
 
__call__(self, *args)
Finds a minimal relaxation of the problem that is feasible.

Inherited from _baseinterface.BaseInterface: __init__, get_indices

Class Variables
  constraint_type = FeasoptConstraintType()
See FeasoptConstraintType()
Method Details

all_constraints(self)

 

Returns an object instructing feasopt to relax all constraints.

Calling Cplex.feasopt(Cplex.feasopt.all_constraints()) will result in every constraint being relaxed independently with equal weight.

See also the __call__ method of this class.

Example usage:

>>> import cplex
>>> c = cplex.Cplex()
>>> group = c.feasopt.all_constraints()

upper_bound_constraints(self, *args)

 

Returns an object instructing feasopt to relax all upper bounds.

If called with no arguments, every upper bound is assigned weight 1.0.

If called with one or more arguments, every upper bound is assigned a weight equal to the float passed in as the first argument.

If additional arguments are specified, they determine a subset of upper bounds to be relaxed. If one variable index or name is specified, it is the only upper bound that can be relaxed. If two variable indices or names are specified, then upper bounds of all variables between the first and the second, inclusive, can be relaxed. If a sequence of variable names or indices is passed in, all of their upper bounds can be relaxed.

See also the __call__ method of this class.

Example usage:

>>> import cplex
>>> c = cplex.Cplex()
>>> group = c.feasopt.upper_bound_constraints()

lower_bound_constraints(self, *args)

 

Returns an object instructing feasopt to relax all lower bounds.

If called with no arguments, every lower bound is assigned weight 1.0.

If called with one or more arguments, every lower bound is assigned a weight equal to the float passed in as the first argument.

If additional arguments are specified, they determine a subset of lower bounds to be relaxed. If one variable index or name is specified, it is the only lower bound that can be relaxed. If two variable indices or names are specified, then lower bounds of all variables between the first and the second, inclusive, can be relaxed. If a sequence of variable names or indices is passed in, all of their lower bounds can be relaxed.

See also the __call__ method of this class.

Example usage:

>>> import cplex
>>> c = cplex.Cplex()
>>> group = c.feasopt.lower_bound_constraints()

linear_constraints(self, *args)

 

Returns an object instructing feasopt to relax all linear constraints.

If called with no arguments, every linear constraint is assigned weight 1.0.

If called with one or more arguments, every linear constraint is assigned a weight equal to the float passed in as the first argument.

If additional arguments are specified, they determine a subset of linear constraints to be relaxed. If one linear constraint index or name is specified, it is the only linear constraint that can be relaxed. If two linear constraint indices or names are specified, then all linear constraints between the first and the second, inclusive, can be relaxed. If a sequence of linear constraint names or indices is passed in, all of their linear constraints can be relaxed.

See also the __call__ method of this class.

Example usage:

>>> import cplex
>>> c = cplex.Cplex()
>>> group = c.feasopt.linear_constraints()

quadratic_constraints(self, *args)

 

Returns an object instructing feasopt to relax all quadratic constraints.

If called with no arguments, every quadratic constraint is assigned weight 1.0.

If called with one or more arguments, every quadratic constraint is assigned a weight equal to the float passed in as the first argument.

If additional arguments are specified, they determine a subset of quadratic constraints to be relaxed. If one quadratic constraint index or name is specified, it is the only quadratic constraint that can be relaxed. If two quadratic constraint indices or names are specified, then all quadratic constraints between the first and the second, inclusive, can be relaxed. If a sequence of quadratic constraint names or indices is passed in, all of their quadratic constraints can be relaxed.

Example usage:

>>> import cplex
>>> c = cplex.Cplex()
>>> group = c.feasopt.quadratic_constraints()

indicator_constraints(self, *args)

 

Returns an object instructing feasopt to relax all indicator constraints.

If called with no arguments, every indicator constraint is assigned weight 1.0.

If called with one or more arguments, every indicator constraint is assigned a weight equal to the float passed in as the first argument.

If additional arguments are specified, they determine a subset of indicator constraints to be relaxed. If one indicator constraint index or name is specified, it is the only indicator constraint that can be relaxed. If two indicator constraint indices or names are specified, then all indicator constraints between the first and the second, inclusive, can be relaxed. If a sequence of indicator constraint names or indices is passed in, all of their indicator constraints can be relaxed.

See also the __call__ method of this class.

Example usage:

>>> import cplex
>>> c = cplex.Cplex()
>>> group = c.feasopt.indicator_constraints()

__call__(self, *args)
(Call operator)

 

Finds a minimal relaxation of the problem that is feasible.

This method can take arbitrarily many arguments. Either the object returned by feasopt.all_constraints() or any combination of constraint groups and objects returned by upper_bound_constraints(), lower_bound_constraints(), linear_constraints(), quadratic_constraints(), or indicator_constraints() may be used to specify the constraints to consider.

Constraint groups are sequences of length two, the first entry of which is the preference for the group (a float), the second of which is a sequence of pairs (type, id), where type is an attribute of self.constraint_type and id is either an index or a valid name for the type.

See CPXfeasoptext in the Callable Library Reference Manual.

Example usage:

>>> import cplex
>>> c = cplex.Cplex()
>>> out = c.set_results_stream(None)
>>> out = c.set_log_stream(None)
>>> c.read("infeasible.lp")
>>> c.feasopt(c.feasopt.all_constraints())
>>> c.solution.get_objective_value()
2.0
>>> c.solution.get_values()
[3.0, 2.0, 3.0, 2.0]