AMPLRESTAPI (0.1.0)

Download OpenAPI specification:Download

Alberto Schiabel: alberto.schiabel@gmail.com

AMPLRESTAPI is a custom asynchronous REST API layer written in modern Python to solve optimization problems in AMPL. At the moment, there's a single problem available, the "Just In Time Computation" problem (JIT).

PROBLEMS

Operations that concern optimization problems

Attempts to solve the JIT problem instance with the provided JSON input.

This operation attempts to solve the JIT problem. The input data must be provided in JSON format. The input should be made of the decisional variables, the fixed malus cost and the number of programs to be computed one-at-a-time.

Request Body schema: application/json

Problem decisional variables, fixed malus cost, number of batches

duration
required
Array of integers (JITDurationArray)
expected_finish
required
Array of strings <datetime> (JITExpectedFinishArray)
wrong_time_fee
required
integer (JITWrongTimeFee)

Fixed cost (in dollars) that must be payed for each minute of early or delayed computations

n_batches
required
integer (JITNumberOfBatches)

Number of programs to be processed by the server. This parameter is used to validate the length of the array of durations and expected finish datetimes.

Responses

200

OK, return the results and some info about how AMPL and CPLEX solved the problem

400

Bad Request Error, could not parse the input data of the current request

422

Unprocessable Entity Error, the input data isn't semantically valid.

post /problems/jit

Local AMPL REST server

http://0.0.0.0:9001/problems/jit

Request samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "duration":
    [
    ],
  • "expected_finish":
    [
    ],
  • "wrong_time_fee": 750,
  • "n_batches": 4
}

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "data":
    {
    },
  • "meta":
    {
    }
}