Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
gboml
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
smart_grids
public
gboml
Commits
8da3196e
Commit
8da3196e
authored
2 years ago
by
Bardhyl Miftari
Browse files
Options
Downloads
Patches
Plain Diff
issue flat solution
parent
bda1098e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#11939
passed
2 years ago
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/gboml/gboml_graph.py
+19
-2
19 additions, 2 deletions
src/gboml/gboml_graph.py
with
19 additions
and
2 deletions
src/gboml/gboml_graph.py
+
19
−
2
View file @
8da3196e
...
...
@@ -11,7 +11,7 @@ from .compiler.classes import Parameter, Expression, Node, Hyperedge, Time, \
from
.compiler.utils
import
error_
,
move_to_directory
from
.solver_api
import
cplex_solver
,
gurobi_solver
,
clp_solver
,
dsp_solver
,
\
xpress_solver
,
highs_solver
,
cbc_solver
from
.output
import
generate_json
from
.output
import
generate_json
,
generate_list_values_tuple
from
enum
import
Enum
import
os
...
...
@@ -338,7 +338,7 @@ class GbomlGraph:
"""
return
self
.
__solve
(
clp_solver
)
def
solve_cbc
(
self
,
opt_file
=
None
,
opt_dict
=
None
):
def
solve_cbc
(
self
,
opt_file
=
None
,
opt_dict
=
None
):
"""
bound method solving the flattened optimization problem with Cbc
...
...
@@ -404,6 +404,23 @@ class GbomlGraph:
return
self
.
__solve
(
dsp_solver_function
)
def
turn_solution_to_list
(
self
,
solution
,
constraints_info
=
None
):
"""
bound method converting the flat solution to a list of <name, value> tuples
Args:
solution (ndarray) : flattened solution
constraints_info (dict) : dict of additional information
concerning constraints
Returns:
output_list (list): list of <name, value> tuples
"""
list_names
,
list_values
=
generate_list_values_tuple
(
self
.
program
,
solution
,
self
.
vector_c
,
self
.
indep_term_c
,
constraints_info
=
constraints_info
)
output_list
=
list
(
zip
(
list_names
,
list_values
))
return
output_list
def
turn_solution_to_dictionary
(
self
,
solver_data
,
status
,
solution
,
objective
,
constraint_info
=
None
,
variables_info
=
None
):
...
...
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