compiling vf13 plugin

Development of custom GMAT plugins

compiling vf13 plugin

Postby mcj » Tue Apr 16, 2013 1:17 pm

I am building a release version of the vf13 plugin with the Windows 32-bit compiler in VS2010. I added the missing files as described in the README file. The build gives the following errors:


1> VF13Factory.cpp
1>..\..\src\base\factory\VF13Factory.cpp(48): error C2259: 'VF13ad' : cannot instantiate abstract class
1> due to following members:
1> 'bool GmatBase::RenameRefObject(const Gmat::ObjectType,const std::string &,const std::string &)' : is abstract
1> ..\..\..\gmatdevelopment\src\base\foundation\GmatBase.hpp(126) : see declaration of 'GmatBase::RenameRefObject'
1> 'bool GmatBase::HasLocalClones(void)' : is abstract
1> ..\..\..\gmatdevelopment\src\base\foundation\GmatBase.hpp(461) : see declaration of 'GmatBase::HasLocalClones'
1>
1> VF13ad.cpp
1>..\..\..\Gmat3rdParty\f2c\include\f2c.h(161): warning C4005: 'min' : macro redefinition
1> C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\windef.h(194) : see previous definition of 'min'
1>..\..\..\Gmat3rdParty\f2c\include\f2c.h(162): warning C4005: 'max' : macro redefinition
1> C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\windef.h(190) : see previous definition of 'max'
1>
1>..\..\src\base\solver\VF13ad.cpp(174): error C2259: 'VF13ad' : cannot instantiate abstract class
1> due to following members:
1> 'bool GmatBase::RenameRefObject(const Gmat::ObjectType,const std::string &,const std::string &)' : is abstract
1> ..\..\..\gmatdevelopment\src\base\foundation\GmatBase.hpp(126) : see declaration of 'GmatBase::RenameRefObject'
1> 'bool GmatBase::HasLocalClones(void)' : is abstract
1> ..\..\..\gmatdevelopment\src\base\foundation\GmatBase.hpp(461) : see declaration of 'GmatBase::HasLocalClones'
1>..\..\src\base\solver\VF13ad.cpp(1152): error C2664: 'vf13ad_' : cannot convert parameter 1 from 'Integer *' to 'integer *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>..\..\src\base\solver\VF13ad.cpp(1244): error C2065: 'initialized' : undeclared identifier
1>..\..\src\base\solver\VF13ad.cpp(1396): error C2065: 'initialized' : undeclared identifier


I don't understand the cause of the errors. I am using code from http://svn.code.sf.net/p/gmatplugins/code/trunk/VF13OptimizerPlugin/.
Attachments
VF13ad.cpp
(49.4 KiB) Downloaded 1224 times
VF13Factory.cpp
(5.32 KiB) Downloaded 1221 times
VF13DEP.h
(371 Bytes) Downloaded 1166 times
VF13DEP.c
(27.92 KiB) Downloaded 1228 times
Last edited by jjkparker on Mon Mar 30, 2015 8:14 pm, edited 1 time in total.
Reason: Deleted VF13 code - we're not allowed to redistribute that code
mcj
 
Posts: 8
Joined: Thu Apr 11, 2013 1:47 pm

Re: compiling vf13 plugin

Postby DJCinSB » Tue Apr 16, 2013 10:09 pm

The issue you are running into here is that the GMAT's core code is evolving and now has some requirements that are not met by the code (from plugins) that you are using. I'll have time to clean some of this up this weekend (sigh, while sitting on a plane) or sooner; expect an update soon. I'll post here when it goes up.

One thing you could try is placing these lines:
Code: Select all
   DEFAULT_TO_NO_CLONES
   DEFAULT_TO_NO_REFOBJECTS
into VF13ad.hpp right before the "protected:" section. These macros provide default implementations for the new required methods. I'm not sure if they implement everything that the code in the plugins project needs, though -- that code is a few years old and only gets exercised when someone needs to start from scratch building the VF13ad optimizer.

