solvers

package
v0.0.0-...-cc6bea1 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2025 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

A brute force solver for the "Weighted Exact Cover Problem".

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalcScLb

func CalcScLb(aC cCSMatrix, costs []float64) (float64, error)

Calculate a lower bound for the (non-exact) set covering problem instance specified by the binary matrix aC where element aC_{ij} = 1 iff element i is in subset j.

This is done using a subgradient algorithm on the Lagrangian Dual of the ILP (Integer Linear Programming) formulation of the set covering problem.

func MakeInstance

func MakeInstance(m int, subsets [][]int, costs []float64) (instance, error)

Make an Instance and check the constraints that an Instance should satisfy.

func SolveByBranchAndBound

func SolveByBranchAndBound(ins cover.Instance) (cover.SubsetsEval, error)

SolveByBranchAndBound exposes an internal method without the suffix `Internal“ and takes and returns exported types.

func SolveByBranchAndBoundInternal

func SolveByBranchAndBoundInternal(ins instance) (subsetsEval, error)

WIP

func SolveByBruteForce

func SolveByBruteForce(ins cover.Instance) (cover.SubsetsEval, error)

SolveByBruteForce exposes an internal method without the suffix `Internal“ and takes and returns exported types.

func SolveByBruteForceInternal

func SolveByBruteForceInternal(ins instance) (subsetsEval, error)

SolveByBruteForceInternal attempts finds a minimum cost exact cover for an instance by evaluating all possible selections of the subsets.

If a minimum cost exact cover exists, the returned subsetsEval will contain indices to this cover and its exactlyCovered flag will be true. Otherwise, the zero value of subsetEval will be returned.

Types

type BranchIndices

type BranchIndices struct {
	// contains filtered or unexported fields
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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