Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GSoC 2022: Manas Sivakumar Third and Fourth Week #225

Merged
merged 13 commits into from
Jul 6, 2022

Conversation

Manas23601
Copy link

@Manas23601 Manas23601 commented Jul 1, 2022

Changes proposed in this pull request:

  • Updated Ubuntu Github workflow to build OR-Tools in C++.
  • Updated knapsack documentation.
  • Temporarily not building OR-Tools with CMake.
  • Ensuring Code-Flow in Knapsack Driver files.
  • Implemented knapsack struct to hold data gathered from the SQL query execution.

@Manas23601 Manas23601 added the manas-2022 Done by Manas Sivakumar label Jul 1, 2022
@Manas23601 Manas23601 changed the title first commit for third week GSoC 2022: Third week Jul 1, 2022
@Manas23601 Manas23601 changed the title GSoC 2022: Third week GSoC 2022 Manas Sivakumar : Third Week Jul 1, 2022
@Manas23601 Manas23601 marked this pull request as ready for review July 3, 2022 12:16
@Manas23601
Copy link
Author

Manas23601 commented Jul 3, 2022

for knapsack_driver.h in include/or-tools do I have to make my own c_type structures as well?
I have a few question regarding the implementation:

  1. the knapsack function takes 3 arguments:
  • bin capacity
  • weights
  • values
    For now I have set the weights and values to be SQL text so that users can fetch data from tables. I believe no such tables related to this (have weights and value fields) already exist. I think we don't any structures that have access to other data points like coordinates, vehichle_id, etc or do we (any mandatory arguments )? . Now this raises two questions to me. 1) Do I really need my own structs and 2) Should I change the SQL data inputs such that weights and values are arrays of integers with 'N' items.

@krashish8
Copy link
Member

Q: Why do you want to access other data points like coordinates, vehicle_id for your knapsack function?

For the structure of your function, there are following possibilities:

  • Both weights and values are arrays of integers.
  • A table has 2 columns [weight, value] and the data is fetched from an SQL query.
  • You have 2 separate tables for weight and value, and you run 2 separate SQL queries to fetch the data.

I think the third approach is not a good one, because why run an SQL query for a table having a single column?

You can go with either the 1st or the 2nd option. The 1st approach is intuitive because say a user has a table with all the item details, then for the knapsack function, the user can fetch two columns from that table. The 2nd approach is also okay, because any way you just require weight and value for the knapsack, and don't need any additional data, so both of these values can be fed in the form of an array. Though in this approach, you need to do an extra check that the length of weight and value arrays are the same.

Yes, if such a struct does not exist, then you have to create it.

orders_sql TEXT,
max_vehicles INTEGER,
capacity FLOAT,
weights_sql TEXT,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Putting this kind of comments that are based on the sql, are useless in the C/C++ code
becuase if you change the sql then you need to look for the comments and modify accordingly.
it just implies more work for you

@Manas23601 Manas23601 changed the title GSoC 2022 Manas Sivakumar : Third Week GSoC 2022 Manas Sivakumar : Third and fourth Week Jul 5, 2022
@Manas23601 Manas23601 changed the title GSoC 2022 Manas Sivakumar : Third and fourth Week GSoC 2022 Manas Sivakumar : Third and Fourth Week Jul 5, 2022
@Manas23601
Copy link
Author

Q: Why do you want to access other data points like coordinates, vehicle_id for your knapsack function?

For the structure of your function, there are following possibilities:

  • Both weights and values are arrays of integers.
  • A table has 2 columns [weight, value] and the data is fetched from an SQL query.
  • You have 2 separate tables for weight and value, and you run 2 separate SQL queries to fetch the data.

I think the third approach is not a good one, because why run an SQL query for a table having a single column?

You can go with either the 1st or the 2nd option. The 1st approach is intuitive because say a user has a table with all the item details, then for the knapsack function, the user can fetch two columns from that table. The 2nd approach is also okay, because any way you just require weight and value for the knapsack, and don't need any additional data, so both of these values can be fed in the form of an array. Though in this approach, you need to do an extra check that the length of weight and value arrays are the same.

Yes, if such a struct does not exist, then you have to create it.

My question was not very clear. I updated it now. But I think you answered my question. Is there any need for a table with additional data columns other than weights and values ? I assume if people want to use the or-tools knapsack implementation they will be having a huge number of items so asking them to enter it as parameters would be difficult

@Manas23601 Manas23601 closed this Jul 6, 2022
@Manas23601 Manas23601 reopened this Jul 6, 2022
@Manas23601 Manas23601 merged commit 554d434 into pgRouting:manas-2022 Jul 6, 2022
@Manas23601 Manas23601 changed the title GSoC 2022 Manas Sivakumar : Third and Fourth Week GSoC 2022: Manas Sivakumar Third and Fourth Week Sep 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
manas-2022 Done by Manas Sivakumar
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants