AbstractProblem#

Module for AbstractProblem class

class AbstractProblem[source]#

Bases: object

The abstract AbstractProblem class. All the class defining a PINA Problem should be inheritied from this class.

In the definition of a PINA problem, the fundamental elements are: the output variables, the condition(s), and the domain(s) where the conditions are applied.

property domain#

The domain(s) where the conditions of the AbstractProblem are valid. If more than one domain type is passed, a list of Location is retured.

Returns:

the domain(s) of self

Return type:

list[Location]

property input_variables#

The input variables of the AbstractProblem, whose type depends on the type of domain (spatial, temporal, and parameter).

Returns:

the input variables of self

Return type:

list

abstract property output_variables#

The output variables of the problem.

abstract property conditions#

The conditions of the problem.

discretise_domain(n, mode='random', variables='all', locations='all')[source]#

Generate a set of points to span the Location of all the conditions of the problem.

Parameters:
  • n (int) – Number of points to sample, see Note below for reference.

  • mode – Mode for sampling, defaults to random. Available modes include: random sampling, random; latin hypercube sampling, latin or lh; chebyshev sampling, chebyshev; grid sampling grid.

  • variables (str | list[str]) – problem’s variables to be sampled, defaults to ‘all’.

  • locations (str) – problem’s locations from where to sample, defaults to ‘all’.

Example:
>>> pinn.discretise_domain(n=10, mode='grid')
>>> pinn.discretise_domain(n=10, mode='grid', location=['bound1'])
>>> pinn.discretise_domain(n=10, mode='grid', variables=['x'])

Warning

random is currently the only implemented mode for all geometries, i.e. EllipsoidDomain, CartesianDomain, SimplexDomain and the geometries compositions Union, Difference, Exclusion, Intersection. The modes latin or lh, chebyshev, grid are only implemented for CartesianDomain.

add_points(new_points)[source]#

Adding points to the already sampled points.

Parameters:

new_points (dict) – a dictionary with key the location to add the points and values the torch.Tensor points.

property have_sampled_points#

Check if all points for Location are sampled.

property not_sampled_points#

Check which points are not sampled.