Commit 64d3fa62 authored by Jorn Baayen's avatar Jorn Baayen

Merge branch 'casadi3-fixes' into 'casadi3'

Casadi3 fixes

See merge request !65
parents d2d06889 fb11af92
cython >= 0.23.0
numpy >= 1.11.0
mock >= 2.0.0
sphinx
......
......@@ -3,7 +3,6 @@ from abc import ABCMeta, abstractmethod
import numpy as np
import itertools
import logging
import cython
import sys
from .optimization_problem import OptimizationProblem
......
......@@ -5,7 +5,6 @@ Author: Jorn Baayen
Date : March 16, 2016
"""
from casadi import CasadiOptions
import logging
import sys
import os
......@@ -13,13 +12,13 @@ import re
import pstats
import cProfile
from data import pi
from optimization.alias_tools import OrderedSet
from optimization.pi_mixin import PIMixin
from .data import pi
from .optimization.alias_tools import OrderedSet
from .optimization.pi_mixin import PIMixin
from . import __version__
def run_optimization_problem(optimization_problem_class, base_folder='..', log_level=logging.INFO, profile=False, profile_casadi=False):
def run_optimization_problem(optimization_problem_class, base_folder='..', log_level=logging.INFO, profile=False):
"""
Sets up and solves an optimization problem.
......@@ -34,7 +33,6 @@ def run_optimization_problem(optimization_problem_class, base_folder='..', log_l
:param base_folder: Base folder.
:param log_level: The log level to use.
:param profile: Whether or not to enable profiling.
:param profile_casadi: Whether or not to enable CasADi profiling.
"""
......@@ -81,18 +79,7 @@ def run_optimization_problem(optimization_problem_class, base_folder='..', log_l
try:
prob = optimization_problem_class(
model_folder=model_folder, input_folder=input_folder, output_folder=output_folder)
if profile_casadi:
# Use CasADi "profilereport" to process these results.
filename = os.path.join(base_folder, 'profile_casadi.log')
logger.info(
"Logging CasADi profiling output to {}. Use 'profilereport' to analyze the results.".format(filename))
CasadiOptions.startProfiling(filename)
if profile:
# Must prepend set Cython compiler option "profile=True".
logger.warning(
"To profile effectively, compile RTC-Tools with the Cython compiler option 'profile=True'")
filename = os.path.join(base_folder, "profile.prof")
cProfile.runctx("prob.optimize()", globals(), locals(), filename)
......
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