> ## Documentation Index
> Fetch the complete documentation index at: https://developer.synopsys.com/llms.txt
> Use this file to discover all available pages before exploring further.

# CreateCustomModel Class Reference

Part of [MOP models](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/group__models)

This class creates a custom model definable in python. It is able to register an instance derived of [CreateCustomModelInterface](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/struct_create_custom_model_interface.md). This registered instance may then be accessed just like any other model. It may also be serialized and de-serialized.

## Public Member Functions

| Type | Name |
| - | - |
| virtual string | [\_\_str\_\_](#a3031d648b73235d11d64df95db3d84ce) () Output function used in python context. Use this function to print instances of this class in python. |
|  virtual | [addProperty](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_property_user_base.md#aedfb47575823522e6a6d22ce6c12e826) ([PropertyBase](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/struct_property_base.md) p) Properties that help the [ScalarMOP](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/struct_scalar_m_o_p.md) scheduling the Models to be built The properties class needs to be implemented for the specific model type. |
| [ModelBase](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_model_base.md) \* | [compute](#adab3d3e83d7c6ba1916a079748b0f152) (::data\_handler::DataHandlerBase datahandler, [TrainingPlanBase](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/struct_training_plan_base.md) training\_plan, quality\_measure::QualityMeasureBase quality\_measure, [CancelBase](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/struct_cancel_base) \*cancel=nullptr) override Builds the model from the given samples and returns the model. |
| | [CreateCustomModel](#afe8658f8e270c0d0f3ce9f6453564f75) () Creates an default initialized instance of this class. |
| | [CreateCustomModel](#a3822d2c5ef526b6238e4a127476d6a61) ([CreateCustomModel](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_create_custom_model.md)) Copies an instance of this class. |
| virtual bool | [equals](#ad90ea62af69f033af4b88810fc877308) ([CreateModelBase](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/struct_create_model_base.md) other) override Checking if the given configurations are equal this this instance. |
|  virtual [PropertyList](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_property_list.md) | [getProperties](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_property_user_base.md#a0e1dd7df82728594fc128ed1c797b0c0) () Returns the properties stored by this user. |
| bool | [hasRegisteredCreateModel](#a903a80535e8969883f2b43ec01b30b27) () Returns true iff this instance has a Python object connected to it via the registerCreateModel function. |
| virtual bool | [isValid](#a1a42d0ff7ef3b9c17965ecc14310ed5d) (::data\_handler::DataHandlerBase datahandler, [TrainingPlanBase](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/struct_training_plan_base.md) training\_plan) override Destroys an instance of this class. |
| virtual | [loadJson](#ae5700ae63985e3e6b30cb716ddb5fdd0) ([JsonValue](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_json_value.md) root) override Function to load the Serializables data from a [JsonValue](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_json_value.md). |
| [CreateCustomModel](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_create_custom_model.md) | [operator=](#a610dc87da6e12b63d83ce67b0ac1e27b) ([CreateCustomModel](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_create_custom_model.md)) Copies an instance of this class. |
| virtual [JsonValue](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_json_value.md) | [saveJson](#ab4587af0230811304c91f1c0aaa1c9ce) () override Function to save the Serializables data as a [JsonValue](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_json_value.md). |
| virtual | [transferProperties](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_property_user_base.md#ab9507274f126b856fb69cd621f0f9fb4) ([PropertyList](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_property_list.md) property\_list) Convenience function to transfer a complete [PropertyList](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_property_list.md) into the model. |

## Public Attributes

| Type | Name |
| - | - |
| apply SWIGTYPE \* | **DISOWN** |
|  string | **id** |
|  string | **node\_name** |
|  string | **working\_dir** |

## Detailed Description

This class creates a custom model definable in python. It is able to register an instance derived of [CreateCustomModelInterface](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/struct_create_custom_model_interface.md). This registered instance may then be accessed just like any other model. It may also be serialized and de-serialized.

## Member Function Documentation

### \_\_str\_\_()

```cpp theme={null}
virtual string __str__()
```

`virtual`

Output function used in python context. Use this function to print instances of this class in python.

**Returns**

string containing the object

Reimplemented from [CreateModelBase](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/struct_create_model_base.md#a3031d648b73235d11d64df95db3d84ce).

### compute()

```cpp theme={null}
ModelBase * compute(
    ::data_handler::DataHandlerBase datahandler,
    TrainingPlanBase training_plan,
    quality_measure::QualityMeasureBase quality_measure,
    CancelBase * cancel = nullptr
)
```

`override` `virtual`

Builds the model from the given samples and returns the model.

**Parameters**

| Name | Description |
| - | - |
| datahandler | The datahandler that contains the samples |
| training\_plan | The training plan that specifies how the model will be trained |
| quality\_measure | The quality measure that allows to compute a models approximation quality |
| cancel | A cancellation object to cancel the training |

**Returns**

The trained model iff not cancelled

Implements [CreateModelBase](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/struct_create_model_base.md#a5e64887b96b93ac8aa95cca396d78f0a).

### equals()

```cpp theme={null}
virtual bool equals(CreateModelBase other)
```

`override` `virtual`

Checking if the given configurations are equal this this instance.

**Parameters**

| Name | Description |
| - | - |
| other | The other Config |

**Returns**

true iff the same type and the same config entries

Implements [CreateModelBase](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/struct_create_model_base.md#a4a1cc8519f2bdb1f9952ceaa3391cbca).

### hasRegisteredCreateModel()

```cpp theme={null}
bool hasRegisteredCreateModel()
```

Returns true iff this instance has a Python object connected to it via the registerCreateModel function.

**Returns**

true/false

### isValid()

```cpp theme={null}
virtual bool isValid(
    ::data_handler::DataHandlerBase datahandler,
    TrainingPlanBase training_plan
)
```

`override` `virtual`

Destroys an instance of this class.

This function checks if the model can validly be trained from the given samples

**Parameters**

| Name | Description |
| - | - |
| datahandler | The samples the model shall be trained with. |
| training\_plan | The training\_plan |

**Returns**

True iff th emodel can be trained with the configuration data, the properties and samples

Implements [CreateModelBase](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/struct_create_model_base.md#a1202ca4468e899d1e6d321ebf59e67a1).

### loadJson()

```cpp theme={null}
virtual loadJson(JsonValue root)
```

`override` `virtual`

Function to load the Serializables data from a [JsonValue](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_json_value.md).

**Parameters**

| Name | Description |
| - | - |
| root | The data of the serializable as [JsonValue](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_json_value.md) |

### saveJson()

```cpp theme={null}
virtual JsonValue saveJson()
```

`override` `virtual`

Function to save the Serializables data as a [JsonValue](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_json_value.md).

**Returns**

The data of the serializable as [JsonValue](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_json_value.md)

### transferProperties()

```cpp theme={null}
virtual transferProperties(PropertyList property_list)
```

`virtual` `inherited`

Convenience function to transfer a complete [PropertyList](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_property_list.md) into the model.

**Parameters**

| Name | Description |
| - | - |
| property\_list | The properties to transfer into this model |

## Member Data Documentation

### DISOWN

```cpp theme={null}
apply SWIGTYPE * DISOWN
```

**Initial value:**

```lua theme={null}
{CreateCustomModelInterface * create_model}

             registerCreateModel(CreateCustomModelInterface *create_model)
```
