class_docstr: Base class for test functions with constraints.
  
  In addition to one or more objectives, a problem may have a number of outcome
  constraints of the form `c_i(x) >= 0` for `i=1, ..., n_c`.
  
  This base class provides common functionality for such problems.
class_docstr_tok: ["Base","class","for","test","functions","with","constraints",".","In","addition","to","one","or","more","objectives",",","a","problem","may","have","a","number","of","outcome","constraints","of","the","form","`","c_i","(","x",")",">","=","0","`","for","`","i=1",",","...",",","n_c","`",".","This","base","class","provides","common","functionality","for","such","problems","."]
docstr: Evaluate the constraint slack on a set of points.
  
  Constraints `i` is assumed to be feasible at `x` if the associated slack
  `c_i(x)` is positive. Zero slack means that the constraint is active. Negative
  slack means that the constraint is violated.
  
  Args:
      X: A `batch_shape x d`-dim tensor of point(s) at which to evaluate the
          constraint slacks: `c_1(X), ...., c_{n_c}(X)`.
      noise: If `True`, add observation noise to the slack as specified by
          `noise_std`.
  
  Returns:
      A `batch_shape x n_c`-dim tensor of constraint slack (where positive slack
          corresponds to the constraint being feasible).
docstr_tok: ["Evaluate","the","constraint","slack","on","a","set","of","points",".","Constraints","`","i","`","is","assumed","to","be","feasible","at","`","x","`","if","the","associated","slack","`","c_i","(","x",")","`","is","positive",".","Zero","slack","means","that","the","constraint","is","active",".","Negative","slack","means","that","the","constraint","is","violated",".","Args",":","X",":","A","`","batch_shape","x","d","`","-dim","tensor","of","point","(","s",")","at","which","to","evaluate","the","constraint","slacks",":","`","c_1","(","X",")",",","....",",","c_","{","n_c","}","(","X",")","`",".","noise",":","If","`","True","`",",","add","observation","noise","to","the","slack","as","specified","by","`","noise_std","`",".","Returns",":","A","`","batch_shape","x","n_c","`","-dim","tensor","of","constraint","slack","(","where","positive","slack","corresponds","to","the","constraint","being","feasible",")","."]
code: def evaluate_slack(self, X: Tensor, noise: bool = True) -> Tensor:
      r"""Evaluate the constraint slack on a set of points.
  
      Constraints `i` is assumed to be feasible at `x` if the associated slack
      `c_i(x)` is positive. Zero slack means that the constraint is active. Negative
      slack means that the constraint is violated.
  
      Args:
          X: A `batch_shape x d`-dim tensor of point(s) at which to evaluate the
              constraint slacks: `c_1(X), ...., c_{n_c}(X)`.
          noise: If `True`, add observation noise to the slack as specified by
              `noise_std`.
  
      Returns:
          A `batch_shape x n_c`-dim tensor of constraint slack (where positive slack
              corresponds to the constraint being feasible).
      """
      cons = self.evaluate_slack_true(X=X)
      if noise and self.constraint_noise_std is not None:
          _constraint_noise = torch.tensor(
              self.constraint_noise_std, device=X.device, dtype=X.dtype
          )
          cons += _constraint_noise * torch.randn_like(cons)
      return cons
  
imports: from __future__ import annotations
  from abc import ABC, abstractmethod
  from typing import List, Tuple, Union
  import torch
  from botorch.exceptions.errors import InputDataError
  from torch import Tensor
  from torch.nn import Module
label_desc: Use image node_id 1 for calling the ConstrainedBaseTestProblem obj's underlying member method code with example usage: obj.evaluate_slack(X, noise) and returns: cons