mpgSolver

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func VarTypeToGRBVType

func VarTypeToGRBVType(vtype optim.VarType) (int8, error)

Types

type GurobiSolver

type GurobiSolver struct {
	Env                    *gurobi.Env
	CurrentModel           *gurobi.Model
	ModelName              string
	GoopIDToGurobiIndexMap map[uint64]int32 // Maps each Goop ID (uint64) to the idx value used for each Gurobi variable.
}

func NewGurobiSolver

func NewGurobiSolver(modelName string) GurobiSolver

NewGurobiSolver Description:

Create a new gurobi solver object.

func Solve

func Solve(model optim.Model) (optim.Solution, GurobiSolver, error)

OptimizeModel Description:

Getting

func (*GurobiSolver) AddConstraint

func (gs *GurobiSolver) AddConstraint(constrIn optim.Constraint, errors ...error) error

AddConstraint Description:

Adds a single constraint to the gurobi model object inside of the current GurobiSolver object.

func (*GurobiSolver) AddVariable

func (gs *GurobiSolver) AddVariable(varIn optim.Variable) error

AddVariable Description:

Adds a variable to the Gurobi Model.

func (*GurobiSolver) AddVariables

func (gs *GurobiSolver) AddVariables(varSliceIn []optim.Variable) error

AddVariables Description:

Adds a set of variables to the Gurobi Model.

func (*GurobiSolver) CreateModel

func (gs *GurobiSolver) CreateModel(modelName string)

CreateModel Description:

func (*GurobiSolver) DeleteSolver

func (gs *GurobiSolver) DeleteSolver() error

DeleteSolver Description:

Attempts to delete all info about the current solver.

func (*GurobiSolver) Free

func (gs *GurobiSolver) Free()

Free Description:

Frees the Env and Model elements of the system.

func (*GurobiSolver) FreeEnv

func (gs *GurobiSolver) FreeEnv()

FreeEnv Description:

Frees the Env() method. Useful after the problem is solved.

func (*GurobiSolver) FreeModel

func (gs *GurobiSolver) FreeModel()

FreeModel Description

Frees the Model member. Useful after the problem is solved.

func (*GurobiSolver) GetTimeLimit

func (gs *GurobiSolver) GetTimeLimit() (float64, error)

GetTimeLimit Description:

Gets the time limit of the current model in gurobi solver gs.

Input:

None

Output

limitInS = Value of time limit in seconds (float)

func (*GurobiSolver) Optimize

func (gs *GurobiSolver) Optimize() (optim.Solution, error)

Optimize Description:

func (*GurobiSolver) SetObjective

func (gs *GurobiSolver) SetObjective(objIn optim.Objective) error

SetObjective Description:

This algorithm should set the objective based on the value of the expression provided as input to this function.

func (*GurobiSolver) SetTimeLimit

func (gs *GurobiSolver) SetTimeLimit(limitInS float64) error

SetTimeLimit Description:

Sets the time limit of the current model in gurobi solver gs.

Input:

limitInS = Value of time limit in seconds (float)

func (*GurobiSolver) ShowLog

func (gs *GurobiSolver) ShowLog(tf bool) error

ShowLog Description:

Decides whether or not to print logs to the terminal?

func (*GurobiSolver) ToGurobiLinearConstraint

func (gs *GurobiSolver) ToGurobiLinearConstraint(constr optim.ScalarConstraint) (
	[]*gurobi.Var, []float64, int8, float64, error,
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL