CLP(R)

CLP(R) is a declarative programming language. It stands for constraint logic programming (real) where real refers to the real numbers. It can be considered and is generally implemented as a superset or add-on package for a Prolog implementation.

Example rule

The simultaneous linear equations:

are expressed in CLP(R) as:

3*X + 4*Y - 2*Z = 8,
X - 5*Y + Z = 10,
2*X + 3*Y -Z = 20.

and a typical implementation's response would be:

Z = 35.75
Y = 8.25
X = 15.5

Yes

Example program

CLP(R) allows the definition of predicates using recursive definitions. For example a mortgage relation can be defined as relating the principal P, the number of time periods of the loan T, the repayment each period R, the interest rate per period I and the final balance owing at the end of the loan B.

mg(P, T, R, I, B) :- T = 0, B = R.
mg(P, T, R, I, B) :- T >= 1, P1 = P*(1+I) - R, mg(P1, T - 1, R, I, B).

The first rule expresses that for a 0 period loan the balance owing at the end is simply the original principal. The second rule expresses that for a loan of at least one time period we can calculate the new owing amount P1 by multiplying the principal by 1 plus the interest rate and subtracting the repayment. The remainder of the loan is treated as another mortgage for the new principal and one less time period.

What can you do with it? You can ask many questions. If I borrow 1000$ for 10 years at 10% per year repaying 150 per year, how much will I owe at the end?

?- mg(1000, 10, 150, 10/100, B).

The system responds with the answer

B = 203.129.

How much can I borrow with a 10 year loan at 10% repaying 150 each year to owe nothing at the end?

?- mg(P, 10, 150, 10/100, 0).

The system responds with the answer

P = 921.685.

What is the relationship between the principal, repayment and balance on a 10 year loan at 10% interest?

?- mg(P, 10, R, 10/100, B).

The system responds with the answer

P = 0.3855*B + 6.1446 * R.

This shows the relationship between the variables, without requiring any to take a particular value.

Prolog Integration

CLP(R) has first been integrated into a Prolog system in 1994, namely into SICStus Prolog.[1] This implementation has since been ported to many popular Prolog systems, including Ciao,[2] SWI-Prolog[3] and XSB.[4]

See also

References

  1. ^ Holzbaur, Christian (1995). "OEFAI clp(q,r) Manual Revision 1.3.2". ÖFAI Technical Reports Online (95–09). Archived from the original on 20 May 2001.
  2. ^ "Introduction — The Ciao System v1.22". ciao-lang.org. Retrieved 2023-11-06.
  3. ^ "SWI-Prolog manual". www.swi-prolog.org. Retrieved 2023-11-06.
  4. ^ Swift, Theresa (13 May 2022). "Constraint Packages". The XSB System, Version 5.0, Volume 2: Interfaces and Packages. p. 71.


Read other articles:

Municipality in Catalonia, SpainBescanóMunicipalitySt. Laurence's parish church Coat of armsBescanóLocation in CataloniaShow map of Province of GironaBescanóBescanó (Spain)Show map of SpainCoordinates: 41°58′N 2°44′E / 41.967°N 2.733°E / 41.967; 2.733Country SpainCommunity CataloniaProvince GironaComarcaGironèsGovernment • MayorXavier Vinyoles i Compta (June 15th, 2019) (Esquerra Republicana)Area[1] • Total35....

 

 

Ir. H. Budi Sulistyono Bupati Ngawi ke-27Masa jabatan17 Februari 2016 – 26 Februari 2021WakilOny Anwar Harsono PendahuluSudjono (Pj.)PenggantiPetahanaMasa jabatan27 Juli 2010 – 27 Juli 2015WakilOny Anwar Harsono PendahuluHarsonoPenggantiSudjono (Pj.) Informasi pribadiLahir18 Juli 1960Ngawi, IndonesiaKebangsaanIndonesiaSuami/istriHj. Sri Eko Rustiyanti, SHAnakDrg. Hj. Vembyantika Listyan PramestiAlma materSMA Negeri 5 SurabayaFakultas Teknik Universitas Gadjah Mada Yo...

 

 

Armenian soprano (born 1957) Hasmik PapianBackground informationBorn(1961-09-02)September 2, 1961OriginYerevanMusical artist Hasmik Papian (Armenian: Հասմիկ Պապյան; born 2 September 1957)[1] is an Armenian soprano. She was awarded the People's Artist of Armenia title in 2004. Papian was named a Cultural ambassador of Armenia in the World for her contributions to Armenian culture in 2005 by the Catholicos of the Holy See of St. Echmiadzin and All Armenians Karekin II and aw...

