tf.contrib.constrained_optimization.ConstrainedOptimizer

View source on GitHub

Base class representing a constrained optimizer.

A ConstrainedOptimizer wraps a tf.compat.v1.train.Optimizer (or more than one), and applies it to a ConstrainedMinimizationProblem. Unlike a tf.compat.v1.train.Optimizer, which takes a tensor to minimize as a parameter to its minimize() method, a constrained optimizer instead takes a ConstrainedMinimizationProblem.

optimizer tf.compat.v1.train.Optimizer, used to optimize the ConstraintedMinimizationProblem.

optimizer Returns the tf.compat.v1.train.Optimizer used for optimization.

Methods

minimize

View source

Returns an Operation for minimizing the constrained problem.

This method combines the functionality of minimize_unconstrained and minimize_constrained. If global_step < unconstrained_steps, it will perform an unconstrained update, and if global_step >= unconstrained_steps, it will perform a constrained update.

The reason for this functionality is that it may be best to initialize the constrained optimizer with an approximate optimum of the unconstrained problem.

Args
minimization_problem ConstrainedMinimizationProblem, the problem to optimize.
unconstrained_steps int, number of steps for which we should perform unconstrained updates, before transitioning to constrained updates.
global_step as in tf.compat.v1.train.Optimizer's minimize method.
var_list as in tf.compat.v1.train.Optimizer's minimize method.
gate_gradients as in tf.compat.v1.train.Optimizer's minimize method.
aggregation_method as in tf.compat.v1.train.Optimizer's minimize method.
colocate_gradients_with_ops as in tf.compat.v1.train.Optimizer's minimize method.
name as in tf.compat.v1.train.Optimizer's minimize method.
grad_loss as in tf.compat.v1.train.Optimizer's minimize method.

Returns
Operation, the train_op.

Raises
ValueError If unconstrained_steps is provided, but global_step is not.

minimize_constrained

View source

Returns an Operation for minimizing the constrained problem.

Unlike minimize_unconstrained, this function attempts to find a solution that minimizes the objective portion of the minimization problem while satisfying the constraints portion.

Args
minimization_problem ConstrainedMinimizationProblem, the problem to optimize.
global_step as in tf.compat.v1.train.Optimizer's minimize method.
var_list as in tf.compat.v1.train.Optimizer's minimize method.
gate_gradients as in tf.compat.v1.train.Optimizer's minimize method.
aggregation_method as in tf.compat.v1.train.Optimizer's minimize method.
colocate_gradients_with_ops as in tf.compat.v1.train.Optimizer's minimize method.
name as in tf.compat.v1.train.Optimizer's minimize method.
grad_loss as in tf.compat.v1.train.Optimizer's minimize method.

Returns
Operation, the train_op.

minimize_unconstrained

View source

Returns an Operation for minimizing the unconstrained problem.

Unlike minimize_constrained, this function ignores the constraints (and proxy_constraints) portion of the minimization problem entirely, and only minimizes objective.

Args
minimization_problem ConstrainedMinimizationProblem, the problem to optimize.
global_step as in tf.compat.v1.train.Optimizer's minimize method.
var_list as in tf.compat.v1.train.Optimizer's minimize method.
gate_gradients as in tf.compat.v1.train.Optimizer's minimize method.
aggregation_method as in tf.compat.v1.train.Optimizer's minimize method.
colocate_gradients_with_ops as in tf.compat.v1.train.Optimizer's minimize method.
name as in tf.compat.v1.train.Optimizer's minimize method.
grad_loss as in tf.compat.v1.train.Optimizer's minimize method.

Returns
Operation, the train_op.