Let me know if this is all that was needed. If there are additional errors, I'll try to correct them when I prepare the code update over the weekend.
DJCinSB
 
Posts: 274
Joined: Mon Jun 09, 2008 3:57 pm

Re: compiling vf13 plugin

Postby mcj » Wed Apr 17, 2013 12:07 pm

The addition of the macros eliminated the "cannot instantiate abstract class" errors, but the others remain (shown below). Thanks in advance for any help you can provide.


1> VF13ad.cpp
1>..\..\..\Gmat3rdParty\f2c\include\f2c.h(161): warning C4005: 'min' : macro redefinition
1> C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\windef.h(194) : see previous definition of 'min'
1>..\..\..\Gmat3rdParty\f2c\include\f2c.h(162): warning C4005: 'max' : macro redefinition
1> C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\windef.h(190) : see previous definition of 'max'
1>
1>..\..\src\base\solver\VF13ad.cpp(1152): error C2664: 'vf13ad_' : cannot convert parameter 1 from 'Integer *' to 'integer *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>..\..\src\base\solver\VF13ad.cpp(1244): error C2065: 'initialized' : undeclared identifier
1>..\..\src\base\solver\VF13ad.cpp(1396): error C2065: 'initialized' : undeclared identifier
mcj
 
Posts: 8
Joined: Thu Apr 11, 2013 1:47 pm

Re: compiling vf13 plugin

Postby DJCinSB » Wed Apr 17, 2013 3:24 pm

Thanks for the additional information. The min and max issue comes from a redefinition in f2c and can be ignored. I'll clean up the integer/Integer piece and others when I update the repository this weekend.
DJCinSB
 
Posts: 274
Joined: Mon Jun 09, 2008 3:57 pm

Re: compiling vf13 plugin

Postby mcj » Thu May 23, 2013 2:38 pm

I have implemented a simple workaround for this problem.

In VF13ad.cpp, I replaced both instances of

Code: Select all
if (initialized)

with

Code: Select all
if (isInitialized)

I also replaced the call to vf13ad_ with the following:

Code: Select all
   integer variableCountLong = (integer) variableCount;
   integer numConstraintsLong = (integer) numConstraints;
   integer eqConstraintCountLong = (integer) eqConstraintCount;
   integer varLengthLong = (integer) varLength;
   integer maxIterationsLong = (integer) maxIterations;
   integer iprintLong = (integer) iprint;
   integer retCodeLong = (integer) retCode;   
   integer workspaceLengthLong = (integer) workspaceLength;
   integer* integerWorkspaceLong = (integer*) integerWorkspace;
     
   vf13ad_(
         &variableCountLong,
         &numConstraintsLong,
         &eqConstraintCountLong,
         vars,             
         &cost,             
         grad,             
         constraints,       
         cJacobian,         
         &varLengthLong,
         &maxIterationsLong,
         &tolerance,
         &iprintLong,
         &retCodeLong,
         workspace,         
         &workspaceLengthLong,
         integerWorkspaceLong);

   retCode = (Integer) retCodeLong;


Not sure if this is the best way to fix the problems or if I have broken anything, but it did compile. And I have tested the VF13 optimizer with several example problems to confirm that it does perform as expected.
mcj
 
Posts: 8
Joined: Thu Apr 11, 2013 1:47 pm

Re: compiling vf13 plugin

Postby tumistufilorenzo » Thu Aug 08, 2013 3:00 pm

As I cannot work with a MATLAB interface, i also tried to compile the VF13 plugin to have a least one Optimizer available. I successfully managed to have GMAT compiled, and then I afforded the VF13 plugin compilation, including all suggested modifications to VF13ad.cpp listed before. At the end of the link phase I still have an unresolved external symbol "public: static class std::basic_string<char,struct std:char_traits<char>, class std:allocator<char> > const * const GmatBase::PARAM_TYPE_STRING" (?PARAM_TYPE_STRING@GmatBase@@2QBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@B).
In addition i signal that I was forced to exclude from the Default Libraries libcmt.lib.
Any sugestion to eliminate this last error?
Attachments
Output-Build(8-Aug-2013).txt
VF13 plugin Build Output file
(7.75 KiB) Downloaded 1148 times
tumistufilorenzo
 
