Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ A collection of optimal control problems, each available in one or more modeling
src/ # Module: problem registry and model backends (AbstractModelBackend)
ext/ # Weak-dependency extensions, one per modeling:
# OptimalControlModels, OptimalControlScalarizedModels, JuMPModels,
# MetaData, Descriptions
# MetaData (the metadata and the description of each problem)
test/ # Test suite: one file per modeling plus shared checks (aqua, init, solution)
docs/ # Documentation site (Documenter)
.ct-conventions/ # ct-conventions, cloned at the pinned tag (git-ignored)
Expand Down
2 changes: 1 addition & 1 deletion docs/problems.jl
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ function problem_page(problem::Symbol)
refs = references(problem)
statuses = OCP.status(problem)
description = with_behaviour(
read(joinpath(ROOT, "ext", "Descriptions", "$(problem).md"), String)
read(joinpath(ROOT, "ext", "MetaData", "$(problem).md"), String)
)

views = Any[(id="problem", label="Problem", kind="problem")]
Expand Down
2 changes: 1 addition & 1 deletion docs/src/problems-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ the latest convergence reports.
| :--- | :--- |
| Modelings | the files of the problem: a problem exists in a modeling when its file does |
| Status | the metadata, `valid` or `draft` per modeling |
| Description | `ext/Descriptions/<problem>.md` |
| Description | `ext/MetaData/<problem>.md`, next to the metadata |
| Parameters, default grid, initial guess | the metadata, `ext/MetaData/<problem>.jl` |
| Features | computed from the OptimalControl model |
| Reference objective | computed from the convergence and robustness crons, per scheme, on the default grid |
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions ext/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ problems: the lists are computed from the files.
```text
ext/
├── MetaData/<problem>.jl # metadata of every problem: one file each
├── MetaData/<problem>.md # description of every problem, next to its metadata
├── MetaData/references/<problem>.toml # reference objectives, generated (tools/references)
├── Descriptions/<problem>.md # description of every problem: one file each
├── <Modeling>Models/<problem>.jl # the problem in a modeling, one directory per modeling
├── JuMPModels.jl # extension of the JuMP modeling
├── ModelingToolkitModels.jl # extension of the ModelingToolkit modeling
Expand Down Expand Up @@ -37,7 +37,7 @@ ext/

The schema is `METADATA_SCHEMA` in `src/Metadata/loading.jl`, checked when the
package loads.
2. **Description**, `Descriptions/<problem>.md`: the problem in words and its mathematical
2. **Description**, `MetaData/<problem>.md`, next to the metadata: the problem in words and its mathematical
formulation, and a `### References` section with at least one entry (checked).
3. **Models**: one file per modeling, `<Modeling>Models/<problem>.jl`. Copy the file of a
problem with the same features (kind of cost, free times, constraints) in the same modeling:
Expand Down
2 changes: 1 addition & 1 deletion src/Catalogue/fingerprint.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
function _problem_files(problem::Symbol)
files = [
joinpath(Modelings.EXT_PATH, "MetaData", "$(problem).jl"),
joinpath(Modelings.EXT_PATH, "Descriptions", "$(problem).md"),
joinpath(Modelings.EXT_PATH, "MetaData", "$(problem).md"),
]
for spec in Modelings.MODELING_SPECS
Modelings._problem_exists(problem, spec) &&
Expand Down
2 changes: 1 addition & 1 deletion test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ modelings change different problems). The rules are read from the repository:
| `ext/<M>Models/<p>.jl`, a problem of a modeling | `M`, `comparison` | `p` |
| another file of `ext/<M>Models/` (e.g. `schemes/`) | `M`, `comparison` | all |
| `ext/<E>.jl`, an extension | those whose `Project.toml` holds its triggers | all |
| a file of `ext/MetaData/` or `ext/Descriptions/` named after a problem | all | `p` |
| a file of `ext/MetaData/` named after a problem (metadata, description) | all | `p` |
| `test/suite/<env>/**` | `env` (none for `core` and the opt-in ones) | all |
| `test/common/<f>.jl` | those whose tests include it, directly or not; all if `test/runtests.jl` names it | all |
| `test/cron/**`, `test/robustness/**`, `tools/**`, `docs/**`, Markdown outside `ext/` | none: `core` only | — |
Expand Down
13 changes: 7 additions & 6 deletions test/suite/core/test_consistency.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ const OCP = OptimalControlProblems
const ROOT = pkgdir(OptimalControlProblems)
const EXT = joinpath(ROOT, "ext")

