Error while generating Morris experiment

Hi

I encountered a bug with otmorris modul
I use openturns v1.17 and otmorris v0.10
I have about 40 input parameters in my model

first I managed to generate a Morris experiment with level=4 for each input
I specify the min-max values for each input obviously

but it would be better for me to generate a Morris experiment with different level for each input, (level = 3 or 4 or 5 depending on input characteristics)
I think it’s possible with otmorris, but I had this error :
error “you are requiring 10 trajectories whereas number of possibilities is zero”

any idea ?
or just get otmorris version 0.11 ? where could I find an installation package *.tar.gz2 ?

why this

Hi

Is it possible to share a script?
We can thus investigate your issue.

Regards

Hi below my script
Thanks !

“”"
#!/usr/bin/env python

coding: utf-8

from future import print_function
import os, sys
import numpy as np
import openturns as ot
import otmorris

import openturns.viewer as viewer
from matplotlib import pylab as plt
ot.Log.Show(ot.Log.NONE)

csv_separator = ‘;’

print(sys.version)

inputs_tokens = [‘P1’, ‘P2’, ‘P3’, ‘P4’, ‘P5’, ‘P6’, ‘P7’, ‘P9’, ‘P10’, ‘P11’, ‘P13’, ‘P14’, ‘P15’, ‘P16’, ‘P17’, ‘P18’, ‘P20’, ‘P21’, ‘P22’, ‘P25’, ‘P26’, ‘P27’, ‘P28’, ‘P29’, ‘P30’, ‘P31’, ‘P32’, ‘P33’, ‘P34’, ‘P35’, ‘P36’, ‘P37’, ‘P38’, ‘P39’, ‘P41’, ‘P42’, ‘P44’, ‘P45’, ‘P47’, ‘P48’, ‘P49’, ‘P50’, ‘P61’, ‘P65’]
outputs = [‘P51’, ‘P52’, ‘P53’, ‘P54’, ‘P55’, ‘P56’, ‘P57’, ‘P58’, ‘P59’, ‘P69’, ‘P70’]
formulas = [‘P1+P2+P3’, ‘P4+P5+P6+P7+P9+P10’, ‘P11+P13+P14+P15+P16+P17’, ‘P18+P20+P21+P22’, ‘P25+P26+P27+P28+P29+P30+P31+P32+P33’, ‘P34+P35+P36+P37’, ‘P38+P39+P41’, ‘P42+P44+P45+P47’, ‘P47+P48+P49+P50’, ‘P61’, ‘P65’]

inputs_interval = ot.Interval([0.33, 7.3, 2.25, 2.1, 6.68, 0, -20.0, 0, 1.29, 2.775, 0.46, 57.5, 0.95, 0.92, 0, -18, 0, 2.8, 0.1346, 3.895, 4.575, 5.165, 0.495, 0.9, 0.49, 7.1, 2.325, 0.03, 0.03, 0.03, 0.03, 0.03, 0.765, 0.81, 0, 0, -10.0, 0.5695, 3.63, 10.45, 32.283, 1.5, 72, 8650],
[0.35, 7.32, 2.26, 2.11, 6.88, 0.02, 20.0, 1, 1.3, 2.8, 0.48, 62.5, 1.05, 1.01, 0.03, -18, 1, 2.85, 0.1646, 3.905, 4.625, 5.265, 0.505, 1.04, 0.53, 7.3, 2.35, 0.06, 0.06, 0.06, 0.06, 0.06, 0.78, 0.825, 0.03, 1, 10.0, 0.57, 3.65, 10.5, 34.283, 1.54, 92, 8800])

inputs_levels = [ 3,3,3,3,5,3,4,4,3,3,3,3,3,4,4,4,4,5,3,3,3,3,3,5,5,5,5,4,4,4,4,4,4,4,4,4,4,3,3,5,3,5,5,4 ]

Number of trajectories

r = 10

Define a k-grid level (so delta = 1/(k-1))

k = 4
dim = len(inputs_tokens)

premier plan experiences, avec le meme level pour chaque parametre d’entree

experiment1 = otmorris.MorrisExperimentGrid([k] * dim, inputs_interval, r)
morris_sample1 = experiment1.generate()

print(“experiment for morris = \n”, morris_sample1)

Save sample into files

dirname = r"D:\Users\Public\MES_OUTILS\TESTS_OpenTurns_Persalys"
input_csv_filename = os.path.join(dirname, “morris_sample1.csv”)
morris_sample1.setDescription(inputs_tokens)
morris_sample1.exportToCSVFile(input_csv_filename, csv_separator)

second plan experiences, avec le level adapte a chaque parametre d’entree

print("\n len = ", dim, len(inputs_levels))

experiment2 = otmorris.MorrisExperimentGrid(inputs_levels, inputs_interval, r)
morris_sample2 = experiment2.generate()

print(“experiment for morris = \n”, morris_sample2)

Save sample into files morris_sample2

dirname = r"D:\Users\Public\MES_OUTILS\TESTS_OpenTurns_Persalys"
input_csv_filename = os.path.join(dirname, “morris_sample2.csv”)
morris_sample2.setDescription(inputs_tokens)
morris_sample2.exportToCSVFile(input_csv_filename, csv_separator)

“”"

Hello Flore,
I have looked a bit at the source code of otmorris, but I have not been able to identify where this issue comes from exactly.
However, it is interesting to point out that it is limited to uneven interval values for large dimensions. Indeed, you would obtain the exact same error if you run the following code :

import otmorris
dim = 44
k = 3
inputs_levels = [ k]*dim
r = 10
experiment = otmorris.MorrisExperimentGrid(inputs_levels, r)

While setting k = 4,6 or 8 would work perfectly. Similarly, reducing the dimension also makes it so that the bug disappears. Indeed, dim = 20 and k = 3 works.

As a temporary solution, I would advise either using a constant and even number of levels, or only using even number of levels, like :

 inputs_levels = [ 4,4,4,4,6,4,4,4,4,4,4,4,4,4,4,4,4,6,4,4,4,4,4,6,6,6,6,4,4,4,4,4,4,4,4,4,4,4,4,6,4,6,6,4 ]

I’ll keep looking to find a more permanent solution. Cheers!

Looks like fullDesignSize overflow for large dimension · Issue #46 · openturns/otmorris · GitHub, which was fixed in v0.11, unfortunately no binaries are available yet (except via persalys).

@schueller I had a similar intuition reading the code on github. However, I don’t understand where the different behavior between even and uneven number of levels comes from.

Hello
I manage to generate my morris DOE with different mixed levels 4, 5 and 6 (I only replaced those with level=3 by level=6)
however it’s weird

thanks for all