Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem-specific certificates #118

Open
wants to merge 6 commits into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
25 changes: 8 additions & 17 deletions inflation/lp/InflationLP.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,8 +490,7 @@ def set_extra_inequalities(self,
for ineq in extra_inequalities]

def solve(self,
relax_known_vars: bool = False,
relax_inequalities: bool = False,
relaxation: bool = False,
solve_dual: bool = True,
solverparameters: dict = None,
verbose: int = None,
Expand All @@ -503,12 +502,7 @@ def solve(self,

Parameters
----------
relax_known_vars : bool, optional
Do feasibility as optimization where each known value equality
becomes two relaxed inequality constraints. E.g., P(A) = 0.7
becomes P(A) + lambda >= 0.7 and P(A) - lambda <= 0.7, where lambda
is a slack variable. By default, ``False``.
relax_inequalities : bool, optional
relaxation : bool, optional
Do feasibility as optimization where each inequality is relaxed by
the non-negative slack variable lambda. By default, ``False``.
solve_dual : bool, optional
Expand All @@ -524,13 +518,11 @@ def solve(self,
given by ``_prepare_solver_arguments()``. However, a user may
manually override these arguments by passing their own here.
"""
if (relax_known_vars or relax_inequalities) and \
len(self.objective) > 0:
if relaxation and len(self.objective) > 0:
warn("You have a non-trivial objective, but set to solve a "
"feasibility problem as optimization. Setting "
"relax_known_vars=False, relax_inequalities=False, and "
"optimizing the objective...")
relax_known_vars = relax_inequalities = False
"relaxation=False and optimizing the objective...")
relaxation = False
if verbose is None:
real_verbose = self.verbose
else:
Expand All @@ -545,15 +537,14 @@ def solve(self,
# Still allow for 'feas_as_optim' as an argument
if 'feas_as_optim' in solver_arguments:
if solver_arguments["feas_as_optim"]:
relax_known_vars = relax_inequalities = True
relaxation = True
del solver_arguments["feas_as_optim"]
else:
relax_known_vars = relax_inequalities = False
relaxation = False
del solver_arguments["feas_as_optim"]
args.update(solver_arguments)

args.update({"relax_known_vars": relax_known_vars,
"relax_inequalities": relax_inequalities,
args.update({"relaxation": relaxation,
"verbose": real_verbose,
"default_non_negative": real_default_non_negative,
"solverparameters": solverparameters,
Expand Down