A REST API endpoint that accepts a RASON optimization, simulation optimization or stochastic optimization model, performs an
optimization and returns a result in JSON format. This call should only be used with models that solve very quickly, i.e. within
a few seconds. There is a time limit of 30 seconds on all 'Quick Solve' calls.
- URL: https://rason.net/api/optimize
- Method: POST
-
URL Params
Required: None
Optional: Any data component may be passed as a query parameter if a binding property exists for that parameter. For example, see the RASON example code snippet below.
data: {
profits: {
value: [[75, 50, 35]],
binding: 'get'
}
To change a query parameter outside of the RASON model environment, use:
$.Post("https://rason.net/api/optimize?profits=100,150,75",...
The RASON Server will map "profits=?" with "profits = 100, 150, 75". A query can return any number of rows that satisfy the filtering condition, from 0 to infinity.
To perform a query using multiple parameters (say custID, maritalStatus and age) outside of the RASON model environment, use the query parameter:
$.get(https://rason.net/api/decision?custID=c2&maritalStatus=s&age=40 .....
Or in general,
$.get(https://rason.net/api/decision?par1=val1&par2=val2.....
-
Headers:
Required: Authorization - Example: Authorization: bearer {your RASON token}
Optional: None
-
Data Params: An optimization, stochastic optimization or simulation optimization RASON Model.
{
"modelName": "productMix4Example",
"modelDescription": "Version of ProductMix using a 2-dimensional
"modelType: "optimization",
matrix",
"variables": {
"x": {
"dimensions": [ 3 ],
"value": 0,
"lower": 0,
"finalValue": []
}
},
"data": {
"profits": {
"dimensions": [ 3 ],
"value": [ 75, 50, 35 ],
"binding": "get",
"finalValue": []
},
"parts": {
"dimensions": [ 5, 3 ],
"value": [
[ 1, 1, 0 ],
[ 1, 0, 0 ],
[ 2, 2, 1 ],
[ 1, 1, 0 ],
[ 2, 1, 1 ]
]
},
"inventory": {
"value": [ 450, 250, 800, 450, 600 ]
}
},
"constraints": {
"num_used": {
"dimensions": [ 5 ],
"formula": "MMULT(parts, x)",
"upper": "inventory"
}
},
"objective": {
"total": {
"formula": "sumproduct(x, profits)",
"type": "maximize",
"finalValue": []
}
}
}
-
Success Response
Code: 200 (OK)
Example Response
Example Response:
{
"status": {
"code": 0,
"id": "2590+2020-03-18-16-16-32-113535",
"codeText": "Solver found a solution. All constraints and optimality conditions are satisfied."
},
"parametricInputs": {
"profits": {
"finalValue": [75, 50, 35]
}
},
"variables": {
"x": {
"finalValue": [200, 200, 0]
}
},
"objective": {
"total": {
"finalValue": 25000
}
}
}