Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
simulation
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
qronos-state-abstractions
simulation
Commits
6a42d20a
Commit
6a42d20a
authored
May 24, 2023
by
Tim Rheinfels
Browse files
Options
Downloads
Patches
Plain Diff
util: implement function to check for the presence of MOSEK
parent
fee7bef5
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/util.py
+19
-0
19 additions, 0 deletions
src/util.py
with
19 additions
and
0 deletions
src/util.py
+
19
−
0
View file @
6a42d20a
...
...
@@ -20,7 +20,9 @@
### @author Tim Rheinfels <tim.rheinfels@fau.de>
###
import
cvxpy
as
cp
from
enum
import
Enum
import
logging
import
json
import
numpy
as
np
...
...
@@ -98,3 +100,20 @@ class Serializable(object): #pragma: no cover
def
__str__
(
self
):
assert
(
hasattr
(
self
,
'
to_dict
'
))
return
json
.
dumps
(
self
.
to_dict
(),
indent
=
2
,
cls
=
StrJSONEncoder
)
###
### @brief Checks if MOSEK is correctly configured for use with cvxpy
###
### @returns True if MOSEK is present and usable
### @returns False if MOSEK cannot be used
###
def
check_mosek
():
#pragma: no cover
# Create a dummy problem and try solving it using MOSEK
x
=
cp
.
Variable
(
nonneg
=
True
)
problem
=
cp
.
Problem
(
cp
.
Minimize
(
x
))
try
:
problem
.
solve
(
solver
=
cp
.
MOSEK
)
except
:
logging
.
critical
(
'
MOSEK does not work. Did you install the license file?
'
,
exc_info
=
True
)
return
False
return
True
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment