Documentation ¶
Index ¶
- type ConstraintSense
- type Environment
- type ObjectiveSense
- type Problem
- func (p *Problem) ChangeCoefficient(i, j int, newValue float64) error
- func (p *Problem) CopyLPWNames(numCols, numRows int, objSense ObjectiveSense, objective, rhs []float64, ...) error
- func (p *Problem) Free()
- func (p *Problem) GetIterationCount() int
- func (p *Problem) GetRowInfeasibility(x []float64, begin, end int) ([]float64, error)
- func (p *Problem) GetSolution() (*Solution, error)
- func (p *Problem) LPOptimize() error
- func (p *Problem) NumColumns() int
- func (p *Problem) NumRows() int
- func (p *Problem) ReadCopyProblem(path string, problemType ProblemFileReadType) error
- func (p *Problem) WriteProblem(path string, problemType ProblemFileWriteType) error
- type ProblemFileReadType
- type ProblemFileWriteType
- type Solution
- type SolutionStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConstraintSense ¶
const ( ConstraintSenseLessThan ConstraintSense = 'L' ConstraintSenseEqualTo ConstraintSense = 'E' ConstraintSenseGreaterThan ConstraintSense = 'G' ConstraintSenseRanged ConstraintSense = 'R' )
type Environment ¶
type Environment struct {
// contains filtered or unexported fields
}
func NewEnvironment ¶
func NewEnvironment() (*Environment, error)
Create a new CPLEX environment - the Environment must be Free'd when no longer needed
func (*Environment) CreateProblem ¶
func (e *Environment) CreateProblem(name string) (*Problem, error)
Create a new Problem with the given name
func (*Environment) ReadCopyProblem ¶
func (e *Environment) ReadCopyProblem(name, path string, problemType ProblemFileReadType) (*Problem, error)
Create a new Problem and read a problem file on disk into it
type ObjectiveSense ¶
const ( ObjectiveSenseMin ObjectiveSense = -1 ObjectiveSenseMax ObjectiveSense = 1 )
type Problem ¶
type Problem struct {
// contains filtered or unexported fields
}
func (*Problem) ChangeCoefficient ¶
Set a single coefficient in the Problem, at row index i and column index j, to newValue
func (*Problem) CopyLPWNames ¶
func (p *Problem) CopyLPWNames(numCols, numRows int, objSense ObjectiveSense, objective, rhs []float64, sense []ConstraintSense, matbeg, matind, matcnt []int, matval, lb, ub, rngval []float64, colName, rowName []string) error
Set all of the fields in this Problem - see CPXcopylpwnames in the CPLEX documentation for details
func (*Problem) GetIterationCount ¶
Get the number of simplex iterations required to find a solution
func (*Problem) GetRowInfeasibility ¶
Get the infeasibility of a solution for a set of constraints - x is the solution, if x is nil the last computed solution will be used. See the documentation for CPXgetrowinfeas for details of how to interpret the output
func (*Problem) GetSolution ¶
After calling LPOptimize, get the Solution for the Problem
func (*Problem) LPOptimize ¶
Attempt to solve this Problem, returns any error that occurs. Note that exceeding a CPLEX limit or proving the problem infeasible or unbounded doesn't result in an error - see documentation for CPXlpopt for details
func (*Problem) NumColumns ¶
Get the number of columns (variables) in the Problem
func (*Problem) ReadCopyProblem ¶
func (p *Problem) ReadCopyProblem(path string, problemType ProblemFileReadType) error
Read a problem file on disk into this Problem
func (*Problem) WriteProblem ¶
func (p *Problem) WriteProblem(path string, problemType ProblemFileWriteType) error
Write this problem file to disk in the given format
type ProblemFileReadType ¶
type ProblemFileReadType string
Types of problem files which can be read in - AutoDetect attempts to choose a type automatically based on extension and file contents
const ( ReadAutoDetect ProblemFileReadType = "" ReadSAVProblemFile ProblemFileReadType = "SAV" ReadMPSProblemFile ProblemFileReadType = "MPS" ReadLPProblemFile ProblemFileReadType = "LP" )
type ProblemFileWriteType ¶
type ProblemFileWriteType string
Types of problem files which can be written - AutoDetect attempts to choose a type automatically based on file extension
const ( WriteAutoDetect ProblemFileWriteType = "" WriteSAVProblemFile ProblemFileWriteType = "SAV" WriteMPSProblemFile ProblemFileWriteType = "MPS" WriteLPProblemFile ProblemFileWriteType = "LP" WriteREWProblemFile ProblemFileWriteType = "REW" WriteRLPProblemFile ProblemFileWriteType = "RLP" WriteALPProblemFile ProblemFileWriteType = "ALP" )
type Solution ¶
type Solution struct { Status SolutionStatus ObjectiveValue float64 X []float64 Pi []float64 Slack []float64 Dj []float64 // contains filtered or unexported fields }
func (*Solution) StatusString ¶
Get a human-readable string to represent the solution status
type SolutionStatus ¶
Possible optimization results
const ( CPX_STAT_OPTIMAL SolutionStatus = C.CPX_STAT_OPTIMAL CPX_STAT_UNBOUNDED SolutionStatus = C.CPX_STAT_UNBOUNDED CPX_STAT_INFEASIBLE SolutionStatus = C.CPX_STAT_INFEASIBLE CPX_STAT_INForUNBD SolutionStatus = C.CPX_STAT_INForUNBD CPX_STAT_OPTIMAL_INFEAS SolutionStatus = C.CPX_STAT_OPTIMAL_INFEAS CPX_STAT_NUM_BEST SolutionStatus = C.CPX_STAT_NUM_BEST CPX_STAT_ABORT_IT_LIM SolutionStatus = C.CPX_STAT_ABORT_IT_LIM CPX_STAT_ABORT_TIME_LIM SolutionStatus = C.CPX_STAT_ABORT_TIME_LIM CPX_STAT_ABORT_OBJ_LIM SolutionStatus = C.CPX_STAT_ABORT_OBJ_LIM CPX_STAT_ABORT_USER SolutionStatus = C.CPX_STAT_ABORT_USER CPX_STAT_FEASIBLE_RELAXED_SUM SolutionStatus = C.CPX_STAT_FEASIBLE_RELAXED_SUM CPX_STAT_OPTIMAL_RELAXED_SUM SolutionStatus = C.CPX_STAT_OPTIMAL_RELAXED_SUM CPX_STAT_FEASIBLE_RELAXED_INF SolutionStatus = C.CPX_STAT_FEASIBLE_RELAXED_INF CPX_STAT_OPTIMAL_RELAXED_INF SolutionStatus = C.CPX_STAT_OPTIMAL_RELAXED_INF CPX_STAT_FEASIBLE_RELAXED_QUAD SolutionStatus = C.CPX_STAT_FEASIBLE_RELAXED_QUAD CPX_STAT_OPTIMAL_RELAXED_QUAD SolutionStatus = C.CPX_STAT_OPTIMAL_RELAXED_QUAD CPX_STAT_OPTIMAL_FACE_UNBOUNDED SolutionStatus = C.CPX_STAT_OPTIMAL_FACE_UNBOUNDED CPX_STAT_ABORT_PRIM_OBJ_LIM SolutionStatus = C.CPX_STAT_ABORT_PRIM_OBJ_LIM CPX_STAT_ABORT_DUAL_OBJ_LIM SolutionStatus = C.CPX_STAT_ABORT_DUAL_OBJ_LIM CPX_STAT_FEASIBLE SolutionStatus = C.CPX_STAT_FEASIBLE CPX_STAT_FIRSTORDER SolutionStatus = C.CPX_STAT_FIRSTORDER CPX_STAT_ABORT_DETTIME_LIM SolutionStatus = C.CPX_STAT_ABORT_DETTIME_LIM CPX_STAT_CONFLICT_FEASIBLE SolutionStatus = C.CPX_STAT_CONFLICT_FEASIBLE CPX_STAT_CONFLICT_MINIMAL SolutionStatus = C.CPX_STAT_CONFLICT_MINIMAL CPX_STAT_CONFLICT_ABORT_CONTRADICTION SolutionStatus = C.CPX_STAT_CONFLICT_ABORT_CONTRADICTION CPX_STAT_CONFLICT_ABORT_TIME_LIM SolutionStatus = C.CPX_STAT_CONFLICT_ABORT_TIME_LIM CPX_STAT_CONFLICT_ABORT_IT_LIM SolutionStatus = C.CPX_STAT_CONFLICT_ABORT_IT_LIM CPX_STAT_CONFLICT_ABORT_NODE_LIM SolutionStatus = C.CPX_STAT_CONFLICT_ABORT_NODE_LIM CPX_STAT_CONFLICT_ABORT_OBJ_LIM SolutionStatus = C.CPX_STAT_CONFLICT_ABORT_OBJ_LIM CPX_STAT_CONFLICT_ABORT_MEM_LIM SolutionStatus = C.CPX_STAT_CONFLICT_ABORT_MEM_LIM CPX_STAT_CONFLICT_ABORT_USER SolutionStatus = C.CPX_STAT_CONFLICT_ABORT_USER CPX_STAT_CONFLICT_ABORT_DETTIME_LIM SolutionStatus = C.CPX_STAT_CONFLICT_ABORT_DETTIME_LIM CPXMIP_OPTIMAL SolutionStatus = C.CPXMIP_OPTIMAL CPXMIP_OPTIMAL_TOL SolutionStatus = C.CPXMIP_OPTIMAL_TOL CPXMIP_INFEASIBLE SolutionStatus = C.CPXMIP_INFEASIBLE CPXMIP_SOL_LIM SolutionStatus = C.CPXMIP_SOL_LIM CPXMIP_NODE_LIM_FEAS SolutionStatus = C.CPXMIP_NODE_LIM_FEAS CPXMIP_NODE_LIM_INFEAS SolutionStatus = C.CPXMIP_NODE_LIM_INFEAS CPXMIP_TIME_LIM_FEAS SolutionStatus = C.CPXMIP_TIME_LIM_FEAS CPXMIP_TIME_LIM_INFEAS SolutionStatus = C.CPXMIP_TIME_LIM_INFEAS CPXMIP_FAIL_FEAS SolutionStatus = C.CPXMIP_FAIL_FEAS CPXMIP_FAIL_INFEAS SolutionStatus = C.CPXMIP_FAIL_INFEAS CPXMIP_MEM_LIM_FEAS SolutionStatus = C.CPXMIP_MEM_LIM_FEAS CPXMIP_MEM_LIM_INFEAS SolutionStatus = C.CPXMIP_MEM_LIM_INFEAS CPXMIP_ABORT_FEAS SolutionStatus = C.CPXMIP_ABORT_FEAS CPXMIP_ABORT_INFEAS SolutionStatus = C.CPXMIP_ABORT_INFEAS CPXMIP_OPTIMAL_INFEAS SolutionStatus = C.CPXMIP_OPTIMAL_INFEAS CPXMIP_FAIL_FEAS_NO_TREE SolutionStatus = C.CPXMIP_FAIL_FEAS_NO_TREE CPXMIP_FAIL_INFEAS_NO_TREE SolutionStatus = C.CPXMIP_FAIL_INFEAS_NO_TREE CPXMIP_UNBOUNDED SolutionStatus = C.CPXMIP_UNBOUNDED CPXMIP_INForUNBD SolutionStatus = C.CPXMIP_INForUNBD CPXMIP_FEASIBLE_RELAXED_SUM SolutionStatus = C.CPXMIP_FEASIBLE_RELAXED_SUM CPXMIP_OPTIMAL_RELAXED_SUM SolutionStatus = C.CPXMIP_OPTIMAL_RELAXED_SUM CPXMIP_FEASIBLE_RELAXED_INF SolutionStatus = C.CPXMIP_FEASIBLE_RELAXED_INF CPXMIP_OPTIMAL_RELAXED_INF SolutionStatus = C.CPXMIP_OPTIMAL_RELAXED_INF CPXMIP_FEASIBLE_RELAXED_QUAD SolutionStatus = C.CPXMIP_FEASIBLE_RELAXED_QUAD CPXMIP_OPTIMAL_RELAXED_QUAD SolutionStatus = C.CPXMIP_OPTIMAL_RELAXED_QUAD CPXMIP_ABORT_RELAXED SolutionStatus = C.CPXMIP_ABORT_RELAXED CPXMIP_FEASIBLE SolutionStatus = C.CPXMIP_FEASIBLE CPXMIP_POPULATESOL_LIM SolutionStatus = C.CPXMIP_POPULATESOL_LIM CPXMIP_OPTIMAL_POPULATED SolutionStatus = C.CPXMIP_OPTIMAL_POPULATED CPXMIP_OPTIMAL_POPULATED_TOL SolutionStatus = C.CPXMIP_OPTIMAL_POPULATED_TOL CPXMIP_DETTIME_LIM_FEAS SolutionStatus = C.CPXMIP_DETTIME_LIM_FEAS CPXMIP_DETTIME_LIM_INFEAS SolutionStatus = C.CPXMIP_DETTIME_LIM_INFEAS )
func (SolutionStatus) String ¶
func (r SolutionStatus) String() string