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)):
The value is always stored in the adapter itself.
If allowed, the value is also propagated into the underlying solver (impl).
- When getting an attribute (e.g. getattr(adapter, name)):
If the attribute exists in the adapter, return it.
Otherwise, try to look it up in the solver (impl).
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.