-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
215e3d1
commit 6f1c4c9
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import argparse | ||
import qmcpy as qp | ||
from qmcpy.integrand.um_bridge_wrapper import UMBridgeWrapper | ||
import numpy as np | ||
import umbridge | ||
|
||
# Read URL from command line argument | ||
parser = argparse.ArgumentParser(description='QMCPy with UM-Bridge model demo.') | ||
parser.add_argument('url', metavar='url', type=str, | ||
help='the URL at which the model is running, for example http://localhost:4242') | ||
args = parser.parse_args() | ||
print(f"Connecting to host URL {args.url}") | ||
|
||
# Set up umbridge model and model config | ||
l2sea_model = umbridge.HTTPModel(args.url, "forward") | ||
|
||
# Get input dimension from model | ||
config = {} | ||
d = l2sea_model.get_input_sizes(config)[0] | ||
|
||
# Froud [0.25,0.41] | ||
# Draft [-6.6, -5.7] | ||
# Choose a distribution to sample via QMC | ||
dnb2 = qp.DigitalNetB2(d) | ||
|
||
#[−0.3, 0.3] × [492500, 507500] × [0.225, 0.345] × | ||
#[0.637, 0.763] × [−0.24, 0.24] | ||
|
||
gauss_sobol = qp.Uniform(dnb2, lower_bound=[-0.3,492500,0.225,0.637,-0.24], upper_bound=[0.3,507500,0.345,0.763,0.24]) | ||
|
||
integrand = UMBridgeWrapper(gauss_sobol, l2sea_model, config, parallel=1) | ||
|
||
qmc_sobol_algorithm = qp.CubQMCSobolG(integrand, abs_tol=1e-1, n_init = 256, n_max = 256) | ||
solution,data = qmc_sobol_algorithm.integrate() | ||
print(data) |