-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SharedParameter: improve source detection #2142
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This PR causes the following changes to the html docs (ubuntu-latest-3.7-x64):
See CI logs for the full diff. |
in the case that the values attribute of a Parameter is not yet populated, the source of a SharedParameter would not be detectable. We can instead find a corresponding source Parameter using the default. This should only be used for completely stateless purposes (checking the value of a "descriptive" Parameter attribute like "stateful" or "loggable")
This PR causes the following changes to the html docs (ubuntu-latest-3.7-x64):
See CI logs for the full diff. |
jdcpni
added a commit
that referenced
this pull request
Dec 23, 2021
* requirements: update grpcio requirement from <1.35.0 to <1.41.0 (#2115) * requirements: update grpcio-tools requirement from <1.35.0 to <1.41.0 (#2116) * requirements: update rich requirement Updates the requirements on [rich](https://github.com/willmcgugan/rich) to permit the latest version. - [Release notes](https://github.com/willmcgugan/rich/releases) - [Changelog](https://github.com/willmcgugan/rich/blob/master/CHANGELOG.md) - [Commits](https://github.com/willmcgugan/rich/compare/v10.1.0...v10.10.0) --- updated-dependencies: - dependency-name: rich dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> * requirements: update pytest-xdist requirement from <2.4.0 to <2.5.0 (#2124) * llvm/udf: Add support for numpy sqrt Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * tests/models/Predator-Prey: Use attractor/repeller forces to select the next move Compare the move based on observations with the real bearing from player to prey. Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * github-actions(deps): bump actions/github-script from 4.1 to 5 (#2125) * requirements: update toposort requirement from <1.7 to <1.8 (#2129) * conftest: Fix typo in func_mode helper Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * tests/mechanism/noise_variations: Set seeds of noise function instead of RandomState Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * tests/transfer_mechanism/uniform_to_normal_noise: Set seeds of noise function instead of RandomState Results change since the 'seed' parameter is converted to list before use. Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * tests/modulation_of_random_seed: Check final model results Drop custom in-flight function check. Remove any cost calculation and use generated random value as objective metric. Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * function: parameters.seed should match the seed that was used to initialize parameters.random_state Fix function copy workaround to reset the seed parameter, the state will be adjusted by the seed setter function. Use DEFAULT_SEED to avoid advancing global seed. Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * functions/parameters: Reset PRNG state on seed assignment or change Instead of resetting the PRNG state once per context, the new approach compares the originally used seed with the new value (either new setting or modulation). This allows for better match in multi-trial executions with OCM: Simulations will only reset PRNG if the modulated seed is different from the one in the current execution context. The result of evaluation will thus match the result of trial even if OCM selects the same seed as originally used by the execution. The PRNG state is also reset on direct seed modification to preserve the old behaviour in situations like; Func1.seed = n Func2.seed = n # Both Func1 and Func2 now follow the same random sequence irrespective # of their original seed Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * tests/random_state: Update test to check semantics across multiple trials Construct the expected values in the test instead of using constants to verify the semantics of reusing random seeds. Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * treewide: Use '==' to compare strings Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * treewide: Drop unused imports Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * codestyle: Fix and check E712: Comparison to True/False should use is/is not Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * codestyle: Fix and check E305: Expected 2 blank lines after class or function definition Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * codestyle: Fix and check E117: Overindented Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * requirements: update rich requirement Updates the requirements on [rich](https://github.com/willmcgugan/rich) to permit the latest version. - [Release notes](https://github.com/willmcgugan/rich/releases) - [Changelog](https://github.com/willmcgugan/rich/blob/master/CHANGELOG.md) - [Commits](https://github.com/willmcgugan/rich/compare/v10.1.0...v10.11.0) --- updated-dependencies: - dependency-name: rich dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> * functions/TransferWithCosts: Convert CostFunctions to IntFlag instead if IntEnum Bitwise combination of flags is still a flag. Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * tests/control: Add simple test for all possible cost options Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * Parameters: exclude more types from copying (#2134) * requirements: update pytest-cov requirement from <2.12.2 to <3.0.1 (#2135) * UDF: support directly passing parameter values previously required them in dictionary form as the params argument * UDF: support string expressions * UDF: allow integration for one parameter * llvm, component: Add 'control_signal' and 'control_signal_params' to the list of ignored parameters Never used in compiled code. Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * llvm, functions: Add compilation support for UniformDist function Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * llvm, functions/GridSearch: Convert ctypes to numpy before returning from parallel execution Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * llvm, functions/GridSearch: Optionally save used calculated values and samples Extend tests. Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * llvm: Add helper function to retrieve and optionally reseed random state Store used seed in compiled random state. Check the last used seed with the most recent value of the 'seed' param, reseed the random state if the seeds don't match. Add simple test. Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * github-actions: Restrict main CI run to macos-10.15 Block macos-11 until https://github.com/actions/virtual-environments/issues/4230 is fixed Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * functions: _is_identity: add option for defaults (#2136) * llvm, mechanism: Use Parameter class to build a list of needed parameter ports Names of Parameter and ParameterPort don't have to match if there are multiple parameters with the same name. (Like 'seed' in DDM with DDI function). Add test modulating seed of DDI within DDM. Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * requirements: update rich requirement (#2141) * SharedParameter: improve source detection (#2142) in the case that the values attribute of a Parameter is not yet populated, the source of a SharedParameter would not be detectable. We can instead find a corresponding source Parameter using the default. This should only be used for completely stateless purposes (checking the value of a "descriptive" Parameter attribute like "stateful" or "loggable") * requirements: update grpcio requirement from <1.41.0 to <1.42.0 (#2127) * requirements: update grpcio-tools requirement from <1.41.0 to <1.42.0 (#2128) * SharedParameter: direct get_previous, get_delta to source Parameter (#2143) * llvm, ports: Move cost generation methods to ControlSignal Matches code location of Python implementation. Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * llvm, ports/ControlSignal: Always call 'combine_costs' when calculating costs Matches Python semantics. Add input shape workaround for Reduce function. Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * LCAMechanism: allow user-input integrator_function (#2148) * requirements: update sphinx requirement from <4.1.3 to <4.2.1 (#2120) * github-actions(deps): bump actions/checkout from 2.3.4 to 2.3.5 (#2149) * requirements: update pillow requirement from <8.4.0 to <8.5.0 (#2150) * requirements: update elfi requirement from <0.8.1 to <0.8.3 Updates the requirements on [elfi](https://github.com/elfi-dev/elfi) to permit the latest version. - [Release notes](https://github.com/elfi-dev/elfi/releases) - [Commits](https://github.com/elfi-dev/elfi/compare/0.2.2...v0.8.2) --- updated-dependencies: - dependency-name: elfi dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> * github-actions: Bump python-3.{8,9} to macos-latest. Keep python3.7 on macos-10.15. See https://github.com/actions/virtual-environments/issues/4230 for details. Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * requirements: update graph-scheduler requirement from <=1.0.0rc2 to <1.0.1 (#2153) * requirements: update numpy requirement from <1.21.3 to <1.21.4 (#2152) * functions/TransferWithCosts: Change default cost options to CostFunctions.NONE Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * github-actions: Drop maxprocesses settings all cloud hosted runners should be able to run one test worker per core. (see https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources ) Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * github-actions: Add code coverage job (#2159) Use macos-latest, Python 3.9. Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * github-actions: Do not check for GITHUB_TOKEN env var when uploading coveralls results (#2163) Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * github-actions: Allow RW permissions for jobs updating the online docs (#2160) Per [0] this should also work with dependabot triggered runs on devel. Closes: https://github.com/PrincetonUniversity/PsyNeuLink/issues/2144 Tested by setting default GITHUB_TOKEN permissions to RO at repo scope. [0] https://github.blog/changelog/2021-10-06-github-actions-workflows-triggered-by-dependabot-prs-will-respect-permissions-key-in-workflows/ Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * Component: add all_dependent_parameters (#2162) returns a dict containing Parameters for all dependent components * github-actions(deps): bump actions/checkout from 2.3.5 to 2.4.0 (#2165) Bumps [actions/checkout](https://github.com/actions/checkout) from 2.3.5 to 2.4.0. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v2.3.5...v2.4.0) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Refactor/pec (#2166) * • component.py docstring mod to **size** * • docstring edits to composition.py and optimizationcontrolmechanism.py * • optimizationcontrolmechanism.py - evaluation_function: add num_samples argument call evaluate method num_samples times return array of outcomes (and results if return_results is specified) * • ControlMechanism _instantiate_input_ports: remove duplicate statement (line 1399): "self.input_port.name = OUTCOME" * • optimizationcontrolmechanism.py: _instantiate_input_ports: augmented to specify size of input_port[OUTCOME] equal to size of either objective_mechanism.output_port[OUTCOME] or OCM's monitor_for_control argument * • transferfunctions.py: CostFunctions: changed DEFAULTS assignment to NONE (from INTENSITY) * • test_modulation_simple modifed expected result for CostFunctions.DEFAULT from INTENSITY to NONE * • optimizationcontrolmechanism.py removed override of _update_input_ports() * • optimizationcontrolmechanism.py and controlmechanism.py: refactor _instantiate_input_ports, moving stuff from OCM to controlmechanism * • optimizationcontrolmechanism.py and controlmechanism.py: refactor _instantiate_input_ports, moving stuff from OCM to controlmechanism * - * - * - * • optimizationcontrolmechanism.py, controlmechanism.py: - more consolidation of instantiate_input_ports and _instanatiate_objective_mechanism * - * • Merge of: - refactor/ocm_control_mec/instantiate_input_ports and - refactor/ocm/evaluate_return_array * • optimizationcontrolmechanism.py: - added num_trials_per_estimate parameter - refactoring so that looping over estimates is moved to composition.evaluate() * - * • Project - added num_trials_per_estimate throughout (still needed in LLVM build methods) - composition.evaluate(): used to replace num_simulation_trials * • composition.py - implemented loop for num_estimates * - * • docstrings for composition.evaluate() and optimizationcontrolmechanism.evaluation_function() * • docstrings for composition.evaluate() and optimizationcontrolmechanism.evaluation_function() * - * - * • parameterestimationcomposition.py: added * - * - * - * • parameterestimationcomposition.py: added * • optimizationfunctions.py: added GridBasedOptimization * • parameterestimationcomposition.py: sketched out * - * • optimizationfunctions.py: GridBasedOptimization has been added • parameterestimationcomposition: further fleshed out • composition.py: removed num_estimates (now handled by ocm.evaluation_function * - * - * - * - * - * • parameterestimationcomposition.py: implemented seed arguments * - * - * - * - * - * - * - * - * • component.py: added all_dependent_parameters() (from Katherine) * • component.py: added all_dependent_parameters() (from Katherine) * tmp: prevent inf recursion in all_dependent_parameters * - * - * - * - * • parameterestimationcomposition.py - should be functioning * • parameterestimationcomposition.py - docstring editing * - * - * - * - * - * - * - * - * • core.rst: elaborated toc * • parameterestimationcomposition.py - docstring * • parameterestimationcomposition.py - notes for run() * • parameterestimationcomposition.py - fixed handling of agent_rep (to make it self) * • parameterestimationcomposition.py - enforced controller_mode==BEFORE for self * - * - * - * • parameterestimationcomposition.py: - ensure that Composition construction args are not specified - ensure that controller args are not specified * • parameterestimationcomposition.py: some refactoring of handling of target * • parameterestimationcomposition.py: - support specification of Composition to be estimated within PEC itself (i.e., in place of **target**) * • parameterestimationcomposition.py: - 'target' renamed 'model' - support specification of model within PEC itself * • parameterestimationcomposition.py: - 'target' renamed to 'model' - support specification of model within PEC constructor itself * - * • parameterestimationcomposition.py: docstring edits * • parameterestimationcomposition.py: more docstring edits * • optimizationcontrolmechanism.py: fixed bug in evaluation_function * • optimizationcontrolmechanism.py: fixed bug in evaluation_function * • tests: fixed some bugs * - * - * - * - * • optimizationcontrolmechanism.py - fixed bug in setting of num_trials_per_estimate * • optimizationcontrolmechanism.py - fixed bug in setting of num_trials_per_estimate * - * • optimizationcontrolmechanism.py, controlmechanism.py: - pass input_ports from OCM to controlmechanism in _instantiate_input_ports - pass input_ports to _instantiate_objective_mechanism in controlmechanism.py - remove extra lines in optimizationcontrolmechanism._control_allocation_getter - reorder OUTCOME * • optimizationcontrolmechanism.py, controlmechanism.py: - pass input_ports from OCM to controlmechanism in _instantiate_input_ports - pass input_ports to _instantiate_objective_mechanism in controlmechanism.py - remove extra lines in optimizationcontrolmechanism._control_allocation_getter - reorder OUTCOME * - * - * • controlmechanism.py, optimizationcontrolmechanism.py: - _instantiate_input_ports(): refactored to more efficiently centralize handling of OUTCOME and state_features • composition.py: - _build_predicted_inputs_dict(): modified to use default inputs if none are specifid * - * • controlmechanism.py: fix reference value in _instantiate_input_ports * - * - * - * - * - * - * - * - * - * - * - * - * • controlmechanism.py: fix reference value in _instantiate_input_ports * • test_show_graph: some fixed * • breaking in test_of_show_3_level... * • breaking in test_of_show_3_level... * • test_of_show_3_level... * • test_show_graph.py: all pass * • test_show_graph.py: all pass * • parameterestimationcomposition.py: _instantiate_ocm(): updated search for seed parameter ports * - pycodestyle corrections * - pycodestyle corrections Co-authored-by: jdcpni <pniintel55> Co-authored-by: Katherine Mantel <kmantel@princeton.edu> * github-actions/install-pnl: Support persistent runners (#2167) Setup python venv in a temp directory that is cleaned on workflow exit Cleanup temporary tag on pull requests. Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * maint: remove freeze.txt (#2182) * github-actions/release: Add deployment environments The environments are created with no restrictions if they don't exist. Split upload to github release and PyPI. Add write permission to jobs creating release and uploading artifacts. Clarify comments and fix typos Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * github-actions/release: Use TWINE_REPOSITORY_URL instead of TWINE_REPOSITORY The latter needs configuration file to read the url from. Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * github-actions/release: rest API methods were moved to github.rest.* github-script@v5 made the change and the release scripts were not tested. Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * github-actions/release: Create full release instead of prerelease on tag Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * github-actions/release: Drop limitation to max 2 test processes No longer needed. Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * github-actions/release: Consolidate into one workflow Move all github release handling into one job, guarded by gh-release deployment Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * requirements: Require minimum numpy version to include Philox PRNG Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * tests/llvm: Rename random tests to include a reference to MT PRNG Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * llvm: Implement integer and uniform FP Philox PRNG Add and test both 64bit and 32bit versions. Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * llvm/helpers: Add helpers for log and log1p Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * llvm/builtins: Implement the ziggurat method for generating Normal distribution using Philox (fp64 only) Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * Refactor/controlmech and ocm (#2186) * • component.py docstring mod to **size** * • controlmechanism.py: add support for monitor_for_control in _instantiate_input_ports * - * • controlmechanism.py: refactoring to use outcome_input_ports_option * • controlmechanism.py: refactored to use outcome_input_ports following tests not passing: - control/test_param_estimation_test_moving_average (elfi) - test_json: test_json_results_equivalence (model_with_control_py-comp-{Input: [0.5, 0.123], reward: [20, 20]}) test_write_json_file (model_with_control_py-comp-{Input: [0.5, 0.123], reward: [20, 20]}) * - * - * - * - * - * Tests passing * • controlMechanism.py: - added outcome_input_ports_option: SEPARATE, COMBINE, CONCATENATE - refactored _outcome_getter to return value of all InputPorts in outcome_input_ports * - * • port.py: _instantiate_projection_from_port raise PortError if type_match fails for projection and parameter value during instantiation * • port.py: _instantiate_projection_from_port raise PortError if type_match fails for projection and parameter value during instantiation * • controlmechanism.py: fixed bugs in use of COMBINE and CONCATENATE * • controlmechanism.py: fixed more bugs in use of COMBINE and CONCATENATE * • optimizationcontrolmechanism.py: renamed evaluation_function -> evaluate_agent_rep * • optimizationfunctions.py: add aggregation_function as Parameter add num_estimates as argument for _function loop over num_estimates in call to _objective_function and use aggregation_function to aggregate results * • optimizationfunctions.py: add aggregation_function as Parameter add num_estimates as argument for _function loop over num_estimates in call to _objective_function and use aggregation_function to aggregate results * - * • optimizationfunctions.py: - implemented randomization_seed_dimension argument - implemented num_estimates property (uses randomization_seed_dimension) • optimizationcontrolmechanism.py: - validates that num_estimates (if specified) is consistent with number generated by allocation_samples for seed ControlSignal - passes randomization_seed_dimension to OptimizationFunction constructor * - * - * - * • tests/composition: add test_parameterestimationcomposition.py * • tests/composition: add test_parameterestimationcomposition.py (basic form) * - * - * - * - * • optimizationcontrolmechanism.py: moved construction of randomization ControlSignal here from PEC Passes all tests * - * - * • optimizationcontrolmechanism.py: renamed same_seed_for_all_parameter_combinations -> same_seed_for_all_allocations (left name the same on PEC for UI reasons) note: use of parameter by ObjectiveFunction remains to be implemented * • optimizationcontrolmechanism.py: docstring updates to reflect preceding changes * • optimizationcontrolmechanism.py: more docstring edits * - * - * - * - Co-authored-by: jdcpni <pniintel55> * llvm: Destroy global LLVMBuilderContext instance on cleanup Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * llvm: Move builtin generation to LLVMBuilderContext contruction Allow only a single instance of LLVMBuilderContext. Allow custom construction of LLVMBuilderContext. Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * llvm/BuilderContext: Allow specifying custom (fp32/fp64) floating point type Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * Docs/comp ctlmech ocm pec (#2187) * • component.py docstring mod to **size** * • parameterestimationcomposition.py: docstring edits * • composition.py: docstring edits * - * - * - * llvm: Create JIT engines on demand Other than saving resource, this recreates JIT specific builtins based on the currently active LLVMBuilderContext, potentially using different type preferences. Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * tests/llvm: Add rudimentary fp32 testing Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * llvm/random: Drop type suffix from philox normal function Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * llvm/builtins: Implement philox fp32 normal distribution Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * llvm, function: Move SeededRandomState to utilities Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * Function_Base: Reuse the PRNG type when crating a copy using new seed The default is still Seeded(np.random.RandomState) Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * tests/functions/memory: Move test ids with the rest of the params Change duplicate test to not use the same rate. Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * llvm: Enable and test compiled Philox PRNG Functions: * ContentAddressableMemory * DictionaryMemory * DriftDiffusionIntegrator * GaussianDistort * GridSearch * NormalDist * OneHot * UniformDist Mechanisms: * DDM Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * github-actions/pnl-ci-docs: Force creation of temporary version tag (#2192) Cleanup the tag if the documentation build fails. Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * tests/ddm: Disable Bogacz test with Philox prng (#2195) Disable to investigate segfaults: =================================== FAILURES =================================== ____________________ tests/mechanisms/test_ddm_mechanism.py ____________________ [gw2] darwin -- Python 3.7.12 /Users/runner/work/_temp/_venv/bin/python worker 'gw2' crashed while running 'tests/mechanisms/test_ddm_mechanism.py::test_DDM_Integrator_Bogacz[LLVM-Philox]' =============================== warnings summary =============================== Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * github-actions/comment: Add PR write permission and use github.rest.* for rest API (#2196) Follow up to 01f710683a7ff6c163fe990700666af047bf9473 ("github-actions/release: rest API methods were moved to github.rest.*") Fixes: 35cf6ecc792f0dd4bb024510b37b3ff825560ab0 ("github-actions(deps): bump actions/github-script from 4.1 to 5 (#2125)") Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * llvm, mechanisms/DDM: Pass correct parameter structure for seed resetting The 'params' in this context refers to the parameter structure of the invoked function. Instead we need to pass the mechanism's parameters. Fixes 9b2ab4f16d80a6409760754fe3949586b5dc79ef ("llvm: Add helper function to retrieve and optionally reseed random state") Add comment about seed floating point type. Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * llvm/codegen: Use correct helper to get state member offset Indexing into state should use 'get_state_ptr' Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * llvm/helpers: Add basic sanity checks to get_{param,state}_ptr helpers Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * llvm, autodiffcomposition: Add id for the optimizer state Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * tests/models/predator-prey: Restore checks of results (#2202) Add values for Philox PRNG. Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * llvm, mechanism/ocm: Add extra checks for simulation input construction. Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * tests/control: Set state features explicitly in modulation tests Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * llvm, ports/ControlSignal: Add shape workarounds and allow Costfunctions.NONE Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * tests/predator-prey: Mark the 101 level test instance as 'stress' test (#2204) No reason to run this variant in regular testing. Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * tests/llvm: Add Philox PRNG tests with different seeds (#2205) Checks that our seed perturbation routine is correct It's enough to test int64 since all other variants are derived from int64. Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * pnl-ci: build docs-only branches (#2206) now that jenkins builds are not produced and the required status is on actions, we need actions to build these * requirements: update psyneulink-sphinx-theme requirement (#2201) * GatingMechanism: properly set gating_allocation as value alias (#2191) * ControlProjection: correct control_signal to SharedParameter (#2212) * github-actions(deps): bump actions/setup-python from 2.2.2 to 2.3.0 (#2209) * llvm/execution: Do not require declaring cached compiled structures Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * llvm/execution: Reuse helper functions to generate structures for 'evaluate' Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * llvm/execution: Report timing information for creating binary structures Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * llvm/debug: Remove unused debug setting 'no_ref_pass' All uses were removed in ba56af82585e2d61f5b5bd13d9a19b7ee3b60124 ("Refactor/autodiff (#1488)") Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * llvm/execution: Drop ctype types for input/output in FuncExecution We only need numpy dtype for input Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * llvm/execution: Improve comments and variable naming Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * github-actions(deps): bump actions/cache from 2.1.6 to 2.1.7 (#2213) * setup/coverage: Correct option name multiprocess -> multiprocessing (#2219) Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * github-actions(deps): bump actions/setup-python from 2.3.0 to 2.3.1 (#2215) * tests/show_graph: Strip whitespace before comparing expected dot output (#2220) Spaces and newlines should not matter. Fixes test failures with graphviz==0.19 which added extra newline at the end of output. Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * requirements: update graphviz requirement from <0.18.0 to <0.20.0 (#2218) * Refactor/ocm/state input ports (#2221) * • component.py docstring mod to **size** * • optimizationcontrolmechanism.py: added feature_input_ports attribute and num_feature_input_ports property * • optimizationcontrolmechanism.py: added feature_input_ports attribute and num_feature_input_ports property • parameterestimationcomposition.py: fixed misplacement of its Parameters() attribute * • optimizationcontrolmechanism.py: added feature_input_ports attribute and num_feature_input_ports property • parameterestimationcomposition.py: fixed misplacement of its Parameters() attribute • optimizationfunctions.py: made num_estimates a Parameter * - modified test_mode_based_num_estimates * - * - * • optimizationcontrolmechanism.py: - _instantiate_control_signals: random_seeds -> random_seed_mod_values * • composition.py - _add_controller: modifying to instantiate feature_input_ports if none are specified * • composition.py: - add_controller: now adds feature_input_ports for Compostion INPUT nodes if not state_features not specified * - * • composition.py - _add_controller: modifying to instantiate feature_input_ports if none are specified * • composition.py: - add_controller: assign simulation_input_ports * - * • optimizationcontrolmechanism.py: - feature_input_ports -> state_input_ports - _instantiate_input_ports(): state_features only allowed to specifying state_input_ports if agent_rep is a CompositionFunctionApproximator (i.e., model-free optimization) • composition.py: - add_controller: adds state_input_ports to shadow INPUT Nodes of Composition if controller.agent_rep is Composition (model-based optimziation) or state_features have not been specified (for model-free optimizaton) * - * • optimizationcontrolmechanism.py: _instantiate_input_ports: reinstate allowance of state_features specification if agent_rep is a Composition (i.e., model-based optimization) as long as they are all INPUT Nodes of agent_rep * - * - * • optimizationcontrolmechanism.py - _gen_llvm_evaluate_function: num_estimates -> num_estimates_per_trial * - * • optimizationcontrolmechanism.py - _gen_llvm_evaluate_function: num_estimates -> num_trial_per_estimate * • optimizationcontrolmechanism.py - _gen_llvm_evaluate_function: num_estimates -> num_trials_per_estimate * - * - * - * - * • composition.py - __init__: moved controller instantiation until after nodes, projections and pathways * • composition.py - __init__: restored add_controller position * llvm/struct generation: Make sure num_estimats per trial is always integer Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * - * • composition.py: - _update_controller: added - add_controller and _analyze_graph(): call _update_controller * - * • composition.py _update_controller: fixed to loop through all input_ports of comp INPUT nodes * • test_control.py - test_agent_rep_assignement_as_controller_and_replacement: updated to test that shadowing projections to state_input_ports are properly added and deleted * • optimizationfunctions.py: - _function: refactored to put use aggregation_function at end - _grid_evaluate: still needs to return all_samples * - * • composition.py - added call to _update_controller to add_node - moved test for projections to controller.state_input_ports to run() * - * • composition.py: moved calls to _update_controller to _complete_init_of_partially_initialized_nodes moved _update_controller to ocm._update_state_input_ports • optimizationcontrolmechanism.py: added _update_state_input_ports [**still needed work**] * • composition.py: moved calls to _update_controller to _complete_init_of_partially_initialized_nodes moved _update_controller to ocm._update_state_input_ports _instantiate_controller_shadow_projections [still needs to be implemented] • optimizationcontrolmechanism.py: added _update_state_input_ports [**still needed work**] * • composition.py added needs_update_controller * - * • composition.py: - implemented self.needs_update_controller - moved implementation of controlsignal projections from add_controller to _instantiate_control_projections that is called in _complete_init_of_partially_initialized_nodes Note: still need to set self.needs_update_controller to False after instantiating state_input_ports and projections to them * - * - * - * - * - * - * - * - * • Passing all test_control tests except test_mode_based_num_estimates * • Passing all test_control tests * - * • optimizationcontrolmechanism.py - _update_state_input_ports_for_controller: handle nested input nodes * - * • optimizationcontrolmechanism.py _update_state_input_ports_for_controller: fixed bug with > 1 INPUT node in Composition * • test_show_graph.py: passes all tests * - * • test_report.py: passing all tests * • Passes all tests! * - * - * • composition.py: reorganize with #region and #enregions * • composition.py: reorganize with #region and #enregions * • controlmechanism.py, optimizationcontrolmechanism.py: - _instantiate_monitor_for_control_input_ports -> _parse_monitor_control_input_ports - refactored to support allow_probes option on ocm * - * - * - * • controlmechanism.py, optimizationcontrolmechanism.py: - _instantiate_monitor_for_control_input_ports -> _parse_monitor_control_input_ports - refactored to support allow_probes option on ocm * • controlmechanism.py, optimizationcontrolmechanism.py: - _instantiate_monitor_for_control_input_ports -> _parse_monitor_control_input_ports - refactored to support allow_probes option on ocm * - * • composition.py: __init__: move controller to after add_nodes and add_linear_pathway * - * - test_control: only test_hanging_control_spec_outer_controller not passing * - * - * - * - * - * - * • composition.py: _instantiate_control_projections: weird requirement for double-call to controller._instantiate_control_signal * • test_paremtercomposition.py: restored parameter spec that causes crash ('threshold',Decision2) * ª Attempt to fix problem with partially overlapping local and ocm control specs - composition.py - _get_control_signals_for_composition: (see 11/20/21) - added (but commented out change) to "if node.controller" to "if not node.controller" - changed append to extend - _instantiation_control_projection: - got rid of try and except double-call to controller._instantiate_control_signals - outdented call to self.controller._activate_projections_for_composition at end - controlmechanism.py: - _check_for_duplicates: add warning and return duplicates - optimizationcontrolmechanism._instantiate_control_signals: - add call to self.agent_rep._get_control_signals_for_composition() to get local control specs (on mechs in comp) - eliminate duplicates with control_signal specs on OCM - instantiate local + ocm control_signals - parameterestimationcomposition.py - added context to various calls * see later commit * see later commit * see later commit * see later commit * - This branch passes all tests except: - test_parameterestimationcomposition - test_composition/test_partially_overlapping_control_specs (ADDED IN THIS COMMINT) - All relevant changes to this branch are marked as "11/21/21." However, most are commented out as they break other things. - The tests above both involve local control specifications (on mechanism within a nested comp) and on the OCM for the outer composition, some of which are for the same nested mechs - Both tests fail with: "AttributeError: 'NoneType' object has no attribute '_get_by_time_scale'" (in component.py LINE 3276) This may be due to a problem with context setting, since the error is because the modulation Parameter of the ControlProjection is returning "None" rather than "multiplicative_param" (when called with get(context)), whereas "multiplicative_param" is returned with a call to get() (i.e., with no context specified) - Most of test_partially_overlapping_control_specs is passed if changes marked "11/21/21 NEW" in optimizationcontrolmechanism.py (LINE 1390) are implemented, but it does not properly route ControlProjections through parameter_CIMS (see last assert in test). Furthermore, test_parameterestimationcompsition fails with the mod param error, even though the model has similar structure (i.e., outer composition -- in this case a ParameterEstimationComposition) with an OCM that is given control specs that overlap with ones in a nested composition. - There are also several other things in composition I found puzzling and tried modifying, but that cuased failures: - _get_control_signals_for_composition(): - seems "if node.controller" should be "if **not** node.controller" (emphasis added just for comment) - "append" should be "extend" - _instantiate_control_projection(): - call to self.controller._activate_projections_for_composition (at end of method) should not be indented * - small mods; don't impact anything relevant to prior commit message * - small mods; don't impact anything relevant to prior commit message * - small mods; don't impact anything relevant to prior commit message * - finished adding formatting regions to composition.py * - * • composition.py: - rename _check_projection_initialization_status -> _check_controller_initialization_status - add _check_nodes_initialization_status(context=context) (and calls it with _check_controller_initialization_status) * • show_graph.py: addressed bug associated with ocm.allow_direct_probe * • show_graph.py: addressed bug associated with ocm.allow_direct_probe * - * Composition: add_controller: set METHOD as context source early * - * • composition.py retore append of control_signals in _instantiate_control_projections() * • composition.py restore append of control_signals in _instantiate_control_projections() • test_composition.py: add test_partially_overlapping_local_and_control_mech_control_specs_in_unnested_and_nested_comp * • test_partially_overlapping_local_and_control_mech_control_specs_in_unnested_and_nested_comp(): - added clear_registry() to allow names to be reused in both runs of test * • composition.py docstring: added projections entry to list of attributes - add_controller: added call to _add_node_aux_components() for controller * • composition.py _add_node_aux_components(): added deletion of item from aux_components if instantiated * • composition.py - comment out _add_node_aux_components() (causing new failures) - move _instantiate_control_projections to be with _instantiate_control_projections, after self.add_node(self.controller.objective_mechanism (to be more orderly) * - * - confirm that it passes all tests exception test_composition/test_partially_overlapping... (with addition of _add_aux_components in add_controller commented out) * • composition.py: some more fixed to add_controller that now fail only one test: - test_agent_rep_assignement_as_controller_and_replacement * • Passes *all* current tests * • composition.py: - add_controller: few more minor mods; still passes all tests * - * - * - * • controlmechanism.py: - __init__: resrict specification to only one of control, modulatory_signals, or control_signals (synonyms) * - * • composition.py: in progress fix of bug in instantiating shadow projections for ocm.state_input_ports * • composition.py: - _get_original_senders(): added support for nested composition needs to be checked for more than one level needs to be refactored to be recursive * • optimizationcontrolmechanism.py - _update_state_input_ports_for_controller: fix invalid_state_features to allow input_CIM of nested comp in agent_rep * - * • composition.py - _get_original_senders: made recursive * • test_show_graph.py: update for fixes * - * • tests: passes all in test_show_graph.py and test_report.py * Passes all tests * - comment clean-up * • composition.py - add_controller and _get_nested_node_CIM_port: added support for forced assignment of NodeRole.OUTPUT for nodes specified in OCM.monitor_for_control, but referenced 'allow_probes' attribute still needs to be implemented * • composition.py, optimizationcontrolmechanism.py: allow_probes fully implemented * • show_graph.py: fixed bug causing extra projections to OCM * • composition.py: - _update_shadow_projections(): fix handling of deep nesting * • optimizationcontrolmechanism.py: add agent_rep_type property * • optimizationcontrolmechanism.py: - state_feature_function -> state_feature_functions * • optimizationcontrolmechanism.py: - _validate_params: validate state_feature_functions - _update_state_input_ports_for_controller: implement assignment of state_feature_functions * - * - * • Passes all tests except test_json with 'model_with_control' * - * • composition.py - add_projection: delete instantiation of shadow projections (handled by _update_shadow_projections) * • composition.py - add_projection: delete instantiation of shadow projections (handled by _update_shadow_projections) - remove calls to _update_shadows_dict * • composition.py - add_projection: delete instantiation of shadow projections (handled by _update_shadow_projections) - remove calls to _update_shadows_dict * - * • test_two_origins_two_input_ports: crashes on failure of C->B to update * - * • composition.py - added property shadowing_dict that has shadowing ports as keys and the ports they shadow as values - refactored _update_shadowing_projections to use shadowing_dict * • optimizationcontrolmechanism.py - _update_state_input_ports: modified validations for nested nodes; still failing some tests * • optimizationcontrolmechanism.py - _update_state_input_ports: more careful and informative validation that state_input_ports are in comp or nested comp and are INPUT nodes thereof; passes all tests except test_two_origins_two_input_ports as before * • composition.py _get_invalid_aux_components(): defer all shadow projections until _update_shadow_projections * • composition.py _get_invalid_aux_components(): bug fix in test for shadow projections * Port: _remove_projection_to_port: don't reduce variable below length 1 even ports with no incoming projections have variable at least length 1 * • composition.py add_node(): marked (but haven't removed) code block instantiating shadow_projections that seems now to be redundant with _update_shadow_projection * • show_graph.py - _assign_cim_components: supress showing projections not in composition * • composition.py: _analyze_graph(): add extra call to _determine_node_roles after _update_shadow_projections _run(): moved block of code at beginning initializing scheduler to after _complete_init_of_partially_initialized_nodes and _analyze_graph() • show_graph.py - add test to all loops on projections: "if proj in composition.projection" * • show_graph.py - add show_projections_not_in_composition option for debugging * • composition.py _update_shadow_projections(): delete unused shadow projections and corresponding ports * • composition.py _update_shadow_projections(): fix bug in deletion of unused shadow projections and ports • test_show_graph: tests failing, need mods to accomodate changes * • composition.py: _analyze_graph(): add extra call to _determine_node_roles after _update_shadow_projections _run(): moved block of code at beginning initializing scheduler to after _complete_init_of_partially_initialized_nodes and _analyze_graph() • show_graph.py - add test to all loops on projections: "if proj in composition.projection" * • show_graph.py fixes; now passes all show_graph tests * - * • composition.py _update_shadow_projections: raise error for attempt to shadow INTERNAL Node of nested comp * - * - * • test_composition.py implemented test_shadow_nested_nodes that tests shadowing of nested nodes * - * - * - * - Co-authored-by: jdcpni <pniintel55> Co-authored-by: Jan Vesely <jan.vesely@rutgers.edu> Co-authored-by: Katherine Mantel <kmantel@princeton.edu> * Misc/ocm/docs and tests (#2223) • composition.py - add calls to _validate_monitor_for_control() • controlmechanism.py, - add _validate_monitor_for_control() • optimizationcontrolmechanism.py: - add _validate_monitor_for_control() for agent_rep - major docsring revisions • test_control: add test_args_specific_to_ocm: tests use of state_features, monitor_for_control, objective_mechanism and allow_probe args * requirements: update grpcio-tools requirement from <1.42.0 to <1.43.0 (#2210) * Docs/ocm/revs (#2225) * • component.py docstring mod to **size** * • optimizationcontrolmechanism.py: added feature_input_ports attribute and num_feature_input_ports property * • optimizationcontrolmechanism.py: added feature_input_ports attribute and num_feature_input_ports property • parameterestimationcomposition.py: fixed misplacement of its Parameters() attribute * • optimizationcontrolmechanism.py: added feature_input_ports attribute and num_feature_input_ports property • parameterestimationcomposition.py: fixed misplacement of its Parameters() attribute • optimizationfunctions.py: made num_estimates a Parameter * - modified test_mode_based_num_estimates * - * - * • optimizationcontrolmechanism.py: - _instantiate_control_signals: random_seeds -> random_seed_mod_values * • composition.py - _add_controller: modifying to instantiate feature_input_ports if none are specified * • composition.py: - add_controller: now adds feature_input_ports for Compostion INPUT nodes if not state_features not specified * - * • composition.py - _add_controller: modifying to instantiate feature_input_ports if none are specified * • composition.py: - add_controller: assign simulation_input_ports * - * • optimizationcontrolmechanism.py: - feature_input_ports -> state_input_ports - _instantiate_input_ports(): state_features only allowed to specifying state_input_ports if agent_rep is a CompositionFunctionApproximator (i.e., model-free optimization) • composition.py: - add_controller: adds state_input_ports to shadow INPUT Nodes of Composition if controller.agent_rep is Composition (model-based optimziation) or state_features have not been specified (for model-free optimizaton) * - * • optimizationcontrolmechanism.py: _instantiate_input_ports: reinstate allowance of state_features specification if agent_rep is a Composition (i.e., model-based optimization) as long as they are all INPUT Nodes of agent_rep * - * - * • optimizationcontrolmechanism.py - _gen_llvm_evaluate_function: num_estimates -> num_estimates_per_trial * - * • optimizationcontrolmechanism.py - _gen_llvm_evaluate_function: num_estimates -> num_trial_per_estimate * • optimizationcontrolmechanism.py - _gen_llvm_evaluate_function: num_estimates -> num_trials_per_estimate * - * - * - * - * • composition.py - __init__: moved controller instantiation until after nodes, projections and pathways * • composition.py - __init__: restored add_controller position * llvm/struct generation: Make sure num_estimats per trial is always integer Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> * - * • composition.py: - _update_controller: added - add_controller and _analyze_graph(): call _update_controller * - * • composition.py _update_controller: fixed to loop through all input_ports of comp INPUT nodes * • test_control.py - test_agent_rep_assignement_as_controller_and_replacement: updated to test that shadowing projections to state_input_ports are properly added and deleted * • optimizationfunctions.py: - _function: refactored to put use aggregation_function at end - _grid_evaluate: still needs to return all_samples * - * • composition.py - added call to _update_controller to add_node - moved test for projections to controller.state_input_ports to run() * - * • composition.py: moved calls to _update_controller to _complete_init_of_partially_initialized_nodes moved _update_controller to ocm._update_state_input_ports • optimizationcontrolmechanism.py: added _update_state_input_ports [**still needed work**] * - * • composition.py: moved calls to _update_controller to _complete_init_of_partially_initialized_nodes moved _update_controller to ocm._update_state_input_ports _instantiate_controller_shadow_projections [still needs to be implemented] • optimizationcontrolmechanism.py: added _update_state_input_ports [**still needed work**] * • composition.py added needs_update_controller * - * • composition.py: - implemented self.needs_update_controller - moved implementation of controlsignal projections from add_controller to _instantiate_control_projections that is called in _complete_init_of_partially_initialized_nodes Note: still need to set self.needs_update_controller to False after instantiating state_input_ports and projections to them * - * - * - * - * - * - * - * - * • Passing all test_control tests except test_mode_based_num_estimates * • Passing all test_control tests * - * • optimizationcontrolmechanism.py - _update_state_input_ports_for_controller: handle nested input nodes * - * • optimizationcontrolmechanism.py _update_state_input_ports_for_controller: fixed bug with > 1 INPUT node in Composition * • test_show_graph.py: passes all tests * - * • test_report.py: passing all tests * • Passes all tests! * - * - * • composition.py: reorganize with #region and #enregions * • composition.py: reorganize with #region and #enregions * • controlmechanism.py, optimizationcontrolmechanism.py: - _instantiate_monitor_for_control_input_ports -> _parse_monitor_control_input_ports - refactored to support allow_probes option on ocm * - * - * - * • controlmechanism.py, optimizationcontrolmechanism.py: - _instantiate_monitor_for_control_input_ports -> _parse_monitor_control_input_ports - refactored to support allow_probes option on ocm * • controlmechanism.py, optimizationcontrolmechanism.py: - _instantiate_monitor_for_control_input_ports -> _parse_monitor_control_input_ports - refactored to support allow_probes option on ocm * - * • composition.py: __init__: move controller to after add_nodes and add_linear_pathway * - * - test_control: only test_hanging_control_spec_outer_controller not passing * - * - * - * - * - * - * • composition.py: _instantiate_control_projections: weird requirement for double-call to controller._instantiate_control_signal * • test_paremtercomposition.py: restored parameter spec that causes crash ('threshold',Decision2) * ª Attempt to fix problem with partially overlapping local and ocm control specs - composition.py - _get_control_signals_for_composition: (see 11/20/21) - added (but commented out change) to "if node.controller" to "if not node.controller" - changed append to extend - _instantiation_control_projection: - got rid of try and except double-call to controller._instantiate_control_signals - outdented call to self.controller._activate_projections_for_composition at end - controlmechanism.py: - _check_for_duplicates: add warning and return duplicates - optimizationcontrolmechanism._instantiate_control_signals: - add call to self.agent_rep._get_control_signals_for_composition() to get local control specs (on mechs in comp) - eliminate duplicates with control_signal specs on OCM - instantiate local + ocm control_signals - parameterestimationcomposition.py - added context to various calls * see later commit * see later commit * see later commit * see later commit * - This branch passes all tests except: - test_parameterestimationcomposition - test_composition/test_partially_overlapping_control_specs (ADDED IN THIS COMMINT) - All relevant changes to this branch are marked as "11/21/21." However, most are commented out as they break other things. - The tests above both involve local control specifications (on mechanism within a nested comp) and on the OCM for the outer composition, some of which are for the same nested mechs - Both tests fail with: "AttributeError: 'NoneType' object has no attribute '_get_by_time_scale'" (in component.py LINE 3276) This may be due to a problem with context setting, since the error is because the modulation Parameter of the ControlProjection is returning "None" rather than "multiplicative_param" (when called with get(context)), whereas "multiplicative_param" is returned with a call to get() (i.e., with no context specified) - Most of test_partially_overlapping_control_specs is passed if changes marked "11/21/21 NEW" in optimizationcontrolmechanism.py (LINE 1390) are implemented, but it does not properly route ControlProjections through parameter_CIMS (see last assert in test). Furthermore, test_parameterestimationcompsition fails with the mod param error, even though the model has similar structure (i.e., outer composition -- in this case a ParameterEstimationComposition) with an OCM that is given control specs that overlap with ones in a nested composition. - There are also several other things in composition I found puzzling and tried modifying, but that cuased failures: - _get_control_signals_for_composition(): - seems "if node.controller" should be "if **not** node.controller" (emphasis added just for comment) - "append" should be "extend" - _instantiate_control_projection(): - call to self.controller._activate_projections_for_composition (at end of method) should not be indented * - small mods; don't impact anything relevant to prior commit message * - small mods; don't impact anything relevant to prior commit message * - small mods; don't impact anything relevant to prior commit message * - finished adding formatting regions to composition.py * - * • composition.py: - rename _check_projection_initialization_status -> _check_controller_initialization_status - add _check_nodes_initialization_status(context=context) (and calls it with _check_controller_initialization_status) * • show_graph.py: addressed bug associated with ocm.allow_direct_probe * • show_graph.py: addressed bug associated with ocm.allow_direct_probe * - * Composition: add_controller: set METHOD as context source early * - * • composition.py retore append of control_signals in _instantiate_control_projections() * • composition.py restore append of control_signals in _instantiate_control_projections() • test_composition.py: add test_partially_overlapping_local_and_control_mech_control_specs_in_unnested_and_nested_comp * • test_partially_overlapping_local_and_control_mech_control_specs_in_unnested_and_nested_comp(): - added clear_registry() to allow names to be reused in both runs of test * • composition.py docstring: added projections entry to list of attributes - add_controller: added call to _add_node_aux_components() for controller * • composition.py _add_node_aux_components(): added deletion of item from aux_components if instantiated * • composition.py - comment out _add_node_aux_components() (causing new failures) - move _instantiate_control_projections to be with _instantiate_control_projections, after self.add_node(self.controller.objective_mechanism (to be more orderly) * - * - confirm that it passes all tests exception test_composition/test_partially_overlapping... (with addition of _add_aux_components in add_controller commented out) * • composition.py: some more fixed to add_controller that now fail only one test: - test_agent_rep_assignement_as_controller_and_replacement * • Passes *all* current tests * • composition.py: - add_controller: few more minor mods; still passes all tests * - * - * - * • controlmechanism.py: - __init__: resrict specification to only one of control, modulatory_signals, or control_signals (synonyms) * - * • composition.py: in progress fix of bug in instantiating shadow projections for ocm.state_input_ports * • composition.py: - _get_original_senders(): added support for nested composition needs to be checked for more than one level needs to be refactored to be recursive * • optimizationcontrolmechanism.py - _update_state_input_ports_for_controller: fix invalid_state_features to allow input_CIM of nested comp in agent_rep * - * • composition.py - _get_original_senders: made recursive * • test_show_graph.py: update for fixes * - * • tests: passes all in test_show_graph.py and test_report.py * Passes all tests * - comment clean-up * • composition.py - add_controller and _get_nested_node_CIM_port: added support for forced assignment of NodeRole.OUTPUT for nodes specified in OCM.monitor_for_control, but referenced 'allow_probes' attribute still needs to be implemented * • composition.py, optimizationcontrolmechanism.py: allow_probes fully implemented * • show_graph.py: fixed bug causing extra projections to OCM * • composition.py: - _update_shadow_projections(): fix handling of deep nesting * • optimizationcontrolmechanism.py: add agent_rep_type property * • optimizationcontrolmechanism.py: - state_feature_function -> state_feature_functions * • optimizationcontrolmechanism.py: - _validate_params: validate state_feature_functions - _update_state_input_ports_for_controller: implement assignment of state_feature_functions * - * - * • Passes all tests except test_json with 'model_with_control' * - * • composition.py - add_projection: delete instantiation of shadow projections (handled by _update_shadow_projections) * • composition.py - add_projection: delete instantiation of shadow projections (handled by _update_shadow_projections) - remove calls to _update_shadows_dict * • composition.py - add_projection: delete instantiation of shadow projections (handled by _update_shadow_projections) - remove calls to _update_shadows_dict * - * • test_two_origins_two_input_ports: crashes on failure of C->B to update * - * • composition.py - added property shadowing_dict that has shadowing ports as keys and the ports they shadow as values - refactored _update_shadowing_projections to use shadowing_dict * • optimizationcontrolmechanism.py - _update_state_input_ports: modified validations for nested nodes; still failing some tests * • optimizationcontrolmechanism.py - _update_state_input_ports: more careful and informative validation that state_input_ports are in comp or nested comp and are INPUT nodes thereof; passes all tests except test_two_origins_two_input_ports as before * • composition.py _get_invalid_aux_components(): defer all shadow projections until _update_shadow_projections * • composition.py _get_invalid_aux_components(): bug fix in test for shadow projections * Port: _remove_projection_to_port: don't reduce variable below length 1 even ports with no incoming projections have variable at least length 1 * • composition.py add_node(): marked (but haven't removed) code block instantiating shadow_projections that seems now to be redundant with _update_shadow_projection * • show_graph.py - _assign_cim_components: supress showing projections not in composition * • composition.py: _analyze_graph(): add extra call to _determine_node_roles after _update_shadow_projections _run(): moved block of code at beginning initializing scheduler to after _complete_init_of_partially_initialized_nodes and _analyze_graph() • show_graph.py - add test to all loops on projections: "if proj in composition.projection" * • show_graph.py - add show_projections_not_in_composition option for debugging * • composition.py _update_shadow_projections(): delete unused shadow projections and corresponding ports * • composition.py _update_shadow_projections(): fix bug in deletion of unused shadow projections and ports • test_show_graph: tests failing, need mods to accomodate changes * • composition.py: _analyze_graph(): add extra call to _determine_node_roles after _update_shadow_projections _run(): moved block of code at beginning initializing scheduler to after _complete_init_of_partially_initialized_nodes and _analyze_graph() • show_graph.py - add test to all loops on projections: "if proj in composition.projection" * • show_graph.py fixes; now passes all show_graph tests * - * • composition.py _update_shadow_projections: raise error for attempt to shadow INTERNAL Node of nested comp * - * - * • test_composition.py implemented test_shadow_nested_nodes that tests shadowing of nested nodes * - * - * - * - * • optimizationcontrolmechanism.py: docstring mods * - * - * • optimizationcontrolmechanism.py docstring: add figure * • optimizationcontrolmechanism.py docstring: rev figure * - * - * - * - * - * - * - * - * - Co-authored-by: jdcpni <pniintel55> Co-authored-by: Jan Vesely <jan.vesely@rutgers.edu> Co-authored-by: Katherine Mantel <kmantel@princeton.edu> * Docs/ocm/revs (#2227) * • component.py docstring mod to **size** * • optimizationcontrolmechanism.py: added feature_input_ports attribute and num_feature_input_ports property * • optimizationcontrolmechanism.py: added feature_input_ports attribute and num_feature_input_ports property • parameterestimationcomposition.py: fixed misplacement of its Parameters() attribute * • optimizationcontrolmechanism.py: added feature_input_ports attribute and num_feature_input_ports property • parameterestimationcomposition.py: fixed misplacement of its Parameters() attribute • optimizationfunctions.py: made num_estimates a Parameter * - modified test_mode_based_num_estimates * - * - * • optimizationcontrolmechanism.py: - _instantiate_control_signals: random_seeds -> random_seed_mod_values * • composition.py - _add_controller: modifying to instantiate feature_input_ports if none are specified * • composition.py: - add_controller: now adds feature_input_ports for Compostion INPUT nodes if not state_features not specified * - * • composition.py …
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
in the case that the values attribute of a Parameter is not yet
populated, the source of a SharedParameter would not be detectable. We
can instead find a corresponding source Parameter using the default.
This should only be used for completely stateless purposes (checking the
value of a "descriptive" Parameter attribute like "stateful" or
"loggable")