Path: blob/main/src/utils/distribution/Distribution_Points.h
169678 views
/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2001-2025 German Aerospace Center (DLR) and others.3// This program and the accompanying materials are made available under the4// terms of the Eclipse Public License 2.0 which is available at5// https://www.eclipse.org/legal/epl-2.0/6// This Source Code may also be made available under the following Secondary7// Licenses when the conditions for such availability set forth in the Eclipse8// Public License 2.0 are satisfied: GNU General Public License, version 29// or later which is available at10// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html11// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later12/****************************************************************************/13/// @file Distribution_Points.h14/// @author Daniel Krajzewicz15/// @author Michael Behrisch16/// @date Sept 200217///18// The description of a distribution by a curve19/****************************************************************************/20#pragma once21#include <config.h>2223#include "RandomDistributor.h"24#include "Distribution.h"252627// ===========================================================================28// class definitions29// ===========================================================================30/**31* @class Distribution_Points32* A description of a distribution that uses a set of points in a 2d-space33* to describe the values (each points x-value) and their possibilities34* (each points y-value)35*/36class Distribution_Points :37public Distribution, public RandomDistributor<double> {38public:39/// Constructor40Distribution_Points(const std::string& id);4142/// Destructor43virtual ~Distribution_Points();4445/** @brief Draw a sample of the distribution.46*47* A random sample is drawn according to the assigned probabilities.48*49* @param[in] which The random number generator to use; the static one will be used if nullptr is passed50* @return the drawn member51*/52double sample(SumoRNG* which = nullptr) const {53return get(which);54}5556/// Returns the maximum value of this distribution57double getMax() const;5859/// Returns the string representation of this distribution60std::string toStr(std::streamsize accuracy) const;61};626364