datamod.evaluator module

Contains the classes to evaluate the new samples, typically using an external software.

class datamod.evaluator.Evaluator

Bases: object

General evaluator class.

save_results

Function to write the results into the results database.

iteration

Iteration number.

Type:int
generate_results(samples, file, iteration, verify)

Generate the response and save the result to the database.

Parameters:
  • samples (np.array) – Samples to evaluate.
  • file (str) – Path and name of the database file.
  • iteration (int) – Iteration number.
  • verify (bool) – Whether this is a verification evaluation.
class datamod.evaluator.EvaluatorANSYS

Bases: datamod.evaluator.Evaluator

Evaluate the samples using ANSYS.

ansys_project_folder

Path to the folder of the ANSYS project.

Type:str
input_param_name

Names of the input parameters.

Type:list
setup

ANSYS settings.

Type:dict
valid_licences

Licences required for running ANSYS:

Type:list
can_run_ansys(minimal_amount=2)

Determine whether there is a sufficient amount of available licenses to run the simulation.

Parameters:minimal_amount (int) – Minimal required amount of available licenses.
Returns:Whether it is possible to run ANSYS or not.
Return type:status (bool)

Notes

Returns True whenever at least one license is available.

check_licenses()

Request the license server for infomation about license usage.

Returns:Licence names with the number of unused licenses.
Return type:license_status (dict)
evaluate(samples, verify)

Evaluate the samples.

Parameters:
  • samples (np.array) – Samples to evaluate.
  • verify (bool) – Whether this is a verification evaluation.
Returns:

Output values at the samples.

Return type:

results (np.array)

get_info()

Get information about the problem.

Returns:Input parameter allowable ranges. dim_in (int): Number of input dimensions. dim_out (int): Number of output dimensions. n_constr (int): Number of constraints.
Return type:range_in (np.array)
scrape_license_info(line)

Extract the number of available ANSYS licenses.

Parameters:line (str) – Line containing the license usage information.
Returns:Name of the license. available (int): Number of available unused licenses.
Return type:license_name (str)
class datamod.evaluator.EvaluatorANSYSAPDL

Bases: datamod.evaluator.EvaluatorANSYS

Evaluate the samples through ANSYS APDL.

Notes

Not documented thorougly as it is a dev version for the particular problem.

call_ansys()

Evaluate the requested input files.

evaluate(samples, verify)

Evaluate the samples.

Parameters:
  • samples (np.array) – Samples to evaluate.
  • verify (bool) – Whether this is a verification evaluation.
Returns:

Output values at the samples.

Return type:

response (np.array)

get_results(verify)

Retrieve the results from text files.

Parameters:verify (bool) – Whether this is a verification evaluation.
Returns:Output values at the samples.
Return type:response (np.array)
update_input(samples)

Update the unput files.

Parameters:samples (np.array) – Input samples to evaluate.
class datamod.evaluator.EvaluatorANSYSWB

Bases: datamod.evaluator.EvaluatorANSYS

Evaluate the samples through ANSYS Workbench.

workbench_project

Path and name to the ANSYS workbench project.

Type:str
template

Path and name to the journal file template.

Type:str
output

Path and name to the newly created journal folder.

Type:str
iteration

Iteration number.

Type:int
call_ansys()

Evaluate the requested input files.

evaluate(samples, verify)

Evaluate the samples.

Parameters:
  • samples (np.array) – Samples to evaluate.
  • verify (bool) – Whether this is a verification evaluation.
Returns:

Output values at the samples.

Return type:

results (np.array)

Notes

A trick with iterations

get_results(verify)

Retrieve the results from CSV files.

Parameters:verify (bool) – Whether this is a verification evaluation.
Returns:Output values at the samples.
Return type:response (np.array)
update_input(samples)

Create an input journal from the template.

Parameters:samples (np.array) – Samples to evaluate.
class datamod.evaluator.EvaluatorBenchmark

Bases: datamod.evaluator.Evaluator

Evaluate a benchmark problem on the given sample.

problem

Benchmark problem.

results

List of values requested from the problem.

Type:list
evaluate(samples, verify)

Evaluate the samples.

Parameters:
  • samples (np.array) – Samples to evaluate.
  • verify (bool) – Whether this is a verification evaluation.
Returns:

Output values at the samples.

Return type:

response (np.array)

Warning

Return_values_of in problem.evaluate doesn’t work - Pymoo implementation problem.

get_info()

Get information about the benchmark problem.

Returns:Input parameter allowable ranges. dim_in (int): Number of input dimensions. dim_out (int): Number of output dimensions. n_constr (int): Number of constraints.
Return type:range_in (np.array)

Notes

return_values_of is wrongly implemented in pymoo

class datamod.evaluator.EvaluatorData

Bases: datamod.evaluator.Evaluator

Obtain the response from a data file.

source_file

Path and name of the data file.

Type:str
evaluate(samples, verify)

Evaluate the samples.

Parameters:
  • samples (np.array) – Samples to evaluate.
  • verify (bool) – Whether this is a verification evaluation.
Returns:

Output values at the samples.

Return type:

response (np.array)

get_info()

Load information about a data-defined problem.

Returns:Input parameter allowable ranges. dim_in (int): Number of input dimensions. dim_out (int): Number of output dimensions. n_constr (int): Number of constraints.
Return type:range_in (np.array)
get_samples(no_samples, no_new_samples)

Get the coordinates of the new samples.

Returns:Coordinates of the new samples.
Return type:samples(np.array)
class datamod.evaluator.RealoadNotAnEvaluator

Bases: datamod.evaluator.Evaluator

Just a programming convenience when reloading a surrogate, doesnt evaluate anything in fact.

get_info()

Get information about the problem.

Returns:Input parameter allowable ranges. dim_in (int): Number of input dimensions. dim_out (int): Number of output dimensions. n_constr (int): Number of constraints.
Return type:range_in (np.array)