GithubHelp home page GithubHelp logo

ahmed-khalil-hafsi / p2clpfd Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 2.0 32 KB

P2CLPFD is an open source (GPLv3) dynamic programming framework that enables decisions on complex supplier allocation problems.

License: GNU General Public License v3.0

Prolog 100.00%
allocation capacity-planning procurement supply-chain supplier-allocation

p2clpfd's Introduction

P2CLPFD: A Constraint Logic Programming Framework for Procurement Professionals

This Prolog program is used for allocating a quantity of a certain part across multiple suppliers, with the objective to minimize the total cost of ownership (TCO). It also considers sourcing strategy constraints such as maximum allowed allocation per supplier, minimum and maximum possible allocations per supplier and part, and supplier capacity constraints.

Getting Started

To run this program, you will need a Prolog interpreter. This script was developed using SWI-Prolog.

Prerequisites

Installing

  1. Download or clone this repository to your local machine.
  2. Open SWI-Prolog.
  3. Navigate to the directory containing the Prolog script using the cd command in the SWI-Prolog terminal.
  4. Load the script by typing ['script.pl']., replacing script.pl with the filename of your script.

Using the Program

The main predicate in the program is global_allocate_with_constraints/2. Here is how you can use it:

?- global_allocate_with_constraints(Allocation, MaxCost).

  • Allocation is a list of quantities to be allocated to each supplier for each part.
  • MaxCost is the maximum allowed total cost. The program will find solutions where total cost is less than or equal to MaxCost.

Here's an example query:

?- global_allocate_with_constraints(Allocation, 20000).

This will find an allocation of parts across the suppliers, such that the total cost does not exceed 20000 and is as low as possible.

Supported Features & Reasoning Constraints

The procurement optimization program supports various constraints and features to fine-tune the allocation process:

  • Supplier Capacities and Costs: You can modify the capacities and costs of suppliers by using the capacity/3 and cost/3 facts. The format is capacity(Supplier, Part, Capacity) and cost(Supplier, Part, Cost), where Supplier and Part are atoms, Capacity is an integer representing the maximum quantity that the supplier can provide, and Cost is the cost per unit from the supplier.

  • Demand: Specify the demand for each part using demand/2 (format demand(Part, Quantity)).

  • Global Supplier Capacity: Specify the global capacity of each supplier using global_capacity/2 (format global_capacity(Supplier, Capacity)).

  • Allocation Ranges: Specify the range of possible allocations for each supplier and part using can/4 (format can(Part, Supplier, Min, Max)). This helps enforce sourcing strategy rules like minimum or maximum allocation to a specific supplier for a part.

License

This project is licensed under the GPLv3 License.

Copyright

Copyright (c) 2023 Ahmed Khalil Hafsi

p2clpfd's People

Contributors

ahmed-khalil-hafsi avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.