LibCapy - greedy

Class implementing the greedy algoirhtm.

Macros:

Enumerations:

None.

Typedefs:

None.

Struct CapyGreedyObject :

Struct CapyGreedyObject's properties:

Gain per unit

Cost per unit

Quantity

Pointer or ID to identify the object

Struct CapyGreedyObject's methods:

None.

Struct CapyGreedyResult :

Struct CapyGreedyResult's properties:

Gain

Cost

Struct CapyGreedyResult's methods:

None.

Struct CapyGreedy :

Struct CapyGreedy's properties:

Array of objects

Struct CapyGreedy's methods:

Destructor

Run the Greedy algorithm to select the best set of objects amongst that->objects.

Input argument(s):

budget: the budget allowed to select objects

Output and side effect(s):

Return the total gain and cost , and that->objects is modified to represent the selected objects and their quantity.

Functions:

Create a CapyGreedy

Output and side effect(s):

Return a CapyGreedy

Allocate memory for a new CapyGreedy and create it

Output and side effect(s):

Return a CapyGreedy

Exception(s):

May raise CapyExc_MallocFailed.

Free the memory used by a CapyGreedy* and reset '*that' to NULL

Input argument(s):

that: a pointer to the CapyGreedy to free

2022-07-11
in LibCapy,
34 views
Copyright 2021-2024 Baillehache Pascal