0

I am trying to solve a problem using simplex method.Although this is a mathematical problem, I need to solve it using any programming language.I am stuck at basic phase itself about dealing those modulus, while coding the matrix Ax=B which is used to solve the problem in a general case simplex.

Route  Departure  Runtime  Arrival       Wait time\\
A-B          x        4    MOD(x+4,24)   MOD(y-(MOD(x+4,24),24)\\
B-C          y        6    MOD(y+6,24)   MOD(z-(MOD(y+6,24),24)\\
C-D          z        8    MOD(z+8,24)   MOD(8-(MOD(z+8,24),24)\\

The objective is to minimize the total wait time subject to constraints 0<= x,y,z <= 24 Simplex is not specifically required, any method may be used. edit - This is a part of much bigger problem, so just assuming z = 0 and starting won't help. I need to solve the entire thing.I want to know how to deal with the modulus.

Arav
  • 1
  • 2
  • Welcome to stackoverflow.com. Please take some time to read [the help pages](http://stackoverflow.com/help), especially the sections named ["What topics can I ask about here?"](http://stackoverflow.com/help/on-topic) and ["What types of questions should I avoid asking?"](http://stackoverflow.com/help/dont-ask). Also please [take the tour](http://stackoverflow.com/tour) and [read about how to ask good questions](http://stackoverflow.com/help/how-to-ask). Lastly please read [this question checklist](https://codeblog.jonskeet.uk/2012/11/24/stack-overflow-question-checklist/). – Some programmer dude Oct 19 '18 at 09:17

1 Answers1

0

The expression

y = mod(x,24)

is not linear so we can not use it in a continuous LP (Linear Programming) model. However, it can be modeled in a Mixed Integer Program as

x = k*24 + y 
k : integer variable
0 <= y <= 23.999 

You'll need a MIP solver for this.

Erwin Kalvelagen
  • 15,677
  • 2
  • 14
  • 39