I have a binary program and one of my variables, x_it is defined on two sets, being I: Set of objects and T: Set of the weeks of the year, thus x_it is a binary variable standing for whether object i is assigned to something on week t. The constraint I failed to implement in AMPL/GNU Mathprog is that if x_it equals to 1 then x_i(t+1) and x_i(t+2) also should take value of 1. Is there a way to implement this constraint in a simple mathematical programming language?
Implementing a constraint based on previous variable's value in GNU Mathprog/AMPL
286 Views Asked by oakenshield1 At
1
There are 1 best solutions below
Related Questions in LINEAR-PROGRAMMING
- Error in running a multi-level mixed effects model on microbiome data
- Distribute a list of positive numbers into a desired number of sets, aiming to have sums as close as possible between them
- Linearlization of quadratic constraint
- Linear program solver CBC seems to give 'optimal' solutions with different objective for the exact same problem (and code)
- PYOMO: LP Heat storage optimalization problem, I want to define the domain of a variable with discrete floats
- How to interpret shadow price array shape in Gekko
- Simultaneous Spacing and Duration Constraints with time gaps in Gekko
- Time-based spacing constraints in Gekko
- Dealing with Non-Optimal Solutions from Gekko
- How to use layered conditional constraints in Gekko
- How to enforce specific elements in a vector to be in an optimization solution in Gekko
- How to write solution file for an LP problem with Coin-or Cbc Solver?
- Randomized Relaxation of Complex Linear Assignment Problem
- ortools solvers GLOP, PDLP instantly writes that the model is infeasible
- Binary and Integer Program in Python
Related Questions in AMPL
- Pyomo not loading solvers ('couenne', 'bonmin') from ampl
- AMPL not running
- Already defined variable in AMPL
- Pyomo: reading a three dimensional parameter from a .dat file
- AMPL Syntax Error - N is already defined, but i didnt define it
- IPOPT solutions in the wrong order
- AMPL code. Error: Where is the issue? mod or dat file?
- Gurobi 10.0.1: Error: Objective Q not PSD (negative diagonal entry)
- Why each retailer is buying the same amount of each product from each supplier when I write display QuantityPurchased;
- AMPL: How can I run a for loop in AMPL to perform a logical comparison?
- Assignnemt problem - Help to write simple constraint - AMPL
- AMPL / Python - Performance & Memory issue
- Unauthorised Solver using Couenne in AMPL IDE
- I am trying to solve Min Cost problem in AMPL, but my objective function is 0
- how to implement in AMPL unsplittable flow and origin and destination contraint for a flow?
Related Questions in INTEGER-PROGRAMMING
- About MATLAB intlinprog
- Binary and Integer Program in Python
- Use min/max operator inside integer linear programming constraint
- Stuck formulating an adjacency constraint with pyomo
- Formulating a constraint with pyomo
- Does the Order of Modeling Affect Computational Speed in Pulp for Integer Programming Problems?
- Gekko not solving Integer Programming Problem
- Mibs exception FileNotFoundError: [Errno 2] No such file or directory: 'mibs.mps'
- PAO.Pyomo model sets two variables x and y to be unique
- How to implement non-zero count constraint for cvxpy in integer programming
- Keeping count of variable occurence in google OR Tools
- Order elements in a matrix based on another matrix
- How to convert the following if-else conditions to Linear integer programming constraints?
- How to define this complex labor rule as a constraint in MIP?
- setting a lower bound constraint based on condition in gekko
Related Questions in MATHPROG
- How to add divisibility constraint in GNU mathprog
- Implementing a constraint based on previous variable's value in GNU Mathprog/AMPL
- How can I bound a variable to be negative in GMPL linear programming (Gusek)?
- Multiplication of linear forms not allowed error
- Optimize with indexing in linear programming
- How to solve out of domain error in mathprog?
- How to implement a minimax combinatorial-optimization problem with MathProg (GLPK) or its API
- Modelling piecewise function in GLPK
- How to take the maximum over all columns of the sum over all rows in MathProg
- How do I define "params" in GLPK for Java API?
- Operational Research applied to SCRUM using Solver Studio (GMPL) - Golfarelli method
- Lookup table for strings (i.e., dictionary of strings/symbols) in MathProg?
- GLPK: set expression following default must have dimension 2 rather than 1
- MathProg / GLPSol - "Too many rows"
- GNU MathProg: symbolic set vs. integer set
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
The implication you want to implement is:
AMPL supports implications (with the ==> operator), so we can write this directly. MathProg does not.
A simple way to implement the implication as straightforward linear inequalities is:
This can easily be expressed in AMPL, MathProg, or any modeling tool.
This is the pure, naive translation of the question. This means however that once a single
x(i,t)=1all followingx(i,t+1),x(i,t+2),x(i,t+3)..=1. That could have been accomplished by just the constraintx(i,t+1) >= x(i,t).A better interpretation would be: we don't want very short run lengths. I.e. patterns: 010 and 0110 are not allowed. This is sometimes called a minimum up-time in machine scheduling and can be modeled in different ways.
Forbid the patterns 010 and 0110:
The pattern 01 implies 0111:
Both these approaches will prevent patterns 010 and 0110 to occur.