Procedure GMP::Solver::FreeEnvironment(solver)

GMP::Solver::FreeEnvironment

The procedure GMP::Solver::FreeEnvironment can be used to free a solver environment. By using the procedure GMP::Solver::InitializeEnvironment you can initialize a solver environment; by using this procedure you can free it again.

Normally AIMMS initializes solver environments at startup and frees them when it is closed. The procodures GMP::Solver::InitializeEnvironment and GMP::Solver::FreeEnvironment can be used to initialize and free a solver environment multiple times inside one AIMMS sesstion. Both procedures are typically used for solvers running on a remote server or a cloud system.
GMP::Solver::FreeEnvironment(
     solver      ! (input) a solver
     )

Arguments

solver

An element in the set AllSolvers.

Return Value

The procedure returns 1 on success, or 0 otherwise.

Note

  • This procedure can be used in combination with a normal solve statement.

  • This procedure is only supported by Gurobi.

  • This procedure cannot be called inside a solver callback procedure.

  • This procedure cannot be called if one of the solver sessions is asynchronous executing.

Example

Assume that ‘MIPSolver’ is an element parameter with range AllSolvers and ‘myGMP’ is an element parameter with range AllGeneratedMathematicalPrograms.

MIPSolver := 'Gurobi 12.0';

! First solve using normal solve statement.

GMP::Solver::InitializeEnvironment( MIPSolver );

solve MP1;

GMP::Solver::FreeEnvironment( MIPSolver );

! Second solve using GMP solve.

GMP::Solver::InitializeEnvironment( MIPSolver );

mgGMP := GMP::Instance::Generate( MP2 );
GMP::Instance::Solve( myGMP );

GMP::Solver::FreeEnvironment( MIPSolver );

See also

The procedure GMP::Solver::InitializeEnvironment.