# Directories of ext/ that hold one file per problem, and the extension of their files.
const DATA_DIRECTORIES = ("MetaData" => ".jl", "Descriptions" => ".md")
# The hand-written data of a problem, in ext/MetaData/: its metadata and its description,
# one file each, side by side.
const DATA_FILES = (".jl", ".md")

function names_in(dir, extension)
return sort!([
Expand All @@ -24,8 +25,8 @@ function test_files()
Test.@testset "files" verbose = VERBOSE begin
problems = OCP.problems(; status=:all)
# metadata and descriptions: one file each per problem, and nothing else
for (dir, extension) in DATA_DIRECTORIES
Test.@test names_in(joinpath(EXT, dir), extension) == problems
for extension in DATA_FILES
Test.@test names_in(joinpath(EXT, "MetaData"), extension) == problems
end
# model directories: exactly the directories of the modeling table
model_dirs = sort!([
Expand Down Expand Up @@ -244,7 +245,7 @@ end
function test_outline()
Test.@testset "outline" verbose = VERBOSE begin
for problem in OCP.problems(; status=:all)
text = read(joinpath(EXT, "Descriptions", "$problem.md"), String)
text = read(joinpath(EXT, "MetaData", "$problem.md"), String)
Test.@test follows_outline(text)
end
complete = "### Mathematical formulation\n### Qualitative behaviour\n### Characteristics\n### References\n"
Expand All @@ -270,7 +271,7 @@ end
function test_sources()
Test.@testset "sources" verbose = VERBOSE begin
for problem in OCP.problems(; status=:all)
text = read(joinpath(EXT, "Descriptions", "$problem.md"), String)
text = read(joinpath(EXT, "MetaData", "$problem.md"), String)
Test.@test cites_sources(text)
end
Test.@test cites_sources("text\n\n### References\n\n- **A. (2000)**. *Title*.\n")
Expand Down
4 changes: 2 additions & 2 deletions tools/ci/scope.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
schemes): the same environments, every problem;
- ``ext/<E>.jl``, the entry point of an extension: the environments whose ``Project.toml``
holds every trigger of ``E`` (``[extensions]`` of the package's ``Project.toml``);
- ``ext/MetaData/**`` and ``ext/Descriptions/**``, a file named after a problem: every
- ``ext/MetaData/**``, a file named after a problem (its metadata, its description): every
environment, for that problem;
- ``test/suite/<env>/**``: the environment ``env``;
- ``test/common/<f>.jl``: the environments whose tests name ``<f>.jl`` (an ``include``),
Expand Down Expand Up @@ -152,7 +152,7 @@ def classify(row, repo):
needed = set(repo.triggers[stem])
envs = {e for e in repo.environments if needed <= repo.deps[e]}
return envs, ALL, f"extension `{stem}`"
if parts[0] == "ext" and len(parts) > 2 and parts[1] in ("MetaData", "Descriptions"):
if parts[0] == "ext" and len(parts) > 2 and parts[1] == "MetaData":
if stem in repo.problems:
return ALL, {stem}, f"problem `{stem}`"
return everything("not the file of a problem")
Expand Down
6 changes: 3 additions & 3 deletions tools/ci/test/test_scope.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def test_extension_entry_point(self):

def test_metadata_and_description(self):
self.assertEqual("problem=beam", self.scope("ext/MetaData/beam.jl"))
self.assertEqual("problem=robot", self.scope("ext/Descriptions/robot.md"))
self.assertEqual("problem=robot", self.scope("ext/MetaData/robot.md"))
self.assertEqual("problem=beam", self.scope("ext/MetaData/references/beam.toml"))

def test_metadata_file_not_a_problem(self):
Expand Down Expand Up @@ -285,11 +285,11 @@ def test_null_labels(self):

class TestSummary(unittest.TestCase):
def test_narrowed(self):
md = run_summary(changed(["ext/JuMPModels/beam.jl", "ext/Descriptions/robot.md"]))
md = run_summary(changed(["ext/JuMPModels/beam.jl", "ext/MetaData/robot.md"]))
self.assertIn("**Problems**: `beam`, `robot`", md)
self.assertIn("**Environments**: all", md)
self.assertIn("| modified | `ext/JuMPModels/beam.jl` | `JuMP`, `comparison` | `beam` |", md)
self.assertIn("| modified | `ext/Descriptions/robot.md` | all | `robot` |", md)
self.assertIn("| modified | `ext/MetaData/robot.md` | all | `robot` |", md)

def test_core_only(self):
md = run_summary(changed(["docs/make.jl"]))
Expand Down
Loading