ConvertOptions#
- class gamspy.ConvertOptions(*, AmplNLBin: bool | None = None, AmplNlInitDual: int | None = None, AmplNlInitPrimal: int | None = None, GDXHessian: bool | None = None, GDXNames: bool | None = None, GDXQuadratic: bool | None = None, GDXUELs: bool | None = None, GAMSInsert: str | None = None, HeaderTimeStamp: bool | None = None, GDXIntervalEval: bool | None = None, GAMSObjVar: str | None = None, PermuteEqus: bool | None = None, PermuteVars: bool | None = None, QExtractAlg: int | None = None, Reform: int | None = None, SkipNRows: int | None = None, Width: int | None = None, AMPL: str = 'ampl.mod', AMPLNL: str = 'ampl.nl', CPLEXLP: str = 'cplex.lp', CPLEXMPS: str = 'cplex.mps', GAMSDict: str = 'dict.txt', GAMSDictMap: str = 'dictmap.gdx', GAMSJacobian: str = 'jacobian.gms', GAMSPyJacobian: str = 'jacobian.py', GDXJacobian: str = 'jacobian.gdx', FileList: str = 'files.txt', FixedMPS: str = 'fixed.mps', GAMS: str = 'gams.gms', JuMP: str = 'jump.jl', LINGO: str = 'lingo.lng', OSiL: str = 'osil.xml', Pyomo: str = 'pyomo.py')[source]#
Options for the conversion of GAMSPy models into different formats.
- Attributes:
- AmplNLBinOptional[bool]
Enables binary .nl file. False by default.
- AmplNlInitDualOptional[int]
Specifies which initial equation marginal values to write to the .nl file.
0: Write no values
1: Write only nondefault values
2: Write all values.
1 by default.
- AmplNlInitPrimalOptional[int]
Specifies which initial primal values to write to the .nl file.
0: Write no values
1: Write only nondefault values
2: Write all values.
2 by default.
- GDXHessianOptional[bool]
Controls whether Hessian information is included in GDX Jacobian file. False by default.
- GDXNamesOptional[bool]
Controls whether variable and equation names are included in GDX Jacobian file. True by default.
- GDXQuadraticOptional[bool]
Specifies whether quadratic terms are included in GDX Jacobian file. False by default.
- GDXUELsOptional[bool]
Controls whether Universal Element List (UEL) information is included in GDX Jacobian file. True by default.
- GAMSInsertOptional[str]
Allows the insertion of custom GAMS code into the model.
- HeaderTimeStampOptional[bool]
Specifies a timestamp to include in the header of the output file.
- GDXIntervalEvalOptional[bool]
Controls the inclusion of interval evaluation (symbols A_int and e_int) into the GDX Jacobian format. False by default.
- GAMSObjVarOptional[str]
Specifies the name of the objective variable in the GAMS scalar model.
- PermuteEqusOptional[bool]
Enables or disables the permutation of equations. False by default.
- PermuteVarsOptional[bool]
Enables or disables the permutation of variables. False by default.
- QExtractAlgOptional[int]
Specifies the algorithm used for quadratic extraction.
0: Automatic
1: ThreePass: Uses a three-pass forward / backward / forward AD technique to compute function / gradient / Hessian values and a hybrid scheme for storage.
2: DoubleForward: Uses forward-mode AD to compute and store function, gradient, and Hessian values at each node or stack level as required. The gradients and Hessians are stored in linked lists.
3: Concurrent: Uses ThreePass and DoubleForward in parallel. As soon as one finishes, the other one stops.
0 by default.
- ReformOptional[int]
Controls the reformulation of certain structures in the model. 0: No reformulation, 1: Apply reformulation.
- SkipNRowsOptional[int]
Skip constraints of type NONBINDING.
- WidthOptional[int]
Sets the width for certain output formats, such as tables or reports.
- AMPLstr
AMPL input format filename. “ampl.mod” by default.
- AMPLNLstr
AMPL nl format filename. “ampl.nl” by default.
- CPLEXLPstr
CPLEX LP format filename. “cplex.lp” by default.
- CPLEXMPSstr
CPLEX MPS format filename. “cplex.mps” by default.
- GAMSDictstr
GAMS dictionary format filename. “dict.txt” by default.
- GAMSDictMapstr
GAMS dictionary map format filename. “dictmap.gdx” by default.
- GAMSJacobianstr
Jacobian in GAMS filename. “jacobian.gms” by default.
- GAMSPyJacobianstr
Jacobian in GAMSPy filename. “jacobian.py” by default.
- GDXJacobianstr
GDX filename with model data incl. Jacobian and Hessian evaluated at current point. “jacobian.gdx” by default.
- FileListstr
Filename for the file that contains the list of file formats generated. “files.txt” by default.
- FixedMPSstr
Fixed format mps filename. “fixed.mps” by default.
- GAMSstr
GAMS scalar model filename. “gams.gms” by default.
- JuMPstr
JuMP scalar model filename. “jump.jl” by default.
- LINGOstr
Lingo format filename. “lingo.lng” by default.
- OSiLstr
Optimization Services instance Language (OSiL) format filename. “osil.xml” by default.
- Pyomostr
Pyomo concrete scalar model filename. “pyomo.py” by default.
Methods
copy(*[, include, exclude, update, deep])Returns a copy of the model.
model_construct([_fields_set])Creates a new instance of the Model class with validated data.
model_copy(*[, update, deep])!!! abstract "Usage Documentation"
model_dump(*[, mode, include, exclude, ...])!!! abstract "Usage Documentation"
model_dump_json(*[, indent, ensure_ascii, ...])!!! abstract "Usage Documentation"
model_json_schema(by_alias, ref_template, ...)Generates a JSON schema for a model class.
model_parametrized_name(params)Compute the class name for parametrizations of generic classes.
model_post_init(context, /)Override this method to perform additional initialization after __init__ and model_construct.
model_rebuild(*[, force, raise_errors, ...])Try to rebuild the pydantic-core schema for the model.
model_validate(obj, *[, strict, extra, ...])Validate a pydantic model instance.
model_validate_json(json_data, *[, strict, ...])!!! abstract "Usage Documentation"
model_validate_strings(obj, *[, strict, ...])Validate the given object with string data against the Pydantic model.
construct
dict
from_orm
json
parse_file
parse_obj
parse_raw
schema
schema_json
update_forward_refs
validate
Examples
>>> import gamspy as gp >>> m = gp.Container() >>> i = gp.Set(m, "i", records=["i1", "i2"]) >>> x = gp.Variable(m, "x", domain=i) >>> eq = gp.Equation(m, "eq", domain=i) >>> eq[i] = x[i] >= 1 >>> model = gp.Model(m, "test_model", equations=[eq], problem="LP", sense="min", objective=gp.Sum(i, x[i])) >>> options = gp.ConvertOptions(GDXNames=False, GDXJacobian="my_jacobian.gdx") >>> model.convert("jacobian", file_format=gp.FileFormat.GDXJacobian, options=options)
- AMPL: str#
- AMPLNL: str#
- CPLEXLP: str#
- CPLEXMPS: str#
- FileList: str#
- FixedMPS: str#
- GAMS: str#
- GAMSDict: str#
- GAMSDictMap: str#
- GAMSInsert: str | None#
- GAMSJacobian: str#
- GAMSObjVar: str | None#
- GAMSPyJacobian: str#
- GDXIntervalEval: bool | None#
- GDXJacobian: str#
- JuMP: str#
- LINGO: str#
- OSiL: str#
- Pyomo: str#