diff --git a/ReleaseNotes/06_15_2023.txt b/ReleaseNotes/06_15_2023.txt
new file mode 100644
index 000000000000..b0679986e05b
--- /dev/null
+++ b/ReleaseNotes/06_15_2023.txt
@@ -0,0 +1,35 @@
+
+Features:
+
+ - No-Claims Inventory Utility Expectation #1 (1, 2, 3)
+ - Indifference Reservation Pricing Run #1 (4, 5, 6)
+ - Bid/Ask Optimal Inventory Vertex (7, 8, 9)
+ - Indifference Reservation Pricing Run #2 (10)
+ - No-Claims Inventory Utility Expectation #2 (11, 12)
+ - Bid Claims Position Value Adjustment (13, 14)
+ - Ask Claims Position Value Adjustment (15, 16)
+ - Indifference Reservation Pricing Run #3 (17, 18)
+ - Utility Expectation Optimization Run Shell (19, 20, 21)
+ - Utility Expectation Optimization Run Value (22, 23)
+ - Utility Expectation Optimization Run Constructor (24, 25, 26)
+ - Utility Function Expectation Run #1 (27, 28)
+ - Utility Function Expectation Run #2 (29, 30)
+ - Utility Function Expectation Run #3 (31, 32)
+ - Utility Function Expectation Run #4 (33, 34)
+ - Utility Function Expectation Run #5 (35, 36)
+ - Utility Function Expectation Run #6 (37, 38)
+ - Claims Utility Expectation Inference Run #1 (39, 40, 41)
+ - Claims Utility Expectation Inference Run - Reservation Value (42, 43)
+ - Claims Utility Expectation Inference Run - Constructor (44, 45, 46)
+ - Claims Utility Expectation Inference Run #2 (47, 48, 49)
+ - Claims Utility Expectation Inference Run #3 (50, 51, 52)
+ - Claims Utility Expectation Inference Run #4 (53, 54)
+ - Claims Utility Expectation Inference Run #5 (55, 56, 57)
+ - Claims Utility Expectation Inference Run #6 (58, 59, 60)
+
+
+Bug Fixes/Re-organization:
+
+Samples:
+
+IdeaDRIP:
diff --git a/ScheduleSheet.xlsx b/ScheduleSheet.xlsx
index 98e1584568c4..32cf2a4702eb 100644
Binary files a/ScheduleSheet.xlsx and b/ScheduleSheet.xlsx differ
diff --git a/src/main/java/org/drip/oms/indifference/ClaimsUtilityExpectationInferenceRun.java b/src/main/java/org/drip/oms/indifference/ClaimsUtilityExpectationInferenceRun.java
new file mode 100644
index 000000000000..6607c3aa3ca8
--- /dev/null
+++ b/src/main/java/org/drip/oms/indifference/ClaimsUtilityExpectationInferenceRun.java
@@ -0,0 +1,152 @@
+
+package org.drip.oms.indifference;
+
+import org.drip.numerical.common.NumberUtil;
+
+/*
+ * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ */
+
+/*!
+ * Copyright (C) 2024 Lakshmi Krishnamurthy
+ *
+ * This file is part of DROP, an open-source library targeting analytics/risk, transaction cost analytics,
+ * asset liability management analytics, capital, exposure, and margin analytics, valuation adjustment
+ * analytics, and portfolio construction analytics within and across fixed income, credit, commodity,
+ * equity, FX, and structured products. It also includes auxiliary libraries for algorithm support,
+ * numerical analysis, numerical optimization, spline builder, model validation, statistical learning,
+ * graph builder/navigator, and computational support.
+ *
+ * https://lakshmidrip.github.io/DROP/
+ *
+ * DROP is composed of three modules:
+ *
+ * - DROP Product Core - https://lakshmidrip.github.io/DROP-Product-Core/
+ * - DROP Portfolio Core - https://lakshmidrip.github.io/DROP-Portfolio-Core/
+ * - DROP Computational Core - https://lakshmidrip.github.io/DROP-Computational-Core/
+ *
+ * DROP Product Core implements libraries for the following:
+ * - Fixed Income Analytics
+ * - Loan Analytics
+ * - Transaction Cost Analytics
+ *
+ * DROP Portfolio Core implements libraries for the following:
+ * - Asset Allocation Analytics
+ * - Asset Liability Management Analytics
+ * - Capital Estimation Analytics
+ * - Exposure Analytics
+ * - Margin Analytics
+ * - XVA Analytics
+ *
+ * DROP Computational Core implements libraries for the following:
+ * - Algorithm Support
+ * - Computation Support
+ * - Function Analysis
+ * - Graph Algorithm
+ * - Model Validation
+ * - Numerical Analysis
+ * - Numerical Optimizer
+ * - Spline Builder
+ * - Statistical Learning
+ *
+ * Documentation for DROP is Spread Over:
+ *
+ * - Main => https://lakshmidrip.github.io/DROP/
+ * - Wiki => https://github.com/lakshmiDRIP/DROP/wiki
+ * - GitHub => https://github.com/lakshmiDRIP/DROP
+ * - Repo Layout Taxonomy => https://github.com/lakshmiDRIP/DROP/blob/master/Taxonomy.md
+ * - Javadoc => https://lakshmidrip.github.io/DROP/Javadoc/index.html
+ * - Technical Specifications => https://github.com/lakshmiDRIP/DROP/tree/master/Docs/Internal
+ * - Release Versions => https://lakshmidrip.github.io/DROP/version.html
+ * - Community Credits => https://lakshmidrip.github.io/DROP/credits.html
+ * - Issues Catalog => https://github.com/lakshmiDRIP/DROP/issues
+ *
+ * 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.
+ */
+
+/**
+ * ClaimsUtilityExpectationInferenceRun holds the Results of the Optimal Utility Expectation Inference
+ * Run on the Claims-Based Agent Utility Function. The References are:
+ *
+ *
+ *
+ * -
+ * Birge, J. R. (2008): Financial Engineering Elsevier Amsterdam Netherlands
+ *
+ * -
+ * Carmona, R. (2009): Indifference Pricing: Theory and Applications Princeton
+ * University Press Princeton NJ
+ *
+ * -
+ * Vassilis, P. (2005): Slow and Fast Markets Journal of Economics and Business 57
+ * (6) 576-593
+ *
+ * -
+ * Weiss, D. (2006): After the Trade is Made: Processing Securities Transactions Portfolio
+ * Publishing London UK
+ *
+ * -
+ * Wikipedia (2021): Indifference Price https://en.wikipedia.org/wiki/Indifference_price
+ *
+ *
+ *
+ *
+ *
+ *
+ * @author Lakshmi Krishnamurthy
+ */
+
+public class ClaimsUtilityExpectationInferenceRun extends UtilityExpectationOptimizationRun
+{
+ private double _reservationValue = Double.NaN;
+
+ /**
+ * ClaimsUtilityExpectationInferenceRun Constructor
+ *
+ * @param optimalValue Optimal Value of the Utility Expectation Optimization Run
+ * @param reservationValue Claims Reservation Value
+ *
+ * @throws Exception Thrown if the Inputs are Invalid
+ */
+
+ public ClaimsUtilityExpectationInferenceRun (
+ final double optimalValue,
+ final double reservationValue)
+ throws Exception
+ {
+ super (optimalValue);
+
+ if (!NumberUtil.IsValid (_reservationValue = reservationValue)) {
+ throw new Exception (
+ "ClaimsUtilityExpectationInferenceRun Constructor => Invalid Reservation Value"
+ );
+ }
+ }
+
+ /**
+ * Retrieve the Claims Reservation Value
+ *
+ * @return Claims Reservation Value
+ */
+
+ public double reservationValue()
+ {
+ return _reservationValue;
+ }
+}
diff --git a/src/main/java/org/drip/oms/indifference/ReservationPricer.java b/src/main/java/org/drip/oms/indifference/ReservationPricer.java
index f1800263c4e9..77708cddb292 100644
--- a/src/main/java/org/drip/oms/indifference/ReservationPricer.java
+++ b/src/main/java/org/drip/oms/indifference/ReservationPricer.java
@@ -2,6 +2,7 @@
package org.drip.oms.indifference;
import org.drip.measure.continuous.R1Univariate;
+import org.drip.measure.discrete.R1Distribution;
/*
* -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
@@ -175,12 +176,23 @@ public InventoryVertex optimalNoClaimsInventoryVertex()
}
/**
- * Retrieve the Optimal Claims Based Inventory Vertex
+ * Retrieve the Optimal Bid Claims Based Inventory Vertex
*
- * @return Optimal Claims Based Inventory Vertex
+ * @return Optimal Bid Claims Based Inventory Vertex
*/
- public InventoryVertex optimalClaimsInventoryVertex()
+ public InventoryVertex optimalBidClaimsInventoryVertex()
+ {
+ return _inventoryVertex;
+ }
+
+ /**
+ * Retrieve the Optimal Ask Claims Based Inventory Vertex
+ *
+ * @return Optimal Ask Claims Based Inventory Vertex
+ */
+
+ public InventoryVertex optimalAskClaimsInventoryVertex()
{
return _inventoryVertex;
}
@@ -206,13 +218,40 @@ public double noClaimsInventoryUtilityExpectation (
null,
optimalNoClaimsInventoryVertex(),
moneyMarketPrice
- ).optimalValue (underlierPriceDistribution, 0.);
+ ).optimizationRun (underlierPriceDistribution, 0.).optimalValue();
+ }
+
+ /**
+ * Compute the No-Claims Inventory-based Optimal Utility Value
+ *
+ * @param underlierPriceDistribution Discrete Underlier Price Distribution
+ * @param underlierPriceArray Underlier Price Array
+ * @param moneyMarketPrice Price of Money Market Entity
+ *
+ * @return The No-Claims Inventory-based Optimal Utility Value
+ *
+ * @throws Exception Thrown if the No-Claims Inventory-based Optimal Utility Value cannot be calculated
+ */
+
+ public double noClaimsInventoryUtilityExpectation (
+ final R1Distribution underlierPriceDistribution,
+ final double[] underlierPriceArray,
+ final double moneyMarketPrice)
+ throws Exception
+ {
+ return new UtilityFunctionExpectation (
+ _utilityFunction,
+ null,
+ optimalNoClaimsInventoryVertex(),
+ moneyMarketPrice
+ ).optimizationRun (underlierPriceDistribution, underlierPriceArray, 0.).optimalValue();
}
/**
* Compute the Bid Claims Inventory-based Position Value Adjustment
*
* @param underlierPriceDistribution Discrete Underlier Price Distribution
+ * @param moneyMarketPrice Price of Money Market Entity
* @param noClaimsInventoryUtilityExpectation No-Claims Inventory Utility Expectation
*
* @return The Bid Claims Inventory-based Position Value Adjustment
@@ -227,18 +266,69 @@ public double bidClaimsPositionValueAdjustment (
final double noClaimsInventoryUtilityExpectation)
throws Exception
{
- return new UtilityFunctionExpectation (
- _utilityFunction,
- _bidClaimsPositionPricer,
- optimalClaimsInventoryVertex(),
- moneyMarketPrice
- ).inferPositionValueAdjustment (underlierPriceDistribution, noClaimsInventoryUtilityExpectation);
+ ClaimsUtilityExpectationInferenceRun claimsUtilityExpectationInferenceRun =
+ new UtilityFunctionExpectation (
+ _utilityFunction,
+ _bidClaimsPositionPricer,
+ optimalBidClaimsInventoryVertex(),
+ moneyMarketPrice
+ ).inferPositionAdjustment (
+ underlierPriceDistribution,
+ noClaimsInventoryUtilityExpectation
+ );
+
+ if (null == claimsUtilityExpectationInferenceRun) {
+ throw new Exception (" Cannot generate Claims Utility Expectation Inference Run");
+ }
+
+ return claimsUtilityExpectationInferenceRun.optimalValue();
+ }
+
+ /**
+ * Compute the Bid Claims Inventory-based Position Value Adjustment
+ *
+ * @param underlierPriceDistribution Discrete Underlier Price Distribution
+ * @param underlierPriceArray Underlier Price Array
+ * @param moneyMarketPrice Price of Money Market Entity
+ * @param noClaimsInventoryUtilityExpectation No-Claims Inventory Utility Expectation
+ *
+ * @return The Bid Claims Inventory-based Position Value Adjustment
+ *
+ * @throws Exception Thrown if the Bid Claims Inventory-based Position Value Adjustment cannot be
+ * calculated
+ */
+
+ public double bidClaimsPositionValueAdjustment (
+ final R1Distribution underlierPriceDistribution,
+ final double[] underlierPriceArray,
+ final double moneyMarketPrice,
+ final double noClaimsInventoryUtilityExpectation)
+ throws Exception
+ {
+ ClaimsUtilityExpectationInferenceRun claimsUtilityExpectationInferenceRun =
+ new UtilityFunctionExpectation (
+ _utilityFunction,
+ _bidClaimsPositionPricer,
+ optimalBidClaimsInventoryVertex(),
+ moneyMarketPrice
+ ).inferPositionAdjustment (
+ underlierPriceDistribution,
+ underlierPriceArray,
+ noClaimsInventoryUtilityExpectation
+ );
+
+ if (null == claimsUtilityExpectationInferenceRun) {
+ throw new Exception (" Cannot generate Claims Utility Expectation Inference Run");
+ }
+
+ return claimsUtilityExpectationInferenceRun.optimalValue();
}
/**
* Compute the Ask Claims Inventory-based Position Value Adjustment
*
* @param underlierPriceDistribution Discrete Underlier Price Distribution
+ * @param moneyMarketPrice Price of Money Market Entity
* @param noClaimsInventoryUtilityExpectation No-Claims Inventory Utility Expectation
*
* @return The Ask Claims Inventory-based Position Value Adjustment
@@ -253,19 +343,144 @@ public double askClaimsPositionValueAdjustment (
final double noClaimsInventoryUtilityExpectation)
throws Exception
{
- return new UtilityFunctionExpectation (
- _utilityFunction,
- _askClaimsPositionPricer,
- optimalClaimsInventoryVertex(),
- moneyMarketPrice
- ).inferPositionValueAdjustment (underlierPriceDistribution, noClaimsInventoryUtilityExpectation);
+ ClaimsUtilityExpectationInferenceRun claimsUtilityExpectationInferenceRun =
+ new UtilityFunctionExpectation (
+ _utilityFunction,
+ _bidClaimsPositionPricer,
+ optimalBidClaimsInventoryVertex(),
+ moneyMarketPrice
+ ).inferPositionAdjustment (
+ underlierPriceDistribution,
+ noClaimsInventoryUtilityExpectation
+ );
+
+ if (null == claimsUtilityExpectationInferenceRun) {
+ throw new Exception (" Cannot generate Claims Utility Expectation Inference Run");
+ }
+
+ return claimsUtilityExpectationInferenceRun.optimalValue();
}
+ /**
+ * Compute the Ask Claims Inventory-based Position Value Adjustment
+ *
+ * @param underlierPriceDistribution Discrete Underlier Price Distribution
+ * @param underlierPriceArray Underlier Price Array
+ * @param moneyMarketPrice Price of Money Market Entity
+ * @param noClaimsInventoryUtilityExpectation No-Claims Inventory Utility Expectation
+ *
+ * @return The Ask Claims Inventory-based Position Value Adjustment
+ *
+ * @throws Exception Thrown if the Bid Claims Inventory-based Position Value Adjustment cannot be
+ * calculated
+ */
+
+ public double askClaimsPositionValueAdjustment (
+ final R1Distribution underlierPriceDistribution,
+ final double[] underlierPriceArray,
+ final double moneyMarketPrice,
+ final double noClaimsInventoryUtilityExpectation)
+ throws Exception
+ {
+ ClaimsUtilityExpectationInferenceRun claimsUtilityExpectationInferenceRun =
+ new UtilityFunctionExpectation (
+ _utilityFunction,
+ _askClaimsPositionPricer,
+ optimalAskClaimsInventoryVertex(),
+ moneyMarketPrice
+ ).inferPositionAdjustment (
+ underlierPriceDistribution,
+ underlierPriceArray,
+ noClaimsInventoryUtilityExpectation
+ );
+
+ if (null == claimsUtilityExpectationInferenceRun) {
+ throw new Exception (" Cannot generate Claims Utility Expectation Inference Run");
+ }
+
+ return claimsUtilityExpectationInferenceRun.optimalValue();
+ }
+
+ /**
+ * Run a Reservation Pricing Flow
+ *
+ * @param underlierPriceDistribution Discrete Underlier Price Distribution
+ * @param moneyMarketPrice Price of Money Market Entity
+ *
+ * @return Reservation Pricing Flow
+ */
+
public ReservationPricingRun reservationPricingRun (
final R1Univariate underlierPriceDistribution,
final double moneyMarketPrice)
- throws Exception
{
+ try {
+ double noClaimsInventoryUtilityExpectation = noClaimsInventoryUtilityExpectation (
+ underlierPriceDistribution,
+ moneyMarketPrice
+ );
+
+ return new ReservationPricingRun (
+ bidClaimsPositionValueAdjustment (
+ underlierPriceDistribution,
+ moneyMarketPrice,
+ noClaimsInventoryUtilityExpectation
+ ),
+ askClaimsPositionValueAdjustment (
+ underlierPriceDistribution,
+ moneyMarketPrice,
+ noClaimsInventoryUtilityExpectation
+ ),
+ noClaimsInventoryUtilityExpectation
+ );
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ return null;
+ }
+
+ /**
+ * Run a Reservation Pricing Flow
+ *
+ * @param underlierPriceDistribution Discrete Underlier Price Distribution
+ * @param underlierPriceArray Underlier Price Array
+ * @param moneyMarketPrice Price of Money Market Entity
+ *
+ * @return Reservation Pricing Flow
+ */
+
+ public ReservationPricingRun reservationPricingRun (
+ final R1Distribution underlierPriceDistribution,
+ final double[] underlierPriceArray,
+ final double moneyMarketPrice)
+ {
+ try {
+ double noClaimsInventoryUtilityExpectation = noClaimsInventoryUtilityExpectation (
+ underlierPriceDistribution,
+ underlierPriceArray,
+ moneyMarketPrice
+ );
+
+ return new ReservationPricingRun (
+ bidClaimsPositionValueAdjustment (
+ underlierPriceDistribution,
+ underlierPriceArray,
+ moneyMarketPrice,
+ noClaimsInventoryUtilityExpectation
+ ),
+ askClaimsPositionValueAdjustment (
+ underlierPriceDistribution,
+ underlierPriceArray,
+ moneyMarketPrice,
+ noClaimsInventoryUtilityExpectation
+ ),
+ noClaimsInventoryUtilityExpectation
+ );
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
return null;
}
}
diff --git a/src/main/java/org/drip/oms/indifference/ReservationPricingRun.java b/src/main/java/org/drip/oms/indifference/ReservationPricingRun.java
index c4af6287bfcc..49c26736bb86 100644
--- a/src/main/java/org/drip/oms/indifference/ReservationPricingRun.java
+++ b/src/main/java/org/drip/oms/indifference/ReservationPricingRun.java
@@ -122,17 +122,21 @@ public class ReservationPricingRun
*
* @param bidPrivateValue Bid Reservation Value
* @param askPrivateValue Ask Reservation Value
+ * @param noClaimsInventoryUtilityExpectation No-Claims Inventory Utility Expectation
*
* @throws Exception Thrown if the Private Values are Invalid
*/
public ReservationPricingRun (
final double bidPrivateValue,
- final double askPrivateValue)
+ final double askPrivateValue,
+ final double noClaimsInventoryUtilityExpectation)
throws Exception
{
if (!NumberUtil.IsValid (_bidPrivateValue = bidPrivateValue) ||
- !NumberUtil.IsValid (_askPrivateValue = askPrivateValue)) {
+ !NumberUtil.IsValid (_askPrivateValue = askPrivateValue) ||
+ !NumberUtil.IsValid (_noClaimsInventoryUtilityExpectation = noClaimsInventoryUtilityExpectation))
+ {
throw new Exception ("ReservationPricingRun Constructor => Invalid Inputs");
}
}
@@ -158,4 +162,15 @@ public double askPrivateValue()
{
return _askPrivateValue;
}
+
+ /**
+ * Retrieve the No-Claims Inventory Utility Expectation
+ *
+ * @return No-Claims Inventory Utility Expectation
+ */
+
+ public double noClaimsInventoryUtilityExpectation()
+ {
+ return _noClaimsInventoryUtilityExpectation;
+ }
}
diff --git a/src/main/java/org/drip/oms/indifference/UtilityExpectationOptimizationRun.java b/src/main/java/org/drip/oms/indifference/UtilityExpectationOptimizationRun.java
new file mode 100644
index 000000000000..24a903b76a0e
--- /dev/null
+++ b/src/main/java/org/drip/oms/indifference/UtilityExpectationOptimizationRun.java
@@ -0,0 +1,146 @@
+
+package org.drip.oms.indifference;
+
+import org.drip.numerical.common.NumberUtil;
+
+/*
+ * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ */
+
+/*!
+ * Copyright (C) 2024 Lakshmi Krishnamurthy
+ *
+ * This file is part of DROP, an open-source library targeting analytics/risk, transaction cost analytics,
+ * asset liability management analytics, capital, exposure, and margin analytics, valuation adjustment
+ * analytics, and portfolio construction analytics within and across fixed income, credit, commodity,
+ * equity, FX, and structured products. It also includes auxiliary libraries for algorithm support,
+ * numerical analysis, numerical optimization, spline builder, model validation, statistical learning,
+ * graph builder/navigator, and computational support.
+ *
+ * https://lakshmidrip.github.io/DROP/
+ *
+ * DROP is composed of three modules:
+ *
+ * - DROP Product Core - https://lakshmidrip.github.io/DROP-Product-Core/
+ * - DROP Portfolio Core - https://lakshmidrip.github.io/DROP-Portfolio-Core/
+ * - DROP Computational Core - https://lakshmidrip.github.io/DROP-Computational-Core/
+ *
+ * DROP Product Core implements libraries for the following:
+ * - Fixed Income Analytics
+ * - Loan Analytics
+ * - Transaction Cost Analytics
+ *
+ * DROP Portfolio Core implements libraries for the following:
+ * - Asset Allocation Analytics
+ * - Asset Liability Management Analytics
+ * - Capital Estimation Analytics
+ * - Exposure Analytics
+ * - Margin Analytics
+ * - XVA Analytics
+ *
+ * DROP Computational Core implements libraries for the following:
+ * - Algorithm Support
+ * - Computation Support
+ * - Function Analysis
+ * - Graph Algorithm
+ * - Model Validation
+ * - Numerical Analysis
+ * - Numerical Optimizer
+ * - Spline Builder
+ * - Statistical Learning
+ *
+ * Documentation for DROP is Spread Over:
+ *
+ * - Main => https://lakshmidrip.github.io/DROP/
+ * - Wiki => https://github.com/lakshmiDRIP/DROP/wiki
+ * - GitHub => https://github.com/lakshmiDRIP/DROP
+ * - Repo Layout Taxonomy => https://github.com/lakshmiDRIP/DROP/blob/master/Taxonomy.md
+ * - Javadoc => https://lakshmidrip.github.io/DROP/Javadoc/index.html
+ * - Technical Specifications => https://github.com/lakshmiDRIP/DROP/tree/master/Docs/Internal
+ * - Release Versions => https://lakshmidrip.github.io/DROP/version.html
+ * - Community Credits => https://lakshmidrip.github.io/DROP/credits.html
+ * - Issues Catalog => https://github.com/lakshmiDRIP/DROP/issues
+ *
+ * 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.
+ */
+
+/**
+ * UtilityExpectationOptimizationRun holds the Results of the Optimal Expectation Run of the Agent
+ * Utility Function. The References are:
+ *
+ *
+ *
+ * -
+ * Birge, J. R. (2008): Financial Engineering Elsevier Amsterdam Netherlands
+ *
+ * -
+ * Carmona, R. (2009): Indifference Pricing: Theory and Applications Princeton
+ * University Press Princeton NJ
+ *
+ * -
+ * Vassilis, P. (2005): Slow and Fast Markets Journal of Economics and Business 57
+ * (6) 576-593
+ *
+ * -
+ * Weiss, D. (2006): After the Trade is Made: Processing Securities Transactions Portfolio
+ * Publishing London UK
+ *
+ * -
+ * Wikipedia (2021): Indifference Price https://en.wikipedia.org/wiki/Indifference_price
+ *
+ *
+ *
+ *
+ *
+ *
+ * @author Lakshmi Krishnamurthy
+ */
+
+public class UtilityExpectationOptimizationRun
+{
+ private double _optimalValue = Double.NaN;
+
+ /**
+ * UtilityExpectationOptimizationRun Constructor
+ *
+ * @param optimalValue Optimal Value of the Utility Expectation Optimization Run
+ *
+ * @throws Exception Thrown if Inputs are Invalid
+ */
+
+ public UtilityExpectationOptimizationRun (
+ final double optimalValue)
+ throws Exception
+ {
+ if (!NumberUtil.IsValid (_optimalValue = optimalValue)) {
+ throw new Exception ("UtilityExpectationOptimizationRun Constructor => Invalid Optimal Value");
+ }
+ }
+
+ /**
+ * Retrieve the Optimal Value of the Utility Expectation Optimization Run
+ *
+ * @return Optimal Value of the Utility Expectation Optimization Run
+ */
+
+ public double optimalValue()
+ {
+ return _optimalValue;
+ }
+}
diff --git a/src/main/java/org/drip/oms/indifference/UtilityFunctionExpectation.java b/src/main/java/org/drip/oms/indifference/UtilityFunctionExpectation.java
index dd07b1996f51..6bdabf4c46d8 100644
--- a/src/main/java/org/drip/oms/indifference/UtilityFunctionExpectation.java
+++ b/src/main/java/org/drip/oms/indifference/UtilityFunctionExpectation.java
@@ -223,173 +223,182 @@ public double agentObjectiveValue (
}
/**
- * Compute the Optimal Expectation of the Agent Utility Function given the Underlier Price Array and
+ * Generate the Utility Expectation Optimization Run given the Underlier Price Array and
* Discrete Distribution
*
* @param underlierPriceDistribution Discrete Underlier Price Distribution
* @param underlierPriceArray Underlier Price Array
* @param positionValueAdjustment Position Value Adjustment
*
- * @return Expectation of the Agent Utility Function
- *
- * @throws Exception Thrown if the Inputs are Invalid
+ * @return The Utility Expectation Optimization Run Results
*/
- public double optimalValue (
+ public UtilityExpectationOptimizationRun optimizationRun (
final R1Distribution underlierPriceDistribution,
final double[] underlierPriceArray,
final double positionValueAdjustment)
- throws Exception
{
if (null == underlierPriceDistribution ||
null == underlierPriceArray || 0 == underlierPriceArray.length) {
- throw new Exception ("UtilityFunctionExpectation::evaluate => Invalid Inputs");
+ return null;
}
- double utilityFunctionExpectationValue = 0.;
+ try {
+ double utilityFunctionExpectationValue = 0.;
- for (double underlierPrice : underlierPriceArray) {
- utilityFunctionExpectationValue += underlierPriceDistribution.probability (underlierPrice) *
- agentObjectiveValue (underlierPrice, positionValueAdjustment);
+ for (double underlierPrice : underlierPriceArray) {
+ utilityFunctionExpectationValue += underlierPriceDistribution.probability (underlierPrice) *
+ agentObjectiveValue (underlierPrice, positionValueAdjustment);
+ }
+
+ return new UtilityExpectationOptimizationRun (utilityFunctionExpectationValue);
+ } catch (Exception e) {
+ e.printStackTrace();
}
- return utilityFunctionExpectationValue;
+ return null;
}
/**
- * Infer the Position Value Adjustment given the Target Utility Expectation Value
+ * Run the Position Value Inference for the Claims given the Target Utility Expectation Value
*
* @param underlierPriceDistribution Discrete Underlier Price Distribution
* @param targetUtilityExpectationValue Target Utility Expectation Value
*
- * @return The Position Value Adjustment
- *
- * @throws Exception Thrown if the Position Value Adjustment cannot be inferred
+ * @return Claims Position Value Inference
*/
- public double inferPositionValueAdjustment (
+ public ClaimsUtilityExpectationInferenceRun inferPositionAdjustment (
final R1Distribution underlierPriceDistribution,
final double[] underlierPriceArray,
final double targetUtilityExpectationValue)
- throws Exception
{
if (null == underlierPriceDistribution || !NumberUtil.IsValid (targetUtilityExpectationValue)) {
- throw new Exception (
- "UtilityFunctionExpectation::inferPositionValueAdjustment => Invalid Inputs"
- );
+ return null;
}
- FixedPointFinderOutput fixedPointFinderOutput = new FixedPointFinderBrent (
- 0.,
- new R1ToR1 (null) {
- @Override public double evaluate (
- final double positionValueAdjustment)
- throws Exception
- {
- return optimalValue (
- underlierPriceDistribution,
- underlierPriceArray,
- positionValueAdjustment
- ) - targetUtilityExpectationValue;
- }
- },
- false
- ).findRoot (
- InitializationHeuristics.FromBracketingMidHint (
- optimalValue (underlierPriceDistribution, underlierPriceArray, 0.) -
- targetUtilityExpectationValue
- )
- );
-
- if (null == fixedPointFinderOutput || !fixedPointFinderOutput.containsRoot()) {
- throw new Exception (
- "UtilityFunctionExpectation::inferPositionValueAdjustment => Cannot Infer Root"
+ try {
+ FixedPointFinderOutput fixedPointFinderOutput = new FixedPointFinderBrent (
+ 0.,
+ new R1ToR1 (null) {
+ @Override public double evaluate (
+ final double positionValueAdjustment)
+ throws Exception
+ {
+ return optimizationRun (
+ underlierPriceDistribution,
+ underlierPriceArray,
+ positionValueAdjustment
+ ).optimalValue() - targetUtilityExpectationValue;
+ }
+ },
+ false
+ ).findRoot (
+ InitializationHeuristics.FromBracketingMidHint (
+ optimizationRun (underlierPriceDistribution, underlierPriceArray, 0.).optimalValue() -
+ targetUtilityExpectationValue
+ )
);
+
+ return null == fixedPointFinderOutput || !fixedPointFinderOutput.containsRoot() ? null :
+ new ClaimsUtilityExpectationInferenceRun (
+ targetUtilityExpectationValue,
+ fixedPointFinderOutput.getRoot()
+ );
+ } catch (Exception e) {
+ e.printStackTrace();
}
- return fixedPointFinderOutput.getRoot();
+ return null;
}
/**
- * Compute the Optimal Expectation of the Agent Utility Function given the Underlier Price Array and
- * Discrete Distribution
+ * Generate the Utility Expectation Optimization Run given the Underlier Price Distribution
*
* @param underlierPriceDistribution Discrete Underlier Price Distribution
* @param positionValueAdjustment Position Value Adjustment
*
- * @return Expectation of the Agent Utility Function
- *
- * @throws Exception Thrown if the Inputs are Invalid
+ * @return Utility Expectation Optimization Run
*/
- public double optimalValue (
+ public UtilityExpectationOptimizationRun optimizationRun (
final R1Univariate underlierPriceDistribution,
final double positionValueAdjustment)
- throws Exception
{
if (null == underlierPriceDistribution) {
- throw new Exception ("UtilityFunctionExpectation::evaluate => Invalid Inputs");
+ return null;
}
- return NewtonCotesQuadratureGenerator.GaussLaguerreLeftDefinite (0., 100).integrate (
- new R1ToR1 (null) {
- @Override public double evaluate (
- final double underlierPrice)
- throws Exception
- {
- return underlierPriceDistribution.density (underlierPrice) *
- agentObjectiveValue (underlierPrice, positionValueAdjustment);
- }
- }
- );
+ try {
+ return new UtilityExpectationOptimizationRun (
+ NewtonCotesQuadratureGenerator.GaussLaguerreLeftDefinite (0., 100).integrate (
+ new R1ToR1 (null) {
+ @Override public double evaluate (
+ final double underlierPrice)
+ throws Exception
+ {
+ return underlierPriceDistribution.density (underlierPrice) *
+ agentObjectiveValue (underlierPrice, positionValueAdjustment);
+ }
+ }
+ )
+ );
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ return null;
}
/**
- * Infer the Position Value Adjustment given the Target Utility Expectation Value
+ * Run the Position Adjustment Inference for the Claims given the Target Utility Expectation Value
*
* @param underlierPriceDistribution Discrete Underlier Price Distribution
* @param targetUtilityExpectationValue Target Utility Expectation Value
*
- * @return The Position Value Adjustment
- *
- * @throws Exception Thrown if the Position Value Adjustment cannot be inferred
+ * @return The Position Adjustment Inference Run
*/
- public double inferPositionValueAdjustment (
+ public ClaimsUtilityExpectationInferenceRun inferPositionAdjustment (
final R1Univariate underlierPriceDistribution,
final double targetUtilityExpectationValue)
throws Exception
{
if (null == underlierPriceDistribution || !NumberUtil.IsValid (targetUtilityExpectationValue)) {
- throw new Exception (
- "UtilityFunctionExpectation::inferPositionValueAdjustment => Invalid Inputs"
- );
+ return null;
}
- FixedPointFinderOutput fixedPointFinderOutput = new FixedPointFinderBrent (
- 0.,
- new R1ToR1 (null) {
- @Override public double evaluate (
- final double positionValueAdjustment)
- throws Exception
- {
- return optimalValue (underlierPriceDistribution, positionValueAdjustment) -
- targetUtilityExpectationValue;
- }
- },
- false
- ).findRoot (
- InitializationHeuristics.FromBracketingMidHint (
- optimalValue (underlierPriceDistribution, 0.) - targetUtilityExpectationValue
- )
- );
-
- if (null == fixedPointFinderOutput || !fixedPointFinderOutput.containsRoot()) {
- throw new Exception (
- "UtilityFunctionExpectation::inferPositionValueAdjustment => Cannot Infer Root"
+ try {
+ FixedPointFinderOutput fixedPointFinderOutput = new FixedPointFinderBrent (
+ 0.,
+ new R1ToR1 (null) {
+ @Override public double evaluate (
+ final double positionValueAdjustment)
+ throws Exception
+ {
+ return optimizationRun (
+ underlierPriceDistribution,
+ positionValueAdjustment
+ ).optimalValue() - targetUtilityExpectationValue;
+ }
+ },
+ false
+ ).findRoot (
+ InitializationHeuristics.FromBracketingMidHint (
+ optimizationRun (underlierPriceDistribution, 0.).optimalValue() -
+ targetUtilityExpectationValue
+ )
);
+
+ return null == fixedPointFinderOutput || !fixedPointFinderOutput.containsRoot() ? null :
+ new ClaimsUtilityExpectationInferenceRun (
+ targetUtilityExpectationValue,
+ fixedPointFinderOutput.getRoot()
+ );
+ } catch (Exception e) {
+ e.printStackTrace();
}
- return fixedPointFinderOutput.getRoot();
+ return null;
}
}