Пример #1
0
 def __init__(self):
     self._solvers_reg = SolversRegistry()
     self._cuts_gen_reg = CutsGeneratorsRegistry()
     self._config_manager = \
         ConfigurationManager(self._solvers_reg, self._cuts_gen_reg)
     self._config = self._config_manager.configuration
     self._telemetry = Telemetry()
     self.logger = get_logger('galini')
     self.cuts_generators_manager = CutsGeneratorsManager(self)
     self.paranoid_mode = False
Пример #2
0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Cuts generators manager."""
import numpy as np

import galini.core as core
from galini.config.options import OptionsGroup, StringListOption
from galini.logging import get_logger
from galini.registry import Registry
from galini.timelimit import current_time, seconds_elapsed_since
from galini.util import expr_to_str

logger = get_logger(__name__)


class CutsGeneratorsRegistry(Registry):
    """Registry of CutsGenerators."""
    def group_name(self):
        return 'galini.cuts_generators'


class _CutGeneratorCounter:
    def __init__(self, telemetry, name):
        self._cut_count = telemetry.create_counter('{}.cuts_count'.format(name))
        self._cut_time = telemetry.create_counter('{}.time'.format(name))

    def increment(self, cuts_count, time):
        self._cut_count.increment(cuts_count)
Пример #3
0
 def __init__(self):
     self._logger = get_logger("galini.telemetry")
     self._counters = []