Commit b1cfaa99 authored by Jorn Baayen's avatar Jorn Baayen

Always maintain insertion order when using dictionaries to create lists of...

Always maintain insertion order when using dictionaries to create lists of state variables or constraints.
parent 04772624
from abc import ABCMeta, abstractmethod
from collections import OrderedDict
from typing import Callable, Dict, List, Union
import casadi as ca
import numpy as np
......@@ -721,8 +722,8 @@ class GoalProgrammingMixin(OptimizationProblem, metaclass = ABCMeta):
options = self.goal_programming_options()
self.__subproblem_constraints = [{} for ensemble_member in range(self.ensemble_size)]
self.__subproblem_path_constraints = [{} for ensemble_member in range(self.ensemble_size)]
self.__subproblem_constraints = [OrderedDict() for ensemble_member in range(self.ensemble_size)]
self.__subproblem_path_constraints = [OrderedDict() for ensemble_member in range(self.ensemble_size)]
self.__first_run = True
self.__results_are_current = False
for i, (priority, goals, path_goals) in enumerate(subproblems):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment