optframework.base.adapters_api_basics module

Created on Tue Aug 26 13:04:13 2025

@author: px2030

class optframework.base.adapters_api_basics.WriteThroughAdapter(impl: Any)[source]

Bases: object

A base adapter that synchronizes (“writes through”) attributes between the adapter itself and an underlying solver instance (impl).

Main behavior:

  • When setting an attribute (e.g. setattr(adapter, name, value)):
    1. The value is always stored in the adapter itself.

    2. If allowed, the value is also propagated into the underlying solver (impl).

  • When getting an attribute (e.g. getattr(adapter, name)):
    1. If the attribute exists in the adapter, return it.

    2. Otherwise, try to look it up in the solver (impl).

    3. Internal fields (like _map, _setters) are never proxied.

Special controls:

  • _map: maps adapter attribute names -> impl attribute names.

  • _setters: custom setter functions for attributes requiring special logic.

  • _skip: attributes that should only exist on the adapter, not written through.