Morpho-lang / Morpho-lang/morpho-optimize4

`ProblemAdapter` does not handle mesh-dependent functionals with field-only optimization

Open
#4 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1
Forks
0
PR merge metrics
No merged PRs in 30d

Description

Suppose you have an OptimizationProblem containing mesh-dependent functionals, such as Area(), AreaEnclosed(), Volume(), or ScalarPotential(...), and you define a ProblemAdapter() that restricts the optimization to only the Field degrees of freedom.

In this situation, optimizer4 complains about the type of OptimizationProblem, depending on whether the problem is constrained or unconstrained. This appears to happen because the adapted problem still contains functionals or constraints that depend on mesh degrees of freedom, even though those degrees of freedom are excluded by the ProblemAdapter.

I think ProblemAdapter should explicitly handle this case. For example, if the original problem contains a Volume() constraint but the adapter restricts the optimization to field degrees of freedom only, the adapter could either:

  • ignore the mesh-dependent contribution by treating its gradient with respect to the field degrees of freedom as zero, or
  • reject the adapted problem with a clear error explaining that the selected degrees of freedom are incompatible with one or more functionals or constraints.

At the moment, the resulting optimizer4 error makes it difficult to identify that the underlying issue is the mismatch between the functionals present in the OptimizationProblem and the degrees of freedom selected by the ProblemAdapter.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at ProblemAdapter and follow how it constructs the adapted OptimizationProblem before the optimizer4 type error occurs. Reproduce the issue with a mesh-dependent functional or constraint such as Volume() and field-only degrees of freedom. Done means the mismatch is either handled with a zero field gradient or rejected with a clear error identifying the incompatible functional or constraint.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.