-
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #229 from Manas23601/manas-week-5
GSoC 22 : Manas Sivakumar Week 5
- Loading branch information
Showing
19 changed files
with
342 additions
and
225 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"files.associations": { | ||
"knapsack_driver.h": "c" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
SET(LOCAL_FILES | ||
knapsack | ||
) | ||
|
||
foreach (f ${LOCAL_FILES}) | ||
|
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,17 @@ | ||
-- TODO make the single tests. | ||
CREATE TABLE knapsack_data( | ||
weight INTEGER, | ||
cost INTEGER); | ||
|
||
INSERT INTO knapsack_data (weight, cost) | ||
VALUES | ||
(12, 4), | ||
(2, 2), | ||
(1, 1), | ||
(4, 10), | ||
(1, 2); | ||
|
||
SELECT * | ||
FROM knapsack_data; | ||
|
||
SELECT * | ||
FROM vrp_knapsack($$SELECT weight, cost FROM knapsack_data$$, 3); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/usr/bin/perl -w | ||
|
||
%main::tests = ( | ||
'any' => { | ||
'comment' => 'test for or-tools', | ||
'data' => [], | ||
'newdb' => 1, | ||
'tests' => [qw( | ||
knapsack | ||
)], | ||
|
||
'documentation' => [qw( | ||
knapsack | ||
)], | ||
|
||
'nottesting' => [qw( | ||
)] | ||
}, | ||
); | ||
|
||
1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/*PGR-GNU***************************************************************** | ||
* TODO fix licence | ||
File: matrixRows_input.h | ||
Copyright (c) 2022 Manas Sivakumar | ||
manas23601@gmail.com | ||
------ | ||
This program is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation; either version 2 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program; if not, write to the Free Software | ||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
********************************************************************PGR-GNU*/ | ||
|
||
#ifndef INCLUDE_C_COMMON_WEIGHTS_COSTS_INPUT_H_ | ||
#define INCLUDE_C_COMMON_WEIGHTS_COSTS_INPUT_H_ | ||
#pragma once | ||
#include <stddef.h> | ||
|
||
typedef struct Knapsack_rt Knapsack_rt; | ||
|
||
/** @brief Get the weights and cost for each item */ | ||
void get_weights_costs( | ||
char *sql, | ||
Knapsack_rt **rows, | ||
size_t *total_rows); | ||
|
||
#endif // INCLUDE_C_COMMON_WEIGHTS_COSTS_INPUT_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/*PGR-GNU***************************************************************** | ||
File: knapsack_rt.h | ||
Copyright (c) 2022 Manas Sivakumar | ||
Mail: vicky_vergara@hotmail.com | ||
------ | ||
This program is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation; either version 2 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program; if not, write to the Free Software | ||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
********************************************************************PGR-GNU*/ | ||
/*! @file */ | ||
|
||
#ifndef INCLUDE_C_TYPES_KNAPSACK_RT_H_ | ||
#define INCLUDE_C_TYPES_KNAPSACK_RT_H_ | ||
#pragma once | ||
|
||
/* for int64_t */ | ||
#ifdef __cplusplus | ||
# include <cstdint> | ||
#else | ||
# include <stdint.h> | ||
#endif | ||
|
||
/** @brief | ||
@note C/C++/postgreSQL connecting structure for output | ||
name | description | ||
:----- | :------- | ||
Index | Position of the item in the order in which the input was given | ||
item_weight | Weight of the item | ||
item_cost | Value of the item | ||
*/ | ||
|
||
struct Knapsack_rt { | ||
int64_t item_weight; | ||
int64_t item_cost; | ||
}; | ||
|
||
/*************************************************************************/ | ||
|
||
#endif // INCLUDE_C_TYPES_KNAPSACK_RT_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
SET(LOCAL_FILES | ||
_knapsack.sql | ||
knapsack.sql | ||
_knapsack.sql | ||
) | ||
|
||
foreach (f ${LOCAL_FILES}) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.