GAMS World [ GAMS World Home | GMS2XX Translator | Search | Contact ]

lgomain.for

C   LP written by GAMS Convert at 07/06/07 14:18:15
C   
C   Equation counts
C       Total        E        G        L        N        X        C
C           6        1        3        2        0        0        0
C   
C   Variable counts
C                    x        b        i      s1s      s2s       sc       si
C       Total     cont   binary  integer     sos1     sos2    scont     sint
C           7        7        0        0        0        0        0        0
C   FX      0        0        0        0        0        0        0        0
C   
C   Nonzero counts
C       Total    const       NL      DLL
C          19       19        0        0
C
C   Variables and equations removed:
C          1 variables defined
C          0 variables fixed
C          0 equations free
C
C   5 LGO equations and 6 LGO variables
C
      subroutine user_fct(xx,obj,gg)

      implicit real*8 (a-h,o-z)
      dimension xx(6),gg(5)

      common /gamslgo/ NumEval,GamsX(7),GamsG(6)

      numeval = numeval + 1

C  map LGO variables to GAMS variables

      GamsX(1) = xx(1)
      GamsX(2) = xx(2)
      GamsX(3) = xx(3)
      GamsX(4) = xx(4)
      GamsX(5) = xx(5)
      GamsX(6) = xx(6)

C  compute defined variables

      GamsX(7) = -( - 0.225D0*GamsX(1) - 0.153D0*GamsX(2)
     . - 0.162D0*GamsX(3) - 0.225D0*GamsX(4) - 0.162D0*GamsX(5)
     . - 0.126D0*GamsX(6) - 0D0)

C  evaluate LGO equations

      GamsG(2) =    GamsX(1) + GamsX(2) + GamsX(3)
      gg(1) = GamsG(2) - 350D0

      GamsG(3) =    GamsX(4) + GamsX(5) + GamsX(6)
      gg(2) = GamsG(3) - 600D0

      GamsG(4) =    GamsX(1) + GamsX(4)
      gg(3) = - (GamsG(4) - 325D0)

      GamsG(5) =    GamsX(2) + GamsX(5)
      gg(4) = - (GamsG(5) - 300D0)

      GamsG(6) =    GamsX(3) + GamsX(6)
      gg(5) = - (GamsG(6) - 275D0)

C  return objective value in terms of LGO minimization

      obj = GamsX(7)

      return
      end

      implicit real*8 (a-h,o-z)
      common /gamslgo/ NumEval,GamsX(7),GamsG(6)
      character*20 modname,objname,varname(6),conname(5)
      integer ctype(5)
      dimension varnom(6),varlb(6),varub(6),varopt(6)
      dimension conopt(5)
      integer opmode,g_maxfct,tlimit,sstat,mstat
      real*8 kt_tol

      numeval = 0

C  set equation types

      ctype(1) =  -1
      ctype(2) =  -1
      ctype(3) =  -1
      ctype(4) =  -1
      ctype(5) =  -1

C  set bounds and nominal values

      varnom(1) = 0D0
      varlb (1) = 0D0
      varub (1) = 1000000D0
      varnom(2) = 0D0
      varlb (2) = 0D0
      varub (2) = 1000000D0
      varnom(3) = 0D0
      varlb (3) = 0D0
      varub (3) = 1000000D0
      varnom(4) = 0D0
      varlb (4) = 0D0
      varub (4) = 1000000D0
      varnom(5) = 0D0
      varlb (5) = 0D0
      varub (5) = 1000000D0
      varnom(6) = 0D0
      varlb (6) = 0D0
      varub (6) = 1000000D0

C  LGO names strings

      modname    = 'GamsModel'
      objname    = 'GamsX7'

      varname(1) = 'GamsX1'
      varname(2) = 'GamsX2'
      varname(3) = 'GamsX3'
      varname(4) = 'GamsX4'
      varname(5) = 'GamsX5'
      varname(6) = 'GamsX6'

      conname(1) = 'GamsG2'
      conname(2) = 'GamsG3'
      conname(3) = 'GamsG4'
      conname(4) = 'GamsG5'
      conname(5) = 'GamsG6'

C  set fixed variables


C  set defined equation levels

      GamsG(1) = 0D0

C  assign option values

      opmode    = 3
      g_maxfct  = 5500
      max_nosuc = 5500
      penmult_in= 100D0
      acc_tr    = -10000000000D0
      fct_trg   = -10000000000D0
      fi_tol    = 1D-6
      con_tol   = 1D-6
      kt_tol    = 1D-6
      irngs     = 0
      tlimit    = 1000

      nvars     = 6
      ncons     = 5

      open(9,file='lgosum.txt',status='unknown')

      call lgo_run(modname,nvars,ncons,varname,objname,
     .             conname,ctype,varlb,varnom,varub,
     .             opmode,g_maxfct,max_nosuc,penmult_in,acc_tr,
     .             fct_trg,fi_tol,con_tol,kt_tol,irngs,tlimit,
     .             varopt,conopt,objopt,nevals,resmax,runtime,
     .             sstat,mstat)

      close(9)

      call user_fct(varopt,obj,conopt)

C  evaluate free equations

      write(*,*) 'sstat=',sstat,'mostat=',mstat
      write(*,*) 'nevals=',nevals,'resmax=',resmax,'runtime=',runtime
      write(*,*) 'obj=',obj,'objopt=',objopt
      do 2 i = 1,7
  2   write(*,*) i,gamsx(i)
      do 3 i = 1,6
  3   write(*,*) i,gamsg(i)

      end