GAMS does not store your models internally in a database, but (by default) as ASCII or binary files. These files can be protected using the security options of the operating system you are using.
Let's assume that all users are allowed to provide data for the model and make runs and do reporting for those runs. If you don't want to allow them to view or change the model structure and algebra, you can accomplish that with our “Save and Restart Feature”. In essence, the core model is pre-compiled and can be run only by restarting from its pre-compiled form.
Below is an example, which shows who this can be achieved. We have two model files where private.gms
contains the secret parts of your model and public.gms
just the public data:
* private.gms $phantom foo $onempty set i / foo /; parameter c(i) / foo 0 /, w(i) / foo 0 /; scalar rhs /0/; binary variable x(i); variable z; equation obj, e; obj.. z =e= sum(i, c(i)*x(i)); e.. sum(i, w(i)*x(i)) =l= rhs; model kn /all/; set s / foo /; loop(s, c(i) = uniform(0.9,1.1)*c(i); solve kn max z using mip; );
* public.gms $onmulti set i / i1*i5 /; parameter c(i) / i1 1, i2 2, i3 3, i4 4, i5 5 / w(i) / i1 5, i2 4, i3 3, i4 2, i5 1 / scalar rhs /8/; set s /s1*s2/;
Now run private.gms
as follows: gams private.gms a=c s=0
. The output will be a pre-complied file 0.g00
, which is not human-readable. Now you can delete private.gms
(make a backup first)
and run public.gms
together with 0.g00
using: gams public r=0
. Please check appendix F (The Save and Restart Feature) of the GAMS User's Guide for more information.
Starting with distribution 22.4 there is also the option to encrypt GAMS source files and to link the encrypted file to a particular GAMS license. Please check appendix I (Compressed and Encrypted Input Files) of the GAMS User's Guide for more information.