Skip to content

Add new schema definition#164

Open
olafmersmann wants to merge 10 commits intomainfrom
push-zmvqzzrwnlup
Open

Add new schema definition#164
olafmersmann wants to merge 10 commits intomainfrom
push-zmvqzzrwnlup

Conversation

@olafmersmann
Copy link
Copy Markdown
Collaborator

@olafmersmann olafmersmann commented Apr 21, 2026

Adds a formal schema definition for problems, generators, suites and implementations. These are packaged in a bare bones python module named opltools. A minimal usage example is located in examples/demo.py.

To check if a given yaml file adheres to the schema, there's an included cli tool. Run

uv run opl validate my-file.yaml

to check it.

Adds a formal schema definition for problems, generators, suites and
implementations. These are packaged in a bare bones python module named
opltools. A minimal usage example is located in examples/demo.py.

To check if a given yaml file adheres to the schema, there's an included cli
tool. Run

  uv run opl validate my-file.yaml

to check it.
Add a minimal (AI generated) set of unit tests for opltools. Run the tests on
push and for pull requests.
Variables and constraints are now lists (technically sets) with a description
of each type. This is more flexible than the previous approach and allows
iterative refinement.
Manual translation of the EMDO problem from the old problems.yaml file to the
new format to check if schema supports storing all information from old format.
Comment thread .github/workflows/check_python_package.yaml
@CIGbalance CIGbalance mentioned this pull request Apr 22, 2026
Rudimentary design document and reference for the new schema that attempts to
summarize the discussion at the OPL hackathon in April. The core structure was
written by the author, then fleshed out using Claude and finally reviewed by
again the author.

Co-Authored-By: Claude Opus 4.7
@olafmersmann olafmersmann force-pushed the push-zmvqzzrwnlup branch 2 times, most recently from 1d059cd to 240bfa7 Compare April 22, 2026 20:54
@olafmersmann
Copy link
Copy Markdown
Collaborator Author

PRs #172, #180, and #181 depend on this one and we need to either temporarily disable the HTML rebuild or also commit @Dvermetten's changes to the build scripts for this PR to land.

Comment thread examples/cobi.py
implementations={"cobi_impl"},
can_evaluate_objectives_independently="no",
constraints=[
# FIXME: Check
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should make issues for these FIXME's to not forget them after merging.

Copy link
Copy Markdown
Collaborator

@kvdblom kvdblom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see only minor issues we can either quickly fix before merging, or make sure to record somewhere to fix later.

Comment thread src/opltools/schema.py
return hash(self.title) + hash(self.link)


class Usage(BaseModel):
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not used anywhere?

Comment thread src/opltools/yesnosome.py
yes = "yes"
no = "no"
some = "some"
unknown = "?"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merge in #180

Comment thread SCHEMA.md Outdated
Comment thread SCHEMA.md Outdated
Comment thread SCHEMA.md
Fields shared by [Problem](#problem), [Suite](#suite), and [Generator](#generator).
The schema deliberately puts most descriptive fields here so suites can be characterised without explicitly having to add all problems in the suite.

| Field | Type | Notes |
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verify types and remove questionmarks

Comment thread SCHEMA.md

| Field | Type | Notes |
|------------|--------------|-----------------------------------------------|
| `problems` | set of IDs? | must resolve to [Problem](#problem)s |
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Veryfiy type + remove questionmark

Comment thread SCHEMA.md
|------------|--------------|-----------------------------------------------|
| `problems` | set of IDs? | must resolve to [Problem](#problem)s |

`fidelity_levels` is auto-unioned from member problems at validation time.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe move this comment to ProblemLike where other such cases are also covered?

Comment thread SCHEMA.md
Comment thread SCHEMA.md

```yaml
references:
- title: "Honey Badger Algorithm: New metaheuristic algorithm for solving optimization problems."
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace with a standard algorithm (basic GA/ES?). Fun-named algorithm as example is not a good look on us.

Comment thread SCHEMA.md

### Link

`{type?: str, url: str}`.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove questionmark?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Schema: Make all fields in a Reference optional Schema: Improve evaluation_time property

3 participants