Optimization Option "constrained levmar" Doesn't Work

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • joewang
    Junior Member
    • Feb 2019
    • 11

    Optimization Option "constrained levmar" Doesn't Work

    Hello,

    I'm trying to use the parameter optimization feature in FEBio2.8.5. I've found an example case in the forum, under post:


    When I tried to run this example with: -i CCsrlxFit3.feb -s CCsrlxOpt3.feb. An error occurred with messages:
    Reading file CCsrlxFit3.feb ...SUCCESS!
    FATAL ERROR: invalid value "constrained levmar" for attribute "Options.type" (line 4)
    Failed initializing the task: optimize

    I went back to check the source code. In the file "/FEBioOpt/FEOptimizeInput.cpp" Line 158-168 shows:
    if (szt == 0) popt = new FELMOptimizeMethod;
    else
    {
    if (strcmp(szt, "levmar") == 0) popt = new FELMOptimizeMethod;
    else if (strcmp(szt, "powell") == 0) popt = new FEPowellOptimizeMethod;
    else if (strcmp(szt, "scan") == 0) popt = new FEScanOptimizeMethod;
    #ifdef HAVE_LEVMAR
    else if (strcmp(szt, "constrained levmar") == 0) popt = new FEConstrainedLMOptimizeMethod;
    #endif
    else throw XMLReader::InvalidAttributeValue(tag, "type", szt);
    }
    Where seems the "HAVE_LEVMAR" is required to active "constrained levmar".

    I've attached both input files here:
    CCsrlxOpt3.feb
    CCsrlxFit3.feb
    I wonder if the problem comes from the input file or the code itself.

    Thank you ahead for any help

    Best,
    Joe
  • brandonz
    Member
    • Oct 2014
    • 48

    #2
    Hi Joe,

    I just rechecked these files, using version 2.8.5 on a Mac and they ran as expected and did not reproduce your error. What operating system are you using?

    Brandon

    Comment

    • joewang
      Junior Member
      • Feb 2019
      • 11

      #3
      Hi Brandon,

      Thank you for fast response. I'm using a macOS Mojave 10.14.3 with Intel compiler and Clion as IDE. I've tried to change the "constrained levmar" into "levmar", everything works fine. Do you have any idea what might be wrong?

      Joe

      Comment

      • joewang
        Junior Member
        • Feb 2019
        • 11

        #4
        Actually, I couldn't find where the "HAVE_LEVMAR" is defined. Could you please do me favor searching through your source codes for how and where the HAVE_LEVMAR is defined? Thank you very much.

        Joe

        Comment

        • maas
          Lead Code Developer
          • Nov 2007
          • 3441

          #5
          Hi Joe,

          The HAVE_LEVMAR needs to defined on the compiler command line and is referenced in FEConstrainedLMOptimizeMethod.h/.cpp. If you can't use the "constrained levmar" method, then this probably means the executable was not build with this macro set. If you got the executable from our web site, we'll have to rebuild it and uploaded it again.

          Cheers,

          Steve
          Department of Bioengineering, University of Utah
          Scientific Computing and Imaging institute, University of Utah

          Comment

          • brandonz
            Member
            • Oct 2014
            • 48

            #6
            Hi Joe,

            I found out how to reproduce your error. My IDE is Xcode and in the FEBioOpt project settings for my compilers there is an option for other flags. For the Intel compiler, look under "ICC_OTHER_CPLUSPLUSFLAGS". Add the flag "-DHAVE_LEVMAR". (For anyone using the Apple compiler, this will be found under "OTHER_CPLUSPLUSFLAGS"). This should allow you to run constrained levmar.

            However, for this problem, there actually are no constraints, so constrained levmar isn't necessary. It turns out that using levmar is much faster and more accurate (although both are so accurate that the difference is marginal).

            Let me know if this helps.

            Brandon

            Comment

            • joewang
              Junior Member
              • Feb 2019
              • 11

              #7
              Hi Brandon,

              I think you are right. We are using a custom CMake and need to define the "HAVE_LEVMAR" flag which we didn't right now. I'll figure it out with my colleagues. I really appreciate your help. It is very helpful.

              Joe

              Comment

              • joewang
                Junior Member
                • Feb 2019
                • 11

                #8
                Hi Steve,

                Thank you for reply. We use the source code and build with our custom CMake file. However, we didn't include the HAVE_LEVMAR flag in it. I suppose that's why I had this problem.

                Best,
                Joe

                Comment

                • maas
                  Lead Code Developer
                  • Nov 2007
                  • 3441

                  #9
                  Hi Joe,

                  Keep in mind that the levmar library is not included in the FEBio source code distribution. This is third-party library that you need to obtain separately from here .

                  Cheers,

                  Steve
                  Department of Bioengineering, University of Utah
                  Scientific Computing and Imaging institute, University of Utah

                  Comment

                  Working...
                  X
                  😀
                  😂
                  🥰
                  😘
                  🤢
                  😎
                  😞
                  😡
                  👍
                  👎