Persekutuan Ganda pada tahun 1914: Kekaisaran Jerman (biru) dan Austria-Hungaria (merah) Persekutuan Ganda (Jerman: Doppelte Allianzcode: de is deprecated , bahasa Hongaria: Kettős Szövetség) adalah persekutuan antara Kekaisaran Jerman dan Austria-Hungaria yang dibentuk melalui perjanjian tanggal 7 Oktober 1879 sebagai bagian dari kebijakan Kanselir Jerman Otto von Bismarck dalam membentuk sistem persekutuan untuk mencegah perang.[1] Kedua negara ini berjanji akan membantu satu...

 

 

Swedish record chart and radio show Tio i ToppTicket given out by Sveriges Radio to the juryOther namesSommartoppenRunning time60 minutes (3:00 pm – 4:00 pm)Country of originSwedenLanguage(s)SwedishHome stationSveriges Radio P2 (1961–1964) Sveriges Radio P3 (1964–1974)Hosted byVariousRecording studioVariousOriginal release14 October 1961 (1961-10-14) –29 June 1974 (1974-06-29)Audio formatMonaural soundOpening themeThe Hully Gully Twist by Billy Doggett's Combo (1962...

 

 

Comes tractus ArgentoratensisNella cartina Argentoratae si trovava nella parte meridionale della provincia della Germania prima ai tempi della Notitia dignitatum (fine del IV secolo). Descrizione generaleAttivafine IV secolo - V secolo NazioneTardo impero romano ServizioEsercito romano TipoUfficiale generale dell'esercito romano Ruolocomandante di un tratto del limes renano Dimensione1 Sedecastra stativa in epoca imperiale PatronoMarte dio della guerraCristo Battaglie/guerreInvasioni barbaric...

هذه المقالة يتيمة إذ تصل إليها مقالات أخرى قليلة جدًا. فضلًا، ساعد بإضافة وصلة إليها في مقالات متعلقة بها. (سبتمبر 2018) مثَّل وضع صادرات  لحوم البقر الأمريكية في تايوان مشكلة في العلاقات التايوانية الأمريكية، وقد تركز الجدل حول حالات الإصابة بإلتهاب الدماغ الإسفنجي البقر...

 

 

† Человек прямоходящий Научная классификация Домен:ЭукариотыЦарство:ЖивотныеПодцарство:ЭуметазоиБез ранга:Двусторонне-симметричныеБез ранга:ВторичноротыеТип:ХордовыеПодтип:ПозвоночныеИнфратип:ЧелюстноротыеНадкласс:ЧетвероногиеКлада:АмниотыКлада:Синапсиды�...

 

 

For the West Point, Georgia radio station that held the call sign WPLV at 1310 AM from 1988 to 1994 and 1996 to 2015, see WPCH (AM). Radio station in Navarre, FloridaWPLVNavarre, FloridaBroadcast areaPensacola, FloridaFrequency95.7 MHzBrandingK-LOVEProgrammingFormatContemporary ChristianAffiliationsK-LOVEOwnershipOwnerEMF BroadcastingHistoryFirst air date1998Former call signsWAFN (1993–1994)WZEW (1994–1997)WGCX-FM (1997)WGCX (1997–2009)WKFP (2009–2015)Call sign meaningW PensacoLa VTec...

Sceaux 行政国 フランス地域圏 (Région) イル=ド=フランス地域圏県 (département) オー=ド=セーヌ県郡 (arrondissement) アントニー郡小郡 (canton) 小郡庁所在地INSEEコード 92071郵便番号 92330市長(任期) フィリップ・ローラン(2008年-2014年)自治体間連合 (fr) メトロポール・デュ・グラン・パリ人口動態人口 19,679人(2007年)人口密度 5466人/km2住民の呼称 Scéens地理座標 北緯48度4...

 

 

TetrisHenk Rogers (Taron Egerton) in una scena del filmLingua originaleinglese, russo Paese di produzioneStati Uniti d'America, Regno Unito Anno2023 Durata118 min Generebiografico, drammatico, thriller, storico, spionaggio RegiaJon S. Baird SoggettoNoah Pink SceneggiaturaNoah Pink ProduttoreMatthew Vaughn, Gillian Berrie, Claudia Schiffer, Len Blavatnik, Gregor Cameron Produttore esecutivoIain Mackenzie Casa di produzioneAI-Film, Apple TV+, Marv Films Distribuzione in ital...

 

 

Pour les articles homonymes, voir MSL. Meung-sur-Loire Le pont à Meung-sur-Loire. Administration Pays France Région Centre-Val de Loire Département Loiret Arrondissement Orléans Intercommunalité Communauté de communes des Terres du Val de Loire(siège) Maire Mandat Aurore Caro 2023-2026 Code postal 45130 Code commune 45203 Démographie Gentilé Magdunois Populationmunicipale 6 567 hab. (2021 ) Densité 323 hab./km2 Géographie Coordonnées 47° 49′ 46″ ...

