-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfree_for_all_dense.py
55 lines (42 loc) · 1.47 KB
/
free_for_all_dense.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# SPDX-License-Identifier: Apache-2.0
# Copyright 2022 Stéphane Caron
# Copyright 2023-2024 Inria
"""Dense subset of the Free-for-all test set."""
import os
from typing import Iterator
from qpbenchmark.benchmark import main
from qpbenchmark.problem import Problem
from free_for_all import FreeForAll
class FreeForAllDense(FreeForAll):
"""Subset of dense problems from the Free-for-all test set.
Note:
This test set is open to proposals from the community. Feel free to
`submit a new problem
<https://github.com/qpsolvers/free_for_all_qpbenchmark/issues/new?template=new_problem.md>`__.
"""
@property
def description(self) -> str:
return "Community-built test set to benchmark QP solvers."
@property
def title(self) -> str:
return "Free-for-all dense subset"
@property
def sparse_only(self) -> bool:
"""This test set is open to sparse and dense matrices."""
return False
def __iter__(self) -> Iterator[Problem]:
"""Iterate on test set problems."""
for problem in super().__iter__():
if "CONT" in problem.name:
continue
yield problem.to_dense()
if __name__ == "__main__":
test_set_path = os.path.abspath(__file__)
test_set_dir = os.path.dirname(test_set_path)
main(
test_set_path=test_set_path,
results_path=f"{test_set_dir}/results/qpbenchmark_results.csv",
)