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)[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.
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) >>> model.convert("jacobian", file_format=gp.FileFormat.GDXJacobian, options=options)
- GAMSInsert: str | None#
- GAMSObjVar: str | None#
- GDXIntervalEval: bool | None#