| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Overview of Mosel examples for 'Business Optimization' book Description List of FICO Xpress Mosel implementations of examples discussed in the book 'J. Kallrath: Business Optimization Using Mathematical Programming - An Introduction with Case Studies and Solutions in Various Algebraic Modeling Languages' (2nd edition, Springer, Cham, 2021, DOI 10.1007/978-3-030-73237-0). List of provided model files(Examples marked with * are newly introduced in the 2nd edition, all other models have been converted from the mp-model versions that were provided with the 1st edition of the book in 1997.)
Source Files By clicking on a file name, a preview is opened at the bottom of this page. Data Files quadrat2.mos (!********************************************************************* Mosel Example Problems ====================== file quadrat2.mos ````````````````` Quadratic Programming problem solved as NLP Example discussed in section 11.4 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 'quadrat2' uses "mmxnlp" declarations N=3 ! Dimension of x (three variables) M=2 ! Number of linear constraints RN=1..N RM=1..M G: array(RN,RN) of real ! Coeff matrix for quadratic portion B: array(RM) of real ! RHS values of linear constraints AT: array(RM,RN) of real ! Constraint coefficient matrix g: array(RN) of real ! Coefficients of linear portion U: array(RN) of real ! Upper bounds on variables x: array(RN) of mpvar ! Decision variables end-declarations G::[6, 2, 1, 2, 4, -0.8, 1, -0.8, 2] B::[1, 1.12] AT::[1, 1, 1, 1.3, 1.2, 1.08] g::[0, 0, 0] U::[0.75, 0.75, 0.75] ! Quadratic objective function QObj:= sum(i,j in RN) G(i,j)*x(i)*x(j) + sum(i in RN) g(i)*x(i) ! Linear constraints forall(i in RM) R(i):= sum(j in RN) AT(i,j) * x(j) >= B(i) forall(i in RN) x(i) <= U(i) ! Solve the problem minimise(QObj) writeln("Solution: ", getobjval) forall(i in RN) writeln(i, ": ", x(i).sol) end-model | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
© Copyright 2023 Fair Isaac Corporation. |