American investment bank Hambrecht & QuistIndustryInvestment bankFounded1968FoundersBill Hambrecht, George QuistFateAcquired by Chase Manhattan Bank in 1999 Hambrecht & Quist (H&Q) was an investment bank based in San Francisco, California noted for its focus on the technology and Internet sectors. H&Q was founded by Bill Hambrecht and George Quist in California, in 1968. Apple Computer IPO 1980 H&Q was an early player in the technology sector, underwriting initial public o...

 

 

Failed bill of the UK Parliament Second Home Rule BillName and originOfficial name of legislationGovernment of Ireland Bill 1893LocationIrelandYear1893Government introducedGladstone (Liberal)Parliamentary passageHouse of Commons passed?YesHouse of Lords passed?NoRoyal Assent?Not ApplicableDefeatedWhich HouseHouse of LordsWhich stage1st stageFinal voteContent: 41; Not content 419DateSeptember 1893Details of legislationLegislature typebicameralUnicameral subdivisionnoneName(s)upper: Legislative...

 

 

Сендега Олександр СтепановичНародився19 грудня 1953(1953-12-19) (70 років)Полтва, Буський район, Львівська область, Українська РСР, СРСРAlma materЛНУ ім. І. ФранкаНагороди Орден «За заслуги» І ступеня Орден «За заслуги» ІІ ступеня Орден «За заслуги» ІІІ ступеня Лицарський Хрест орден�...

Boman Aimé Informasi pribadiNama lengkap Boman Bi Irie AiméTanggal lahir 16 Agustus 1989 (umur 34)Tempat lahir Dabou, Côte d'IvoireTinggi 1,89 m (6 ft 2+1⁄2 in)Posisi bermain DefenderInformasi klubKlub saat ini Perseru SeruiKarier senior*Tahun Tim Tampil (Gol) Société Omnisports de l'Armée 2014-2016 PSM Makassar 22 (1)2016-.... Perseru Serui * Penampilan dan gol di klub senior hanya dihitung dari liga domestik dan akurat per 30 Juni 2016 Boman Bi Irie Aim...

 

 

Belgian film director and screenwriter Lukas DhontDhont in European Parliament LUX Audience Award 2023, BrusselsBorn (1991-06-11) 11 June 1991 (age 33)[1]Ghent, Belgium[1]OccupationsDirectorscreenwriterYears active2012–presentAwardsFull list Lukas Dhont (born 11 June 1991)[1] (Dutch: [ˈlukɑz ˈdɔnt][2]) is a Belgian film director and screenwriter. His debut feature film, Girl, premiered at the 2018 Cannes Film Festival, where it won the C...

 

 

Circle of AtonementPoster rilis teatrikalNama lainHangul비밀 Hanja秘密 Alih AksaraBimil Sutradara Park Eun-gyoung Lee Dong-ha Produser Jang So-jung Lee Haeng-bok Pemeran Sung Dong-il Son Ho-jun Kim Yoo-jung Penata musikChoi In-yeongSinematograferJeon Dae-sungPenyuntingSung Su-ahPerusahaanproduksiFilm DorothyDistributorCGV ArthouseTanggal rilis 15 Oktober 2015 (2015-10-15) (Korea Selatan) Durasi101 menit[1]NegaraKorea SelatanBahasaKorea Circle of Atonement (Han...

Den här artikeln behöver källhänvisningar för att kunna verifieras. (2015-06) Åtgärda genom att lägga till pålitliga källor (gärna som fotnoter). Uppgifter utan källhänvisning kan ifrågasättas och tas bort utan att det behöver diskuteras på diskussionssidan. Lettlands historia Denna artikel är en del av en serie Tidig historiaKundakulturen (ca 8000–5000 f.Kr.)Narvakulturen (ca 5300–1750 f.Kr.)Stridsyxekulturen (ca 2950-2300 f.Kr.)Liver och Balterkulturen (ca 2000 f.Kr.-...

 

 

Hyderabad Open 2004Sport Tennis Data16 febbraio – 22 febbraio Edizione2a SuperficieCemento CampioniSingolare Nicole Pratt Doppio Liezel Huber / Sania Mirza 2003 2005 L'Hyderabad Open 2004 è stato un torneo di tennis giocato sul cemento. È stata la 2ª edizione dell'Hyderabad Open, che fa parte della categoria Tier IV nell'ambito del WTA Tour 2004. Si è giocato nella città indiana di Hyderabad dal 16 al 22 febbraio. Indice 1 Campionesse 1.1 Singolare 1.2 Doppio 2 Collegamenti esterni Cam...