diff --git a/CMakeLists.txt b/CMakeLists.txt index 5704865e6..69740af55 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -350,7 +350,7 @@ if(WIN32 AND BUILD_PYTHON_BINDINGS) endif() # Compile public executables (with main functions) -set(EXECUTABLES solver identification L_eff Elastic_props ODF PDF) +set(EXECUTABLES solver L_eff Elastic_props ODF PDF) foreach(exe_name ${EXECUTABLES}) add_executable(${exe_name} software/${exe_name}.cpp) target_link_libraries(${exe_name} PRIVATE simcoon ${CMAKE_DL_LIBS}) diff --git a/README.md b/README.md index 3f6b06184..279ccf237 100755 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Simcoon is developed with the aim to be a high-quality scientific library to fac Simcoon integrates - a easy way to handle geometrical non-linearities : Use of Lagrangian measures, Eulerian measures and cumulative strains considering several spins : Jaumann, Green-Naghdi, Xi-Meyers-Bruhns logarithmic. With this last measure, cumulative strain correspond to a logarithmic strain measure and is the standard measure utilized for our constitutive laws. -Simcoon is a C++ library with emphasis on speed and ease-of-use, that offers a python interface to facilitate its use. Its principle focus is to provide tools to facilitate the implementation of up-to-date constitutive model for materials in Finite Element Analysis Packages. This is done by providing a C++ API to generate user material subroutine based on a library of functions. Also, Simconnn provides tools to analyse the behavior of material, considering loading at the material point level. Such tools include a thermomechanical solver, a software to predict effective properties of composites, and a built-in identification software (using a combined genetic-gradient based algorithm) +Simcoon is a C++ library with emphasis on speed and ease-of-use, that offers a python interface to facilitate its use. Its principle focus is to provide tools to facilitate the implementation of up-to-date constitutive model for materials in Finite Element Analysis Packages. This is done by providing a C++ API to generate user material subroutine based on a library of functions. Also, Simcoon provides tools to analyse the behavior of material, considering loading at the material point level. Such tools include a thermomechanical solver and a software to predict effective properties of composites. Parameter identification can be performed using Python with scipy.optimize (e.g. differential_evolution) and the simcoon Parameter/Constant key system Simcoon is mainly developed by faculty and researchers from University of Bordeaux and the I2M Laboratory (Institut de d'Ingénierie et de Mécanique). Fruitful contribution came from the LEM3 laboratory in Metz, France, TU Bergakademie Freiberg in Germany and the TIMC-IMAG laboratory in Grenoble, France. It is released under the GNU General Public License: GPL, version 3. diff --git a/docs/cpp_api/index.rst b/docs/cpp_api/index.rst index 9d1a52c20..36d3b74ca 100644 --- a/docs/cpp_api/index.rst +++ b/docs/cpp_api/index.rst @@ -9,7 +9,7 @@ Simcoon's C++ library provides high-performance implementations for: - **Continuum Mechanics**: Tensor operations, strain/stress transformations, kinematics - **Constitutive Models**: Hyperelastic, viscoelastic, and viscoplastic material models - **Homogenization**: Mean-field homogenization methods for composite materials -- **Simulation Tools**: Solvers, identification algorithms, and utilities +- **Simulation Tools**: Solvers and utilities .. note:: The C++ API is designed for advanced users who need direct access to the diff --git a/docs/cpp_api/simulation/identification.rst b/docs/cpp_api/simulation/identification.rst deleted file mode 100644 index a8b9ea067..000000000 --- a/docs/cpp_api/simulation/identification.rst +++ /dev/null @@ -1,10 +0,0 @@ -============== -Identification -============== - -Functions for material parameter identification using optimization algorithms -(genetic algorithms, gradient-based methods, etc.). - -.. doxygengroup:: identification - :project: simcoon - :content-only: diff --git a/docs/cpp_api/simulation/index.rst b/docs/cpp_api/simulation/index.rst index a0a8b4617..38b348102 100644 --- a/docs/cpp_api/simulation/index.rst +++ b/docs/cpp_api/simulation/index.rst @@ -2,8 +2,8 @@ Simulation ========== -The Simulation module provides tools for running simulations, including solvers, -identification algorithms, and mathematical utilities. +The Simulation module provides tools for running simulations, including solvers +and mathematical utilities. .. toctree:: :maxdepth: 2 @@ -12,7 +12,6 @@ identification algorithms, and mathematical utilities. maths rotation solver - identification phase Overview @@ -23,7 +22,6 @@ This module contains simulation and numerical tools: - **Maths**: Mathematical utilities (random numbers, statistics, solvers) - **Rotation**: Comprehensive 3D rotation tools with ``Rotation`` class and Voigt notation support - **Solver**: Material point simulation solvers -- **Identification**: Parameter identification algorithms - **Phase**: Phase management and properties What's New in Simcoon 2.0 diff --git a/docs/cpp_api/simulation_overview.md b/docs/cpp_api/simulation_overview.md index 033d4550d..9ab0b8c33 100644 --- a/docs/cpp_api/simulation_overview.md +++ b/docs/cpp_api/simulation_overview.md @@ -2,7 +2,7 @@ ## Introduction -The Simulation module provides the infrastructure for executing multi-physics simulations, parameter identification, and optimization. It includes the solver framework, phase management, mathematical utilities, and identification algorithms for material parameter calibration. +The Simulation module provides the infrastructure for executing multi-physics simulations. It includes the solver framework, phase management, and mathematical utilities. ## Module Organization @@ -88,104 +88,9 @@ Results management: - **read.hpp** - Phase file parsing - **write.hpp** - State serialization -### 3. **Identification** - Parameter Identification Framework +### 3. **Maths** - Mathematical Utilities -Inverse analysis tools for material parameter calibration from experimental data. - -#### **Optimization Framework:** - -##### **identification.hpp** -Main identification driver supporting multiple optimization algorithms: -- Genetic Algorithms (GA) -- Gradient-based methods (Levenberg-Marquardt) -- Hybrid strategies - -##### **Core Components:** - -**parameters.hpp** -Defines optimization variables: -```cpp -class parameters { - public: - double value; // Current value - double min_value; // Lower bound - double max_value; // Upper bound - string key; // Parameter identifier - int ninit; // Number of initializations -}; -``` - -**constants.hpp** -Fixed values during optimization: -```cpp -class constants { - public: - double value; - string key; - int ninit; -}; -``` - -**individual.hpp** -Solution candidate in population-based methods: -- Parameter vector -- Cost function value -- Constraint violations -- Fitness ranking - -**generation.hpp** -Population management for evolutionary algorithms: -- Population initialization -- Selection operators -- Crossover and mutation -- Elitism strategies - -**methods.hpp** -Optimization algorithm implementations: -- Cost function evaluation -- Gradient computation (numerical/analytical) -- Hessian approximation - -**optimize.hpp** -High-level optimization loop: -- Convergence checking -- Iteration management -- History tracking -- Checkpointing - -**opti_data.hpp** -Experimental data management: -- Loading experimental files -- Data interpolation -- Weight assignment - -**doe.hpp** (Design of Experiments) -Sampling strategies for parameter space exploration: -- Latin Hypercube Sampling (LHS) -- Random sampling - -**script.hpp** -Script interpretation for identification workflows. - -#### **Cost Function Definition:** - -The identification minimizes a weighted sum of squared residuals: - -\f[ -f(\mathbf{p}) = \sum_{i=1}^{N_{exp}} \sum_{j=1}^{N_{pts}} w_{ij} \left( y^{exp}_{ij} - y^{sim}_{ij}(\mathbf{p}) \right)^2 -\f] - -where: -- \f$ \mathbf{p} \f$ = parameter vector -- \f$ N_{exp} \f$ = number of experimental datasets -- \f$ N_{pts} \f$ = number of data points per dataset -- \f$ w_{ij} \f$ = weight for point j in experiment i -- \f$ y^{exp}_{ij} \f$ = experimental observation -- \f$ y^{sim}_{ij}(\mathbf{p}) \f$ = simulation prediction - -### 4. **Maths** - Mathematical Utilities - -Mathematical tools supporting simulation and identification: +Mathematical tools supporting simulation: #### **rotation.hpp** Rotation operations for objective stress integration: @@ -241,7 +146,7 @@ Random number generation: - Seeding control - Reproducibility support -### 5. **Geometry** - Geometric Primitives +### 4. **Geometry** - Geometric Primitives Geometric representations for multi-phase materials: @@ -312,42 +217,6 @@ solver(umat_name, props, nstatev, psi, theta, phi); Results are written to output files specified in the control file. -## Parameter Identification Workflow - -### 1. Define Parameters to Identify - -```cpp -vector params; -params.push_back({"E", 50000, 100000, "Young"}); -params.push_back({"sigma_Y", 100, 500, "Yield"}); -``` - -### 2. Load Experimental Data - -```cpp -opti_data data; -data.import("tensile_test.txt"); -data.weight = 1.0; -``` - -### 3. Configure Optimization - -```cpp -int method = 0; // Genetic Algorithm -int maxiter = 100; -double tolerance = 1e-6; -``` - -### 4. Run Identification - -```cpp -identification(method, params, constants, data_files); -``` - -### 5. Retrieve Optimal Parameters - -The identified parameters are written to `parameters_results.txt`. - ## Advanced Features ### Multi-scale Modeling @@ -375,14 +244,6 @@ The solver automatically adjusts time step size based on: Some operations support parallel execution (using OpenMP): - Multiple phase response -- Population-based optimization (outdated) - -### Checkpointing - -Identification can be checkpointed for: -- Recovery from interruptions -- Continuation of long-running optimizations -- Sensitivity analysis ## Configuration Files @@ -448,20 +309,13 @@ Block_1: ## References -1. **Genetic Algorithms:** - - Goldberg, D. E. (1989). *Genetic Algorithms in Search, Optimization, and Machine Learning*. Addison-Wesley. - -2. **Micromechanics and Multi-scale Modeling:** +1. **Micromechanics and Multi-scale Modeling:** - Qu, J., & Cherkaoui, M. (2006). *Fundamentals of Micromechanics of Solids*. Wiley. -3. **Parameter Identification:** - - Mahnken, R., & Stein, E. (1996). "Parameter identification for viscoplastic models based on analytical derivatives of a least-squares functional and stability investigations." *International Journal of Plasticity*. - -4. **Fischer-Burmeister Method:** +2. **Fischer-Burmeister Method:** - Fischer, A. (1997). "Solution of monotone complementarity problems with locally Lipschitzian functions." *Mathematical Programming*. ## See Also - [Continuum Mechanics Module](continuum_mechanics_overview.md) - Material models and constitutive functions - [Solver API](solver/) - Detailed solver documentation -- [Identification API](identification/) - Parameter identification reference diff --git a/docs/index.rst b/docs/index.rst index 44fb4c7e7..12aa8779c 100755 --- a/docs/index.rst +++ b/docs/index.rst @@ -13,7 +13,7 @@ Simcoon is a free, open-source C++ library for simulating multiphysics systems. [microgen](https://github.com/3MAH/microgen) for CAD and meshing of heterogeneous materials and [fedoo](https://github.com/3MAH/fedoo), our finite-element solver, the project provides a comprehensive toolset for analyzing heterogeneous materials. -Simcoon aims to be a high-quality scientific library for analysing complex, nonlinear system behaviour. It emphasizes performance and ease of use and exposes a Python interface to simplify workflows. The principal focus is to provide a C++ API to generate user-material subroutines for finite-element packages. Simcoon also includes tools to analyse material-point behaviour under loading, such as a thermomechanical solver, a tool to predict effective properties of composites, and a built-in identification tool that combines genetic and gradient-based algorithms. +Simcoon aims to be a high-quality scientific library for analysing complex, nonlinear system behaviour. It emphasizes performance and ease of use and exposes a Python interface to simplify workflows. The principal focus is to provide a C++ API to generate user-material subroutines for finite-element packages. Simcoon also includes tools to analyse material-point behaviour under loading, such as a thermomechanical solver and a tool to predict effective properties of composites. Parameter identification can be performed using Python with scipy.optimize (e.g. differential_evolution) and the simcoon Parameter/Constant key system. Simcoon supports geometric nonlinearity using Lagrangian and Eulerian measures, and cumulative strains with several objective rates (Jaumann, Green--Naghdi, and Xi--Meyers--Brühns logarithmic). The logarithmic cumulative-strain measure is the default used by the library's constitutive laws. diff --git a/docs/simulation/identification.rst b/docs/simulation/identification.rst new file mode 100644 index 000000000..2aea8de83 --- /dev/null +++ b/docs/simulation/identification.rst @@ -0,0 +1,281 @@ +Parameter Identification +======================== + +Simcoon provides a Python-based parameter identification workflow using +``scipy.optimize`` and a generic key-based file templating system. This +replaces the former built-in C++ genetic algorithm and allows users to +choose any optimizer, cost function, or external simulation tool. + +Overview +-------- + +The identification workflow consists of three components: + +1. **Key system** (``Parameter`` / ``Constant``): generic file templating + that replaces placeholders with parameter values in any input file +2. **Forward model**: simcoon solver, ``L_eff`` homogenization, or any + external tool (e.g., fedoo for FEMU) +3. **Optimizer**: ``sim.identification()`` wraps + ``scipy.optimize.differential_evolution``, or call scipy directly + for more control + +.. code-block:: none + + Template files (keys/) Working files (data/) + ┌──────────────────┐ copy ┌──────────────────┐ + │ ... @2p ... │ ────────> │ ... @2p ... │ + │ ... @3p ... │ │ ... @3p ... │ + └──────────────────┘ └──────────────────┘ + │ apply + v + ┌──────────────────┐ + │ ... 73000 ... │ ──> Forward model + │ ... 0.22 ... │ (solver, L_eff, ...) + └──────────────────┘ + +Key System +---------- + +The key system decouples the optimizer from the simulation tool. Template +files contain alphanumeric placeholders (keys) that are replaced at each +iteration with the current parameter values. + +Parameter class +^^^^^^^^^^^^^^^ + +.. code-block:: python + + from simcoon.parameter import Parameter, read_parameters, copy_parameters, apply_parameters + + # Create parameters programmatically + params = [ + Parameter(number=0, bounds=(100, 300), key="@E", + sim_input_files=["material.dat"]), + Parameter(number=1, bounds=(0.1, 0.4), key="@nu", + sim_input_files=["material.dat"]), + ] + + # Or read from a file + params = read_parameters("data/parameters.inp") + +**Parameter attributes:** + +- ``number``: parameter index +- ``bounds``: ``(min, max)`` tuple — used as optimizer bounds +- ``key``: placeholder string in template files (e.g., ``@E``, ``@0p``) +- ``sim_input_files``: list of files containing this key +- ``value``: current value (defaults to midpoint of bounds) + +**Parameters file format** (``parameters.inp``): + +.. code-block:: none + + #Number #min #max #key #number_of_files #files + 0 100 300 @E 1 material.dat + 1 0.1 0.4 @nu 1 material.dat + +Constant class +^^^^^^^^^^^^^^ + +Constants are fixed values (not optimized) that also use the key system: + +.. code-block:: python + + from simcoon.constant import Constant, read_constants, copy_constants, apply_constants + +The ``Constant`` class is a ``NamedTuple`` with fields: ``number``, ``key``, +``input_values``, ``value``, ``sim_input_files``. + +File operations +^^^^^^^^^^^^^^^ + +.. code-block:: python + + # 1. Copy template files from keys/ to data/ + copy_parameters(params, src_path="keys", dst_path="data") + + # 2. Replace keys with current values + params[0].value = 200.0 # set by optimizer + params[1].value = 0.3 + apply_parameters(params, dst_path="data") + +This works with **any** file format — simcoon input files, FE meshes, JSON +configs, etc. The key system is deliberately simple: it performs string +replacement, making it compatible with any simulation tool. + + +``identification()`` — Global Optimization +------------------------------------------- + +``sim.identification()`` wraps ``scipy.optimize.differential_evolution`` +using the bounds from your ``Parameter`` objects. After optimization, the +identified values are written back to each ``Parameter.value``. + +.. code-block:: python + + from simcoon.identify import identification + from simcoon.parameter import Parameter + + params = [ + Parameter(0, bounds=(10000, 200000), key="@Ef", + sim_input_files=["Nellipsoids0.dat"]), + Parameter(1, bounds=(0.01, 0.45), key="@nuf", + sim_input_files=["Nellipsoids0.dat"]), + ] + + result = identification(my_cost_function, params, seed=42, disp=True) + print(f"E_f = {params[0].value:.0f}, nu_f = {params[1].value:.3f}") + +**Arguments:** + +- ``cost_fn``: callable ``f(x) -> float`` where ``x`` is a parameter array +- ``parameters``: list of ``Parameter`` (bounds used for search space) +- ``method``: ``"differential_evolution"`` (default, only option for now) +- ``**kwargs``: forwarded to scipy (``maxiter``, ``popsize``, ``tol``, + ``seed``, ``polish=True``, ``disp``, etc.) + +**Returns:** ``scipy.optimize.OptimizeResult`` + +For more control (other optimizers, constraints, custom initialization), +call ``scipy.optimize`` directly — the ``Parameter`` objects provide the +bounds and values you need. + + +``calc_cost()`` — Multi-Level Weighted Cost +-------------------------------------------- + +``sim.calc_cost()`` computes a weighted cost function with three levels +of weights, designed for multi-test identification: + +.. math:: + + C = \text{avg}\left( + W^{\text{test}}_i \cdot + W^{\text{resp}}_{i,k} \cdot + W^{\text{pt}}_{i,k,j} \cdot + (y^{\exp}_{i,k,j} - y^{\num}_{i,k,j})^2 + \right) + +Data is organized as a **list of 2-D arrays**, one per test, each of +shape ``(n_points, n_responses)``: + +.. code-block:: python + + from simcoon.identify import calc_cost + import numpy as np + + # Two tensile tests, each with force + displacement columns + y_exp = [ + np.column_stack([force_exp_1, disp_exp_1]), # test 1: (N, 2) + np.column_stack([force_exp_2, disp_exp_2]), # test 2: (N, 2) + ] + y_num = [ + np.column_stack([force_num_1, disp_num_1]), + np.column_stack([force_num_2, disp_num_2]), + ] + + # Simple MSE + cost = calc_cost(y_exp, y_num) + + # NMSE per response (balances force in N vs disp in mm) + cost = calc_cost(y_exp, y_num, metric='nmse_per_response') + + # Per-test weights (emphasize test 2) + cost = calc_cost(y_exp, y_num, w_test=np.array([1.0, 3.0])) + +Weight levels +^^^^^^^^^^^^^ + +Three levels of weights are combined multiplicatively: + +.. list-table:: + :header-rows: 1 + :widths: 20 20 60 + + * - Level + - Argument + - Description + * - **Test** + - ``w_test`` + - ``ndarray (n_tests,)`` — weight per experiment/file. + Use to emphasize certain tests over others. + * - **Response** + - ``w_response`` + - ``list of ndarray (n_responses,)`` — weight per response column. + To balance responses of different magnitudes, use + ``metric='nmse_per_response'`` instead of manual weights. + * - **Point** + - ``w_point`` + - ``list of ndarray (n_points, n_responses)`` — weight per data point. + Use for heterogeneous confidence or to mask outliers. + +Metrics +^^^^^^^ + +Built-in metrics (numpy only, no extra dependency): + +- ``"mse"`` — Mean Squared Error (default) +- ``"nmse"`` — Normalized MSE (divided by variance of all experimental data) +- ``"nmse_per_response"`` — NMSE computed independently per response column, + then averaged. Each column is divided by its own ``sum(y_exp^2)``, + balancing responses of different magnitudes (e.g., force in N vs + displacement in mm). This is the recommended metric for multi-response + identification. +- ``"rmse"`` — Root Mean Squared Error +- ``"mae"`` — Mean Absolute Error + +With ``scikit-learn`` installed (``pip install simcoon[identify]``): + +- ``"r2"`` — R-squared score +- ``"mean_squared_error"``, ``"mean_absolute_error"`` — sklearn wrappers +- Any ``sklearn.metrics`` function that accepts ``sample_weight`` + +If scikit-learn is not installed and an sklearn metric is requested, a +clear error message with install instructions is shown. + + +Using with External Solvers +---------------------------- + +The key system works with any simulation tool. For example, with fedoo +(Finite Element Model Updating — FEMU): + +.. code-block:: python + + import subprocess + from simcoon.parameter import Parameter, copy_parameters, apply_parameters + from simcoon.identify import identification, calc_cost + + params = [ + Parameter(0, bounds=(100e3, 300e3), key="@E", + sim_input_files=["material.json"]), + ] + + def cost(x): + params[0].value = x[0] + copy_parameters(params, "keys", "data") + apply_parameters(params, "data") + + # Run external solver + subprocess.run(["python", "run_fedoo_simulation.py"]) + + # Load results and compare + y_num = [np.loadtxt("results/reaction_force.txt")] + y_exp = [np.loadtxt("exp_data/reaction_force.txt")] + return calc_cost(y_exp, y_num, normalize_response=True) + + result = identification(cost, params, seed=42) + + +Gallery Examples +---------------- + +Two complete examples demonstrate the identification workflow: + +- **Hyperelastic identification**: Mooney-Rivlin parameters from Treloar data + using ``differential_evolution`` and simcoon stress functions + (see ``examples/analysis/hyperelastic_parameter_identification.py``) + +- **Composite identification**: reinforcement properties from effective + modulus data using Mori-Tanaka and Self-Consistent homogenization + (see ``examples/heterogeneous/composite_parameter_identification.py``) diff --git a/docs/simulation/index.rst b/docs/simulation/index.rst index d57f293d7..3085509ff 100755 --- a/docs/simulation/index.rst +++ b/docs/simulation/index.rst @@ -6,5 +6,6 @@ Simulation :caption: Contents: solver.rst + identification.rst output.rst fea_integration.rst \ No newline at end of file diff --git a/docs_old/Cpp/Simulation/Identification/identification.rst b/docs_old/Cpp/Simulation/Identification/identification.rst deleted file mode 100755 index 7b22ce617..000000000 --- a/docs_old/Cpp/Simulation/Identification/identification.rst +++ /dev/null @@ -1,7 +0,0 @@ -The Identification Library -==================== - -Example : Identification of elastic parameters of a laminate ------------------------------------------ - -The first example is the identification of a laminate \ No newline at end of file diff --git a/docs_old/Cpp/Simulation/Identification/index.rst b/docs_old/Cpp/Simulation/Identification/index.rst deleted file mode 100755 index d92c3000c..000000000 --- a/docs_old/Cpp/Simulation/Identification/index.rst +++ /dev/null @@ -1,6 +0,0 @@ -Identification -============== - -.. toctree:: - - identification.rst \ No newline at end of file diff --git a/examples/heterogeneous/composite_parameter_identification.py b/examples/heterogeneous/composite_parameter_identification.py new file mode 100644 index 000000000..379937025 --- /dev/null +++ b/examples/heterogeneous/composite_parameter_identification.py @@ -0,0 +1,334 @@ +""" +Composite Parameter Identification using Mori-Tanaka and Self-Consistent +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +This example demonstrates inverse identification of reinforcement elastic +properties in a two-phase composite material. Given experimental effective +Young's modulus data at various volume fractions (Wang 2003), we identify the +Young's modulus and Poisson's ratio of the reinforcement phase. + +Two micromechanical schemes are compared: + +- **Mori-Tanaka** (``MIMTN``): accurate at low-to-moderate volume fractions +- **Self-Consistent** (``MISCN``): better at high volume fractions (c > 0.3) + +**Forward model**: simcoon mean-field homogenization (``L_eff``) +**Optimization**: ``scipy.optimize.differential_evolution`` (global optimizer) +**Key system**: simcoon ``Parameter`` for generic file templating +""" + +import numpy as np +import matplotlib.pyplot as plt +from scipy.optimize import differential_evolution +import simcoon as sim +from simcoon import parameter as par +import os + +################################################################################### +# Problem Setup +# ------------- +# +# We have a glass-particle / epoxy composite. The matrix properties are known: +# +# - :math:`E_m = 2250` MPa, :math:`\\nu_m = 0.19` +# +# The reinforcement properties :math:`(E_f, \\nu_f)` are unknown and must be +# identified from experimental effective Young's modulus measurements at several +# volume fractions. +# +# **Key System**: simcoon's key system allows parameters to be injected into +# any input file via alphanumeric placeholders (e.g., ``@2p``). This makes the +# identification workflow generic and applicable to any simulation tool +# (simcoon solver, Mori-Tanaka, fedoo FE, etc.). + + +def load_experimental_data(filepath): + """Load experimental E_eff vs volume fraction data.""" + data = np.loadtxt(filepath) + return data[:, 0], data[:, 1] + + +################################################################################### +# Forward Model +# ------------- +# +# For each set of candidate properties :math:`(E_f, \\nu_f)`, we compute the +# effective Young's modulus at all experimental volume fractions using simcoon's +# ``L_eff`` function. + + +def compute_E_eff( + E_f, nu_f, concentrations, umat_name, param_list, path_keys, path_data, + props_composite, +): + """ + Compute effective Young's modulus at given volume fractions. + + Parameters + ---------- + E_f : float + Reinforcement Young's modulus [MPa] + nu_f : float + Reinforcement Poisson's ratio [-] + concentrations : array-like + Volume fractions of reinforcement + umat_name : str + Micromechanical scheme ("MIMTN" or "MISCN") + param_list : list of Parameter + Parameter objects with keys for file templating + path_keys : str + Path to template files + path_data : str + Path to working data directory (must be "data" relative to cwd) + props_composite : numpy.ndarray + Composite definition array [nphases, num_file, int1, int2, n_matrix] + + Returns + ------- + numpy.ndarray + Effective Young's modulus at each volume fraction [MPa] + """ + E_eff = np.zeros(len(concentrations)) + + for i, c in enumerate(concentrations): + param_list[0].value = 1.0 - c + param_list[1].value = c + param_list[2].value = E_f + param_list[3].value = nu_f + + par.copy_parameters(param_list, path_keys, path_data) + par.apply_parameters(param_list, path_data) + + L = sim.L_eff(umat_name, props_composite, 0, 0.0, 0.0, 0.0) + iso_props = sim.L_iso_props(L).flatten() + E_eff[i] = iso_props[0] + + return E_eff + + +def cost_function( + params_opt, c_exp, E_exp, umat_name, param_list, path_keys, path_data, + props_composite, +): + """MSE cost function for reinforcement property identification.""" + E_f, nu_f = params_opt + try: + E_pred = compute_E_eff( + E_f, nu_f, c_exp, umat_name, param_list, path_keys, path_data, + props_composite, + ) + return np.mean((E_pred - E_exp) ** 2) + except Exception: + return 1e12 + + +def identify_reinforcement( + c_exp, E_exp, umat_name, param_list, path_keys, path_data, + props_composite, bounds, verbose=True, +): + """ + Identify reinforcement properties using differential evolution. + + Returns + ------- + dict + Identified parameters and optimization result + """ + if verbose: + print(f"\n{'=' * 60}") + print(f" Identification with {umat_name}") + print(f"{'=' * 60}") + + result = differential_evolution( + cost_function, + bounds=bounds, + args=(c_exp, E_exp, umat_name, param_list, path_keys, path_data, + props_composite), + strategy="best1bin", + maxiter=200, + popsize=15, + tol=1e-8, + mutation=(0.5, 1.0), + recombination=0.7, + seed=42, + polish=True, + disp=verbose, + ) + + E_f_opt, nu_f_opt = result.x + if verbose: + print(f"\n E_f = {E_f_opt:.0f} MPa") + print(f" nu_f = {nu_f_opt:.3f}") + print(f" MSE = {result.fun:.2e} MPa^2") + + return { + "E_f": E_f_opt, + "nu_f": nu_f_opt, + "mse": result.fun, + "result": result, + "umat_name": umat_name, + } + + +################################################################################### +# Main Execution +# -------------- +# +# We compare two identification strategies: +# +# 1. **Mori-Tanaka** (``MIMTN``): dilute approximation, best for c < 30% +# 2. **Self-Consistent** (``MISCN``): accounts for percolation, better at high c +# +# At high volume fractions (c = 0.5), Mori-Tanaka underestimates stiffness +# and compensates by overestimating :math:`E_f`. Self-Consistent gives more +# physically meaningful identified properties. + +if __name__ == "__main__": + + # ----------------------------------------------------------------- + # Change to example directory (L_eff reads from data/ in cwd) + # ----------------------------------------------------------------- + script_dir = os.path.dirname(os.path.abspath(__file__)) + os.chdir(script_dir) + + path_keys = "keys_ident" + path_data = "data" + + # ----------------------------------------------------------------- + # Load experimental data (Wang 2003) + # ----------------------------------------------------------------- + c_exp, E_exp = load_experimental_data("data/E_exp.txt") + + print("=" * 60) + print(" COMPOSITE REINFORCEMENT IDENTIFICATION") + print(" Glass/Epoxy — Mean-field + Differential Evolution") + print("=" * 60) + print(f"\nExperimental data (Wang 2003): {len(c_exp)} points") + for c, E in zip(c_exp, E_exp): + print(f" c = {c:.1f} -> E_eff = {E:.0f} MPa") + + # ----------------------------------------------------------------- + # Load parameters (key system) + # ----------------------------------------------------------------- + # Define parameters inline (no external file needed): + # @0p -> matrix concentration + # @1p -> reinforcement concentration + # @2p -> reinforcement E [MPa] + # @3p -> reinforcement nu + param_list = [ + par.Parameter(0, bounds=(0.0, 1.0), key="@0p", + sim_input_files=["Nellipsoids0.dat"]), + par.Parameter(1, bounds=(0.0, 1.0), key="@1p", + sim_input_files=["Nellipsoids0.dat"]), + par.Parameter(2, bounds=(10000, 200000), key="@2p", + sim_input_files=["Nellipsoids0.dat"]), + par.Parameter(3, bounds=(0.01, 0.45), key="@3p", + sim_input_files=["Nellipsoids0.dat"]), + ] + + # Composite definition + props_composite = np.array([2, 0, 50, 50, 0], dtype="float") + + # Bounds for identification (E_f, nu_f) + bounds = [(10000, 200000), (0.01, 0.45)] + + # ----------------------------------------------------------------- + # Identification with Mori-Tanaka + # ----------------------------------------------------------------- + result_MT = identify_reinforcement( + c_exp, E_exp, "MIMTN", param_list, path_keys, path_data, + props_composite, bounds, + ) + + # ----------------------------------------------------------------- + # Identification with Self-Consistent + # ----------------------------------------------------------------- + result_SC = identify_reinforcement( + c_exp, E_exp, "MISCN", param_list, path_keys, path_data, + props_composite, bounds, + ) + + # ----------------------------------------------------------------- + # Summary + # ----------------------------------------------------------------- + print(f"\n{'=' * 60}") + print(f" SUMMARY") + print(f"{'=' * 60}") + print(f" Reference glass: E_f ~ 73000 MPa, nu_f ~ 0.22") + print(f"") + print(f" {'Scheme':<20} {'E_f [MPa]':>12} {'nu_f':>8} {'MSE':>14}") + print(f" {'-' * 56}") + print(f" {'Mori-Tanaka':<20} {result_MT['E_f']:>12.0f} " + f"{result_MT['nu_f']:>8.3f} {result_MT['mse']:>14.2e}") + print(f" {'Self-Consistent':<20} {result_SC['E_f']:>12.0f} " + f"{result_SC['nu_f']:>8.3f} {result_SC['mse']:>14.2e}") + print() + + # Note on model limitations + print(" Note: Mori-Tanaka underestimates stiffness at high volume") + print(" fractions and compensates by overestimating E_f. Self-Consistent") + print(" accounts for phase connectivity and gives more physically") + print(" meaningful results for this dataset (c up to 50%).") + + # ----------------------------------------------------------------- + # Visualization + # ----------------------------------------------------------------- + c_model = np.arange(0.0, 0.51, 0.01) + + E_MT = compute_E_eff( + result_MT["E_f"], result_MT["nu_f"], c_model, "MIMTN", + param_list, path_keys, path_data, props_composite, + ) + E_SC = compute_E_eff( + result_SC["E_f"], result_SC["nu_f"], c_model, "MISCN", + param_list, path_keys, path_data, props_composite, + ) + # Reference with handbook glass properties + E_ref_MT = compute_E_eff( + 73000, 0.22, c_model, "MIMTN", + param_list, path_keys, path_data, props_composite, + ) + E_ref_SC = compute_E_eff( + 73000, 0.22, c_model, "MISCN", + param_list, path_keys, path_data, props_composite, + ) + + fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(14, 6)) + + # Left: Identified fits + ax1.plot(c_exp, E_exp, "kx", markersize=10, markeredgewidth=2, + label="Exp. (Wang 2003)") + ax1.plot(c_model, E_MT, "b-", linewidth=2, + label=f"MT identified (E_f={result_MT['E_f']:.0f})") + ax1.plot(c_model, E_SC, "r-", linewidth=2, + label=f"SC identified (E_f={result_SC['E_f']:.0f})") + ax1.set_xlabel("Reinforcement volume fraction $c$", fontsize=12) + ax1.set_ylabel("Effective Young's modulus $E_{eff}$ [MPa]", fontsize=12) + ax1.set_title("Identified Reinforcement Properties", fontsize=13) + ax1.legend(fontsize=10) + ax1.grid(True, alpha=0.3) + + # Right: Reference vs Identified + ax2.plot(c_exp, E_exp, "kx", markersize=10, markeredgewidth=2, + label="Exp. (Wang 2003)") + ax2.plot(c_model, E_ref_MT, "b--", linewidth=1.5, alpha=0.6, + label="MT with E_f=73 GPa (handbook)") + ax2.plot(c_model, E_ref_SC, "r--", linewidth=1.5, alpha=0.6, + label="SC with E_f=73 GPa (handbook)") + ax2.plot(c_model, E_MT, "b-", linewidth=2, alpha=0.8, + label="MT identified") + ax2.plot(c_model, E_SC, "r-", linewidth=2, alpha=0.8, + label="SC identified") + ax2.set_xlabel("Reinforcement volume fraction $c$", fontsize=12) + ax2.set_ylabel("Effective Young's modulus $E_{eff}$ [MPa]", fontsize=12) + ax2.set_title("Handbook vs Identified Properties", fontsize=13) + ax2.legend(fontsize=9) + ax2.grid(True, alpha=0.3) + + fig.suptitle( + "Composite Reinforcement Identification — Glass/Epoxy\n" + "Mori-Tanaka vs Self-Consistent + Differential Evolution", + fontsize=14, fontweight="bold", + ) + plt.tight_layout() + plt.show() diff --git a/examples/heterogeneous/keys_ident/Nellipsoids0.dat b/examples/heterogeneous/keys_ident/Nellipsoids0.dat new file mode 100644 index 000000000..aa10a235a --- /dev/null +++ b/examples/heterogeneous/keys_ident/Nellipsoids0.dat @@ -0,0 +1,3 @@ +Number Coatingof umat save c psi_mat theta_mat phi_mat a1 a2 a3 psi_geom theta_geom phi_geom nprops nstatev props +0 0 ELISO 1 @0p 0. 0. 0. 1 1 1 0. 0. 0. 3 1 2250 0.19 8.8E-5 +1 0 ELISO 1 @1p 0. 0. 0. 1 1 1 0. 0. 0. 3 1 @2p @3p 0.5E-6 diff --git a/include/simcoon/Simulation/Identification/constants.hpp b/include/simcoon/Simulation/Identification/constants.hpp deleted file mode 100755 index 6f7050167..000000000 --- a/include/simcoon/Simulation/Identification/constants.hpp +++ /dev/null @@ -1,78 +0,0 @@ -/* This file is part of simcoon. - - simcoon is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - simcoon is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with simcoon. If not, see . - - */ - -///@file parameters.hpp -///@brief Handle of input parameters -///@version 1.0 - -#pragma once - -#include -#include - -namespace simcoon{ - -/** - * @file constants.hpp - * @brief Parameter identification functions. - */ - -/** @addtogroup identification - * @{ - */ - - -//====================================== -class constants -//====================================== -{ - private: - - protected: - - public : - - int number; //number of the constant - double value; //Value of the constant - - arma::vec input_values; //values of the constant for each input file considered (test) - - std::string key; //A unique key utilized to replace the constants in file(s) - int ninput_files; - std::vector input_files; //vector of files impacted (automaticaly filed for some parameter types) - - constants(); //default constructor - constants(const int&, const int&); //constructor - number, min and max values - constants(const int&, const double&, const arma::vec&, const std::string&, const int &, const std::vector&); //Constructor with parameters - constants(const constants &); //Copy constructor - ~constants(); - - int dimfiles () const {return ninput_files;} // returns the number of files associated to this parameter - - void update(const int&); //Update value based on the number in the vec input_value - void resize(const int&, const int&); - - virtual constants& operator = (const constants&); - - friend std::ostream& operator << (std::ostream&, const constants&); - -}; - - -/** @} */ // end of identification group - -} //namespace simcoon diff --git a/include/simcoon/Simulation/Identification/doe.hpp b/include/simcoon/Simulation/Identification/doe.hpp deleted file mode 100755 index 9970d4e5e..000000000 --- a/include/simcoon/Simulation/Identification/doe.hpp +++ /dev/null @@ -1,54 +0,0 @@ -/* This file is part of simcoon. - - simcoon is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - simcoon is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with simcoon. If not, see . - - */ - -///@file doe.hpp -///@brief Design of Experiments library -///@version 1.0 - -#include -#include -#include "parameters.hpp" -#include "generation.hpp" - -namespace simcoon{ - -/** - * @file doe.hpp - * @brief Parameter identification functions. - */ - -/** @addtogroup identification - * @{ - */ - - -//This function computes the test matrix with the parameters of a uniform multidimensional distribution -arma::mat doe_uniform(const int &, const int &, const std::vector &); - -//This function computes the test matrix with the parameters of a uniform multidimensional distribution, where the extreme samples are in the bounds -arma::mat doe_uniform_limit(const int &, const int &, const std::vector &); - -//This function computes the test matrix with the parameters of a random sampling -arma::mat doe_random(const int &, const int &, const std::vector &); - -//This function is utilized to initialize the first generation -void gen_initialize(generation &, int &, int&, int &, const int &, const int &, const std::vector &, const double &); - - -/** @} */ // end of identification group - -} //namespace simcoon diff --git a/include/simcoon/Simulation/Identification/generation.hpp b/include/simcoon/Simulation/Identification/generation.hpp deleted file mode 100755 index 15ec156f5..000000000 --- a/include/simcoon/Simulation/Identification/generation.hpp +++ /dev/null @@ -1,126 +0,0 @@ -/* This file is part of simcoon. - - simcoon is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - simcoon is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with simcoon. If not, see . - - */ - -///@file generation.hpp -///@brief generation for genetic algorithm (among others) -///@author Chemisky & Despringre -///@version 1.0 - -#pragma once -#include -#include -#include "individual.hpp" - -namespace simcoon{ - -/** - * @file generation.hpp - * @brief Parameter identification functions. - */ - -/** @addtogroup identification - * @{ - */ - - -//====================================== -class generation -//====================================== -{ - private: - - protected: - - public : - std::vector pop; ///< Population of individuals - - /** - * @brief Default constructor. - */ - generation(); - - /** - * @brief Constructor with population size and parameter count. - * @param npop Number of individuals - * @param nparam Number of parameters per individual - * @param id_start Starting id for individuals - * @param lambda Initial lambda value (default: 0.0) - */ - generation(const int &npop, const int &nparam, int &id_start, const double &lambda = 0.); - - /** - * @brief Copy constructor. - * @param gen Generation to copy - */ - generation(const generation &gen); - - /** - * @brief Destructor. - */ - ~generation(); - - /** - * @brief Get the number of individuals in the population. - * @return Population size - */ - int size() const {return pop.size();} - - /** - * @brief Construct the population with given size and parameters. - * @param npop Number of individuals - * @param nparam Number of parameters - * @param id_start Starting id - * @param lambda Initial lambda value - */ - void construct(const int &npop, const int &nparam, int &id_start, const double &lambda = 0.); - - /** - * @brief Classify individuals by cost (fitness). - */ - void classify(); - - /** - * @brief Assign new unique ids to individuals. - * @param id_start Starting id - */ - void newid(int &id_start); - - /** - * @brief Destroy the population (clear individuals). - */ - void destruct(); - - /** - * @brief Assignment operator. - * @param gen Generation to assign - * @return Reference to this object - */ - virtual generation& operator = (const generation &gen); - - /** - * @brief Stream output operator. - * @param os Output stream - * @param gen Generation to output - * @return Output stream - */ - friend std::ostream& operator << (std::ostream& os, const generation &gen); -}; - - -/** @} */ // end of identification group - -} //namespace simcoon diff --git a/include/simcoon/Simulation/Identification/identification.hpp b/include/simcoon/Simulation/Identification/identification.hpp deleted file mode 100755 index 3f466c5a6..000000000 --- a/include/simcoon/Simulation/Identification/identification.hpp +++ /dev/null @@ -1,47 +0,0 @@ -/* This file is part of simcoon. - - simcoon is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - simcoon is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with simcoon. If not, see . - - */ - -///@file identification.hpp -///@brief Function that run solver identification algorithms based on Smart+ solver -///@version 1.0 - -#pragma once - -#include -#include -#include "parameters.hpp" -#include "opti_data.hpp" -#include "generation.hpp" - -namespace simcoon{ - -/** - * @file identification.hpp - * @brief Parameter identification functions. - */ - -/** @addtogroup identification - * @{ - */ - - -void run_identification(const std::string &, const int &, const int &, const int &, const int &, const int &, int &, int &, const int &, const int &, const int & = 6, const double & = 1.E-12, const std::string & = "data/", const std::string & = "keys/", const std::string & = "results/", const std::string & = "material.dat", const std::string & = "id_params.txt", const std::string & = "simul.txt", const double & = 5, const double & = 0.01, const double & = 0.001, const double & = 10, const double & = 0.01); - - -/** @} */ // end of identification group - -} //namespace simcoon diff --git a/include/simcoon/Simulation/Identification/individual.hpp b/include/simcoon/Simulation/Identification/individual.hpp deleted file mode 100755 index a90f99b99..000000000 --- a/include/simcoon/Simulation/Identification/individual.hpp +++ /dev/null @@ -1,112 +0,0 @@ -/* This file is part of simcoon. - - simcoon is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - simcoon is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with simcoon. If not, see . - - */ - -///@file individual.hpp -///@brief individual for genetic algorithm (among others) -///@author Chemisky & Despringre -///@version 1.0 - -#pragma once -#include -#include - -namespace simcoon{ - -/** - * @file individual.hpp - * @brief Parameter identification functions. - */ - -/** @addtogroup identification - * @{ - */ - - - -/** - * @brief Class representing an individual in a genetic algorithm for parameter identification. - * - * An individual encodes a candidate solution (set of parameters) and its associated cost (fitness). - * Used in evolutionary algorithms for model calibration or optimization. - * - * @details The class stores: - * - Parameter vector (p) - * - Cost function value (cout) - * - Unique identifier (id) and rank in the population - * - Lambda: step size or regularization parameter - */ -class individual -{ -private: -protected: -public: - int np; ///< Number of parameters - double cout; ///< Cost function value (fitness) - int id; ///< Unique identifier - int rank; ///< Rank in the population - arma::vec p; ///< Parameter vector - double lambda; ///< Step or regularization parameter - - /** - * @brief Default constructor. - */ - individual(); - - /** - * @brief Constructor with number of parameters, id, and lambda. - * @param np Number of parameters - * @param id Unique identifier - * @param lambda Step or regularization parameter - */ - individual(const int &np, const int &id, const double &lambda); - - /** - * @brief Copy constructor. - * @param ind Individual to copy - */ - individual(const individual &ind); - - /** - * @brief Destructor. - */ - ~individual(); - - /** - * @brief Allocate and initialize parameter vector. - */ - void construct(); - - /** - * @brief Assignment operator. - * @param ind Individual to assign - * @return Reference to this object - */ - virtual individual& operator = (const individual &ind); - - /** - * @brief Stream output operator. - * @param os Output stream - * @param ind Individual to output - * @return Output stream - */ - friend std::ostream& operator << (std::ostream& os, const individual &ind); -}; - - -/** @} */ // end of identification group - -} //namespace simcoon diff --git a/include/simcoon/Simulation/Identification/methods.hpp b/include/simcoon/Simulation/Identification/methods.hpp deleted file mode 100755 index f472a7ed3..000000000 --- a/include/simcoon/Simulation/Identification/methods.hpp +++ /dev/null @@ -1,56 +0,0 @@ -/* This file is part of simcoon. - - simcoon is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - simcoon is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with simcoon. If not, see . - - */ - -///@file individual.hpp -///@brief individual for genetic algorithm (among others) -///@author Chemisky & Despringre -///@version 1.0 - -#pragma once -#include -#include -#include "generation.hpp" - -namespace simcoon{ - -/** - * @file methods.hpp - * @brief Parameter identification functions. - */ - -/** @addtogroup identification - * @{ - */ - - -//Genetic method -void genetic(generation &, generation &, int &, const double &, const double &, const std::vector &); - -///Genrun creation -void to_run(generation &, generation &, generation &, const double &, const std::vector &); - -//Find the bests from the gensons and previous generation, considering the gboys -//Define the new gen_cur and gboys_cur accordingly -void find_best(generation &, generation &, const generation &, const generation &, const generation &, const int &, const int &, int &); - -//Write the results in an output file -void write_results(std::ofstream &, const std::string &outputfile, const generation &, const int &, const int &, const int &); - - -/** @} */ // end of identification group - -} //namespace simcoon \ No newline at end of file diff --git a/include/simcoon/Simulation/Identification/opti_data.hpp b/include/simcoon/Simulation/Identification/opti_data.hpp deleted file mode 100755 index 818cc33fb..000000000 --- a/include/simcoon/Simulation/Identification/opti_data.hpp +++ /dev/null @@ -1,79 +0,0 @@ -/* This file is part of simcoon. - - simcoon is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - simcoon is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with simcoon. If not, see . - - */ - -///@file opti_data.hpp -///@brief Handle of data from optimization -///@author Chemisky & Despringre -///@version 1.0 - -#pragma once -#include -#include - -namespace simcoon{ - -/** - * @file opti_data.hpp - * @brief Parameter identification functions. - */ - -/** @addtogroup identification - * @{ - */ - - -//====================================== -class opti_data -//====================================== -{ - private: - - protected: - - public : - std::string name; - int number; - int ndata; - int ninfo; - int ncolumns; - arma::Col c_data; - arma::mat data; - int skiplines; - - opti_data(); //default constructor - opti_data(int, int); //constructor - allocates memory for statev - opti_data(std::string, int, int, int, int, int); //Constructor with parameters - opti_data(const opti_data &); //Copy constructor - virtual ~opti_data(); - - int dimdata () const {return ndata;} // returns the number of data points - int diminfo () const {return ninfo;} // returns the number of informations at each datapoint - - void constructc_data(); - void constructdata(); - - void import(std::string, int=0); - - virtual opti_data& operator = (const opti_data&); - - friend std::ostream& operator << (std::ostream&, const opti_data&); -}; - - -/** @} */ // end of identification group - -} //namespace simcoon diff --git a/include/simcoon/Simulation/Identification/optimize.hpp b/include/simcoon/Simulation/Identification/optimize.hpp deleted file mode 100755 index 9fb15ee42..000000000 --- a/include/simcoon/Simulation/Identification/optimize.hpp +++ /dev/null @@ -1,93 +0,0 @@ -/* This file is part of simcoon. - - simcoon is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - simcoon is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with simcoon. If not, see . - - */ - -///@file individual.hpp -///@brief individual for genetic algorithm (among others) -///@author Chemisky & Despringre -///@version 1.0 - -#pragma once - -#include -#include -#include "parameters.hpp" -#include "individual.hpp" -#include "opti_data.hpp" - -namespace simcoon{ - -/** - * @file optimize.hpp - * @brief Parameter identification functions. - */ - -/** @addtogroup identification - * @{ - */ - - -///This function constructs the vector of exp/num -arma::vec calcV(const std::vector &, const std::vector &, const int &, const int &); - -///This function constructs the sensitivity matrix - void calcS(arma::mat &, const arma::vec &, const arma::vec &, const int &, const arma::vec &); - -///This function checks the sensitivity matrix. -///This ensures that if a parameter didn't modify at all the result, the sensibility matrix doesn't have a column of "0" (inversion) issues -arma::Col checkS(const arma::mat &); - -//This function reduce S if if a parameter didn't modify at all the result -arma::mat reduce_S(const arma::mat &, const arma::Col &); - -///This function computes the Cost function (Square differnces) from the components of experimental values and numerically evaluated values -double calcC(const arma::vec &, arma::vec &, const arma::vec &); - -//This function computes the approximation of Hessian for under quadratic form assumptions, according to a weight vector -arma::mat Hessian(const arma::mat &, const arma::vec &); - -//This function computes the diagonal of the Hessian, which is actually the the gradient direction -arma::mat diagJtJ(const arma::mat &); - -//This function computes the minimal vector bound -arma::vec bound_min(const int &, const arma::vec &, const std::vector &, const double &, const double &); - -//This function computes the maximal vector bound -arma::vec bound_max(const int &, const arma::vec &, const std::vector &, const double &, const double &); - -//This function computes the minimal vector bound derivative -arma::vec dbound_min(const int &, const arma::vec &, const std::vector &, const double &, const double &); - -//This function computes the minimal vector bound derivative -arma::vec dbound_max(const int &, const arma::vec &, const std::vector &, const double &, const double &); - -//This function computes the weight coefficient vector -arma::vec calcW(const int &, const int &, const arma::Col &, const arma::vec &, const std::vector &, const std::vector &, const std::vector &); - -//This function computes the gradient of the cost function -arma::vec G_cost(const arma::mat &S, const arma::vec &W, const arma::vec &Dv, const arma::vec &L_min, const arma::vec &L_max); - -///Levenberg-Marquardt matrix, with bounds -arma::mat LevMarq(const arma::mat &H, const double &lambdaLM, const arma::vec &L_min, const arma::vec &L_max); - -//This function computes the increment Dp of the parameter vector according to a Levenberg-Marquardt algorithm -arma::vec calcDp(const arma::mat &, const arma::vec &, const arma::vec &, const arma::vec &, const arma::vec &, const std::vector &, const double &, const double &, const double &, const int &, arma::Col&); - - -/** @} */ // end of identification group - -} //namespace simcoon - diff --git a/include/simcoon/Simulation/Identification/parameters.hpp b/include/simcoon/Simulation/Identification/parameters.hpp deleted file mode 100755 index 5af3bf480..000000000 --- a/include/simcoon/Simulation/Identification/parameters.hpp +++ /dev/null @@ -1,79 +0,0 @@ -/* This file is part of simcoon. - - simcoon is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - simcoon is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with simcoon. If not, see . - - */ - -///@file parameters.hpp -///@brief Handle of input parameters -///@author Chemisky -///@version 1.0 - -#pragma once - -#include -#include - -namespace simcoon{ - -/** - * @file parameters.hpp - * @brief Parameter identification functions. - */ - -/** @addtogroup identification - * @{ - */ - - -//====================================== -class parameters -//====================================== -{ - private: - - protected: - - public : - - int number; //number of the parameters - double value; //Value of the parameter - - double min_value; //Minimum value of the parameter - double max_value; //Maximum value of the parameter - - std::string key; //A unique key utilized to replace the parameters in file(s) - int ninput_files; - std::vector input_files; //vector of files impacted (automaticaly filed for some parameter types) - - parameters(); //default constructor - parameters(const int&, const double&, const double&); //constructor - number, min and max values - parameters(const int&, const double&, const double&, const std::string&, const int &, const std::vector&); //Constructor with parameters - parameters(const parameters &); //Copy constructor - ~parameters(); - - int dimfiles () const {return ninput_files;} // returns the number of files associated to this parameter - - void update(const double &); - void resize(const int&); - - virtual parameters& operator = (const parameters&); - - friend std::ostream& operator << (std::ostream&, const parameters&); -}; - - -/** @} */ // end of identification group - -} //namespace simcoon diff --git a/include/simcoon/Simulation/Identification/read.hpp b/include/simcoon/Simulation/Identification/read.hpp deleted file mode 100755 index 607cf2f5b..000000000 --- a/include/simcoon/Simulation/Identification/read.hpp +++ /dev/null @@ -1,65 +0,0 @@ -/* This file is part of simcoon. - - simcoon is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - simcoon is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with simcoon. If not, see . - - */ - -///@file read.hpp -///@brief Generation of the complex objects for identification library -///@author Chemisky -///@version 1.0 - -#pragma once - -#include -#include -#include "parameters.hpp" -#include "constants.hpp" -#include "opti_data.hpp" - -namespace simcoon{ - -/** - * @file read.hpp - * @brief Parameter identification functions. - */ - -/** @addtogroup identification - * @{ - */ - - -//Generation of the parameters from the parameters file -void read_parameters(const int &, std::vector &); - -void read_constants(const int &, std::vector &, const int &); - -void read_data_exp(const int &, std::vector &); - -void read_data_weights(const int &, arma::Col &, arma::vec &, std::vector &, std::vector &, const std::vector &); - -void read_data_num(const int &, const std::vector &, std::vector &); - -//Read the essential control parameters of the optimization algorithm -void ident_essentials(int &, int &, int &, const std::string &, const std::string &); - -//Read the control parameters of the optimization algorithm -void ident_control(int &, int &, int &, int &, int &, int &, int &, double &, double &, double &, double &, double &, double &, const std::string &, const std::string &); - -void read_gen(int &, arma::mat &, const int &); - - -/** @} */ // end of identification group - -} //namespace simcoon diff --git a/include/simcoon/Simulation/Identification/script.hpp b/include/simcoon/Simulation/Identification/script.hpp deleted file mode 100755 index af1234b25..000000000 --- a/include/simcoon/Simulation/Identification/script.hpp +++ /dev/null @@ -1,75 +0,0 @@ -/* This file is part of simcoon. - - simcoon is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - simcoon is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with simcoon. If not, see . - - */ - -///@file script.hpp -///@brief Scripts that allows to run identification algorithms based on Smart+ Control functions -///@version 1.0 - -#pragma once - -#include -#include -#include "constants.hpp" -#include "parameters.hpp" -#include "opti_data.hpp" -#include "individual.hpp" -#include "generation.hpp" - -namespace simcoon{ - -/** - * @file script.hpp - * @brief Parameter identification functions. - */ - -/** @addtogroup identification - * @{ - */ - - -//This function will copy the parameters files -void copy_parameters(const std::vector &, const std::string &, const std::string &); - -//This function will copy the parameters files -void copy_constants(const std::vector &, const std::string &, const std::string &); - -//This function will replace the keys by the parameters -void apply_parameters(const std::vector &, const std::string &); - -//This function will replace the keys by the parameters -void apply_constants(const std::vector &, const std::string &); - -//Read the control parameters of the optimization algorithm -void launch_solver(const generation &, const int &, std::vector &, std::vector &, const std::string &, const std::string &, const std::string &, const std::string &, const std::string&); - -//Read the control parameters of the optimization algorithm -void launch_odf(const generation &, std::vector &, const std::string &, const std::string &, const std::string &, const std::string &, const std::string &, const std::string&); - -//Read the control parameters of the optimization algorithm - void launch_func_N(const generation &, const int &, std::vector &, std::vector &, const std::string &, const std::string &, const std::string &, const std::string &, const std::string &, const std::string&); - -void run_simulation(const std::string &, const individual &, const int &, std::vector &, std::vector &, std::vector &, const std::string &, const std::string &, const std::string &, const std::string &, const std::string&); - -double calc_cost(const arma::vec &, arma::vec &, const arma::vec &, const std::vector &, const std::vector &, const int &, const int &); - -arma::mat calc_sensi(const individual &, generation &, const std::string &, const int &, const int &, std::vector &, std::vector &, arma::vec &, std::vector &, std::vector &, const std::string &, const std::string &, const std::string &, const std::string &, const int &, const arma::vec &, const std::string&); - - - -/** @} */ // end of identification group - -} //namespace simcoon diff --git a/pyproject.toml b/pyproject.toml index a009601da..f94e54c28 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -61,6 +61,9 @@ Changelog = "https://github.com/3MAH/simcoon/releases" dev = [ "pytest>=7.0", ] +identify = [ + "scikit-learn>=1.0", +] # ============================================================================= # scikit-build-core configuration diff --git a/python-setup/simcoon/__init__.py b/python-setup/simcoon/__init__.py index 09d94462c..0a09f0192 100755 --- a/python-setup/simcoon/__init__.py +++ b/python-setup/simcoon/__init__.py @@ -1,6 +1,7 @@ from simcoon._core import * from simcoon.__version__ import __version__ from simcoon.rotation import Rotation # override _CppRotation from star-import +from simcoon.identify import identification, calc_cost # Backward compatibility alias - simmit was the legacy module name from simcoon import _core as simmit diff --git a/python-setup/simcoon/constant.py b/python-setup/simcoon/constant.py index cef09d796..9b1616986 100644 --- a/python-setup/simcoon/constant.py +++ b/python-setup/simcoon/constant.py @@ -118,6 +118,6 @@ def apply_constants( with open(mod_files, "r", encoding="utf-8") as in_files: content = in_files.read() - modified_content = content.replace(const.key, str(const.value)) + modified_content = content.replace(co.key, str(co.value)) with open(mod_files, "w", encoding="utf-8") as ou_files: ou_files.write(modified_content) diff --git a/python-setup/simcoon/data.py b/python-setup/simcoon/data.py index 29a8cf3ba..11d45dde0 100644 --- a/python-setup/simcoon/data.py +++ b/python-setup/simcoon/data.py @@ -1,7 +1,6 @@ from typing import List, Optional import numpy as np import numpy.typing as npt -import glob np.float_ = np.float64 @@ -48,43 +47,3 @@ def write_input_and_tab_files( i += 1 -def write_files_exp(list_data: List[Data], - exp_data_path: str = "exp_data/", - path: str = "data/", - ) -> None: - list_exp_input_files_names = glob.glob("input_data_*.txt", root_dir=exp_data_path) - list_nb_columns_in_files = [] - list_nb_observation_columns = [] - list_observation_columns_indices = [] - for element in list_data: - nb_columns_in_files = ( - element.increments.ndim - + element.time.ndim - + element.control.ndim - + element.observation.ndim - ) - nb_observation_columns = element.observation.ndim - observation_columns_indices = [ - i - for i in range( - nb_columns_in_files - element.observation.ndim, nb_columns_in_files - ) - ] - list_nb_columns_in_files.append(nb_columns_in_files) - list_nb_observation_columns.append(nb_observation_columns) - list_observation_columns_indices.append(observation_columns_indices) - with open(path + "files_exp.inp", "w+") as file: - file.write("#Name_of_the_exp_files\n") - for file_name in list_exp_input_files_names: - file.write(f"{file_name}\n") - file.write("\n#EXP_Nb_columns_in_files\n") - for nb_col_file in list_nb_columns_in_files: - file.write(f"{nb_col_file}\n") - file.write("\n#EXP_Nb_columns_to_identify\n") - for nb_obs_col in list_nb_observation_columns: - file.write(f"{nb_obs_col}\n") - file.write("\n#EXP_colums_to_identify\n") - for indices_list in list_observation_columns_indices: - file.write(" ".join(str(val) for val in indices_list)) - file.write("\n") - file.close() diff --git a/python-setup/simcoon/identify.py b/python-setup/simcoon/identify.py new file mode 100644 index 000000000..f2d230261 --- /dev/null +++ b/python-setup/simcoon/identify.py @@ -0,0 +1,317 @@ +""" +Identification utilities for simcoon. + +Provides ``identification()`` (wraps ``scipy.optimize.differential_evolution``) +and ``calc_cost()`` (multi-level weighted cost function for parameter +identification from multiple tests). +""" + +from typing import Callable, List, Optional, Union + +import numpy as np +from scipy.optimize import differential_evolution + + +def identification( + cost_fn: Callable, + parameters: list, + method: str = "differential_evolution", + **kwargs, +): + """ + Run parameter identification using scipy global optimization. + + This function wraps ``scipy.optimize.differential_evolution`` using the + bounds defined in the ``Parameter`` objects. After optimization, the + identified values are written back to each ``Parameter.value``. + + Parameters + ---------- + cost_fn : callable + Cost function ``f(x) -> float`` where ``x`` is a 1-D array of + parameter values (same order as *parameters*). + parameters : list of Parameter + Parameter objects whose ``.bounds`` define the search space. + method : str, optional + Optimization method. Currently only ``"differential_evolution"`` + is supported. Default: ``"differential_evolution"``. + **kwargs + Extra keyword arguments forwarded to the scipy optimizer. + Common options: ``maxiter``, ``popsize``, ``tol``, ``seed``, + ``polish`` (default ``True``), ``disp``. + + Returns + ------- + scipy.optimize.OptimizeResult + The full scipy result object. ``result.x`` contains the + identified parameter values. + + Examples + -------- + >>> from simcoon.parameter import Parameter + >>> from simcoon.identify import identification + >>> params = [ + ... Parameter(0, bounds=(10000, 200000), key="@Ef", + ... sim_input_files=["material.dat"]), + ... ] + >>> result = identification(my_cost, params, seed=42) + >>> print(f"Identified E = {params[0].value:.0f}") + """ + if method != "differential_evolution": + raise ValueError( + f"Unknown method '{method}'. " + "Currently only 'differential_evolution' is supported." + ) + + bounds = [p.bounds for p in parameters] + + # Sensible defaults + kwargs.setdefault("polish", True) + + result = differential_evolution(cost_fn, bounds=bounds, **kwargs) + + # Write back identified values + for p, val in zip(parameters, result.x): + p.value = val + + return result + + +def calc_cost( + y_exp: List[np.ndarray], + y_num: List[np.ndarray], + w_test: Optional[np.ndarray] = None, + w_response: Optional[List[np.ndarray]] = None, + w_point: Optional[List[np.ndarray]] = None, + metric: str = "mse", +): + """ + Compute a weighted cost between experimental and numerical data. + + The data is organized per test (experiment), each test being a 2-D + array of shape ``(n_points, n_responses)``. Three levels of weights + are combined multiplicatively, mirroring the classical identification + cost function: + + .. math:: + + C = \\sum_i \\sum_k \\sum_j + W^{\\text{test}}_i \\; + W^{\\text{resp}}_{i,k} \\; + W^{\\text{pt}}_{i,k,j} \\; + \\bigl(y^{\\exp}_{i,k,j} - y^{\\num}_{i,k,j}\\bigr)^2 + + Parameters + ---------- + y_exp : list of ndarray, each (n_points, n_responses) or (n_points,) + Experimental data, one array per test. + y_num : list of ndarray, same shapes as *y_exp* + Numerical (model) data, one array per test. + w_test : ndarray of shape (n_tests,), optional + Weight per test. ``None`` means uniform (1.0). + w_response : list of ndarray, each (n_responses,), optional + Weight per response type, for each test. ``None`` means uniform. + w_point : list of ndarray, each (n_points, n_responses), optional + Weight per individual data point. ``None`` means uniform. + metric : str, optional + Cost metric. Built-in (numpy): + + - ``"mse"`` — Mean Squared Error (default) + - ``"nmse"`` — Normalized MSE (divided by variance of all data) + - ``"nmse_per_response"`` — NMSE computed per response column, + then averaged. Each column is divided by its own + ``sum(y_exp²)``, balancing responses of different magnitudes + (e.g., force in N vs displacement in mm). + - ``"rmse"`` — Root Mean Squared Error + - ``"mae"`` — Mean Absolute Error + + With scikit-learn installed (``pip install simcoon[identify]``): + ``"r2"`` and any ``sklearn.metrics`` function that accepts + ``sample_weight``. + + Returns + ------- + float + The scalar cost value. + + Examples + -------- + Simple MSE over two tensile tests: + + >>> import numpy as np + >>> from simcoon.identify import calc_cost + >>> y_exp = [np.array([100, 200, 300]), np.array([150, 250])] + >>> y_num = [np.array([105, 195, 310]), np.array([148, 260])] + >>> calc_cost(y_exp, y_num) # simple MSE + 50.6 + + NMSE per response (balances force vs displacement): + + >>> y_exp = [np.column_stack([force_exp, disp_exp])] + >>> y_num = [np.column_stack([force_num, disp_num])] + >>> calc_cost(y_exp, y_num, metric='nmse_per_response') + """ + n_tests = len(y_exp) + if len(y_num) != n_tests: + raise ValueError( + f"y_exp has {n_tests} tests but y_num has {len(y_num)}" + ) + + # Ensure 2-D + y_exp_2d = [np.atleast_2d(y) if y.ndim == 1 else y for y in y_exp] + y_num_2d = [np.atleast_2d(y) if y.ndim == 1 else y for y in y_num] + # atleast_2d on 1-D gives (1, N) — we want (N, 1) + y_exp_2d = [y.T if y_orig.ndim == 1 else y + for y, y_orig in zip(y_exp_2d, y_exp)] + y_num_2d = [y.T if y_orig.ndim == 1 else y + for y, y_orig in zip(y_num_2d, y_num)] + + # Handle nmse_per_response separately (per-column computation) + if metric == "nmse_per_response": + return _nmse_per_response( + y_exp_2d, y_num_2d, n_tests, w_test, w_response, w_point, + ) + + # Build flat vectors and weight vector + all_exp = [] + all_num = [] + all_w = [] + + for i in range(n_tests): + exp_i = y_exp_2d[i] + num_i = y_num_2d[i] + n_pts, n_resp = exp_i.shape + + if num_i.shape != exp_i.shape: + raise ValueError( + f"Test {i}: y_exp shape {exp_i.shape} != " + f"y_num shape {num_i.shape}" + ) + + W_i = np.ones_like(exp_i) + + # Level 1: per-test weight + if w_test is not None: + W_i *= w_test[i] + + # Level 2: per-response weight + if w_response is not None: + for k in range(n_resp): + W_i[:, k] *= w_response[i][k] + + # Level 3: per-point weight + if w_point is not None: + W_i *= np.abs(w_point[i]) + + all_exp.append(exp_i.ravel()) + all_num.append(num_i.ravel()) + all_w.append(W_i.ravel()) + + y_exp_flat = np.concatenate(all_exp) + y_num_flat = np.concatenate(all_num) + w_flat = np.concatenate(all_w) + + return _compute_metric(y_exp_flat, y_num_flat, w_flat, metric) + + +def _nmse_per_response( + y_exp_2d, y_num_2d, n_tests, w_test, w_response, w_point, +): + """Compute NMSE independently per response column, then average.""" + # Collect all columns across tests + # First pass: determine n_resp per test and validate + col_costs = {} # col_index -> list of (mse_col, denom_col, weight) + + for i in range(n_tests): + exp_i = y_exp_2d[i] + num_i = y_num_2d[i] + n_pts, n_resp = exp_i.shape + + if num_i.shape != exp_i.shape: + raise ValueError( + f"Test {i}: y_exp shape {exp_i.shape} != " + f"y_num shape {num_i.shape}" + ) + + wt = w_test[i] if w_test is not None else 1.0 + + for k in range(n_resp): + wr = w_response[i][k] if w_response is not None else 1.0 + + residuals = exp_i[:, k] - num_i[:, k] + wp = (np.abs(w_point[i][:, k]) if w_point is not None + else np.ones(n_pts)) + + w_combined = wt * wr * wp + weighted_sse = np.sum(w_combined * residuals ** 2) + denom = np.sum(exp_i[:, k] ** 2) + + if k not in col_costs: + col_costs[k] = {"sse": 0.0, "denom": 0.0} + col_costs[k]["sse"] += weighted_sse + col_costs[k]["denom"] += denom + + # Average NMSE across response columns + nmse_values = [] + for k in sorted(col_costs): + denom = col_costs[k]["denom"] + if denom > 1e-30: + nmse_values.append(col_costs[k]["sse"] / denom) + else: + nmse_values.append(col_costs[k]["sse"]) + + return float(np.mean(nmse_values)) + + +def _compute_metric( + y_exp: np.ndarray, + y_num: np.ndarray, + w: np.ndarray, + metric: str, +) -> float: + """Compute the requested metric, using sklearn if available.""" + residuals = y_exp - y_num + + # Built-in metrics (numpy only) + if metric == "mse": + return float(np.average(residuals ** 2, weights=w)) + + if metric == "nmse": + mse = np.average(residuals ** 2, weights=w) + var = np.average((y_exp - np.average(y_exp, weights=w)) ** 2, weights=w) + return float(mse / var) if var > 1e-30 else float(mse) + + if metric == "rmse": + return float(np.sqrt(np.average(residuals ** 2, weights=w))) + + if metric == "mae": + return float(np.average(np.abs(residuals), weights=w)) + + # sklearn metrics + try: + import sklearn.metrics as skm + except ImportError: + raise ImportError( + f"Metric '{metric}' requires scikit-learn. Install it with:\n" + " pip install scikit-learn\n" + " # or\n" + " conda install -c conda-forge scikit-learn" + ) + + if metric == "r2": + return float(skm.r2_score(y_exp, y_num, sample_weight=w)) + + if metric == "mean_squared_error": + return float(skm.mean_squared_error(y_exp, y_num, sample_weight=w)) + + if metric == "mean_absolute_error": + return float(skm.mean_absolute_error(y_exp, y_num, sample_weight=w)) + + if hasattr(skm, metric): + fn = getattr(skm, metric) + return float(fn(y_exp, y_num, sample_weight=w)) + + raise ValueError( + f"Unknown metric '{metric}'. Built-in: mse, nmse, rmse, mae. " + f"With scikit-learn: r2, mean_squared_error, mean_absolute_error, etc." + ) diff --git a/python-setup/simcoon/parameter.py b/python-setup/simcoon/parameter.py index 47decd95c..7045ba004 100644 --- a/python-setup/simcoon/parameter.py +++ b/python-setup/simcoon/parameter.py @@ -29,6 +29,14 @@ def __init__( self._value = None + def __repr__(self) -> str: + val = self.value + return ( + f"Parameter(number={self.number}, value={val}, " + f"bounds={self.bounds}, key='{self.key}', " + f"sim_input_files={self.sim_input_files})" + ) + @property def value(self) -> float: if self._value is not None: diff --git a/simcoon-python-builder/CMakeLists.txt b/simcoon-python-builder/CMakeLists.txt index fb74bba9f..43395236c 100755 --- a/simcoon-python-builder/CMakeLists.txt +++ b/simcoon-python-builder/CMakeLists.txt @@ -39,12 +39,6 @@ pybind11_add_module(_core # Homogenization src/python_wrappers/Libraries/Homogenization/eshelby.cpp - # Identification - src/python_wrappers/Libraries/Identification/constants.cpp - src/python_wrappers/Libraries/Identification/identification.cpp - src/python_wrappers/Libraries/Identification/optimize.cpp - src/python_wrappers/Libraries/Identification/parameters.cpp - # Material src/python_wrappers/Libraries/Material/ODF.cpp diff --git a/simcoon-python-builder/include/simcoon/python_wrappers/Libraries/Identification/constants.hpp b/simcoon-python-builder/include/simcoon/python_wrappers/Libraries/Identification/constants.hpp deleted file mode 100755 index f73dc1b6b..000000000 --- a/simcoon-python-builder/include/simcoon/python_wrappers/Libraries/Identification/constants.hpp +++ /dev/null @@ -1,19 +0,0 @@ - -#pragma once -#include -#include -#include - -namespace simpy{ - -simcoon::constants build_constants_full(const int &, const double &, const pybind11::array_t &, const std::string &, const int &, const pybind11::list &); - -pybind11::array_t constants_get_input_values(simcoon::constants &); - -pybind11::list constants_get_input_files(simcoon::constants &); - -void constants_set_input_values(simcoon::constants &, const pybind11::array_t &); - -void constants_set_input_files(simcoon::constants &, const pybind11::list &); - -} //namespace simcoon diff --git a/simcoon-python-builder/include/simcoon/python_wrappers/Libraries/Identification/identification.hpp b/simcoon-python-builder/include/simcoon/python_wrappers/Libraries/Identification/identification.hpp deleted file mode 100755 index c59803f7c..000000000 --- a/simcoon-python-builder/include/simcoon/python_wrappers/Libraries/Identification/identification.hpp +++ /dev/null @@ -1,24 +0,0 @@ -#pragma once -#include -#include - -namespace simpy{ - -//This function computes the response of materials for an homogeneous mixed thermomechanical loading path -void identification(const std::string &, const int &, const int &, const int &, const int &, const int &, const int &, const int &, const int &, const std::string &, const std::string &, const std::string &, const std::string &, const std::string &); - -pybind11::list read_constants_py(const int &, const int &); - -void copy_constants_py(const pybind11::list &, const std::string &, const std::string &); - -void apply_constants_py(const pybind11::list &, const std::string &); - -pybind11::list read_parameters_py(const int &); - -void copy_parameters_py(const pybind11::list &, const std::string &, const std::string &); - -void apply_parameters_py(const pybind11::list &, const std::string &); - -double calc_cost(const int &, const pybind11::list &); - -} //namespace simpy diff --git a/simcoon-python-builder/include/simcoon/python_wrappers/Libraries/Identification/optimize.hpp b/simcoon-python-builder/include/simcoon/python_wrappers/Libraries/Identification/optimize.hpp deleted file mode 100755 index 35fd17b77..000000000 --- a/simcoon-python-builder/include/simcoon/python_wrappers/Libraries/Identification/optimize.hpp +++ /dev/null @@ -1,10 +0,0 @@ -#pragma once -#include -#include - -namespace simpy{ - -//This function computes the response of materials for an homogeneous mixed thermomechanical loading path - double cost_solver(const pybind11::array_t &); - -} //namespace simpy \ No newline at end of file diff --git a/simcoon-python-builder/include/simcoon/python_wrappers/Libraries/Identification/parameters.hpp b/simcoon-python-builder/include/simcoon/python_wrappers/Libraries/Identification/parameters.hpp deleted file mode 100755 index 511a52ab7..000000000 --- a/simcoon-python-builder/include/simcoon/python_wrappers/Libraries/Identification/parameters.hpp +++ /dev/null @@ -1,14 +0,0 @@ -#pragma once -#include -#include -#include - -namespace simpy{ - -simcoon::parameters build_parameters_full(const int &, const double&, const double &, const std::string&, const int &, const pybind11::list &); - -pybind11::list parameters_get_input_files(simcoon::parameters &); - -void parameters_set_input_files(simcoon::parameters &, const pybind11::list &); - -} //namespace simcoon diff --git a/simcoon-python-builder/src/python_wrappers/Libraries/Identification/constants.cpp b/simcoon-python-builder/src/python_wrappers/Libraries/Identification/constants.cpp deleted file mode 100755 index c41d99bd5..000000000 --- a/simcoon-python-builder/src/python_wrappers/Libraries/Identification/constants.cpp +++ /dev/null @@ -1,60 +0,0 @@ -#include -#include -#include - -#include -#include -#include -#include - -#include -#include - -using namespace std; -using namespace arma; -namespace py=pybind11; - -namespace simpy{ - -//------------------------------------------------------------- -simcoon::constants build_constants_full(const int &mnumber, const double &mvalue, const py::array_t &minput_values, const std::string &mkey, const int &mninput_files, const py::list &minput_files) -//------------------------------------------------------------- -{ - simcoon::constants a; - a.number = mnumber; - a.value = mvalue; - a.input_values = carma::arr_to_col(minput_values); - a.key = mkey; - a.ninput_files = mninput_files; - a.input_files = minput_files.cast>(); - return a; -} - -//------------------------------------------------------ -py::array_t constants_get_input_values(simcoon::constants &self) { - return carma::col_to_arr(self.input_values); -} -//------------------------------------------------------ - -//------------------------------------------------------ -py::list constants_get_input_files(simcoon::constants &self) { - py::list list_to_return = py::cast(self.input_files); - return list_to_return; -} -//------------------------------------------------------ - -//------------------------------------------------------ -void constants_set_input_values(simcoon::constants &self, const py::array_t &minput_values) { - self.input_values = carma::arr_to_col(minput_values); -} -//------------------------------------------------------ - -//------------------------------------------------------ -void constants_set_input_files(simcoon::constants &self, const py::list &minput_files) { - self.input_files = minput_files.cast>(); - self.ninput_files = self.input_files.size(); -} -//------------------------------------------------------ - - -} //namespace simpy \ No newline at end of file diff --git a/simcoon-python-builder/src/python_wrappers/Libraries/Identification/identification.cpp b/simcoon-python-builder/src/python_wrappers/Libraries/Identification/identification.cpp deleted file mode 100755 index 7bc42d1f0..000000000 --- a/simcoon-python-builder/src/python_wrappers/Libraries/Identification/identification.cpp +++ /dev/null @@ -1,121 +0,0 @@ -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -using namespace std; -using namespace arma; -namespace py=pybind11; - -namespace simpy { - -//This function computes the identifcation of materials parameters for one/multiple homogeneous mixed thermomechanical loading experiment -void identification(const std::string &simul_type_py, const int &n_param, const int &n_consts, const int &nfiles, const int &ngen, const int &aleaspace, const int &pop_py, const int &ngboys, const int &maxpop, const std::string &path_data_py, const std::string &path_keys_py, const std::string &path_results_py, const std::string &materialfile_py, const std::string &outputfile_py) { - - int apop = 0; - int spop = 0; - - if(aleaspace == 2) - apop = pop_py; - else if(aleaspace < 2) - spop = pop_py; - - int station_nb = 6; - double station_lim = 1.E-12; - simcoon::run_identification(simul_type_py,n_param, n_consts, nfiles, ngen, aleaspace, apop, spop, ngboys, maxpop, station_nb, station_lim, path_data_py, path_keys_py, path_results_py, materialfile_py, outputfile_py); -} - -py::list read_constants_py(const int &nconstants, const int &nfiles) { - std::vector consts(nconstants); - py::list list_to_return = py::cast(consts); - return list_to_return; -} - -py::list read_parameters_py(const int &nparams) { - std::vector params(nparams); - py::list list_to_return = py::cast(params); - return list_to_return; -} - -//This function will copy the constant files -void copy_constants_py(const py::list &consts_py, const string &src_path, const string &dst_path) { - - std::vector consts = consts_py.cast>(); - simcoon::copy_constants(consts, src_path, dst_path); -} - -//This function will copy the parameters files -void copy_parameters_py(const py::list ¶ms_py, const string &src_path, const string &dst_path) { - - std::vector params = params_py.cast>(); - simcoon::copy_parameters(params, src_path, dst_path); -} - -void apply_constants_py(const py::list &consts_py, const string &dst_path) { - - std::vector consts = consts_py.cast>(); - simcoon::apply_constants(consts, dst_path); -} - -void apply_parameters_py(const py::list ¶ms_py, const string &dst_path) { - - std::vector params = params_py.cast>(); - simcoon::apply_parameters(params, dst_path); -} - -double calc_cost(const int &nfiles, const py::list &data_num_names_list) { - - //Get the data structures - std::vector data_exp(nfiles); - std::vector data_weight(nfiles); - std::vector data_num(nfiles); - - Col weight_types(3); - vec weight_files = zeros(nfiles); - vector weight_cols(nfiles); - - simcoon::read_data_exp(nfiles, data_exp); - simcoon::read_data_weights(nfiles, weight_types, weight_files, weight_cols, data_weight, data_exp); - simcoon::read_data_num(nfiles, data_exp, data_num); - - /// Get the data vectors - ///Import of the experimental data - string data_exp_folder="exp_data"; - string data_num_folder="num_data"; - - int sizev = 0; - for(int i=0; i(); - - data_exp[i].import(data_exp_folder); - data_weight[i].import(data_exp_folder); - sizev += data_exp[i].ndata * data_exp[i].ninfo; - - data_num[i].name = data_num_item; - data_num[i].import(data_num_folder); - } - - ///Computation of the cost function - vec vexp = simcoon::calcV(data_exp, data_exp, nfiles, sizev); - vec vnum = simcoon::calcV(data_num, data_exp, nfiles, sizev); - vec W = simcoon::calcW(sizev, nfiles, weight_types, weight_files, weight_cols, data_weight, data_exp); - - return simcoon::calcC(vexp, vnum, W); -} - - -} //namepsace simpy diff --git a/simcoon-python-builder/src/python_wrappers/Libraries/Identification/optimize.cpp b/simcoon-python-builder/src/python_wrappers/Libraries/Identification/optimize.cpp deleted file mode 100755 index 8a0bd97f6..000000000 --- a/simcoon-python-builder/src/python_wrappers/Libraries/Identification/optimize.cpp +++ /dev/null @@ -1,176 +0,0 @@ -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include - -using namespace std; -using namespace arma; -namespace py=pybind11; - -namespace simpy{ - -double cost_solver(const py::array_t &p_py) { - - //transform p in a vec - vec p = carma::arr_to_col(p_py); - - int n_param = 0; - int n_consts = 0; - int n_files = 0; - - simcoon::ident_essentials(n_param, n_consts, n_files, "data", "ident_essentials.inp"); - - if(n_param != int(p.n_elem)) { - cout << "Error : n_param ( = " << n_param << " informed in the file : ident_essentials.inp do not match with the size of p : " << p.n_elem << endl; - return 0.; - } - - vector params(n_param); //vector of parameters - vector consts(n_consts); //vector of constants - //Read the parameters and constants - read_parameters(n_param, params); - read_constants(n_consts, consts, n_files); - - //Get the data structures - std::vector data_exp(n_files); - std::vector data_weight(n_files); - std::vector data_num(n_files); - - Col weight_types(3); - vec weight_files = zeros(n_files); - vector weight_cols(n_files); - - simcoon::read_data_exp(n_files, data_exp); - simcoon::read_data_weights(n_files, weight_types, weight_files, weight_cols, data_weight, data_exp); - simcoon::read_data_num(n_files, data_exp, data_num); - - /// Get the data vectors - ///Import of the experimental data - string data_exp_folder="exp_data"; - string data_num_folder="num_data"; - string materialfile="material.dat"; - string data_num_name="simul.txt"; - string simul_type = "SOLVE"; - - string path_data="data"; - string path_keys="keys"; - string path_results="results"; - - string data_num_name_ext = data_num_name.substr(data_num_name.length()-4,data_num_name.length()); - string data_num_name_root = data_num_name.substr(0,data_num_name.length()-4); //to remove the extension - - simcoon::individual ind(n_param, 1, 0.); - ind.p = p; - simcoon::run_simulation(simul_type, ind, n_files, params, consts, data_num, data_num_folder, data_num_name, path_data, path_keys, materialfile); - - //Get the experimental data and build the exp vector, and get the size of vectors - int sizev = 0; - read_data_exp(n_files, data_exp); - for(int i=0; i &p_py) { - - //transform p in a vec - vec p = carma::arr_to_col(p_py); - - int n_param = 0; - int n_consts = 0; - int n_files = 0; - - simcoon::ident_essentials(n_param, n_consts, n_files, "data", "ident_essentials.inp"); - - if(n_param != int(p.n_elem)) { - cout << "Error : n_param ( = " << n_param << " informed in the file : ident_essentials.inp do not match with the size of p : " << p.n_elem << endl; - return 0.; - } - - vector params(n_param); //vector of parameters - vector consts(n_consts); //vector of constants - //Read the parameters and constants - read_parameters(n_param, params); - read_constants(n_consts, consts, n_files); - - //Get the data structures - std::vector data_exp(n_files); - std::vector data_weight(n_files); - std::vector data_num(n_files); - - Col weight_types(3); - vec weight_files = zeros(n_files); - vector weight_cols(n_files); - - simcoon::read_data_exp(n_files, data_exp); - simcoon::read_data_weights(n_files, weight_types, weight_files, weight_cols, data_weight, data_exp); - simcoon::read_data_num(n_files, data_exp, data_num); - - /// Get the data vectors - ///Import of the experimental data - string data_exp_folder="exp_data"; - string data_num_folder="num_data"; - string materialfile="material.dat"; - string data_num_name="simul.txt"; - string simul_type = "SOLVE"; - - string path_data="data"; - string path_keys="keys"; - string path_results="results"; - - string data_num_name_ext = data_num_name.substr(data_num_name.length()-4,data_num_name.length()); - string data_num_name_root = data_num_name.substr(0,data_num_name.length()-4); //to remove the extension - - simcoon::individual ind(n_param, 1, 0.); - ind.p = p; - simcoon::run_simulation(simul_type, ind, n_files, params, consts, data_num, data_num_folder, data_num_name, path_data, path_keys, materialfile); - - //Get the experimental data and build the exp vector, and get the size of vectors - int sizev = 0; - read_data_exp(n_files, data_exp); - for(int i=0; i -#include -#include - -#include -#include -#include -#include - -#include -#include - -using namespace std; -using namespace arma; -namespace py=pybind11; - -namespace simpy{ - -//------------------------------------------------------------- -simcoon::parameters build_parameters_full(const int &mnumber, const double &mmin_value, const double &mmax_value, const std::string &mkey, const int &mninput_files, const py::list &minput_files) -//------------------------------------------------------------- -{ - simcoon::parameters a; - a.number = mnumber; - a.min_value = mmin_value; - a.max_value = mmax_value; - a.value = (a.min_value+a.max_value)/2.; - a.key = mkey; - a.ninput_files = mninput_files; - a.input_files = minput_files.cast>(); - return a; -} - -//------------------------------------------------------ -py::list parameters_get_input_files(simcoon::parameters &self) { - py::list list_to_return = py::cast(self.input_files); - return list_to_return; -} -//------------------------------------------------------ - -//------------------------------------------------------ -void parameters_set_input_files(simcoon::parameters &self, const py::list &minput_values) { - self.input_files = minput_values.cast>(); - self.ninput_files = self.input_files.size(); -} -//------------------------------------------------------ - -} //namespace simpy \ No newline at end of file diff --git a/simcoon-python-builder/src/python_wrappers/python_module.cpp b/simcoon-python-builder/src/python_wrappers/python_module.cpp index 2a2c53cec..9a4540cc8 100755 --- a/simcoon-python-builder/src/python_wrappers/python_module.cpp +++ b/simcoon-python-builder/src/python_wrappers/python_module.cpp @@ -29,11 +29,6 @@ // #include // #include -#include -#include -#include -#include - #include #include #include @@ -238,7 +233,4 @@ PYBIND11_MODULE(_core, m) m.def("get_densities_ODF", &get_densities_ODF); m.def("ODF_discretization", &ODF_discretization); - // Register the from-python converters for identification - m.def("identification", &identification); - m.def("calc_cost", &calc_cost, "nfiles"_a, "data_num_name"_a); } diff --git a/simcoon-python-builder/test/parameter_test/test.py b/simcoon-python-builder/test/parameter_test/test.py index e38709203..42927b732 100644 --- a/simcoon-python-builder/test/parameter_test/test.py +++ b/simcoon-python-builder/test/parameter_test/test.py @@ -1,60 +1,260 @@ -import pytest +import os +import tempfile + import numpy as np -import numpy.typing as npt -from simcoon import _core as sim -from simcoon import parameter as par +import pytest + +from simcoon.parameter import Parameter, read_parameters, copy_parameters, apply_parameters +from simcoon.identify import identification, calc_cost + + +@pytest.fixture +def data_dir(): + return os.path.join(os.path.dirname(__file__), "data") + + +@pytest.fixture +def keys_dir(): + return os.path.join(os.path.dirname(__file__), "keys") + + +class TestReadParameters: + def test_read_parameters(self, data_dir): + params = read_parameters(os.path.join(data_dir, "parameters.inp")) + assert len(params) == 4 + + def test_first_parameter(self, data_dir): + params = read_parameters(os.path.join(data_dir, "parameters.inp")) + p = params[0] + assert p.number == 0 + assert p.bounds == (0.0, 180.0) + assert p.key == "@0p" + assert p.sim_input_files == ["Nellipsoids0.dat"] + + def test_parameter_default_value_is_midpoint(self, data_dir): + params = read_parameters(os.path.join(data_dir, "parameters.inp")) + p = params[0] + assert p.value == pytest.approx(90.0) + + def test_read_parameters_invalid_path(self): + with pytest.raises(FileNotFoundError): + read_parameters("nonexistent/parameters.inp") + + def test_read_parameters_invalid_type(self): + with pytest.raises(TypeError): + read_parameters(123) + + +class TestCopyParameters: + def test_copy_parameters(self, data_dir, keys_dir): + params = read_parameters(os.path.join(data_dir, "parameters.inp")) + with tempfile.TemporaryDirectory() as tmp: + copy_parameters(params, keys_dir, tmp) + assert os.path.exists(os.path.join(tmp, "Nellipsoids0.dat")) + + def test_copy_parameters_invalid_src(self, data_dir): + params = read_parameters(os.path.join(data_dir, "parameters.inp")) + with pytest.raises(TypeError): + copy_parameters(params, 123, "/tmp") + + +class TestApplyParameters: + def test_apply_parameters_replaces_keys(self, data_dir, keys_dir): + params = read_parameters(os.path.join(data_dir, "parameters.inp")) + params[0].value = 45.0 + params[1].value = 72000.0 + + with tempfile.TemporaryDirectory() as tmp: + copy_parameters(params, keys_dir, tmp) + apply_parameters(params, tmp) + + with open(os.path.join(tmp, "Nellipsoids0.dat"), "r") as f: + content = f.read() + + assert "@0p" not in content + assert "@1p" not in content + assert "45.0" in content + assert "72000.0" in content + + +class TestParameterRepr: + def test_repr(self): + p = Parameter( + number=0, bounds=(0.0, 180.0), key="@0p", + sim_input_files=["mat.dat"], + ) + r = repr(p) + assert "Parameter(" in r + assert "@0p" in r + assert "bounds=(0.0, 180.0)" in r + + +class TestIdentificationWorkflow: + """Test the full identification workflow: template -> apply -> forward model -> cost.""" + + def test_template_apply_no_residual_keys(self, data_dir, keys_dir): + """End-to-end: key substitution produces valid input (no residual @).""" + params = read_parameters(os.path.join(data_dir, "parameters.inp")) + params[0].value = 0.8 + params[1].value = 73000 + + with tempfile.TemporaryDirectory() as tmp: + copy_parameters(params, keys_dir, tmp) + apply_parameters(params, tmp) + + with open(os.path.join(tmp, "Nellipsoids0.dat"), "r") as f: + content = f.read() + + assert "@" not in content, "Residual keys found after apply_parameters" + assert "0.8" in content + assert "73000" in content + + def test_multiple_iterations_fresh_copy(self, data_dir, keys_dir): + """Each iteration starts from a fresh template (no stale values).""" + params = read_parameters(os.path.join(data_dir, "parameters.inp")) + + with tempfile.TemporaryDirectory() as tmp: + # First iteration + params[0].value = 0.7 + params[1].value = 50000 + copy_parameters(params, keys_dir, tmp) + apply_parameters(params, tmp) + + with open(os.path.join(tmp, "Nellipsoids0.dat"), "r") as f: + content1 = f.read() + assert "50000" in content1 + + # Second iteration with different values + params[0].value = 0.9 + params[1].value = 80000 + copy_parameters(params, keys_dir, tmp) + apply_parameters(params, tmp) + + with open(os.path.join(tmp, "Nellipsoids0.dat"), "r") as f: + content2 = f.read() + assert "80000" in content2 + assert "50000" not in content2, "Stale value from previous iteration" + + def test_bounds_available_for_optimizer(self, data_dir): + """Parameter.bounds can be used as scipy optimizer bounds.""" + params = read_parameters(os.path.join(data_dir, "parameters.inp")) + bounds = [p.bounds for p in params] + assert all(lo < hi for lo, hi in bounds) + assert bounds[0] == (0.0, 180.0) + -dir = os.path.dirname(os.path.realpath('__file__')) +class TestIdentification: + """Test the identification() wrapper around differential_evolution.""" -nstatev = 0 + def test_identifies_simple_quadratic(self): + """Identify minimum of (x - 3)^2 + (y - 7)^2.""" + params = [ + Parameter(0, bounds=(0, 10), key="@x"), + Parameter(1, bounds=(0, 10), key="@y"), + ] -nphases = 2 #The number of phases -num_file = 0 #The num of the file that contains the subphases -int1 = 50 -int2 = 50 -n_matrix = 0 + def cost(x): + return (x[0] - 3) ** 2 + (x[1] - 7) ** 2 -props = np.array([nphases, num_file, int1, int2, n_matrix], dtype='float') + result = identification(cost, params, seed=42, tol=1e-10) + assert result.success + assert params[0].value == pytest.approx(3.0, abs=1e-4) + assert params[1].value == pytest.approx(7.0, abs=1e-4) -path_data = dir + '/data' -path_keys = dir + '/keys' -pathfile = 'path.txt' + def test_values_written_back(self): + """After identification, Parameter.value holds the optimum.""" + params = [Parameter(0, bounds=(-5, 5), key="@a")] + result = identification(lambda x: (x[0] - 2.5) ** 2, params, seed=0) + assert params[0].value == pytest.approx(2.5, abs=1e-3) -param_list = par.read_parameters() + def test_unknown_method_raises(self): + params = [Parameter(0, bounds=(0, 1), key="@x")] + with pytest.raises(ValueError, match="Unknown method"): + identification(lambda x: x[0], params, method="bogus") -psi_rve = 0. -theta_rve = 0. -phi_rve = 0. +class TestCalcCost: + """Test the calc_cost() multi-level weighted cost function.""" -from simcoon import parameter as par + def test_simple_mse(self): + y_exp = [np.array([1.0, 2.0, 3.0])] + y_num = [np.array([1.1, 2.1, 3.1])] + cost = calc_cost(y_exp, y_num) + assert cost == pytest.approx(0.01, abs=1e-10) -dir = os.path.dirname(os.path.realpath('__file__')) -pylab.rcParams['figure.figsize'] = (18.0, 8.0) #configure the figure output size + def test_two_tests(self): + """Cost aggregates across multiple tests.""" + y_exp = [np.array([10.0]), np.array([20.0])] + y_num = [np.array([11.0]), np.array([22.0])] + # residuals: 1, 2 → MSE = (1 + 4) / 2 = 2.5 + cost = calc_cost(y_exp, y_num) + assert cost == pytest.approx(2.5) -nstatev = 0 + def test_w_test(self): + """Per-test weights scale the contribution of each test.""" + y_exp = [np.array([0.0]), np.array([0.0])] + y_num = [np.array([1.0]), np.array([1.0])] + # Without weights: MSE = 1.0 + # With w_test=[2, 0]: only first test counts, weighted avg = 2*1/2 = 1.0 + # Actually weighted average: (2*1 + 0*1)/(2+0) ... np.average uses sum(w*x)/sum(w) + # No — np.average(residuals**2, weights=w) = sum(w*r²)/sum(w) + cost_uniform = calc_cost(y_exp, y_num) + cost_weighted = calc_cost(y_exp, y_num, w_test=np.array([1.0, 0.0])) + # weighted: sum(w*r²)/sum(w) = (1*1+0*1)/(1+0) = 1.0 + assert cost_uniform == pytest.approx(1.0) + assert cost_weighted == pytest.approx(1.0) -nphases = 2 #The number of phases -num_file = 0 #The num of the file that contains the subphases -int1 = 50 -int2 = 50 -n_matrix = 0 + def test_2d_responses(self): + """Multiple response columns per test.""" + y_exp = [np.array([[100, 0.1], [200, 0.2]])] # (2 points, 2 responses) + y_num = [np.array([[110, 0.1], [200, 0.3]])] + cost = calc_cost(y_exp, y_num) + # residuals: [10, 0, 0, 0.1] → MSE = (100+0+0+0.01)/4 = 25.0025 + assert cost == pytest.approx(25.0025) -props = np.array([nphases, num_file, int1, int2, n_matrix], dtype='float') + def test_nmse_per_response(self): + """nmse_per_response balances responses of different magnitudes.""" + # Two responses: force (~1000 N) and displacement (~0.01 mm) + y_exp = [np.array([[1000.0, 0.01], [2000.0, 0.02]])] + y_num = [np.array([[1010.0, 0.015], [2010.0, 0.025]])] + # Without normalization, force residuals dominate (10² >> 0.005²) + cost_mse = calc_cost(y_exp, y_num, metric="mse") + # nmse_per_response normalizes each column by sum(exp²) + cost_nmse = calc_cost(y_exp, y_num, metric="nmse_per_response") + # Results must differ (force dominates MSE but not NMSE per response) + assert cost_mse != pytest.approx(cost_nmse) + assert cost_nmse > 0 + assert np.isfinite(cost_nmse) -#NPhases_file = dir + '/keys/Nellipsoids0.dat' -#NPhases = pd.read_csv(NPhases_file, delimiter=r'\s+', index_col=False, engine='python') -#NPhases[::] + def test_nmse_per_response_equal_columns(self): + """With identical columns, nmse_per_response equals standard NMSE.""" + y_exp = [np.array([[10.0], [20.0]])] + y_num = [np.array([[11.0], [21.0]])] + cost = calc_cost(y_exp, y_num, metric="nmse_per_response") + # SSE=2, denom=10²+20²=500 → NMSE=2/500=0.004 + assert cost == pytest.approx(2.0 / 500.0) -path_data = dir + '/data' -path_keys = dir + '/keys' -pathfile = 'path.txt' + def test_rmse(self): + y_exp = [np.array([0.0, 0.0])] + y_num = [np.array([3.0, 4.0])] + cost = calc_cost(y_exp, y_num, metric="rmse") + assert cost == pytest.approx(np.sqrt(12.5)) -param_list = par.read_parameters() + def test_mae(self): + y_exp = [np.array([0.0, 0.0])] + y_num = [np.array([3.0, -4.0])] + cost = calc_cost(y_exp, y_num, metric="mae") + assert cost == pytest.approx(3.5) -psi_rve = 0. -theta_rve = 0. -phi_rve = 0. + def test_mismatched_shapes_raises(self): + with pytest.raises(ValueError, match="shape"): + calc_cost([np.array([1, 2])], [np.array([1, 2, 3])]) + def test_mismatched_ntests_raises(self): + with pytest.raises(ValueError, match="tests"): + calc_cost([np.array([1])], [np.array([1]), np.array([2])]) -param_list = par.read_parameters(ncjlknl;jw) + def test_unknown_metric_without_sklearn(self): + """Unknown metric raises ValueError with helpful message.""" + with pytest.raises((ValueError, ImportError)): + calc_cost([np.array([1.0])], [np.array([2.0])], metric="bogus_metric_xyz") diff --git a/software/identification.cpp b/software/identification.cpp deleted file mode 100755 index 962f19e24..000000000 --- a/software/identification.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* This file is part of simcoon. - - simcoon is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - simcoon is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with simcoon. If not, see . - - */ - -///@file Identification_LM.cpp -///@brief main: to identify // SMA model based on several uniaxial tests // Micromechanical parameters in a multiscale model of a composite material -///@author Yves Chemisky, Boris Piotrowski, Nicolas Despringre -///@version 0.9 -///@date 01-18-2016 - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -using namespace std; -using namespace arma; -using namespace simcoon; - -int main() { - - ofstream result; ///Output stream, with parameters values and cost function - - int n_param; - int n_consts; - int nfiles = 0; //number of files for the identification - - //Parameters for the optimization software - int ngen; - int aleaspace; - int apop; - int spop; - int ngboys; - int maxpop; - int station_nb; - double station_lim; - double probaMut; - double pertu; - double c; ///Lagrange penalty parameters - double p0; - double lambdaLM; - //Read the identification control - - string path_data = "data"; - string path_keys = "keys"; - string path_results = "results"; - string materialfile = "material.dat"; - string outputfile = "id_params.txt"; - string simulfile = "simul.txt"; - - string file_essentials = "ident_essentials.inp"; - string file_control = "ident_control.inp"; - - string simul_type = "SOLVE"; - - try { - ident_essentials(n_param, n_consts, nfiles, path_data, file_essentials); - ident_control(ngen, aleaspace, apop, spop, ngboys, maxpop, station_nb, station_lim, probaMut, pertu, c, p0, lambdaLM, path_data, file_control); - } catch (const runtime_error& e) { - cerr << "Configuration error: " << e.what() << endl; - return 1; - } - run_identification(simul_type,n_param, n_consts, nfiles, ngen, aleaspace, apop, spop, ngboys, maxpop, station_nb, station_lim, path_data, path_keys, path_results, materialfile, outputfile, simulfile, probaMut, pertu, c, p0, lambdaLM); - -} diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f0e66c483..e0badc3c5 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -106,19 +106,6 @@ target_sources(simcoon PRIVATE Simulation/Geometry/geometry.cpp Simulation/Geometry/layer.cpp - # Simulation - Identification - Simulation/Identification/constants.cpp - Simulation/Identification/doe.cpp - Simulation/Identification/generation.cpp - Simulation/Identification/identification.cpp - Simulation/Identification/individual.cpp - Simulation/Identification/methods.cpp - Simulation/Identification/opti_data.cpp - Simulation/Identification/optimize.cpp - Simulation/Identification/parameters.cpp - Simulation/Identification/read.cpp - Simulation/Identification/script.cpp - # Simulation - Maths Simulation/Maths/lagrange.cpp Simulation/Maths/num_solve.cpp diff --git a/src/Simulation/Identification/constants.cpp b/src/Simulation/Identification/constants.cpp deleted file mode 100755 index c518b8801..000000000 --- a/src/Simulation/Identification/constants.cpp +++ /dev/null @@ -1,153 +0,0 @@ -/* This file is part of simcoon. - - simcoon is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - simcoon is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with simcoon. If not, see . - - */ - -///@file constants.cpp -///@brief Handle of input constants -///@version 0.9 - -#include -#include -#include -#include -#include -#include - -using namespace std; -using namespace arma; - -namespace simcoon{ - -//=====Private methods for constants=================================== - -//=====Public methods for constants============================================ - -//@brief default constructor -//------------------------------------------------------------- -constants::constants() -//------------------------------------------------------------- -{ - - number = 0; - value = 0.; //Initial Value of the parameter - ninput_files = 0; -} - -/*! - \brief Constructor - \param mnumber : number of the constant - \param nfiles : Number of files where the constant is present - */ - -//------------------------------------------------------------- -constants::constants(const int &mnumber, const int& nfiles) -//------------------------------------------------------------- -{ - assert(nfiles > 0); - - number = mnumber; - input_values.resize(nfiles); - value = 0.; - ninput_files = 0; -} - -/*! - \brief Constructor with parameters - \param mnumber : number of the constant - */ - -//------------------------------------------------------------- -constants::constants(const int &mnumber, const double &mvalue, const vec &minput_values, const string &mkey, const int &mninput_files, const std::vector &minput_files) -//------------------------------------------------------------- -{ - number = mnumber; - value = mvalue; - input_values = minput_values; - key = mkey; - ninput_files = mninput_files; - input_files = minput_files; -} - -/*! - \brief Copy constructor - \param ed opti_data object to duplicate - */ - -//------------------------------------------------------ -constants::constants(const constants& co) -//------------------------------------------------------ -{ - number=co.number; - value = co.value; - input_values = co.input_values; - key = co.key; - ninput_files = co.ninput_files; - input_files = co.input_files; -} - -/*! - \brief destructor - */ - -constants::~constants() {} - -//------------------------------------------------------------- -void constants::update(const int &file) -//------------------------------------------------------------- -{ - value = input_values(file); -} - -//------------------------------------------------------------- -void constants::resize(const int &n, const int &nfiles) -//------------------------------------------------------------- -{ - ninput_files = n; - input_files.resize(n); - input_values.resize(nfiles); -} - -//---------------------------------------------------------------------- -constants& constants::operator = (const constants& co) -//---------------------------------------------------------------------- -{ - number=co.number; - value = co.value; - input_values = co.input_values; - key = co.key; - ninput_files = co.ninput_files; - input_files = co.input_files; - - return *this; -} - -//-------------------------------------------------------------------------- -ostream& operator << (ostream& s, const constants& co) -//-------------------------------------------------------------------------- -{ - - s << "Display info on the parameter data\n"; - s << "Number of the parameter: " << co.number << "\n"; - s << "Number of files impacted and list of files: " << co.input_files.size() << "\n"; - - for (vector::const_iterator iter = co.input_files.begin(); iter != co.input_files.end(); iter++) { - cout << *iter << "\n"; - } - - return s; -} - -} //namespace simcoon \ No newline at end of file diff --git a/src/Simulation/Identification/doe.cpp b/src/Simulation/Identification/doe.cpp deleted file mode 100755 index 2a64f067d..000000000 --- a/src/Simulation/Identification/doe.cpp +++ /dev/null @@ -1,188 +0,0 @@ -/* This file is part of simcoon. - - simcoon is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - simcoon is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with simcoon. If not, see . - - */ - -///@file doe.cpp -///@brief Design of Experiments library - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace std; -using namespace arma; - -namespace simcoon{ - -mat doe_uniform(const int &spop, const int &n_param, const vector ¶ms) { - - double pfactor = 0.; - int pinc = 1; - int z = 1; - int pcol = 0; - - int n_samples = (int)pow(spop,n_param); - mat doe = zeros(n_samples, n_param); - - ///Determination of parameters_equally_spaced - for(int j=0; j ¶ms) { - - //This doe can only work if spop >=2 - assert(spop >= 2); - - double pfactor = 0.; - int pinc = 0; - int z = 1; - int pcol = 0; - - int n_samples = (int)pow(spop,n_param); - mat doe = zeros(n_samples, n_param); - - ///Determination of parameters_equally_spaced - for(int j=0; j ¶ms) { - - mat doe = zeros(n_samples, n_param); - - for(int j=0; j ¶ms, const double &lambda) { - - if(aleaspace==0) { - - ///Populate the space with equidistant values. First generation - int geninit_nindividuals = (int)pow(spop,n_param); - geninit.construct(geninit_nindividuals, n_param, idnumber, lambda); - - ///Determination of parameters_equally_spaced - mat samples = doe_uniform(spop, n_param, params); - - for(int j=0; j. - - */ - -///@file generation.cpp -///@brief generation for genetic algorithm (among others) -///@author Chemisky & Despringre -///@version 1.0 - -#include -#include -#include -#include -#include -#include - -using namespace std; -using namespace arma; - -namespace simcoon{ - -//=====Private methods for phases_characteristics=================================== - -//=====Public methods for phases_characteristics============================================ - -///@brief default constructor -//---------------------------------------------------------------------- -generation::generation() -//---------------------------------------------------------------------- -{ - -} - -///@brief Constructor -///@param n : number of individuals -///@param init boolean that indicates if the constructor has to initialize (default value is true) -//---------------------------------------------------------------------- -generation::generation(const int &n, const int &m, int &idnumber, const double &mlambda) -//---------------------------------------------------------------------- -{ - assert(n>0); - - for (int i=0; i0); - - for (int i=0; i0); - - double mini = -1.; - int posmini = 0; - individual temp; - unsigned int number_not_NaN = pop.size(); - - for(unsigned int i=0; i < number_not_NaN; i++) { - int check_nan = 0; - if (std::isnan(pop[i].cout)) { - check_nan++; - } - - if(check_nan > 0) { - temp = pop[i]; - pop.erase(pop.begin() + i); - pop.push_back(temp); - number_not_NaN--; - i--; - } - } - - for(unsigned int i=0; i < pop.size(); i++) { - pop[i].rank=i+1; - } - - for(unsigned int i=0; i < number_not_NaN-1; i++) { - mini=pop[i].cout; - posmini=i; - - for(unsigned int j=i; j < number_not_NaN; j++) { - if(pop[j].cout < mini) { - mini=pop[j].cout; - posmini=j; - } - } - temp=pop[posmini]; - pop[posmini]=pop[i]; - pop[i]=temp; - } - - for(unsigned int i=0; i < number_not_NaN; i++) { - pop[i].rank=i+1; - } - -} - -///@brief newid : A method to assign new id's to a generation -//---------------------------------------------------------------------- -void generation::newid(int &idnumber) -//---------------------------------------------------------------------- -{ - - assert(pop.size()>0); - - for (unsigned int i=0; i. - - */ - -///@file identification.cpp -///@brief The main identification function -///@version 1.0 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace std; -using namespace arma; - -namespace simcoon{ - -void run_identification(const std::string &simul_type, const int &n_param, const int &n_consts, const int &nfiles, const int &ngen, const int &aleaspace, int &apop, int &spop, const int &ngboys, const int &maxpop, const int &stationnarity_nb, const double &stationnarity_lim, const std::string &path_data, const std::string &path_keys, const std::string &path_results, const std::string &materialfile, const std::string &outputfile, const std::string &data_num_name, const double &probaMut, const double &pertu, const double &c, const double &p0, const double &lambdaLM) { - - std::string data_num_ext = data_num_name.substr(data_num_name.length()-4,data_num_name.length()); - std::string data_num_name_root = data_num_name.substr(0,data_num_name.length()-4); //to remove the extension - - cout << filesystem::current_path().string() << endl; - - //Check if the required directories exist: - if(!filesystem::is_directory(path_data)) { - cout << "error: the folder for the data, " << path_data << ", is not present" << endl; - return; - } - if(!filesystem::is_directory(path_keys)) { - cout << "error: the folder for the keys, " << path_keys << ", is not present" << endl; - return; - } - if(!filesystem::is_directory(path_results)) { - cout << "The folder for the results, " << path_results << ", is not present and has been created" << endl; - filesystem::create_directory(path_results); - } - - //Check consistency of data - if((aleaspace==0)||(aleaspace==1)) { - if(maxpop > spop*n_param) { - cout << "Please increase the mesh grid for the first generation (Space population) or reduce the max number population per subgeneration\n"; - exit(0); - } - } - else if((aleaspace==2)||(aleaspace==3)) { - if(maxpop > apop) { - cout << "Please increase the Space population or reduce the max number population per subgeneration\n"; - exit(0); - } - } - - if(ngboys > maxpop) { - cout << "Please increase the the max number population per subgeneration or reduce the number of gboys\n"; - exit(0); - } - - ///Allow non-repetitive pseudo-random number generation - srand(time(0)); - ofstream result; ///Output stream, with parameters values and cost function - - //Define the parameters - vector params(n_param); //vector of parameters - vector consts(n_consts); //vector of constants - vec Dp = zeros(n_param); - vec p = zeros(n_param); - - //Read the parameters and constants - read_parameters(n_param, params); - read_constants(n_consts, consts, nfiles); - - int idnumber=1; - int id0=0; - - //Get the experimental data file - string data_exp_folder="exp_data"; - if(!filesystem::is_directory(data_exp_folder)) { - cout << "The folder for the experimental data, " << data_exp_folder << ", is not present" << endl; - return; - } - - //Get the experimental data and build the exp vector, and get the size of vectors - int sizev = 0; - vector data_exp(nfiles); - read_data_exp(nfiles, data_exp); - for(int i=0; i data_weight(nfiles); - Col weight_types(3); - vec weight_files = zeros(nfiles); - vector weight_cols(nfiles); - read_data_weights(nfiles, weight_types, weight_files, weight_cols, data_weight, data_exp); - for(int i=0; i data_num(nfiles); - read_data_num(nfiles, data_exp, data_num); - vec vnum = zeros(sizev); //num vector - - //Data structure has been created. Next is the generation of structures to compute cost function and associated derivatives - mat S(sizev,n_param); - Col pb_col; - pb_col.zeros(n_param); - - result.open(outputfile, ios::out); - result << "g" << "\t"; - result << "nindividual" << "\t"; - result << "cost" << "\t"; - for(int i=0; i gen(ngen+1); - vector gboys(ngen+1); - - generation geninit; - int g=0; - - gen[g].construct(maxpop, n_param, id0, lambdaLM); - if(ngboys) { - gboys[g].construct(ngboys, n_param, id0, lambdaLM); - } - gen_initialize(geninit, spop, apop, idnumber, aleaspace, n_param, params, lambdaLM); - - string data_num_folder = "num_data"; - if(!filesystem::is_directory(data_num_folder)) { - cout << "The folder for the numerical data, " << data_num_folder << ", is not present and has been created" << endl; - filesystem::create_directory(data_num_folder); - } - - /// Run the simulations corresponding to each individual - /// The simulation input files should be ready! - for(int i=0; i cost_gb_cost_n(ngboys); - std::vector Dp_gb_n(ngboys); - - for(int i=0; i 1) { - - genetic(gen[g], gensons, idnumber, probaMut, pertu, params); - ///prepare the individuals to run - - for(int i=0; i params[j].max_value) - p(j) = params[j].max_value; - if(p(j) < params[j].min_value) - p(j) = params[j].min_value; - } - gboys[g].pop[i].p = p; - - if(gboys[g].pop[i].cout > cost_gb_cost_n[i]) { - //bad_des = true; - gboys[g].pop[i].lambda *= 3; - gboys[g].pop[i].p = gen[g].pop[i].p; - gboys[g].pop[i].cout = cost_gb_cost_n[i]; - } - else if(gboys[g].pop[i].cout < cost_gb_cost_n[i]) { - gboys[g].pop[i].lambda *= 0.5; - } - - } - - ///Find the bests - g++; - find_best(gen[g], gboys[g], gen[g-1], gboys[g-1], gensons, maxpop, n_param, id0); - write_results(result, outputfile, gen[g], g, maxpop, n_param); - - if(fabs(costnm1 - gen[g].pop[0].cout) < simcoon::iota) { - compt_des++; - } - else{ - compt_des = 0; - } - - if(gen[g].pop[0].cout < stationnarity_lim) { - compt_des = stationnarity_nb; - } - - cout << "Cost function (Best set of parameters) = " << gen[g].pop[0].cout << "\n"; - - //Replace the parameters - for (unsigned int k=0; kpath()); - } - - //Run the identified simulation and store results in the results folder - run_simulation(simul_type, gen[g].pop[0], nfiles, params, consts, data_num, path_results, data_num_name, path_data, path_keys, materialfile); - - for (int i = 0; i. - - */ - -///@file individual.hpp -///@brief individual for genetic algorithm (among others) -///@author Chemisky & Despringre -///@version 1.0 - -#include -#include -#include -#include -#include -#include - -using namespace std; -using namespace arma; - -namespace simcoon{ - -///@brief default constructor -//---------------------------------------------------------------------- -individual::individual() -//---------------------------------------------------------------------- -{ - np = 0; - cout = 0.; - id = 0; - rank=0; - lambda=0.; -} - -/*! - \brief Constructor - \param m : number of parameters - \param init boolean that indicates if the constructor has to initialize (default value is true) \n - \n\n - \f$ \textbf{Examples :} \f$ \n -*/ -//------------------------------------------------------------- -individual::individual(const int &n, const int &idnumber, const double &nlambda) -//------------------------------------------------------------- -{ - np = n; - cout = 0.; - id = idnumber; - rank = 0; - - if (n>0) { - p = zeros(n); - } - lambda=nlambda; -} - -/*! - \brief Copy constructor - \param gp individual object to duplicate -*/ -//------------------------------------------------------ -individual::individual(const individual& gp) -//------------------------------------------------------ -{ - np = gp.np; - cout=gp.cout; - id=gp.id; - rank=gp.rank; - p=gp.p; - lambda=gp.lambda; -} - -/*! - \brief destructor -*/ -individual::~individual() {} - -///@brief Construct method to construct an element that had size zero -//------------------------------------------------------------- -void individual::construct() -//------------------------------------------------------------- -{ - assert(np>0); - p = zeros(np); -} - -/*! - \brief Standard operator = for individual -*/ -//---------------------------------------------------------------------- -individual& individual::operator = (const individual& gp) -//---------------------------------------------------------------------- -{ - np=gp.np; - cout=gp.cout; - id=gp.id; - rank=gp.rank; - p=gp.p; - lambda=gp.lambda; - - return *this; -} - -/*! -\brief Ostream operator << for individual -*/ -//-------------------------------------------------------------------------- -ostream& operator << (ostream& s, const individual& gp) -//-------------------------------------------------------------------------- -{ - assert(gp.np>0); - - s << "Parameters of individual\n"; - s << "id = " << gp.id << "\n" ; - s << "rank = " << gp.rank << "\n" ; - s << "cost = " << gp.cout << "\n" ; - s << "p = " << gp.p.t() << "\n" ; - s << "lambda = " << gp.lambda << "\n" ; - - return s; -} - -} //namespace simcoon \ No newline at end of file diff --git a/src/Simulation/Identification/methods.cpp b/src/Simulation/Identification/methods.cpp deleted file mode 100755 index acf00117c..000000000 --- a/src/Simulation/Identification/methods.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/* This file is part of simcoon. - - simcoon is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - simcoon is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with simcoon. If not, see . - - */ - -///@file methods.cpp -///@brief methods for genetic algorithm (among others) -///@author Chemisky & Despringre -///@version 1.0 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace std; -using namespace arma; - -namespace simcoon{ - -//Genetic method -void genetic(generation &gen_g, generation &gensons, int &idnumber, const double &probaMut, const double &pertu, const vector ¶ms){ - - int n_param = params.size(); - int maxpop = gensons.size(); - - //Generate two genitoers - individual dad(n_param, 0, 0.); - individual mom(n_param, 0, 0.); - - int chromosome = 0; - //Very small pertubation - - gensons.newid(idnumber); - for(int i=0; i params[j].max_value) - gensons.pop[i].p(j) = params[j].max_value; - if (gensons.pop[i].p(j) < params[j].min_value) - gensons.pop[i].p(j) = params[j].min_value; - - ///Apply a mutation - if (alea(99) 1) ? 2*maxpop : maxpop, n_param, id0); - - for(int i=0; i 1) { - for(int i=0; i. - - */ - -///@file opti_data.cpp -///@brief object that stores exp/num data -///@author Chemisky & Despringre -///@version 1.0 -///@date 05/28/2014 - -#include -#include -#include -#include -#include -#include -#include - -using namespace std; -using namespace arma; - -namespace simcoon{ - -//=====Private methods for phases_characteristics=================================== - -//=====Public methods for phases_characteristics============================================ - -//@brief default constructor -//------------------------------------------------------------- -opti_data::opti_data() -//------------------------------------------------------------- -{ - name="undefined"; - number=0; - ninfo=0; - ndata=0; - ncolumns=0; - skiplines = 0; -} - -/*! - \brief Constructor - \param n : number of data points - \param m : number of information in each point -*/ - -//------------------------------------------------------------- -opti_data::opti_data(int n, int m) -//------------------------------------------------------------- -{ - assert(n>0); - assert(m>0); - - name="undefined"; - number = 0; - ndata = n; - ninfo = m; - ncolumns=0; - skiplines = 0; - - c_data.zeros(m); - data = zeros(n,m); -} - -/*! - \brief Constructor with parameters - \param mname : name of the experimental data file (with the extension) - \param mnumber : number of the experimental file - \param mndata : number of data points -*/ - -//------------------------------------------------------------- -opti_data::opti_data(string mname, int mnumber, int mninfo, int mndata, int mncolumns, int mskiplines) -//------------------------------------------------------------- -{ - assert(mndata>0); - assert(mninfo>0); - - name=mname; - number = mnumber; - ndata = mndata; - ninfo = mninfo; - ncolumns = mncolumns; - skiplines = mskiplines; - - c_data.zeros(mninfo); - data = zeros(mndata,mninfo); -} - -/*! - \brief Copy constructor - \param ed opti_data object to duplicate -*/ - -//------------------------------------------------------ -opti_data::opti_data(const opti_data& ed) -//------------------------------------------------------ -{ - assert(ed.ndata>0); - assert(ed.ninfo>0); - - name=ed.name; - number = ed.number; - ndata = ed.ndata; - ninfo = ed.ninfo; - ncolumns = ed.ncolumns; - skiplines = ed.skiplines; - - c_data = ed.c_data; - data = ed.data; -} - -/*! - \brief destructor -*/ - -opti_data::~opti_data() {} - -//------------------------------------------------------------- -void opti_data::constructc_data() -//------------------------------------------------------------- -{ - assert(ninfo>0); - - c_data.zeros(ninfo); -} - -//------------------------------------------------------------- -void opti_data::constructdata() -//------------------------------------------------------------- -{ - assert(ninfo>0); - assert(ndata>0); - - data = zeros(ndata,ninfo); -} - -//------------------------------------------------------------- -void opti_data::import(string folder, int nexp) -//------------------------------------------------------------- -{ - assert(ninfo>0); - assert(ncolumns>0); - if (nexp > 0) { - ndata = nexp; - constructdata(); - } - ndata = 0; - ifstream ifdata; - string buffer; - - string temp_string; - string path = folder + "/" + name; - - ifdata.open(path, ios::in); - while (!ifdata.eof()) - { - getline (ifdata,buffer); - if (buffer != "") { - ndata++; - } - } - ndata -= skiplines; - - ifdata.close(); - - ifdata.open(path, ios::in); - - for (int i=0; i> temp_string; - for(int k=0; k nexp) { - for (int i = 0; i < nexp; i++) { - for (int j = 0; j < ncolumns; j++) { - ifdata >> temp_string; - for(int k=0; k0); - assert(ed.ninfo>0); - - name=ed.name; - number = ed.number; - ndata = ed.ndata; - ninfo = ed.ninfo; - ncolumns = ed.ncolumns; - - c_data = ed.c_data; - data = ed.data; - - return *this; -} - -//-------------------------------------------------------------------------- -ostream& operator << (ostream& s, const opti_data& ed) -//-------------------------------------------------------------------------- -{ -// assert(ed.ndata>0); -// assert(ed.ninfo>0); - - s << "Display info on the experimental data\n"; - s << "Name of the experimental data file: " << ed.name << "\n"; - s << "Number of the experimental data file: " << ed.number << "\n"; - s << "Number of data points: " << ed.ndata << "\n"; - s << "Number of informations per data point: " << ed.ninfo << "\n"; - s << "Number of columns in the file: " << ed.ncolumns << "\n"; - s << "Number of lines skipped at the beginning of the file: " << ed.skiplines << "\n"; - -/* for (int i=1; i<=ed.ndata; i++) { - - s << i; - for (int j=1; j<=ed.ninfo; j++) { - s << "\t" << ed.E(i,j); - } - s << "\n"; - } - - s << "\n\n";*/ - - return s; -} - -} //namespace simcoon diff --git a/src/Simulation/Identification/optimize.cpp b/src/Simulation/Identification/optimize.cpp deleted file mode 100755 index 5b102b6e2..000000000 --- a/src/Simulation/Identification/optimize.cpp +++ /dev/null @@ -1,342 +0,0 @@ -/* This file is part of simcoon. - - simcoon is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - simcoon is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with simcoon. If not, see . - - */ - -///@file optimize.cpp -///@brief functions for optimization -///@version 1.0 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace std; -using namespace arma; - -namespace simcoon{ - -///This function constructs the vector of exp/num -vec calcV(const vector &data, const vector &exp_data, const int &nfiles, const int &sizev) { - - vec v = zeros(sizev); - int z=0; - - for(int i=0; i checkS(const mat &S) { - double somme; - int problem = 0; - Col pb_col; - pb_col.zeros(S.n_cols + 1); - - for (int j = 0; j &pb_col) { - - mat S_reduced = S; - for (int j = (fabs(S.n_cols))-1; j > -1; j--) { - if (pb_col(j) == 1) { - S_reduced.shed_col(j); - } - } - return S_reduced; -} - -double calcC(const vec &vexp, vec &vnum, const vec &W) { - double Cout = 0.; - - if(vnum.n_elem < vexp.n_elem) { - vnum = zeros(vexp.n_elem); - } - - for(unsigned int z=0; z simcoon::iota) { - Cout += pow((vexp(z)-vnum(z)), 2.)*W(z); - } - } - return Cout; -} - -//Minimal bound Lagrange multiplier vector -vec bound_min(const int &size, const vec &p, const vector ¶ms, const double &c, const double &p0) { - vec L_min = zeros(size); - for(int k=0; k<(size); k++) { - L_min(k) = -1.*lagrange_exp(params[k].min_value*(1.-p(k)/params[k].min_value), c*params[k].min_value, p0); - } - return L_min; -} - -//Minimal bound Lagrange multiplier vector derivative -vec dbound_min(const int &size, const vec &p, const vector ¶ms, const double &c, const double &p0) { - vec dL_min = zeros(size); - for(int k=0; k<(size); k++) { - dL_min(k) = dlagrange_exp(params[k].min_value*(1.-p(k)/params[k].min_value), c*params[k].min_value, p0); - } - return dL_min; -} - - -//Maximal bound Lagrange multiplier vector -vec bound_max(const int &size, const vec &p, const vector ¶ms, const double &c, const double &p0) { - vec L_max = zeros(size); - for(int k=0; k<(size); k++) { - L_max(k) = -1.*lagrange_exp(p(k)*(p(k)/params[k].max_value-1.), c*p(k), p0); - } - return L_max; -} - - -//Maximal bound Lagrange multiplier vector derivative -vec dbound_max(const int &size, const vec &p, const vector ¶ms, const double &c, const double &p0) { - vec dL_max = zeros(size); - for(int k=0; k<(size); k++) { - dL_max(k) = -1.*dlagrange_exp(params[k].max_value*(p(k)/params[k].max_value-1.), c*params[k].max_value, p0); - } - return dL_max; -} - - -vec calcW(const int &sizev, const int &nfiles, const Col &weight_types, const vec &weight_files, const vector &weight_cols, const vector &weight, const vector &data_exp) { - - vec W = ones(sizev); - double denom = 0.; - int z=0; - - //Load info for the weight type 1 : Weight for each data file - //if (weight_types(0) == 0) : Nothing to do - if(weight_types(0) == 1) { //Add the weight per file - for(int i=0; i ¶ms, const double &lambdaLM, const double &c, const double &p0, const int &n_param, Col& pb_col) { - - //In case calc Sensi: - pb_col.zeros(n_param + 1); - pb_col = checkS(S); - - vec FullDp = zeros(n_param); - int problem = pb_col(n_param); - - int sizepb = n_param-problem; - vec Dp = zeros(n_param-problem); - vec Dv = (vexp-vnum); - - ///Constrain optimization - vec L_min = bound_min(sizepb, p, params, c, p0); - vec L_max = dbound_max(sizepb, p, params, c, p0); - vec dL_min = bound_min(sizepb, p, params, c, p0); - vec dL_max = dbound_max(sizepb, p, params, c, p0); - - mat S_reduced; - mat H; - vec G; - if (problem > 0) { - S_reduced = reduce_S(S, pb_col); - H = Hessian(S_reduced, W); - G = G_cost(S_reduced, W, Dv, L_min, L_max); - } - else { - H = Hessian(S, W); - G = G_cost(S, W, Dv, L_min, L_max); - } - - mat LM = LevMarq(H, lambdaLM, dL_min, dL_max); - - Dp = inv(LM)*G; - - int z = 0; - for(int i=0; i 0.1*p(i)) { - if(FullDp(i) > 0) { - FullDp(i) = 0.1*fabs(p(i)); - } - else { - FullDp(i) = -1.*0.1*fabs(p(i)); - } - } - } - return FullDp; -} - -} //namespace simcoon \ No newline at end of file diff --git a/src/Simulation/Identification/parameters.cpp b/src/Simulation/Identification/parameters.cpp deleted file mode 100755 index dc5a4f81e..000000000 --- a/src/Simulation/Identification/parameters.cpp +++ /dev/null @@ -1,165 +0,0 @@ -/* This file is part of simcoon. - - simcoon is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - simcoon is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with simcoon. If not, see . - - */ - -///@file parameters.cpp -///@brief Handle of input parameters -///@version 0.9 - -#include -#include -#include -#include -#include -#include - -using namespace std; -using namespace arma; - -namespace simcoon{ - -//=====Private methods for parameters=================================== - -//=====Public methods for parameters============================================ - -//@brief default constructor -//------------------------------------------------------------- -parameters::parameters() -//------------------------------------------------------------- -{ - - number = 0; - value = 0.; //Initial Value of the parameter - min_value = 0.; //Minimum value of the parameter - max_value = 0.; //Maximum value of the parameter - ninput_files = 0; -} - -/*! - \brief Constructor - \param mnumber : number of the parameter - \param mmin_value : Minimal value of the parameter - \param mmax_value : Maximal value of the parameter - */ - -//------------------------------------------------------------- -parameters::parameters(const int &mnumber, const double &mmin_value, const double &mmax_value) -//------------------------------------------------------------- -{ - number = mnumber; - min_value = mmin_value; - max_value = mmax_value; - value = (min_value+max_value)/2.; - ninput_files = 0; -} - -/*! - \brief Constructor with parameters - \param mnumber : number of the parameter - \param mmin_value : Minimal value of the parameter - \param mmax_value : Maximal value of the parameter - */ - -//------------------------------------------------------------- -parameters::parameters(const int &mnumber, const double &mmin_value, const double &mmax_value, const string &mkey, const int &mninput_files, const std::vector &minput_files) -//------------------------------------------------------------- -{ - number = mnumber; - min_value = mmin_value; - max_value = mmax_value; - value = (min_value+max_value)/2.; - - key = mkey; - ninput_files = mninput_files; - input_files = minput_files; -} - -/*! - \brief Copy constructor - \param ed opti_data object to duplicate - */ - -//------------------------------------------------------ -parameters::parameters(const parameters& pa) -//------------------------------------------------------ -{ - number=pa.number; - min_value = pa.min_value; - max_value = pa.max_value; - value = pa.value; - - key = pa.key; - ninput_files = pa.ninput_files; - input_files = pa.input_files; -} - -/*! - \brief destructor - */ - -parameters::~parameters() {} - -//------------------------------------------------------------- -void parameters::update(const double &p) -//------------------------------------------------------------- -{ - value = p; -} - - -//------------------------------------------------------------- -void parameters::resize(const int &n) -//------------------------------------------------------------- -{ - - ninput_files = n; - input_files.resize(n); -} - -//---------------------------------------------------------------------- -parameters& parameters::operator = (const parameters& pa) -//---------------------------------------------------------------------- -{ - number=pa.number; - min_value = pa.min_value; - max_value = pa.max_value; - value = pa.value; - - key = pa.key; - ninput_files = pa.ninput_files; - input_files = pa.input_files; - - return *this; -} - -//-------------------------------------------------------------------------- -ostream& operator << (ostream& s, const parameters& pa) -//-------------------------------------------------------------------------- -{ - - s << "Display info on the parameter data\n"; - s << "Number of the parameter: " << pa.number << "\n"; - s << "Bounds (Min and Max) values: " << pa.min_value << "\t" << pa.max_value << "\n"; - s << "Number of files impacted and list of files: " << pa.input_files.size() << "\n"; - - for (vector::const_iterator iter = pa.input_files.begin(); iter != pa.input_files.end(); iter++) { - cout << *iter << "\n"; - } - - return s; -} - -} //namespace simcoon \ No newline at end of file diff --git a/src/Simulation/Identification/read.cpp b/src/Simulation/Identification/read.cpp deleted file mode 100755 index 7f5b3bc5f..000000000 --- a/src/Simulation/Identification/read.cpp +++ /dev/null @@ -1,391 +0,0 @@ -/* This file is part of simcoon. - - simcoon is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - simcoon is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with simcoon. If not, see . - - */ - -///@file read -///@brief read and construct for complex objects construction from input files -///@version 1.0 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace std; -using namespace arma; - -namespace simcoon{ - -void read_parameters(const int &n_param, vector ¶ms) { - - std::filesystem::path data_dir = std::filesystem::current_path() / "data"; - std::filesystem::path pathfile = data_dir / "parameters.inp"; - - ifstream paraminit; - string buffer; - - ///@brief Properties of the parameters reading, use "parameters.dat" to specify the parameters of a model - paraminit.open(pathfile, ios::in); - if(paraminit) { - paraminit >> buffer >> buffer >> buffer >> buffer >> buffer >> buffer; - for(int i=0; i> buffer >> buffer >> buffer >> buffer >> params[i].ninput_files; - params[i].input_files.resize(params[i].ninput_files); - for(int j=0; j> buffer; - } - } - } - else { - cout << "Error: cannot open parameters.inp file \n"; - exit(0); - } - paraminit.close(); - - paraminit.open(pathfile, ios::in); - if(paraminit) { - paraminit >> buffer >> buffer >> buffer >> buffer >> buffer >> buffer; - for(int i=0; i> params[i].number >> params[i].min_value >> params[i].max_value >> params[i].key >> buffer; - for(int j=0; j> params[i].input_files[j]; - } - } - } - paraminit.close(); -} - -void read_constants(const int &n_consts, vector &consts, const int &nfiles) { - - std::filesystem::path data_dir = std::filesystem::current_path() / "data"; - std::filesystem::path pathfile = data_dir / "constants.inp"; - - ifstream paraminit; - string buffer; - - ///@brief Properties of the parameters reading, use "parameters.dat" to specify the parameters of a model - paraminit.open(pathfile, ios::in); - if(paraminit) { - paraminit >> buffer >> buffer >> buffer >> buffer >> buffer; - for(int i=0; i> buffer >> buffer; - for(int j=0; j> buffer; - } - paraminit >> consts[i].ninput_files; - consts[i].resize(consts[i].ninput_files, nfiles); - for(int j=0; j> buffer; - } - } - } - else { - cout << "Error: cannot open parameters.inp file \n"; - exit(0); - } - paraminit.close(); - - paraminit.open(pathfile, ios::in); - if(paraminit) { - paraminit >> buffer >> buffer >> buffer >> buffer >> buffer; - for(int i=0; i> consts[i].number >> consts[i].key; - for(int j=0; j> consts[i].input_values(j); - } - paraminit>> buffer; - for(int j=0; j> consts[i].input_files[j]; - } - } - } - paraminit.close(); -} - -void read_data_exp(const int &nfiles, vector &datas) { - - std::filesystem::path data_dir = std::filesystem::current_path() / "data"; - std::filesystem::path pathfile = data_dir / "files_exp.inp"; - - ifstream paraminit; - string buffer; - paraminit.open(pathfile, ios::in); - if(!paraminit) { - cout << "Error: cannot open files_exp.inp file\n"; - exit(0); - } - datas.resize(nfiles); - - paraminit >> buffer; - for(int i=0; i> datas[i].name; - } - - paraminit >> buffer; - for(int i=0; i> datas[i].ncolumns; - } - - paraminit >> buffer; - for(int i=0; i> datas[i].ninfo; - datas[i].constructc_data(); - } - - paraminit >> buffer; - for(int i=0; i> datas[i].c_data(j); - assert(datas[i].c_data(j)>=0); - assert(datas[i].c_data(j)<= datas[i].ncolumns); - } - } - - paraminit >> buffer; - for(int i=0; i> datas[i].skiplines; - } - paraminit.close(); -} - -void read_data_weights(const int &nfiles, Col &weight_types, vec &weights_file, vector &weights_cols, vector &weights, const vector &data_exp) { - - std::filesystem::path data_dir = std::filesystem::current_path() / "data"; - std::filesystem::path pathfile = data_dir / "files_weights.inp"; - - ifstream paraminit; - string buffer; - paraminit.open(pathfile, ios::in); - if(!paraminit) { - cout << "Error: cannot open files_weights.inp file\n"; - exit(0); - } - - weights.resize(nfiles); - for (int i=0; i> buffer >> buffer >> weight_types(0); - if (weight_types(0) == 0) { - paraminit >> buffer; - } - else if(weight_types(0) == 1) { - paraminit >> buffer; - weights_file.resize(nfiles); - for(int i = 0; i> weights_file(i); - } - } - else { - cout << "Please enter 0 or 1 for the weight type 1 : Weight for each data point\n"; - exit(0); - } - - //Load info for the weight type 2 : Weight for each data columns - paraminit >> buffer >> buffer >> weight_types(1); - - if (weight_types(1) == 0) { - paraminit >> buffer; - } - else if (weight_types(1) == 1) { - paraminit >> buffer; - } - else if((weight_types(1) == 2)||(weight_types(1) == 3)) { - paraminit >> buffer; - for(int i = 0; i> weights_cols[i](j); - } - } - } - else { - cout << "Please enter 0 or 1 or 2 or 3 for the weight type 2 : Weight for each data point\n"; - exit(0); - } - - //Load info for the weight type 3 : Weight for each data point - paraminit >> buffer >> buffer >> weight_types(2); - if (weight_types(2) == 0) { - paraminit >> buffer; - } - else if(weight_types(2) == 1) { - paraminit >> buffer; - for(int i=0; i> weights[i].c_data(j); - assert(weights[i].c_data(j)>0); - assert(weights[i].c_data(j)<= weights[i].ncolumns); - } - } - } - else { - cout << "Please enter 0 or 1 for the weight type 3 : Weight for each data point\n"; - exit(0); - } - paraminit.close(); -} - -void read_data_num(const int &nfiles, const vector &data_exp, vector &data_num) { - - std::filesystem::path data_dir = std::filesystem::current_path() / "data"; - std::filesystem::path pathfile = data_dir / "files_num.inp"; - - ifstream paraminit; - string buffer; - paraminit.open(pathfile, ios::in); - if(!paraminit) { - cout << "Error: cannot open files_num.inp file\n"; - exit(0); - } - paraminit >> buffer; - for(int i=0; i> data_num[i].ncolumns; - data_num[i].ninfo = data_exp[i].ninfo; - data_num[i].constructc_data(); - } - - paraminit >> buffer; - for(int i=0; i> data_num[i].c_data(j); - assert(data_num[i].c_data(j)>0); - assert(data_num[i].c_data(j)<=data_num[i].ncolumns); - } - } - - paraminit >> buffer; - for(int i=0; i> data_num[i].skiplines; - } - paraminit.close(); -} - -void ident_essentials(int &n_param, int &n_consts, int &n_files, const string &path, const string &filename) { - std::filesystem::path data_dir = std::filesystem::current_path() / path; - std::filesystem::path pathfile = data_dir / filename; - ifstream param_essentials; - string buffer; - - param_essentials.open(pathfile, ios::in); - if(!param_essentials) { - throw runtime_error("Cannot open file " + filename + " in path " + path); - } - - ///Get the control values for the genetic algorithm - param_essentials >> buffer >> n_param; - param_essentials >> buffer >> n_consts; - param_essentials >> buffer >> n_files; - - param_essentials.close(); -} - -void ident_control(int &ngen, int &aleaspace, int &apop, int &spop, int &ngboys, int &maxpop, int &station_nb, double &station_lim, double &probaMut, double &pertu, double &c, double &p0, double &lambdaLM, const string &path, const string &filename) { - std::filesystem::path data_dir = std::filesystem::current_path() / path; - std::filesystem::path pathfile = data_dir / filename; - ifstream param_control; - string buffer; - - param_control.open(pathfile, ios::in); - if(!param_control) { - throw runtime_error("Cannot open file " + filename + " in path " + path); - } - - ///Get the control values for the genetic algorithm - param_control >> buffer >> ngen; - param_control >> buffer >> aleaspace; - ///Get the state of the initial population : 0 = equidistant individuals, 1 = random individuals, 2 = previously computed population, 3 = equidistant individuals with boundary ones - if((aleaspace==0)||(aleaspace==1)) - param_control >> buffer >> spop; - else if((aleaspace==2)||(aleaspace==3)) - param_control >> buffer >> apop; - else { - cout << "Please select if the initial space is filled with random or equidistant values\n"; - exit(0); - } - - param_control >> buffer >> ngboys; - param_control >> buffer >> maxpop; - - param_control >> buffer >> station_nb; - param_control >> buffer >> station_lim; - param_control >> buffer >> probaMut; - param_control >> buffer >> pertu; - - param_control >> buffer >> c >> p0; - param_control >> buffer >> lambdaLM; - - param_control.close(); -} - -void read_gen(int &apop, mat &samples, const int &n_param) { - - ifstream paraminit; - string buffer; - - std::filesystem::path data_dir = std::filesystem::current_path() / "data"; - std::filesystem::path pathfile = data_dir / "gen0.inp"; - - paraminit.open(pathfile, ios::in); - if(!paraminit) { - cout << "Error: cannot open data/gen0.inp file\n"; - exit(0); - } - - apop=0; - //Read the number of lines (-1 since their is a header), to get the pop number - while (!paraminit.eof()) - { - getline (paraminit,buffer); - if (buffer != "") { - apop++; - } - } - paraminit.close(); - apop--; - samples.resize(apop, n_param); - - paraminit.open(pathfile, ios::in); - paraminit >> buffer >> buffer >> buffer; - for(int j=0; j> buffer; - } - - for(int i=0;i> buffer >> buffer >> buffer; - for(int j=0; j> samples(i,j); - } - } - paraminit.close(); -} - -} //namespace simcoon diff --git a/src/Simulation/Identification/script.cpp b/src/Simulation/Identification/script.cpp deleted file mode 100755 index 75ae69962..000000000 --- a/src/Simulation/Identification/script.cpp +++ /dev/null @@ -1,574 +0,0 @@ -/* This file is part of simcoon. - - simcoon is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - simcoon is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with simcoon. If not, see . - - */ - -///@file script.cpp -///@brief Scripts that allows to run identification algorithms based on Smart+ Control functions -///@version 1.0 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace std; -using namespace arma; - -namespace simcoon{ - -//This function will copy the parameters files -void copy_parameters(const vector ¶ms, const string &src_path, const string &dst_path) { - - string src_files; - string dst_files; - - for (auto pa : params) { - for(auto ifiles : pa.input_files) { - src_files = src_path + "/" + ifiles; - dst_files = dst_path + "/" + ifiles; - std::filesystem::copy_file(src_files,dst_files,std::filesystem::copy_options::overwrite_existing); - } - } -} - -//This function will copy the parameters files -void copy_constants(const vector &consts, const string &src_path, const string &dst_path) { - - string src_files; - string dst_files; - - for (auto co : consts) { - for(auto ifiles : co.input_files) { - src_files = src_path + "/" + ifiles; - dst_files = dst_path + "/" + ifiles; - std::filesystem::copy_file(src_files,dst_files,std::filesystem::copy_options::overwrite_existing); - } - } -} - -//This function will replace the keys by the parameters -void apply_parameters(const vector ¶ms, const string &dst_path) { - - string mod_files; - string buffer; - - ifstream in_files; - ofstream ou_files; - - for (auto pa : params) { - for(auto ifiles : pa.input_files) { - mod_files = dst_path + "/" + ifiles; - - in_files.open(mod_files, ios::in); - - std::vector str; - while (!in_files.eof()) - { - getline(in_files,buffer); - str.push_back(buffer); - } - in_files.close(); - - ou_files.open(mod_files); - for (auto s : str) { - size_t pos = 0; - while ((pos = s.find(pa.key, pos)) != std::string::npos) { - s.replace(pos, pa.key.length(), to_string(pa.value)); - pos += to_string(pa.value).length(); - } - ou_files << s << "\n"; - } - ou_files.close(); - } - } - -} - -//This function will replace the keys by the parameters -void apply_constants(const vector &consts, const string &dst_path) { - - string mod_files; - string buffer; - - ifstream in_files; - ofstream ou_files; - - for (auto co : consts) { - for(auto ifiles : co.input_files) { - mod_files = dst_path + "/" + ifiles; - - in_files.open(mod_files, ios::in); - - std::vector str; - while (!in_files.eof()) - { - getline(in_files,buffer); - str.push_back(buffer); - } - in_files.close(); - - ou_files.open(mod_files); - for (auto s : str) { - size_t pos = 0; - while ((pos = s.find(co.key, pos)) != std::string::npos) { - s.replace(pos, co.key.length(), to_string(co.value)); - pos += to_string(co.value).length(); - } - ou_files << s << "\n"; - } - ou_files.close(); - } - } - -} - -void launch_solver(const individual &ind, const int &nfiles, vector ¶ms, vector &consts, const string &path_results, const string &name, const string &path_data, const string &path_keys, const string &materialfile) -{ - string outputfile; - string simulfile; - string pathfile; - - string name_ext = name.substr(name.length()-4,name.length()); - string name_root = name.substr(0,name.length()-4); //to remove the extension - - //#pragma omp parallel for private(sstm, path) - for (int i = 0; i ¶ms, const string &path_results, const string &name, const string &path_data, const string &path_keys, const string &materialfile) -{ - - string inputfile; - string outputfile; - string simulfile; - - string name_ext = name.substr(name.length()-4,name.length()); - string name_root = name.substr(0,name.length()-4); //to remove the extension - - //Replace the parameters - for (unsigned int k=0; kupdate(0, umat_name, 1, psi_rve, theta_rve, phi_rve, nprops, props); - // The vector of props should be = {nphases_out,nscale,geom_type,npeak}; - //int nphases_in = int(props(0)); - int nphases_out = int(props(1)); - int nscale_in = int(props(2)); - int nscale_out = int(props(3)); - int geom_type = int(props(4)); - int npeak = int(props(5)); - - switch (geom_type) { - - case 0 : { - //Definition from Nphases.dat - rve_init.construct(0,1); //The rve is supposed to be mechanical only here - inputfile = "Nphases" + to_string(nscale_in) + ".dat"; - read_phase(rve_init, path_data, inputfile); - break; - } - case 1: { - //Definition from Nlayers.dat - rve_init.construct(1,1); //The rve is supposed to be mechanical only here - inputfile = "Nlayers" + to_string(nscale_in) + ".dat"; - read_layer(rve_init, path_data, inputfile); - break; - } - case 2: { - rve_init.construct(2,1); //The rve is supposed to be mechanical only here - //Definition from Nellipsoids.dat - inputfile = "Nellipsoids" + to_string(nscale_in) + ".dat"; - read_ellipsoid(rve_init, path_data, inputfile); - break; - } - case 3: { - rve_init.construct(3,1); //The rve is supposed to be mechanical only here - //Definition from Ncylinders.dat - inputfile = "Ncylinders" + to_string(nscale_in) + ".dat"; - read_cylinder(rve_init, path_data, inputfile); - break; - } - } - - double angle_min = 0.; - double angle_max = 180.; - string peakfile = "Npeaks" + to_string(npeak) + ".dat"; - - ODF odf_rve(0, false, angle_min, angle_max); - read_peak(odf_rve, path_data, peakfile); - - phase_characteristics rve = discretize_ODF(rve_init, odf_rve, 1, nphases_out,0); - - if(rve.shape_type == 0) { - outputfile = "Nphases" + to_string(nscale_out) + ".dat"; - write_phase(rve, path_data, outputfile); - } - if(rve.shape_type == 1) { - outputfile = "Nlayers" + to_string(nscale_out) + ".dat"; - write_layer(rve, path_data, outputfile); - } - else if(rve.shape_type == 2) { - outputfile = "Nellipsoids" + to_string(nscale_out) + ".dat"; - write_ellipsoid(rve, path_data, outputfile); - } - else if(rve.shape_type == 3) { - outputfile = "Ncylinders" + to_string(nscale_out) + ".dat"; - write_cylinder(rve, path_data, outputfile); - } - - //Get the simulation files according to the proper name - simulfile = path_results + "/" + name_root + "_" + to_string(ind.id) +"_" + to_string(1) + name_ext; - outputfile = path_data + "/" + outputfile; - std::filesystem::copy_file(outputfile,simulfile,std::filesystem::copy_options::overwrite_existing); -} - - -void launch_pdf(const individual &ind, vector ¶ms, const string &path_results, const string &name, const string &path_data, const string &path_keys, const string &materialfile) -{ - - string inputfile; - string outputfile; - string simulfile; - - string name_ext = name.substr(name.length()-4,name.length()); - string name_root = name.substr(0,name.length()-4); //to remove the extension - - //Replace the parameters - for (unsigned int k=0; kupdate(0, umat_name, 1, psi_rve, theta_rve, phi_rve, nprops, props); - - - // The vector of props should be = {nphases_out,nscale,geom_type,npeak}; - //int nphases_in = int(props(0)); - int nphases_out = int(props(1)); //called "nphases_rve" (props(6)) in main (software/PDF.cpp) - int nscale_in = int(props(2)); //called "num_file_in" (props(1)) in main (software/PDF.cpp) - int nscale_out = int(props(3)); //called "num_file_out" (props(5)) in main (software/PDF.cpp) - int geom_type = int(props(4)); //related to umat_name in main (software/PDF.cpp) - int npeak = int(props(5)); //called "num_file_peaks" (props(11)) in main (software/PDF.cpp) - double parameter_min = int(props(6)); //as (props(8)) in main (software/PDF.cpp) - double parameter_max = int(props(7)); //as (props(9)) in main (software/PDF.cpp) - double num_Parameter = int(props(8)); //as (props(10)) in main (software/PDF.cpp) - - - switch (geom_type) { - - case 0 : { - //Definition from Nphases.dat - rve_init.construct(0,1); //The rve is supposed to be mechanical only here - inputfile = "Nphases" + to_string(nscale_in) + ".dat"; - read_phase(rve_init, path_data, inputfile); - break; - } - case 1: { - //Definition from Nlayers.dat - rve_init.construct(1,1); //The rve is supposed to be mechanical only here - inputfile = "Nlayers" + to_string(nscale_in) + ".dat"; - read_layer(rve_init, path_data, inputfile); - break; - } - case 2: { - rve_init.construct(2,1); //The rve is supposed to be mechanical only here - //Definition from Nellipsoids.dat - inputfile = "Nellipsoids" + to_string(nscale_in) + ".dat"; - read_ellipsoid(rve_init, path_data, inputfile); - break; - } - case 3: { - rve_init.construct(3,1); //The rve is supposed to be mechanical only here - //Definition from Ncylinders.dat - inputfile = "Ncylinders" + to_string(nscale_in) + ".dat"; - read_cylinder(rve_init, path_data, inputfile); - break; - } - } - - - string peakfile = "Npeaks" + to_string(npeak) + ".dat"; - - PDF pdf_rve(num_Parameter, parameter_min, parameter_max); ////HERE Parameter index is set to 0 as default - read_peak(pdf_rve, path_data, peakfile); - - phase_characteristics rve = discretize_PDF(rve_init, pdf_rve, 1, nphases_out); - - if(rve.shape_type == 0) { - outputfile = "Nphases" + to_string(nscale_out) + ".dat"; - write_phase(rve, path_data, outputfile); - } - if(rve.shape_type == 1) { - outputfile = "Nlayers" + to_string(nscale_out) + ".dat"; - write_layer(rve, path_data, outputfile); - } - else if(rve.shape_type == 2) { - outputfile = "Nellipsoids" + to_string(nscale_out) + ".dat"; - write_ellipsoid(rve, path_data, outputfile); - } - else if(rve.shape_type == 3) { - outputfile = "Ncylinders" + to_string(nscale_out) + ".dat"; - write_cylinder(rve, path_data, outputfile); - } - - //Get the simulation files according to the proper name - simulfile = path_results + "/" + name_root + "_" + to_string(ind.id) +"_" + to_string(1) + name_ext; - outputfile = path_data + "/" + outputfile; - std::filesystem::copy_file(outputfile,simulfile,std::filesystem::copy_options::overwrite_existing); -} - -void launch_func_N(const individual &ind, const int &nfiles, vector ¶ms, vector &consts, const string &path_results, const string &name, const string &path_data, const string &path_keys, const string &materialfile) -{ - - string outputfile; - string simulfile; - string pathfile; - - string name_ext = name.substr(name.length()-4,name.length()); - string name_root = name.substr(0,name.length()-4); //to remove the extension - - for (int i = 0; i ¶ms, vector &consts, vector &data_num, const string &folder, const string &name, const string &path_data, const string &path_keys, const string &inputdatafile) { - - //In the simulation run, make sure that we remove all the temporary files - std::filesystem::path path_to_remove(folder); - for (std::filesystem::directory_iterator end_dir_it, it(path_to_remove); it!=end_dir_it; ++it) { - std::filesystem::remove_all(it->path()); - } - - std::map list_simul; - list_simul = {{"SCRIPT",0},{"SOLVE",1},{"ODF",2},{"PDF",3},{"FUNCN",4}}; - - switch (list_simul[simul_type]) { - - case 0: { - //to finish - break; - } - case 1: { - launch_solver(ind, nfiles, params, consts, folder, name, path_data, path_keys, inputdatafile); - break; - } - case 2: { - launch_odf(ind, params, folder, name, path_data, path_keys, inputdatafile); - break; - } - case 3: { - launch_pdf(ind, params, folder, name, path_data, path_keys, inputdatafile); - break; - } - case 4: { - launch_func_N(ind, nfiles, params, consts, folder, name, path_data, path_keys, inputdatafile); - break; - } - default: { - cout << "\n\nError in run_simulation : The specified solver (" << simul_type << ") does not exist.\n"; - return; - } - } - - for (int i = 0; i &data_num, const vector &data_exp, const int &nfiles, const int &sizev) { - - vnum = calcV(data_num, data_exp, nfiles, sizev); - return calcC(vexp, vnum, W); -} - -mat calc_sensi(const individual &gboy, generation &n_gboy, const string &simul_type, const int &nfiles, const int &n_param, vector ¶ms, vector &consts, vec &vnum0, vector &data_num, vector &data_exp, const string &folder, const string &name, const string &path_data, const string &path_keys, const int &sizev, const vec &Dp_n, const string &materialfile) { - - //delta - vec delta = 0.01*ones(n_param); - - mat S = zeros(sizev,n_param); - //genrun part of the gradient - - run_simulation(simul_type, gboy, nfiles, params, consts, data_num, folder, name, path_data, path_keys, materialfile); - vnum0 = calcV(data_num, data_exp, nfiles, sizev); - - for(int j=0; j 0.) { - delta(j) *= Dp_n(j); -// delta(j) *= (0.1*gboy.p(j)); - n_gboy.pop[j].p(j) += delta(j); - } - else { - delta(j) *= (0.1*gboy.p(j)); - n_gboy.pop[j].p(j) += delta(j); - } - } - - for(int j=0; j. - - */ - -///@file Tidentification.cpp -///@brief Test for Identification algorithm -///@version 1.0 - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -using namespace std; -using namespace arma; -using namespace simcoon; - -TEST(Tidentification, identification_layers) -{ - ofstream result; ///Output stream, with parameters values and cost function - - int n_param; - int n_consts; - int nfiles = 0; //number of files for the identification - - //Parameters for the optimization software - int ngen; - int aleaspace; - int apop; - int spop; - int ngboys; - int maxpop; - int station_nb; - double station_lim; - double probaMut; - double pertu; - double c; ///Lagrange penalty parameters - double p0; - double lambdaLM; - //Read the identification control - - string path_data = "data"; - string path_keys = "keys"; - string path_results = "results"; - string materialfile = "material.dat"; - string outputfile = "id_params.txt"; - string simulfile = "simul.txt"; - - string file_essentials = "ident_essentials.inp"; - string file_control = "ident_control.inp"; - - string simul_type = "SOLVE"; - - ASSERT_NO_THROW(ident_essentials(n_param, n_consts, nfiles, path_data, file_essentials)) << "Failed to read identification essentials - check if file exists"; - ASSERT_NO_THROW(ident_control(ngen, aleaspace, apop, spop, ngboys, maxpop, station_nb, station_lim, probaMut, pertu, c, p0, lambdaLM, path_data, file_control)) << "Failed to read identification control - check if file exists"; - run_identification(simul_type,n_param, n_consts, nfiles, ngen, aleaspace, apop, spop, ngboys, maxpop, station_nb, station_lim, path_data, path_keys, path_results, materialfile, outputfile, simulfile, probaMut, pertu, c, p0, lambdaLM); - - string umat_name; - unsigned int nprops = 0; - unsigned int nstatev = 0; - vec props; - - double psi_rve = 0.; - double theta_rve = 0.; - double phi_rve = 0.; - ASSERT_NO_THROW(read_matprops(umat_name, nprops, props, nstatev, psi_rve, theta_rve, phi_rve, path_data, materialfile)) << "Failed to read material properties - check if file exists"; - - phase_characteristics rve_layer_0; - phase_characteristics rve_layer_1; - rve_layer_0.sptr_matprops->update(0, umat_name, 1, psi_rve, theta_rve, phi_rve, props.n_elem, props); - rve_layer_0.construct(1,1); //The rve is supposed to be mechanical only here - rve_layer_1.sptr_matprops->update(0, umat_name, 1, psi_rve, theta_rve, phi_rve, props.n_elem, props); - rve_layer_1.construct(1,1); //The rve is supposed to be mechanical only here - - string path_comparison = "comparison"; - - read_layer(rve_layer_0, path_comparison, "Nlayers0.dat"); - read_layer(rve_layer_0, path_results, "Nlayers0.dat"); - - for(unsigned int i=0; iprops(i)) > simcoon::iota) { - EXPECT_LT( pow(pow(rve_layer_0.sptr_matprops->props(i),2.) - pow(rve_layer_1.sptr_matprops->props(i),2.),0.5)/fabs(rve_layer_0.sptr_matprops->props(i)),1.E-6); - } - else { - EXPECT_LT( pow(pow(rve_layer_0.sptr_matprops->props(i),2.) - pow(rve_layer_1.sptr_matprops->props(i),2.),0.5),1.E-6); - } - } -} diff --git a/testBin/Identification/comparison/Nlayers0.dat b/testBin/Identification/comparison/Nlayers0.dat deleted file mode 100755 index a41d4f906..000000000 --- a/testBin/Identification/comparison/Nlayers0.dat +++ /dev/null @@ -1,37 +0,0 @@ -Number umat save c psi_mat theta_mat phi_mat psi_geom theta_geom phi_geom nprops nstatev props -0 ELIST 1 0.5 0. 0. 0 0. 90. -90. 8 1 1 31034.0 4569.0 0.065000 0.061062 2000.0 0. 0. -1 ELIST 1 0.5 90. 0. 0. 0. 90. -90. 8 1 1 31034.0 4569.0 0.065000 0.061062 2000.0 0. 0. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/testBin/Identification/data/Nlayers0.dat b/testBin/Identification/data/Nlayers0.dat deleted file mode 100755 index b6a5b74cd..000000000 --- a/testBin/Identification/data/Nlayers0.dat +++ /dev/null @@ -1,39 +0,0 @@ -Number umat save c psi_mat theta_mat phi_mat psi_geom theta_geom phi_geom nprops nstatev props -0 ELIST 1 0.5 0.000000 0. 0 0. 90. -90. 8 1 1 27455.546743 4203.085917 0.139300 0.256096 3936.522009 0. 0. -1 ELIST 1 0.5 90.000000 0. 0. 0. 90. -90. 8 1 1 27455.546743 4203.085917 0.139300 0.256096 3936.522009 0. 0. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/testBin/Identification/data/constants.inp b/testBin/Identification/data/constants.inp deleted file mode 100644 index 6207c9338..000000000 --- a/testBin/Identification/data/constants.inp +++ /dev/null @@ -1,3 +0,0 @@ -#Number #key #input_values #number_of_files #files -0 @0c 0 45 67.5 1 Nlayers0.dat -1 @1c 90 -45 -67.5 1 Nlayers0.dat \ No newline at end of file diff --git a/testBin/Identification/data/files_exp.inp b/testBin/Identification/data/files_exp.inp deleted file mode 100644 index 2cdca7050..000000000 --- a/testBin/Identification/data/files_exp.inp +++ /dev/null @@ -1,19 +0,0 @@ -#Name_of_the_exp_files -results_0-90.dat -results_pm45.dat -results_pm675.dat - -#EXP_Nb_columns_in_files -20 -20 -20 - -#EXP_Nb_columns_to_identify -2 -2 -2 - -#EXP_colums_to_identify -8 9 -8 9 -8 9 \ No newline at end of file diff --git a/testBin/Identification/data/files_num.inp b/testBin/Identification/data/files_num.inp deleted file mode 100644 index 3cc894a84..000000000 --- a/testBin/Identification/data/files_num.inp +++ /dev/null @@ -1,9 +0,0 @@ -NUMNb_columnsinfiles -24 -24 -24 - -NUMNb_colums_to_identify -8 9 -8 9 -8 9 \ No newline at end of file diff --git a/testBin/Identification/data/files_weights.inp b/testBin/Identification/data/files_weights.inp deleted file mode 100644 index 7f8db356d..000000000 --- a/testBin/Identification/data/files_weights.inp +++ /dev/null @@ -1,41 +0,0 @@ -Weight_1_per_file -type_0_no_weight_1_weight_per_file -0 -#if_1_list - -Weight_2_per_columns -type_0_no_weight_1_sum_per_columns_2_weight_per_columns_plus_sum_3_weight_per_columns_no_sum -1 -#if_2_or_3_list - -Weight_3_or_uncertainty_per_point -type_0_no_weight_1_weight_column_for_each_exp_col -0 -#if_1_list_per_file_of_columns - - - - - - -#Below is a reminder only - -Weight_1_per_file -type_0_no_weight_1_weight_per_file -1 -#if_1_list -2.0 - -Weight_2_per_columns -type_0_no_weight_1_sum_per_columns_2_weight_per_columns_plus_sum_3_weight_per_columns_no_sum -2 -#if_2_or_3_list -4.0 1.0 - -Weight_3_or_uncertainty_per_point -type_0_no_weight_1_weight_column_for_each_exp_col -1 -#if_1_list_per_file_of_columns -9 10 - - diff --git a/testBin/Identification/data/gen0.inp b/testBin/Identification/data/gen0.inp deleted file mode 100644 index 54788d051..000000000 --- a/testBin/Identification/data/gen0.inp +++ /dev/null @@ -1,5 +0,0 @@ -g nindividual cost p(0) p(1) p(2) p(3) p(4) -0 1 0.538474 32000 5144.24 0.0900987 0.211601 3190.88 -0 2 0.538474 30196.8 5144.24 0.0900987 0.211601 3190.88 -0 3 0.538474 30196.8 5144.24 0.0900987 0.211601 3190.88 -0 4 0.538474 30196.8 5144.24 0.0900987 0.211601 3190.88 \ No newline at end of file diff --git a/testBin/Identification/data/ident_control.inp b/testBin/Identification/data/ident_control.inp deleted file mode 100755 index 18944555a..000000000 --- a/testBin/Identification/data/ident_control.inp +++ /dev/null @@ -1,22 +0,0 @@ -Number_of_generations -100 -Aleatory_Space_Population_0=mesh_1=meshlimit_2=random_3=defined -2 -Space_Population -10 -Golden_boys -1 -Max_population_per_subgeneration -10 -Station_condition -5 -Station_lim -1.E-8 -Mutation_probability_pourcentage -5 -Perturbation -0.001 -Lagrange_parameters -0.001 10 -Lambda_LM -1. \ No newline at end of file diff --git a/testBin/Identification/data/ident_essentials.inp b/testBin/Identification/data/ident_essentials.inp deleted file mode 100644 index 15dbf5e9b..000000000 --- a/testBin/Identification/data/ident_essentials.inp +++ /dev/null @@ -1,6 +0,0 @@ -Number_of_parameters -5 -Number_of_consts -2 -Number_of_files -3 \ No newline at end of file diff --git a/testBin/Identification/data/material.dat b/testBin/Identification/data/material.dat deleted file mode 100644 index 1ecebd68a..000000000 --- a/testBin/Identification/data/material.dat +++ /dev/null @@ -1,13 +0,0 @@ -Material -Name MIPLN -Number_of_material_parameters 2 -Number_of_internal_variables 0 - -#Orientation -psi 0 -theta 0 -phi 0 - -#Mechancial -P1 2 -P2 0 \ No newline at end of file diff --git a/testBin/Identification/data/output.dat b/testBin/Identification/data/output.dat deleted file mode 100755 index cc0b9ba19..000000000 --- a/testBin/Identification/data/output.dat +++ /dev/null @@ -1,16 +0,0 @@ -#Output_values -strain_type 0 -nb_strain 6 -0 1 2 3 4 5 -stress_type 4 -nb_stress 6 -0 1 2 3 4 5 - -Rotation_type 0 -Tangent_type 0 -T 1 - -Number_of_wanted_internal_variables 0 - -#Block #type_1_N_2_T #every -1 1 1 \ No newline at end of file diff --git a/testBin/Identification/data/parameters.inp b/testBin/Identification/data/parameters.inp deleted file mode 100644 index 1424d44d8..000000000 --- a/testBin/Identification/data/parameters.inp +++ /dev/null @@ -1,6 +0,0 @@ -#Number #min #max #key #number_of_files #files -0 10000 40000 @0p 1 Nlayers0.dat -1 1000 8000 @1p 1 Nlayers0.dat -2 0.01 0.3 @2p 1 Nlayers0.dat -3 0.01 0.3 @3p 1 Nlayers0.dat -4 1000 8000 @4p 1 Nlayers0.dat \ No newline at end of file diff --git a/testBin/Identification/data/path_id_1.txt b/testBin/Identification/data/path_id_1.txt deleted file mode 100755 index 958e0b077..000000000 --- a/testBin/Identification/data/path_id_1.txt +++ /dev/null @@ -1,29 +0,0 @@ -#Initial_temperature -290 -#Number_of_blocks -1 - -#Block -1 -#Loading_type -1 -#Control_type(NLGEOM) -1 -#Repeat -1 -#Steps -1 - -#Mode -1 -#Dn_init 1. -#Dn_mini 1. -#Dn_inc 0.01 -#time -0.001 -#Consigne -S 40 -S 0 S 0 -S 0 S 0 S 0 -#Consigne_T -T 290 diff --git a/testBin/Identification/data/path_id_2.txt b/testBin/Identification/data/path_id_2.txt deleted file mode 100755 index 7a1a26855..000000000 --- a/testBin/Identification/data/path_id_2.txt +++ /dev/null @@ -1,31 +0,0 @@ -#Initial_temperature -290 -#Number_of_blocks -1 - -#Block -1 -#Loading_type -1 -#Control_type(NLGEOM) -1 -#Repeat -1 -#Steps -1 - -#Mode -1 -#Dn_init 1. -#Dn_mini 1. -#Dn_inc 0.01 -#time -0.001 -#Consigne -S 40 -S 0 S 0 -S 0 S 0 S 0 -#Consigne_T -T 290 - - diff --git a/testBin/Identification/data/path_id_3.txt b/testBin/Identification/data/path_id_3.txt deleted file mode 100755 index b30ceb07a..000000000 --- a/testBin/Identification/data/path_id_3.txt +++ /dev/null @@ -1,30 +0,0 @@ -#Initial_temperature -290 -#Number_of_blocks -1 - -#Block -1 -#Loading_type -1 -#Control_type(NLGEOM) -1 -#Repeat -1 -#Steps -1 - -#Mode -1 -#Dn_init 1. -#Dn_mini 1. -#Dn_inc 0.01 -#time -0.001 -#Consigne -S 40 -S 0 S 0 -S 0 S 0 S 0 -#Consigne_T -T 290 - diff --git a/testBin/Identification/data/solver_control.inp b/testBin/Identification/data/solver_control.inp deleted file mode 100644 index 1f415796e..000000000 --- a/testBin/Identification/data/solver_control.inp +++ /dev/null @@ -1,21 +0,0 @@ -div_tnew_dt_solver -0.5 - -mul_tnew_dt_solver -2 - -miniter_solver -10 - -maxiter_solver -100 - -inforce_solver -1 - -precision_solver -1.E-6 - -lambda_solver -10000. - diff --git a/testBin/Identification/data/solver_essentials.inp b/testBin/Identification/data/solver_essentials.inp deleted file mode 100755 index 3bfc39f7c..000000000 --- a/testBin/Identification/data/solver_essentials.inp +++ /dev/null @@ -1,4 +0,0 @@ -Solver_type_0_Newton_tangent_1_RNL -0 -Rate_type -2 \ No newline at end of file diff --git a/testBin/Identification/exp_data/results_0-90.dat b/testBin/Identification/exp_data/results_0-90.dat deleted file mode 100644 index 6b2b2c1a5..000000000 --- a/testBin/Identification/exp_data/results_0-90.dat +++ /dev/null @@ -1,100 +0,0 @@ -1 1 1 1 1e-05 290 0 0 2.21091e-05 -2.50533e-06 -9.98184e-06 5.27692e-22 1.11543e-21 -5.46495e-22 0.4 -6.93889e-18 6.96651e-19 -1.92593e-34 5.24666e-18 -6.34136e-19 -1 1 1 2 2e-05 290 0 0 4.42182e-05 -5.01066e-06 -1.99637e-05 1.05538e-21 2.23086e-21 -1.09299e-21 0.8 -1.38778e-17 -3.3509e-18 -3.85186e-34 1.04933e-17 -1.26827e-18 -1 1 1 3 3e-05 290 0 0 6.63272e-05 -7.51599e-06 -2.99455e-05 1.58308e-21 3.34628e-21 -1.63948e-21 1.2 -2.77556e-17 -2.65425e-18 1.92593e-34 1.574e-17 -1.90241e-18 -1 1 1 4 4e-05 290 0 0 8.84363e-05 -1.00213e-05 -3.99274e-05 2.11077e-21 4.46171e-21 -2.18598e-21 1.6 -2.77556e-17 -6.70179e-18 -7.70372e-34 2.09866e-17 -2.53655e-18 -1 1 1 5 5e-05 290 0 0 0.000110545 -1.25267e-05 -4.99092e-05 2.63846e-21 5.57714e-21 -2.73247e-21 2 -2.77556e-17 -6.00514e-18 -1.54074e-33 2.62333e-17 -3.17068e-18 -1 1 1 6 6e-05 290 0 0 0.000132654 -1.5032e-05 -5.98911e-05 3.16615e-21 6.69257e-21 -3.27897e-21 2.4 -2.77556e-17 -2.93639e-18 7.70372e-34 3.148e-17 -3.80482e-18 -1 1 1 7 7e-05 290 0 0 0.000154764 -1.75373e-05 -6.98729e-05 3.69385e-21 7.808e-21 -3.82546e-21 2.8 -2.77556e-17 -6.98394e-18 0 3.67266e-17 -4.43895e-18 -1 1 1 8 8e-05 290 0 0 0.000176873 -2.00427e-05 -7.98548e-05 4.22154e-21 8.92342e-21 -4.37196e-21 3.2 -5.55112e-17 -6.28729e-18 -7.70372e-34 4.19733e-17 -5.07309e-18 -1 1 1 9 9e-05 290 0 0 0.000198982 -2.2548e-05 -8.98366e-05 4.74923e-21 1.00389e-20 -4.91845e-21 3.6 -8.32667e-17 -3.21854e-18 -1.54074e-33 4.72199e-17 -5.70723e-18 -1 1 1 10 0.0001 290 0 0 0.000221091 -2.50533e-05 -9.98184e-05 5.27692e-21 1.11543e-20 -5.46495e-21 4 -8.32667e-17 -1.49791e-19 -2.31112e-33 5.24666e-17 -6.34136e-18 -1 1 1 11 0.00011 290 0 0 0.0002432 -2.75586e-05 -0.0001098 5.80462e-21 1.22697e-20 -6.01144e-21 4.4 -1.11022e-16 -4.19734e-18 -2.15704e-32 5.77133e-17 -6.9755e-18 -1 1 1 12 0.00012 290 0 0 0.000265309 -3.0064e-05 -0.000119782 6.33231e-21 1.33851e-20 -6.55794e-21 4.8 -1.38778e-16 -3.50069e-18 -2.23408e-32 6.29599e-17 -7.60964e-18 -1 1 1 13 0.00013 290 0 0 0.000287418 -3.25693e-05 -0.000129764 6.86e-21 1.45006e-20 -7.10443e-21 5.2 -1.38778e-16 -4.31938e-19 -1.69482e-32 6.82066e-17 -8.24377e-18 -1 1 1 14 0.00014 290 0 0 0.000309527 -3.50746e-05 -0.000139746 7.38769e-21 1.5616e-20 -7.65093e-21 5.6 -1.66533e-16 -4.47949e-18 -2.46519e-32 7.34532e-17 -8.87791e-18 -1 1 1 15 0.00015 290 0 0 0.000331636 -3.758e-05 -0.000149728 7.91539e-21 1.67314e-20 -8.19742e-21 6 -1.66533e-16 -3.78283e-18 -2.61926e-32 7.86999e-17 -9.51204e-18 -1 1 1 16 0.00016 290 0 0 0.000353745 -4.00853e-05 -0.00015971 8.44308e-21 1.78468e-20 -8.74392e-21 6.4 -1.66533e-16 -7.14085e-19 -1.54074e-32 8.39465e-17 -1.01462e-17 -1 1 1 17 0.00017 290 0 0 0.000375854 -4.25906e-05 -0.000169691 8.97077e-21 1.89623e-20 -9.29041e-21 6.8 -1.66533e-16 -1.74345e-20 -1.07852e-32 8.91932e-17 -1.07803e-17 -1 1 1 18 0.00018 290 0 0 0.000397963 -4.5096e-05 -0.000179673 9.49846e-21 2.00777e-20 -9.83691e-21 7.2 -1.66533e-16 -4.06498e-18 -6.16298e-33 9.44399e-17 -1.14145e-17 -1 1 1 19 0.00019 290 0 0 0.000420073 -4.76013e-05 -0.000189655 1.00262e-20 2.11931e-20 -1.03834e-20 7.6 -1.66533e-16 -3.36833e-18 -1.54074e-33 9.96865e-17 -1.20486e-17 -1 1 1 20 0.0002 290 0 0 0.000442182 -5.01066e-05 -0.000199637 1.05538e-20 2.23086e-20 -1.09299e-20 8 -1.66533e-16 -7.41588e-18 3.08149e-33 1.04933e-16 -1.26827e-17 -1 1 1 21 0.00021 290 0 0 0.000464291 -5.2612e-05 -0.000209619 1.10815e-20 2.3424e-20 -1.14764e-20 8.4 -1.66533e-16 -6.71923e-18 7.70372e-33 1.1018e-16 -1.33169e-17 -1 1 1 22 0.00022 290 0 0 0.0004864 -5.51173e-05 -0.000219601 1.16092e-20 2.45394e-20 -1.20229e-20 8.8 -1.66533e-16 -1.07668e-17 4.93038e-32 1.15427e-16 -1.3951e-17 -1 1 1 23 0.00023 290 0 0 0.000508509 -5.76226e-05 -0.000229582 1.21369e-20 2.56548e-20 -1.25694e-20 9.2 -1.66533e-16 -1.00701e-17 5.3926e-32 1.20673e-16 -1.45851e-17 -1 1 1 24 0.00024 290 0 0 0.000530618 -6.0128e-05 -0.000239564 1.26646e-20 2.67703e-20 -1.31159e-20 9.6 -1.66533e-16 -1.41177e-17 5.85483e-32 1.2592e-16 -1.52193e-17 -1 1 1 25 0.00025 290 0 0 0.000552727 -6.26333e-05 -0.000249546 1.31923e-20 2.78857e-20 -1.36624e-20 10 -1.66533e-16 -1.3421e-17 6.31705e-32 1.31166e-16 -1.58534e-17 -1 1 1 26 0.00026 290 0 0 0.000574836 -6.51386e-05 -0.000259528 1.372e-20 2.90011e-20 -1.42089e-20 10.4 -1.66533e-16 -1.74686e-17 3.08149e-32 1.36413e-16 -1.64875e-17 -1 1 1 27 0.00027 290 0 0 0.000596945 -6.7644e-05 -0.00026951 1.42477e-20 3.01166e-20 -1.47554e-20 10.8 -1.66533e-16 -1.67719e-17 0 1.4166e-16 -1.71217e-17 -1 1 1 28 0.00028 290 0 0 0.000619054 -7.01493e-05 -0.000279492 1.47754e-20 3.1232e-20 -1.53019e-20 11.2 -1.66533e-16 -2.08195e-17 1.84889e-32 1.46906e-16 -1.77558e-17 -1 1 1 29 0.00029 290 0 0 0.000641163 -7.26546e-05 -0.000289473 1.53031e-20 3.23474e-20 -1.58484e-20 11.6 -1.66533e-16 -2.01228e-17 2.46519e-32 1.52153e-16 -1.839e-17 -1 1 1 30 0.0003 290 0 0 0.000663272 -7.51599e-05 -0.000299455 1.58308e-20 3.34628e-20 -1.63948e-20 12 -2.22045e-16 -2.41704e-17 3.08149e-32 1.574e-16 -1.90241e-17 -1 1 1 31 0.00031 290 0 0 0.000685382 -7.76653e-05 -0.000309437 1.63585e-20 3.45783e-20 -1.69413e-20 12.4 -2.22045e-16 -2.34737e-17 3.69779e-32 1.62646e-16 -1.96582e-17 -1 1 1 32 0.00032 290 0 0 0.000707491 -8.01706e-05 -0.000319419 1.68862e-20 3.56937e-20 -1.74878e-20 12.8 -2.22045e-16 -2.75213e-17 4.31408e-32 1.67893e-16 -2.02924e-17 -1 1 1 33 0.00033 290 0 0 0.0007296 -8.26759e-05 -0.000329401 1.74139e-20 3.68091e-20 -1.80343e-20 13.2 -2.22045e-16 -2.68246e-17 3.69779e-32 1.7314e-16 -2.09265e-17 -1 1 1 34 0.00034 290 0 0 0.000751709 -8.51813e-05 -0.000339383 1.79415e-20 3.79246e-20 -1.85808e-20 13.6 -2.22045e-16 -2.6128e-17 1.04771e-31 1.78386e-16 -2.15606e-17 -1 1 1 35 0.00035 290 0 0 0.000773818 -8.76866e-05 -0.000349365 1.84692e-20 3.904e-20 -1.91273e-20 14 -2.22045e-16 -3.01755e-17 9.86076e-32 1.83633e-16 -2.21948e-17 -1 1 1 36 0.00036 290 0 0 0.000795927 -9.01919e-05 -0.000359346 1.89969e-20 4.01554e-20 -1.96738e-20 14.4 -2.22045e-16 -2.94789e-17 6.77927e-32 1.8888e-16 -2.28289e-17 -1 1 1 37 0.00037 290 0 0 0.000818036 -9.26973e-05 -0.000369328 1.95246e-20 4.12708e-20 -2.02203e-20 14.8 -2.22045e-16 -3.35264e-17 -1.2326e-32 1.94126e-16 -2.3463e-17 -1 1 1 38 0.00038 290 0 0 0.000840145 -9.52026e-05 -0.00037931 2.00523e-20 4.23863e-20 -2.07668e-20 15.2 -2.22045e-16 -3.28298e-17 -1.84889e-32 1.99373e-16 -2.40972e-17 -1 1 1 39 0.00039 290 0 0 0.000862254 -9.77079e-05 -0.000389292 2.058e-20 4.35017e-20 -2.13133e-20 15.6 -2.22045e-16 -3.68773e-17 -2.46519e-32 2.0462e-16 -2.47313e-17 -1 1 1 40 0.0004 290 0 0 0.000884363 -0.000100213 -0.000399274 2.11077e-20 4.46171e-20 -2.18598e-20 16 -2.22045e-16 -3.61806e-17 -3.08149e-32 2.09866e-16 -2.53655e-17 -1 1 1 41 0.00041 290 0 0 0.000906472 -0.000102719 -0.000409256 2.16354e-20 4.57325e-20 -2.24063e-20 16.4 -2.22045e-16 -4.02282e-17 -3.69779e-32 2.15113e-16 -2.59996e-17 -1 1 1 42 0.00042 290 0 0 0.000928581 -0.000105224 -0.000419237 2.21631e-20 4.6848e-20 -2.29528e-20 16.8 -2.22045e-16 -3.95315e-17 3.08149e-32 2.2036e-16 -2.66337e-17 -1 1 1 43 0.00043 290 0 0 0.00095069 -0.000107729 -0.000429219 2.26908e-20 4.79634e-20 -2.34993e-20 17.2 -2.22045e-16 -4.35791e-17 9.86076e-32 2.25606e-16 -2.72679e-17 -1 1 1 44 0.00044 290 0 0 0.0009728 -0.000110235 -0.000439201 2.32185e-20 4.90788e-20 -2.40458e-20 17.6 -2.22045e-16 -4.28824e-17 1.41748e-31 2.30853e-16 -2.7902e-17 -1 1 1 45 0.00045 290 0 0 0.000994909 -0.00011274 -0.000449183 2.37462e-20 5.01943e-20 -2.45923e-20 18 -2.22045e-16 -4.693e-17 1.35585e-31 2.361e-16 -2.85361e-17 -1 1 1 46 0.00046 290 0 0 0.00101702 -0.000115245 -0.000459165 2.42739e-20 5.13097e-20 -2.51388e-20 18.4 -2.22045e-16 -4.62333e-17 1.29422e-31 2.41346e-16 -2.91703e-17 -1 1 1 47 0.00047 290 0 0 0.00103913 -0.000117751 -0.000469147 2.48015e-20 5.24251e-20 -2.56853e-20 18.8 -2.22045e-16 -5.02809e-17 1.2326e-31 2.46593e-16 -2.98044e-17 -1 1 1 48 0.00048 290 0 0 0.00106124 -0.000120256 -0.000479129 2.53292e-20 5.35405e-20 -2.62318e-20 19.2 -2.22045e-16 -4.95842e-17 1.17097e-31 2.5184e-16 -3.04385e-17 -1 1 1 49 0.00049 290 0 0 0.00108334 -0.000122761 -0.00048911 2.58569e-20 5.4656e-20 -2.67783e-20 19.6 -2.22045e-16 -5.36318e-17 1.10934e-31 2.57086e-16 -3.10727e-17 -1 1 1 50 0.0005 290 0 0 0.00110545 -0.000125267 -0.000499092 2.63846e-20 5.57714e-20 -2.73247e-20 20 -2.22045e-16 -5.29351e-17 1.04771e-31 2.62333e-16 -3.17068e-17 -1 1 1 51 0.00051 290 0 0 0.00112756 -0.000127772 -0.000509074 2.69123e-20 5.68868e-20 -2.78712e-20 20.4 -2.22045e-16 -5.22385e-17 9.86076e-32 2.6758e-16 -3.2341e-17 -1 1 1 52 0.00052 290 0 0 0.00114967 -0.000130277 -0.000519056 2.744e-20 5.80023e-20 -2.84177e-20 20.8 -2.22045e-16 -5.6286e-17 9.24446e-32 2.72826e-16 -3.29751e-17 -1 1 1 53 0.00053 290 0 0 0.00117178 -0.000132783 -0.000529038 2.79677e-20 5.91177e-20 -2.89642e-20 21.2 -2.22045e-16 -5.55894e-17 8.62817e-32 2.78073e-16 -3.36092e-17 -1 1 1 54 0.00054 290 0 0 0.00119389 -0.000135288 -0.00053902 2.84954e-20 6.02331e-20 -2.95107e-20 21.6 -2.22045e-16 -5.96369e-17 8.01187e-32 2.8332e-16 -3.42434e-17 -1 1 1 55 0.00055 290 0 0 0.001216 -0.000137793 -0.000549001 2.90231e-20 6.13485e-20 -3.00572e-20 22 -2.22045e-16 -5.89403e-17 1.47911e-31 2.88566e-16 -3.48775e-17 -1 1 1 56 0.00056 290 0 0 0.00123811 -0.000140299 -0.000558983 2.95508e-20 6.2464e-20 -3.06037e-20 22.4 -2.22045e-16 -6.29878e-17 1.17097e-31 2.93813e-16 -3.55116e-17 -1 1 1 57 0.00057 290 0 0 0.00126022 -0.000142804 -0.000568965 3.00785e-20 6.35794e-20 -3.11502e-20 22.8 -2.22045e-16 -6.22912e-17 1.35585e-31 2.9906e-16 -3.61458e-17 -1 1 1 58 0.00058 290 0 0 0.00128233 -0.000145309 -0.000578947 3.06062e-20 6.46948e-20 -3.16967e-20 23.2 -2.22045e-16 -6.63387e-17 1.04771e-31 3.04306e-16 -3.67799e-17 -1 1 1 59 0.00059 290 0 0 0.00130444 -0.000147815 -0.000588929 3.11339e-20 6.58103e-20 -3.22432e-20 23.6 -2.22045e-16 -6.56421e-17 1.2326e-31 3.09553e-16 -3.7414e-17 -1 1 1 60 0.0006 290 0 0 0.00132654 -0.00015032 -0.000598911 3.16615e-20 6.69257e-20 -3.27897e-20 24 -2.22045e-16 -6.96896e-17 9.24446e-32 3.148e-16 -3.80482e-17 -1 1 1 61 0.00061 290 0 0 0.00134865 -0.000152825 -0.000608893 3.21892e-20 6.80411e-20 -3.33362e-20 24.4 -2.22045e-16 -6.8993e-17 1.10934e-31 3.20046e-16 -3.86823e-17 -1 1 1 62 0.00062 290 0 0 0.00137076 -0.000155331 -0.000618874 3.27169e-20 6.91565e-20 -3.38827e-20 24.8 -2.22045e-16 -7.30405e-17 8.01187e-32 3.25293e-16 -3.93165e-17 -1 1 1 63 0.00063 290 0 0 0.00139287 -0.000157836 -0.000628856 3.32446e-20 7.0272e-20 -3.44292e-20 25.2 -2.22045e-16 -7.23439e-17 9.86076e-32 3.3054e-16 -3.99506e-17 -1 1 1 64 0.00064 290 0 0 0.00141498 -0.000160341 -0.000638838 3.37723e-20 7.13874e-20 -3.49757e-20 25.6 -2.22045e-16 -7.63914e-17 6.77927e-32 3.35786e-16 -4.05847e-17 -1 1 1 65 0.00065 290 0 0 0.00143709 -0.000162847 -0.00064882 3.43e-20 7.25028e-20 -3.55222e-20 26 -2.22045e-16 -7.56948e-17 8.62817e-32 3.41033e-16 -4.12189e-17 -1 1 1 66 0.00066 290 0 0 0.0014592 -0.000165352 -0.000658802 3.48277e-20 7.36182e-20 -3.60687e-20 26.4 -2.22045e-16 -7.49981e-17 5.54668e-32 3.4628e-16 -4.1853e-17 -1 1 1 67 0.00067 290 0 0 0.00148131 -0.000167857 -0.000668784 3.53554e-20 7.47337e-20 -3.66152e-20 26.8 -2.22045e-16 -7.90457e-17 2.46519e-32 3.51526e-16 -4.24871e-17 -1 1 1 68 0.00068 290 0 0 0.00150342 -0.000170363 -0.000678765 3.58831e-20 7.58491e-20 -3.71617e-20 27.2 -2.22045e-16 -7.8349e-17 4.31408e-32 3.56773e-16 -4.31213e-17 -1 1 1 69 0.00069 290 0 0 0.00152553 -0.000172868 -0.000688747 3.64108e-20 7.69645e-20 -3.77082e-20 27.6 -2.22045e-16 -8.23966e-17 1.2326e-32 3.62019e-16 -4.37554e-17 -1 1 1 70 0.0007 290 0 0 0.00154764 -0.000175373 -0.000698729 3.69385e-20 7.808e-20 -3.82546e-20 28 -2.22045e-16 -8.16999e-17 3.08149e-32 3.67266e-16 -4.43895e-17 -1 1 1 71 0.00071 290 0 0 0.00156974 -0.000177879 -0.000708711 3.74662e-20 7.91954e-20 -3.88011e-20 28.4 -2.22045e-16 -8.57474e-17 4.93038e-32 3.72513e-16 -4.50237e-17 -1 1 1 72 0.00072 290 0 0 0.00159185 -0.000180384 -0.000718693 3.79939e-20 8.03108e-20 -3.93476e-20 28.8 -2.22045e-16 -8.50508e-17 1.664e-31 3.77759e-16 -4.56578e-17 -1 1 1 73 0.00073 290 0 0 0.00161396 -0.000182889 -0.000728675 3.85215e-20 8.14262e-20 -3.98941e-20 29.2 -2.22045e-16 -8.90983e-17 1.35585e-31 3.83006e-16 -4.62919e-17 -1 1 1 74 0.00074 290 0 0 0.00163607 -0.000185395 -0.000738656 3.90492e-20 8.25417e-20 -4.04406e-20 29.6 -2.22045e-16 -8.84017e-17 1.54074e-31 3.88253e-16 -4.69261e-17 -1 1 1 75 0.00075 290 0 0 0.00165818 -0.0001879 -0.000748638 3.95769e-20 8.36571e-20 -4.09871e-20 30 -2.22045e-16 -9.24492e-17 2.71171e-31 3.93499e-16 -4.75602e-17 -1 1 1 76 0.00076 290 0 0 0.00168029 -0.000190405 -0.00075862 4.01046e-20 8.47725e-20 -4.15336e-20 30.4 -2.22045e-16 -9.17526e-17 2.8966e-31 3.98746e-16 -4.81944e-17 -1 1 1 77 0.00077 290 0 0 0.0017024 -0.000192911 -0.000768602 4.06323e-20 8.5888e-20 -4.20801e-20 30.8 -2.22045e-16 -9.58001e-17 4.06756e-31 4.03993e-16 -4.88285e-17 -1 1 1 78 0.00078 290 0 0 0.00172451 -0.000195416 -0.000778584 4.116e-20 8.70034e-20 -4.26266e-20 31.2 -2.22045e-16 -9.51035e-17 4.25245e-31 4.09239e-16 -4.94626e-17 -1 1 1 79 0.00079 290 0 0 0.00174662 -0.000197921 -0.000788566 4.16877e-20 8.81188e-20 -4.31731e-20 31.6 -2.22045e-16 -9.9151e-17 5.42342e-31 4.14486e-16 -5.00968e-17 -1 1 1 80 0.0008 290 0 0 0.00176873 -0.000200427 -0.000798548 4.22154e-20 8.92342e-20 -4.37196e-20 32 -2.22045e-16 -9.84544e-17 5.60831e-31 4.19733e-16 -5.07309e-17 -1 1 1 81 0.00081 290 0 0 0.00179084 -0.000202932 -0.000808529 4.27431e-20 9.03497e-20 -4.42661e-20 32.4 -2.22045e-16 -9.53856e-17 6.77927e-31 4.24979e-16 -5.1365e-17 -1 1 1 82 0.00082 290 0 0 0.00181294 -0.000205437 -0.000818511 4.32708e-20 9.14651e-20 -4.48126e-20 32.8 -2.22045e-16 -9.23169e-17 7.95024e-31 4.30226e-16 -5.19992e-17 -1 1 1 83 0.00083 290 0 0 0.00183505 -0.000207943 -0.000828493 4.37985e-20 9.25805e-20 -4.53591e-20 33.2 -2.22045e-16 -9.16202e-17 7.64209e-31 4.35473e-16 -5.26333e-17 -1 1 1 84 0.00084 290 0 0 0.00185716 -0.000210448 -0.000838475 4.43262e-20 9.36959e-20 -4.59056e-20 33.6 -2.22045e-16 -9.56678e-17 6.34787e-31 4.40719e-16 -5.32674e-17 -1 1 1 85 0.00085 290 0 0 0.00187927 -0.000212953 -0.000848457 4.48539e-20 9.48114e-20 -4.64521e-20 34 -2.22045e-16 -9.49711e-17 6.03972e-31 4.45966e-16 -5.39016e-17 -1 1 1 86 0.00086 290 0 0 0.00190138 -0.000215459 -0.000858439 4.53816e-20 9.59268e-20 -4.69986e-20 34.4 -2.22045e-16 -9.90187e-17 4.74549e-31 4.51213e-16 -5.45357e-17 -1 1 1 87 0.00087 290 0 0 0.00192349 -0.000217964 -0.00086842 4.59092e-20 9.70422e-20 -4.75451e-20 34.8 -2.22045e-16 -9.8322e-17 4.43734e-31 4.56459e-16 -5.51699e-17 -1 1 1 88 0.00088 290 0 0 0.0019456 -0.000220469 -0.000878402 4.64369e-20 9.81577e-20 -4.80916e-20 35.2 -2.22045e-16 -1.0237e-16 3.14312e-31 4.61706e-16 -5.5804e-17 -1 1 1 89 0.00089 290 0 0 0.00196771 -0.000222975 -0.000888384 4.69646e-20 9.92731e-20 -4.86381e-20 35.6 -2.22045e-16 -1.01673e-16 2.83497e-31 4.66953e-16 -5.64381e-17 -1 1 1 90 0.0009 290 0 0 0.00198982 -0.00022548 -0.000898366 4.74923e-20 1.00389e-19 -4.91845e-20 36 -2.22045e-16 -1.0572e-16 1.54074e-31 4.72199e-16 -5.70723e-17 -1 1 1 91 0.00091 290 0 0 0.00201193 -0.000227985 -0.000908348 4.802e-20 1.01504e-19 -4.9731e-20 36.4 -2.22045e-16 -1.05024e-16 1.2326e-31 4.77446e-16 -5.77064e-17 -1 1 1 92 0.00092 290 0 0 0.00203404 -0.00023049 -0.00091833 4.85477e-20 1.02619e-19 -5.02775e-20 36.8 -2.22045e-16 -1.01955e-16 -6.16298e-33 4.82693e-16 -5.83405e-17 -1 1 1 93 0.00093 290 0 0 0.00205614 -0.000232996 -0.000928312 4.90754e-20 1.03735e-19 -5.0824e-20 37.2 -2.22045e-16 -1.06003e-16 -3.69779e-32 4.87939e-16 -5.89747e-17 -1 1 1 94 0.00094 290 0 0 0.00207825 -0.000235501 -0.000938293 4.96031e-20 1.0485e-19 -5.13705e-20 37.6 -2.22045e-16 -1.05306e-16 -1.664e-31 4.93186e-16 -5.96088e-17 -1 1 1 95 0.00095 290 0 0 0.00210036 -0.000238006 -0.000948275 5.01308e-20 1.05966e-19 -5.1917e-20 38 -2.22045e-16 -1.02237e-16 -1.97215e-31 4.98433e-16 -6.02429e-17 -1 1 1 96 0.00096 290 0 0 0.00212247 -0.000240512 -0.000958257 5.06585e-20 1.07081e-19 -5.24635e-20 38.4 -2.22045e-16 -9.91685e-17 -1.78726e-31 5.03679e-16 -6.08771e-17 -1 1 1 97 0.00097 290 0 0 0.00214458 -0.000243017 -0.000968239 5.11862e-20 1.08197e-19 -5.301e-20 38.8 -2.22045e-16 -9.60997e-17 -2.09541e-31 5.08926e-16 -6.15112e-17 -1 1 1 98 0.00098 290 0 0 0.00216669 -0.000245522 -0.000978221 5.17139e-20 1.09312e-19 -5.35565e-20 39.2 -2.22045e-16 -9.3031e-17 -1.91052e-31 5.14173e-16 -6.21454e-17 -1 1 1 99 0.00099 290 0 0 0.0021888 -0.000248028 -0.000988203 5.22416e-20 1.10427e-19 -5.4103e-20 39.6 -2.22045e-16 -9.23343e-17 -2.21867e-31 5.19419e-16 -6.27795e-17 -1 1 1 100 0.001 290 0 0 0.00221091 -0.000250533 -0.000998184 5.27692e-20 1.11543e-19 -5.46495e-20 40 -2.22045e-16 -9.63819e-17 -2.03378e-31 5.24666e-16 -6.34136e-17 diff --git a/testBin/Identification/exp_data/results_pm45.dat b/testBin/Identification/exp_data/results_pm45.dat deleted file mode 100644 index c2ceab342..000000000 --- a/testBin/Identification/exp_data/results_pm45.dat +++ /dev/null @@ -1,100 +0,0 @@ -1 1 1 1 1e-05 290 0 0 5.98019e-05 -4.01981e-05 -9.98184e-06 1.45214e-38 3.91594e-21 2.25402e-21 0.4 5.55112e-17 1.78336e-17 0 7.86189e-18 3.40419e-18 -1 1 1 2 2e-05 290 0 0 0.000119604 -8.03963e-05 -1.99637e-05 2.90427e-38 7.83188e-21 4.50803e-21 0.8 1.11022e-16 7.91153e-18 0 1.50668e-17 7.55133e-18 -1 1 1 3 3e-05 290 0 0 0.000179406 -0.000120594 -2.99455e-05 4.35641e-38 1.17478e-20 6.76205e-21 1.2 1.11022e-16 -2.01049e-18 0 2.29287e-17 1.09555e-17 -1 1 1 4 4e-05 290 0 0 0.000239207 -0.000160793 -3.99274e-05 5.80854e-38 1.56638e-20 9.01607e-21 1.6 1.11022e-16 -1.19325e-17 0 3.07906e-17 1.43597e-17 -1 1 1 5 5e-05 290 0 0 0.000299009 -0.000200991 -4.99092e-05 7.26068e-38 1.95797e-20 1.12701e-20 2 1.11022e-16 -2.18545e-17 0 3.86524e-17 1.77639e-17 -1 1 1 6 6e-05 290 0 0 0.000358811 -0.000241189 -5.98911e-05 8.71282e-38 2.34956e-20 1.35241e-20 2.4 0 -3.17766e-17 0 4.65143e-17 2.11681e-17 -1 1 1 7 7e-05 290 0 0 0.000418613 -0.000281387 -6.98729e-05 1.0165e-37 2.74116e-20 1.57781e-20 2.8 0 -4.16986e-17 0 5.43762e-17 2.45723e-17 -1 1 1 8 8e-05 290 0 0 0.000478415 -0.000321585 -7.98548e-05 1.16171e-37 3.13275e-20 1.80321e-20 3.2 0 -5.16206e-17 0 6.22381e-17 2.79765e-17 -1 1 1 9 9e-05 290 0 0 0.000538217 -0.000361783 -8.98366e-05 1.30692e-37 3.52435e-20 2.02862e-20 3.6 -2.22045e-16 -6.15426e-17 0 7.01e-17 3.13807e-17 -1 1 1 10 0.0001 290 0 0 0.000598019 -0.000401981 -9.98184e-05 1.45214e-37 3.91594e-20 2.25402e-20 4 -4.44089e-16 -7.14647e-17 0 7.79619e-17 3.47848e-17 -1 1 1 11 0.00011 290 0 0 0.000657821 -0.000442179 -0.0001098 1.59735e-37 4.30753e-20 2.47942e-20 4.4 0 -8.13867e-17 0 8.58238e-17 3.8189e-17 -1 1 1 12 0.00012 290 0 0 0.000717622 -0.000482378 -0.000119782 1.74256e-37 4.69913e-20 2.70482e-20 4.8 0 -9.13087e-17 0 9.36856e-17 4.15932e-17 -1 1 1 13 0.00013 290 0 0 0.000777424 -0.000522576 -0.000129764 1.88778e-37 5.09072e-20 2.93022e-20 5.2 0 -1.01231e-16 0 1.01548e-16 4.49974e-17 -1 1 1 14 0.00014 290 0 0 0.000837226 -0.000562774 -0.000139746 2.03299e-37 5.48232e-20 3.15562e-20 5.6 0 -1.11153e-16 0 1.09409e-16 4.84016e-17 -1 1 1 15 0.00015 290 0 0 0.000897028 -0.000602972 -0.000149728 2.1782e-37 5.87391e-20 3.38103e-20 6 0 -1.21075e-16 0 1.17271e-16 5.18058e-17 -1 1 1 16 0.00016 290 0 0 0.00095683 -0.00064317 -0.00015971 2.32342e-37 6.2655e-20 3.60643e-20 6.4 0 -1.30997e-16 0 1.25133e-16 5.521e-17 -1 1 1 17 0.00017 290 0 0 0.00101663 -0.000683368 -0.000169691 2.46863e-37 6.6571e-20 3.83183e-20 6.8 0 -1.40919e-16 0 1.32995e-16 5.86142e-17 -1 1 1 18 0.00018 290 0 0 0.00107643 -0.000723566 -0.000179673 2.61384e-37 7.04869e-20 4.05723e-20 7.2 -4.44089e-16 -1.50841e-16 0 1.40857e-16 6.20184e-17 -1 1 1 19 0.00019 290 0 0 0.00113624 -0.000763764 -0.000189655 2.75906e-37 7.44029e-20 4.28263e-20 7.6 -4.44089e-16 -1.60763e-16 0 1.48719e-16 6.54225e-17 -1 1 1 20 0.0002 290 0 0 0.00119604 -0.000803963 -0.000199637 2.90427e-37 7.83188e-20 4.50803e-20 8 0 -1.70685e-16 0 1.56581e-16 6.88267e-17 -1 1 1 21 0.00021 290 0 0 0.00125584 -0.000844161 -0.000209619 3.04949e-37 8.22347e-20 4.73344e-20 8.4 0 -1.80607e-16 0 1.64443e-16 7.22309e-17 -1 1 1 22 0.00022 290 0 0 0.00131564 -0.000884359 -0.000219601 3.1947e-37 8.61507e-20 4.95884e-20 8.8 0 -1.90529e-16 0 1.72305e-16 7.56351e-17 -1 1 1 23 0.00023 290 0 0 0.00137544 -0.000924557 -0.000229582 3.33991e-37 9.00666e-20 5.18424e-20 9.2 0 -2.00451e-16 0 1.80166e-16 7.90393e-17 -1 1 1 24 0.00024 290 0 0 0.00143524 -0.000964755 -0.000239564 3.48513e-37 9.39826e-20 5.40964e-20 9.6 0 -2.10373e-16 0 1.88028e-16 8.24435e-17 -1 1 1 25 0.00025 290 0 0 0.00149505 -0.00100495 -0.000249546 3.63034e-37 9.78985e-20 5.63504e-20 10 -8.88178e-16 -2.20295e-16 0 1.9589e-16 8.58477e-17 -1 1 1 26 0.00026 290 0 0 0.00155485 -0.00104515 -0.000259528 3.77555e-37 1.01814e-19 5.86045e-20 10.4 -8.88178e-16 -2.30217e-16 0 2.03752e-16 8.92519e-17 -1 1 1 27 0.00027 290 0 0 0.00161465 -0.00108535 -0.00026951 3.92077e-37 1.0573e-19 6.08585e-20 10.8 -8.88178e-16 -2.40139e-16 0 2.11614e-16 9.26561e-17 -1 1 1 28 0.00028 290 0 0 0.00167445 -0.00112555 -0.000279492 4.06598e-37 1.09646e-19 6.31125e-20 11.2 -8.88178e-16 -2.50061e-16 0 2.19476e-16 9.60602e-17 -1 1 1 29 0.00029 290 0 0 0.00173425 -0.00116575 -0.000289473 4.21119e-37 1.13562e-19 6.53665e-20 11.6 -8.88178e-16 -2.59983e-16 0 2.27338e-16 9.94644e-17 -1 1 1 30 0.0003 290 0 0 0.00179406 -0.00120594 -0.000299455 4.35641e-37 1.17478e-19 6.76205e-20 12 -8.88178e-16 -2.69905e-16 0 2.352e-16 1.02869e-16 -1 1 1 31 0.00031 290 0 0 0.00185386 -0.00124614 -0.000309437 4.50162e-37 1.21394e-19 6.98745e-20 12.4 -8.88178e-16 -2.79827e-16 0 2.43061e-16 1.06273e-16 -1 1 1 32 0.00032 290 0 0 0.00191366 -0.00128634 -0.000319419 4.64683e-37 1.2531e-19 7.21286e-20 12.8 -8.88178e-16 -2.89749e-16 0 2.50923e-16 1.09677e-16 -1 1 1 33 0.00033 290 0 0 0.00197346 -0.00132654 -0.000329401 4.79205e-37 1.29226e-19 7.43826e-20 13.2 -8.88178e-16 -2.99671e-16 0 2.58785e-16 1.13081e-16 -1 1 1 34 0.00034 290 0 0 0.00203326 -0.00136674 -0.000339383 4.93726e-37 1.33142e-19 7.66366e-20 13.6 -8.88178e-16 -3.09593e-16 0 2.66647e-16 1.16485e-16 -1 1 1 35 0.00035 290 0 0 0.00209307 -0.00140693 -0.000349365 5.08248e-37 1.37058e-19 7.88906e-20 14 -8.88178e-16 -3.19515e-16 0 2.74509e-16 1.1989e-16 -1 1 1 36 0.00036 290 0 0 0.00215287 -0.00144713 -0.000359346 5.22769e-37 1.40974e-19 8.11446e-20 14.4 -1.77636e-15 -3.29437e-16 0 2.82371e-16 1.23294e-16 -1 1 1 37 0.00037 290 0 0 0.00221267 -0.00148733 -0.000369328 5.3729e-37 1.4489e-19 8.33986e-20 14.8 -2.66454e-15 -3.39359e-16 0 2.90233e-16 1.26698e-16 -1 1 1 38 0.00038 290 0 0 0.00227247 -0.00152753 -0.00037931 5.51812e-37 1.48806e-19 8.56527e-20 15.2 -4.44089e-15 -3.49281e-16 0 2.98095e-16 1.30102e-16 -1 1 1 39 0.00039 290 0 0 0.00233227 -0.00156773 -0.000389292 5.66333e-37 1.52722e-19 8.79067e-20 15.6 -6.21725e-15 -3.59203e-16 0 3.05957e-16 1.33506e-16 -1 1 1 40 0.0004 290 0 0 0.00239207 -0.00160793 -0.000399274 5.80854e-37 1.56638e-19 9.01607e-20 16 -7.99361e-15 -3.69125e-16 0 3.13818e-16 1.36911e-16 -1 1 1 41 0.00041 290 0 0 0.00245188 -0.00164812 -0.000409256 5.95376e-37 1.60554e-19 9.24147e-20 16.4 -1.06581e-14 -3.79047e-16 0 3.2168e-16 1.40315e-16 -1 1 1 42 0.00042 290 0 0 0.00251168 -0.00168832 -0.000419237 6.09897e-37 1.64469e-19 9.46687e-20 16.8 -1.06581e-14 -3.88969e-16 0 3.29542e-16 1.43719e-16 -1 1 1 43 0.00043 290 0 0 0.00257148 -0.00172852 -0.000429219 6.24418e-37 1.68385e-19 9.69227e-20 17.2 -1.06581e-14 -3.98891e-16 0 3.37404e-16 1.47123e-16 -1 1 1 44 0.00044 290 0 0 0.00263128 -0.00176872 -0.000439201 6.3894e-37 1.72301e-19 9.91768e-20 17.6 -1.06581e-14 -4.08813e-16 0 3.45266e-16 1.50527e-16 -1 1 1 45 0.00045 290 0 0 0.00269108 -0.00180892 -0.000449183 6.53461e-37 1.76217e-19 1.01431e-19 18 -1.06581e-14 -4.18735e-16 0 3.53128e-16 1.53931e-16 -1 1 1 46 0.00046 290 0 0 0.00275089 -0.00184911 -0.000459165 6.67983e-37 1.80133e-19 1.03685e-19 18.4 -1.06581e-14 -4.28657e-16 0 3.6099e-16 1.57336e-16 -1 1 1 47 0.00047 290 0 0 0.00281069 -0.00188931 -0.000469147 6.82504e-37 1.84049e-19 1.05939e-19 18.8 -1.06581e-14 -4.3858e-16 0 3.68852e-16 1.6074e-16 -1 1 1 48 0.00048 290 0 0 0.00287049 -0.00192951 -0.000479129 6.97025e-37 1.87965e-19 1.08193e-19 19.2 -1.06581e-14 -4.48502e-16 0 3.76714e-16 1.64144e-16 -1 1 1 49 0.00049 290 0 0 0.00293029 -0.00196971 -0.00048911 7.11547e-37 1.91881e-19 1.10447e-19 19.6 -1.06581e-14 -4.58424e-16 0 3.84575e-16 1.67548e-16 -1 1 1 50 0.0005 290 0 0 0.00299009 -0.00200991 -0.000499092 7.26068e-37 1.95797e-19 1.12701e-19 20 -1.06581e-14 -4.68346e-16 0 3.92437e-16 1.70952e-16 -1 1 1 51 0.00051 290 0 0 0.0030499 -0.0020501 -0.000509074 7.40589e-37 1.99713e-19 1.14955e-19 20.4 -1.06581e-14 -4.78268e-16 0 4.00299e-16 1.74357e-16 -1 1 1 52 0.00052 290 0 0 0.0031097 -0.0020903 -0.000519056 7.55111e-37 2.03629e-19 1.17209e-19 20.8 -8.88178e-15 -4.8819e-16 0 4.08161e-16 1.77761e-16 -1 1 1 53 0.00053 290 0 0 0.0031695 -0.0021305 -0.000529038 7.69632e-37 2.07545e-19 1.19463e-19 21.2 -7.10543e-15 -4.98112e-16 0 4.16023e-16 1.81165e-16 -1 1 1 54 0.00054 290 0 0 0.0032293 -0.0021707 -0.00053902 7.84153e-37 2.11461e-19 1.21717e-19 21.6 -5.32907e-15 -5.08034e-16 0 4.23885e-16 1.84569e-16 -1 1 1 55 0.00055 290 0 0 0.0032891 -0.0022109 -0.000549001 7.98675e-37 2.15377e-19 1.23971e-19 22 -5.32907e-15 -5.17956e-16 0 4.31747e-16 1.87973e-16 -1 1 1 56 0.00056 290 0 0 0.0033489 -0.0022511 -0.000558983 8.13196e-37 2.19293e-19 1.26225e-19 22.4 -5.32907e-15 -5.27878e-16 0 4.39609e-16 1.91378e-16 -1 1 1 57 0.00057 290 0 0 0.00340871 -0.00229129 -0.000568965 8.27717e-37 2.23209e-19 1.28479e-19 22.8 -5.32907e-15 -5.378e-16 0 4.47471e-16 1.94782e-16 -1 1 1 58 0.00058 290 0 0 0.00346851 -0.00233149 -0.000578947 8.42239e-37 2.27125e-19 1.30733e-19 23.2 -5.32907e-15 -5.47722e-16 0 4.55332e-16 1.98186e-16 -1 1 1 59 0.00059 290 0 0 0.00352831 -0.00237169 -0.000588929 8.5676e-37 2.3104e-19 1.32987e-19 23.6 -5.32907e-15 -5.57644e-16 0 4.63194e-16 2.0159e-16 -1 1 1 60 0.0006 290 0 0 0.00358811 -0.00241189 -0.000598911 8.71282e-37 2.34956e-19 1.35241e-19 24 -5.32907e-15 -5.67566e-16 0 4.71056e-16 2.04994e-16 -1 1 1 61 0.00061 290 0 0 0.00364791 -0.00245209 -0.000608893 8.85803e-37 2.38872e-19 1.37495e-19 24.4 -5.32907e-15 -5.77488e-16 0 4.78918e-16 2.08398e-16 -1 1 1 62 0.00062 290 0 0 0.00370772 -0.00249228 -0.000618874 9.00324e-37 2.42788e-19 1.39749e-19 24.8 -5.32907e-15 -5.8741e-16 0 4.8678e-16 2.11803e-16 -1 1 1 63 0.00063 290 0 0 0.00376752 -0.00253248 -0.000628856 9.14846e-37 2.46704e-19 1.42003e-19 25.2 -5.32907e-15 -5.97332e-16 0 4.94642e-16 2.15207e-16 -1 1 1 64 0.00064 290 0 0 0.00382732 -0.00257268 -0.000638838 9.29367e-37 2.5062e-19 1.44257e-19 25.6 -5.32907e-15 -6.07254e-16 0 5.02504e-16 2.18611e-16 -1 1 1 65 0.00065 290 0 0 0.00388712 -0.00261288 -0.00064882 9.43888e-37 2.54536e-19 1.46511e-19 26 -5.32907e-15 -6.17176e-16 0 5.10366e-16 2.22015e-16 -1 1 1 66 0.00066 290 0 0 0.00394692 -0.00265308 -0.000658802 9.5841e-37 2.58452e-19 1.48765e-19 26.4 -5.32907e-15 -6.27098e-16 0 5.18228e-16 2.25419e-16 -1 1 1 67 0.00067 290 0 0 0.00400673 -0.00269327 -0.000668784 9.72931e-37 2.62368e-19 1.51019e-19 26.8 -5.32907e-15 -6.3702e-16 0 5.26089e-16 2.28824e-16 -1 1 1 68 0.00068 290 0 0 0.00406653 -0.00273347 -0.000678765 9.87452e-37 2.66284e-19 1.53273e-19 27.2 -5.32907e-15 -6.46942e-16 0 5.33951e-16 2.32228e-16 -1 1 1 69 0.00069 290 0 0 0.00412633 -0.00277367 -0.000688747 1.00197e-36 2.702e-19 1.55527e-19 27.6 -5.32907e-15 -6.56864e-16 0 5.41813e-16 2.35632e-16 -1 1 1 70 0.0007 290 0 0 0.00418613 -0.00281387 -0.000698729 1.0165e-36 2.74116e-19 1.57781e-19 28 -5.32907e-15 -6.66786e-16 0 5.49675e-16 2.39036e-16 -1 1 1 71 0.00071 290 0 0 0.00424593 -0.00285407 -0.000708711 1.03102e-36 2.78032e-19 1.60035e-19 28.4 -5.32907e-15 -6.76708e-16 0 5.57537e-16 2.4244e-16 -1 1 1 72 0.00072 290 0 0 0.00430573 -0.00289427 -0.000718693 1.04554e-36 2.81948e-19 1.62289e-19 28.8 -7.10543e-15 -6.8663e-16 0 5.65399e-16 2.45845e-16 -1 1 1 73 0.00073 290 0 0 0.00436554 -0.00293446 -0.000728675 1.06006e-36 2.85864e-19 1.64543e-19 29.2 -8.88178e-15 -6.96552e-16 0 5.73261e-16 2.49249e-16 -1 1 1 74 0.00074 290 0 0 0.00442534 -0.00297466 -0.000738656 1.07458e-36 2.8978e-19 1.66797e-19 29.6 -8.88178e-15 -7.06474e-16 0 5.81123e-16 2.52653e-16 -1 1 1 75 0.00075 290 0 0 0.00448514 -0.00301486 -0.000748638 1.0891e-36 2.93696e-19 1.69051e-19 30 -8.88178e-15 -7.16396e-16 0 5.88984e-16 2.56057e-16 -1 1 1 76 0.00076 290 0 0 0.00454494 -0.00305506 -0.00075862 1.10362e-36 2.97611e-19 1.71305e-19 30.4 -8.88178e-15 -7.26318e-16 0 5.96846e-16 2.59461e-16 -1 1 1 77 0.00077 290 0 0 0.00460474 -0.00309526 -0.000768602 1.11814e-36 3.01527e-19 1.73559e-19 30.8 -8.88178e-15 -7.3624e-16 0 6.04708e-16 2.62866e-16 -1 1 1 78 0.00078 290 0 0 0.00466455 -0.00313545 -0.000778584 1.13267e-36 3.05443e-19 1.75813e-19 31.2 -8.88178e-15 -7.46162e-16 0 6.1257e-16 2.6627e-16 -1 1 1 79 0.00079 290 0 0 0.00472435 -0.00317565 -0.000788566 1.14719e-36 3.09359e-19 1.78067e-19 31.6 -8.88178e-15 -7.56084e-16 0 6.20432e-16 2.69674e-16 -1 1 1 80 0.0008 290 0 0 0.00478415 -0.00321585 -0.000798548 1.16171e-36 3.13275e-19 1.80321e-19 32 -8.88178e-15 -7.66006e-16 0 6.28294e-16 2.73078e-16 -1 1 1 81 0.00081 290 0 0 0.00484395 -0.00325605 -0.000808529 1.17623e-36 3.17191e-19 1.82575e-19 32.4 -1.06581e-14 -7.75928e-16 0 6.36156e-16 2.76482e-16 -1 1 1 82 0.00082 290 0 0 0.00490375 -0.00329625 -0.000818511 1.19075e-36 3.21107e-19 1.84829e-19 32.8 -1.06581e-14 -7.8585e-16 0 6.44018e-16 2.79886e-16 -1 1 1 83 0.00083 290 0 0 0.00496356 -0.00333644 -0.000828493 1.20527e-36 3.25023e-19 1.87083e-19 33.2 -7.10543e-15 -7.95772e-16 0 6.5188e-16 2.83291e-16 -1 1 1 84 0.00084 290 0 0 0.00502336 -0.00337664 -0.000838475 1.21979e-36 3.28939e-19 1.89337e-19 33.6 -7.10543e-15 -8.05694e-16 0 6.59741e-16 2.86695e-16 -1 1 1 85 0.00085 290 0 0 0.00508316 -0.00341684 -0.000848457 1.23432e-36 3.32855e-19 1.91591e-19 34 -7.10543e-15 -8.15616e-16 0 6.67603e-16 2.90099e-16 -1 1 1 86 0.00086 290 0 0 0.00514296 -0.00345704 -0.000858439 1.24884e-36 3.36771e-19 1.93845e-19 34.4 -7.10543e-15 -8.25538e-16 0 6.75465e-16 2.93503e-16 -1 1 1 87 0.00087 290 0 0 0.00520276 -0.00349724 -0.00086842 1.26336e-36 3.40687e-19 1.961e-19 34.8 -7.10543e-15 -8.3546e-16 0 6.83327e-16 2.96907e-16 -1 1 1 88 0.00088 290 0 0 0.00526256 -0.00353744 -0.000878402 1.27788e-36 3.44603e-19 1.98354e-19 35.2 -7.10543e-15 -8.45382e-16 0 6.91189e-16 3.00312e-16 -1 1 1 89 0.00089 290 0 0 0.00532237 -0.00357763 -0.000888384 1.2924e-36 3.48519e-19 2.00608e-19 35.6 -7.10543e-15 -8.55304e-16 0 6.99051e-16 3.03716e-16 -1 1 1 90 0.0009 290 0 0 0.00538217 -0.00361783 -0.000898366 1.30692e-36 3.52435e-19 2.02862e-19 36 -7.10543e-15 -8.65227e-16 0 7.06913e-16 3.0712e-16 -1 1 1 91 0.00091 290 0 0 0.00544197 -0.00365803 -0.000908348 1.32144e-36 3.56351e-19 2.05116e-19 36.4 -7.10543e-15 -8.75149e-16 0 7.14775e-16 3.10524e-16 -1 1 1 92 0.00092 290 0 0 0.00550177 -0.00369823 -0.00091833 1.33597e-36 3.60267e-19 2.0737e-19 36.8 -7.10543e-15 -8.85071e-16 0 7.22637e-16 3.13928e-16 -1 1 1 93 0.00093 290 0 0 0.00556157 -0.00373843 -0.000928312 1.35049e-36 3.64182e-19 2.09624e-19 37.2 -7.10543e-15 -8.94993e-16 0 7.30498e-16 3.17333e-16 -1 1 1 94 0.00094 290 0 0 0.00562138 -0.00377862 -0.000938293 1.36501e-36 3.68098e-19 2.11878e-19 37.6 -7.10543e-15 -9.04915e-16 0 7.3836e-16 3.20737e-16 -1 1 1 95 0.00095 290 0 0 0.00568118 -0.00381882 -0.000948275 1.37953e-36 3.72014e-19 2.14132e-19 38 -7.10543e-15 -9.14837e-16 0 7.46222e-16 3.24141e-16 -1 1 1 96 0.00096 290 0 0 0.00574098 -0.00385902 -0.000958257 1.39405e-36 3.7593e-19 2.16386e-19 38.4 -7.10543e-15 -9.24759e-16 0 7.54084e-16 3.27545e-16 -1 1 1 97 0.00097 290 0 0 0.00580078 -0.00389922 -0.000968239 1.40857e-36 3.79846e-19 2.1864e-19 38.8 -7.10543e-15 -9.34681e-16 0 7.61946e-16 3.30949e-16 -1 1 1 98 0.00098 290 0 0 0.00586058 -0.00393942 -0.000978221 1.42309e-36 3.83762e-19 2.20894e-19 39.2 -7.10543e-15 -9.44603e-16 0 7.69808e-16 3.34353e-16 -1 1 1 99 0.00099 290 0 0 0.00592039 -0.00397961 -0.000988203 1.43761e-36 3.87678e-19 2.23148e-19 39.6 -7.10543e-15 -9.54525e-16 0 7.7767e-16 3.37758e-16 -1 1 1 100 0.001 290 0 0 0.00598019 -0.00401981 -0.000998184 1.45214e-36 3.91594e-19 2.25402e-19 40 -7.10543e-15 -9.64447e-16 0 7.85532e-16 3.41162e-16 diff --git a/testBin/Identification/exp_data/results_pm675.dat b/testBin/Identification/exp_data/results_pm675.dat deleted file mode 100644 index 41ec7dfd8..000000000 --- a/testBin/Identification/exp_data/results_pm675.dat +++ /dev/null @@ -1,100 +0,0 @@ -1 1 1 1 1e-05 290 0 0 8.75148e-05 -1.80649e-05 -2.72251e-05 7.81822e-38 7.02957e-21 -5.40016e-22 0.4 -3.29128e-17 -4.26544e-17 0 1.21313e-17 -1.0955e-18 -1 1 1 2 2e-05 290 0 0 0.00017503 -3.61297e-05 -5.44502e-05 1.56364e-37 1.40591e-20 -1.08003e-21 0.8 -6.58257e-17 -8.53088e-17 0 2.4269e-17 -2.15021e-18 -1 1 1 3 3e-05 290 0 0 0.000262544 -5.41946e-05 -8.16753e-05 2.34546e-37 2.10887e-20 -1.62005e-21 1.2 -7.3364e-17 -1.27963e-16 0 3.64003e-17 -3.24572e-18 -1 1 1 4 4e-05 290 0 0 0.000350059 -7.22594e-05 -0.0001089 3.12729e-37 2.81183e-20 -2.16007e-21 1.6 -1.31651e-16 -1.70618e-16 0 4.85315e-17 -4.34122e-18 -1 1 1 5 5e-05 290 0 0 0.000437574 -9.03243e-05 -0.000136126 3.90911e-37 3.51478e-20 -2.70008e-21 2 -1.66945e-16 -2.13272e-16 0 6.06628e-17 -5.43672e-18 -1 1 1 6 6e-05 290 0 0 0.000525089 -0.000108389 -0.000163351 4.69093e-37 4.21774e-20 -3.2401e-21 2.4 -1.1421e-16 -2.55926e-16 0 7.2794e-17 -6.53222e-18 -1 1 1 7 7e-05 290 0 0 0.000612603 -0.000126454 -0.000190576 5.47275e-37 4.9207e-20 -3.78012e-21 2.8 -1.72498e-16 -2.98581e-16 0 8.49253e-17 -7.62773e-18 -1 1 1 8 8e-05 290 0 0 0.000700118 -0.000144519 -0.000217801 6.25457e-37 5.62366e-20 -4.32013e-21 3.2 -3.0929e-16 -3.41235e-16 0 9.70566e-17 -8.72323e-18 -1 1 1 9 9e-05 290 0 0 0.000787633 -0.000162584 -0.000245026 7.03639e-37 6.32661e-20 -4.86015e-21 3.6 -2.89072e-16 -3.8389e-16 0 1.09188e-16 -9.81873e-18 -1 1 1 10 0.0001 290 0 0 0.000875148 -0.000180649 -0.000272251 7.81822e-37 7.02957e-20 -5.40016e-21 4 -2.68855e-16 -4.26544e-16 0 1.21319e-16 -1.09142e-17 -1 1 1 11 0.00011 290 0 0 0.000962662 -0.000198713 -0.000299476 8.60004e-37 7.73253e-20 -5.94018e-21 4.4 -3.5966e-16 -4.69199e-16 0 1.3345e-16 -1.20097e-17 -1 1 1 12 0.00012 290 0 0 0.00105018 -0.000216778 -0.000326701 9.38186e-37 8.43548e-20 -6.4802e-21 4.8 -5.42439e-16 -5.11853e-16 0 1.45582e-16 -1.31052e-17 -1 1 1 13 0.00013 290 0 0 0.00113769 -0.000234843 -0.000353926 1.01637e-36 9.13844e-20 -7.02021e-21 5.2 -5.68209e-16 -5.54507e-16 0 1.57713e-16 -1.42007e-17 -1 1 1 14 0.00014 290 0 0 0.00122521 -0.000252908 -0.000381152 1.09455e-36 9.8414e-20 -7.56023e-21 5.6 -7.50988e-16 -5.97162e-16 0 1.69844e-16 -1.52963e-17 -1 1 1 15 0.00015 290 0 0 0.00131272 -0.000270973 -0.000408377 1.17273e-36 1.05444e-19 -8.10025e-21 6 -1.15581e-15 -6.39816e-16 0 1.81975e-16 -1.63918e-17 -1 1 1 16 0.00016 290 0 0 0.00140024 -0.000289038 -0.000435602 1.25091e-36 1.12473e-19 -8.64026e-21 6.4 -1.02457e-15 -6.82471e-16 0 1.94107e-16 -1.74873e-17 -1 1 1 17 0.00017 290 0 0 0.00148775 -0.000307103 -0.000462827 1.3291e-36 1.19503e-19 -9.18028e-21 6.8 -1.11538e-15 -7.25125e-16 0 2.06238e-16 -1.85828e-17 -1 1 1 18 0.00018 290 0 0 0.00157527 -0.000325167 -0.000490052 1.40728e-36 1.26532e-19 -9.7203e-21 7.2 -9.84137e-16 -7.67779e-16 0 2.18369e-16 -1.96783e-17 -1 1 1 19 0.00019 290 0 0 0.00166278 -0.000343232 -0.000517277 1.48546e-36 1.33562e-19 -1.02603e-20 7.6 -1.29699e-15 -8.10434e-16 0 2.305e-16 -2.07738e-17 -1 1 1 20 0.0002 290 0 0 0.0017503 -0.000361297 -0.000544502 1.56364e-36 1.40591e-19 -1.08003e-20 8 -1.47977e-15 -8.53088e-16 0 2.42632e-16 -2.18693e-17 -1 1 1 21 0.00021 290 0 0 0.00183781 -0.000379362 -0.000571727 1.64183e-36 1.47621e-19 -1.13403e-20 8.4 -1.66254e-15 -8.95743e-16 0 2.54763e-16 -2.29648e-17 -1 1 1 22 0.00022 290 0 0 0.00192532 -0.000397427 -0.000598952 1.72001e-36 1.54651e-19 -1.18804e-20 8.8 -1.84532e-15 -9.38397e-16 0 2.66894e-16 -2.40603e-17 -1 1 1 23 0.00023 290 0 0 0.00201284 -0.000415492 -0.000626178 1.79819e-36 1.6168e-19 -1.24204e-20 9.2 -2.47219e-15 -9.81051e-16 0 2.79025e-16 -2.51558e-17 -1 1 1 24 0.00024 290 0 0 0.00210035 -0.000433557 -0.000653403 1.87637e-36 1.6871e-19 -1.29604e-20 9.6 -2.65497e-15 -1.02371e-15 0 2.91157e-16 -2.62513e-17 -1 1 1 25 0.00025 290 0 0 0.00218787 -0.000451622 -0.000680628 1.95455e-36 1.75739e-19 -1.35004e-20 10 -2.52373e-15 -1.06636e-15 0 3.03288e-16 -2.73468e-17 -1 1 1 26 0.00026 290 0 0 0.00227538 -0.000469686 -0.000707853 2.03274e-36 1.82769e-19 -1.40404e-20 10.4 -3.02053e-15 -1.10901e-15 0 3.15419e-16 -2.84423e-17 -1 1 1 27 0.00027 290 0 0 0.0023629 -0.000487751 -0.000735078 2.11092e-36 1.89798e-19 -1.45804e-20 10.8 -3.07324e-15 -1.15167e-15 0 3.2755e-16 -2.95378e-17 -1 1 1 28 0.00028 290 0 0 0.00245041 -0.000505816 -0.000762303 2.1891e-36 1.96828e-19 -1.51205e-20 11.2 -2.942e-15 -1.19432e-15 0 3.39682e-16 -3.06333e-17 -1 1 1 29 0.00029 290 0 0 0.00253793 -0.000523881 -0.000789528 2.26728e-36 2.03857e-19 -1.56605e-20 11.6 -2.81076e-15 -1.23698e-15 0 3.51813e-16 -3.17288e-17 -1 1 1 30 0.0003 290 0 0 0.00262544 -0.000541946 -0.000816753 2.34546e-36 2.10887e-19 -1.62005e-20 12 -2.86347e-15 -1.27963e-15 0 3.63944e-16 -3.28243e-17 -1 1 1 31 0.00031 290 0 0 0.00271296 -0.000560011 -0.000843978 2.42365e-36 2.17917e-19 -1.67405e-20 12.4 -2.73223e-15 -1.32229e-15 0 3.76075e-16 -3.39198e-17 -1 1 1 32 0.00032 290 0 0 0.00280047 -0.000578076 -0.000871203 2.50183e-36 2.24946e-19 -1.72805e-20 12.8 -3.04508e-15 -1.36494e-15 0 3.88207e-16 -3.50153e-17 -1 1 1 33 0.00033 290 0 0 0.00288799 -0.00059614 -0.000898429 2.58001e-36 2.31976e-19 -1.78205e-20 13.2 -3.35793e-15 -1.4076e-15 0 4.00338e-16 -3.61108e-17 -1 1 1 34 0.00034 290 0 0 0.0029755 -0.000614205 -0.000925654 2.65819e-36 2.39005e-19 -1.83606e-20 13.6 -3.41063e-15 -1.45025e-15 0 4.12469e-16 -3.72063e-17 -1 1 1 35 0.00035 290 0 0 0.00306302 -0.00063227 -0.000952879 2.73638e-36 2.46035e-19 -1.89006e-20 14 -3.72348e-15 -1.4929e-15 0 4.246e-16 -3.83018e-17 -1 1 1 36 0.00036 290 0 0 0.00315053 -0.000650335 -0.000980104 2.81456e-36 2.53064e-19 -1.94406e-20 14.4 -3.59224e-15 -1.53556e-15 0 4.36732e-16 -3.93973e-17 -1 1 1 37 0.00037 290 0 0 0.00323805 -0.0006684 -0.00100733 2.89274e-36 2.60094e-19 -1.99806e-20 14.8 -3.64495e-15 -1.57821e-15 0 4.48863e-16 -4.04928e-17 -1 1 1 38 0.00038 290 0 0 0.00332556 -0.000686465 -0.00103455 2.97092e-36 2.67124e-19 -2.05206e-20 15.2 -3.69766e-15 -1.62087e-15 0 4.60994e-16 -4.15883e-17 -1 1 1 39 0.00039 290 0 0 0.00341308 -0.00070453 -0.00106178 3.0491e-36 2.74153e-19 -2.10606e-20 15.6 -3.12233e-15 -1.66352e-15 0 4.73125e-16 -4.26838e-17 -1 1 1 40 0.0004 290 0 0 0.00350059 -0.000722594 -0.001089 3.12729e-36 2.81183e-19 -2.16007e-20 16 -2.547e-15 -1.70618e-15 0 4.85257e-16 -4.37793e-17 -1 1 1 41 0.00041 290 0 0 0.00358811 -0.000740659 -0.00111623 3.20547e-36 2.88212e-19 -2.21407e-20 16.4 -3.48789e-15 -1.74883e-15 0 4.97388e-16 -4.48748e-17 -1 1 1 42 0.00042 290 0 0 0.00367562 -0.000758724 -0.00114345 3.28365e-36 2.95242e-19 -2.26807e-20 16.8 -4.42878e-15 -1.79149e-15 0 5.09519e-16 -4.59703e-17 -1 1 1 43 0.00043 290 0 0 0.00376313 -0.000776789 -0.00117068 3.36183e-36 3.02271e-19 -2.32207e-20 17.2 -4.74163e-15 -1.83414e-15 0 5.2165e-16 -4.70658e-17 -1 1 1 44 0.00044 290 0 0 0.00385065 -0.000794854 -0.0011979 3.44001e-36 3.09301e-19 -2.37607e-20 17.6 -5.05448e-15 -1.87679e-15 0 5.33782e-16 -4.81613e-17 -1 1 1 45 0.00045 290 0 0 0.00393816 -0.000812919 -0.00122513 3.5182e-36 3.16331e-19 -2.43007e-20 18 -5.99536e-15 -1.91945e-15 0 5.45913e-16 -4.92569e-17 -1 1 1 46 0.00046 290 0 0 0.00402568 -0.000830984 -0.00125236 3.59638e-36 3.2336e-19 -2.48408e-20 18.4 -6.04807e-15 -1.9621e-15 0 5.58044e-16 -5.03524e-17 -1 1 1 47 0.00047 290 0 0 0.00411319 -0.000849048 -0.00127958 3.67456e-36 3.3039e-19 -2.53808e-20 18.8 -6.10078e-15 -2.00476e-15 0 5.70175e-16 -5.14479e-17 -1 1 1 48 0.00048 290 0 0 0.00420071 -0.000867113 -0.00130681 3.75274e-36 3.37419e-19 -2.59208e-20 19.2 -6.41363e-15 -2.04741e-15 0 5.82307e-16 -5.25434e-17 -1 1 1 49 0.00049 290 0 0 0.00428822 -0.000885178 -0.00133403 3.83093e-36 3.44449e-19 -2.64608e-20 19.6 -7.09437e-15 -2.09007e-15 0 5.94438e-16 -5.36389e-17 -1 1 1 50 0.0005 290 0 0 0.00437574 -0.000903243 -0.00136126 3.90911e-36 3.51478e-19 -2.70008e-20 20 -7.14708e-15 -2.13272e-15 0 6.06569e-16 -5.47344e-17 -1 1 1 51 0.00051 290 0 0 0.00446325 -0.000921308 -0.00138848 3.98729e-36 3.58508e-19 -2.75408e-20 20.4 -8.08797e-15 -2.17537e-15 0 6.187e-16 -5.58299e-17 -1 1 1 52 0.00052 290 0 0 0.00455077 -0.000939373 -0.00141571 4.06547e-36 3.65538e-19 -2.80809e-20 20.8 -8.40082e-15 -2.21803e-15 0 6.30832e-16 -5.69254e-17 -1 1 1 53 0.00053 290 0 0 0.00463828 -0.000957438 -0.00144293 4.14365e-36 3.72567e-19 -2.86209e-20 21.2 -9.3417e-15 -2.26068e-15 0 6.42963e-16 -5.80209e-17 -1 1 1 54 0.00054 290 0 0 0.0047258 -0.000975502 -0.00147016 4.22184e-36 3.79597e-19 -2.91609e-20 21.6 -1.02826e-14 -2.30334e-15 0 6.55094e-16 -5.91164e-17 -1 1 1 55 0.00055 290 0 0 0.00481331 -0.000993567 -0.00149738 4.30002e-36 3.86626e-19 -2.97009e-20 22 -1.05954e-14 -2.34599e-15 0 6.67226e-16 -6.02119e-17 -1 1 1 56 0.00056 290 0 0 0.00490083 -0.00101163 -0.00152461 4.3782e-36 3.93656e-19 -3.02409e-20 22.4 -1.09083e-14 -2.38865e-15 0 6.79357e-16 -6.13074e-17 -1 1 1 57 0.00057 290 0 0 0.00498834 -0.0010297 -0.00155183 4.45638e-36 4.00685e-19 -3.07809e-20 22.8 -1.1589e-14 -2.4313e-15 0 6.91488e-16 -6.24029e-17 -1 1 1 58 0.00058 290 0 0 0.00507586 -0.00104776 -0.00157906 4.53456e-36 4.07715e-19 -3.1321e-20 23.2 -1.10137e-14 -2.47396e-15 0 7.03619e-16 -6.34984e-17 -1 1 1 59 0.00059 290 0 0 0.00516337 -0.00106583 -0.00160628 4.61275e-36 4.14745e-19 -3.1861e-20 23.6 -1.13266e-14 -2.51661e-15 0 7.15751e-16 -6.45939e-17 -1 1 1 60 0.0006 290 0 0 0.00525089 -0.00108389 -0.00163351 4.69093e-36 4.21774e-19 -3.2401e-20 24 -1.16394e-14 -2.55926e-15 0 7.27882e-16 -6.56894e-17 -1 1 1 61 0.00061 290 0 0 0.0053384 -0.00110196 -0.00166073 4.76911e-36 4.28804e-19 -3.2941e-20 24.4 -1.1432e-14 -2.60192e-15 0 7.40013e-16 -6.67849e-17 -1 1 1 62 0.00062 290 0 0 0.00542592 -0.00112002 -0.00168796 4.84729e-36 4.35833e-19 -3.3481e-20 24.8 -1.17448e-14 -2.64457e-15 0 7.52144e-16 -6.78804e-17 -1 1 1 63 0.00063 290 0 0 0.00551343 -0.00113809 -0.00171518 4.92548e-36 4.42863e-19 -3.4021e-20 25.2 -1.11695e-14 -2.68723e-15 0 7.64276e-16 -6.89759e-17 -1 1 1 64 0.00064 290 0 0 0.00560094 -0.00115615 -0.00174241 5.00366e-36 4.49892e-19 -3.45611e-20 25.6 -1.18502e-14 -2.72988e-15 0 7.76407e-16 -7.00714e-17 -1 1 1 65 0.00065 290 0 0 0.00568846 -0.00117422 -0.00176963 5.08184e-36 4.56922e-19 -3.51011e-20 26 -1.12749e-14 -2.77254e-15 0 7.88538e-16 -7.11669e-17 -1 1 1 66 0.00066 290 0 0 0.00577597 -0.00119228 -0.00179686 5.16002e-36 4.63952e-19 -3.56411e-20 26.4 -1.15878e-14 -2.81519e-15 0 8.00669e-16 -7.22624e-17 -1 1 1 67 0.00067 290 0 0 0.00586349 -0.00121035 -0.00182408 5.2382e-36 4.70981e-19 -3.61811e-20 26.8 -1.31567e-14 -2.85785e-15 0 8.12801e-16 -7.33579e-17 -1 1 1 68 0.00068 290 0 0 0.005951 -0.00122841 -0.00185131 5.31639e-36 4.78011e-19 -3.67211e-20 27.2 -1.47256e-14 -2.9005e-15 0 8.24932e-16 -7.44534e-17 -1 1 1 69 0.00069 290 0 0 0.00603852 -0.00124648 -0.00187853 5.39457e-36 4.8504e-19 -3.72611e-20 27.6 -1.54064e-14 -2.94315e-15 0 8.37063e-16 -7.55489e-17 -1 1 1 70 0.0007 290 0 0 0.00612603 -0.00126454 -0.00190576 5.47275e-36 4.9207e-19 -3.78012e-20 28 -1.66074e-14 -2.98581e-15 0 8.49194e-16 -7.66444e-17 -1 1 1 71 0.00071 290 0 0 0.00621355 -0.00128261 -0.00193298 5.55093e-36 4.99099e-19 -3.83412e-20 28.4 -1.69202e-14 -3.02846e-15 0 8.61326e-16 -7.77399e-17 -1 1 1 72 0.00072 290 0 0 0.00630106 -0.00130067 -0.00196021 5.62912e-36 5.06129e-19 -3.88812e-20 28.8 -1.63449e-14 -3.07112e-15 0 8.73457e-16 -7.88354e-17 -1 1 1 73 0.00073 290 0 0 0.00638858 -0.00131873 -0.00198743 5.7073e-36 5.13159e-19 -3.94212e-20 29.2 -1.75459e-14 -3.11377e-15 0 8.85588e-16 -7.99309e-17 -1 1 1 74 0.00074 290 0 0 0.00647609 -0.0013368 -0.00201466 5.78548e-36 5.20188e-19 -3.99612e-20 29.6 -1.8747e-14 -3.15643e-15 0 8.97719e-16 -8.10264e-17 -1 1 1 75 0.00075 290 0 0 0.00656361 -0.00135486 -0.00204188 5.86366e-36 5.27218e-19 -4.05012e-20 30 -2.06838e-14 -3.19908e-15 0 9.09851e-16 -8.21219e-17 -1 1 1 76 0.00076 290 0 0 0.00665112 -0.00137293 -0.00206911 5.94184e-36 5.34247e-19 -4.10413e-20 30.4 -2.09966e-14 -3.24174e-15 0 9.21982e-16 -8.32174e-17 -1 1 1 77 0.00077 290 0 0 0.00673864 -0.00139099 -0.00209633 6.02003e-36 5.41277e-19 -4.15813e-20 30.8 -2.13095e-14 -3.28439e-15 0 9.34113e-16 -8.4313e-17 -1 1 1 78 0.00078 290 0 0 0.00682615 -0.00140906 -0.00212356 6.09821e-36 5.48306e-19 -4.21213e-20 31.2 -2.28784e-14 -3.32704e-15 0 9.46244e-16 -8.54085e-17 -1 1 1 79 0.00079 290 0 0 0.00691367 -0.00142712 -0.00215078 6.17639e-36 5.55336e-19 -4.26613e-20 31.6 -2.44473e-14 -3.3697e-15 0 9.58376e-16 -8.6504e-17 -1 1 1 80 0.0008 290 0 0 0.00700118 -0.00144519 -0.00217801 6.25457e-36 5.62366e-19 -4.32013e-20 32 -2.42399e-14 -3.41235e-15 0 9.70507e-16 -8.75995e-17 -1 1 1 81 0.00081 290 0 0 0.0070887 -0.00146325 -0.00220523 6.33275e-36 5.69395e-19 -4.37413e-20 32.4 -2.45527e-14 -3.45501e-15 0 9.82638e-16 -8.8695e-17 -1 1 1 82 0.00082 290 0 0 0.00717621 -0.00148132 -0.00223246 6.41094e-36 5.76425e-19 -4.42813e-20 32.8 -2.61217e-14 -3.49766e-15 0 9.94769e-16 -8.97905e-17 -1 1 1 83 0.00083 290 0 0 0.00726372 -0.00149938 -0.00225968 6.48912e-36 5.83454e-19 -4.48214e-20 33.2 -2.64345e-14 -3.54032e-15 0 1.0069e-15 -9.0886e-17 -1 1 1 84 0.00084 290 0 0 0.00735124 -0.00151745 -0.00228691 6.5673e-36 5.90484e-19 -4.53614e-20 33.6 -2.4971e-14 -3.58297e-15 0 1.01903e-15 -9.19815e-17 -1 1 1 85 0.00085 290 0 0 0.00743875 -0.00153551 -0.00231413 6.64548e-36 5.97513e-19 -4.59014e-20 34 -2.65399e-14 -3.62562e-15 0 1.03116e-15 -9.3077e-17 -1 1 1 86 0.00086 290 0 0 0.00752627 -0.00155358 -0.00234136 6.72367e-36 6.04543e-19 -4.64414e-20 34.4 -2.86291e-14 -3.66828e-15 0 1.04329e-15 -9.41725e-17 -1 1 1 87 0.00087 290 0 0 0.00761378 -0.00157164 -0.00236858 6.80185e-36 6.11572e-19 -4.69814e-20 34.8 -3.09338e-14 -3.71093e-15 0 1.05543e-15 -9.5268e-17 -1 1 1 88 0.00088 290 0 0 0.0077013 -0.00158971 -0.00239581 6.88003e-36 6.18602e-19 -4.75214e-20 35.2 -3.25028e-14 -3.75359e-15 0 1.06756e-15 -9.63635e-17 -1 1 1 89 0.00089 290 0 0 0.00778881 -0.00160777 -0.00242303 6.95821e-36 6.25632e-19 -4.80615e-20 35.6 -3.15595e-14 -3.79624e-15 0 1.07969e-15 -9.7459e-17 -1 1 1 90 0.0009 290 0 0 0.00787633 -0.00162584 -0.00245026 7.03639e-36 6.32661e-19 -4.86015e-20 36 -3.18724e-14 -3.8389e-15 0 1.09182e-15 -9.85545e-17 -1 1 1 91 0.00091 290 0 0 0.00796384 -0.0016439 -0.00247748 7.11458e-36 6.39691e-19 -4.91415e-20 36.4 -3.39616e-14 -3.88155e-15 0 1.10395e-15 -9.965e-17 -1 1 1 92 0.00092 290 0 0 0.00805136 -0.00166197 -0.00250471 7.19276e-36 6.4672e-19 -4.96815e-20 36.8 -3.50102e-14 -3.92421e-15 0 1.11608e-15 -1.00746e-16 -1 1 1 93 0.00093 290 0 0 0.00813887 -0.00168003 -0.00253194 7.27094e-36 6.5375e-19 -5.02215e-20 37.2 -3.48028e-14 -3.96686e-15 0 1.12821e-15 -1.01841e-16 -1 1 1 94 0.00094 290 0 0 0.00822639 -0.0016981 -0.00255916 7.34912e-36 6.60779e-19 -5.07615e-20 37.6 -3.45954e-14 -4.00951e-15 0 1.14034e-15 -1.02937e-16 -1 1 1 95 0.00095 290 0 0 0.0083139 -0.00171616 -0.00258639 7.4273e-36 6.67809e-19 -5.13016e-20 38 -3.5644e-14 -4.05217e-15 0 1.15248e-15 -1.04032e-16 -1 1 1 96 0.00096 290 0 0 0.00840142 -0.00173423 -0.00261361 7.50549e-36 6.74839e-19 -5.18416e-20 38.4 -3.77332e-14 -4.09482e-15 0 1.16461e-15 -1.05128e-16 -1 1 1 97 0.00097 290 0 0 0.00848893 -0.00175229 -0.00264084 7.58367e-36 6.81868e-19 -5.23816e-20 38.8 -3.87819e-14 -4.13748e-15 0 1.17674e-15 -1.06223e-16 -1 1 1 98 0.00098 290 0 0 0.00857645 -0.00177036 -0.00266806 7.66185e-36 6.88898e-19 -5.29216e-20 39.2 -4.03508e-14 -4.18013e-15 0 1.18887e-15 -1.07319e-16 -1 1 1 99 0.00099 290 0 0 0.00866396 -0.00178842 -0.00269529 7.74003e-36 6.95927e-19 -5.34616e-20 39.6 -4.19197e-14 -4.22279e-15 0 1.201e-15 -1.08414e-16 -1 1 1 100 0.001 290 0 0 0.00875148 -0.00180649 -0.00272251 7.81822e-36 7.02957e-19 -5.40016e-20 40 -4.22326e-14 -4.26544e-15 0 1.21313e-15 -1.0951e-16 diff --git a/testBin/Identification/id_params.txt b/testBin/Identification/id_params.txt deleted file mode 100644 index 7d61c7491..000000000 --- a/testBin/Identification/id_params.txt +++ /dev/null @@ -1,106 +0,0 @@ -g nindividual cost p(0) p(1) p(2) p(3) p(4) -0 1 1.6286 19395.6 5170.5 0.0402935 0.260553 4418.88 -0 3 1.79133 39848.7 4559.21 0.267728 0.235859 5356.34 -0 5 3.07423 26402.9 3319.51 0.140803 0.26414 5352.47 -0 2 3.41667 31139.4 3618.29 0.202336 0.255151 6194.34 -0 4 11.5655 17196.2 5589.48 0.205055 0.208168 5033.58 -1 1 1.6286 19395.6 5170.5 0.0402935 0.260553 4418.88 -1 3 1.79133 39848.7 4559.21 0.267728 0.235859 5356.34 -1 12 2.41025 39817.9 5585.41 0.267584 0.236021 5358.32 -1 5 3.07423 26402.9 3319.51 0.140803 0.26414 5352.47 -1 2 3.41667 31139.4 3618.29 0.202336 0.255151 6194.34 -2 18 1.28745 39868.2 5169.07 0.040294 0.260609 4417.63 -2 1 1.6286 19395.6 5170.5 0.0402935 0.260553 4418.88 -2 3 1.79133 39848.7 4559.21 0.267728 0.235859 5356.34 -2 16 1.79316 39842.1 4558.19 0.267511 0.235797 5354.72 -2 12 2.41025 39817.9 5585.41 0.267584 0.236021 5358.32 -3 18 1.28745 35881.3 5685.98 0.0443233 0.260609 3975.87 -3 25 1.62821 19391.2 5172.56 0.0403023 0.260751 4417.49 -3 1 1.6286 19395.6 5170.5 0.0402935 0.260553 4418.88 -3 22 1.63533 39876.5 5172.55 0.0402851 0.235811 5359.17 -3 24 1.78832 39880.8 4560.95 0.267719 0.235844 5353.41 -4 18 1.06683 32293.2 5117.38 0.0487557 0.28667 3578.28 -4 28 1.07293 35887 5731.57 0.0443333 0.260565 3978.79 -4 25 1.62821 19391.2 5172.56 0.0403023 0.260751 4417.49 -4 1 1.6286 19395.6 5170.5 0.0402935 0.260553 4418.88 -4 26 1.63484 39843.4 5177.08 0.0403087 0.235765 5358.18 -5 18 0.750474 30123.4 5192.46 0.0536313 0.28667 3220.45 -5 28 1.07293 35887 5731.57 0.0443333 0.260565 3978.79 -5 33 1.24279 32275.6 5166.34 0.0402933 0.260476 4416.78 -5 35 1.31525 35881 5728.49 0.0403206 0.260995 4418.23 -5 34 1.62739 19401.7 5170.56 0.0402755 0.260361 4417.18 -6 18 0.538274 30650.4 4857.84 0.0589944 0.28667 2898.41 -6 39 0.721688 35855.7 5192.87 0.0403331 0.261132 3219.64 -6 37 1.01372 35900.1 5175.14 0.0443638 0.260448 3982.59 -6 28 1.07293 35887 5731.57 0.0443333 0.260565 3978.79 -6 33 1.24279 32275.6 5166.34 0.0402933 0.260476 4416.78 -7 18 0.318462 30702.4 4810.9 0.0648938 0.28667 2608.57 -7 43 0.666364 35867.4 5193.63 0.0443439 0.260408 3219.9 -7 41 0.720591 35821.5 5198.02 0.0403271 0.260896 3216.68 -7 39 0.721688 35855.7 5192.87 0.0403331 0.261132 3219.64 -7 37 1.01372 35900.1 5175.14 0.0443638 0.260448 3982.59 -8 18 0.167307 30849.4 4680.36 0.0649591 0.28667 2347.71 -8 48 0.191735 30692.4 5197.88 0.0648701 0.286583 2608.53 -8 43 0.666364 35867.4 5193.63 0.0443439 0.260408 3219.9 -8 50 0.666463 35826.4 5188.49 0.0443464 0.260188 3222.2 -8 49 0.719825 35829.8 5191.63 0.040348 0.260534 3217.01 -9 18 0.0645795 30970.6 4609.36 0.0649753 0.28667 2112.94 -9 48 0.191735 30692.4 5197.88 0.0648701 0.286583 2608.53 -9 55 0.433519 30833.9 4676.56 0.0649932 0.260054 3219.38 -9 51 0.478741 35866.8 5197.54 0.0649263 0.286436 3220.43 -9 53 0.637113 30697.3 5201.27 0.0443175 0.260286 3225.12 -10 18 0.00826572 31022.8 4572.87 0.0649753 0.28667 1993.78 -10 57 0.00954538 30835.4 4677.59 0.064941 0.286459 2112.84 -10 56 0.160356 30841.1 4676.98 0.064835 0.286704 2610.82 -10 48 0.191735 30692.4 5197.88 0.0648701 0.286583 2608.53 -10 55 0.433519 30833.9 4676.56 0.0649932 0.260054 3219.38 -11 18 2.3026e-05 31033 4569.05 0.0649992 0.28667 1999.97 -11 64 0.00935517 31006.6 4679.96 0.065033 0.28683 2112.44 -11 57 0.00954538 30835.4 4677.59 0.064941 0.286459 2112.84 -11 61 0.153599 31049.5 4570.51 0.0648519 0.28672 2609.74 -11 62 0.155497 30823.6 4568.9 0.0649681 0.286425 2612.67 -12 18 1.36597e-09 31033.4 4569.02 0.0649992 0.28667 1999.99 -12 64 0.00935517 31006.6 4679.96 0.065033 0.28683 2112.44 -12 66 0.00939566 31019.1 4681.13 0.0650748 0.286641 2112.77 -12 57 0.00954538 30835.4 4677.59 0.064941 0.286459 2112.84 -12 68 0.00974444 30837.2 4678.37 0.0649123 0.286487 2114.06 -13 18 4.70469e-10 31033.4 4569.02 0.0649994 0.28667 1999.99 -13 71 0.00915974 31027.4 4677.05 0.0650944 0.286687 2111.74 -13 74 0.00928349 31002.8 4678.04 0.0650473 0.286646 2112.23 -13 64 0.00935517 31006.6 4679.96 0.065033 0.28683 2112.44 -13 73 0.00937351 31041.9 4676.8 0.0650008 0.286372 2113.02 -14 18 4.61305e-10 31033.4 4569.02 0.0649994 0.28667 1999.99 -14 71 0.00915974 31027.4 4677.05 0.0650944 0.286687 2111.74 -14 74 0.00928349 31002.8 4678.04 0.0650473 0.286646 2112.23 -14 78 0.00929869 30994.4 4672.27 0.0649791 0.286636 2112.85 -14 64 0.00935517 31006.6 4679.96 0.065033 0.28683 2112.44 -15 18 4.58282e-10 31033.4 4569 0.0649995 0.28667 1999.99 -15 83 3.72183e-06 31006.7 4564.55 0.0650141 0.286575 1999.04 -15 84 0.00903032 31032.1 4677.67 0.0649847 0.286619 2110.32 -15 71 0.00915974 31027.4 4677.05 0.0650944 0.286687 2111.74 -15 74 0.00928349 31002.8 4678.04 0.0650473 0.286646 2112.23 -16 18 4.58282e-10 31033.4 4569 0.0649995 0.28667 1999.99 -16 83 3.72183e-06 31006.7 4564.55 0.0650141 0.286575 1999.04 -16 88 4.01089e-06 31056.6 4566.9 0.0651326 0.286415 2001.39 -16 90 0.000498627 31018.2 4679.08 0.064947 0.286825 2000.7 -16 89 0.00898431 31044.5 4673.77 0.065074 0.286721 2110.91 -17 18 4.58282e-10 31033.4 4569 0.0649995 0.28667 1999.99 -17 83 3.72183e-06 31006.7 4564.55 0.0650141 0.286575 1999.04 -17 88 4.01089e-06 31056.6 4566.9 0.0651326 0.286415 2001.39 -17 93 0.00042766 31057.1 4670.83 0.0650446 0.28638 2001.64 -17 95 0.000428565 31068.6 4669.58 0.0649413 0.286783 1999.83 -18 18 4.58282e-10 31033.4 4569 0.0649995 0.28667 1999.99 -18 97 1.92161e-06 31040 4567.91 0.0649961 0.286791 1998.45 -18 83 3.72183e-06 31006.7 4564.55 0.0650141 0.286575 1999.04 -18 88 4.01089e-06 31056.6 4566.9 0.0651326 0.286415 2001.39 -18 96 4.01756e-06 31072 4560.72 0.0649919 0.286517 2001.66 -19 18 4.58282e-10 31033.4 4569 0.0649995 0.28667 1999.99 -19 101 1.41417e-06 31028.7 4566.15 0.0650478 0.28704 2000.28 -19 97 1.92161e-06 31040 4567.91 0.0649961 0.286791 1998.45 -19 83 3.72183e-06 31006.7 4564.55 0.0650141 0.286575 1999.04 -19 105 3.88246e-06 31046.5 4563.77 0.0649763 0.286232 2002.53 -20 18 4.58282e-10 31033.4 4569 0.0649995 0.28667 1999.99 -20 101 1.41417e-06 31028.7 4566.15 0.0650478 0.28704 2000.28 -20 106 1.48152e-06 31033.7 4563.45 0.0650191 0.286939 2000.77 -20 109 1.57711e-06 31000.3 4566.02 0.06495 0.0474461 1999.7 -20 97 1.92161e-06 31040 4567.91 0.0649961 0.286791 1998.45 diff --git a/testBin/Identification/keys/Nlayers0.dat b/testBin/Identification/keys/Nlayers0.dat deleted file mode 100755 index f885490b3..000000000 --- a/testBin/Identification/keys/Nlayers0.dat +++ /dev/null @@ -1,32 +0,0 @@ -Number umat save c psi_mat theta_mat phi_mat psi_geom theta_geom phi_geom nprops nstatev props -0 ELIST 1 0.5 @0c 0. 0 0. 90. -90. 8 1 1 @0p @1p @2p @3p @4p 0. 0. -1 ELIST 1 0.5 @1c 0. 0. 0. 90. -90. 8 1 1 @0p @1p @2p @3p @4p 0. 0. - - - - - - - - - - - - - - - - - - - - - - - - - - - - -