(!********************************************************************* Mosel Example Problems ====================== file simple2.mos ```````````````` Simple LP problem Example solution to exercise 2.3 in section 2.13 of J. Kallrath: Business Optimization Using Mathematical Programming - An Introduction with Case Studies and Solutions in Various Algebraic Modeling Languages. 2nd edition, Springer Nature, Cham, 2021 author: S. Heipcke, June 2018 (c) Copyright 2020 Fair Isaac Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *********************************************************************!) model 'simple2' uses "mmxprs" declarations RV=1..4 ! Set of variables RC=1..3 ! Set of constraints C: array(RV) of real ! Objective coefficients - profits A: array(RC,RV) of real ! Constraint coefficients - resources B: array(RC) of real ! RHS values - resource limits x: array(RV) of mpvar ! The decision variables end-declarations C::[15,6,9,2] A::[10,5,25,3, 12,4,12,1, 7,0,0,1] B::[100,96,70] Profit:= sum(j in RV) C(j) * x(j) ! Objective - total profit forall(i in RC) Con(i):=sum(j in RV) A(i,j) * x(j)<= B(i) ! Constraints ! Solve the problem maximise(Profit) writeln("Solution: ", getobjval) forall(j in RV) writeln(" x", j, ":", x(j).sol) end-model