Posts: 4
Joined: Thu Aug 01, 2013 9:05 am

Re: compiling vf13 plugin

Postby Ajaja » Thu Mar 26, 2015 11:28 pm

I downloaded VF13OptimizerPlugin from http://sourceforge.net/p/gmatplugins/gi ... izerPlugin , compilied it using vf13-1.0.0.tar.gz from HSL (with DEFAULT_TO_NO_CLONES, DEFAULT_TO_NO_REFOBJECTS in VF13ad.hpp and typedef int integer in f2c.h) , and I got error running tests:
Code: Select all
 ***** file: C:\GMAT\samples\NeedVF13ad\Ex_AlgebraicOptimization.script
1: **** ERROR **** Interpreter Exception: The field name "FeasibilityTolerance" on object "SQPfmincon" is not permitted in line:
   "  16: GMAT SQPfmincon.FeasibilityTolerance = .0001;"

After removing this line "GMAT SQPfmincon.FeasibilityTolerance = .0001;" scripts works fine.

Looks like there is old version of plugin on sourceforge.net. Without FeasibilityTolerance parameter. Where can I download latest source code?
Ajaja
 
Posts: 5
Joined: Thu Mar 26, 2015 11:14 pm

Re: compiling vf13 plugin

Postby jjkparker » Fri Mar 27, 2015 6:07 pm

Ajaja, I'm glad to hear you had some success.

You're right, GMAT has enhanced the VF13 code to add a feasibility tolerance parameter. This particular parameter won't work unless we release our patch to the source code. I'll check around with the team here.

Where there any other changes you had to make to the instructions to get it to work?
Joel J. K. Parker
Flight dynamics engineer, GMAT team
http://gmatcentral.org
jjkparker
 
Posts: 617
Joined: Thu Jan 07, 2010 9:48 pm
Location: NASA Goddard Space Flight Center, Greenbelt, MD

Re: compiling vf13 plugin

Postby Ajaja » Fri Mar 27, 2015 7:47 pm

Only small changes in libVF13Optimizer.vcxproj. Few "Additional Include Directories" were missed ( ..\..\..\..\GmatDevelopment\src\base\coordsystem, ..\..\..\..\GmatDevelopment\src\base\solarsys).
Ajaja
 
Posts: 5
Joined: Thu Mar 26, 2015 11:14 pm

Re: compiling vf13 plugin

Postby shughes » Wed Apr 08, 2015 4:44 pm

Another user suggested this change to add a feasiblity tolerance. YOu will need to modify the Fortran interface to support feastol as an input
Code: Select all
!.......JW Edit : 9-10-09.............                                                                      !JW 9-10-2009
      if (use_feastol) then                                                                                             !JW 9-10-2009
            !Force it to consider constraint feasibility using the feastol tolerance            !JW 9-10-2009
            ! [individually testing each of the == and >= constraints]                                !JW 9-10-2009
            if (sum>acc .or. any(abs(c(1:meq))>feastol) .or. any(abs(c(meq+1:m))<feastol))      !JW 9-10-2009
     +            goto 120                                                                                                    !JW 9-10-2009
      else                                                                                                                    !JW 9-10-2009
            !Original code [uses expected changes in constraint violations]                           !JW 9-10-2009
            DO 110 K = 1,M
  110       SUM = SUM + DABS(VLAM(K)*C(K))
            IF (SUM.GT.ACC) GO TO 120
      end if                                                                                                                  !JW 9-10-2009
  !.......End JW Edit : 9-10-09.........                                                                    !JW 9-10-2009

shughes
 
Posts: 443
Joined: Mon Jun 09, 2008 6:27 pm

Next

Return to Plugin Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron