# Copyright 2018/2019 The RLgraph authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================

from __future__ import absolute_import, division, print_function

from rlgraph.components.loss_functions.loss_function import LossFunction
from rlgraph.components.loss_functions.actor_critic_loss_function import ActorCriticLossFunction
from rlgraph.components.loss_functions.categorical_cross_entropy_loss import CategoricalCrossEntropyLoss
from rlgraph.components.loss_functions.container_loss_function import ContainerLossFunction
from rlgraph.components.loss_functions.dqn_loss_function import DQNLossFunction
from rlgraph.components.loss_functions.dqfd_loss_function import DQFDLossFunction
from rlgraph.components.loss_functions.euclidian_distance_loss import EuclidianDistanceLoss
from rlgraph.components.loss_functions.impala_loss_function import IMPALALossFunction
from rlgraph.components.loss_functions.neg_log_likelihood_loss import NegativeLogLikelihoodLoss
from rlgraph.components.loss_functions.ppo_loss_function import PPOLossFunction
from rlgraph.components.loss_functions.sac_loss_function import SACLossFunction

LossFunction.__lookup_classes__ = dict(
    actorcriticlossfunction=ActorCriticLossFunction,
    categoricalcrossentropy=CategoricalCrossEntropyLoss,
    categoricalcrossentropyloss=CategoricalCrossEntropyLoss,
    containerloss=ContainerLossFunction,
    dqnlossfunction=DQNLossFunction,
    dqfdlossfunction=DQFDLossFunction,
    euclidiandistance=EuclidianDistanceLoss,
    euclidiandistanceloss=EuclidianDistanceLoss,
    impalalossfunction=IMPALALossFunction,
    negativeloglikelihoodloss=NegativeLogLikelihoodLoss,
    negativeloglikelihood=NegativeLogLikelihoodLoss,
    negloglikelihoodloss=NegativeLogLikelihoodLoss,
    negloglikelihood=NegativeLogLikelihoodLoss,
    ppolossfunction=PPOLossFunction,
    saclossfunction=SACLossFunction
)

__all__ = ["LossFunction"] + \
          list(set(map(lambda x: x.__name__, LossFunction.__lookup_classes__.values())))

